llvm-project/llvm/test/Transforms/InstCombine/and-or-icmps.ll

54 lines
1.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s
define i1 @PR1817_1(i32 %X) {
; CHECK-LABEL: @PR1817_1(
; CHECK-NEXT: [[A:%.*]] = icmp slt i32 %X, 10
; CHECK-NEXT: [[B:%.*]] = icmp ult i32 %X, 10
; CHECK-NEXT: [[C:%.*]] = and i1 [[A]], [[B]]
; CHECK-NEXT: ret i1 [[C]]
;
%A = icmp slt i32 %X, 10
%B = icmp ult i32 %X, 10
%C = and i1 %A, %B
ret i1 %C
}
define i1 @PR1817_2(i32 %X) {
; CHECK-LABEL: @PR1817_2(
; CHECK-NEXT: [[A:%.*]] = icmp slt i32 %X, 10
; CHECK-NEXT: [[B:%.*]] = icmp ult i32 %X, 10
; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
; CHECK-NEXT: ret i1 [[C]]
;
%A = icmp slt i32 %X, 10
%B = icmp ult i32 %X, 10
%C = or i1 %A, %B
ret i1 %C
}
define i1 @PR2330(i32 %a, i32 %b) {
; CHECK-LABEL: @PR2330(
; CHECK-NEXT: [[TMP1:%.*]] = or i32 %b, %a
; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i32 [[TMP1]], 8
; CHECK-NEXT: ret i1 [[TMP2]]
;
%cmp1 = icmp ult i32 %a, 8
%cmp2 = icmp ult i32 %b, 8
%and = and i1 %cmp2, %cmp1
ret i1 %and
}
define i1 @test(i32 %tmp1030) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[TMP1030_OFF:%.*]] = add i32 %tmp1030, -39
; CHECK-NEXT: [[TMP1030_CMP:%.*]] = icmp ugt i32 [[TMP1030_OFF]], 1
; CHECK-NEXT: ret i1 [[TMP1030_CMP]]
;
%tmp1037 = icmp ne i32 %tmp1030, 39
%tmp1039 = icmp ne i32 %tmp1030, 40
%tmp1042 = and i1 %tmp1037, %tmp1039
ret i1 %tmp1042
}