golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.24k stars 17.7k forks source link

x/arch: TestObjdumpARM64TestDecodeGNUSyntaxdata and TestObjdumpARM64TestDecodeGoSyntaxdata fail with binutils 2.42 #66005

Open alexsaezm opened 8 months ago

alexsaezm commented 8 months ago

Go version

go 1.22

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/golang'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/root/Code/src/github.com/golang/arch/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3014929690=/tmp/go-build -gno-record-gcc-switches'

What did you do?

While building a newer version of the arch package in Fedora I found that it doesn't build correctly on the latest version which has binutils 2.42.50 . I was able to reproduce this outside the building process by doing:

go test ./... with the newer binutils version so it is not related to the package.

Recently, ARM decided to tighten up the disassembly so objdump now matches exactly matches the specification in the AArch64 ISA document. I confirmed this by reaching out Nick Clifton from binutils.

I was going to submit a PR, but I realized that as this depends on the version the user is running, the solution is not as easy as just adapt the syntax because it will break older versions.

What did you see happen?

?       golang.org/x/arch/arm/armmap    [no test files]
ok      golang.org/x/arch/arm/armasm    (cached)
?       golang.org/x/arch/arm/armspec   [no test files]
?       golang.org/x/arch/arm64/arm64gen    [no test files]
?       golang.org/x/arch/arm64/arm64spec   [no test files]
?       golang.org/x/arch/ppc64/ppc64map    [no test files]
?       golang.org/x/arch/ppc64/ppc64spec   [no test files]
?       golang.org/x/arch/x86/x86map    [no test files]
--- FAIL: TestObjdumpARM64TestDecodeGNUSyntaxdata (0.15s)
    ext_test.go:197: decode(eca7cc4c) = "ld1 {v12.8h, v13.8h}, [sp], x12", 4, want "ld1 {v12.8h-v13.8h}, [sp], x12", 4

    ext_test.go:197: decode(b787404c) = "ld2 {v23.8h, v24.8h}, [x29]", 4, want "ld2 {v23.8h-v24.8h}, [x29]", 4

    ext_test.go:197: decode(1280df0c) = "ld2 {v18.8b, v19.8b}, [x0],#16", 4, want "ld2 {v18.8b-v19.8b}, [x0], #16", 4

    ext_test.go:197: decode(2f88c10c) = "ld2 {v15.2s, v16.2s}, [x1], x1", 4, want "ld2 {v15.2s-v16.2s}, [x1], x1", 4

    ext_test.go:197: decode(e315ff0d) = "ld2 {v3.b, v4.b}[5], [x15],#2", 4, want "ld2 {v3.b-v4.b}[5], [x15], #2", 4

    ext_test.go:197: decode(c885ff0d) = "ld2 {v8.d, v9.d}[0], [x14],#16", 4, want "ld2 {v8.d-v9.d}[0], [x14], #16", 4

    ext_test.go:197: decode(1286f34d) = "ld2 {v18.d, v19.d}[1], [x16], x19", 4, want "ld2 {v18.d-v19.d}[1], [x16], x19", 4

    ext_test.go:197: decode(1f03df0c) = "ld4 {v31.8b, v0.8b, v1.8b, v2.8b}, [x24],#32", 4, want "ld4 {v31.8b-v2.8b}, [x24], #32", 4

    ext_test.go:197: decode(fd3a604d) = "ld4 {v29.b, v30.b, v31.b, v0.b}[14], [x23]", 4, want "ld4 {v29.b-v0.b}[14], [x23]", 4

    ext_test.go:197: decode(be71ff4d) = "ld4 {v30.h, v31.h, v0.h, v1.h}[6], [x13],#8", 4, want "ld4 {v30.h-v1.h}[6], [x13], #8", 4

    ext_test.go:197: decode(cca6000c) = "st1 {v12.4h, v13.4h}, [x22]", 4, want "st1 {v12.4h-v13.4h}, [x22]", 4

    ext_test.go:197: decode(adaa9f0c) = "st1 {v13.2s, v14.2s}, [x21],#16", 4, want "st1 {v13.2s-v14.2s}, [x21], #16", 4

    ext_test.go:197: decode(bca7844c) = "st1 {v28.8h, v29.8h}, [x29], x4", 4, want "st1 {v28.8h-v29.8h}, [x29], x4", 4

    ext_test.go:197: decode(f686004c) = "st2 {v22.8h, v23.8h}, [x23]", 4, want "st2 {v22.8h-v23.8h}, [x23]", 4

    ext_test.go:197: decode(2e869f0c) = "st2 {v14.4h, v15.4h}, [x17],#16", 4, want "st2 {v14.4h-v15.4h}, [x17], #16", 4

    ext_test.go:197: decode(d200200d) = "st2 {v18.b, v19.b}[0], [x6]", 4, want "st2 {v18.b-v19.b}[0], [x6]", 4

    ext_test.go:197: decode(c491204d) = "st2 {v4.s, v5.s}[3], [x14]", 4, want "st2 {v4.s-v5.s}[3], [x14]", 4

    ext_test.go:197: decode(2b0ea04d) = "st2 {v11.b, v12.b}[11], [x17], x0", 4, want "st2 {v11.b-v12.b}[11], [x17], x0", 4

    ext_test.go:197: decode(9342af4d) = "st2 {v19.h, v20.h}[4], [x20], x15", 4, want "st2 {v19.h-v20.h}[4], [x20], x15", 4

    ext_test.go:197: decode(9b91bf4d) = "st2 {v27.s, v28.s}[3], [x12],#8", 4, want "st2 {v27.s-v28.s}[3], [x12], #8", 4

    ext_test.go:197: decode(7480a10d) = "st2 {v20.s, v21.s}[0], [x3], x1", 4, want "st2 {v20.s-v21.s}[0], [x3], x1", 4

    ext_test.go:197: decode(ae86ac4d) = "st2 {v14.d, v15.d}[1], [x21], x12", 4, want "st2 {v14.d-v15.d}[1], [x21], x12", 4

    ext_test.go:197: decode(3fa6200d) = "st4 {v31.d, v0.d, v1.d, v2.d}[0], [x17]", 4, want "st4 {v31.d-v2.d}[0], [x17]", 4

    ext_test.go:197: decode(bf26a60d) = "st4 {v31.b, v0.b, v1.b, v2.b}[1], [x21], x6", 4, want "st4 {v31.b-v2.b}[1], [x21], x6", 4

    ext_test.go:197: decode(8b23164e) = "tbl v11.16b, {v28.16b, v29.16b}, v22.16b", 4, want "tbl v11.16b, {v28.16b-v29.16b}, v22.16b", 4

    ext_test.go:197: decode(9830014e) = "tbx v24.16b, {v4.16b, v5.16b}, v1.16b", 4, want "tbx v24.16b, {v4.16b-v5.16b}, v1.16b", 4

    ext_test.go:197: decode(6e9186f8) = "prfum #0x0e, [x11,#105]", 4, want "prfum plislckeep, [x11, #105]", 4

    ext_test.go:197: decode(4aa7404c) = "ld1 {v10.8h, v11.8h}, [x26]", 4, want "ld1 {v10.8h-v11.8h}, [x26]", 4

    ext_test.go:197: decode(93a1ce0c) = "ld1 {v19.8b, v20.8b}, [x12], x14", 4, want "ld1 {v19.8b-v20.8b}, [x12], x14", 4

    ext_test.go:197: decode(4c0a604d) = "ld2 {v12.b, v13.b}[10], [x18]", 4, want "ld2 {v12.b-v13.b}[10], [x18]", 4

    ext_test.go:197: decode(061eff0d) = "ld2 {v6.b, v7.b}[7], [x16],#2", 4, want "ld2 {v6.b-v7.b}[7], [x16], #2", 4

    ext_test.go:197: decode(8a49ff4d) = "ld2 {v10.h, v11.h}[5], [x12],#4", 4, want "ld2 {v10.h-v11.h}[5], [x12], #4", 4

    ext_test.go:197: decode(5a82ff0d) = "ld2 {v26.s, v27.s}[0], [x18],#8", 4, want "ld2 {v26.s-v27.s}[0], [x18], #8", 4

    ext_test.go:197: decode(7c86ed4d) = "ld2 {v28.d, v29.d}[1], [x19], x13", 4, want "ld2 {v28.d-v29.d}[1], [x19], x13", 4

    ext_test.go:197: decode(54c0604d) = "ld2r {v20.16b, v21.16b}, [x2]", 4, want "ld2r {v20.16b-v21.16b}, [x2]", 4

    ext_test.go:197: decode(7bc5e40d) = "ld2r {v27.4h, v28.4h}, [x11], x4", 4, want "ld2r {v27.4h-v28.4h}, [x11], x4", 4

    ext_test.go:197: decode(5d78ef0d) = "ld4 {v29.h, v30.h, v31.h, v0.h}[3], [x2], x15", 4, want "ld4 {v29.h-v0.h}[3], [x2], x15", 4

    ext_test.go:197: decode(1da39f0c) = "st1 {v29.8b, v30.8b}, [x24],#16", 4, want "st1 {v29.8b-v30.8b}, [x24], #16", 4

    ext_test.go:197: decode(20a0800c) = "st1 {v0.8b, v1.8b}, [x1], x0", 4, want "st1 {v0.8b-v1.8b}, [x1], x0", 4

    ext_test.go:197: decode(e788004c) = "st2 {v7.4s, v8.4s}, [x7]", 4, want "st2 {v7.4s-v8.4s}, [x7]", 4

    ext_test.go:197: decode(a502204d) = "st2 {v5.b, v6.b}[8], [x21]", 4, want "st2 {v5.b-v6.b}[8], [x21]", 4

    ext_test.go:197: decode(0e50204d) = "st2 {v14.h, v15.h}[6], [x0]", 4, want "st2 {v14.h-v15.h}[6], [x0]", 4

    ext_test.go:197: decode(6b93204d) = "st2 {v11.s, v12.s}[3], [x27]", 4, want "st2 {v11.s-v12.s}[3], [x27]", 4

    ext_test.go:197: decode(0987200d) = "st2 {v9.d, v10.d}[0], [x24]", 4, want "st2 {v9.d-v10.d}[0], [x24]", 4

    ext_test.go:197: decode(1a09a94d) = "st2 {v26.b, v27.b}[10], [x8], x9", 4, want "st2 {v26.b-v27.b}[10], [x8], x9", 4

    ext_test.go:197: decode(1e43b00d) = "st2 {v30.h, v31.h}[0], [x24], x16", 4, want "st2 {v30.h-v31.h}[0], [x24], x16", 4

    ext_test.go:197: decode(1a82bf0d) = "st2 {v26.s, v27.s}[0], [x16],#8", 4, want "st2 {v26.s-v27.s}[0], [x16], #8", 4

    ext_test.go:197: decode(5884bf0d) = "st2 {v24.d, v25.d}[0], [x2],#16", 4, want "st2 {v24.d-v25.d}[0], [x2], #16", 4

    ext_test.go:197: decode(dfb2204d) = "st4 {v31.s, v0.s, v1.s, v2.s}[3], [x22]", 4, want "st4 {v31.s-v2.s}[3], [x22]", 4

    ext_test.go:197: decode(eb301f4e) = "tbx v11.16b, {v7.16b, v8.16b}, v31.16b", 4, want "tbx v11.16b, {v7.16b-v8.16b}, v31.16b", 4

    ext_test.go:197: decode(75a6404c) = "ld1 {v21.8h, v22.8h}, [x19]", 4, want "ld1 {v21.8h-v22.8h}, [x19]", 4

    ext_test.go:197: decode(8ba1d90c) = "ld1 {v11.8b, v12.8b}, [x12], x25", 4, want "ld1 {v11.8b-v12.8b}, [x12], x25", 4

    ext_test.go:197: decode(3f2adf4c) = "ld1 {v31.4s, v0.4s, v1.4s, v2.4s}, [x17],#64", 4, want "ld1 {v31.4s-v2.4s}, [x17], #64", 4

    ext_test.go:197: decode(5487400c) = "ld2 {v20.4h, v21.4h}, [x26]", 4, want "ld2 {v20.4h-v21.4h}, [x26]", 4

    ext_test.go:197: decode(e08adf0c) = "ld2 {v0.2s, v1.2s}, [x23],#16", 4, want "ld2 {v0.2s-v1.2s}, [x23], #16", 4

    ext_test.go:197: decode(768ac40c) = "ld2 {v22.2s, v23.2s}, [x19], x4", 4, want "ld2 {v22.2s-v23.2s}, [x19], x4", 4

    ext_test.go:197: decode(e043604d) = "ld2 {v0.h, v1.h}[4], [sp]", 4, want "ld2 {v0.h-v1.h}[4], [sp]", 4

    ext_test.go:197: decode(e585600d) = "ld2 {v5.d, v6.d}[0], [x15]", 4, want "ld2 {v5.d-v6.d}[0], [x15]", 4

    ext_test.go:197: decode(2c1aff4d) = "ld2 {v12.b, v13.b}[14], [x17],#2", 4, want "ld2 {v12.b-v13.b}[14], [x17], #2", 4

    ext_test.go:197: decode(820bfd4d) = "ld2 {v2.b, v3.b}[10], [x28], x29", 4, want "ld2 {v2.b-v3.b}[10], [x28], x29", 4

    ext_test.go:197: decode(d593ff0d) = "ld2 {v21.s, v22.s}[1], [x30],#8", 4, want "ld2 {v21.s-v22.s}[1], [x30], #8", 4

    ext_test.go:197: decode(6780ea0d) = "ld2 {v7.s, v8.s}[0], [x3], x10", 4, want "ld2 {v7.s-v8.s}[0], [x3], x10", 4

    ext_test.go:197: decode(3484ff4d) = "ld2 {v20.d, v21.d}[1], [x1],#16", 4, want "ld2 {v20.d-v21.d}[1], [x1], #16", 4

    ext_test.go:197: decode(6a86ee4d) = "ld2 {v10.d, v11.d}[1], [x19], x14", 4, want "ld2 {v10.d-v11.d}[1], [x19], x14", 4

    ext_test.go:197: decode(52ccf30d) = "ld2r {v18.1d, v19.1d}, [x2], x19", 4, want "ld2r {v18.1d-v19.1d}, [x2], x19", 4

    ext_test.go:197: decode(9e4b404c) = "ld3 {v30.4s, v31.4s, v0.4s}, [x28]", 4, want "ld3 {v30.4s-v0.4s}, [x28]", 4

    ext_test.go:197: decode(9fa4600d) = "ld4 {v31.d, v0.d, v1.d, v2.d}[0], [x4]", 4, want "ld4 {v31.d-v2.d}[0], [x4]", 4

    ext_test.go:197: decode(de22ff0d) = "ld4 {v30.b, v31.b, v0.b, v1.b}[0], [x22],#4", 4, want "ld4 {v30.b-v1.b}[0], [x22], #4", 4

    ext_test.go:197: decode(10a5004c) = "st1 {v16.8h, v17.8h}, [x8]", 4, want "st1 {v16.8h-v17.8h}, [x8]", 4

    ext_test.go:197: decode(48a69f4c) = "st1 {v8.8h, v9.8h}, [x18],#32", 4, want "st1 {v8.8h-v9.8h}, [x18], #32", 4

    ext_test.go:197: decode(dca19b4c) = "st1 {v28.16b, v29.16b}, [x14], x27", 4, want "st1 {v28.16b-v29.16b}, [x14], x27", 4

    ext_test.go:197: decode(7f279f0c) = "st1 {v31.4h, v0.4h, v1.4h, v2.4h}, [x27],#32", 4, want "st1 {v31.4h-v2.4h}, [x27], #32", 4

    ext_test.go:197: decode(bf808a0c) = "st2 {v31.8b, v0.8b}, [x5], x10", 4, want "st2 {v31.8b-v0.8b}, [x5], x10", 4

    ext_test.go:197: decode(4551204d) = "st2 {v5.h, v6.h}[6], [x10]", 4, want "st2 {v5.h-v6.h}[6], [x10]", 4

    ext_test.go:197: decode(9982204d) = "st2 {v25.s, v26.s}[2], [x20]", 4, want "st2 {v25.s-v26.s}[2], [x20]", 4

    ext_test.go:197: decode(7b02bf0d) = "st2 {v27.b, v28.b}[0], [x19],#2", 4, want "st2 {v27.b-v28.b}[0], [x19], #2", 4

    ext_test.go:197: decode(fb59a40d) = "st2 {v27.h, v28.h}[3], [x15], x4", 4, want "st2 {v27.h-v28.h}[3], [x15], x4", 4

    ext_test.go:197: decode(f880bf0d) = "st2 {v24.s, v25.s}[0], [x7],#8", 4, want "st2 {v24.s-v25.s}[0], [x7], #8", 4

    ext_test.go:197: decode(f582ac4d) = "st2 {v21.s, v22.s}[2], [x23], x12", 4, want "st2 {v21.s-v22.s}[2], [x23], x12", 4

    ext_test.go:197: decode(3386b14d) = "st2 {v19.d, v20.d}[1], [x17], x17", 4, want "st2 {v19.d-v20.d}[1], [x17], x17", 4

    ext_test.go:197: decode(5f31184e) = "tbx v31.16b, {v10.16b, v11.16b}, v24.16b", 4, want "tbx v31.16b, {v10.16b-v11.16b}, v24.16b", 4

    ext_test.go:197: decode(7aa9404c) = "ld1 {v26.4s, v27.4s}, [x11]", 4, want "ld1 {v26.4s-v27.4s}, [x11]", 4

    ext_test.go:197: decode(4007604d) = "ld2 {v0.b, v1.b}[9], [x26]", 4, want "ld2 {v0.b-v1.b}[9], [x26]", 4

    ext_test.go:197: decode(4f92600d) = "ld2 {v15.s, v16.s}[1], [x18]", 4, want "ld2 {v15.s-v16.s}[1], [x18]", 4

    ext_test.go:197: decode(631aff0d) = "ld2 {v3.b, v4.b}[6], [x19],#2", 4, want "ld2 {v3.b-v4.b}[6], [x19], #2", 4

    ext_test.go:197: decode(330ceb4d) = "ld2 {v19.b, v20.b}[11], [x1], x11", 4, want "ld2 {v19.b-v20.b}[11], [x1], x11", 4

    ext_test.go:197: decode(3b91fd0d) = "ld2 {v27.s, v28.s}[1], [x9], x29", 4, want "ld2 {v27.s-v28.s}[1], [x9], x29", 4

    ext_test.go:197: decode(b086ff4d) = "ld2 {v16.d, v17.d}[1], [x21],#16", 4, want "ld2 {v16.d-v17.d}[1], [x21], #16", 4

    ext_test.go:197: decode(dfa6d94d) = "ld3 {v31.d, v0.d, v1.d}[1], [x22], x25", 4, want "ld3 {v31.d-v1.d}[1], [x22], x25", 4

    ext_test.go:197: decode(eea99f4c) = "st1 {v14.4s, v15.4s}, [x15],#32", 4, want "st1 {v14.4s-v15.4s}, [x15], #32", 4

    ext_test.go:197: decode(1e87000c) = "st2 {v30.4h, v31.4h}, [x24]", 4, want "st2 {v30.4h-v31.4h}, [x24]", 4

    ext_test.go:197: decode(07829f0c) = "st2 {v7.8b, v8.8b}, [x16],#16", 4, want "st2 {v7.8b-v8.8b}, [x16], #16", 4

    ext_test.go:197: decode(d38a884c) = "st2 {v19.4s, v20.4s}, [x22], x8", 4, want "st2 {v19.4s-v20.4s}, [x22], x8", 4

    ext_test.go:197: decode(9180200d) = "st2 {v17.s, v18.s}[0], [x4]", 4, want "st2 {v17.s-v18.s}[0], [x4]", 4

    ext_test.go:197: decode(3b08b44d) = "st2 {v27.b, v28.b}[10], [x1], x20", 4, want "st2 {v27.b-v28.b}[10], [x1], x20", 4

    ext_test.go:197: decode(6290a80d) = "st2 {v2.s, v3.s}[1], [x3], x8", 4, want "st2 {v2.s-v3.s}[1], [x3], x8", 4

    ext_test.go:197: decode(b587bf4d) = "st2 {v21.d, v22.d}[1], [x29],#16", 4, want "st2 {v21.d-v22.d}[1], [x29], #16", 4

    ext_test.go:197: decode(3e05000c) = "st4 {v30.4h, v31.4h, v0.4h, v1.4h}, [x9]", 4, want "st4 {v30.4h-v1.4h}, [x9]", 4

    ext_test.go:197: decode(7fa4200d) = "st4 {v31.d, v0.d, v1.d, v2.d}[0], [x3]", 4, want "st4 {v31.d-v2.d}[0], [x3]", 4

    ext_test.go:197: decode(f920030e) = "tbl v25.8b, {v7.16b, v8.16b}, v3.8b", 4, want "tbl v25.8b, {v7.16b-v8.16b}, v3.8b", 4

    ext_test.go:203: 4757 test cases, 879 expected mismatches, 176 failures; 69530 cases/second
    ext_test.go:204: decoder coverage: 96.5%;
    ext_test.go:203: 4757 test cases, 0 expected mismatches, 0 failures; 71731 cases/second
    ext_test.go:204: decoder coverage: 96.5%;
