[llvm] r347331 - [InstSimplify] add tests for funnel shift with undef operands; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 20 09:30:09 PST 2018
Author: spatel
Date: Tue Nov 20 09:30:09 2018
New Revision: 347331
URL: http://llvm.org/viewvc/llvm-project?rev=347331&view=rev
Log:
[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)
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=347331&r1=347330&r2=347331&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/call.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/call.ll Tue Nov 20 09:30:09 2018
@@ -628,3 +628,43 @@ define <2 x i8> @fshr_zero_shift_guard_s
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
+}
+
More information about the llvm-commits
mailing list