Open zhangyoufu opened 4 years ago
go version
$ go version go version go1.15 darwin/amd64
Yes
go env
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/zhangyoufu/Library/Caches/go-build" GOENV="/Users/zhangyoufu/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/zhangyoufu/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/zhangyoufu/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.15/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.15/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vf/10556_c97vj8qmvw000tgh5w0000gn/T/go-build228934958=/tmp/go-build -gno-record-gcc-switches -fno-common"
Sample:
package main import ( "log" "math" ) func main() { log.Print(math.FMA(0, 0, 0)) }
$ go tool compile -S a.go | head -n 20 "".main STEXT size=183 args=0x0 locals=0x38 0x0000 00000 (a.go:8) TEXT "".main(SB), ABIInternal, $56-0 0x0000 00000 (a.go:8) MOVQ (TLS), CX 0x0009 00009 (a.go:8) CMPQ SP, 16(CX) 0x000d 00013 (a.go:8) PCDATA $0, $-2 0x000d 00013 (a.go:8) JLS 173 0x0013 00019 (a.go:8) PCDATA $0, $-1 0x0013 00019 (a.go:8) SUBQ $56, SP 0x0017 00023 (a.go:8) MOVQ BP, 48(SP) 0x001c 00028 (a.go:8) LEAQ 48(SP), BP 0x0021 00033 (a.go:8) FUNCDATA $0, gclocals·69c1753bd5f81501d95132d08af04464(SB) 0x0021 00033 (a.go:8) FUNCDATA $1, gclocals·568470801006e5c0dc3947ea998fe279(SB) 0x0021 00033 (a.go:8) FUNCDATA $3, "".main.stkobj(SB) 0x0021 00033 (a.go:8) MOVBQZX runtime.x86HasFMA(SB), AX 0x0029 00041 (a.go:8) TESTQ AX, AX 0x002c 00044 (a.go:9) JEQ 136 0x002e 00046 (a.go:9) XORPS X0, X0 0x0031 00049 (a.go:9) VFMADD231SD X0, X0, X0 0x0036 00054 (a.go:9) XORPS X1, X1 0x0039 00057 (a.go:9) MOVUPS X1, ""..autotmp_1+32(SP) go tool compile: signal: broken pipe $ go build a.go $ go tool objdump -s main.main a | head -n13 TEXT main.main(SB) /Users/zhangyoufu/a.go a.go:8 0x10a8760 65488b0c2530000000 MOVQ GS:0x30, CX a.go:8 0x10a8769 483b6110 CMPQ 0x10(CX), SP a.go:8 0x10a876d 0f869a000000 JBE 0x10a880d a.go:8 0x10a8773 4883ec38 SUBQ $0x38, SP a.go:8 0x10a8777 48896c2430 MOVQ BP, 0x30(SP) a.go:8 0x10a877c 488d6c2430 LEAQ 0x30(SP), BP a.go:8 0x10a8781 480fb6054b710f00 MOVZX runtime.x86HasFMA(SB), AX a.go:8 0x10a8789 4885c0 TESTQ AX, AX a.go:9 0x10a878c 745a JE 0x10a87e8 a.go:9 0x10a878e 0f57c0 XORPS X0, X0 a.go:9 0x10a8791 c4e2f9b9c00f57c9 MOVL $-0x36a8f040, CX a.go:9 0x10a8799 0f114c2420 MOVUPS X1, 0x20(SP)
objdump shows FMA instruction VFMADD231SD X0, X0, X0.
VFMADD231SD X0, X0, X0
objdump shows MOVL $-0x36a8f040, CX
MOVL $-0x36a8f040, CX
/cc @cherrymui
Change https://go.dev/cl/618036 mentions this issue: x86: allow decoding of AVX instructions
x86: allow decoding of AVX instructions
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Sample:
What did you expect to see?
objdump shows FMA instruction
VFMADD231SD X0, X0, X0
.What did you see instead?
objdump shows
MOVL $-0x36a8f040, CX