nouveau/nir: Don't try to emit OP_FMA pre-nvc0.
authorEmma Anholt <emma@anholt.net>
Sat, 26 Mar 2022 04:06:35 +0000 (21:06 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 14 Apr 2022 12:39:48 +0000 (12:39 +0000)
The TGSI backend avoids TGSI_OPCODE_FMA (and thus OP_FMA) pre-nvc0,
replacing it with TGSI_OPCODE_MAD in that case.

Noticed when looking at native-NIR stats and finding that load
optimization wasn't taking place on the unsupported opcode.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15543>

src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp

index 4c5e326..f9703fe 100644 (file)
@@ -433,6 +433,9 @@ Converter::getOperation(nir_op op)
    case nir_op_ffloor:
       return OP_FLOOR;
    case nir_op_ffma:
+      /* No FMA op pre-nvc0 */
+      if (info->target < 0xc0)
+         return OP_MAD;
       return OP_FMA;
    case nir_op_flog2:
       return OP_LG2;