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
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
; RUN: llc < %s -mtriple=thumbv7m -mcpu=cortex-m7 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-BP
; RUN: llc < %s -mtriple=thumbv7m -mcpu=cortex-m3 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOBP

declare void @otherfn()

; CHECK-LABEL: triangle1:
; CHECK: itt ne
; CHECK: movne
; CHECK: strne
define i32 @triangle1(i32 %n, i32* %p) {
entry:
  %tobool = icmp eq i32 %n, 0
  br i1 %tobool, label %if.end, label %if.then

if.then:
  store i32 1, i32* %p, align 4
  br label %if.end

if.end:
  tail call void @otherfn()
  ret i32 0
}

; CHECK-LABEL: triangle2:
; CHECK-BP: itttt ne
; CHECK-BP: movne
; CHECK-BP: strne
; CHECK-BP: movne
; CHECK-BP: strne
; CHECK-NOBP: cbz
; CHECK-NOBP: movs
; CHECK-NOBP: str
; CHECK-NOBP: movs
; CHECK-NOBP: str
define i32 @triangle2(i32 %n, i32* %p, i32* %q) {
entry:
  %tobool = icmp eq i32 %n, 0
  br i1 %tobool, label %if.end, label %if.then

if.then:
  store i32 1, i32* %p, align 4
  store i32 2, i32* %q, align 4
  br label %if.end

if.end:
  tail call void @otherfn()
  ret i32 0
}

; CHECK-LABEL: triangle3:
; CHECK: cbz
; CHECK: movs
; CHECK: str
; CHECK: movs
; CHECK: str
; CHECK: movs
; CHECK: str
define i32 @triangle3(i32 %n, i32* %p, i32* %q, i32* %r) {
entry:
  %tobool = icmp eq i32 %n, 0
  br i1 %tobool, label %if.end, label %if.then

if.then:
  store i32 1, i32* %p, align 4
  store i32 2, i32* %q, align 4
  store i32 3, i32* %r, align 4
  br label %if.end

if.end:
  tail call void @otherfn()
  ret i32 0
}

; CHECK-LABEL: diamond1:
; CHECK: itee eq
; CHECK: ldreq
; CHECK: strne
define i32 @diamond1(i32 %n, i32* %p) {
entry:
  %tobool = icmp eq i32 %n, 0
  br i1 %tobool, label %if.else, label %if.then

if.then:
  store i32 %n, i32* %p, align 4
  br label %if.end

if.else:
  %0 = load i32, i32* %p, align 4
  br label %if.end

if.end:
  %n.addr.0 = phi i32 [ %n, %if.then ], [ %0, %if.else ]
  tail call void @otherfn()
  ret i32 %n.addr.0
}

; CHECK-LABEL: diamond2:
; CHECK-BP: cbz
; CHECK-BP: str
; CHECK-BP: str
; CHECK-BP: b
; CHECK-BP: str
; CHECK-BP: add
; CHECK-NOBP: ittee
; CHECK-NOBP: streq
; CHECK-NOBP: addeq
; CHECK-NOBP: strne
; CHECK-NOBP: strne
define i32 @diamond2(i32 %n, i32* %p, i32* %q) {
entry:
  %tobool = icmp eq i32 %n, 0
  br i1 %tobool, label %if.else, label %if.then

if.then:
  store i32 %n, i32* %p, align 4
  %arrayidx = getelementptr inbounds i32, i32* %p, i32 2
  store i32 %n, i32* %arrayidx, align 4
  br label %if.end

if.else:
  store i32 %n, i32* %q, align 4
  %0 = add i32 %n, 10
  br label %if.end

if.end:
  %n.addr.0 = phi i32 [ %n, %if.then ], [ %0, %if.else ]
  tail call void @otherfn()
  ret i32 %n.addr.0
}

; CHECK-LABEL: diamond3:
; CHECK: cbz
; CHECK: movs
; CHECK: str
; CHECK: b
; CHECK: ldr
; CHECK: ldr
; CHECK: adds
define i32 @diamond3(i32 %n, i32* %p, i32* %q) {
entry:
  %tobool = icmp eq i32 %n, 0
  br i1 %tobool, label %if.else, label %if.then

if.then:
  store i32 1, i32* %p, align 4
  br label %if.end

if.else:
  %0 = load i32, i32* %p, align 4
  %1 = load i32, i32* %q, align 4
  %add = add nsw i32 %1, %0
  br label %if.end

if.end:
  %n.addr.0 = phi i32 [ %n, %if.then ], [ %add, %if.else ]
  tail call void @otherfn()
  ret i32 %n.addr.0
}