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: AVX2 instruction VPSHUFD failed to compile #16499

Closed
aead opened this issue Jul 26, 2016 · 5 comments
Closed

cmd/internal: AVX2 instruction VPSHUFD failed to compile #16499

aead opened this issue Jul 26, 2016 · 5 comments
Milestone

Comments

@aead
Copy link
Contributor

aead commented Jul 26, 2016

  1. What version of Go are you using (go version)?
    1.7-beta2, 1.7-beta3
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

What did you do?
The AVX2 instruction VPSHUFD $0x39, Y1, Y1 and VPSHUFD $0x78, Y1, Y1
compile, but VPSHUFD $0x93, Y0, Y0 e.g. fails with:

asm: invalid instruction: 03087 VPSHUFD $147, Y1, Y1

If I use the plain byte representation,
in my case BYTE $0xC5; BYTE $0xFD; BYTE $0x70; BYTE $0xC9; BYTE $0x93
everything is fine...

For reproducing:

TEXT ·foo(SB),4,$0-8
         VPSHUFD $0x39, Y1, Y1
         VPSHUFD $0x93, Y1, Y1
         RET
@aead
Copy link
Contributor Author

aead commented Jul 27, 2016

VPSHUFD seems to accept only a 7 bit constant:
VPSHUFD $127, Y1, Y1 compiles, but VPSHUFD $128, Y1, Y1 does not....

@aead
Copy link
Contributor Author

aead commented Jul 28, 2016

Okay, VPSHUFD accepts either a positive or negative 7 bit shuffle constant...
Semantically these two lines are equal:
VPSHUFD $147, Y1, Y1 and VPSHUFD $-109, Y1, Y1
but only the second one compile without an error

@randall77
Copy link
Contributor

@TocarIP

@gopherbot
Copy link

CL https://golang.org/cl/25383 mentions this issue.

@TocarIP
Copy link
Contributor

TocarIP commented Aug 1, 2016

CL25383 makes VPSHUFD consistent with PSHUFD and only allows non-negative arguments.
Gnu as allows both (e. g. -6 and 0xFA). It may make sense to add signed form, but that should be done for all instructions at once.

@quentinmit quentinmit added this to the Go1.8 milestone Aug 1, 2016
@golang golang locked and limited conversation to collaborators Aug 16, 2017
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

5 participants