--- FAIL: TestObjdumpARM64TestDecodeGoSyntaxdata (0.14s)
    ext_test.go:197: decode(c62184f8) = "prfum #0x06, [x14,#66]", 4, want "prfum pldslckeep, [x14, #66]", 4

    ext_test.go:197: decode(8ea8404c) = "ld1 {v14.4s, v15.4s}, [x4]", 4, want "ld1 {v14.4s-v15.4s}, [x4]", 4

    ext_test.go:197: decode(b787404c) = "ld2 {v23.8h, v24.8h}, [x29]", 4, want "ld2 {v23.8h-v24.8h}, [x29]", 4

    ext_test.go:197: decode(1280df0c) = "ld2 {v18.8b, v19.8b}, [x0],#16", 4, want "ld2 {v18.8b-v19.8b}, [x0], #16", 4

    ext_test.go:197: decode(a01e604d) = "ld2 {v0.b, v1.b}[15], [x21]", 4, want "ld2 {v0.b-v1.b}[15], [x21]", 4

    ext_test.go:197: decode(eb82604d) = "ld2 {v11.s, v12.s}[2], [x23]", 4, want "ld2 {v11.s-v12.s}[2], [x23]", 4

    ext_test.go:197: decode(e315ff0d) = "ld2 {v3.b, v4.b}[5], [x15],#2", 4, want "ld2 {v3.b-v4.b}[5], [x15], #2", 4

    ext_test.go:197: decode(1c11f24d) = "ld2 {v28.b, v29.b}[12], [x8], x18", 4, want "ld2 {v28.b-v29.b}[12], [x8], x18", 4

    ext_test.go:197: decode(f341ef4d) = "ld2 {v19.h, v20.h}[4], [x15], x15", 4, want "ld2 {v19.h-v20.h}[4], [x15], x15", 4

    ext_test.go:197: decode(5a80ff4d) = "ld2 {v26.s, v27.s}[2], [x2],#8", 4, want "ld2 {v26.s-v27.s}[2], [x2], #8", 4

    ext_test.go:197: decode(06c2600d) = "ld2r {v6.8b, v7.8b}, [x16]", 4, want "ld2r {v6.8b-v7.8b}, [x16]", 4

    ext_test.go:197: decode(be71ff4d) = "ld4 {v30.h, v31.h, v0.h, v1.h}[6], [x13],#8", 4, want "ld4 {v30.h-v1.h}[6], [x13], #8", 4

    ext_test.go:197: decode(cca6000c) = "st1 {v12.4h, v13.4h}, [x22]", 4, want "st1 {v12.4h-v13.4h}, [x22]", 4

    ext_test.go:197: decode(adaa9f0c) = "st1 {v13.2s, v14.2s}, [x21],#16", 4, want "st1 {v13.2s-v14.2s}, [x21], #16", 4

    ext_test.go:197: decode(bca7844c) = "st1 {v28.8h, v29.8h}, [x29], x4", 4, want "st1 {v28.8h-v29.8h}, [x29], x4", 4

    ext_test.go:197: decode(d200200d) = "st2 {v18.b, v19.b}[0], [x6]", 4, want "st2 {v18.b-v19.b}[0], [x6]", 4

    ext_test.go:197: decode(c491204d) = "st2 {v4.s, v5.s}[3], [x14]", 4, want "st2 {v4.s-v5.s}[3], [x14]", 4

    ext_test.go:197: decode(2b0ea04d) = "st2 {v11.b, v12.b}[11], [x17], x0", 4, want "st2 {v11.b-v12.b}[11], [x17], x0", 4

    ext_test.go:197: decode(4042bf0d) = "st2 {v0.h, v1.h}[0], [x18],#4", 4, want "st2 {v0.h-v1.h}[0], [x18], #4", 4

    ext_test.go:197: decode(7480a10d) = "st2 {v20.s, v21.s}[0], [x3], x1", 4, want "st2 {v20.s-v21.s}[0], [x3], x1", 4

    ext_test.go:197: decode(ae86ac4d) = "st2 {v14.d, v15.d}[1], [x21], x12", 4, want "st2 {v14.d-v15.d}[1], [x21], x12", 4

    ext_test.go:197: decode(3fa6200d) = "st4 {v31.d, v0.d, v1.d, v2.d}[0], [x17]", 4, want "st4 {v31.d-v2.d}[0], [x17]", 4

    ext_test.go:197: decode(8b23164e) = "tbl v11.16b, {v28.16b, v29.16b}, v22.16b", 4, want "tbl v11.16b, {v28.16b-v29.16b}, v22.16b", 4

    ext_test.go:197: decode(9830014e) = "tbx v24.16b, {v4.16b, v5.16b}, v1.16b", 4, want "tbx v24.16b, {v4.16b-v5.16b}, v1.16b", 4

    ext_test.go:197: decode(5ca3df4c) = "ld1 {v28.16b, v29.16b}, [x26],#32", 4, want "ld1 {v28.16b-v29.16b}, [x26], #32", 4

    ext_test.go:197: decode(93a1ce0c) = "ld1 {v19.8b, v20.8b}, [x12], x14", 4, want "ld1 {v19.8b-v20.8b}, [x12], x14", 4

    ext_test.go:197: decode(5384404c) = "ld2 {v19.8h, v20.8h}, [x2]", 4, want "ld2 {v19.8h-v20.8h}, [x2]", 4

    ext_test.go:197: decode(ca87df0c) = "ld2 {v10.4h, v11.4h}, [x30],#16", 4, want "ld2 {v10.4h-v11.4h}, [x30], #16", 4

    ext_test.go:197: decode(4c0a604d) = "ld2 {v12.b, v13.b}[10], [x18]", 4, want "ld2 {v12.b-v13.b}[10], [x18]", 4

    ext_test.go:197: decode(3080600d) = "ld2 {v16.s, v17.s}[0], [x1]", 4, want "ld2 {v16.s-v17.s}[0], [x1]", 4

    ext_test.go:197: decode(6686600d) = "ld2 {v6.d, v7.d}[0], [x19]", 4, want "ld2 {v6.d-v7.d}[0], [x19]", 4

    ext_test.go:197: decode(061eff0d) = "ld2 {v6.b, v7.b}[7], [x16],#2", 4, want "ld2 {v6.b-v7.b}[7], [x16], #2", 4

    ext_test.go:197: decode(db05fa0d) = "ld2 {v27.b, v28.b}[1], [x14], x26", 4, want "ld2 {v27.b-v28.b}[1], [x14], x26", 4

    ext_test.go:197: decode(6180e30d) = "ld2 {v1.s, v2.s}[0], [x3], x3", 4, want "ld2 {v1.s-v2.s}[0], [x3], x3", 4

    ext_test.go:197: decode(6485ff0d) = "ld2 {v4.d, v5.d}[0], [x11],#16", 4, want "ld2 {v4.d-v5.d}[0], [x11], #16", 4

    ext_test.go:197: decode(54c0604d) = "ld2r {v20.16b, v21.16b}, [x2]", 4, want "ld2r {v20.16b-v21.16b}, [x2]", 4

    ext_test.go:197: decode(cea4000c) = "st1 {v14.4h, v15.4h}, [x6]", 4, want "st1 {v14.4h-v15.4h}, [x6]", 4

    ext_test.go:197: decode(20a0800c) = "st1 {v0.8b, v1.8b}, [x1], x0", 4, want "st1 {v0.8b-v1.8b}, [x1], x0", 4

    ext_test.go:197: decode(e788004c) = "st2 {v7.4s, v8.4s}, [x7]", 4, want "st2 {v7.4s-v8.4s}, [x7]", 4

    ext_test.go:197: decode(79889f0c) = "st2 {v25.2s, v26.2s}, [x3],#16", 4, want "st2 {v25.2s-v26.2s}, [x3], #16", 4

    ext_test.go:197: decode(0e50204d) = "st2 {v14.h, v15.h}[6], [x0]", 4, want "st2 {v14.h-v15.h}[6], [x0]", 4

    ext_test.go:197: decode(6b93204d) = "st2 {v11.s, v12.s}[3], [x27]", 4, want "st2 {v11.s-v12.s}[3], [x27]", 4

    ext_test.go:197: decode(7003bf0d) = "st2 {v16.b, v17.b}[0], [x27],#2", 4, want "st2 {v16.b-v17.b}[0], [x27], #2", 4

    ext_test.go:197: decode(1e43b00d) = "st2 {v30.h, v31.h}[0], [x24], x16", 4, want "st2 {v30.h-v31.h}[0], [x24], x16", 4

    ext_test.go:197: decode(1a82bf0d) = "st2 {v26.s, v27.s}[0], [x16],#8", 4, want "st2 {v26.s-v27.s}[0], [x16], #8", 4

    ext_test.go:197: decode(9892a50d) = "st2 {v24.s, v25.s}[1], [x20], x5", 4, want "st2 {v24.s-v25.s}[1], [x20], x5", 4

    ext_test.go:197: decode(5fb38c0d) = "st3 {v31.s, v0.s, v1.s}[1], [x26], x12", 4, want "st3 {v31.s-v1.s}[1], [x26], x12", 4

    ext_test.go:197: decode(dfb2204d) = "st4 {v31.s, v0.s, v1.s, v2.s}[3], [x22]", 4, want "st4 {v31.s-v2.s}[3], [x22]", 4

    ext_test.go:197: decode(25231c4e) = "tbl v5.16b, {v25.16b, v26.16b}, v28.16b", 4, want "tbl v5.16b, {v25.16b-v26.16b}, v28.16b", 4

    ext_test.go:197: decode(75a6404c) = "ld1 {v21.8h, v22.8h}, [x19]", 4, want "ld1 {v21.8h-v22.8h}, [x19]", 4

    ext_test.go:197: decode(3f2adf4c) = "ld1 {v31.4s, v0.4s, v1.4s, v2.4s}, [x17],#64", 4, want "ld1 {v31.4s-v2.4s}, [x17], #64", 4

    ext_test.go:197: decode(e08adf0c) = "ld2 {v0.2s, v1.2s}, [x23],#16", 4, want "ld2 {v0.2s-v1.2s}, [x23], #16", 4

    ext_test.go:197: decode(4c0f604d) = "ld2 {v12.b, v13.b}[11], [x26]", 4, want "ld2 {v12.b-v13.b}[11], [x26]", 4

    ext_test.go:197: decode(2c1aff4d) = "ld2 {v12.b, v13.b}[14], [x17],#2", 4, want "ld2 {v12.b-v13.b}[14], [x17], #2", 4

    ext_test.go:197: decode(d593ff0d) = "ld2 {v21.s, v22.s}[1], [x30],#8", 4, want "ld2 {v21.s-v22.s}[1], [x30], #8", 4

    ext_test.go:197: decode(3484ff4d) = "ld2 {v20.d, v21.d}[1], [x1],#16", 4, want "ld2 {v20.d-v21.d}[1], [x1], #16", 4

    ext_test.go:197: decode(e4c7604d) = "ld2r {v4.8h, v5.8h}, [sp]", 4, want "ld2r {v4.8h-v5.8h}, [sp]", 4

    ext_test.go:197: decode(52ccf30d) = "ld2r {v18.1d, v19.1d}, [x2], x19", 4, want "ld2r {v18.1d-v19.1d}, [x2], x19", 4

    ext_test.go:197: decode(9e4b404c) = "ld3 {v30.4s, v31.4s, v0.4s}, [x28]", 4, want "ld3 {v30.4s-v0.4s}, [x28]", 4

    ext_test.go:197: decode(9fa4600d) = "ld4 {v31.d, v0.d, v1.d, v2.d}[0], [x4]", 4, want "ld4 {v31.d-v2.d}[0], [x4]", 4

    ext_test.go:197: decode(10a5004c) = "st1 {v16.8h, v17.8h}, [x8]", 4, want "st1 {v16.8h-v17.8h}, [x8]", 4

    ext_test.go:197: decode(48a69f4c) = "st1 {v8.8h, v9.8h}, [x18],#32", 4, want "st1 {v8.8h-v9.8h}, [x18], #32", 4

    ext_test.go:197: decode(7f279f0c) = "st1 {v31.4h, v0.4h, v1.4h, v2.4h}, [x27],#32", 4, want "st1 {v31.4h-v2.4h}, [x27], #32", 4

    ext_test.go:197: decode(4181004c) = "st2 {v1.16b, v2.16b}, [x10]", 4, want "st2 {v1.16b-v2.16b}, [x10]", 4

    ext_test.go:197: decode(d6819f0c) = "st2 {v22.8b, v23.8b}, [x14],#16", 4, want "st2 {v22.8b-v23.8b}, [x14], #16", 4

    ext_test.go:197: decode(bf808a0c) = "st2 {v31.8b, v0.8b}, [x5], x10", 4, want "st2 {v31.8b-v0.8b}, [x5], x10", 4

    ext_test.go:197: decode(ea86200d) = "st2 {v10.d, v11.d}[0], [x23]", 4, want "st2 {v10.d-v11.d}[0], [x23]", 4

    ext_test.go:197: decode(fb59a40d) = "st2 {v27.h, v28.h}[3], [x15], x4", 4, want "st2 {v27.h-v28.h}[3], [x15], x4", 4

    ext_test.go:197: decode(f582ac4d) = "st2 {v21.s, v22.s}[2], [x23], x12", 4, want "st2 {v21.s-v22.s}[2], [x23], x12", 4

    ext_test.go:197: decode(9c86bf4d) = "st2 {v28.d, v29.d}[1], [x20],#16", 4, want "st2 {v28.d-v29.d}[1], [x20], #16", 4

    ext_test.go:197: decode(3386b14d) = "st2 {v19.d, v20.d}[1], [x17], x17", 4, want "st2 {v19.d-v20.d}[1], [x17], x17", 4

    ext_test.go:197: decode(1e07880c) = "st4 {v30.4h, v31.4h, v0.4h, v1.4h}, [x24], x8", 4, want "st4 {v30.4h-v1.4h}, [x24], x8", 4

    ext_test.go:197: decode(5a201a4e) = "tbl v26.16b, {v2.16b, v3.16b}, v26.16b", 4, want "tbl v26.16b, {v2.16b-v3.16b}, v26.16b", 4

    ext_test.go:197: decode(7aa9404c) = "ld1 {v26.4s, v27.4s}, [x11]", 4, want "ld1 {v26.4s-v27.4s}, [x11]", 4

    ext_test.go:197: decode(35a7d70c) = "ld1 {v21.4h, v22.4h}, [x25], x23", 4, want "ld1 {v21.4h-v22.4h}, [x25], x23", 4

    ext_test.go:197: decode(e68a400c) = "ld2 {v6.2s, v7.2s}, [x23]", 4, want "ld2 {v6.2s-v7.2s}, [x23]", 4

    ext_test.go:197: decode(4007604d) = "ld2 {v0.b, v1.b}[9], [x26]", 4, want "ld2 {v0.b-v1.b}[9], [x26]", 4

    ext_test.go:197: decode(8c49604d) = "ld2 {v12.h, v13.h}[5], [x12]", 4, want "ld2 {v12.h-v13.h}[5], [x12]", 4

    ext_test.go:197: decode(b186600d) = "ld2 {v17.d, v18.d}[0], [x21]", 4, want "ld2 {v17.d-v18.d}[0], [x21]", 4

    ext_test.go:197: decode(631aff0d) = "ld2 {v3.b, v4.b}[6], [x19],#2", 4, want "ld2 {v3.b-v4.b}[6], [x19], #2", 4

    ext_test.go:197: decode(454bff4d) = "ld2 {v5.h, v6.h}[5], [x26],#4", 4, want "ld2 {v5.h-v6.h}[5], [x26], #4", 4

    ext_test.go:197: decode(0792ff0d) = "ld2 {v7.s, v8.s}[1], [x16],#8", 4, want "ld2 {v7.s-v8.s}[1], [x16], #8", 4

    ext_test.go:197: decode(da86e30d) = "ld2 {v26.d, v27.d}[0], [x22], x3", 4, want "ld2 {v26.d-v27.d}[0], [x22], x3", 4

    ext_test.go:197: decode(5ac8ff0d) = "ld2r {v26.2s, v27.2s}, [x2],#8", 4, want "ld2r {v26.2s-v27.2s}, [x2], #8", 4

    ext_test.go:197: decode(dfa6d94d) = "ld3 {v31.d, v0.d, v1.d}[1], [x22], x25", 4, want "ld3 {v31.d-v1.d}[1], [x22], x25", 4

    ext_test.go:197: decode(eea99f4c) = "st1 {v14.4s, v15.4s}, [x15],#32", 4, want "st1 {v14.4s-v15.4s}, [x15], #32", 4

    ext_test.go:197: decode(11af9d4c) = "st1 {v17.2d, v18.2d}, [x24], x29", 4, want "st1 {v17.2d-v18.2d}, [x24], x29", 4

    ext_test.go:197: decode(07829f0c) = "st2 {v7.8b, v8.8b}, [x16],#16", 4, want "st2 {v7.8b-v8.8b}, [x16], #16", 4

    ext_test.go:197: decode(541c204d) = "st2 {v20.b, v21.b}[15], [x2]", 4, want "st2 {v20.b-v21.b}[15], [x2]", 4

    ext_test.go:197: decode(9180200d) = "st2 {v17.s, v18.s}[0], [x4]", 4, want "st2 {v17.s-v18.s}[0], [x4]", 4

    ext_test.go:197: decode(2585204d) = "st2 {v5.d, v6.d}[1], [x9]", 4, want "st2 {v5.d-v6.d}[1], [x9]", 4

    ext_test.go:197: decode(805bbf0d) = "st2 {v0.h, v1.h}[3], [x28],#4", 4, want "st2 {v0.h-v1.h}[3], [x28], #4", 4

    ext_test.go:197: decode(6290a80d) = "st2 {v2.s, v3.s}[1], [x3], x8", 4, want "st2 {v2.s-v3.s}[1], [x3], x8", 4

    ext_test.go:197: decode(b587bf4d) = "st2 {v21.d, v22.d}[1], [x29],#16", 4, want "st2 {v21.d-v22.d}[1], [x29], #16", 4

    ext_test.go:197: decode(7fa4200d) = "st4 {v31.d, v0.d, v1.d, v2.d}[0], [x3]", 4, want "st4 {v31.d-v2.d}[0], [x3]", 4

    ext_test.go:197: decode(f920030e) = "tbl v25.8b, {v7.16b, v8.16b}, v3.8b", 4, want "tbl v25.8b, {v7.16b-v8.16b}, v3.8b", 4

    ext_test.go:197: decode(bc630d4e) = "tbl v28.16b, {v29.16b, v30.16b, v31.16b, v0.16b}, v13.16b", 4, want "tbl v28.16b, {v29.16b-v0.16b}, v13.16b", 4

    ext_test.go:197: decode(4b32124e) = "tbx v11.16b, {v18.16b, v19.16b}, v18.16b", 4, want "tbx v11.16b, {v18.16b-v19.16b}, v18.16b", 4

    ext_test.go:197: decode(ffacdf0c) = "ld1 {v31.1d, v0.1d}, [x7],#16", 4, want "ld1 {v31.1d-v0.1d}, [x7], #16", 4

    ext_test.go:197: decode(78a2c40c) = "ld1 {v24.8b, v25.8b}, [x19], x4", 4, want "ld1 {v24.8b-v25.8b}, [x19], x4", 4

    ext_test.go:203: 4684 test cases, 922 expected mismatches, 180 failures; 71031 cases/second
    ext_test.go:204: decoder coverage: 96.5%;
    ext_test.go:203: 4684 test cases, 0 expected mismatches, 0 failures; 75947 cases/second
    ext_test.go:204: decoder coverage: 96.5%;
FAIL
FAIL    golang.org/x/arch/arm64/arm64asm    2.337s
ok      golang.org/x/arch/ppc64/ppc64asm    (cached)
ok      golang.org/x/arch/x86/x86asm    (cached)
ok      golang.org/x/arch/x86/x86avxgen (cached)
ok      golang.org/x/arch/x86/x86csv    (cached)
ok      golang.org/x/arch/x86/x86spec   (cached)
ok      golang.org/x/arch/x86/xeddata   (cached)
FAIL

What did you expect to see?

All test passing.

cagedmantis commented 8 months ago

@cherrymui

cherrymui commented 8 months ago

Thanks for the report. The simplest fix is probably just adding those cases to allowedMismatchObjdump. A more principled fix is probably implement some matching algorithm so that those cases are considered "match". Feel free to send a CL. Thanks.

alexsaezm commented 8 months ago

I'll take a look into it :D thanks for the suggestions.

erifan commented 8 months ago

The assembly format output by different binutils versions may also be different, which makes it difficult to do in Go. So in Go we have to allow this difference.