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: missing logical/move instruction for RSP on arm64 #24332

Closed
mengzhuo opened this issue Mar 10, 2018 · 5 comments
Closed

cmd/compile: missing logical/move instruction for RSP on arm64 #24332

mengzhuo opened this issue Mar 10, 2018 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mengzhuo
Copy link
Contributor

What did you do?

        BIC     $1, RSP
        ORR     $1, RSP
        AND     $1, RSP
        EOR     $1, RSP
        SUB     $1, RSP
        ADD     $1, RSP
        MOVD    (56)(R21), RSP

What did you expect to see?

all instruction passed

What did you see instead?

asm: illegal combination: 00000 (/root/go/src/github.com/t/t_arm64.s:4) BIC     $1, RSP ABCON0 NONE RSP, 4 7
asm: illegal combination: 00004 (/root/go/src/github.com/t/t_arm64.s:5) ORR     $1, RSP ABCON0 NONE RSP, 4 7
asm: illegal combination: 00008 (/root/go/src/github.com/t/t_arm64.s:6) AND     $1, RSP ABCON0 NONE RSP, 4 7
asm: illegal combination: 00012 (/root/go/src/github.com/t/t_arm64.s:7) EOR     $1, RSP ABCON0 NONE RSP, 4 7
asm: illegal combination: 00024 (/root/go/src/github.com/t/t_arm64.s:10)        MOVD    56(R21), RSP PSOREG_8 NONE RSP, 3 7

System details

go version go1.10 linux/arm64
GOARCH="arm64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build946549955=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.10 linux/arm64
GOROOT/bin/go tool compile -V: compile version go1.10
uname -sr: Linux 4.4.49-s5p6818
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial
/lib/aarch64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.23-0ubuntu10) stable release version 2.23, by Roland McGrath et al.
gdb --version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
@odeke-em odeke-em changed the title compile: missing logical/move instruction for RSP on arm64 cmd/compile: missing logical/move instruction for RSP on arm64 Mar 11, 2018
@odeke-em
Copy link
Member

/cc @randall77 @cherrymui

@andybons andybons added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 11, 2018
@andybons andybons added this to the Go1.11 milestone Mar 11, 2018
@randall77
Copy link
Contributor

From the arm64 manual:

You can only use SP as an operand in the following instructions:

As the base register for loads and stores. In this case it must be quadword-aligned before adding any offset, or a stack alignment exception occurs.

As a source or destination for arithmetic instructions, but it cannot be used as the destination in instructions that set the condition flags.

In logical instructions, for example in order to align it.

My reading of that is that the MOVD error is correct, RSP cannot be the target of a load. But the others look like they should be ok.

@randall77
Copy link
Contributor

The obvious patch of just duplicating the RSP AADD lines and replacing the opcode with AAND and ABIC doesn't work. It gets rid of the errors, but go tool objdump doesn't print the right result on the resulting .o file (of course, that may be a bug in objdump). This is beyond my skillset...
@benshi001 @4ad @williamweixiao

@cherrymui
Copy link
Member

The two-operand form of logical instructions, AND $1, RSP, which is equivalent to the three-operand form AND $1, RSP, RSP, is not valid. For logical instructions, while the destination can be RSP, the source register cannot.

That said, AND $1, R0, RSP is valid. We should support it.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 12, 2018
@gopherbot gopherbot removed the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 12, 2018
@gopherbot
Copy link

Change https://golang.org/cl/100217 mentions this issue: cmd/internal/obj/arm64: support logical instructions targeting RSP

@golang golang locked and limited conversation to collaborators Mar 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

7 participants