1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc %s -o - -mtriple=powerpc-unknown-unknown -run-pass=machine-cse -verify-machineinstrs | FileCheck %s
3 # RUN: llc %s -o - -mtriple=powerpc-unknown-unknown -passes=machine-cse | FileCheck %s
5 define void @can_pre() {
10 br i1 undef, label %if.then, label %if.else
22 define void @cannot_pre() {
27 br i1 undef, label %if.then, label %if.else
42 - { id: 0, class: f8rc, preferred-register: '' }
43 - { id: 1, class: f8rc, preferred-register: '' }
44 - { id: 2, class: gprc, preferred-register: '' }
45 - { id: 3, class: gprc, preferred-register: '' }
46 - { id: 4, class: f8rc, preferred-register: '' }
47 - { id: 5, class: f8rc, preferred-register: '' }
49 - { reg: '$r1', virtual-reg: '%2' }
50 - { reg: '$r2', virtual-reg: '%3' }
51 - { reg: '$f1', virtual-reg: '%4' }
52 - { reg: '$f2', virtual-reg: '%5' }
54 ; CHECK-LABEL: name: can_pre
55 ; CHECK: bb.0.for.body:
56 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
57 ; CHECK-NEXT: liveins: $r1, $r2, $f1, $f2
59 ; CHECK-NEXT: [[COPY:%[0-9]+]]:f8rc = COPY $f2
60 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:f8rc = COPY $f1
61 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gprc = COPY $r2
62 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gprc = COPY $r1
63 ; CHECK-NEXT: $cr0 = CMPLWI [[COPY3]], 0
64 ; CHECK-NEXT: %6:f8rc = nofpexcept FDIV [[COPY1]], [[COPY]], implicit $rm
65 ; CHECK-NEXT: BCC 44, $cr0, %bb.1
68 ; CHECK-NEXT: bb.1.if.then:
69 ; CHECK-NEXT: successors: %bb.3(0x80000000)
73 ; CHECK-NEXT: bb.2.if.else:
74 ; CHECK-NEXT: successors: %bb.3(0x80000000)
76 ; CHECK-NEXT: bb.3.if.end:
77 ; CHECK-NEXT: BLR implicit $lr, implicit $rm
79 successors: %bb.1(0x40000000), %bb.2(0x40000000)
80 liveins: $r1, $r2, $f1, $f2
91 successors: %bb.3(0x80000000)
93 %0:f8rc = nofpexcept FDIV %4, %5, implicit $rm
97 successors: %bb.3(0x80000000)
99 %1:f8rc = nofpexcept FDIV %4, %5, implicit $rm
102 BLR implicit $lr, implicit $rm
107 - { id: 0, class: f8rc, preferred-register: '' }
108 - { id: 1, class: f8rc, preferred-register: '' }
109 - { id: 2, class: gprc, preferred-register: '' }
110 - { id: 3, class: gprc, preferred-register: '' }
111 - { id: 4, class: f8rc, preferred-register: '' }
112 - { id: 5, class: f8rc, preferred-register: '' }
113 - { id: 6, class: f8rc, preferred-register: '' }
115 - { reg: '$r1', virtual-reg: '%2' }
116 - { reg: '$r2', virtual-reg: '%3' }
117 - { reg: '$f1', virtual-reg: '%4' }
118 - { reg: '$f2', virtual-reg: '%5' }
120 ; CHECK-LABEL: name: cannot_pre
121 ; CHECK: bb.0.for.body:
122 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
123 ; CHECK-NEXT: liveins: $r1, $r2, $f1, $f2
125 ; CHECK-NEXT: [[COPY:%[0-9]+]]:f8rc = COPY $f2
126 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:f8rc = COPY $f1
127 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gprc = COPY $r2
128 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gprc = COPY $r1
129 ; CHECK-NEXT: $cr0 = CMPLWI [[COPY3]], 0
130 ; CHECK-NEXT: BCC 44, $cr0, %bb.1
131 ; CHECK-NEXT: B %bb.2
133 ; CHECK-NEXT: bb.1.if.then:
134 ; CHECK-NEXT: successors: %bb.3(0x80000000)
136 ; CHECK-NEXT: [[SETRND:%[0-9]+]]:f8rc = SETRND [[COPY2]], implicit-def $rm, implicit $rm
137 ; CHECK-NEXT: %0:f8rc = nofpexcept FDIV [[COPY1]], [[COPY]], implicit $rm
138 ; CHECK-NEXT: B %bb.3
140 ; CHECK-NEXT: bb.2.if.else:
141 ; CHECK-NEXT: successors: %bb.3(0x80000000)
143 ; CHECK-NEXT: %1:f8rc = nofpexcept FDIV [[COPY1]], [[COPY]], implicit $rm
145 ; CHECK-NEXT: bb.3.if.end:
146 ; CHECK-NEXT: BLR implicit $lr, implicit $rm
148 successors: %bb.1(0x40000000), %bb.2(0x40000000)
149 liveins: $r1, $r2, $f1, $f2
160 successors: %bb.3(0x80000000)
162 %6:f8rc = SETRND %3, implicit-def $rm, implicit $rm
163 %0:f8rc = nofpexcept FDIV %4, %5, implicit $rm
167 successors: %bb.3(0x80000000)
169 %1:f8rc = nofpexcept FDIV %4, %5, implicit $rm
172 BLR implicit $lr, implicit $rm