summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-07-25 21:25:50 +0000
committerSanjay Patel <spatel@rotateright.com>2018-07-25 21:25:50 +0000
commitf94c4c84e6b3f74a615db16a67c333485d160777 (patch)
tree0e978349dd1a27292b1106185fc60e555da5ec41 /llvm
parent4b58867d0688e7dc559a8bde0f3f987c311dd2b2 (diff)
downloadbcm5719-llvm-f94c4c84e6b3f74a615db16a67c333485d160777.tar.gz
bcm5719-llvm-f94c4c84e6b3f74a615db16a67c333485d160777.zip
[AArch, PowerPC] add more tests for legal rotate ops; NFC
llvm-svn: 337964
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/CodeGen/AArch64/funnel-shift-rot.ll22
-rw-r--r--llvm/test/CodeGen/PowerPC/funnel-shift-rot.ll29
2 files changed, 47 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/AArch64/funnel-shift-rot.ll b/llvm/test/CodeGen/AArch64/funnel-shift-rot.ll
index 5e9b0633e9b..0b3bc665bdf 100644
--- a/llvm/test/CodeGen/AArch64/funnel-shift-rot.ll
+++ b/llvm/test/CodeGen/AArch64/funnel-shift-rot.ll
@@ -64,6 +64,19 @@ define i32 @rotl_i32(i32 %x, i32 %z) {
ret i32 %f
}
+define i64 @rotl_i64(i64 %x, i64 %z) {
+; CHECK-LABEL: rotl_i64:
+; CHECK: // %bb.0:
+; CHECK-NEXT: orr w9, wzr, #0x40
+; CHECK-NEXT: sub w9, w9, w1
+; CHECK-NEXT: lsl x8, x0, x1
+; CHECK-NEXT: lsr x9, x0, x9
+; CHECK-NEXT: orr x0, x8, x9
+; CHECK-NEXT: ret
+ %f = call i64 @llvm.fshl.i64(i64 %x, i64 %x, i64 %z)
+ ret i64 %f
+}
+
; Vector rotate.
define <4 x i32> @rotl_v4i32(<4 x i32> %x, <4 x i32> %z) {
@@ -138,6 +151,15 @@ define i16 @rotr_i16(i16 %x, i16 %z) {
ret i16 %f
}
+define i32 @rotr_i32(i32 %x, i32 %z) {
+; CHECK-LABEL: rotr_i32:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ror w0, w0, w1
+; CHECK-NEXT: ret
+ %f = call i32 @llvm.fshr.i32(i32 %x, i32 %x, i32 %z)
+ ret i32 %f
+}
+
define i64 @rotr_i64(i64 %x, i64 %z) {
; CHECK-LABEL: rotr_i64:
; CHECK: // %bb.0:
diff --git a/llvm/test/CodeGen/PowerPC/funnel-shift-rot.ll b/llvm/test/CodeGen/PowerPC/funnel-shift-rot.ll
index 41317ed68d9..b238504edc1 100644
--- a/llvm/test/CodeGen/PowerPC/funnel-shift-rot.ll
+++ b/llvm/test/CodeGen/PowerPC/funnel-shift-rot.ll
@@ -62,13 +62,23 @@ define i32 @rotl_i32(i32 %x, i32 %z) {
ret i32 %f
}
+define i64 @rotl_i64(i64 %x, i64 %z) {
+; CHECK-LABEL: rotl_i64:
+; CHECK: # %bb.0:
+; CHECK-NEXT: rlwinm 4, 4, 0, 26, 31
+; CHECK-NEXT: rotld 3, 3, 4
+; CHECK-NEXT: blr
+ %f = call i64 @llvm.fshl.i64(i64 %x, i64 %x, i64 %z)
+ ret i64 %f
+}
+
; Vector rotate.
define <4 x i32> @rotl_v4i32(<4 x i32> %x, <4 x i32> %z) {
; CHECK-LABEL: rotl_v4i32:
; CHECK: # %bb.0:
-; CHECK-NEXT: addis 3, 2, .LCPI4_0@toc@ha
-; CHECK-NEXT: addi 3, 3, .LCPI4_0@toc@l
+; CHECK-NEXT: addis 3, 2, .LCPI5_0@toc@ha
+; CHECK-NEXT: addi 3, 3, .LCPI5_0@toc@l
; CHECK-NEXT: lvx 4, 0, 3
; CHECK-NEXT: vsubuwm 4, 4, 3
; CHECK-NEXT: vslw 3, 2, 3
@@ -135,6 +145,17 @@ define i16 @rotr_i16(i16 %x, i16 %z) {
ret i16 %f
}
+define i32 @rotr_i32(i32 %x, i32 %z) {
+; CHECK-LABEL: rotr_i32:
+; CHECK: # %bb.0:
+; CHECK-NEXT: subfic 4, 4, 32
+; CHECK-NEXT: clrlwi 4, 4, 27
+; CHECK-NEXT: rlwnm 3, 3, 4, 0, 31
+; CHECK-NEXT: blr
+ %f = call i32 @llvm.fshr.i32(i32 %x, i32 %x, i32 %z)
+ ret i32 %f
+}
+
define i64 @rotr_i64(i64 %x, i64 %z) {
; CHECK-LABEL: rotr_i64:
; CHECK: # %bb.0:
@@ -151,8 +172,8 @@ define i64 @rotr_i64(i64 %x, i64 %z) {
define <4 x i32> @rotr_v4i32(<4 x i32> %x, <4 x i32> %z) {
; CHECK-LABEL: rotr_v4i32:
; CHECK: # %bb.0:
-; CHECK-NEXT: addis 3, 2, .LCPI10_0@toc@ha
-; CHECK-NEXT: addi 3, 3, .LCPI10_0@toc@l
+; CHECK-NEXT: addis 3, 2, .LCPI12_0@toc@ha
+; CHECK-NEXT: addi 3, 3, .LCPI12_0@toc@l
; CHECK-NEXT: lvx 4, 0, 3
; CHECK-NEXT: vsubuwm 4, 4, 3
; CHECK-NEXT: vsrw 3, 2, 3
OpenPOWER on IntegriCloud