[llvm] a71d666 - [InstCombine] Precommit tests for D101807 (NFC)

Juneyoung Lee via llvm-commits llvm-commits at lists.llvm.org
Tue May 4 21:45:17 PDT 2021


Author: Juneyoung Lee
Date: 2021-05-05T13:44:57+09:00
New Revision: a71d666d189ed3b176b20c361604c7ec30d25621

URL: https://github.com/llvm/llvm-project/commit/a71d666d189ed3b176b20c361604c7ec30d25621
DIFF: https://github.com/llvm/llvm-project/commit/a71d666d189ed3b176b20c361604c7ec30d25621.diff

LOG: [InstCombine] Precommit tests for D101807 (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/select-safe-transforms.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/select-safe-transforms.ll b/llvm/test/Transforms/InstCombine/select-safe-transforms.ll
index a08cbb881edd..08f89f6973ae 100644
--- a/llvm/test/Transforms/InstCombine/select-safe-transforms.ll
+++ b/llvm/test/Transforms/InstCombine/select-safe-transforms.ll
@@ -178,3 +178,33 @@ define i1 @bools2_logical(i1 %a, i1 %b, i1 %c) {
   %or = select i1 %and1, i1 true, i1 %and2
   ret i1 %or
 }
+
+define i1 @orn_and_cmp_1_logical(i37 %a, i37 %b, i1 %y) {
+; CHECK-LABEL: @orn_and_cmp_1_logical(
+; CHECK-NEXT:    [[X:%.*]] = icmp sgt i37 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT:    [[X_INV:%.*]] = icmp sle i37 [[A]], [[B]]
+; CHECK-NEXT:    [[AND:%.*]] = select i1 [[Y:%.*]], i1 [[X]], i1 false
+; CHECK-NEXT:    [[OR:%.*]] = select i1 [[X_INV]], i1 true, i1 [[AND]]
+; CHECK-NEXT:    ret i1 [[OR]]
+;
+  %x = icmp sgt i37 %a, %b
+  %x_inv = icmp sle i37 %a, %b
+  %and = select i1 %y, i1 %x, i1 false
+  %or = select i1 %x_inv, i1 true, i1 %and
+  ret i1 %or
+}
+
+define i1 @orn_and_cmp_2_logical(i16 %a, i16 %b, i1 %y) {
+; CHECK-LABEL: @orn_and_cmp_2_logical(
+; CHECK-NEXT:    [[X:%.*]] = icmp sge i16 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT:    [[X_INV:%.*]] = icmp slt i16 [[A]], [[B]]
+; CHECK-NEXT:    [[AND:%.*]] = select i1 [[Y:%.*]], i1 [[X]], i1 false
+; CHECK-NEXT:    [[OR:%.*]] = select i1 [[AND]], i1 true, i1 [[X_INV]]
+; CHECK-NEXT:    ret i1 [[OR]]
+;
+  %x = icmp sge i16 %a, %b
+  %x_inv = icmp slt i16 %a, %b
+  %and = select i1 %y, i1 %x, i1 false
+  %or = select i1 %and, i1 true, i1 %x_inv
+  ret i1 %or
+}


        


More information about the llvm-commits mailing list