[llvm] b2fe025 - [InstCombine][test] add tests for icmp ult with constant and offset; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 16:00:20 PDT 2021


Author: Sanjay Patel
Date: 2021-06-30T19:00:12-04:00
New Revision: b2fe025707aae780d88db2446fc1ce618e40bdb3

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

LOG: [InstCombine][test] add tests for icmp ult with constant and offset; NFC

This is the 'ult' sibling pattern for:
c7b658aeb526c3e6

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/icmp-add.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp-add.ll b/llvm/test/Transforms/InstCombine/icmp-add.ll
index d611a80027cf..1fbc6d169f10 100644
--- a/llvm/test/Transforms/InstCombine/icmp-add.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-add.ll
@@ -793,3 +793,49 @@ define i1 @ugt_wrong_offset(i8 %a) {
   %ov = icmp ugt i8 %t, 251
   ret i1 %ov
 }
+
+define i1 @ult_offset(i8 %a) {
+; CHECK-LABEL: @ult_offset(
+; CHECK-NEXT:    [[T:%.*]] = add i8 [[A:%.*]], -6
+; CHECK-NEXT:    [[OV:%.*]] = icmp ult i8 [[T]], 122
+; CHECK-NEXT:    ret i1 [[OV]]
+;
+  %t = add i8 %a, 250
+  %ov = icmp ult i8 %t, 122
+  ret i1 %ov
+}
+
+define i1 @ult_offset_use(i32 %a) {
+; CHECK-LABEL: @ult_offset_use(
+; CHECK-NEXT:    [[T:%.*]] = add i32 [[A:%.*]], 42
+; CHECK-NEXT:    call void @use(i32 [[T]])
+; CHECK-NEXT:    [[OV:%.*]] = icmp ult i32 [[T]], -2147483606
+; CHECK-NEXT:    ret i1 [[OV]]
+;
+  %t = add i32 %a, 42
+  call void @use(i32 %t)
+  %ov = icmp ult i32 %t, 2147483690
+  ret i1 %ov
+}
+
+define <2 x i1> @ult_offset_splat(<2 x i5> %a) {
+; CHECK-LABEL: @ult_offset_splat(
+; CHECK-NEXT:    [[T:%.*]] = add <2 x i5> [[A:%.*]], <i5 9, i5 9>
+; CHECK-NEXT:    [[OV:%.*]] = icmp ult <2 x i5> [[T]], <i5 -7, i5 -7>
+; CHECK-NEXT:    ret <2 x i1> [[OV]]
+;
+  %t = add <2 x i5> %a, <i5 9, i5 9>
+  %ov = icmp ult <2 x i5> %t, <i5 25, i5 25>
+  ret <2 x i1> %ov
+}
+
+define i1 @ult_wrong_offset(i8 %a) {
+; CHECK-LABEL: @ult_wrong_offset(
+; CHECK-NEXT:    [[T:%.*]] = add i8 [[A:%.*]], -6
+; CHECK-NEXT:    [[OV:%.*]] = icmp ult i8 [[T]], 123
+; CHECK-NEXT:    ret i1 [[OV]]
+;
+  %t = add i8 %a, 250
+  %ov = icmp ult i8 %t, 123
+  ret i1 %ov
+}


        


More information about the llvm-commits mailing list