From 5ee60c860b2b30fcde454b4b8df6dcb5a1a367b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Balv=C3=ADn?= Date: Wed, 7 Oct 2026 20:29:44 +0200 Subject: [PATCH] fix(cmd/gasm): probe the arm64 operand shapes the encoder accepts Assisted-by: GLM 5.3 Flash --- cmd/gasm/audit.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cmd/gasm/audit.go b/cmd/gasm/audit.go index 340322a..c5c31ba 100644 --- a/cmd/gasm/audit.go +++ b/cmd/gasm/audit.go @@ -298,6 +298,37 @@ func probeShapes(a arch.Arch) []string { // insert/extract family, as the toolchain's own // testdata spells them. "C", "$1, $0", "$0, R1, $1, R2", + // The narrowing and lengthening vector families carry + // mixed-lane operands (the widened half names the + // operation's wide view), with and without the shift + // immediate, as arm64enc.s spells them: the plain + // halves, the doubled high halves of the 2-suffix + // forms, and the narrowing shift's reversed operand + // order. + "V1.S2, V2.D2", "V1.S4, V2.D2", "V1.B8, V2.H8", + "V1.H8, V2.S4", "V1.D2, V2.S2", "V1.D2, V2.S4", + "V9.B8, V12.H8, V14.H8", "V0.B8, V1.B8, V2.H8", + "V0.H4, V1.H4, V2.S4", "V0.S4, V1.S4, V2.D2", + "V0.H8, V1.S4, V2.S4", + "$1, V1.B8, V2.H8", "$0, V1.H8, V2.S4", + "$0, V1.B16, V2.H8", "$0, V1.S4, V2.D2", + "$7, V1.H8, V0.B8", "$15, V1.S4, V0.H8", + // The vector move immediate and the structure + // loads/stores: pairs, triples and quads in the + // bracketed register lists, loads with the base first + // and stores with the list first. + "$146, V22.B16", + "(R15), [V15.H4, V16.H4]", "(RSP), [V31.S2, V0.S2, V1.S2]", + "[V22.H8, V23.H8], (R23)", "[V1.D2, V2.D2, V3.D2], (R11)", + "[V22.D2, V23.D2, V24.D2, V25.D2], (R3)", + // The paired FP loads and stores, the CASP pair compare + // (its two value registers bracketed), the remote + // prefetch and the system operations with their bare + // operand names. + "(R0), (F1, F2)", "(F3, F4), (R5)", + "(R2, R3), (R2), (R8, R9)", + "(R6), R12, $25", + "$285440, R12", "ALLE1", } case arch.RISCV: return []string{