ac: fix ac_build_fdiv for f64

trivial

Fixes: a5f35aa742
This commit is contained in:
Marek Olšák 2018-10-29 17:22:03 -04:00
parent 9007c0ed26
commit 8676af12c8
1 changed files with 2 additions and 1 deletions

View File

@ -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. */