reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s

define i1 @test_umax1(i32 %n) {
; CHECK-LABEL: @test_umax1(
; CHECK-NEXT:    ret i1 true
;
  %c1 = icmp ugt i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp ugt i32 %s, 9
  ret i1 %c2
}

define i1 @test_umax2(i32 %n) {
; CHECK-LABEL: @test_umax2(
; CHECK-NEXT:    [[C1:%.*]] = icmp ugt i32 [[N:%.*]], 10
; CHECK-NEXT:    ret i1 [[C1]]
;
  %c1 = icmp ugt i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp ugt i32 %s, 10
  ret i1 %c2
}

define i1 @test_umax3(i32 %n) {
; CHECK-LABEL: @test_umax3(
; CHECK-NEXT:    [[C1:%.*]] = icmp ugt i32 [[N:%.*]], 10
; CHECK-NEXT:    [[S:%.*]] = select i1 [[C1]], i32 [[N]], i32 10
; CHECK-NEXT:    [[C2:%.*]] = icmp ugt i32 [[S]], 11
; CHECK-NEXT:    ret i1 [[C2]]
;
  %c1 = icmp ugt i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp ugt i32 %s, 11
  ret i1 %c2
}

define i1 @test_umin1(i32 %n) {
; CHECK-LABEL: @test_umin1(
; CHECK-NEXT:    ret i1 true
;
  %c1 = icmp ult i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp ult i32 %s, 11
  ret i1 %c2
}

define i1 @test_umin2(i32 %n) {
; CHECK-LABEL: @test_umin2(
; CHECK-NEXT:    [[C1:%.*]] = icmp ult i32 [[N:%.*]], 10
; CHECK-NEXT:    ret i1 [[C1]]
;
  %c1 = icmp ult i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp ult i32 %s, 10
  ret i1 %c2
}

define i1 @test_umin3(i32 %n) {
; CHECK-LABEL: @test_umin3(
; CHECK-NEXT:    [[C1:%.*]] = icmp ult i32 [[N:%.*]], 10
; CHECK-NEXT:    [[S:%.*]] = select i1 [[C1]], i32 [[N]], i32 10
; CHECK-NEXT:    [[C2:%.*]] = icmp ult i32 [[S]], 9
; CHECK-NEXT:    ret i1 [[C2]]
;
  %c1 = icmp ult i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp ult i32 %s, 9
  ret i1 %c2
}

define i1 @test_smax1(i32 %n) {
; CHECK-LABEL: @test_smax1(
; CHECK-NEXT:    ret i1 true
;
  %c1 = icmp sgt i32 %n, -10
  %s = select i1 %c1, i32 %n, i32 -10
  %c2 = icmp sgt i32 %s, -11
  ret i1 %c2
}

define i1 @test_smax2(i32 %n) {
; CHECK-LABEL: @test_smax2(
; CHECK-NEXT:    [[C1:%.*]] = icmp sgt i32 [[N:%.*]], -10
; CHECK-NEXT:    ret i1 [[C1]]
;
  %c1 = icmp sgt i32 %n, -10
  %s = select i1 %c1, i32 %n, i32 -10
  %c2 = icmp sgt i32 %s, -10
  ret i1 %c2
}

define i1 @test_smax3(i32 %n) {
; CHECK-LABEL: @test_smax3(
; CHECK-NEXT:    [[C1:%.*]] = icmp sgt i32 [[N:%.*]], -10
; CHECK-NEXT:    [[S:%.*]] = select i1 [[C1]], i32 [[N]], i32 -10
; CHECK-NEXT:    [[C2:%.*]] = icmp sgt i32 [[S]], -9
; CHECK-NEXT:    ret i1 [[C2]]
;
  %c1 = icmp sgt i32 %n, -10
  %s = select i1 %c1, i32 %n, i32 -10
  %c2 = icmp sgt i32 %s, -9
  ret i1 %c2
}

define i1 @test_smin1(i32 %n) {
; CHECK-LABEL: @test_smin1(
; CHECK-NEXT:    ret i1 true
;
  %c1 = icmp slt i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp slt i32 %s, 11
  ret i1 %c2
}

define i1 @test_smin2(i32 %n) {
; CHECK-LABEL: @test_smin2(
; CHECK-NEXT:    [[C1:%.*]] = icmp slt i32 [[N:%.*]], 10
; CHECK-NEXT:    ret i1 [[C1]]
;
  %c1 = icmp slt i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp slt i32 %s, 10
  ret i1 %c2
}

define i1 @test_smin3(i32 %n) {
; CHECK-LABEL: @test_smin3(
; CHECK-NEXT:    [[C1:%.*]] = icmp slt i32 [[N:%.*]], 10
; CHECK-NEXT:    [[S:%.*]] = select i1 [[C1]], i32 [[N]], i32 10
; CHECK-NEXT:    [[C2:%.*]] = icmp slt i32 [[S]], 9
; CHECK-NEXT:    ret i1 [[C2]]
;
  %c1 = icmp slt i32 %n, 10
  %s = select i1 %c1, i32 %n, i32 10
  %c2 = icmp slt i32 %s, 9
  ret i1 %c2
}