[llvm] 2b252c1 - [InstCombine] Add commuted or of icmp test (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 03:28:20 PDT 2022
Author: Nikita Popov
Date: 2022-04-22T12:28:12+02:00
New Revision: 2b252c159f535f6b91f4e3cf092919b206e4a526
URL: https://github.com/llvm/llvm-project/commit/2b252c159f535f6b91f4e3cf092919b206e4a526
DIFF: https://github.com/llvm/llvm-project/commit/2b252c159f535f6b91f4e3cf092919b206e4a526.diff
LOG: [InstCombine] Add commuted or of icmp test (NFC)
Added:
Modified:
llvm/test/Transforms/InstCombine/or.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll
index f34d0d8f1b4d7..09d6780c917d8 100644
--- a/llvm/test/Transforms/InstCombine/or.ll
+++ b/llvm/test/Transforms/InstCombine/or.ll
@@ -37,6 +37,20 @@ define i1 @test14(i32 %A, i32 %B) {
ret i1 %D
}
+define i1 @test14_commuted(i32 %A, i32 %B) {
+; CHECK-LABEL: @test14_commuted(
+; CHECK-NEXT: [[C1:%.*]] = icmp ugt i32 [[B:%.*]], [[A:%.*]]
+; CHECK-NEXT: [[C2:%.*]] = icmp ult i32 [[B]], [[A]]
+; CHECK-NEXT: [[D:%.*]] = or i1 [[C1]], [[C2]]
+; CHECK-NEXT: ret i1 [[D]]
+;
+ %C1 = icmp ult i32 %A, %B
+ %C2 = icmp ult i32 %B, %A
+ ; (A < B) | (A > B) === A != B
+ %D = or i1 %C1, %C2
+ ret i1 %D
+}
+
define i1 @test14_logical(i32 %A, i32 %B) {
; CHECK-LABEL: @test14_logical(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i32 [[A:%.*]], [[B:%.*]]
More information about the llvm-commits
mailing list