[Mesa-dev] [PATCH] radv: Translate x/y to x*(1.0/y).

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Sat Apr 22 19:55:08 UTC 2017


Moves from accurate divides to rcp and rsq. No new CTS failures.

Signed-off-by: Bas Nieuwenhuizen <basni at google.com>
---
 src/amd/common/ac_nir_to_llvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 514c9e9ca35..081a2c2d26e 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1588,7 +1588,9 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
 	case nir_op_fdiv:
 		src[0] = to_float(ctx, src[0]);
 		src[1] = to_float(ctx, src[1]);
-		result = ac_build_fdiv(&ctx->ac, src[0], src[1]);
+
+		result = ac_build_fdiv(&ctx->ac, ctx->f32one, src[1]);
+		result = LLVMBuildFMul(ctx->builder, src[0], result, "");
 		break;
 	case nir_op_frcp:
 		src[0] = to_float(ctx, src[0]);
-- 
2.12.2



More information about the mesa-dev mailing list