-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: shift operands unsupported on arm64 (but supported on arm) #18070
Comments
I'm pretty sure the ADD instruction in arm64 does not a register as a
shifted operand. You can use a small immediate constant, but not a
register, and certainly not as the first operand.
…On Mon, Nov 28, 2016 at 1:15 PM, Wei Xiao ***@***.***> wrote:
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.7.3 linux/arm64
What operating system and processor architecture are you using (go env)?
GOARCH="arm64"
GOBIN=""
GOEXE=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/weixia01/workspace/golang/gocode"
GORACE=""
GOROOT="/home/weixia01/workspace/go-go1.7.3"
GOTOOLDIR="/home/weixia01/workspace/go-go1.7.3/pkg/tool/linux_arm64"
CC="gcc"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build695199653=/tmp/go-build
-gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
Assemble following assembly code (shiftopd.s):
1
2TEXT test?shiftopd(SB),0,$0-0
3 ADD R1>>1, R2, R0
4 RET
with command:
go tool asm shiftopd.s
What did you expect to see?
Assemble successfully
What did you see instead?
shiftopd.s:3: expected end of operand, found >>
asm: assembly of shiftopd.s failed
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#18070>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA3aQ4_z-7e9MKhXGHo3cU6TVO2_8ks5rCjlYgaJpZM4K9WAN>
.
|
My apologies, after studying the arm64 instruction manuals I did find
ADD Wd, Wn, Wm{, ashift #imm}
// Add (register): Wd = Wn + ashift(Wm, imm).
Can you pleaes
a. you said this was a regression, which versions of Go did this work on
b. Upload your source file, the text pasted into the issue has some
emojibake corruption.
Thanks
…On Mon, Nov 28, 2016 at 1:22 PM, Dave Cheney ***@***.***> wrote:
I'm pretty sure the ADD instruction in arm64 does not a register as a
shifted operand. You can use a small immediate constant, but not a
register, and certainly not as the first operand.
On Mon, Nov 28, 2016 at 1:15 PM, Wei Xiao ***@***.***>
wrote:
> Please answer these questions before submitting your issue. Thanks!
> What version of Go are you using (go version)?
>
> go version go1.7.3 linux/arm64
> What operating system and processor architecture are you using (go env)?
>
> GOARCH="arm64"
> GOBIN=""
> GOEXE=""
> GOHOSTARCH="arm64"
> GOHOSTOS="linux"
> GOOS="linux"
> GOPATH="/home/weixia01/workspace/golang/gocode"
> GORACE=""
> GOROOT="/home/weixia01/workspace/go-go1.7.3"
> GOTOOLDIR="/home/weixia01/workspace/go-go1.7.3/pkg/tool/linux_arm64"
> CC="gcc"
> GOGCCFLAGS="-fPIC -pthread -fmessage-length=0
> -fdebug-prefix-map=/tmp/go-build695199653=/tmp/go-build
> -gno-record-gcc-switches"
> CXX="g++"
> CGO_ENABLED="1"
> What did you do?
>
> Assemble following assembly code (shiftopd.s):
>
> 1
> 2TEXT test?shiftopd(SB),0,$0-0
> 3 ADD R1>>1, R2, R0
> 4 RET
>
> with command:
> go tool asm shiftopd.s
> What did you expect to see?
>
> Assemble successfully
> What did you see instead?
>
> shiftopd.s:3: expected end of operand, found >>
> asm: assembly of shiftopd.s failed
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#18070>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAAcA3aQ4_z-7e9MKhXGHo3cU6TVO2_8ks5rCjlYgaJpZM4K9WAN>
> .
>
|
CL https://golang.org/cl/33595 mentions this issue. |
a. according to go source code, shift operand is supported on arm but fail to work on armv8 |
If it has never been supported by cmd/asm before,
then it's not a regression.
arm64 and arm are two completely different ISAs, so
we certainly can't say this arm64 bug is regression
from the arm support.
It's just cmd/asm lacks shift operand support in
arm64.
|
There is a discussion about the issue: https://groups.google.com/forum/#!msg/golang-nuts/yKmWV0WZZiw/n3JkTTQhBQAJ;context-place=forum/golang-nuts
If we just consider the issue since golang implementation switching from c to go, lack shift operand support on arm64 maybe a more suitable title |
I would like to wait until Go 1.9 for this, to give us more time to set up a proper test suite. This is the kind of thing that is easy to get wrong and hard to correct. |
Ideally, the way this would proceed for Go 1.9 is the following. One thing that is missing from the arm64 port is a disassembler generated from a table of the instructions. See golang.org/x/arch's top-level directories for other examples. Once we have that, then we can generate a table of tests, commenting out the instructions that we don't have yet. Then when each new CL adds instructions it just uncomments the already-generated test, which gives us some confidence that the test is not just repeating what the CL implemented. go/src/cmd/asm/internal/asm/testdata/amd64enc.s is an example of this. |
We have started developing arm64 disassembler and expect to finish it within about three months. |
Hi @williamweixiao can you give a progress report on the arm64 disassembler? Do you need any test resources? Let us know. |
we have completed support for basic ARM64 instructions last month and are working on SIMD and FP instructions this month. we expect to make the first push to upstream within one month to support all instructions currently supported by assembler. Moreover, we need to discuss with upstream about how to express ARM64 SIMD instructions in go syntax which is still undefined in current assembler framework. I'm summarizing the materials and will post it ASAP. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.3 linux/arm64
What operating system and processor architecture are you using (
go env
)?GOARCH="arm64"
GOBIN=""
GOEXE=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/weixia01/workspace/golang/gocode"
GORACE=""
GOROOT="/home/weixia01/workspace/go-go1.7.3"
GOTOOLDIR="/home/weixia01/workspace/go-go1.7.3/pkg/tool/linux_arm64"
CC="gcc"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build695199653=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
Assemble following assembly code (shiftopd.s):
1
2TEXT test?shiftopd(SB),0,$0-0
3 ADD R1>>1, R2, R0
4 RET
with command:
go tool asm shiftopd.s
What did you expect to see?
Assemble successfully
What did you see instead?
shiftopd.s:3: expected end of operand, found >>
asm: assembly of shiftopd.s failed
The text was updated successfully, but these errors were encountered: