gallivm: Use vector selects on LLVM 3.3+.
authorJose Fonseca <jfonseca@vmware.com>
Thu, 31 Mar 2016 22:37:34 +0000 (23:37 +0100)
committerJose Fonseca <jfonseca@vmware.com>
Fri, 1 Apr 2016 08:05:19 +0000 (09:05 +0100)
This is an old patch I had around.

Vector selects seem to work well from LLVM 3.3.  Using them should
improve code quality, as it might make constant propagation pass more
effective.

Tested lp_test_*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_logic.c

index 19d30d0d63c845f900923409e2f45a394046c513..5b0b6c6b2340d5a7248d195ccc0024697cc3e9dd 100644 (file)
@@ -314,11 +314,13 @@ lp_build_select(struct lp_build_context *bld,
       mask = LLVMBuildTrunc(builder, mask, LLVMInt1TypeInContext(lc), "");
       res = LLVMBuildSelect(builder, mask, a, b, "");
    }
-   else if (0) {
+   else if (HAVE_LLVM >= 0x0303) {
       /* Generate a vector select.
        *
-       * XXX: Using vector selects would avoid emitting intrinsics, but they aren't
-       * properly supported yet.
+       * Using vector selects would avoid emitting intrinsics, but they weren't
+       * properly supported yet for a long time.
+       *
+       * LLVM 3.3 appears to reliably support it.
        *
        * LLVM 3.1 supports it, but it yields buggy code (e.g. lp_blend_test).
        *