rexcode/arm64: drop vestigial/redundant mnemonics; alias redundant SME names

Remove from the Mnemonic enum: LDARB_X/LDARH_X/STLRB_X/STLRH_X (no
distinct byte/half acquire-release 'X' encoding exists -- LDARB/LDARH/
STLRB/STLRH already cover them), and the 12 redundant SME names
SME_LD1{B,H,W,D,Q}_ZA / SME_ST1{...}_ZA / SME_MOVA_TO_Z / SME_MOVA_TO_ZA
(same instructions as the canonical *_TILE / MOVA_*_FROM_* forms).

The builder generator now emits delegating aliases for the redundant SME
names (inst_sme_ld1b_za :: inst_sme_ld1b_tile, ...), so the convenient
names keep working and resolve to the canonical, decode-unambiguous
encodings. With XAR_Z landed, the arm64 Mnemonic enum is now 100%
covered: every entry has an encode form. 461 tests green.
This commit is contained in:
Brendan Punsky
2026-06-18 00:42:37 -04:00
committed by Flāvius
parent 303fa9e509
commit fe7b81d64f
7 changed files with 42 additions and 20 deletions

View File

@@ -4446,3 +4446,29 @@ inst_cmn_imm :: inst_cmn_imm_r_i
emit_cmn_imm :: emit_cmn_imm_r_i
inst_tst_sr :: inst_tst_sr_r_sh
emit_tst_sr :: emit_tst_sr_r_sh
// Aliases: redundant SME names -> canonical tile/MOVA builders.
inst_sme_ld1b_za :: inst_sme_ld1b_tile
emit_sme_ld1b_za :: emit_sme_ld1b_tile
inst_sme_ld1h_za :: inst_sme_ld1h_tile
emit_sme_ld1h_za :: emit_sme_ld1h_tile
inst_sme_ld1w_za :: inst_sme_ld1w_tile
emit_sme_ld1w_za :: emit_sme_ld1w_tile
inst_sme_ld1d_za :: inst_sme_ld1d_tile
emit_sme_ld1d_za :: emit_sme_ld1d_tile
inst_sme_ld1q_za :: inst_sme_ld1q_tile
emit_sme_ld1q_za :: emit_sme_ld1q_tile
inst_sme_st1b_za :: inst_sme_st1b_tile
emit_sme_st1b_za :: emit_sme_st1b_tile
inst_sme_st1h_za :: inst_sme_st1h_tile
emit_sme_st1h_za :: emit_sme_st1h_tile
inst_sme_st1w_za :: inst_sme_st1w_tile
emit_sme_st1w_za :: emit_sme_st1w_tile
inst_sme_st1d_za :: inst_sme_st1d_tile
emit_sme_st1d_za :: emit_sme_st1d_tile
inst_sme_st1q_za :: inst_sme_st1q_tile
emit_sme_st1q_za :: emit_sme_st1q_tile
inst_sme_mova_to_z :: inst_sme_mova_z_from_tile
emit_sme_mova_to_z :: emit_sme_mova_z_from_tile
inst_sme_mova_to_za :: inst_sme_mova_tile_from_z
emit_sme_mova_to_za :: emit_sme_mova_tile_from_z

View File

