microsoft/compiler: correct dxil fma opcode
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 6 Jan 2021 07:51:18 +0000 (08:51 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 8 Jan 2021 15:09:23 +0000 (15:09 +0000)
When I originally added the FFMA opcode here, I added the FMAD opcode
instead of the FMA opcode. The reason for this is that it works on
32-bit values as well, so that seemed like a better fit.

But that's not correct, as the FMA opcode isn't a fused operation, so
let's correct the opcode.

This isn't currently in use, because we currently lower away all ffma
opcodes on the NIR level, but that's about to change.

While we're at it, let's also update the opcode name to match the DXIL
documentation.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8349>

src/microsoft/compiler/nir_to_dxil.c

index e59b1b3..e7a53d8 100644 (file)
@@ -207,7 +207,7 @@ enum dxil_intr {
    DXIL_INTR_UMAX = 39,
    DXIL_INTR_UMIN = 40,
 
-   DXIL_INTR_FFMA = 46,
+   DXIL_INTR_FMA = 47,
 
    DXIL_INTR_CREATE_HANDLE = 57,
    DXIL_INTR_CBUFFER_LOAD_LEGACY = 59,
@@ -1956,7 +1956,7 @@ emit_alu(struct ntd_context *ctx, nir_alu_instr *alu)
    case nir_op_fsqrt: return emit_unary_intin(ctx, alu, DXIL_INTR_SQRT, src[0]);
    case nir_op_fmax: return emit_binary_intin(ctx, alu, DXIL_INTR_FMAX, src[0], src[1]);
    case nir_op_fmin: return emit_binary_intin(ctx, alu, DXIL_INTR_FMIN, src[0], src[1]);
-   case nir_op_ffma: return emit_tertiary_intin(ctx, alu, DXIL_INTR_FFMA, src[0], src[1], src[2]);
+   case nir_op_ffma: return emit_tertiary_intin(ctx, alu, DXIL_INTR_FMA, src[0], src[1], src[2]);
 
    case nir_op_unpack_half_2x16_split_x: return emit_f16tof32(ctx, alu, src[0]);
    case nir_op_pack_half_2x16_split: return emit_f32tof16(ctx, alu, src[0]);