[Mesa-dev] [PATCH v2 54/73] ac/nir: pass ac_nir_context to emit_discard_if

Nicolai Hähnle nhaehnle at gmail.com
Wed Jul 5 10:48:38 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/amd/common/ac_nir_to_llvm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index d20b0fa..bb314cb 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3589,32 +3589,32 @@ 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);
 		return;
 	}
 	ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.s.barrier",
 			   ctx->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT);
 }
 
-static void emit_discard_if(struct nir_to_llvm_context *ctx,
+static void emit_discard_if(struct ac_nir_context *ctx,
 			    const nir_intrinsic_instr *instr)
 {
 	LLVMValueRef cond;
 
-	cond = LLVMBuildICmp(ctx->builder, LLVMIntNE,
-			     get_src(ctx->nir, instr->src[0]),
-			     ctx->i32zero, "");
+	cond = LLVMBuildICmp(ctx->ac.builder, LLVMIntNE,
+			     get_src(ctx, instr->src[0]),
+			     ctx->ac.i32_0, "");
 
-	cond = LLVMBuildSelect(ctx->builder, cond,
-			       LLVMConstReal(ctx->f32, -1.0f),
-			       ctx->f32zero, "");
+	cond = LLVMBuildSelect(ctx->ac.builder, cond,
+			       LLVMConstReal(ctx->ac.f32, -1.0f),
+			       ctx->ac.f32_0, "");
 	ac_build_kill(&ctx->ac, cond);
 }
 
 static LLVMValueRef
 visit_load_local_invocation_index(struct nir_to_llvm_context *ctx)
 {
 	LLVMValueRef result;
 	LLVMValueRef thread_id = ac_get_thread_id(&ctx->ac);
 	result = LLVMBuildAnd(ctx->builder, ctx->tg_size,
 			      LLVMConstInt(ctx->i32, 0xfc0, false), "");
@@ -4057,21 +4057,21 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
 		break;
 	case nir_intrinsic_image_size:
 		result = visit_image_size(ctx, instr);
 		break;
 	case nir_intrinsic_discard:
 		ac_build_intrinsic(&ctx->ac, "llvm.AMDGPU.kilp",
 				   LLVMVoidTypeInContext(ctx->ac.context),
 				   NULL, 0, AC_FUNC_ATTR_LEGACY);
 		break;
 	case nir_intrinsic_discard_if:
-		emit_discard_if(ctx->nctx, instr);
+		emit_discard_if(ctx, instr);
 		break;
 	case nir_intrinsic_memory_barrier:
 		emit_waitcnt(ctx->nctx, VM_CNT);
 		break;
 	case nir_intrinsic_barrier:
 		emit_barrier(ctx->nctx);
 		break;
 	case nir_intrinsic_var_atomic_add:
 	case nir_intrinsic_var_atomic_imin:
 	case nir_intrinsic_var_atomic_umin:
-- 
2.9.3



More information about the mesa-dev mailing list