aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorfanzha02 <fannie.zhang@arm.com>2021-09-06 11:15:30 +0800
committerfannie zhang <Fannie.Zhang@arm.com>2021-09-06 03:31:53 +0000
commit7b69ddc171938b8321a535dd79b8ca2ba56ac72d (patch)
tree25a037893bb0068c3960cec1138fdf1874dd545f /test
parent43b05173a219e19697c2f9c6d98cf4d8667b7ca5 (diff)
downloadgo-7b69ddc171938b8321a535dd79b8ca2ba56ac72d.tar.gz
go-7b69ddc171938b8321a535dd79b8ca2ba56ac72d.zip
cmd/compile: merge sign extension and shift into SBFIZ
This patch adds some rules to rewrite "(LeftShift (SignExtend x) lc)" expression as "SBFIZ". Add the test cases. Change-Id: I294c4ba09712eeb02c7a952447bb006780f1e60d Reviewed-on: https://go-review.googlesource.com/c/go/+/267602 Trust: fannie zhang <Fannie.Zhang@arm.com> Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: fannie zhang <Fannie.Zhang@arm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test')
-rw-r--r--test/codegen/bitfield.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/codegen/bitfield.go b/test/codegen/bitfield.go
index 6c66e3ab6d..d4ffbad85d 100644
--- a/test/codegen/bitfield.go
+++ b/test/codegen/bitfield.go
@@ -99,6 +99,18 @@ func sbfiz5(x int32) int32 {
return (x << 4) >> 3
}
+func sbfiz5(x int32) int64 {
+ return int64(x+1) << 40 // arm64:"SBFIZ\t[$]40, R[0-9]+, [$]24",-"LSL"
+}
+
+func sbfiz6(x int16) int64 {
+ return int64(x+1) << 3 // arm64:"SBFIZ\t[$]3, R[0-9]+, [$]16",-"LSL"
+}
+
+func sbfiz7(x int8) int64 {
+ return int64(x+1) << 62 // arm64:"SBFIZ\t[$]62, R[0-9]+, [$]2",-"LSL"
+}
+
// sbfx
func sbfx1(x int64) int64 {
return (x << 3) >> 4 // arm64:"SBFX\t[$]1, R[0-9]+, [$]60",-"LSL",-"ASR"