]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix bit length intrinsic for 16/8 bits on GOAMD64=v3
authorKeith Randall <khr@golang.org>
Tue, 3 May 2022 17:40:34 +0000 (10:40 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 3 May 2022 18:33:02 +0000 (18:33 +0000)
commit5a103ca5e9e67414f5307b3993c1c34e531b26a8
tree89cc9c543150032a6bd8b97ef671b86da38e2012
parent8a5845e4e34c046758af3729acf9221b8b6c01ae
cmd/compile: fix bit length intrinsic for 16/8 bits on GOAMD64=v3

Upper bits of registers for uint8/uint16 are junk. Make sure we
mask those off before using LZCNT (leading zeros count).

Fixes #52681

Change-Id: I0ca9e62f23bcb1f6ad2a787fa9895322afaa2533
Reviewed-on: https://go-review.googlesource.com/c/go/+/403815
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@google.com>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/test/intrinsics_test.go [new file with mode: 0644]