feat(arch): the SVE2.1 narrowing two-to-one family
Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
ee2c6d51b3
commit
31ab584eee
4 files changed
+254
-3
No files matched your search
@@ -1338,6 +1338,62 @@ func TestArm64ExtStage3Golden(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestArm64ExtStage4Golden pins the SVE2.1 narrowing two-to-one family
|
||||
// (ZADDHNB and friends) against the toolchain-generated corpus, the same
|
||||
// provenance as the families above: every row is one arm64sveenc.s line and
|
||||
// the want word is that line's own encoding, with two extra vectors pinning
|
||||
// the widths the corpus line does not show (.H over .B, .D over .S).
|
||||
func TestArm64ExtStage4Golden(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
mnem string
|
||||
form ExtForm
|
||||
ops []ExtOperand
|
||||
want uint32
|
||||
}{
|
||||
{"ZADDHNB Z22.S, Z10.S, Z8.H", "ZADDHNB", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b66148},
|
||||
{"ZADDHNT Z22.S, Z10.S, Z8.H", "ZADDHNT", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b66548},
|
||||
{"ZRADDHNB Z22.S, Z10.S, Z8.H", "ZRADDHNB", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b66948},
|
||||
{"ZRADDHNT Z22.S, Z10.S, Z8.H", "ZRADDHNT", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b66d48},
|
||||
{"ZRSUBHNB Z22.S, Z10.S, Z8.H", "ZRSUBHNB", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b67948},
|
||||
{"ZRSUBHNT Z22.S, Z10.S, Z8.H", "ZRSUBHNT", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b67d48},
|
||||
{"ZSUBHNB Z22.S, Z10.S, Z8.H", "ZSUBHNB", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b67148},
|
||||
{"ZSUBHNT Z22.S, Z10.S, Z8.H", "ZSUBHNT", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(22, ExtArrS), ExtVector(10, ExtArrS), ExtVector(8, ExtArrH)},
|
||||
0x45b67548},
|
||||
{"ZADDHNB Z8.H, Z10.H, Z11.B", "ZADDHNB", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(8, ExtArrH), ExtVector(10, ExtArrH), ExtVector(11, ExtArrB)},
|
||||
0x4568614b},
|
||||
{"ZSUBHNT Z26.D, Z4.D, Z13.S", "ZSUBHNT", ExtFormNarrow,
|
||||
[]ExtOperand{ExtVector(26, ExtArrD), ExtVector(4, ExtArrD), ExtVector(13, ExtArrS)},
|
||||
0x45fa748d},
|
||||
} {
|
||||
in := extInstructionMeta(t, tt.mnem, tt.form, ExtQualNone, ExtArrNone)
|
||||
got, err := in.Encode(tt.ops)
|
||||
if err != nil {
|
||||
t.Errorf("%s: encode: %v", tt.name, err)
|
||||
continue
|
||||
}
|
||||
if want := hex.EncodeToString(extWordLE(tt.want)); hex.EncodeToString(got) != want {
|
||||
t.Errorf("%s:\n got %x\n want %s", tt.name, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// extSveRow finds the gather/scatter row whose mnemonic, addressing mode,
|
||||
// base size, shift and list arrangement all match.
|
||||
func extSveRow(t *testing.T, mnem string, mode uint8, shift int, base, arr ExtArrangement) ExtInstr {
|
||||
|
||||
Reference in new issue
Block a user