[llvm] r346902 - [InstSimplify] add more tests for funnel shift with select; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 14 14:34:26 PST 2018
Author: spatel
Date: Wed Nov 14 14:34:25 2018
New Revision: 346902
URL: http://llvm.org/viewvc/llvm-project?rev=346902&view=rev
Log:
[InstSimplify] add more tests for funnel shift with select; NFC
The cases are just different enough that we should have
complete tests to avoid bugs from typos in the code.
Modified:
llvm/trunk/test/Transforms/InstSimplify/call.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/call.ll?rev=346902&r1=346901&r2=346902&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/call.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/call.ll Wed Nov 14 14:34:25 2018
@@ -513,6 +513,58 @@ define i8 @fshl_zero_shift_guard(i8 %x,
ret i8 %s
}
+define i8 @fshl_zero_shift_guard_swapped(i8 %x, i8 %y, i8 %sh) {
+; CHECK-LABEL: @fshl_zero_shift_guard_swapped(
+; CHECK-NEXT: [[C:%.*]] = icmp ne i8 [[SH:%.*]], 0
+; CHECK-NEXT: [[F:%.*]] = call i8 @llvm.fshl.i8(i8 [[X:%.*]], i8 [[Y:%.*]], i8 [[SH]])
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i8 [[F]], i8 [[X]]
+; CHECK-NEXT: ret i8 [[S]]
+;
+ %c = icmp ne i8 %sh, 0
+ %f = call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 %sh)
+ %s = select i1 %c, i8 %f, i8 %x
+ ret i8 %s
+}
+
+define i8 @fshl_zero_shift_guard_inverted(i8 %x, i8 %y, i8 %sh) {
+; CHECK-LABEL: @fshl_zero_shift_guard_inverted(
+; CHECK-NEXT: [[C:%.*]] = icmp eq i8 [[SH:%.*]], 0
+; CHECK-NEXT: [[F:%.*]] = call i8 @llvm.fshl.i8(i8 [[X:%.*]], i8 [[Y:%.*]], i8 [[SH]])
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i8 [[F]], i8 [[X]]
+; CHECK-NEXT: ret i8 [[S]]
+;
+ %c = icmp eq i8 %sh, 0
+ %f = call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 %sh)
+ %s = select i1 %c, i8 %f, i8 %x
+ ret i8 %s
+}
+
+define i8 @fshl_zero_shift_guard_inverted_swapped(i8 %x, i8 %y, i8 %sh) {
+; CHECK-LABEL: @fshl_zero_shift_guard_inverted_swapped(
+; CHECK-NEXT: [[C:%.*]] = icmp ne i8 [[SH:%.*]], 0
+; CHECK-NEXT: [[F:%.*]] = call i8 @llvm.fshl.i8(i8 [[X:%.*]], i8 [[Y:%.*]], i8 [[SH]])
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i8 [[X]], i8 [[F]]
+; CHECK-NEXT: ret i8 [[S]]
+;
+ %c = icmp ne i8 %sh, 0
+ %f = call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 %sh)
+ %s = select i1 %c, i8 %x, i8 %f
+ ret i8 %s
+}
+
+define i9 @fshr_zero_shift_guard(i9 %x, i9 %y, i9 %sh) {
+; CHECK-LABEL: @fshr_zero_shift_guard(
+; CHECK-NEXT: [[C:%.*]] = icmp eq i9 [[SH:%.*]], 0
+; CHECK-NEXT: [[F:%.*]] = call i9 @llvm.fshr.i9(i9 [[X:%.*]], i9 [[Y:%.*]], i9 [[SH]])
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i9 [[Y]], i9 [[F]]
+; CHECK-NEXT: ret i9 [[S]]
+;
+ %c = icmp eq i9 %sh, 0
+ %f = call i9 @llvm.fshr.i9(i9 %x, i9 %y, i9 %sh)
+ %s = select i1 %c, i9 %y, i9 %f
+ ret i9 %s
+}
+
define i9 @fshr_zero_shift_guard_swapped(i9 %x, i9 %y, i9 %sh) {
; CHECK-LABEL: @fshr_zero_shift_guard_swapped(
; CHECK-NEXT: [[C:%.*]] = icmp ne i9 [[SH:%.*]], 0
@@ -526,6 +578,32 @@ define i9 @fshr_zero_shift_guard_swapped
ret i9 %s
}
+define i9 @fshr_zero_shift_guard_inverted(i9 %x, i9 %y, i9 %sh) {
+; CHECK-LABEL: @fshr_zero_shift_guard_inverted(
+; CHECK-NEXT: [[C:%.*]] = icmp eq i9 [[SH:%.*]], 0
+; CHECK-NEXT: [[F:%.*]] = call i9 @llvm.fshr.i9(i9 [[X:%.*]], i9 [[Y:%.*]], i9 [[SH]])
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i9 [[F]], i9 [[Y]]
+; CHECK-NEXT: ret i9 [[S]]
+;
+ %c = icmp eq i9 %sh, 0
+ %f = call i9 @llvm.fshr.i9(i9 %x, i9 %y, i9 %sh)
+ %s = select i1 %c, i9 %f, i9 %y
+ ret i9 %s
+}
+
+define i9 @fshr_zero_shift_guard_inverted_swapped(i9 %x, i9 %y, i9 %sh) {
+; CHECK-LABEL: @fshr_zero_shift_guard_inverted_swapped(
+; CHECK-NEXT: [[C:%.*]] = icmp ne i9 [[SH:%.*]], 0
+; CHECK-NEXT: [[F:%.*]] = call i9 @llvm.fshr.i9(i9 [[X:%.*]], i9 [[Y:%.*]], i9 [[SH]])
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i9 [[Y]], i9 [[F]]
+; CHECK-NEXT: ret i9 [[S]]
+;
+ %c = icmp ne i9 %sh, 0
+ %f = call i9 @llvm.fshr.i9(i9 %x, i9 %y, i9 %sh)
+ %s = select i1 %c, i9 %y, i9 %f
+ ret i9 %s
+}
+
define i8 @fshl_zero_shift_guard_wrong_select_op(i8 %x, i8 %y, i8 %sh) {
; CHECK-LABEL: @fshl_zero_shift_guard_wrong_select_op(
; CHECK-NEXT: [[C:%.*]] = icmp eq i8 [[SH:%.*]], 0
@@ -539,19 +617,6 @@ define i8 @fshl_zero_shift_guard_wrong_s
ret i8 %s
}
-define i9 @fshr_zero_shift_guard_swapped_select_order(i9 %x, i9 %y, i9 %sh) {
-; CHECK-LABEL: @fshr_zero_shift_guard_swapped_select_order(
-; CHECK-NEXT: [[C:%.*]] = icmp eq i9 [[SH:%.*]], 0
-; CHECK-NEXT: [[F:%.*]] = call i9 @llvm.fshr.i9(i9 [[X:%.*]], i9 [[Y:%.*]], i9 [[SH]])
-; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i9 [[F]], i9 [[Y]]
-; CHECK-NEXT: ret i9 [[S]]
-;
- %c = icmp eq i9 %sh, 0
- %f = call i9 @llvm.fshr.i9(i9 %x, i9 %y, i9 %sh)
- %s = select i1 %c, i9 %f, i9 %y
- ret i9 %s
-}
-
define <2 x i8> @fshr_zero_shift_guard_splat(<2 x i8> %x, <2 x i8> %y, <2 x i8> %sh) {
; CHECK-LABEL: @fshr_zero_shift_guard_splat(
; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i8> [[SH:%.*]], zeroinitializer
More information about the llvm-commits
mailing list