1; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
2
3
4foo:
5  ; BREQ
6  breq .-18
7  breq .-12
8  brbs 1, .-18
9  brbs 1, baz
10
11; CHECK: breq    .Ltmp0-18               ; encoding: [0bAAAAA001,0b111100AA]
12; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp0-18, kind: fixup_7_pcrel
13; CHECK: breq    .Ltmp1-12               ; encoding: [0bAAAAA001,0b111100AA]
14; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp1-12, kind: fixup_7_pcrel
15; CHECK: brbs    1, .Ltmp2-18            ; encoding: [0bAAAAA001,0b111100AA]
16; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp2-18, kind: fixup_7_pcrel
17; CHECK: brbs    1, baz                  ; encoding: [0bAAAAA001,0b111100AA]
18; CHECK:                                 ;   fixup A - offset: 0, value: baz, kind: fixup_7_pcrel
19
20  ; BRNE
21  brne .+10
22  brne .+2
23  brbc 1, .+10
24  brbc 1, bar
25
26; CHECK: brne    .Ltmp3+10               ; encoding: [0bAAAAA001,0b111101AA]
27; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp3+10, kind: fixup_7_pcrel
28; CHECK: brne    .Ltmp4+2                ; encoding: [0bAAAAA001,0b111101AA]
29; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp4+2, kind: fixup_7_pcrel
30; CHECK: brbc    1, .Ltmp5+10            ; encoding: [0bAAAAA001,0b111101AA]
31; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp5+10, kind: fixup_7_pcrel
32; CHECK: brbc    1, bar                  ; encoding: [0bAAAAA001,0b111101AA]
33; CHECK:                                 ;   fixup A - offset: 0, value: bar, kind: fixup_7_pcrel
34
35bar:
36  ; BRCS
37  brcs .+8
38  brcs .+4
39  brbs 0, .+8
40  brbs 0, end
41
42; CHECK: brcs    .Ltmp6+8                ; encoding: [0bAAAAA000,0b111100AA]
43; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp6+8, kind: fixup_7_pcrel
44; CHECK: brcs    .Ltmp7+4                ; encoding: [0bAAAAA000,0b111100AA]
45; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp7+4, kind: fixup_7_pcrel
46; CHECK: brcs    .Ltmp8+8                ; encoding: [0bAAAAA000,0b111100AA]
47; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp8+8, kind: fixup_7_pcrel
48; CHECK: brcs    end                     ; encoding: [0bAAAAA000,0b111100AA]
49; CHECK:                                 ;   fixup A - offset: 0, value: end, kind: fixup_7_pcrel
50
51  ; BRCC
52  brcc .+66
53  brcc .-22
54  brbc 0, .+66
55  brbc 0, baz
56
57; CHECK: brcc    .Ltmp9+66               ; encoding: [0bAAAAA000,0b111101AA]
58; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp9+66, kind: fixup_7_pcrel
59; CHECK: brcc    .Ltmp10-22              ; encoding: [0bAAAAA000,0b111101AA]
60; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp10-22, kind: fixup_7_pcrel
61; CHECK: brcc    .Ltmp11+66              ; encoding: [0bAAAAA000,0b111101AA]
62; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp11+66, kind: fixup_7_pcrel
63; CHECK: brcc    baz                     ; encoding: [0bAAAAA000,0b111101AA]
64; CHECK:                                 ;   fixup A - offset: 0, value: baz, kind: fixup_7_pcrel
65
66  ; BRSH
67  brsh .+32
68  brsh .+70
69  brsh car
70
71; CHECK: brsh    .Ltmp12+32              ; encoding: [0bAAAAA000,0b111101AA]
72; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp12+32, kind: fixup_7_pcrel
73; CHECK: brsh    .Ltmp13+70              ; encoding: [0bAAAAA000,0b111101AA]
74; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp13+70, kind: fixup_7_pcrel
75; CHECK: brsh    car                     ; encoding: [0bAAAAA000,0b111101AA]
76; CHECK:                                 ;   fixup A - offset: 0, value: car, kind: fixup_7_pcrel
77
78baz:
79
80  ; BRLO
81  brlo .+12
82  brlo .+28
83  brlo car
84
85; CHECK: brlo    .Ltmp14+12              ; encoding: [0bAAAAA000,0b111100AA]
86; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp14+12, kind: fixup_7_pcrel
87; CHECK: brlo    .Ltmp15+28              ; encoding: [0bAAAAA000,0b111100AA]
88; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp15+28, kind: fixup_7_pcrel
89; CHECK: brlo    car                     ; encoding: [0bAAAAA000,0b111100AA]
90; CHECK:                                 ;   fixup A - offset: 0, value: car, kind: fixup_7_pcrel
91
92  ; BRMI
93  brmi .+66
94  brmi .+58
95  brmi car
96
97; CHECK: brmi    .Ltmp16+66              ; encoding: [0bAAAAA010,0b111100AA]
98; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp16+66, kind: fixup_7_pcrel
99; CHECK: brmi    .Ltmp17+58              ; encoding: [0bAAAAA010,0b111100AA]
100; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp17+58, kind: fixup_7_pcrel
101; CHECK: brmi    car                     ; encoding: [0bAAAAA010,0b111100AA]
102; CHECK:                                 ;   fixup A - offset: 0, value: car, kind: fixup_7_pcrel
103
104  ; BRPL
105  brpl .-12
106  brpl .+18
107  brpl car
108
109; CHECK: brpl    .Ltmp18-12              ; encoding: [0bAAAAA010,0b111101AA]
110; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp18-12, kind: fixup_7_pcrel
111; CHECK: brpl    .Ltmp19+18              ; encoding: [0bAAAAA010,0b111101AA]
112; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp19+18, kind: fixup_7_pcrel
113; CHECK: brpl    car                     ; encoding: [0bAAAAA010,0b111101AA]
114; CHECK:                                 ;   fixup A - offset: 0, value: car, kind: fixup_7_pcrel
115
116  ; BRGE
117  brge .+50
118  brge .+42
119  brge car
120
121; CHECK: brge    .Ltmp20+50              ; encoding: [0bAAAAA100,0b111101AA]
122; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp20+50, kind: fixup_7_pcrel
123; CHECK: brge    .Ltmp21+42              ; encoding: [0bAAAAA100,0b111101AA]
124; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp21+42, kind: fixup_7_pcrel
125; CHECK: brge    car                     ; encoding: [0bAAAAA100,0b111101AA]
126; CHECK:                                 ;   fixup A - offset: 0, value: car, kind: fixup_7_pcrel
127
128car:
129  ; BRLT
130  brlt .+16
131  brlt .+2
132  brlt end
133
134; CHECK: brlt    .Ltmp22+16              ; encoding: [0bAAAAA100,0b111100AA]
135; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp22+16, kind: fixup_7_pcrel
136; CHECK: brlt    .Ltmp23+2               ; encoding: [0bAAAAA100,0b111100AA]
137; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp23+2, kind: fixup_7_pcrel
138; CHECK: brlt    end                     ; encoding: [0bAAAAA100,0b111100AA]
139; CHECK:                                 ;   fixup A - offset: 0, value: end, kind: fixup_7_pcrel
140
141  ; BRHS
142  brhs .-66
143  brhs .+14
144  brhs just_another_label
145
146; CHECK: brhs    .Ltmp24-66              ; encoding: [0bAAAAA101,0b111100AA]
147; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp24-66, kind: fixup_7_pcrel
148; CHECK: brhs    .Ltmp25+14              ; encoding: [0bAAAAA101,0b111100AA]
149; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp25+14, kind: fixup_7_pcrel
150; CHECK: brhs    just_another_label      ; encoding: [0bAAAAA101,0b111100AA]
151; CHECK:                                 ;   fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel
152
153  ; BRHC
154  brhc .+12
155  brhc .+14
156  brhc just_another_label
157
158; CHECK: brhc    .Ltmp26+12              ; encoding: [0bAAAAA101,0b111101AA]
159; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp26+12, kind: fixup_7_pcrel
160; CHECK: brhc    .Ltmp27+14              ; encoding: [0bAAAAA101,0b111101AA]
161; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp27+14, kind: fixup_7_pcrel
162; CHECK: brhc    just_another_label      ; encoding: [0bAAAAA101,0b111101AA]
163; CHECK:                                 ;   fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel
164
165  ; BRTS
166  brts .+18
167  brts .+22
168  brts just_another_label
169
170; CHECK: brts    .Ltmp28+18              ; encoding: [0bAAAAA110,0b111100AA]
171; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp28+18, kind: fixup_7_pcrel
172; CHECK: brts    .Ltmp29+22              ; encoding: [0bAAAAA110,0b111100AA]
173; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp29+22, kind: fixup_7_pcrel
174; CHECK: brts    just_another_label      ; encoding: [0bAAAAA110,0b111100AA]
175; CHECK:                                 ;   fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel
176
177just_another_label:
178  ; BRTC
179  brtc .+52
180  brtc .+50
181  brtc end
182
183; CHECK: brtc    .Ltmp30+52              ; encoding: [0bAAAAA110,0b111101AA]
184; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp30+52, kind: fixup_7_pcrel
185; CHECK: brtc    .Ltmp31+50              ; encoding: [0bAAAAA110,0b111101AA]
186; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp31+50, kind: fixup_7_pcrel
187; CHECK: brtc    end                     ; encoding: [0bAAAAA110,0b111101AA]
188; CHECK:                                 ;   fixup A - offset: 0, value: end, kind: fixup_7_pcrel
189
190  ; BRVS
191  brvs .+18
192  brvs .+32
193  brvs end
194
195; CHECK: brvs    .Ltmp32+18              ; encoding: [0bAAAAA011,0b111100AA]
196; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp32+18, kind: fixup_7_pcrel
197; CHECK: brvs    .Ltmp33+32              ; encoding: [0bAAAAA011,0b111100AA]
198; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp33+32, kind: fixup_7_pcrel
199; CHECK: brvs    end                     ; encoding: [0bAAAAA011,0b111100AA]
200; CHECK:                                 ;   fixup A - offset: 0, value: end, kind: fixup_7_pcrel
201
202  ; BRVC
203  brvc .-28
204  brvc .-62
205  brvc end
206
207; CHECK: brvc    .Ltmp34-28              ; encoding: [0bAAAAA011,0b111101AA]
208; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp34-28, kind: fixup_7_pcrel
209; CHECK: brvc    .Ltmp35-62              ; encoding: [0bAAAAA011,0b111101AA]
210; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp35-62, kind: fixup_7_pcrel
211; CHECK: brvc    end                     ; encoding: [0bAAAAA011,0b111101AA]
212; CHECK:                                 ;   fixup A - offset: 0, value: end, kind: fixup_7_pcrel
213
214  ; BRIE
215  brie .+20
216  brie .+40
217  brie end
218
219; CHECK: brie    .Ltmp36+20              ; encoding: [0bAAAAA111,0b111100AA]
220; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp36+20, kind: fixup_7_pcrel
221; CHECK: brie    .Ltmp37+40              ; encoding: [0bAAAAA111,0b111100AA]
222; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp37+40, kind: fixup_7_pcrel
223; CHECK: brie    end                     ; encoding: [0bAAAAA111,0b111100AA]
224; CHECK:                                 ;   fixup A - offset: 0, value: end, kind: fixup_7_pcrel
225
226  ; BRID
227  brid .+42
228  brid .+62
229  brid end
230
231; CHECK: brid    .Ltmp38+42              ; encoding: [0bAAAAA111,0b111101AA]
232; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp38+42, kind: fixup_7_pcrel
233; CHECK: brid    .Ltmp39+62              ; encoding: [0bAAAAA111,0b111101AA]
234; CHECK:                                 ;   fixup A - offset: 0, value: .Ltmp39+62, kind: fixup_7_pcrel
235; CHECK: brid    end                     ; encoding: [0bAAAAA111,0b111101AA]
236; CHECK:                                 ;   fixup A - offset: 0, value: end, kind: fixup_7_pcrel
237
238end:
239