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/internal/obj/arm64: ARM assembly rotational right shift of a register with @> syntax causes compile error #57662

Closed
dadrian opened this issue Jan 6, 2023 · 3 comments

Comments

@dadrian
Copy link

dadrian commented Jan 6, 2023

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

$ go version 
go1.19.4 darwin/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="/Users/dadrian/Library/Caches/go-build"
GOENV="/Users/dadrian/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/dadrian/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dadrian/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.4/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dadrian/src/github.com/dadrian/go-bugs/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7_/yc9s7tp94lq83r7fmlncg58c0000gn/T/go-build2852821403=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Compiled Go assembly for arm that uses a rotation right shift with the @> syntax.

ADD R0@>16, ZR, R0

I pushed a minimal test case here: https://github.com/dadrian/go-bugs/tree/main/arm-ror

What did you expect to see?

Successful compilation

What did you see instead?

asm: unsupported shift operator: 00016 (/Users/dadrian/src/github.com/dadrian/go-bugs/arm-ror/function_arm64.s:3)       ADDR0@>16, ZR, R0
@cespare
Copy link
Contributor

cespare commented Jan 6, 2023

@dadrian is ROR a valid shift type for ADD?

If I look at the ADD docs I see

Is the optional shift type to be applied to the second source operand, defaulting to LSL, and can be one of LSL, LSR, or ASR.

whereas if I look at, for example, EOR I see

Is the optional shift to be applied to the final source, defaulting to LSL, and can be one of LSL, LSR, ASR, or ROR.

(I'm an arm64 newbie so maybe I'm mistaken.)

@dadrian
Copy link
Author

dadrian commented Jan 6, 2023

I actually first ran into this on an EOR and dumbed it down to ADD for the repro. You're absolutely correct.

That being said, it does work on EOR but only on the first argument, not the second. Not sure if that's intentional (I'm also an ARM newbie).

@dadrian dadrian closed this as completed Jan 6, 2023
@greatroar
Copy link

greatroar commented Jan 6, 2023

it does work on EOR but only on the first argument, not the second.

This is a feature/limitation of the architecture.

@golang golang locked and limited conversation to collaborators Jan 7, 2024
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

4 participants