[llvm] 93ccb8e - [InstSimplify] Add additional zext/sext comparison tests (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 4 02:03:12 PDT 2020
Author: Nikita Popov
Date: 2020-07-04T11:03:00+02:00
New Revision: 93ccb8eb52f7e7474afaa782fcc6c52bd8c1494b
URL: https://github.com/llvm/llvm-project/commit/93ccb8eb52f7e7474afaa782fcc6c52bd8c1494b
DIFF: https://github.com/llvm/llvm-project/commit/93ccb8eb52f7e7474afaa782fcc6c52bd8c1494b.diff
LOG: [InstSimplify] Add additional zext/sext comparison tests (NFC)
Add vector variants, and negative tests where the operand does
not match.
Added:
Modified:
llvm/test/Transforms/InstSimplify/cmp_ext.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/cmp_ext.ll b/llvm/test/Transforms/InstSimplify/cmp_ext.ll
index 48faced4b077..4bbe23bb870a 100644
--- a/llvm/test/Transforms/InstSimplify/cmp_ext.ll
+++ b/llvm/test/Transforms/InstSimplify/cmp_ext.ll
@@ -208,3 +208,55 @@ define i1 @sext_sle_zext(i32 %x) {
%cmp = icmp sle i64 %sext, %zext
ret i1 %cmp
}
+
+define <4 x i1> @zext_ugt_sext_vec(<4 x i32> %x) {
+; CHECK-LABEL: @zext_ugt_sext_vec(
+; CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i32> [[X:%.*]] to <4 x i64>
+; CHECK-NEXT: [[ZEXT:%.*]] = zext <4 x i32> [[X]] to <4 x i64>
+; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <4 x i64> [[ZEXT]], [[SEXT]]
+; CHECK-NEXT: ret <4 x i1> [[CMP]]
+;
+ %sext = sext <4 x i32> %x to <4 x i64>
+ %zext = zext <4 x i32> %x to <4 x i64>
+ %cmp = icmp ugt <4 x i64> %zext, %sext
+ ret <4 x i1> %cmp
+}
+
+define <4 x i1> @sext_ult_zext_vec(<4 x i32> %x) {
+; CHECK-LABEL: @sext_ult_zext_vec(
+; CHECK-NEXT: [[SEXT:%.*]] = sext <4 x i32> [[X:%.*]] to <4 x i64>
+; CHECK-NEXT: [[ZEXT:%.*]] = zext <4 x i32> [[X]] to <4 x i64>
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult <4 x i64> [[SEXT]], [[ZEXT]]
+; CHECK-NEXT: ret <4 x i1> [[CMP]]
+;
+ %sext = sext <4 x i32> %x to <4 x i64>
+ %zext = zext <4 x i32> %x to <4 x i64>
+ %cmp = icmp ult <4 x i64> %sext, %zext
+ ret <4 x i1> %cmp
+}
+
+define i1 @zext_ugt_sext_
diff erent_operand(i32 %x, i32 %y) {
+; CHECK-LABEL: @zext_ugt_sext_
diff erent_operand(
+; CHECK-NEXT: [[SEXT:%.*]] = sext i32 [[X:%.*]] to i64
+; CHECK-NEXT: [[ZEXT:%.*]] = zext i32 [[Y:%.*]] to i64
+; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i64 [[ZEXT]], [[SEXT]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sext = sext i32 %x to i64
+ %zext = zext i32 %y to i64
+ %cmp = icmp ugt i64 %zext, %sext
+ ret i1 %cmp
+}
+
+define i1 @sext_ult_zext_
diff erent_operand(i32 %x, i32 %y) {
+; CHECK-LABEL: @sext_ult_zext_
diff erent_operand(
+; CHECK-NEXT: [[SEXT:%.*]] = sext i32 [[X:%.*]] to i64
+; CHECK-NEXT: [[ZEXT:%.*]] = zext i32 [[Y:%.*]] to i64
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[SEXT]], [[ZEXT]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sext = sext i32 %x to i64
+ %zext = zext i32 %y to i64
+ %cmp = icmp ult i64 %sext, %zext
+ ret i1 %cmp
+}
More information about the llvm-commits
mailing list