From ec9fe8abc730c890a76ffb6d01a3ec1099ddf264 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 19 Nov 2018 13:00:36 +1000 Subject: ac: avoid casting pointers on bcsel and stores For variable pointers we really don't want to case the pointers to int without a good reason, just add a wrapper for bcsel loading and result storing. Reviewed-by: Bas Nieuwenhuizen --- src/amd/common/ac_nir_to_llvm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/amd/common/ac_nir_to_llvm.c') diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index c7fc676abde..fb350f1ff78 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -270,8 +270,9 @@ static LLVMValueRef emit_bcsel(struct ac_llvm_context *ctx, { LLVMValueRef v = LLVMBuildICmp(ctx->builder, LLVMIntNE, src0, ctx->i32_0, ""); - return LLVMBuildSelect(ctx->builder, v, ac_to_integer(ctx, src1), - ac_to_integer(ctx, src2), ""); + return LLVMBuildSelect(ctx->builder, v, + ac_to_integer_or_pointer(ctx, src1), + ac_to_integer_or_pointer(ctx, src2), ""); } static LLVMValueRef emit_minmax_int(struct ac_llvm_context *ctx, @@ -1095,7 +1096,7 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) if (result) { assert(instr->dest.dest.is_ssa); - result = ac_to_integer(&ctx->ac, result); + result = ac_to_integer_or_pointer(&ctx->ac, result); ctx->ssa_defs[instr->dest.dest.ssa.index] = result; } } -- cgit v1.2.3