Navigation Menu

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
Labels
arch-arm64 FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ericlagergren
Copy link
Contributor

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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. arch-arm Issues solely affecting the 32-bit arm architecture. labels Aug 27, 2021
@toothrot toothrot added this to the Backlog milestone Aug 27, 2021
@RuinanSun
Copy link
Contributor

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

@greatroar
Copy link

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

@ALTree ALTree added arch-arm64 and removed arch-arm Issues solely affecting the 32-bit arm architecture. labels Sep 19, 2021
@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

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

@golang golang locked and limited conversation to collaborators Sep 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm64 FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants