summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_llvm_build.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-10-29 17:22:03 -0400
committerMarek Olšák <[email protected]>2018-10-29 17:24:21 -0400
commit8676af12c8e8e223f186059705f189ae7d3cae60 (patch)
tree6f91ca852d138ce410a5f9e6fe39af0f1f31c48b /src/amd/common/ac_llvm_build.c
parent9007c0ed26858cb1a40d17e1f5b477d6ed3d2db7 (diff)
ac: fix ac_build_fdiv for f64
trivial Fixes: a5f35aa742c
Diffstat (limited to 'src/amd/common/ac_llvm_build.c')
-rw-r--r--src/amd/common/ac_llvm_build.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index c54a50dcd86..1392ec0f238 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -597,7 +597,8 @@ ac_build_fdiv(struct ac_llvm_context *ctx,
* If we do (num * (1 / den)), LLVM does:
* return num * v_rcp_f32(den);
*/
- LLVMValueRef rcp = LLVMBuildFDiv(ctx->builder, ctx->f32_1, den, "");
+ LLVMValueRef one = LLVMTypeOf(num) == ctx->f64 ? ctx->f64_1 : ctx->f32_1;
+ LLVMValueRef rcp = LLVMBuildFDiv(ctx->builder, one, den, "");
LLVMValueRef ret = LLVMBuildFMul(ctx->builder, num, rcp, "");
/* Use v_rcp_f32 instead of precise division. */