summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-10-29 17:22:03 -0400
committerJuan A. Suarez Romero <[email protected]>2018-11-06 12:14:55 +0100
commit00359407590ae567aa44fc47046323cb51c835e2 (patch)
tree6d6905f12c770c8f0319c9724e97bc0a3e2b33a7 /src/amd
parent746659919f93f1a68a71ea79a44658aeef43baa4 (diff)
ac: fix ac_build_fdiv for f64
trivial Fixes: a5f35aa742c (cherry picked from commit 8676af12c8e8e223f186059705f189ae7d3cae60)
Diffstat (limited to 'src/amd')
-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 5a7bc23a4fc..c85d2816ba9 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -573,7 +573,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. */