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>
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;
}
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) {