From 42cd40ee74050391e4714eefa8aeb0242b93b0f5 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Fri, 12 Feb 2021 15:55:25 -0800 Subject: 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 Trust: Josh Bleecher Snyder Run-TryBot: Keith Randall Reviewed-by: Josh Bleecher Snyder --- test/codegen/bits.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/codegen/bits.go') 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 +} -- cgit v1.3