aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/bits.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-02-12 15:55:25 -0800
committerKeith Randall <khr@golang.org>2021-02-23 18:02:48 +0000
commit42cd40ee74050391e4714eefa8aeb0242b93b0f5 (patch)
treeb9e1f10f66999a3e4ab9289dd07f7c7da295c2d8 /test/codegen/bits.go
parentf1562c761014111ce359b14016718ddabd24c2f2 (diff)
downloadgo-42cd40ee74050391e4714eefa8aeb0242b93b0f5.tar.xz
cmd/compile: improve bit test code
Some bit test instruction generation stopped triggering after the change to addressing modes. I suspect this was just because ANDQload was being generated before the rewrite rules could discover the BTQ. Fix that by decomposing the ANDQload when it is surrounded by a TESTQ (thus re-enabling the BTQ rules). Fixes #44228 Change-Id: I489b4a5a7eb01c65fc8db0753f8cec54097cadb2 Reviewed-on: https://go-review.googlesource.com/c/go/+/291749 Trust: Keith Randall <khr@golang.org> Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'test/codegen/bits.go')
-rw-r--r--test/codegen/bits.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/codegen/bits.go b/test/codegen/bits.go
index 4508eba487..806dad13c8 100644
--- a/test/codegen/bits.go
+++ b/test/codegen/bits.go
@@ -352,3 +352,12 @@ func cont0Mask64U(x uint64) uint64 {
// s390x:"RISBGZ\t[$]48, [$]15, [$]0,"
return x & 0xffff00000000ffff
}
+
+func issue44228a(a []int64, i int) bool {
+ // amd64: "BTQ", -"SHL"
+ return a[i>>6]&(1<<(i&63)) != 0
+}
+func issue44228b(a []int32, i int) bool {
+ // amd64: "BTL", -"SHL"
+ return a[i>>5]&(1<<(i&31)) != 0
+}