test(disasm): pin the toolchain's own ADDU16I.D rendering

Assisted-by: GLM 5.3 Flash
This commit is contained in:
petrbalvin authored and Petr Balvín committed 2026-10-07 21:42:14 +02:00
1 parent f661c2fc78
commit 43494a30f0
1 file changed
+19 -3
+19 -3
View File
@@ -88,14 +88,30 @@ func TestUnknownNaming(t *testing.T) {
}
}
// TestUnknownNamingBoundaries pins what stays untouched: the macro helper
// ADDU16I.D has no toolchain spelling (the assembler never takes it as
// input), so its "Unknown" render is the decoder's own and stays.
// TestUnknownNamingBoundaries pins what stays untouched: the ADDU16I.D
// render. The truth of the naming question, established against the live
// toolchain: the assembler spells the family ADDV16 (loong64enc1.s pins
// the rows and go tool asm refuses "ADDU16I.D" as input), while the
// toolchain's own disassembler names the encoding ADDU16I.D with the
// "Unknown" prefix x/arch gives the ops its Plan 9 map lacks, and `go tool
// objdump` prints exactly this text ("Unknown ADDU16I.D $16, R4" for the
// 0x10004084 the loong64enc1.s corpus carries). The render is therefore
// the toolchain's own on both counts, name and prefix, and stays.
func TestUnknownNamingBoundaries(t *testing.T) {
for _, tt := range []struct {
code []byte
text string
}{
// loong64enc1.s: ADDV16 $(-32768<<16), R4, R5 // 85000012.
{[]byte{0x85, 0x00, 0x00, 0x12}, "Unknown ADDU16I.D $-32768, R4, R5"},
// loong64enc1.s: ADDV16 $(0<<16), R4, R5 // 85000010.
{[]byte{0x85, 0x00, 0x00, 0x10}, "Unknown ADDU16I.D $0, R4, R5"},
// loong64enc1.s: ADDV16 $(8<<16), R4, R5 // 85200010.
{[]byte{0x85, 0x20, 0x00, 0x10}, "Unknown ADDU16I.D $8, R4, R5"},
// loong64enc1.s: ADDV16 $(32767<<16), R4, R5 // 85fcff11.
{[]byte{0x85, 0xfc, 0xff, 0x11}, "Unknown ADDU16I.D $32767, R4, R5"},
// loong64enc1.s: ADDV16 $(16<<16), R4 // 84400010; the destination-
// only form collapses in the renderer when rd equals rj.
{[]byte{0x84, 0x40, 0x00, 0x10}, "Unknown ADDU16I.D $16, R4"},
{[]byte{0x85, 0x00, 0x17, 0x00}, "MOVW R4, R5"},
} {