diff --git a/arch/arm64_ext.go b/arch/arm64_ext.go index 89bef17..91d1b33 100644 --- a/arch/arm64_ext.go +++ b/arch/arm64_ext.go @@ -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 diff --git a/arch/arm64_ext_test.go b/arch/arm64_ext_test.go index b86d9ed..17fb7bc 100644 --- a/arch/arm64_ext_test.go +++ b/arch/arm64_ext_test.go @@ -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)