#include <stdio.h>
#include <Halide.h>

using namespace Halide;

int main(int argc, char **argv) {
    Var x, y;

    Func pred("pred");
    pred(x, y) = x < y;

    Func selector("selector");
    selector(x, y) = select(pred(x, y), 1, 0);

    // Load a vector of 8 bools
    pred.compute_root();
    selector.compute_root().vectorize(x, 8);

    RDom range(0, 100, 0, 100);
    int32_t result = evaluate<int32_t>(lambda(sum(selector(range.x, range.y))));

    assert(result == 4950);

    printf("Success!\n");
    return 0;
}

Add a test to cover the bug that was fixed recently where bool in memory is a byte, but a bool vector inside llvm is bitpacked so loading 8 bools would load a byte, not 8-bytes, if vectorized.
Add a test to cover the bug that was fixed recently where bool in
memory is a byte, but a bool vector inside llvm is bitpacked so
loading 8 bools would load a byte, not 8-bytes, if vectorized.


Former-commit-id: aedfad7bcbc248e545e7666d1a2b0cd74407c6a7