radeonsi: make use of ac_build_fdiv()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 12 Dec 2017 17:10:20 +0000 (18:10 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Dec 2017 21:24:38 +0000 (22:24 +0100)
And move the comment to amd/common.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_llvm_build.c
src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c

index b2bf1bf7b51252af63fff23eb48ac7b787a3e463..baa921d65591432a2f2a61c585edc9cc6a4db4fe 100644 (file)
@@ -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;
index a27586b3fff93fb6102f0a400c10330d5d747334..cec33c38b4e4c165c1fc70a7fe8318bac3594c33 100644 (file)
@@ -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