summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_llvm_build.c9
-rw-r--r--src/amd/common/ac_llvm_build.h2
-rw-r--r--src/amd/common/ac_nir_to_llvm.c14
3 files changed, 13 insertions, 12 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index baa921d6559..b407678c3b0 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1482,6 +1482,15 @@ LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
AC_FUNC_ATTR_LEGACY);
}
+void ac_build_waitcnt(struct ac_llvm_context *ctx, unsigned simm16)
+{
+ LLVMValueRef args[1] = {
+ LLVMConstInt(ctx->i32, simm16, false),
+ };
+ ac_build_intrinsic(ctx, "llvm.amdgcn.s.waitcnt",
+ ctx->voidt, args, 1, 0);
+}
+
void ac_get_image_intr_name(const char *base_name,
LLVMTypeRef data_type,
LLVMTypeRef coords_type,
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 655dc1dcc86..4a570c41bc5 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -286,6 +286,8 @@ LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
LLVMValueRef offset, LLVMValueRef width,
bool is_signed);
+void ac_build_waitcnt(struct ac_llvm_context *ctx, unsigned simm16);
+
void ac_get_image_intr_name(const char *base_name,
LLVMTypeRef data_type,
LLVMTypeRef coords_type,
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 25bdb341e0a..69d7bead8c1 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3674,16 +3674,6 @@ static LLVMValueRef visit_image_size(struct ac_nir_context *ctx,
#define LGKM_CNT 0x07f
#define VM_CNT 0xf70
-static void emit_waitcnt(struct nir_to_llvm_context *ctx,
- unsigned simm16)
-{
- LLVMValueRef args[1] = {
- LLVMConstInt(ctx->ac.i32, simm16, false),
- };
- ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.s.waitcnt",
- ctx->ac.voidt, args, 1, 0);
-}
-
static void emit_membar(struct nir_to_llvm_context *ctx,
const nir_intrinsic_instr *instr)
{
@@ -3706,7 +3696,7 @@ static void emit_membar(struct nir_to_llvm_context *ctx,
break;
}
if (waitcnt != NOOP_WAITCNT)
- emit_waitcnt(ctx, waitcnt);
+ ac_build_waitcnt(&ctx->ac, waitcnt);
}
static void emit_barrier(struct nir_to_llvm_context *ctx)
@@ -3717,7 +3707,7 @@ static void emit_barrier(struct nir_to_llvm_context *ctx)
*/
if (ctx->options->chip_class == SI &&
ctx->stage == MESA_SHADER_TESS_CTRL) {
- emit_waitcnt(ctx, LGKM_CNT & VM_CNT);
+ ac_build_waitcnt(&ctx->ac, LGKM_CNT & VM_CNT);
return;
}
ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.s.barrier",