summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-11-20 17:30:09 +0000
committerSanjay Patel <spatel@rotateright.com>2018-11-20 17:30:09 +0000
commit2778f56a40dba2efd6da9466a1405b4a097fb0b5 (patch)
treea84ab5ec7185507fab70ea20f06686657361c4a7
parenteea21da12a16d6f81a9cf213c988ab058c6b2722 (diff)
downloadbcm5719-llvm-2778f56a40dba2efd6da9466a1405b4a097fb0b5.tar.gz
bcm5719-llvm-2778f56a40dba2efd6da9466a1405b4a097fb0b5.zip
[InstSimplify] add tests for funnel shift with undef operands; NFC
These are part of D54666, so adding them here before the patch to show the baseline (currently unoptimized) results. Patch by: @nikic (Nikita Popov) llvm-svn: 347331
-rw-r--r--llvm/test/Transforms/InstSimplify/call.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index 3c054e3dfc0..4207a27fd36 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -628,3 +628,43 @@ define <2 x i8> @fshr_zero_shift_guard_splat(<2 x i8> %x, <2 x i8> %y, <2 x i8>
ret <2 x i8> %s
}
+; If first two operands of funnel shift are undef, the result is undef
+
+define i8 @fshl_ops_undef(i8 %shamt) {
+; CHECK-LABEL: @fshl_ops_undef(
+; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.fshl.i8(i8 undef, i8 undef, i8 [[SHAMT:%.*]])
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %r = call i8 @llvm.fshl.i8(i8 undef, i8 undef, i8 %shamt)
+ ret i8 %r
+}
+
+define i9 @fshr_ops_undef(i9 %shamt) {
+; CHECK-LABEL: @fshr_ops_undef(
+; CHECK-NEXT: [[R:%.*]] = call i9 @llvm.fshr.i9(i9 undef, i9 undef, i9 [[SHAMT:%.*]])
+; CHECK-NEXT: ret i9 [[R]]
+;
+ %r = call i9 @llvm.fshr.i9(i9 undef, i9 undef, i9 %shamt)
+ ret i9 %r
+}
+
+; If shift amount is undef, treat it as zero, returning operand 0 or 1
+
+define i8 @fshl_shift_undef(i8 %x, i8 %y) {
+; CHECK-LABEL: @fshl_shift_undef(
+; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.fshl.i8(i8 [[X:%.*]], i8 [[Y:%.*]], i8 undef)
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %r = call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 undef)
+ ret i8 %r
+}
+
+define i9 @fshr_shift_undef(i9 %x, i9 %y) {
+; CHECK-LABEL: @fshr_shift_undef(
+; CHECK-NEXT: [[R:%.*]] = call i9 @llvm.fshr.i9(i9 [[X:%.*]], i9 [[Y:%.*]], i9 undef)
+; CHECK-NEXT: ret i9 [[R]]
+;
+ %r = call i9 @llvm.fshr.i9(i9 %x, i9 %y, i9 undef)
+ ret i9 %r
+}
+
OpenPOWER on IntegriCloud