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/compile: combine xor and rotate right into shifted EOR on arm64 #48002

Closed
ericlagergren opened this issue Aug 27, 2021 · 3 comments
Closed

cmd/compile: combine xor and rotate right into shifted EOR on arm64 #48002

ericlagergren opened this issue Aug 27, 2021 · 3 comments

Comments

@ericlagergren
Copy link
Contributor

@ericlagergren ericlagergren commented Aug 27, 2021

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

$ go version
go version go1.17 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="/Users/eric/gopath/bin"
GOCACHE="/Users/eric/Library/Caches/go-build"
GOENV="/Users/eric/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/eric/gopath/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/eric/gopath"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/2f/2_yz21b92h94_pvr2m00gzh80000gn/T/go-build15658485=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

https://play.golang.org/p/LNnAPEjrB1u

What did you expect to see?

The compiler generate EOR with a shifted register. E.g., turning

s.x3 = t3 ^ rotr(t3, 10) ^ rotr(t3, 17)

into (ignoring any typoed register names)

eor x3, x3, x2, ror #10
eor x2, x3, x2 ror #17

What did you see instead?

mov	x3, #10
ror	x3, x2, x3
eor	x3, x3, x2
mov	x4, #17
ror	x2, x2, x4
eor	x2, x2, x3
@ericlagergren ericlagergren changed the title cmd/compile: combine xor and rotate right on ARMv8 cmd/compile: combine xor and rotate right into shifted EOR on ARMv8 Aug 27, 2021
@toothrot toothrot added this to the Backlog milestone Aug 27, 2021
@RuinanSun
Copy link

@RuinanSun RuinanSun commented Sep 3, 2021

I will work with my teammates on this issue, thanks for reporting that.

Loading

@greatroar
Copy link

@greatroar greatroar commented Sep 19, 2021

This is labeled arch-arm, but it's about arm64.

Loading

@randall77 randall77 changed the title cmd/compile: combine xor and rotate right into shifted EOR on ARMv8 cmd/compile: combine xor and rotate right into shifted EOR on arm64 Sep 19, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 19, 2021

Change https://golang.org/cl/350912 mentions this issue: cmd/compile: allow rotates to be merged with arithmetic ops on arm64

Loading

@gopherbot gopherbot closed this in 6f35430 Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants