aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2023-08-01 14:32:56 -0700
committerKeith Randall <khr@google.com>2023-08-04 16:40:24 +0000
commit611706b17136beb602711f7bfebd15622f73f58f (patch)
tree47a67335a6e838036b57134620e775a6b3ac6ee8 /test/codegen/mathbits.go
parent51cb12e83b87a100d1df0d80f5176417e08872ea (diff)
downloadgo-611706b17136beb602711f7bfebd15622f73f58f.tar.xz
cmd/compile: don't use BTS when OR works, add direct memory BTS operations
Stop using BTSconst and friends when ORLconst can be used instead. OR can be issued by more function units than BTS can, so it could lead to better IPC. OR might take a few more bytes to encode, but not a lot more. Still use BTSconst for cases where the constant otherwise wouldn't fit and would require a separate movabs instruction to materialize the constant. This happens when setting bits 31-63 of 64-bit targets. Add BTS-to-memory operations so we don't need to load/bts/store. Fixes #61694 Change-Id: I00379608df8fb0167cb01466e97d11dec7c1596c Reviewed-on: https://go-review.googlesource.com/c/go/+/515755 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test/codegen/mathbits.go')
-rw-r--r--test/codegen/mathbits.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index 797aa23b67..d80bfaeec0 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -335,7 +335,7 @@ func TrailingZeros32(n uint32) int {
}
func TrailingZeros16(n uint16) int {
- // amd64:"BSFL","BTSL\\t\\$16"
+ // amd64:"BSFL","ORL\\t\\$65536"
// 386:"BSFL\t"
// arm:"ORR\t\\$65536","CLZ",-"MOVHU\tR"
// arm64:"ORR\t\\$65536","RBITW","CLZW",-"MOVHU\tR",-"RBIT\t",-"CLZ\t"
@@ -347,7 +347,7 @@ func TrailingZeros16(n uint16) int {
}
func TrailingZeros8(n uint8) int {
- // amd64:"BSFL","BTSL\\t\\$8"
+ // amd64:"BSFL","ORL\\t\\$256"
// 386:"BSFL"
// arm:"ORR\t\\$256","CLZ",-"MOVBU\tR"
// arm64:"ORR\t\\$256","RBITW","CLZW",-"MOVBU\tR",-"RBIT\t",-"CLZ\t"