• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instcombine -S | FileCheck %s
3
4define i1 @PR1817_1(i32 %X) {
5; CHECK-LABEL: @PR1817_1(
6; CHECK-NEXT:    [[A:%.*]] = icmp slt i32 %X, 10
7; CHECK-NEXT:    [[B:%.*]] = icmp ult i32 %X, 10
8; CHECK-NEXT:    [[C:%.*]] = and i1 [[A]], [[B]]
9; CHECK-NEXT:    ret i1 [[C]]
10;
11  %A = icmp slt i32 %X, 10
12  %B = icmp ult i32 %X, 10
13  %C = and i1 %A, %B
14  ret i1 %C
15}
16
17define i1 @PR1817_2(i32 %X) {
18; CHECK-LABEL: @PR1817_2(
19; CHECK-NEXT:    [[A:%.*]] = icmp slt i32 %X, 10
20; CHECK-NEXT:    [[B:%.*]] = icmp ult i32 %X, 10
21; CHECK-NEXT:    [[C:%.*]] = or i1 [[A]], [[B]]
22; CHECK-NEXT:    ret i1 [[C]]
23;
24  %A = icmp slt i32 %X, 10
25  %B = icmp ult i32 %X, 10
26  %C = or i1 %A, %B
27  ret i1 %C
28}
29
30define i1 @PR2330(i32 %a, i32 %b) {
31; CHECK-LABEL: @PR2330(
32; CHECK-NEXT:    [[TMP1:%.*]] = or i32 %b, %a
33; CHECK-NEXT:    [[TMP2:%.*]] = icmp ult i32 [[TMP1]], 8
34; CHECK-NEXT:    ret i1 [[TMP2]]
35;
36  %cmp1 = icmp ult i32 %a, 8
37  %cmp2 = icmp ult i32 %b, 8
38  %and = and i1 %cmp2, %cmp1
39  ret i1 %and
40}
41
42define i1 @test(i32 %tmp1030) {
43; CHECK-LABEL: @test(
44; CHECK-NEXT:    [[TMP1030_OFF:%.*]] = add i32 %tmp1030, -39
45; CHECK-NEXT:    [[TMP1030_CMP:%.*]] = icmp ugt i32 [[TMP1030_OFF]], 1
46; CHECK-NEXT:    ret i1 [[TMP1030_CMP]]
47;
48  %tmp1037 = icmp ne i32 %tmp1030, 39
49  %tmp1039 = icmp ne i32 %tmp1030, 40
50  %tmp1042 = and i1 %tmp1037, %tmp1039
51  ret i1 %tmp1042
52}
53
54