ac/llvm: fix various findMSB bugs
authorMarek Olšák <marek.olsak@amd.com>
Fri, 17 Feb 2017 13:26:07 +0000 (14:26 +0100)
committerDave Airlie <airlied@redhat.com>
Fri, 17 Feb 2017 20:24:32 +0000 (06:24 +1000)
sffbh needs to be suffixed with ".i32"

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_llvm_build.c

index ed31a5606e84cf30c1dc6655ce97f54afe3db950..9751a9329dd47f8657ec9b583c4e59cdc9747552 100644 (file)
@@ -769,7 +769,8 @@ ac_emit_imsb(struct ac_llvm_context *ctx,
             LLVMValueRef arg,
             LLVMTypeRef dst_type)
 {
-       const char *intr_name = (HAVE_LLVM < 0x0400) ? "llvm.AMDGPU.flbit.i32" : "llvm.amdgcn.sffbh";
+       const char *intr_name = (HAVE_LLVM < 0x0400) ? "llvm.AMDGPU.flbit.i32" :
+                                                      "llvm.amdgcn.sffbh.i32";
        LLVMValueRef msb = ac_emit_llvm_intrinsic(ctx, intr_name,
                                                  dst_type, &arg, 1,
                                                  AC_FUNC_ATTR_READNONE);
@@ -796,7 +797,7 @@ ac_emit_umsb(struct ac_llvm_context *ctx,
 {
        LLVMValueRef args[2] = {
                arg,
-               LLVMConstInt(ctx->i32, 1, 0),
+               LLVMConstInt(ctx->i1, 1, 0),
        };
        LLVMValueRef msb = ac_emit_llvm_intrinsic(ctx, "llvm.ctlz.i32",
                                                  dst_type, args, ARRAY_SIZE(args),