Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/asm: ARM64 VLD1 from pseudo-register FP results in asm: illegal combination #41183

Closed
paultag opened this issue Sep 2, 2020 · 3 comments
Closed

Comments

@paultag
Copy link

paultag commented Sep 2, 2020

What version of Go are you using (go version)?

$ go version
go version go1.15.1 linux/arm64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/home/ubuntu/.cache/go-build"
GOENV="/home/ubuntu/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ubuntu/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ubuntu/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/golang/go-1.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/golang/go-1.15/pkg/tool/linux_arm64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ubuntu/go/src/hz.tools/sdr/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build634724932=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Using the VLD1 instruction with a pseudo register such as FP results in an asm: illegal combination.

For instance, when I try and load the [4]float32 as a S4, I get an asm: illegal combination even though the variant using the actual registers works fine.

// func x([4]float32, []float32)
TEXT ·x(SB), $0-40
    VLD1 f+0(FP), [V2.S4]

What did you expect to see?

My data in V2 as an S4

What did you see instead?

asm: illegal combination: 00000 (.s:27)	VLD1	a+16(FP), [V2.S4] PSAUTO_8 NONE NONE LIST, 3 13
asm: illegal combination: 00000 (.s:27)	VLD1	a+16(FP), [V2.S4] PSAUTO_8 NONE NONE LIST, 3 13
asm: illegal combination: 00000 (.s:27)	VLD1	a+16(FP), [V2.S4] PSAUTO_8 NONE NONE LIST, 3 13
asm: illegal combination: 00000 (.s:27)	VLD1	a+16(FP), [V2.S4] PSAUTO_8 NONE NONE LIST, 3 13
asm: assembly failed
@paultag paultag changed the title cmd/asm: ARM64 VLD1 from psuedo-register FP results in asm: illegal combination cmd/asm: ARM64 VLD1 from pseudo-register FP results in asm: illegal combination Sep 2, 2020
@paultag
Copy link
Author

paultag commented Sep 2, 2020

My workaround for this, for my fellow nerds who stumble upon this, is to change [4]float32 to a *[4]float32, MOVD that to a register, then do a VLD (R1), [V2.S4]. Not ideal, but it beats having to work out how to do this by hand :)

@cherrymui
Copy link
Member

VLD1 instruction doesn't take an offset for the source, so it must be (Rx) instead of something like 16(Rx), also not a symbolic offset like f+0(FP).

You don't have to change the signature of the function. You could MOVD the address of the argument to a register, then VLD1 from there, like MOVD $f+0(FP), R1; VLD1 (R1), [V2.S4].

@paultag
Copy link
Author

paultag commented Sep 2, 2020

Thanks, @cherrymui !

@golang golang locked and limited conversation to collaborators Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants