diff options
| author | Keith Randall <khr@golang.org> | 2023-08-01 14:32:56 -0700 |
|---|---|---|
| committer | Keith Randall <khr@google.com> | 2023-08-04 16:40:24 +0000 |
| commit | 611706b17136beb602711f7bfebd15622f73f58f (patch) | |
| tree | 47a67335a6e838036b57134620e775a6b3ac6ee8 /test/codegen/bits.go | |
| parent | 51cb12e83b87a100d1df0d80f5176417e08872ea (diff) | |
| download | go-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/bits.go')
| -rw-r--r-- | test/codegen/bits.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/codegen/bits.go b/test/codegen/bits.go index 018f5b909e..88d5ebe9cf 100644 --- a/test/codegen/bits.go +++ b/test/codegen/bits.go @@ -220,10 +220,10 @@ func biton32(a, b uint32) (n uint32) { // amd64:"BTSL" n += b | (1 << (a & 31)) - // amd64:"BTSL\t[$]31" + // amd64:"ORL\t[$]-2147483648" n += a | (1 << 31) - // amd64:"BTSL\t[$]28" + // amd64:"ORL\t[$]268435456" n += a | (1 << 28) // amd64:"ORL\t[$]1" @@ -236,10 +236,10 @@ func bitoff32(a, b uint32) (n uint32) { // amd64:"BTRL" n += b &^ (1 << (a & 31)) - // amd64:"BTRL\t[$]31" + // amd64:"ANDL\t[$]2147483647" n += a &^ (1 << 31) - // amd64:"BTRL\t[$]28" + // amd64:"ANDL\t[$]-268435457" n += a &^ (1 << 28) // amd64:"ANDL\t[$]-2" @@ -252,10 +252,10 @@ func bitcompl32(a, b uint32) (n uint32) { // amd64:"BTCL" n += b ^ (1 << (a & 31)) - // amd64:"BTCL\t[$]31" + // amd64:"XORL\t[$]-2147483648" n += a ^ (1 << 31) - // amd64:"BTCL\t[$]28" + // amd64:"XORL\t[$]268435456" n += a ^ (1 << 28) // amd64:"XORL\t[$]1" |
