[obj2yaml] - Fix a comment. NFC.
[llvm-complete.git] / test / MC / AVR / modifiers.s
blobcc1935cf9cbed509b14d7895967a69ae9cbd6237
1 ; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
3 ; TODO: Add support for lo8(-foo + 3), and add test
4 ; FIXME: most of these tests use values (i.e. 0x0815) that are out of bounds.
6 foo:
8 ldi r24, lo8(0x42)
9 ldi r24, lo8(0x2342)
11 ldi r24, lo8(0x23)
12 ldi r24, hi8(0x2342)
14 ; CHECK: ldi r24, lo8(66) ; encoding: [0x82,0xe4]
15 ; CHECK: ldi r24, lo8(9026) ; encoding: [0x82,0xe4]
17 ; CHECK: ldi r24, lo8(35) ; encoding: [0x83,0xe2]
18 ; CHECK: ldi r24, hi8(9026) ; encoding: [0x83,0xe2]
21 bar:
23 ldi r24, lo8(bar)
24 ldi r24, hi8(bar)
26 ; CHECK: ldi r24, lo8(bar) ; encoding: [0x80'A',0xe0]
27 ; CHECK: ; fixup A - offset: 0, value: lo8(bar), kind: fixup_lo8_ldi
28 ; CHECK: ldi r24, hi8(bar) ; encoding: [0x80'A',0xe0]
29 ; CHECK: ; fixup A - offset: 0, value: hi8(bar), kind: fixup_hi8_ldi
31 lo8:
33 ldi r24, lo8(0x0815)
34 ldi r24, lo8(foo)
35 ldi r24, lo8(bar + 5)
37 ; CHECK: ldi r24, lo8(2069) ; encoding: [0x85,0xe1]
38 ; CHECK: ldi r24, lo8(foo) ; encoding: [0x80'A',0xe0]
39 ; CHECK: ; fixup A - offset: 0, value: lo8(foo), kind: fixup_lo8_ldi
40 ; CHECK: ldi r24, lo8(bar+5) ; encoding: [0x80'A',0xe0]
41 ; CHECK: ; fixup A - offset: 0, value: lo8(bar+5), kind: fixup_lo8_ldi
43 lo8_neg:
45 ldi r24, -lo8(123456)
46 ldi r24, -lo8(foo)
48 ; CHECK: ldi r24, -lo8(123456) ; encoding: [0x80,0xec]
49 ; CHECK: ldi r24, -lo8(foo) ; encoding: [0x80'A',0xe0]
50 ; CHECK: ; fixup A - offset: 0, value: -lo8(foo), kind: fixup_lo8_ldi_neg
52 hi8:
54 ldi r24, hi8(0x0815)
55 ldi r24, hi8(foo)
56 ldi r24, hi8(bar + 5)
58 ; CHECK: ldi r24, hi8(2069) ; encoding: [0x88,0xe0]
59 ; CHECK: ldi r24, hi8(foo) ; encoding: [0x80'A',0xe0]
60 ; CHECK: ; fixup A - offset: 0, value: hi8(foo), kind: fixup_hi8_ldi
61 ; CHECK: ldi r24, hi8(bar+5) ; encoding: [0x80'A',0xe0]
62 ; CHECK: ; fixup A - offset: 0, value: hi8(bar+5), kind: fixup_hi8_ldi
64 hi8_neg:
66 ldi r24, -hi8(123456)
67 ldi r24, -hi8(foo)
69 ; CHECK: ldi r24, -hi8(123456) ; encoding: [0x8d,0xe1]
70 ; CHECK: ldi r24, -hi8(foo) ; encoding: [0x80'A',0xe0]
71 ; CHECK: ; fixup A - offset: 0, value: -hi8(foo), kind: fixup_hi8_ldi_neg
73 hh8:
75 ldi r24, hh8(0x0815)
76 ldi r24, hh8(foo)
77 ldi r24, hh8(bar + 5)
79 ; CHECK: ldi r24, hh8(2069) ; encoding: [0x80,0xe0]
80 ; CHECK: ldi r24, hh8(foo) ; encoding: [0x80'A',0xe0]
81 ; CHECK: ; fixup A - offset: 0, value: hh8(foo), kind: fixup_hh8_ldi
82 ; CHECK: ldi r24, hh8(bar+5) ; encoding: [0x80'A',0xe0]
83 ; CHECK: ; fixup A - offset: 0, value: hh8(bar+5), kind: fixup_hh8_ldi
85 hh8_neg:
87 ldi r24, -hh8(123456)
88 ldi r24, -hh8(foo)
90 ; CHECK: ldi r24, -hh8(123456) ; encoding: [0x8e,0xef]
91 ; CHECK: ldi r24, -hh8(foo) ; encoding: [0x80'A',0xe0]
92 ; CHECK: ; fixup A - offset: 0, value: -hh8(foo), kind: fixup_hh8_ldi_neg
94 hlo8: ; synonym with hh8() above, hence the... odd results
96 ldi r24, hlo8(0x0815)
97 ldi r24, hlo8(foo)
98 ldi r24, hlo8(bar + 5)
100 ; CHECK: ldi r24, hh8(2069) ; encoding: [0x80,0xe0]
101 ; CHECK: ldi r24, hh8(foo) ; encoding: [0x80'A',0xe0]
102 ; CHECK: ; fixup A - offset: 0, value: hh8(foo), kind: fixup_hh8_ldi
103 ; CHECK: ldi r24, hh8(bar+5) ; encoding: [0x80'A',0xe0]
104 ; CHECK: ; fixup A - offset: 0, value: hh8(bar+5), kind: fixup_hh8_ldi
106 hlo8_neg:
108 ldi r24, -hlo8(123456)
109 ldi r24, -hlo8(foo)
112 ; CHECK: ldi r24, -hh8(123456) ; encoding: [0x8e,0xef]
113 ; CHECK: ldi r24, -hh8(foo) ; encoding: [0x80'A',0xe0]
114 ; CHECK: ; fixup A - offset: 0, value: -hh8(foo), kind: fixup_hh8_ldi_neg
116 hhi8:
118 ldi r24, hhi8(0x0815)
119 ldi r24, hhi8(foo)
120 ldi r24, hhi8(bar + 5)
122 ; CHECK: ldi r24, hhi8(2069) ; encoding: [0x80,0xe0]
123 ; CHECK: ldi r24, hhi8(foo) ; encoding: [0x80'A',0xe0]
124 ; CHECK: ; fixup A - offset: 0, value: hhi8(foo), kind: fixup_ms8_ldi
125 ; CHECK: ldi r24, hhi8(bar+5) ; encoding: [0x80'A',0xe0]
126 ; CHECK: ; fixup A - offset: 0, value: hhi8(bar+5), kind: fixup_ms8_ldi
128 hhi8_neg:
129 ldi r24, -hhi8(123456)
130 ldi r24, -hhi8(foo)
133 ; CHECK: ldi r24, -hhi8(123456) ; encoding: [0x8f,0xef]
134 ; CHECK: ldi r24, -hhi8(foo) ; encoding: [0x80'A',0xe0]
135 ; CHECK: ; fixup A - offset: 0, value: -hhi8(foo), kind: fixup_ms8_ldi_neg
137 pm_lo8:
138 ldi r24, pm_lo8(0x0815)
139 ldi r24, pm_lo8(foo)
140 ldi r24, pm_lo8(bar + 5)
142 ; CHECK: ldi r24, pm_lo8(2069) ; encoding: [0x8a,0xe0]
143 ; CHECK: ldi r24, pm_lo8(foo) ; encoding: [0x80'A',0xe0]
144 ; CHECK: ; fixup A - offset: 0, value: pm_lo8(foo), kind: fixup_lo8_ldi_pm
145 ; CHECK: ldi r24, pm_lo8(bar+5) ; encoding: [0x80'A',0xe0]
146 ; CHECK: ; fixup A - offset: 0, value: pm_lo8(bar+5), kind: fixup_lo8_ldi_pm
148 pm_hi8:
149 ldi r24, pm_hi8(0x0815)
150 ldi r24, pm_hi8(foo)
151 ldi r24, pm_hi8(bar + 5)
153 ; CHECK: ldi r24, pm_hi8(2069) ; encoding: [0x84,0xe0]
154 ; CHECK: ldi r24, pm_hi8(foo) ; encoding: [0x80'A',0xe0]
155 ; CHECK: ; fixup A - offset: 0, value: pm_hi8(foo), kind: fixup_hi8_ldi_pm
156 ; CHECK: ldi r24, pm_hi8(bar+5) ; encoding: [0x80'A',0xe0]
157 ; CHECK: ; fixup A - offset: 0, value: pm_hi8(bar+5), kind: fixup_hi8_ldi_pm
159 pm_hh8:
160 ldi r24, pm_hh8(0x0815)
161 ldi r24, pm_hh8(foo)
162 ldi r24, pm_hh8(bar + 5)
164 ; CHECK: ldi r24, pm_hh8(2069) ; encoding: [0x80,0xe0]
165 ; CHECK: ldi r24, pm_hh8(foo) ; encoding: [0x80'A',0xe0]
166 ; CHECK: ; fixup A - offset: 0, value: pm_hh8(foo), kind: fixup_hh8_ldi_pm
167 ; CHECK: ldi r24, pm_hh8(bar+5) ; encoding: [0x80'A',0xe0]
168 ; CHECK: ; fixup A - offset: 0, value: pm_hh8(bar+5), kind: fixup_hh8_ldi_pm
171 pm_lo8_neg:
172 ldi r24, -pm_lo8(0x0815)
173 ldi r24, -pm_lo8(foo)
174 ldi r24, -pm_lo8(bar + 5)
176 ; CHECK: ldi r24, -pm_lo8(2069) ; encoding: [0x85,0xef]
177 ; CHECK: ldi r24, -pm_lo8(foo) ; encoding: [0x80'A',0xe0]
178 ; CHECK: ; fixup A - offset: 0, value: -pm_lo8(foo), kind: fixup_lo8_ldi_pm_neg
179 ; CHECK: ldi r24, -pm_lo8(bar+5) ; encoding: [0x80'A',0xe0]
180 ; CHECK: ; fixup A - offset: 0, value: -pm_lo8(bar+5), kind: fixup_lo8_ldi_pm_neg
182 pm_hi8_neg:
183 ldi r24, -pm_hi8(0x0815)
184 ldi r24, -pm_hi8(foo)
185 ldi r24, -pm_hi8(bar + 5)
187 ; CHECK: ldi r24, -pm_hi8(2069) ; encoding: [0x8b,0xef]
188 ; CHECK: ldi r24, -pm_hi8(foo) ; encoding: [0x80'A',0xe0]
189 ; CHECK: ; fixup A - offset: 0, value: -pm_hi8(foo), kind: fixup_hi8_ldi_pm_neg
190 ; CHECK: ldi r24, -pm_hi8(bar+5) ; encoding: [0x80'A',0xe0]
191 ; CHECK: ; fixup A - offset: 0, value: -pm_hi8(bar+5), kind: fixup_hi8_ldi_pm_neg
193 pm_hh8_neg:
194 ldi r24, -pm_hh8(0x0815)
195 ldi r24, -pm_hh8(foo)
196 ldi r24, -pm_hh8(bar + 5)
198 ; CHECK: ldi r24, -pm_hh8(2069) ; encoding: [0x8f,0xef]
199 ; CHECK: ldi r24, -pm_hh8(foo) ; encoding: [0x80'A',0xe0]
200 ; CHECK: ; fixup A - offset: 0, value: -pm_hh8(foo), kind: fixup_hh8_ldi_pm_neg
201 ; CHECK: ldi r24, -pm_hh8(bar+5) ; encoding: [0x80'A',0xe0]
202 ; CHECK: ; fixup A - offset: 0, value: -pm_hh8(bar+5), kind: fixup_hh8_ldi_pm_neg