radeonsi: allow specifying simm16 of emit_waitcnt at call sites
authorMarek Olšák <marek.olsak@amd.com>
Fri, 2 Dec 2016 17:56:21 +0000 (18:56 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Dec 2016 18:40:29 +0000 (19:40 +0100)
The next commit will use this.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_shader.c

index 018c99cf1f606e08d3fae1e79927339feebb0a14..27926d56320f9ebb9444f290029a865287ff0c81 100644 (file)
@@ -3288,12 +3288,14 @@ static void emit_optimization_barrier(struct si_shader_context *ctx)
        LLVMBuildCall(builder, inlineasm, NULL, 0, "");
 }
 
-static void emit_waitcnt(struct si_shader_context *ctx)
+#define VM_CNT 0xf70
+
+static void emit_waitcnt(struct si_shader_context *ctx, unsigned simm16)
 {
        struct gallivm_state *gallivm = &ctx->gallivm;
        LLVMBuilderRef builder = gallivm->builder;
        LLVMValueRef args[1] = {
-               lp_build_const_int32(gallivm, 0xf70)
+               lp_build_const_int32(gallivm, simm16)
        };
        lp_build_intrinsic(builder, "llvm.amdgcn.s.waitcnt",
                           ctx->voidt, args, 1, 0);
@@ -3306,7 +3308,7 @@ static void membar_emit(
 {
        struct si_shader_context *ctx = si_shader_context(bld_base);
 
-       emit_waitcnt(ctx);
+       emit_waitcnt(ctx, VM_CNT);
 }
 
 static LLVMValueRef
@@ -3710,7 +3712,7 @@ static void load_emit(
        }
 
        if (inst->Memory.Qualifier & TGSI_MEMORY_VOLATILE)
-               emit_waitcnt(ctx);
+               emit_waitcnt(ctx, VM_CNT);
 
        if (inst->Src[0].Register.File == TGSI_FILE_BUFFER) {
                load_emit_buffer(ctx, emit_data);
@@ -3919,7 +3921,7 @@ static void store_emit(
        }
 
        if (inst->Memory.Qualifier & TGSI_MEMORY_VOLATILE)
-               emit_waitcnt(ctx);
+               emit_waitcnt(ctx, VM_CNT);
 
        if (inst->Dst[0].Register.File == TGSI_FILE_BUFFER) {
                store_emit_buffer(ctx, emit_data);