diff options
| author | Wayne Zuo <wdvxdr@golangcn.org> | 2023-03-12 15:34:20 +0800 |
|---|---|---|
| committer | Wayne Zuo <wdvxdr@golangcn.org> | 2023-03-14 08:10:32 +0000 |
| commit | cedfcba3e859316410ae820abc5b43f9bda4e4f6 (patch) | |
| tree | d4c1a50114ca7ad23c30a74766a48eced8f23762 /test/codegen/mathbits.go | |
| parent | 82bf12902f2abecdbe2cb5fa38299ac70cf9c67e (diff) | |
| download | go-cedfcba3e859316410ae820abc5b43f9bda4e4f6.tar.xz | |
cmd/compile: instrinsify TrailingZeros{8,32,64} for 386
This CL add support for instrinsifying the TrialingZeros{8,32,64}
functions for 386 architecture. We need handle the case when the input
is 0, which could lead to undefined output from the BSFL instruction.
Next CL will remove the assembly code in runtime/internal/sys package.
Change-Id: Ic168edf68e81bf69a536102100fdd3f56f0f4a1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/475735
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test/codegen/mathbits.go')
| -rw-r--r-- | test/codegen/mathbits.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 86a44d7c93..8c971cf760 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -293,6 +293,7 @@ func RotateLeftVariable32(n uint32, m int) uint32 { func TrailingZeros(n uint) int { // amd64/v1,amd64/v2:"BSFQ","MOVL\t\\$64","CMOVQEQ" // amd64/v3:"TZCNTQ" + // 386:"BSFL" // arm:"CLZ" // arm64:"RBIT","CLZ" // s390x:"FLOGR" @@ -305,6 +306,7 @@ func TrailingZeros(n uint) int { func TrailingZeros64(n uint64) int { // amd64/v1,amd64/v2:"BSFQ","MOVL\t\\$64","CMOVQEQ" // amd64/v3:"TZCNTQ" + // 386:"BSFL" // arm64:"RBIT","CLZ" // s390x:"FLOGR" // ppc64x/power8:"ANDN","POPCNTD" @@ -322,6 +324,7 @@ func TrailingZeros64Subtract(n uint64) int { func TrailingZeros32(n uint32) int { // amd64/v1,amd64/v2:"BTSQ\\t\\$32","BSFQ" // amd64/v3:"TZCNTL" + // 386:"BSFL" // arm:"CLZ" // arm64:"RBITW","CLZW" // s390x:"FLOGR","MOVWZ" @@ -345,6 +348,7 @@ func TrailingZeros16(n uint16) int { func TrailingZeros8(n uint8) int { // amd64:"BSFL","BTSL\\t\\$8" + // 386:"BSFL" // arm:"ORR\t\\$256","CLZ",-"MOVBU\tR" // arm64:"ORR\t\\$256","RBITW","CLZW",-"MOVBU\tR",-"RBIT\t",-"CLZ\t" // s390x:"FLOGR","OR\t\\$256" |
