[llvm] c1abd47 - [InstSimplify] Add tests for icmp of min/max with constants (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 13:08:23 PDT 2020
Author: Nikita Popov
Date: 2020-08-12T22:07:29+02:00
New Revision: c1abd47aa16f71a3c0fff3ed6c5d2a3dbd3431f8
URL: https://github.com/llvm/llvm-project/commit/c1abd47aa16f71a3c0fff3ed6c5d2a3dbd3431f8
DIFF: https://github.com/llvm/llvm-project/commit/c1abd47aa16f71a3c0fff3ed6c5d2a3dbd3431f8.diff
LOG: [InstSimplify] Add tests for icmp of min/max with constants (NFC)
Test the case where the constants are not the same, but the result
is still known.
Added:
Modified:
llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll b/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
index 3f8d529fbce1..8bb93d8245b7 100644
--- a/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
+++ b/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
@@ -1853,3 +1853,47 @@ define i8 @umin_umin_umin(i8 %x, i8 %y) {
%r = call i8 @llvm.umin.i8(i8 %m1, i8 %m2)
ret i8 %r
}
+
+define i1 @umin_ult_
diff _const(i8 %x) {
+; CHECK-LABEL: @umin_ult_
diff _const(
+; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 10)
+; CHECK-NEXT: [[C:%.*]] = icmp ult i8 [[M]], 20
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %m = call i8 @llvm.umin.i8(i8 %x, i8 10)
+ %c = icmp ult i8 %m, 20
+ ret i1 %c
+}
+
+define i1 @umax_ugt_
diff _const(i8 %x) {
+; CHECK-LABEL: @umax_ugt_
diff _const(
+; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 10)
+; CHECK-NEXT: [[C:%.*]] = icmp ugt i8 [[M]], 5
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %m = call i8 @llvm.umax.i8(i8 %x, i8 10)
+ %c = icmp ugt i8 %m, 5
+ ret i1 %c
+}
+
+define i1 @smin_slt_
diff _const(i8 %x) {
+; CHECK-LABEL: @smin_slt_
diff _const(
+; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 10)
+; CHECK-NEXT: [[C:%.*]] = icmp slt i8 [[M]], 20
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %m = call i8 @llvm.smin.i8(i8 %x, i8 10)
+ %c = icmp slt i8 %m, 20
+ ret i1 %c
+}
+
+define i1 @smax_sgt_
diff _const(i8 %x) {
+; CHECK-LABEL: @smax_sgt_
diff _const(
+; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 10)
+; CHECK-NEXT: [[C:%.*]] = icmp sgt i8 [[M]], 5
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %m = call i8 @llvm.smax.i8(i8 %x, i8 10)
+ %c = icmp sgt i8 %m, 5
+ ret i1 %c
+}
More information about the llvm-commits
mailing list