[llvm] 14eea55 - [InstSimplify][NFC][test] Add tests for Odd - X ==/!= X -> false/true
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 5 08:17:35 PDT 2022
Author: LiaoChunyu
Date: 2022-09-05T23:17:26+08:00
New Revision: 14eea554450b4ea0e341713448665ede09ce9dd1
URL: https://github.com/llvm/llvm-project/commit/14eea554450b4ea0e341713448665ede09ce9dd1
DIFF: https://github.com/llvm/llvm-project/commit/14eea554450b4ea0e341713448665ede09ce9dd1.diff
LOG: [InstSimplify][NFC][test] Add tests for Odd - X ==/!= X -> false/true
testcases will be updated by D132989
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D133306
Added:
Modified:
llvm/test/Transforms/InstSimplify/icmp.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/icmp.ll b/llvm/test/Transforms/InstSimplify/icmp.ll
index 88f4d42c74039..b967198dd6c94 100644
--- a/llvm/test/Transforms/InstSimplify/icmp.ll
+++ b/llvm/test/Transforms/InstSimplify/icmp.ll
@@ -211,3 +211,58 @@ loop:
%sub2 = sub i32 42, %p2
br label %loop
}
+
+define i1 @sub_false(i32 %x) {
+; CHECK-LABEL: @sub_false(
+; CHECK-NEXT: [[SUB:%.*]] = sub i32 1, [[X:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[SUB]], [[X]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sub = sub i32 1, %x
+ %cmp = icmp eq i32 %sub, %x
+ ret i1 %cmp
+}
+
+define i1 @sub_swap(i8 %x) {
+; CHECK-LABEL: @sub_swap(
+; CHECK-NEXT: [[SUB:%.*]] = sub i8 3, [[X:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[X]], [[SUB]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sub = sub i8 3, %x
+ %cmp = icmp ne i8 %x, %sub
+ ret i1 %cmp
+}
+
+define <2 x i1> @sub_odd(<2 x i8> %x) {
+; CHECK-LABEL: @sub_odd(
+; CHECK-NEXT: [[SUB:%.*]] = sub <2 x i8> <i8 3, i8 3>, [[X:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i8> [[SUB]], [[X]]
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %sub = sub <2 x i8> <i8 3, i8 3>, %x
+ %cmp = icmp ne <2 x i8> %sub, %x
+ ret <2 x i1> %cmp
+}
+
+define <2 x i1> @sub_odd_poison(<2 x i8> %x) {
+; CHECK-LABEL: @sub_odd_poison(
+; CHECK-NEXT: [[SUB:%.*]] = sub <2 x i8> <i8 poison, i8 1>, [[X:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i8> [[SUB]], [[X]]
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %sub = sub <2 x i8> <i8 poison, i8 1>, %x
+ %cmp = icmp ne <2 x i8> %sub, %x
+ ret <2 x i1> %cmp
+}
+
+define i1 @sub_even(i8 %x) {
+; CHECK-LABEL: @sub_even(
+; CHECK-NEXT: [[SUB:%.*]] = sub i8 2, [[X:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[SUB]], [[X]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sub = sub i8 2, %x
+ %cmp = icmp ne i8 %sub, %x
+ ret i1 %cmp
+}
More information about the llvm-commits
mailing list