summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2014-10-03 15:55:12 -0400
committerEmil Velikov <emil.l.velikov@gmail.com>2014-12-03 23:59:16 +0000
commitd859a98f83952f18e859382dfa3e024ece3bd896 (patch)
tree2b73710a537f4f0c2255c43fb9cc3379abc410e6
parentfd1610d542d5eaa36f93aaa866332f819d16dc39 (diff)
freedreno/ir3: fix UMAD
Looks like none of the mad variants do u16 * u16 + u32, so just add in the extra value "by hand". Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org> (cherry picked from commit de83ef677f6d845e63f9e5e790d3078372f752df)
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
index fdd62efd62a..bc37bbaf03a 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
@@ -2136,7 +2136,7 @@ trans_cov(const struct instr_translater *t,
* madsh.m16 tmp1, a, b, tmp0 (mul-add shift high mix, i.e. ah * bl << 16)
* madsh.m16 dst, b, a, tmp1 (i.e. al * bh << 16)
*
- * For UMAD, replace first mull.u with mad.u16.
+ * For UMAD, add in the extra argument after mull.u.
*/
static void
trans_umul(const struct instr_translater *t,
@@ -2159,16 +2159,16 @@ trans_umul(const struct instr_translater *t,
if (is_rel_or_const(b))
b = get_unconst(ctx, b);
- if (t->tgsi_opc == TGSI_OPCODE_UMUL) {
- /* mull.u tmp0, a, b */
- instr = instr_create(ctx, 2, OPC_MULL_U);
- vectorize(ctx, instr, &tmp0_dst, 2, a, 0, b, 0);
- } else {
+ /* mull.u tmp0, a, b */
+ instr = instr_create(ctx, 2, OPC_MULL_U);
+ vectorize(ctx, instr, &tmp0_dst, 2, a, 0, b, 0);
+
+ if (t->tgsi_opc == TGSI_OPCODE_UMAD) {
struct tgsi_src_register *c = &inst->Src[2].Register;
- /* mad.u16 tmp0, a, b, c */
- instr = instr_create(ctx, 3, OPC_MAD_U16);
- vectorize(ctx, instr, &tmp0_dst, 3, a, 0, b, 0, c, 0);
+ /* add.u tmp0, tmp0, c */
+ instr = instr_create(ctx, 2, OPC_ADD_U);
+ vectorize(ctx, instr, &tmp0_dst, 2, tmp0_src, 0, c, 0);
}
/* madsh.m16 tmp1, a, b, tmp0 */