gallivm: fix find lsb
authorDave Airlie <airlied@redhat.com>
Mon, 20 Jan 2020 04:56:36 +0000 (14:56 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 23 Jan 2020 03:48:16 +0000 (13:48 +1000)
the GLSL return value is different than the llvm intrinsic.

Fixes arb gpu shader5 tests

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3528>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3528>

src/gallium/auxiliary/gallivm/lp_bld_bitarit.c

index eee3cba2fb5ece6ba137c82baf696162335d719b..97e5a137e8961c217a1c6b036eb0738e19a7fa76 100644 (file)
@@ -276,7 +276,8 @@ lp_build_cttz(struct lp_build_context *bld, LLVMValueRef a)
 
    LLVMValueRef undef_val = LLVMConstNull(LLVMInt1TypeInContext(bld->gallivm->context));
    result = lp_build_intrinsic_binary(builder, intr_str, bld->vec_type, a, undef_val);
-   return result;
+   return LLVMBuildSelect(builder, LLVMBuildICmp(builder, LLVMIntEQ, a, bld->zero, ""),
+                         lp_build_const_int_vec(bld->gallivm, bld->type, -1), result, "");
 }
 
 LLVMValueRef