OLD | NEW |
1 ; Simple test that returns various immediates. For fixed-width instruction | 1 ; Simple test that returns various immediates. For fixed-width instruction |
2 ; sets, some immediates are more complicated than others. | 2 ; sets, some immediates are more complicated than others. |
3 ; For x86-32, it shouldn't be a problem. | 3 ; For x86-32, it shouldn't be a problem. |
4 | 4 |
5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s | 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s |
6 | 6 |
7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) | 7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) |
8 ; once enough infrastructure is in. Also, switch to --filetype=obj | 8 ; once enough infrastructure is in. Also, switch to --filetype=obj |
9 ; when possible. | 9 ; when possible. |
10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
11 ; RUN: --command %p2i --filetype=asm --assemble \ | 11 ; RUN: --command %p2i --filetype=asm --assemble \ |
12 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ | 12 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ |
13 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 13 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
14 ; RUN: --command FileCheck --check-prefix ARM32 %s | 14 ; RUN: --command FileCheck --check-prefix ARM32 %s |
15 | 15 |
| 16 ; TODO(rkotler): Stop skipping unimplemented parts (via --skip-unimplemented) |
| 17 ; once enough infrastructure is in. Also, switch to --filetype=obj |
| 18 ; when possible. |
| 19 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 20 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 21 ; RUN: --disassemble --target mips32 -i %s --args -O2 --skip-unimplemented \ |
| 22 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 23 ; RUN: --command FileCheck --check-prefix MIPS32 %s |
| 24 |
16 ; Test 8-bits of all ones rotated right by various amounts (even vs odd). | 25 ; Test 8-bits of all ones rotated right by various amounts (even vs odd). |
17 ; ARM has a shifter that allows encoding 8-bits rotated right by even amounts. | 26 ; ARM has a shifter that allows encoding 8-bits rotated right by even amounts. |
18 ; The first few "rotate right" test cases are expressed as shift-left. | 27 ; The first few "rotate right" test cases are expressed as shift-left. |
19 | 28 |
20 define i32 @ret_8bits_shift_left0() { | 29 define i32 @ret_8bits_shift_left0() { |
21 ret i32 255 | 30 ret i32 255 |
22 } | 31 } |
23 ; CHECK-LABEL: ret_8bits_shift_left0 | 32 ; CHECK-LABEL: ret_8bits_shift_left0 |
24 ; CHECK-NEXT: mov eax,0xff | 33 ; CHECK-NEXT: mov eax,0xff |
25 ; ARM32-LABEL: ret_8bits_shift_left0 | 34 ; ARM32-LABEL: ret_8bits_shift_left0 |
26 ; ARM32-NEXT: mov r0, #255 | 35 ; ARM32-NEXT: mov r0, #255 |
| 36 ; MIPS32-LABEL: <ret_8bits_shift_left0> |
| 37 ; MIPS32-NEXT: li v0,255 |
27 | 38 |
28 define i32 @ret_8bits_shift_left1() { | 39 define i32 @ret_8bits_shift_left1() { |
29 ret i32 510 | 40 ret i32 510 |
30 } | 41 } |
31 ; CHECK-LABEL: ret_8bits_shift_left1 | 42 ; CHECK-LABEL: ret_8bits_shift_left1 |
32 ; CHECK-NEXT: mov eax,0x1fe | 43 ; CHECK-NEXT: mov eax,0x1fe |
33 ; ARM32-LABEL: ret_8bits_shift_left1 | 44 ; ARM32-LABEL: ret_8bits_shift_left1 |
34 ; ARM32-NEXT: movw r0, #510 | 45 ; ARM32-NEXT: movw r0, #510 |
| 46 ; MIPS32-LABEL: <ret_8bits_shift_left1> |
| 47 ; MIPS32-NEXT: li v0,510 |
35 | 48 |
36 define i32 @ret_8bits_shift_left2() { | 49 define i32 @ret_8bits_shift_left2() { |
37 ret i32 1020 | 50 ret i32 1020 |
38 } | 51 } |
39 ; CHECK-LABEL: ret_8bits_shift_left2 | 52 ; CHECK-LABEL: ret_8bits_shift_left2 |
40 ; CHECK-NEXT: mov eax,0x3fc | 53 ; CHECK-NEXT: mov eax,0x3fc |
41 ; ARM32-LABEL: ret_8bits_shift_left2 | 54 ; ARM32-LABEL: ret_8bits_shift_left2 |
42 ; ARM32-NEXT: mov r0, #1020 | 55 ; ARM32-NEXT: mov r0, #1020 |
| 56 ; MIPS32-LABEL: <ret_8bits_shift_left2> |
| 57 ; MIPS32-NEXT: li v0,1020 |
43 | 58 |
44 define i32 @ret_8bits_shift_left4() { | 59 define i32 @ret_8bits_shift_left4() { |
45 ret i32 4080 | 60 ret i32 4080 |
46 } | 61 } |
47 ; CHECK-LABEL: ret_8bits_shift_left4 | 62 ; CHECK-LABEL: ret_8bits_shift_left4 |
48 ; CHECK-NEXT: mov eax,0xff0 | 63 ; CHECK-NEXT: mov eax,0xff0 |
49 ; ARM32-LABEL: ret_8bits_shift_left4 | 64 ; ARM32-LABEL: ret_8bits_shift_left4 |
50 ; ARM32-NEXT: mov r0, #4080 | 65 ; ARM32-NEXT: mov r0, #4080 |
| 66 ; MIPS32-LABEL: <ret_8bits_shift_left4> |
| 67 ; MIPS32-NEXT: li v0,4080 |
51 | 68 |
52 define i32 @ret_8bits_shift_left14() { | 69 define i32 @ret_8bits_shift_left14() { |
53 ret i32 4177920 | 70 ret i32 4177920 |
54 } | 71 } |
55 ; CHECK-LABEL: ret_8bits_shift_left14 | 72 ; CHECK-LABEL: ret_8bits_shift_left14 |
56 ; CHECK-NEXT: mov eax,0x3fc000 | 73 ; CHECK-NEXT: mov eax,0x3fc000 |
57 ; ARM32-LABEL: ret_8bits_shift_left14 | 74 ; ARM32-LABEL: ret_8bits_shift_left14 |
58 ; ARM32-NEXT: mov r0, #4177920 | 75 ; ARM32-NEXT: mov r0, #4177920 |
| 76 ; MIPS32-LABEL: <ret_8bits_shift_left14> |
| 77 ; MIPS32-NEXT: lui v0,0x3f |
| 78 ; MIPS32-NEXT: ori v0,v0,0xc000 |
59 | 79 |
60 define i32 @ret_8bits_shift_left15() { | 80 define i32 @ret_8bits_shift_left15() { |
61 ret i32 8355840 | 81 ret i32 8355840 |
62 } | 82 } |
63 ; CHECK-LABEL: ret_8bits_shift_left15 | 83 ; CHECK-LABEL: ret_8bits_shift_left15 |
64 ; CHECK-NEXT: mov eax,0x7f8000 | 84 ; CHECK-NEXT: mov eax,0x7f8000 |
65 ; ARM32-LABEL: ret_8bits_shift_left15 | 85 ; ARM32-LABEL: ret_8bits_shift_left15 |
66 ; ARM32-NEXT: movw r0, #32768 | 86 ; ARM32-NEXT: movw r0, #32768 |
67 ; ARM32-NEXT: movt r0, #127 | 87 ; ARM32-NEXT: movt r0, #127 |
| 88 ; MIPS32-LABEL: <ret_8bits_shift_left15> |
| 89 ; MIPS32-NEXT: lui v0,0x7f |
| 90 ; MIPS32-NEXT: ori v0,v0,0x8000 |
68 | 91 |
69 ; Shift 8 bits left by 24 to the i32 limit. This is also ror by 8 bits. | 92 ; Shift 8 bits left by 24 to the i32 limit. This is also ror by 8 bits. |
70 | 93 |
71 define i32 @ret_8bits_shift_left24() { | 94 define i32 @ret_8bits_shift_left24() { |
72 ret i32 4278190080 | 95 ret i32 4278190080 |
73 } | 96 } |
74 ; CHECK-LABEL: ret_8bits_shift_left24 | 97 ; CHECK-LABEL: ret_8bits_shift_left24 |
75 ; CHECK-NEXT: mov eax,0xff000000 | 98 ; CHECK-NEXT: mov eax,0xff000000 |
76 ; ARM32-LABEL: ret_8bits_shift_left24 | 99 ; ARM32-LABEL: ret_8bits_shift_left24 |
77 ; ARM32-NEXT: mov r0, #-16777216 | 100 ; ARM32-NEXT: mov r0, #-16777216 |
78 ; ARM32-NEXT: bx lr | 101 ; ARM32-NEXT: bx lr |
| 102 ; MIPS32-LABEL: <ret_8bits_shift_left24> |
| 103 ; MIPS32-NEXT: lui v0,0xff00 |
| 104 ; MIPS32-NEXT: ori v0,v0,0x0 |
79 | 105 |
80 ; The next few cases wrap around and actually demonstrate the rotation. | 106 ; The next few cases wrap around and actually demonstrate the rotation. |
81 | 107 |
82 define i32 @ret_8bits_ror7() { | 108 define i32 @ret_8bits_ror7() { |
83 ret i32 4261412865 | 109 ret i32 4261412865 |
84 } | 110 } |
85 ; CHECK-LABEL: ret_8bits_ror7 | 111 ; CHECK-LABEL: ret_8bits_ror7 |
86 ; CHECK-NEXT: mov eax,0xfe000001 | 112 ; CHECK-NEXT: mov eax,0xfe000001 |
87 ; ARM32-LABEL: ret_8bits_ror7 | 113 ; ARM32-LABEL: ret_8bits_ror7 |
88 ; ARM32-NEXT: movw r0, #1 | 114 ; ARM32-NEXT: movw r0, #1 |
89 ; ARM32-NEXT: movt r0, #65024 | 115 ; ARM32-NEXT: movt r0, #65024 |
| 116 ; MIPS32-LABEL: <ret_8bits_ror7> |
| 117 ; MIPS32-NEXT: lui v0,0xfe00 |
| 118 ; MIPS32-NEXT: ori v0,v0,0x1 |
90 | 119 |
91 define i32 @ret_8bits_ror6() { | 120 define i32 @ret_8bits_ror6() { |
92 ret i32 4227858435 | 121 ret i32 4227858435 |
93 } | 122 } |
94 ; CHECK-LABEL: ret_8bits_ror6 | 123 ; CHECK-LABEL: ret_8bits_ror6 |
95 ; CHECK-NEXT: mov eax,0xfc000003 | 124 ; CHECK-NEXT: mov eax,0xfc000003 |
96 ; ARM32-LABEL: ret_8bits_ror6 | 125 ; ARM32-LABEL: ret_8bits_ror6 |
97 ; ARM32-NEXT: mov r0, #-67108861 | 126 ; ARM32-NEXT: mov r0, #-67108861 |
98 ; ARM32-NEXT: bx lr | 127 ; ARM32-NEXT: bx lr |
| 128 ; MIPS32-LABEL: <ret_8bits_ror6> |
| 129 ; MIPS32-NEXT: lui v0,0xfc00 |
| 130 ; MIPS32-NEXT: ori v0,v0,0x3 |
99 | 131 |
100 define i32 @ret_8bits_ror5() { | 132 define i32 @ret_8bits_ror5() { |
101 ret i32 4160749575 | 133 ret i32 4160749575 |
102 } | 134 } |
103 ; CHECK-LABEL: ret_8bits_ror5 | 135 ; CHECK-LABEL: ret_8bits_ror5 |
104 ; CHECK-NEXT: mov eax,0xf8000007 | 136 ; CHECK-NEXT: mov eax,0xf8000007 |
105 ; ARM32-LABEL: ret_8bits_ror5 | 137 ; ARM32-LABEL: ret_8bits_ror5 |
106 ; ARM32-NEXT: movw r0, #7 | 138 ; ARM32-NEXT: movw r0, #7 |
107 ; ARM32-NEXT: movt r0, #63488 | 139 ; ARM32-NEXT: movt r0, #63488 |
| 140 ; MIPS32-LABEL: <ret_8bits_ror5> |
| 141 ; MIPS32-NEXT: lui v0,0xf800 |
| 142 ; MIPS32-NEXT: ori v0,v0,0x7 |
108 | 143 |
109 define i32 @ret_8bits_ror4() { | 144 define i32 @ret_8bits_ror4() { |
110 ret i32 4026531855 | 145 ret i32 4026531855 |
111 } | 146 } |
112 ; CHECK-LABEL: ret_8bits_ror4 | 147 ; CHECK-LABEL: ret_8bits_ror4 |
113 ; CHECK-NEXT: mov eax,0xf000000f | 148 ; CHECK-NEXT: mov eax,0xf000000f |
114 ; ARM32-LABEL: ret_8bits_ror4 | 149 ; ARM32-LABEL: ret_8bits_ror4 |
115 ; ARM32-NEXT: mov r0, #-268435441 | 150 ; ARM32-NEXT: mov r0, #-268435441 |
116 ; ARM32-NEXT: bx lr | 151 ; ARM32-NEXT: bx lr |
| 152 ; MIPS32-LABEL: <ret_8bits_ror4> |
| 153 ; MIPS32-NEXT: lui v0,0xf000 |
| 154 ; MIPS32-NEXT: ori v0,v0,0xf |
117 | 155 |
118 define i32 @ret_8bits_ror3() { | 156 define i32 @ret_8bits_ror3() { |
119 ret i32 3758096415 | 157 ret i32 3758096415 |
120 } | 158 } |
121 ; CHECK-LABEL: ret_8bits_ror3 | 159 ; CHECK-LABEL: ret_8bits_ror3 |
122 ; CHECK-NEXT: mov eax,0xe000001f | 160 ; CHECK-NEXT: mov eax,0xe000001f |
123 ; ARM32-LABEL: ret_8bits_ror3 | 161 ; ARM32-LABEL: ret_8bits_ror3 |
124 ; ARM32-NEXT: movw r0, #31 | 162 ; ARM32-NEXT: movw r0, #31 |
125 ; ARM32-NEXT: movt r0, #57344 | 163 ; ARM32-NEXT: movt r0, #57344 |
| 164 ; MIPS32-LABEL: <ret_8bits_ror3> |
| 165 ; MIPS32-NEXT: lui v0,0xe000 |
| 166 ; MIPS32-NEXT: ori v0,v0,0x1f |
| 167 |
126 | 168 |
127 define i32 @ret_8bits_ror2() { | 169 define i32 @ret_8bits_ror2() { |
128 ret i32 3221225535 | 170 ret i32 3221225535 |
129 } | 171 } |
130 ; CHECK-LABEL: ret_8bits_ror2 | 172 ; CHECK-LABEL: ret_8bits_ror2 |
131 ; CHECK-NEXT: mov eax,0xc000003f | 173 ; CHECK-NEXT: mov eax,0xc000003f |
132 ; ARM32-LABEL: ret_8bits_ror2 | 174 ; ARM32-LABEL: ret_8bits_ror2 |
133 ; ARM32-NEXT: mov r0, #-1073741761 | 175 ; ARM32-NEXT: mov r0, #-1073741761 |
134 ; ARM32-NEXT: bx lr | 176 ; ARM32-NEXT: bx lr |
| 177 ; MIPS32-LABEL: <ret_8bits_ror2> |
| 178 ; MIPS32-NEXT: lui v0,0xc000 |
| 179 ; MIPS32-NEXT: ori v0,v0,0x3f |
135 | 180 |
136 define i32 @ret_8bits_ror1() { | 181 define i32 @ret_8bits_ror1() { |
137 ret i32 2147483775 | 182 ret i32 2147483775 |
138 } | 183 } |
139 ; CHECK-LABEL: ret_8bits_ror1 | 184 ; CHECK-LABEL: ret_8bits_ror1 |
140 ; CHECK-NEXT: mov eax,0x8000007f | 185 ; CHECK-NEXT: mov eax,0x8000007f |
141 ; ARM32-LABEL: ret_8bits_ror1 | 186 ; ARM32-LABEL: ret_8bits_ror1 |
142 ; ARM32-NEXT: movw r0, #127 | 187 ; ARM32-NEXT: movw r0, #127 |
143 ; ARM32-NEXT: movt r0, #32768 | 188 ; ARM32-NEXT: movt r0, #32768 |
| 189 ; MIPS32-LABEL: <ret_8bits_ror1> |
| 190 ; MIPS32-NEXT: lui v0,0x8000 |
| 191 ; MIPS32-NEXT: ori v0,v0,0x7f |
144 | 192 |
145 ; Some architectures can handle 16-bits at a time efficiently, | 193 ; Some architectures can handle 16-bits at a time efficiently, |
146 ; so also test those. | 194 ; so also test those. |
147 | 195 |
148 define i32 @ret_16bits_lower() { | 196 define i32 @ret_16bits_lower() { |
149 ret i32 65535 | 197 ret i32 65535 |
150 } | 198 } |
151 ; CHECK-LABEL: ret_16bits_lower | 199 ; CHECK-LABEL: ret_16bits_lower |
152 ; CHECK-NEXT: mov eax,0xffff | 200 ; CHECK-NEXT: mov eax,0xffff |
153 ; ARM32-LABEL: ret_16bits_lower | 201 ; ARM32-LABEL: ret_16bits_lower |
154 ; ARM32-NEXT: movw r0, #65535 | 202 ; ARM32-NEXT: movw r0, #65535 |
155 ; ARM32-NEXT: bx lr | 203 ; ARM32-NEXT: bx lr |
| 204 ; MIPS32-LABEL: <ret_16bits_lower> |
| 205 ; MIPS32-NEXT: lui v0,0x0 |
| 206 ; MIPS32-NEXT: ori v0,v0,0xffff |
156 | 207 |
157 define i32 @ret_17bits_lower() { | 208 define i32 @ret_17bits_lower() { |
158 ret i32 131071 | 209 ret i32 131071 |
159 } | 210 } |
160 ; CHECK-LABEL: ret_17bits_lower | 211 ; CHECK-LABEL: ret_17bits_lower |
161 ; CHECK-NEXT: mov eax,0x1ffff | 212 ; CHECK-NEXT: mov eax,0x1ffff |
162 ; ARM32-LABEL: ret_17bits_lower | 213 ; ARM32-LABEL: ret_17bits_lower |
163 ; ARM32-NEXT: movw r0, #65535 | 214 ; ARM32-NEXT: movw r0, #65535 |
164 ; ARM32-NEXT: movt r0, #1 | 215 ; ARM32-NEXT: movt r0, #1 |
| 216 ; MIPS32-LABEL: <ret_17bits_lower> |
| 217 ; MIPS32-NEXT: lui v0,0x1 |
| 218 ; MIPS32-NEXT: ori v0,v0,0xffff |
| 219 |
165 | 220 |
166 define i32 @ret_16bits_upper() { | 221 define i32 @ret_16bits_upper() { |
167 ret i32 4294901760 | 222 ret i32 4294901760 |
168 } | 223 } |
169 ; CHECK-LABEL: ret_16bits_upper | 224 ; CHECK-LABEL: ret_16bits_upper |
170 ; CHECK-NEXT: mov eax,0xffff0000 | 225 ; CHECK-NEXT: mov eax,0xffff0000 |
171 ; ARM32-LABEL: ret_16bits_upper | 226 ; ARM32-LABEL: ret_16bits_upper |
172 ; ARM32-NEXT: movw r0, #0 | 227 ; ARM32-NEXT: movw r0, #0 |
173 ; ARM32-NEXT: movt r0, #65535 | 228 ; ARM32-NEXT: movt r0, #65535 |
| 229 ; MIPS32-LABEL: <ret_16bits_upper> |
| 230 ; MIPS32-NEXT: lui v0,0xffff |
| 231 ; MIPS32-NEXT: ori v0,v0,0x0 |
| 232 |
174 | 233 |
175 ; Some 32-bit immediates can be inverted, and moved in a single instruction. | 234 ; Some 32-bit immediates can be inverted, and moved in a single instruction. |
176 | 235 |
177 define i32 @ret_8bits_inverted_shift_left0() { | 236 define i32 @ret_8bits_inverted_shift_left0() { |
178 ret i32 4294967040 | 237 ret i32 4294967040 |
179 } | 238 } |
180 ; CHECK-LABEL: ret_8bits_inverted_shift_left0 | 239 ; CHECK-LABEL: ret_8bits_inverted_shift_left0 |
181 ; CHECK-NEXT: mov eax,0xffffff00 | 240 ; CHECK-NEXT: mov eax,0xffffff00 |
182 ; ARM32-LABEL: ret_8bits_inverted_shift_left0 | 241 ; ARM32-LABEL: ret_8bits_inverted_shift_left0 |
183 ; ARM32-NEXT: mvn r0, #255 | 242 ; ARM32-NEXT: mvn r0, #255 |
184 ; ARM32-NEXT: bx lr | 243 ; ARM32-NEXT: bx lr |
| 244 ; MIPS32-LABEL: <ret_8bits_inverted_shift_left0> |
| 245 ; MIPS32-NEXT: li v0,-256 |
185 | 246 |
186 define i32 @ret_8bits_inverted_shift_left24() { | 247 define i32 @ret_8bits_inverted_shift_left24() { |
187 ret i32 16777215 | 248 ret i32 16777215 |
188 } | 249 } |
189 ; CHECK-LABEL: ret_8bits_inverted_shift_left24 | 250 ; CHECK-LABEL: ret_8bits_inverted_shift_left24 |
190 ; CHECK-NEXT: mov eax,0xffffff | 251 ; CHECK-NEXT: mov eax,0xffffff |
191 ; ARM32-LABEL: ret_8bits_inverted_shift_left24 | 252 ; ARM32-LABEL: ret_8bits_inverted_shift_left24 |
192 ; ARM32-NEXT: mvn r0, #-16777216 | 253 ; ARM32-NEXT: mvn r0, #-16777216 |
193 ; ARM32-NEXT: bx lr | 254 ; ARM32-NEXT: bx lr |
| 255 ; MIPS32-LABEL: <ret_8bits_inverted_shift_left24> |
| 256 ; MIPS32-NEXT: lui v0,0xff |
| 257 ; MIPS32-NEXT: ori v0,v0,0xffff |
194 | 258 |
195 define i32 @ret_8bits_inverted_ror2() { | 259 define i32 @ret_8bits_inverted_ror2() { |
196 ret i32 1073741760 | 260 ret i32 1073741760 |
197 } | 261 } |
198 ; CHECK-LABEL: ret_8bits_inverted_ror2 | 262 ; CHECK-LABEL: ret_8bits_inverted_ror2 |
199 ; CHECK-NEXT: mov eax,0x3fffffc0 | 263 ; CHECK-NEXT: mov eax,0x3fffffc0 |
200 ; ARM32-LABEL: ret_8bits_inverted_ror2 | 264 ; ARM32-LABEL: ret_8bits_inverted_ror2 |
201 ; ARM32-NEXT: mvn r0, #-1073741761 | 265 ; ARM32-NEXT: mvn r0, #-1073741761 |
202 ; ARM32-NEXT: bx lr | 266 ; ARM32-NEXT: bx lr |
| 267 ; MIPS32-LABEL: <ret_8bits_inverted_ror2> |
| 268 ; MIPS32-NEXT: lui v0,0x3fff |
| 269 ; MIPS32-NEXT: ori v0,v0,0xffc0 |
203 | 270 |
204 define i32 @ret_8bits_inverted_ror6() { | 271 define i32 @ret_8bits_inverted_ror6() { |
205 ret i32 67108860 | 272 ret i32 67108860 |
206 } | 273 } |
207 ; CHECK-LABEL: ret_8bits_inverted_ror6 | 274 ; CHECK-LABEL: ret_8bits_inverted_ror6 |
208 ; CHECK-NEXT: mov eax,0x3fffffc | 275 ; CHECK-NEXT: mov eax,0x3fffffc |
209 ; ARM32-LABEL: ret_8bits_inverted_ror6 | 276 ; ARM32-LABEL: ret_8bits_inverted_ror6 |
210 ; ARM32-NEXT: mvn r0, #-67108861 | 277 ; ARM32-NEXT: mvn r0, #-67108861 |
211 ; ARM32-NEXT: bx lr | 278 ; ARM32-NEXT: bx lr |
| 279 ; MIPS32-LABEL: <ret_8bits_inverted_ror6> |
| 280 ; MIPS32-NEXT: lui v0,0x3ff |
| 281 ; MIPS32-NEXT: ori v0,v0,0xfffc |
| 282 |
212 | 283 |
213 define i32 @ret_8bits_inverted_ror7() { | 284 define i32 @ret_8bits_inverted_ror7() { |
214 ret i32 33554430 | 285 ret i32 33554430 |
215 } | 286 } |
216 ; CHECK-LABEL: ret_8bits_inverted_ror7 | 287 ; CHECK-LABEL: ret_8bits_inverted_ror7 |
217 ; CHECK-NEXT: mov eax,0x1fffffe | 288 ; CHECK-NEXT: mov eax,0x1fffffe |
218 ; ARM32-LABEL: ret_8bits_inverted_ror7 | 289 ; ARM32-LABEL: ret_8bits_inverted_ror7 |
219 ; ARM32-NEXT: movw r0, #65534 | 290 ; ARM32-NEXT: movw r0, #65534 |
220 ; ARM32-NEXT: movt r0, #511 | 291 ; ARM32-NEXT: movt r0, #511 |
| 292 ; MIPS32-LABEL: <ret_8bits_inverted_ror7> |
| 293 ; MIPS32-NEXT: lui v0,0x1ff |
| 294 ; MIPS32-NEXT: ori v0,v0,0xfffe |
221 | 295 |
222 ; 64-bit immediates. | 296 ; 64-bit immediates. |
223 | 297 |
224 define i64 @ret_64bits_shift_left0() { | 298 define i64 @ret_64bits_shift_left0() { |
225 ret i64 1095216660735 | 299 ret i64 1095216660735 |
226 } | 300 } |
227 ; CHECK-LABEL: ret_64bits_shift_left0 | 301 ; CHECK-LABEL: ret_64bits_shift_left0 |
228 ; CHECK-NEXT: mov eax,0xff | 302 ; CHECK-NEXT: mov eax,0xff |
229 ; CHECK-NEXT: mov edx,0xff | 303 ; CHECK-NEXT: mov edx,0xff |
230 ; ARM32-LABEL: ret_64bits_shift_left0 | 304 ; ARM32-LABEL: ret_64bits_shift_left0 |
231 ; ARM32-NEXT: movw r0, #255 | 305 ; ARM32-NEXT: movw r0, #255 |
232 ; ARM32-NEXT: movw r1, #255 | 306 ; ARM32-NEXT: movw r1, #255 |
| 307 ; MIPS32-LABEL: <ret_64bits_shift_left0> |
| 308 ; MIPS32-NEXT: li v0,255 |
| 309 ; MIPS32-NEXT: li v1,255 |
| 310 |
233 | 311 |
234 ; A relocatable constant is assumed to require 32-bits along with | 312 ; A relocatable constant is assumed to require 32-bits along with |
235 ; relocation directives. | 313 ; relocation directives. |
236 | 314 |
237 declare void @_start() | 315 declare void @_start() |
238 | 316 |
239 define i32 @ret_addr() { | 317 define i32 @ret_addr() { |
240 %ptr = ptrtoint void ()* @_start to i32 | 318 %ptr = ptrtoint void ()* @_start to i32 |
241 ret i32 %ptr | 319 ret i32 %ptr |
242 } | 320 } |
243 ; CHECK-LABEL: ret_addr | 321 ; CHECK-LABEL: ret_addr |
244 ; CHECK-NEXT: mov eax,0x0 {{.*}} R_386_32 _start | 322 ; CHECK-NEXT: mov eax,0x0 {{.*}} R_386_32 _start |
245 ; ARM32-LABEL: ret_addr | 323 ; ARM32-LABEL: ret_addr |
246 ; ARM32-NEXT: movw r0, #0 {{.*}} R_ARM_MOVW_ABS_NC _start | 324 ; ARM32-NEXT: movw r0, #0 {{.*}} R_ARM_MOVW_ABS_NC _start |
247 ; ARM32-NEXT: movt r0, #0 {{.*}} R_ARM_MOVT_ABS _start | 325 ; ARM32-NEXT: movt r0, #0 {{.*}} R_ARM_MOVT_ABS _start |
| 326 ; TODO(RKotler) emitting proper li but in disassembly |
| 327 ; it shows up only in the relocation records. Should emit |
| 328 ; without the macro but we still need to add GOT implementation |
| 329 ; to finish this case |
| 330 ; |
OLD | NEW |