ac: add ac_build_s_barrier
authorMarek Olšák <marek.olsak@amd.com>
Tue, 14 Aug 2018 03:59:28 +0000 (23:59 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Aug 2018 00:50:37 +0000 (20:50 -0400)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_llvm_build.c
src/amd/common/ac_llvm_build.h
src/amd/common/ac_nir_to_llvm.c
src/gallium/drivers/radeonsi/si_shader.c

index 87e36df6431fb7b0ef2a5ece6b5e34d11dd719c5..c89bdf49faf5ea6b5d982f7df0286af3b44c4147 100644 (file)
@@ -348,6 +348,12 @@ ac_build_phi(struct ac_llvm_context *ctx, LLVMTypeRef type,
        return phi;
 }
 
+void ac_build_s_barrier(struct ac_llvm_context *ctx)
+{
+       ac_build_intrinsic(ctx, "llvm.amdgcn.s.barrier", ctx->voidt, NULL,
+                          0, AC_FUNC_ATTR_CONVERGENT);
+}
+
 /* Prevent optimizations (at least of memory accesses) across the current
  * point in the program by emitting empty inline assembly that is marked as
  * having side effects.
index c5753037e7bca75ec1fdd2f086c4be7889651a94..84212f0d459eb9db3614da87597734dedb0da8c2 100644 (file)
@@ -133,6 +133,7 @@ ac_build_phi(struct ac_llvm_context *ctx, LLVMTypeRef type,
             unsigned count_incoming, LLVMValueRef *values,
             LLVMBasicBlockRef *blocks);
 
+void ac_build_s_barrier(struct ac_llvm_context *ctx);
 void ac_build_optimization_barrier(struct ac_llvm_context *ctx,
                                   LLVMValueRef *pvgpr);
 
index cffc980e51f9d34e54e94bddc46d71c9242abc4d..1584fef7ab7c920fb471e2e90684511150e6df02 100644 (file)
@@ -2582,8 +2582,7 @@ void ac_emit_barrier(struct ac_llvm_context *ac, gl_shader_stage stage)
                ac_build_waitcnt(ac, LGKM_CNT & VM_CNT);
                return;
        }
-       ac_build_intrinsic(ac, "llvm.amdgcn.s.barrier",
-                          ac->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT);
+       ac_build_s_barrier(ac);
 }
 
 static void emit_discard(struct ac_nir_context *ctx,
index 81c825db1e4103522cfb42baf5ea1a54a4923a84..29523474735a392c37e57367389a89f878e9cf9f 100644 (file)
@@ -4404,9 +4404,7 @@ static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
                return;
        }
 
-       ac_build_intrinsic(&ctx->ac,
-                          "llvm.amdgcn.s.barrier",
-                          ctx->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT);
+       ac_build_s_barrier(&ctx->ac);
 }
 
 static void si_create_function(struct si_shader_context *ctx,