aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorfanzha02 <fannie.zhang@arm.com>2020-11-03 17:31:04 +0800
committerFannie Zhang <Fannie.Zhang@arm.com>2022-03-25 01:24:44 +0000
commit8ab42a945aef7c09189a60263c4450a65bc00a47 (patch)
treeafdcb50de88a5aa95abf5a24aa687188de4672b5 /test/codegen
parenta10a209b23f877c80d8a5f3ebda1ce4b492ac3a9 (diff)
downloadgo-8ab42a945aef7c09189a60263c4450a65bc00a47.tar.xz
cmd/compile: merge ANDconst and UBFX into UBFX on arm64
Add a new rewrite rule to merge ANDconst and UBFX into UBFX. Add test cases. Change-Id: I24d6442d0c956d7ce092c3a3858d4a3a41771670 Reviewed-on: https://go-review.googlesource.com/c/go/+/377054 Trust: Fannie Zhang <Fannie.Zhang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/bitfield.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/codegen/bitfield.go b/test/codegen/bitfield.go
index 8327da6cf8..11f31ecf25 100644
--- a/test/codegen/bitfield.go
+++ b/test/codegen/bitfield.go
@@ -321,6 +321,12 @@ func ubfx15(x uint64) bool {
return false
}
+// merge ANDconst and ubfx into ubfx
+func ubfx16(x uint64) uint64 {
+ // arm64:"UBFX\t[$]4, R[0-9]+, [$]6",-"AND\t[$]63"
+ return ((x >> 3) & 0xfff) >> 1 & 0x3f
+}
+
// Check that we don't emit comparisons for constant shifts.
//go:nosplit
func shift_no_cmp(x int) int {