From 7579ae422a0fcd8c36a6e873f5e47d0e8d158640 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 4 Apr 2015 18:15:00 -0400 Subject: [PATCH] gallium/ttn: add UMAD Signed-off-by: Rob Clark Reviewed-by: Eric Anholt --- src/gallium/auxiliary/nir/tgsi_to_nir.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 @@ -629,6 +629,12 @@ ttn_dph(nir_builder *b, nir_op op, nir_alu_dest dest, nir_ssa_def **src) ttn_channel(b, src[1], W))); } +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) { @@ -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; -- 2.30.2