Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / AVR / inst-family-cond-branch.s
blobdc36425a884f3b0950546b42cc9c196ae9011b49
1 ; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
2 ; RUN: llvm-mc -filetype=obj -triple avr < %s \
3 ; RUN: | llvm-objdump -d - | FileCheck --check-prefix=INST %s
6 foo:
7 ; BREQ
8 breq .-18
9 breq .-12
10 brbs 1, .-18
11 brbs 1, baz
13 ; CHECK: breq .Ltmp0-18 ; encoding: [0bAAAAA001,0b111100AA]
14 ; CHECK: ; fixup A - offset: 0, value: .Ltmp0-18, kind: fixup_7_pcrel
15 ; CHECK: breq .Ltmp1-12 ; encoding: [0bAAAAA001,0b111100AA]
16 ; CHECK: ; fixup A - offset: 0, value: .Ltmp1-12, kind: fixup_7_pcrel
17 ; CHECK: brbs 1, .Ltmp2-18 ; encoding: [0bAAAAA001,0b111100AA]
18 ; CHECK: ; fixup A - offset: 0, value: .Ltmp2-18, kind: fixup_7_pcrel
19 ; CHECK: brbs 1, baz ; encoding: [0bAAAAA001,0b111100AA]
20 ; CHECK: ; fixup A - offset: 0, value: baz, kind: fixup_7_pcrel
22 ; INST-LABEL: <foo>:
23 ; INST: breq .-18
24 ; INST: breq .-12
25 ; INST: breq .-18
26 ; INST: breq .+0
28 ; BRNE
29 brne .+10
30 brne .+2
31 brbc 1, .+10
32 brbc 1, bar
34 ; CHECK: brne .Ltmp3+10 ; encoding: [0bAAAAA001,0b111101AA]
35 ; CHECK: ; fixup A - offset: 0, value: .Ltmp3+10, kind: fixup_7_pcrel
36 ; CHECK: brne .Ltmp4+2 ; encoding: [0bAAAAA001,0b111101AA]
37 ; CHECK: ; fixup A - offset: 0, value: .Ltmp4+2, kind: fixup_7_pcrel
38 ; CHECK: brbc 1, .Ltmp5+10 ; encoding: [0bAAAAA001,0b111101AA]
39 ; CHECK: ; fixup A - offset: 0, value: .Ltmp5+10, kind: fixup_7_pcrel
40 ; CHECK: brbc 1, bar ; encoding: [0bAAAAA001,0b111101AA]
41 ; CHECK: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel
43 ; INST: brne .+10
44 ; INST: brne .+2
45 ; INST: brne .+10
46 ; INST: brne .+0
48 bar:
49 ; BRCS
50 brcs .+8
51 brcs .+4
52 brbs 0, .+8
53 brbs 0, end
55 ; CHECK: brcs .Ltmp6+8 ; encoding: [0bAAAAA000,0b111100AA]
56 ; CHECK: ; fixup A - offset: 0, value: .Ltmp6+8, kind: fixup_7_pcrel
57 ; CHECK: brcs .Ltmp7+4 ; encoding: [0bAAAAA000,0b111100AA]
58 ; CHECK: ; fixup A - offset: 0, value: .Ltmp7+4, kind: fixup_7_pcrel
59 ; CHECK: brcs .Ltmp8+8 ; encoding: [0bAAAAA000,0b111100AA]
60 ; CHECK: ; fixup A - offset: 0, value: .Ltmp8+8, kind: fixup_7_pcrel
61 ; CHECK: brcs end ; encoding: [0bAAAAA000,0b111100AA]
62 ; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel
64 ; INST-LABEL: <bar>:
65 ; INST: brlo .+8
66 ; INST: brlo .+4
67 ; INST: brlo .+8
68 ; INST: brlo .+0
70 ; BRCC
71 brcc .+66
72 brcc .-22
73 brbc 0, .+66
74 brbc 0, baz
76 ; CHECK: brcc .Ltmp9+66 ; encoding: [0bAAAAA000,0b111101AA]
77 ; CHECK: ; fixup A - offset: 0, value: .Ltmp9+66, kind: fixup_7_pcrel
78 ; CHECK: brcc .Ltmp10-22 ; encoding: [0bAAAAA000,0b111101AA]
79 ; CHECK: ; fixup A - offset: 0, value: .Ltmp10-22, kind: fixup_7_pcrel
80 ; CHECK: brcc .Ltmp11+66 ; encoding: [0bAAAAA000,0b111101AA]
81 ; CHECK: ; fixup A - offset: 0, value: .Ltmp11+66, kind: fixup_7_pcrel
82 ; CHECK: brcc baz ; encoding: [0bAAAAA000,0b111101AA]
83 ; CHECK: ; fixup A - offset: 0, value: baz, kind: fixup_7_pcrel
85 ; INST: brsh .+66
86 ; INST: brsh .-22
87 ; INST: brsh .+66
88 ; INST: brsh .+0
90 ; BRSH
91 brsh .+32
92 brsh .+70
93 brsh car
95 ; CHECK: brsh .Ltmp12+32 ; encoding: [0bAAAAA000,0b111101AA]
96 ; CHECK: ; fixup A - offset: 0, value: .Ltmp12+32, kind: fixup_7_pcrel
97 ; CHECK: brsh .Ltmp13+70 ; encoding: [0bAAAAA000,0b111101AA]
98 ; CHECK: ; fixup A - offset: 0, value: .Ltmp13+70, kind: fixup_7_pcrel
99 ; CHECK: brsh car ; encoding: [0bAAAAA000,0b111101AA]
100 ; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel
102 ; INST: brsh .+32
103 ; INST: brsh .+70
104 ; INST: brsh .+0
106 baz:
108 ; BRLO
109 brlo .+12
110 brlo .+28
111 brlo car
113 ; CHECK: brlo .Ltmp14+12 ; encoding: [0bAAAAA000,0b111100AA]
114 ; CHECK: ; fixup A - offset: 0, value: .Ltmp14+12, kind: fixup_7_pcrel
115 ; CHECK: brlo .Ltmp15+28 ; encoding: [0bAAAAA000,0b111100AA]
116 ; CHECK: ; fixup A - offset: 0, value: .Ltmp15+28, kind: fixup_7_pcrel
117 ; CHECK: brlo car ; encoding: [0bAAAAA000,0b111100AA]
118 ; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel
120 ; INST-LABEL: <baz>:
121 ; INST: brlo .+12
122 ; INST: brlo .+28
123 ; INST: brlo .+0
125 ; BRMI
126 brmi .+66
127 brmi .+58
128 brmi car
130 ; CHECK: brmi .Ltmp16+66 ; encoding: [0bAAAAA010,0b111100AA]
131 ; CHECK: ; fixup A - offset: 0, value: .Ltmp16+66, kind: fixup_7_pcrel
132 ; CHECK: brmi .Ltmp17+58 ; encoding: [0bAAAAA010,0b111100AA]
133 ; CHECK: ; fixup A - offset: 0, value: .Ltmp17+58, kind: fixup_7_pcrel
134 ; CHECK: brmi car ; encoding: [0bAAAAA010,0b111100AA]
135 ; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel
137 ; INST: brmi .+66
138 ; INST: brmi .+58
139 ; INST: brmi .+0
141 ; BRPL
142 brpl .-12
143 brpl .+18
144 brpl car
146 ; CHECK: brpl .Ltmp18-12 ; encoding: [0bAAAAA010,0b111101AA]
147 ; CHECK: ; fixup A - offset: 0, value: .Ltmp18-12, kind: fixup_7_pcrel
148 ; CHECK: brpl .Ltmp19+18 ; encoding: [0bAAAAA010,0b111101AA]
149 ; CHECK: ; fixup A - offset: 0, value: .Ltmp19+18, kind: fixup_7_pcrel
150 ; CHECK: brpl car ; encoding: [0bAAAAA010,0b111101AA]
151 ; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel
153 ; INST: brpl .-12
154 ; INST: brpl .+18
155 ; INST: brpl .+0
157 ; BRGE
158 brge .+50
159 brge .+42
160 brge car
162 ; CHECK: brge .Ltmp20+50 ; encoding: [0bAAAAA100,0b111101AA]
163 ; CHECK: ; fixup A - offset: 0, value: .Ltmp20+50, kind: fixup_7_pcrel
164 ; CHECK: brge .Ltmp21+42 ; encoding: [0bAAAAA100,0b111101AA]
165 ; CHECK: ; fixup A - offset: 0, value: .Ltmp21+42, kind: fixup_7_pcrel
166 ; CHECK: brge car ; encoding: [0bAAAAA100,0b111101AA]
167 ; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel
169 ; INST: brge .+50
170 ; INST: brge .+42
171 ; INST: brge .+0
173 car:
174 ; BRLT
175 brlt .+16
176 brlt .+2
177 brlt end
179 ; CHECK: brlt .Ltmp22+16 ; encoding: [0bAAAAA100,0b111100AA]
180 ; CHECK: ; fixup A - offset: 0, value: .Ltmp22+16, kind: fixup_7_pcrel
181 ; CHECK: brlt .Ltmp23+2 ; encoding: [0bAAAAA100,0b111100AA]
182 ; CHECK: ; fixup A - offset: 0, value: .Ltmp23+2, kind: fixup_7_pcrel
183 ; CHECK: brlt end ; encoding: [0bAAAAA100,0b111100AA]
184 ; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel
186 ; INST-LABEL: <car>:
187 ; INST: brlt .+16
188 ; INST: brlt .+2
189 ; INST: brlt .+0
191 ; BRHS
192 brhs .-66
193 brhs .+14
194 brhs just_another_label
196 ; CHECK: brhs .Ltmp24-66 ; encoding: [0bAAAAA101,0b111100AA]
197 ; CHECK: ; fixup A - offset: 0, value: .Ltmp24-66, kind: fixup_7_pcrel
198 ; CHECK: brhs .Ltmp25+14 ; encoding: [0bAAAAA101,0b111100AA]
199 ; CHECK: ; fixup A - offset: 0, value: .Ltmp25+14, kind: fixup_7_pcrel
200 ; CHECK: brhs just_another_label ; encoding: [0bAAAAA101,0b111100AA]
201 ; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel
203 ; INST: brhs .-66
204 ; INST: brhs .+14
205 ; INST: brhs .+0
207 ; BRHC
208 brhc .+12
209 brhc .+14
210 brhc just_another_label
212 ; CHECK: brhc .Ltmp26+12 ; encoding: [0bAAAAA101,0b111101AA]
213 ; CHECK: ; fixup A - offset: 0, value: .Ltmp26+12, kind: fixup_7_pcrel
214 ; CHECK: brhc .Ltmp27+14 ; encoding: [0bAAAAA101,0b111101AA]
215 ; CHECK: ; fixup A - offset: 0, value: .Ltmp27+14, kind: fixup_7_pcrel
216 ; CHECK: brhc just_another_label ; encoding: [0bAAAAA101,0b111101AA]
217 ; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel
219 ; INST: brhc .+12
220 ; INST: brhc .+14
221 ; INST: brhc .+0
223 ; BRTS
224 brts .+18
225 brts .+22
226 brts just_another_label
228 ; CHECK: brts .Ltmp28+18 ; encoding: [0bAAAAA110,0b111100AA]
229 ; CHECK: ; fixup A - offset: 0, value: .Ltmp28+18, kind: fixup_7_pcrel
230 ; CHECK: brts .Ltmp29+22 ; encoding: [0bAAAAA110,0b111100AA]
231 ; CHECK: ; fixup A - offset: 0, value: .Ltmp29+22, kind: fixup_7_pcrel
232 ; CHECK: brts just_another_label ; encoding: [0bAAAAA110,0b111100AA]
233 ; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel
235 ; INST: brts .+18
236 ; INST: brts .+22
237 ; INST: brts .+0
239 just_another_label:
240 ; BRTC
241 brtc .+52
242 brtc .+50
243 brtc end
245 ; CHECK: brtc .Ltmp30+52 ; encoding: [0bAAAAA110,0b111101AA]
246 ; CHECK: ; fixup A - offset: 0, value: .Ltmp30+52, kind: fixup_7_pcrel
247 ; CHECK: brtc .Ltmp31+50 ; encoding: [0bAAAAA110,0b111101AA]
248 ; CHECK: ; fixup A - offset: 0, value: .Ltmp31+50, kind: fixup_7_pcrel
249 ; CHECK: brtc end ; encoding: [0bAAAAA110,0b111101AA]
250 ; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel
252 ; INST-LABEL: <just_another_label>:
253 ; INST: brtc .+52
254 ; INST: brtc .+50
255 ; INST: brtc .+0
257 ; BRVS
258 brvs .+18
259 brvs .+32
260 brvs end
262 ; CHECK: brvs .Ltmp32+18 ; encoding: [0bAAAAA011,0b111100AA]
263 ; CHECK: ; fixup A - offset: 0, value: .Ltmp32+18, kind: fixup_7_pcrel
264 ; CHECK: brvs .Ltmp33+32 ; encoding: [0bAAAAA011,0b111100AA]
265 ; CHECK: ; fixup A - offset: 0, value: .Ltmp33+32, kind: fixup_7_pcrel
266 ; CHECK: brvs end ; encoding: [0bAAAAA011,0b111100AA]
267 ; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel
269 ; INST: brvs .+18
270 ; INST: brvs .+32
271 ; INST: brvs .+0
273 ; BRVC
274 brvc .-28
275 brvc .-62
276 brvc end
278 ; CHECK: brvc .Ltmp34-28 ; encoding: [0bAAAAA011,0b111101AA]
279 ; CHECK: ; fixup A - offset: 0, value: .Ltmp34-28, kind: fixup_7_pcrel
280 ; CHECK: brvc .Ltmp35-62 ; encoding: [0bAAAAA011,0b111101AA]
281 ; CHECK: ; fixup A - offset: 0, value: .Ltmp35-62, kind: fixup_7_pcrel
282 ; CHECK: brvc end ; encoding: [0bAAAAA011,0b111101AA]
283 ; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel
285 ; INST: brvc .-28
286 ; INST: brvc .-62
287 ; INST: brvc .+0
289 ; BRIE
290 brie .+20
291 brie .+40
292 brie end
294 ; CHECK: brie .Ltmp36+20 ; encoding: [0bAAAAA111,0b111100AA]
295 ; CHECK: ; fixup A - offset: 0, value: .Ltmp36+20, kind: fixup_7_pcrel
296 ; CHECK: brie .Ltmp37+40 ; encoding: [0bAAAAA111,0b111100AA]
297 ; CHECK: ; fixup A - offset: 0, value: .Ltmp37+40, kind: fixup_7_pcrel
298 ; CHECK: brie end ; encoding: [0bAAAAA111,0b111100AA]
299 ; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel
301 ; INST: brie .+20
302 ; INST: brie .+40
303 ; INST: brie .+0
305 ; BRID
306 brid .+42
307 brid .+62
308 brid end
310 ; CHECK: brid .Ltmp38+42 ; encoding: [0bAAAAA111,0b111101AA]
311 ; CHECK: ; fixup A - offset: 0, value: .Ltmp38+42, kind: fixup_7_pcrel
312 ; CHECK: brid .Ltmp39+62 ; encoding: [0bAAAAA111,0b111101AA]
313 ; CHECK: ; fixup A - offset: 0, value: .Ltmp39+62, kind: fixup_7_pcrel
314 ; CHECK: brid end ; encoding: [0bAAAAA111,0b111101AA]
315 ; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel
317 ; INST: brid .+42
318 ; INST: brid .+62
319 ; INST: brid .+0
321 end: