Mesa (master): radeonsi: make use of ac_build_fdiv()

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Thu Dec 14 21:25:53 UTC 2017


Module: Mesa
Branch: master
Commit: d43e72fd8cb7cde6fa4aa4331539faa34100e68d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d43e72fd8cb7cde6fa4aa4331539faa34100e68d

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Tue Dec 12 18:10:20 2017 +0100

radeonsi: make use of ac_build_fdiv()

And move the comment to amd/common.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/common/ac_llvm_build.c                    | 1 +
 src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 8 +-------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index b2bf1bf7b5..baa921d655 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -439,6 +439,7 @@ ac_build_fdiv(struct ac_llvm_context *ctx,
 {
 	LLVMValueRef ret = LLVMBuildFDiv(ctx->builder, num, den, "");
 
+	/* Use v_rcp_f32 instead of precise division. */
 	if (!LLVMIsConstant(ret))
 		LLVMSetMetadata(ret, ctx->fpmath_md_kind, ctx->fpmath_md_2p5_ulp);
 	return ret;
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index a27586b3ff..cec33c38b4 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -668,13 +668,7 @@ static void emit_fdiv(const struct lp_build_tgsi_action *action,
 	struct si_shader_context *ctx = si_shader_context(bld_base);
 
 	emit_data->output[emit_data->chan] =
-		LLVMBuildFDiv(ctx->ac.builder,
-			      emit_data->args[0], emit_data->args[1], "");
-
-	/* Use v_rcp_f32 instead of precise division. */
-	if (!LLVMIsConstant(emit_data->output[emit_data->chan]))
-		LLVMSetMetadata(emit_data->output[emit_data->chan],
-				ctx->fpmath_md_kind, ctx->fpmath_md_2p5_ulp);
+		ac_build_fdiv(&ctx->ac, emit_data->args[0], emit_data->args[1]);
 }
 
 /* 1/sqrt is translated to rsq for f32 if fp32 denormals are not enabled in




More information about the mesa-commit mailing list