radv: emit fmuladd instead of fma to llvm.
authorDave Airlie <airlied@redhat.com>
Wed, 4 Oct 2017 02:06:04 +0000 (03:06 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 4 Oct 2017 05:22:44 +0000 (06:22 +0100)
For Vulkan SPIR-V the spec states
fma() Inherited from OpFMul followed by OpFAdd.

Matt says the backend will do the right thing depending on the
hardware being compiled for, if you use the fmuladd intrinsic.

Using the Mad Max pts test, on high settings at 4K:
CHP: 55->60
HGDD: 46->50
LM: 55->60
No change on Stronghold.

Thanks to Feral for spending the time to track this down.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c

index d7b6259fe8f00da200b8e578237474303638762a..11ba487f3753febf1147ce7ed1df9c97aa667343 100644 (file)
@@ -1707,7 +1707,7 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
                                                      result);
                break;
        case nir_op_ffma:
-               result = emit_intrin_3f_param(&ctx->ac, "llvm.fma",
+               result = emit_intrin_3f_param(&ctx->ac, "llvm.fmuladd",
                                              ac_to_float_type(&ctx->ac, def_type), src[0], src[1], src[2]);
                break;
        case nir_op_ibitfield_extract: