summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2023-04-28 14:49:25 -0400
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>2023-05-11 09:23:23 -0400
commitc2793a304d4adad9e547d8b65060cd4ac255923e (patch)
tree6247ad77feb05c230bf89bd7f6ec50e89ba26245
parent8289fa253bc53422feff67c0132c78f735acf143 (diff)
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>
-rw-r--r--src/asahi/compiler/agx_pack.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/asahi/compiler/agx_pack.c b/src/asahi/compiler/agx_pack.c
index 30d15caffbc..07a2a84453a 100644
--- a/src/asahi/compiler/agx_pack.c
+++ b/src/asahi/compiler/agx_pack.c
@@ -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) {