1; RUN: llvm-mc -filetype=obj -triple=avr %s -mattr=avr6 | llvm-objdump -r - | FileCheck %s
2
3; CHECK: RELOCATION RECORDS FOR
4
5.global bar
6bar:
7  jmp bar
8
9; CHECK: R_AVR_LDI SYMBOL+3
10ldi r21, SYMBOL+3
11
12; CHECK-NEXT: R_AVR_6_ADIW FOO
13adiw r24, FOO
14
15; CHECK-NEXT: R_AVR_16 BAR+2
16lds r8, BAR+2
17
18; CHECK-NEXT: R_AVR_PORT5 foo
19sbic foo, 1
20
21; CHECK-NEXT: R_AVR_PORT6 Bar+2
22in r30, Bar+2
23
24; CHECK-NEXT: R_AVR_CALL foo+3
25call foo+3
26
27; CHECK-NEXT: R_AVR_13_PCREL foo-10
28rjmp foo-10
29
30; CHECK-NEXT: R_AVR_7_PCREL foo+2
31brcs foo+2
32
33; CHECK-NEXT: R_AVR_LO8_LDI bar+3
34; CHECK-NEXT: R_AVR_LO8_LDI abc
35; CHECK-NEXT: R_AVR_LO8_LDI abc
36ldi r24, lo8(bar+3)
37ldi r16, +lo8(abc)
38ldi r16, lo8(+(abc))
39
40; CHECK-NEXT: R_AVR_HI8_LDI abc
41; CHECK-NEXT: R_AVR_HI8_LDI abc
42; CHECK-NEXT: R_AVR_HI8_LDI abc
43ldi r30, hi8(abc)
44ldi r16, +hi8(abc)
45ldi r16, hi8(+(abc))
46
47; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc
48; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc
49ldi r16, -lo8(abc)
50ldi r16, lo8(-(abc))
51
52; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc
53; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc
54ldi r16, -hi8(abc)
55ldi r16, hi8(-(abc))
56
57; CHECK-NEXT: R_AVR_HH8_LDI foo
58; CHECK-NEXT: R_AVR_HH8_LDI foo
59; CHECK-NEXT: R_AVR_HH8_LDI foo
60ldi r16, hh8(foo)
61ldi r16, +hh8(foo)
62ldi r16, hh8(+(foo))
63
64; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
65; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
66ldi r16, -hh8(foo)
67ldi r16, hh8(-(foo))
68
69; CHECK-NEXT: R_AVR_HH8_LDI foo
70; CHECK-NEXT: R_AVR_HH8_LDI foo
71; CHECK-NEXT: R_AVR_HH8_LDI foo
72ldi r24, hlo8(foo)
73ldi r24, +hlo8(foo)
74ldi r24, hlo8(+(foo))
75
76; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
77; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
78ldi r24, -hlo8(foo)
79ldi r24, hlo8(-(foo))
80
81; CHECK-NEXT: R_AVR_MS8_LDI bar
82; CHECK-NEXT: R_AVR_MS8_LDI bar
83; CHECK-NEXT: R_AVR_MS8_LDI bar
84ldi r24, hhi8(bar)
85ldi r24, +hhi8(bar)
86ldi r24, hhi8(+(bar))
87
88; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar
89; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar
90ldi r24, -hhi8(bar)
91ldi r24, hhi8(-(bar))
92
93; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
94; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
95; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
96ldi r17, pm_lo8(foo)
97ldi r25, +pm_lo8(foo)
98ldi r25, pm_lo8(+(foo))
99
100; CHECK-NEXT: R_AVR_HI8_LDI_PM bar
101; CHECK-NEXT: R_AVR_HI8_LDI_PM foo
102; CHECK-NEXT: R_AVR_HI8_LDI_PM foo
103ldi r22, pm_hi8(bar)
104ldi r25, +pm_hi8(foo)
105ldi r25, pm_hi8(+(foo))
106
107; CHECK-NEXT: R_AVR_HH8_LDI_PM baz
108; CHECK-NEXT: R_AVR_HH8_LDI_PM foo
109; CHECK-NEXT: R_AVR_HH8_LDI_PM foo
110ldi r25, pm_hh8(baz)
111ldi r25, +pm_hh8(foo)
112ldi r25, pm_hh8(+(foo))
113
114; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG foo
115; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG foo
116ldi r25, -pm_lo8(foo)
117ldi r25, pm_lo8(-(foo))
118
119; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG foo
120; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG foo
121ldi r25, -pm_hi8(foo)
122ldi r25, pm_hi8(-(foo))
123
124; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG foo
125; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG foo
126ldi r25, -pm_hh8(foo)
127ldi r25, pm_hh8(-(foo))
128
129; CHECK-NEXT: R_AVR_LO8_LDI_GS foo
130ldi r17, lo8(gs(foo))
131
132; CHECK-NEXT: R_AVR_HI8_LDI_GS foo
133ldi r18, hi8(gs(foo))
134
135; CHECK-NEXT: R_AVR_16
136.short foo
137
138; CHECK-NEXT: R_AVR_16_PM
139.short gs(foo)
140
141; CHECK-NEXT: R_AVR_8
142.byte foo
143
144; CHECK-NEXT: R_AVR_8_LO8
145.byte lo8(foo)
146
147; CHECK-NEXT: R_AVR_8_HI8
148.byte hi8(foo)
149
150; CHECK-NEXT: R_AVR_8_HLO8
151.byte hlo8(foo)
152
153; CHECK: R_AVR_DIFF8
154.byte foo - bar
155
156; CHECK: R_AVR_DIFF16
157.short foo - bar
158
159; CHECK: R_AVR_DIFF32
160.long foo - bar
161