summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-04-04 18:15:00 -0400
committerRob Clark <[email protected]>2015-04-05 09:24:17 -0400
commit7579ae422a0fcd8c36a6e873f5e47d0e8d158640 (patch)
treedb328ec6ced9327a3cbccb7bfd5c033649565958
parentf2ecc95e44c5798a15cde4aa67887bc562756ccd (diff)
gallium/ttn: add UMAD
Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 4935f6c6bf8..07afdb2733b 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -630,6 +630,12 @@ ttn_dph(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src)
}
static void
+ttn_umad(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src)
+{
+ ttn_move_dest(b, dest, nir_iadd(b, nir_imul(b, src[0], src[1]), src[2]));
+}
+
+static void
ttn_arr(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src)
{
ttn_move_dest(b, dest, nir_ffloor(b, nir_fadd(b, src[0], nir_imm_float(b, 0.5))));
@@ -1071,7 +1077,7 @@ static const nir_op op_trans[TGSI_OPCODE_LAST] = {
[TGSI_OPCODE_U2F] = nir_op_u2f,
[TGSI_OPCODE_UADD] = nir_op_iadd,
[TGSI_OPCODE_UDIV] = nir_op_udiv,
- [TGSI_OPCODE_UMAD] = 0, /* XXX */
+ [TGSI_OPCODE_UMAD] = 0,
[TGSI_OPCODE_UMAX] = nir_op_umax,
[TGSI_OPCODE_UMIN] = nir_op_umin,
[TGSI_OPCODE_UMOD] = nir_op_umod,
@@ -1220,6 +1226,10 @@ ttn_emit_instruction(struct ttn_compile *c)
ttn_dph(b, op_trans[tgsi_op], dest, src);
break;
+ case TGSI_OPCODE_UMAD:
+ ttn_umad(b, op_trans[tgsi_op], dest, src);
+ break;
+
case TGSI_OPCODE_LRP:
ttn_move_dest(b, dest, nir_flrp(b, src[2], src[1], src[0]));
break;