agx: Fix packing of imsub instructions

The negate for imad is on the third source (a * b - c), not the second source.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22695>
This commit is contained in:
Alyssa Rosenzweig 2023-04-28 14:49:25 -04:00
parent 8289fa253b
commit c2793a304d

View file

@ -395,7 +395,8 @@ agx_pack_alu(struct util_dynarray *emission, agx_instr *I)
unsigned sxt = (extends && !zext) ? (1 << 10) : 0;
assert(!I->src[s].neg || s == 1);
unsigned negate_src = (I->op == AGX_OPCODE_IMAD) ? 2 : 1;
assert(!I->src[s].neg || s == negate_src);
src_short |= sxt;
}
@ -408,7 +409,8 @@ agx_pack_alu(struct util_dynarray *emission, agx_instr *I)
extend |= (src_extend << extend_offset);
}
if ((I->op == AGX_OPCODE_IMAD || I->op == AGX_OPCODE_IADD) && I->src[1].neg)
if ((I->op == AGX_OPCODE_IMAD && I->src[2].neg) ||
(I->op == AGX_OPCODE_IADD && I->src[1].neg))
raw |= (1 << 27);
if (info.immediates & AGX_IMMEDIATE_TRUTH_TABLE) {