We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please answer these questions before submitting your issue. Thanks!
go version
go version go1.8beta2 darwin/amd64
go env
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/rasky/Sources/go" GORACE="" GOROOT="/usr/local/Cellar/go/1.8beta2_1/libexec" GOTOOLDIR="/usr/local/Cellar/go/1.8beta2_1/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lw/jdbk7p_d4gj6qpydczpbw2080000gn/T/go-build116611858=/tmp/go-build -gno-record-gcc-switches -fno-common" CXX="clang++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
func DebugPerf(mem []byte, x int) { op := binary.LittleEndian.Uint32(mem[x:]) fmt.Println(op) }
When inlining, the temporary slice could be fully elided. Moreover, a single bound-check on x+3 would be sufficient.
x+3
test.go:9 0x1086bc1 488b442470 MOVQ 0x70(SP), AX test.go:9 0x1086bc6 488b4c2460 MOVQ 0x60(SP), CX test.go:9 0x1086bcb 4839c8 CMPQ CX, AX test.go:9 0x1086bce 0f879c000000 JA 0x1086c70 test.go:9 0x1086bd4 4829c1 SUBQ AX, CX test.go:9 0x1086bd7 488b542468 MOVQ 0x68(SP), DX test.go:9 0x1086bdc 4829c2 SUBQ AX, DX test.go:9 0x1086bdf 48ffca DECQ DX test.go:9 0x1086be2 48c1fa3f SARQ $0x3f, DX test.go:9 0x1086be6 4883f2ff XORQ $-0x1, DX test.go:9 0x1086bea 4821d0 ANDQ DX, AX test.go:9 0x1086bed 4883f903 CMPQ $0x3, CX test.go:9 0x1086bf1 7676 JBE 0x1086c69 test.go:9 0x1086bf3 488b4c2458 MOVQ 0x58(SP), CX test.go:9 0x1086bf8 8b0401 MOVL 0(CX)(AX*1), AX
Basically, the last line (with AX=x) plus a single bound-check would be sufficient.
The text was updated successfully, but these errors were encountered:
Related: #16813. The patch there doesn't seem to help here, unfortunately.
Sorry, something went wrong.
Also related: #15397
binary.*Endian.Uint*
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8beta2 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
When inlining, the temporary slice could be fully elided. Moreover, a single bound-check on
x+3
would be sufficient.What did you see instead?
Basically, the last line (with AX=x) plus a single bound-check would be sufficient.
The text was updated successfully, but these errors were encountered: