ac: fix ac_get_i1_sgpr_mask for Wave32
authorMarek Olšák <marek.olsak@amd.com>
Thu, 12 Dec 2019 22:00:51 +0000 (17:00 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 16 Dec 2019 20:06:07 +0000 (20:06 +0000)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3095>

src/amd/llvm/ac_llvm_build.c

index 47c27893fe50d2af2d98cd9498eeaf16cdcbe4d0..a0e9eecd8235723a040e4ab826af40ed938ed81b 100644 (file)
@@ -505,14 +505,23 @@ ac_build_ballot(struct ac_llvm_context *ctx,
 LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
                                 LLVMValueRef value)
 {
-       const char *name = LLVM_VERSION_MAJOR >= 9 ? "llvm.amdgcn.icmp.i64.i1" : "llvm.amdgcn.icmp.i1";
+       const char *name;
+
+       if (LLVM_VERSION_MAJOR >= 9) {
+               if (ctx->wave_size == 64)
+                       name = "llvm.amdgcn.icmp.i64.i1";
+               else
+                       name = "llvm.amdgcn.icmp.i32.i1";
+       } else {
+               name = "llvm.amdgcn.icmp.i1";
+       }
        LLVMValueRef args[3] = {
                value,
                ctx->i1false,
                LLVMConstInt(ctx->i32, LLVMIntNE, 0),
        };
 
-       return ac_build_intrinsic(ctx, name, ctx->i64, args, 3,
+       return ac_build_intrinsic(ctx, name, ctx->iN_wavemask, args, 3,
                                  AC_FUNC_ATTR_NOUNWIND |
                                  AC_FUNC_ATTR_READNONE |
                                  AC_FUNC_ATTR_CONVERGENT);