ac: add ac_get_i1_sgpr_mask
authorMarek Olšák <marek.olsak@amd.com>
Tue, 12 Feb 2019 20:00:53 +0000 (15:00 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 23 Apr 2019 15:28:56 +0000 (11:28 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/amd/common/ac_llvm_build.c
src/amd/common/ac_llvm_build.h

index d75b28e1b82a7e2794b0949c02091d25a372e59d..4fdf73c99ba358d852ac5ee44a414437c0002af8 100644 (file)
@@ -461,6 +461,22 @@ ac_build_ballot(struct ac_llvm_context *ctx,
                                  AC_FUNC_ATTR_CONVERGENT);
 }
 
+LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
+                                LLVMValueRef value)
+{
+       LLVMValueRef args[3] = {
+               value,
+               ctx->i1false,
+               LLVMConstInt(ctx->i32, LLVMIntNE, 0),
+       };
+
+       assert(HAVE_LLVM >= 0x0800);
+       return ac_build_intrinsic(ctx, "llvm.amdgcn.icmp.i1", ctx->i64, args, 3,
+                                 AC_FUNC_ATTR_NOUNWIND |
+                                 AC_FUNC_ATTR_READNONE |
+                                 AC_FUNC_ATTR_CONVERGENT);
+}
+
 LLVMValueRef
 ac_build_vote_all(struct ac_llvm_context *ctx, LLVMValueRef value)
 {
index debc029f192554a397c17cfbd861fc4a92826652..f4cee667153ae705d66842eada8750ef4b52f548 100644 (file)
@@ -153,6 +153,8 @@ void ac_build_optimization_barrier(struct ac_llvm_context *ctx,
 LLVMValueRef ac_build_shader_clock(struct ac_llvm_context *ctx);
 
 LLVMValueRef ac_build_ballot(struct ac_llvm_context *ctx, LLVMValueRef value);
+LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
+                                LLVMValueRef value);
 
 LLVMValueRef ac_build_vote_all(struct ac_llvm_context *ctx, LLVMValueRef value);