summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-01-12 12:31:00 +1100
committerTimothy Arceri <[email protected]>2018-01-14 11:40:03 +1100
commit741b21b713f0e9fd7f8df802164120e0d8486d7b (patch)
tree1c446f7f9250a7013e5252f9a2d443d6bd298c90 /src
parent4d61eb80187cd8e5984eed94f2ae3c7d6c3b3aa0 (diff)
ac/nir: fix translation of nir_op_b2i for doubles
V2: just zero-extend the 32-bit value. Fixes a number of int64 piglet tests, for example: generated_tests/spec/arb_gpu_shader_int64/execution/conversion/frag-conversion-explicit-bool-int64_t.shader_test Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 0e1fefede56..0a0b577735f 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1422,9 +1422,15 @@ static LLVMValueRef emit_f2b(struct ac_llvm_context *ctx,
}
static LLVMValueRef emit_b2i(struct ac_llvm_context *ctx,
- LLVMValueRef src0)
+ LLVMValueRef src0,
+ unsigned bitsize)
{
- return LLVMBuildAnd(ctx->builder, src0, ctx->i32_1, "");
+ LLVMValueRef result = LLVMBuildAnd(ctx->builder, src0, ctx->i32_1, "");
+
+ if (bitsize == 32)
+ return result;
+
+ return LLVMBuildZExt(ctx->builder, result, ctx->i64, "");
}
static LLVMValueRef emit_i2b(struct ac_llvm_context *ctx,
@@ -1979,7 +1985,7 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
result = emit_f2b(&ctx->ac, src[0]);
break;
case nir_op_b2i:
- result = emit_b2i(&ctx->ac, src[0]);
+ result = emit_b2i(&ctx->ac, src[0], instr->dest.dest.ssa.bit_size);
break;
case nir_op_i2b:
src[0] = ac_to_integer(&ctx->ac, src[0]);