@@ -160,7 +160,6 @@ Mnemonic :: enum u16 {
LDXP, STXP, LDAXP, STLXP, // exclusive pair
LDXRB, STXRB, LDAXRB, STLXRB, // exclusive byte
LDXRH, STXRH, LDAXRH, STLXRH, // exclusive halfword
LDARB_X, STLRB_X, LDARH_X, STLRH_X, // acquire/release byte/half (the existing LDARB/STLRB/LDARH/STLRH are unsigned)
LDAPR, LDAPRB, LDAPRH, // load-acquire RCpc
// -------------------------------------------------------------------------
@@ -433,9 +432,6 @@ Mnemonic :: enum u16 {
SME_BFMOPA, SME_BFMOPS,
SME_SMOPA, SME_SMOPS, SME_UMOPA, SME_UMOPS,
SME_USMOPA, SME_SUMOPA,
SME_MOVA_TO_Z, SME_MOVA_TO_ZA,
SME_LD1B_ZA, SME_LD1H_ZA, SME_LD1W_ZA, SME_LD1D_ZA, SME_LD1Q_ZA,
SME_ST1B_ZA, SME_ST1H_ZA, SME_ST1W_ZA, SME_ST1D_ZA, SME_ST1Q_ZA,
SME_LDR_ZA, SME_STR_ZA,
// -------------------------------------------------------------------------

View File

@@ -3760,10 +3760,6 @@ ENCODE_RUNS := [lib.Mnemonic]lib.Encode_Run{
.STXRH = { 380, 1},
.LDAXRH = { 381, 1},
.STLXRH = { 382, 1},
.LDARB_X = { 383, 0},
.STLRB_X = { 383, 0},
.LDARH_X = { 383, 0},
.STLRH_X = { 383, 0},
.LDAPR = { 383, 2},
.LDAPRB = { 385, 1},
.LDAPRH = { 386, 1},
@@ -4415,18 +4411,6 @@ ENCODE_RUNS := [lib.Mnemonic]lib.Encode_Run{
.SME_UMOPS = { 2159, 2},
.SME_USMOPA = { 2161, 1},
.SME_SUMOPA = { 2162, 1},
.SME_MOVA_TO_Z = { 2163, 0},
.SME_MOVA_TO_ZA = { 2163, 0},
.SME_LD1B_ZA = { 2163, 0},
.SME_LD1H_ZA = { 2163, 0},
.SME_LD1W_ZA = { 2163, 0},
.SME_LD1D_ZA = { 2163, 0},
.SME_LD1Q_ZA = { 2163, 0},
.SME_ST1B_ZA = { 2163, 0},
.SME_ST1H_ZA = { 2163, 0},
.SME_ST1W_ZA = { 2163, 0},
.SME_ST1D_ZA = { 2163, 0},
.SME_ST1Q_ZA = { 2163, 0},
.SME_LDR_ZA = { 2163, 1},
.SME_STR_ZA = { 2164, 1},
.SVE_FMLA_IDX_H = { 2165, 1},

View File

@@ -659,6 +659,22 @@ main :: proc() {
}
}
// Builder aliases for redundant SME enum names that were removed from the
// Mnemonic enum: they are the same instructions as the canonical *_TILE /
// MOVA_*_FROM_* forms, so the convenient *_za / *_to_* names delegate to them.
sme_aliases := [][2]string{
{"sme_ld1b_za", "sme_ld1b_tile"}, {"sme_ld1h_za", "sme_ld1h_tile"},
{"sme_ld1w_za", "sme_ld1w_tile"}, {"sme_ld1d_za", "sme_ld1d_tile"},
{"sme_ld1q_za", "sme_ld1q_tile"}, {"sme_st1b_za", "sme_st1b_tile"},
{"sme_st1h_za", "sme_st1h_tile"}, {"sme_st1w_za", "sme_st1w_tile"},
{"sme_st1d_za", "sme_st1d_tile"}, {"sme_st1q_za", "sme_st1q_tile"},
{"sme_mova_to_z", "sme_mova_z_from_tile"}, {"sme_mova_to_za", "sme_mova_tile_from_z"},
}
strings.write_string(&sb, "\n// Aliases: redundant SME names -> canonical tile/MOVA builders.\n")
for al in sme_aliases {
fmt.sbprintf(&sb, "inst_%s :: inst_%s\nemit_%s :: emit_%s\n", al[0], al[1], al[0], al[1])
}
output := strings.to_string(sb)
err := os.write_entire_file(#directory + "/../mnemonic_builders.odin", transmute([]u8)strings.concatenate({GEN_ATTRIB, output}))
if err == nil {