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
; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s

declare { i16, i1 } @llvm.sadd.with.overflow.i16(i16, i16) nounwind readnone
declare { i16, i1 } @llvm.uadd.with.overflow.i16(i16, i16) nounwind readnone
declare { i16, i1 } @llvm.ssub.with.overflow.i16(i16, i16) nounwind readnone
declare { i16, i1 } @llvm.usub.with.overflow.i16(i16, i16) nounwind readnone
declare { i16, i1 } @llvm.smul.with.overflow.i16(i16, i16) nounwind readnone
declare { i16, i1 } @llvm.umul.with.overflow.i16(i16, i16) nounwind readnone

; CHECK-LABEL: Classifying expressions for: @uadd_exhaustive
; CHECK: Loop %for.body: backedge-taken count is 35
define void @uadd_exhaustive() {
entry:
  br i1 undef, label %for.end, label %for.body.preheader

for.body.preheader:                               ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %for.body.preheader, %for.body
  %indvars.iv = phi i16 [ %math, %for.body ], [ 65500, %for.body.preheader ]
  %0 = call { i16, i1 } @llvm.uadd.with.overflow.i16(i16 %indvars.iv, i16 1)
  %math = extractvalue { i16, i1 } %0, 0
  %ov = extractvalue { i16, i1 } %0, 1
  br i1 %ov, label %for.end, label %for.body

for.end:                                          ; preds = %for.body, %entry
  ret void
}

; CHECK-LABEL: Classifying expressions for: @sadd_exhaustive
; CHECK: Loop %for.body: backedge-taken count is 67
define void @sadd_exhaustive() {
entry:
  br i1 undef, label %for.end, label %for.body.preheader

for.body.preheader:                               ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %for.body.preheader, %for.body
  %indvars.iv = phi i16 [ %math, %for.body ], [ 32700, %for.body.preheader ]
  %0 = call { i16, i1 } @llvm.sadd.with.overflow.i16(i16 %indvars.iv, i16 1)
  %math = extractvalue { i16, i1 } %0, 0
  %ov = extractvalue { i16, i1 } %0, 1
  br i1 %ov, label %for.end, label %for.body

for.end:                                          ; preds = %for.body, %entry
  ret void
}

; CHECK-LABEL: Classifying expressions for: @usub_exhaustive
; CHECK: Loop %for.body: backedge-taken count is 50
define void @usub_exhaustive() {
entry:
  br i1 undef, label %for.end, label %for.body.preheader

for.body.preheader:                               ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %for.body.preheader, %for.body
  %indvars.iv = phi i16 [ %math, %for.body ], [ 50, %for.body.preheader ]
  %0 = call { i16, i1 } @llvm.usub.with.overflow.i16(i16 %indvars.iv, i16 1)
  %math = extractvalue { i16, i1 } %0, 0
  %ov = extractvalue { i16, i1 } %0, 1
  br i1 %ov, label %for.end, label %for.body

for.end:                                          ; preds = %for.body, %entry
  ret void
}

; CHECK-LABEL: Classifying expressions for: @ssub_exhaustive
; CHECK: Loop %for.body: backedge-taken count is 68
define void @ssub_exhaustive() {
entry:
  br i1 undef, label %for.end, label %for.body.preheader

for.body.preheader:                               ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %for.body.preheader, %for.body
  %indvars.iv = phi i16 [ %math, %for.body ], [ -32700, %for.body.preheader ]
  %0 = call { i16, i1 } @llvm.ssub.with.overflow.i16(i16 %indvars.iv, i16 1)
  %math = extractvalue { i16, i1 } %0, 0
  %ov = extractvalue { i16, i1 } %0, 1
  br i1 %ov, label %for.end, label %for.body

for.end:                                          ; preds = %for.body, %entry
  ret void
}

; CHECK-LABEL: Classifying expressions for: @smul_exhaustive
; CHECK: Loop %for.body: backedge-taken count is 14
define void @smul_exhaustive() {
entry:
  br i1 undef, label %for.end, label %for.body.preheader

for.body.preheader:                               ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %for.body.preheader, %for.body
  %indvars.iv = phi i16 [ %math, %for.body ], [ 1, %for.body.preheader ]
  %0 = call { i16, i1 } @llvm.smul.with.overflow.i16(i16 %indvars.iv, i16 2)
  %math = extractvalue { i16, i1 } %0, 0
  %ov = extractvalue { i16, i1 } %0, 1
  br i1 %ov, label %for.end, label %for.body

for.end:                                          ; preds = %for.body, %entry
  ret void
}

; CHECK-LABEL: Classifying expressions for: @umul_exhaustive
; CHECK: Loop %for.body: backedge-taken count is 15
define void @umul_exhaustive() {
entry:
  br i1 undef, label %for.end, label %for.body.preheader

for.body.preheader:                               ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %for.body.preheader, %for.body
  %indvars.iv = phi i16 [ %math, %for.body ], [ 1, %for.body.preheader ]
  %0 = call { i16, i1 } @llvm.umul.with.overflow.i16(i16 %indvars.iv, i16 2)
  %math = extractvalue { i16, i1 } %0, 0
  %ov = extractvalue { i16, i1 } %0, 1
  br i1 %ov, label %for.end, label %for.body

for.end:                                          ; preds = %for.body, %entry
  ret void
}