fix(asm): read three operands from the arm64 last-element form

Assisted-by: GLM 5.3
This commit is contained in:
petrbalvin committed 2026-10-07 13:51:10 +02:00
1 parent 104bea036b
commit e56c04e9ee
2 files changed
+12 -3

No files matched your search

+6 -3
View File
@@ -529,7 +529,10 @@ const (
// ExtFormWhile is the while-compare form, PWHILELT R2, R10, P10.H:
// P10 counts the lanes where the signed comparison holds. Operands:
// Rm (R0-R30), Rn (R0-R30), Pd.T, the arrangement feeding the size
// field.
// field. The first written register is the comparison bound and the
// second the start of the count, the order the toolchain's corpus
// spells and the JIT run under qemu-user confirmed: PWHILELT R1, R0,
// P0.S with R1=4 builds four active lanes.
ExtFormWhile
// ExtFormPredicateCounter is PTRUE's counter-register form, PPTRUE
// PN14.S: the destination is a predicate-as-counter register, spelled
@@ -655,7 +658,7 @@ func (f ExtForm) Arity() int {
case ExtFormImmediate, ExtFormSignedImmediate, ExtFormPredicateFFRRead,
ExtFormPredicateMove, ExtFormPredicateUnpack, ExtFormPredicateTest,
ExtFormZMoveBare, ExtFormZFromGeneral,
ExtFormZLastReg, ExtFormZMove, ExtFormZUnpack:
ExtFormZMove, ExtFormZUnpack:
return 2
case ExtFormAmdVec3, ExtFormAmdMask2, ExtFormAmdVecGprVec:
return 3
@@ -667,7 +670,7 @@ func (f ExtForm) Arity() int {
return 2
case ExtFormPredicateOne, ExtFormPredicateWrite, ExtFormPredicateCounter:
return 1
case ExtFormZReadBack, ExtFormCountP, ExtFormCountPnW, ExtFormReduce:
case ExtFormZReadBack, ExtFormCountP, ExtFormCountPnW, ExtFormReduce, ExtFormZLastReg:
return 3
case ExtFormZSameReg, ExtFormCountPn, ExtFormCTerm:
return 2
+6
View File
@@ -1060,6 +1060,12 @@ func TestArm64ExtZGolden(t *testing.T) {
{"ZSUBR $6, Z7.D, Z7.D", "ZSUBR", ExtFormZImmediateSource, 0, ExtArrNone,
[]ExtOperand{ExtImmediate(6), ExtVector(7, ExtArrD), ExtVector(7, ExtArrD)},
0x25e3c0c7},
{"ZLASTA Z10.D, P3, R15", "ZLASTA", ExtFormZLastReg, 0, ExtArrD,
[]ExtOperand{ExtVector(10, ExtArrD), ExtPredicateSized(3, ExtArrNone), ExtGeneral(15)},
0x05e0ad4f},
{"ZLASTB Z10.D, P3, R15", "ZLASTB", ExtFormZLastReg, 0, ExtArrD,
[]ExtOperand{ExtVector(10, ExtArrD), ExtPredicateSized(3, ExtArrNone), ExtGeneral(15)},
0x05e1ad4f},
} {
in := extInstructionMeta(t, tt.mnem, tt.form, tt.qual, tt.arr)
got, err := in.Encode(tt.ops)