1 // REQUIRES: arm-registered-target
3 // RUN: %clang_cc1 -triple armv6 -verify=arm6 %s
4 // RUN: %clang_cc1 -triple armv7 -verify=arm7 %s
5 // RUN: %clang_cc1 -triple thumbv6 -verify=thumb1 %s
6 // RUN: %clang_cc1 -triple thumbv7 -verify=thumb2 %s
8 // j: An immediate integer between 0 and 65535 (valid for MOVW) (ARM/Thumb2)
12 : [ result
] "=r"(res
)
13 : [ constant
] "j"(-1), [ input
] "r"(i
)
15 // arm6-error@13 {{invalid input constraint 'j' in asm}}
16 // arm7-error@13 {{value '-1' out of range for constraint 'j'}}
17 // thumb1-error@13 {{invalid input constraint 'j' in asm}}
18 // thumb2-error@13 {{value '-1' out of range for constraint 'j'}}
20 : [ result
] "=r"(res
)
21 : [ constant
] "j"(0), [ input
] "r"(i
)
23 // arm6-error@21 {{invalid input constraint 'j' in asm}}
25 // thumb1-error@21 {{invalid input constraint 'j' in asm}}
28 : [ result
] "=r"(res
)
29 : [ constant
] "j"(65535), [ input
] "r"(i
)
31 // arm6-error@29 {{invalid input constraint 'j' in asm}}
33 // thumb1-error@29 {{invalid input constraint 'j' in asm}}
36 : [ result
] "=r"(res
)
37 : [ constant
] "j"(65536), [ input
] "r"(i
)
39 // arm6-error@37 {{invalid input constraint 'j' in asm}}
40 // arm7-error@37 {{value '65536' out of range for constraint 'j'}}
41 // thumb1-error@37 {{invalid input constraint 'j' in asm}}
42 // thumb2-error@37 {{value '65536' out of range for constraint 'j'}}
46 // I: An immediate integer valid for a data-processing instruction. (ARM/Thumb2)
47 // An immediate integer between 0 and 255. (Thumb1)
52 : [ result
] "=r"(res
)
53 : [ constant
] "I"(-1), [ input
] "r"(i
)
54 :); // thumb1-error@53 {{value '-1' out of range for constraint 'I'}}
57 : [ result
] "=r"(res
)
58 : [ constant
] "I"(0), [ input
] "r"(i
)
59 :); // No errors expected.
62 : [ result
] "=r"(res
)
63 : [ constant
] "I"(255), [ input
] "r"(i
)
64 :); // No errors expected.
67 : [ result
] "=r"(res
)
68 : [ constant
] "I"(256), [ input
] "r"(i
)
69 :); // thumb1-error@68 {{value '256' out of range for constraint 'I'}}
73 // J: An immediate integer between -4095 and 4095. (ARM/Thumb2)
74 // An immediate integer between -255 and -1. (Thumb1)
79 : [ result
] "=r"(res
)
80 : [ constant
] "J"(-4096), [ input
] "r"(i
)
82 // arm6-error@80 {{value '-4096' out of range for constraint 'J'}}
83 // arm7-error@80 {{value '-4096' out of range for constraint 'J'}}
84 // thumb1-error@80 {{value '-4096' out of range for constraint 'J'}}
85 // thumb2-error@80 {{value '-4096' out of range for constraint 'J'}}
88 : [ result
] "=r"(res
)
89 : [ constant
] "J"(-4095), [ input
] "r"(i
)
91 // thumb1-error@89 {{value '-4095' out of range for constraint 'J'}}
94 : [ result
] "=r"(res
)
95 : [ constant
] "J"(-256), [ input
] "r"(i
)
97 // thumb1-error@95 {{value '-256' out of range for constraint 'J'}}
100 : [ result
] "=r"(res
)
101 : [ constant
] "J"(-255), [ input
] "r"(i
)
103 // No errors expected.
106 : [ result
] "=r"(res
)
107 : [ constant
] "J"(-1), [ input
] "r"(i
)
109 // No errors expected.
112 : [ result
] "=r"(res
)
113 : [ constant
] "J"(0), [ input
] "r"(i
)
115 // thumb1-error@113 {{value '0' out of range for constraint 'J'}}
118 : [ result
] "=r"(res
)
119 : [ constant
] "J"(4095), [ input
] "r"(i
)
121 // thumb1-error@119 {{value '4095' out of range for constraint 'J'}}
124 : [ result
] "=r"(res
)
125 : [ constant
] "J"(4096), [ input
] "r"(i
)
127 // arm6-error@125 {{value '4096' out of range for constraint 'J'}}
128 // arm7-error@125 {{value '4096' out of range for constraint 'J'}}
129 // thumb1-error@125 {{value '4096' out of range for constraint 'J'}}
130 // thumb2-error@125 {{value '4096' out of range for constraint 'J'}}
134 // K: An immediate integer whose bitwise inverse is valid for a data-processing instruction. (ARM/Thumb2)
135 // An immediate integer between 0 and 255, with optional left-shift by some amount. (Thumb1)
140 : [ result
] "=r"(res
)
141 : [ constant
] "K"(123), [ input
] "r"(i
)
143 // No errors expected.
147 // L: An immediate integer whose negation is valid for a data-processing instruction. (ARM/Thumb2)
148 // An immediate integer between -7 and 7. (Thumb1)
153 : [ result
] "=r"(res
)
154 : [ constant
] "L"(-8), [ input
] "r"(i
)
155 :); // thumb1-error@154 {{value '-8' out of range for constraint 'L'}}
158 : [ result
] "=r"(res
)
159 : [ constant
] "L"(-7), [ input
] "r"(i
)
160 :); // No errors expected.
163 : [ result
] "=r"(res
)
164 : [ constant
] "L"(7), [ input
] "r"(i
)
165 :); // No errors expected.
168 : [ result
] "=r"(res
)
169 : [ constant
] "L"(8), [ input
] "r"(i
)
170 :); // thumb1-error@169 {{value '8' out of range for constraint 'L'}}
174 // M: A power of two or a integer between 0 and 32. (ARM/Thumb2)
175 // An immediate integer which is a multiple of 4 between 0 and 1020. (Thumb1)
180 : [ result
] "=r"(res
)
181 : [ constant
] "M"(123), [ input
] "r"(i
)
182 :); // No errors expected.
186 // N: Invalid (ARM/Thumb2)
187 // An immediate integer between 0 and 31. (Thumb1)
191 : [ result
] "=r"(res
)
192 : [ constant
] "N"(-1), [ input
] "r"(i
)
194 // arm6-error@192 {{invalid input constraint 'N' in asm}}
195 // arm7-error@192 {{invalid input constraint 'N' in asm}}
196 // thumb1-error@192 {{value '-1' out of range for constraint 'N'}}
197 // thumb2-error@192 {{invalid input constraint 'N' in asm}}
200 : [ result
] "=r"(res
)
201 : [ constant
] "N"(0), [ input
] "r"(i
)
203 // arm6-error@201 {{invalid input constraint 'N' in asm}}
204 // arm7-error@201 {{invalid input constraint 'N' in asm}}
206 // thumb2-error@201 {{invalid input constraint 'N' in asm}}
209 : [ result
] "=r"(res
)
210 : [ constant
] "N"(31), [ input
] "r"(i
)
212 // arm6-error@210 {{invalid input constraint 'N' in asm}}
213 // arm7-error@210 {{invalid input constraint 'N' in asm}}
215 // thumb2-error@210 {{invalid input constraint 'N' in asm}}
218 : [ result
] "=r"(res
)
219 : [ constant
] "N"(32), [ input
] "r"(i
)
221 // arm6-error@219 {{invalid input constraint 'N' in asm}}
222 // arm7-error@219 {{invalid input constraint 'N' in asm}}
223 // thumb1-error@219 {{value '32' out of range for constraint 'N'}}
224 // thumb2-error@219 {{invalid input constraint 'N' in asm}}
228 // O: Invalid (ARM/Thumb2)
229 // An immediate integer which is a multiple of 4 between -508 and 508. (Thumb1)
234 : [ result
] "=r"(res
)
235 : [ constant
] "O"(1), [ input
] "r"(i
)
237 // arm6-error@235 {{invalid input constraint 'O' in asm}}
238 // arm7-error@235 {{invalid input constraint 'O' in asm}}
240 // thumb2-error@235 {{invalid input constraint 'O' in asm}}
244 // l: Same as r (ARM)
245 // A low 32-bit GPR register (r0-r7). (Thumb1/Thumb2)
250 : [ result
] "=l"(res
)
251 : [ constant
] "i"(10), [ input
] "l"(i
)
252 :); // No errors expected.
257 // A high 32-bit GPR register (r8-r15). (Thumb1/Thumb2)
262 : [ result
] "=h"(res
)
263 : [ constant
] "i"(10), [ input
] "h"(i
)
265 // arm6-error@262 {{invalid output constraint '=h' in asm}}
266 // arm7-error@262 {{invalid output constraint '=h' in asm}}
270 // s: An integer constant, but allowing only relocatable values.
277 : [ result
] "=r"(res
)
278 : [ constant
] "s"(&g
), [ input
] "r"(i
)
279 :); // No errors expected.
283 // w: A 32, 64, or 128-bit floating-point/SIMD register: s0-s31, d0-d31, or q0-q15.
284 float test_w(float x
) {
285 __asm__("vsqrt.f32 %0, %1"
287 : "w"(x
)); // No error expected.
291 // x: A 32, 64, or 128-bit floating-point/SIMD register: s0-s15, d0-d7, or q0-q3.
292 float test_x(float x
) {
293 __asm__("vsqrt.f32 %0, %1"
295 : "x"(x
)); // No error expected.
299 // t: A 32, 64, or 128-bit floating-point/SIMD register: s0-s31, d0-d15, or q0-q7.
300 float test_t(float x
) {
301 __asm__("vsqrt.f32 %0, %1"
303 : "t"(x
)); // No error expected.