vc4: Add support for UMAD.
authorEric Anholt <eric@anholt.net>
Mon, 15 Dec 2014 17:24:16 +0000 (09:24 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 15 Dec 2014 22:28:23 +0000 (14:28 -0800)
src/gallium/drivers/vc4/vc4_program.c

index 781e7e2f7f17a927683671a617cfc5d49e33e587..1362170b7a3a70d61ad579d94239abd769064f5f 100644 (file)
@@ -431,6 +431,14 @@ tgsi_to_qir_umul(struct vc4_compile *c,
                                         qir_uniform_ui(c, 16)));
 }
 
+static struct qreg
+tgsi_to_qir_umad(struct vc4_compile *c,
+                 struct tgsi_full_instruction *tgsi_inst,
+                 enum qop op, struct qreg *src, int i)
+{
+        return qir_ADD(c, tgsi_to_qir_umul(c, NULL, 0, src, i), src[2 * 4 + i]);
+}
+
 static struct qreg
 tgsi_to_qir_idiv(struct vc4_compile *c,
                  struct tgsi_full_instruction *tgsi_inst,
@@ -1286,6 +1294,7 @@ emit_tgsi_instruction(struct vc4_compile *c,
                 [TGSI_OPCODE_NOT] = { QOP_NOT, tgsi_to_qir_alu },
 
                 [TGSI_OPCODE_UMUL] = { 0, tgsi_to_qir_umul },
+                [TGSI_OPCODE_UMAD] = { 0, tgsi_to_qir_umad },
                 [TGSI_OPCODE_IDIV] = { 0, tgsi_to_qir_idiv },
                 [TGSI_OPCODE_INEG] = { 0, tgsi_to_qir_ineg },