fix(asm): enforce the arm64 TLBI, RPRFM, FCVT and integer-pair arities

Assisted-by: GLM 5.3
This commit is contained in:
petrbalvin committed 2026-10-07 13:49:49 +02:00
1 parent 7a69be8b59
commit 33e7fdac98
4 files changed
+140 -33

No files matched your search

+7 -26
View File
@@ -15,28 +15,15 @@ import (
// arm64AcceptedErrorShapes lists the toolchain's arm64error.s spellings gasm
// still accepts, each an acceptance superset with a known shape. The list
// only shrinks: every tightening of the encoder moves spellings out of it,
// and a spelling reappearing here means a regression.
var arm64AcceptedErrorShapes = []string{
// spelling, the .P immediate against the aggregate register size, the
// REGTMP (R27) as an explicit operand the toolchain refuses, the pair
// split paths included.
// TLBI operand arity and the range-prefetch operand shapes.
"TLBI VMALLE1IS, R0",
"TLBI ALLE3OS, ZR",
"TLBI VAE1IS",
"TLBI RVALE3",
"RPRFM (R1), RSP, PLDKEEP",
// The GP register pairs on the FP mnemonics, the other way round.
"LDP (R0), (F0, F1)",
"STP (F2, F3), (R0)",
// FCVTL exists for the S to D pair alone.
"VFCVTL V1.H4, V2.S4",
}
// and a spelling reappearing here means a regression. The catalogue is
// empty as of Go 1.27: every line the toolchain's corpus rejects, gasm
// rejects too.
var arm64AcceptedErrorShapes = []string{}
// TestArm64ToolchainErrorParity walks the toolchain's arm64error.s (Go
// 1.27, arm64) and requires gasm to reject every case the toolchain rejects,
// the documented acceptance supersets above excepted. A live Go toolchain
// is needed for the source file; the test skips without one or in -short.
// 1.27, arm64) and requires gasm to reject every case the toolchain rejects.
// A live Go toolchain is needed for the source file; the test skips without
// one or in -short.
func TestArm64ToolchainErrorParity(t *testing.T) {
if testing.Short() {
t.Skip("live arm64error.s corpus: skipped in -short mode")
@@ -65,12 +52,6 @@ func TestArm64ToolchainErrorParity(t *testing.T) {
}
body = strings.ReplaceAll(body, "\t", " ")
body = strings.Join(strings.Fields(body), " ")
// Label-relative and non-operand lines need their function context.
if strings.Contains(body, "(PC)") || strings.Contains(body, "(SB)") || strings.Contains(body, "PCALIGN") ||
strings.HasPrefix(body, "RET") || strings.HasPrefix(body, "NOP") || strings.HasPrefix(body, "BRK") ||
strings.Contains(body, "again") || strings.Contains(body, "next") || strings.Contains(body, "loop") {
continue
}
src := "#include \"textflag.h\"\n\nTEXT ·f(SB), NOSPLIT, $0-0\n\t" + body + "\n\tRET\n"
f, perr := parser.Parse("errorparity.s", src)
if len(perr) > 0 {