summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-01-11 21:11:00 +1100
committerTimothy Arceri <[email protected]>2018-01-12 09:29:18 +1100
commit7b971c828a7aaa507e9cea139f3ed932bbfc890a (patch)
treedaf3e84b5c61c1d5c91697a19fe0902bb946b7da
parent24575c815c3a8bf3457b54077b93baa5fd73c7f2 (diff)
ac/nir: fix translation of nir_op_frcp for doubles
Without this we end up with the llvm error message: "Both operands to a binary operator are not of the same type!" Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r--src/amd/common/ac_nir_to_llvm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 372a424ce51..7b348d97f0a 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1715,7 +1715,8 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
break;
case nir_op_frcp:
src[0] = ac_to_float(&ctx->ac, src[0]);
- result = ac_build_fdiv(&ctx->ac, ctx->ac.f32_1, src[0]);
+ result = ac_build_fdiv(&ctx->ac, instr->dest.dest.ssa.bit_size == 32 ? ctx->ac.f32_1 : ctx->ac.f64_1,
+ src[0]);
break;
case nir_op_iand:
result = LLVMBuildAnd(ctx->ac.builder, src[0], src[1], "");