Debian Codegraph @

gcc/testsuite/gcc.target/arm/acle/data-intrinsics-assembly.c

raw
1 /* Test the ACLE data intrinsics get expanded to the correct instructions on a specific architecture */
2 /* { dg-do assemble } */
3 /* { dg-require-effective-target arm_softfp_ok } */
4 /* { dg-require-effective-target arm_arch_v6_arm_ok } */
5 /* { dg-additional-options "--save-temps -O1" } */
6 /* { dg-add-options arm_arch_v6_arm } */
7 /* { dg-final { check-function-bodies "**" "" "" } } */
8
9 #include "arm_acle.h"
10
11 uint32_t *g32;
12 unsigned long *gul;
13 uint64_t *g64;
14 unsigned int *gui;
15 int16_t *g16;
16
17 /*
18 ** test_clz:
19 ** clz r0, r0
20 ** bx lr
21 */
22
23 unsigned int test_clz (uint32_t a)
24 {
25 return __clz (a);
26 }
27
28 /*
29 ** test_clzl:
30 ** clz r0, r0
31 ** bx lr
32 */
33
34 unsigned int test_clzl (unsigned long a)
35 {
36 return __clzl (a);
37 }
38
39 /*
40 ** test_cls:
41 ** eor (r[0-9]+), r0, r0, asr #31
42 ** clz (r[0-9]+), \1
43 ** sub r0, \2, #1
44 ** bx lr
45 */
46
47 unsigned int test_cls (uint32_t a)
48 {
49 return __cls(a);
50 }
51
52 /*
53 ** test_clsl:
54 ** eor (r[0-9]+), r0, r0, asr #31
55 ** clz (r[0-9]+), \1
56 ** sub r0, \2, #1
57 ** bx lr
58 */
59
60 unsigned int test_clsl (unsigned long a)
61 {
62 return __clsl (a);
63 }
64
65 /*
66 ** test_rev:
67 ** rev r0, r0
68 ** bx lr
69 */
70
71 uint32_t test_rev (uint32_t a)
72 {
73 return __rev (a);
74 }
75
76 /*
77 ** test_revl:
78 ** rev r0, r0
79 ** bx lr
80 */
81
82 unsigned long test_revl (unsigned long a)
83 {
84 return __revl (a);
85 }
86
87 /*
88 ** test_revll:
89 ** mov (r[0-9]+), r0
90 ** rev r0, r1
91 ** rev r1, \1
92 ** bx lr
93 */
94
95 uint64_t test_revll (uint64_t a)
96 {
97 return __revll (a);
98 }
99
100 /*
101 ** test_ror:
102 ** and (r[0-9]+), r1, #31
103 ** ror r0, r0, \1
104 ** bx lr
105 */
106
107 uint32_t test_ror (uint32_t a, uint32_t r)
108 {
109 return __ror (a, r);
110 }
111
112 /*
113 ** test_rorl:
114 ** and (r[0-9]+), r1, #31
115 ** ror r0, r0, \1
116 ** bx lr
117 */
118
119 unsigned long test_rorl (unsigned long a, uint32_t r)
120 {
121 return __rorl (a, r);
122 }
123
124 /*
125 ** test_revsh:
126 ** revsh r0, r0
127 ** bx lr
128 */
129
130 int16_t test_revsh (int16_t a)
131 {
132 return __revsh (a);
133 }
134
135 /*
136 ** test_clz_mem:
137 ** ...
138 ** clz r[0-9]+, r[0-9]+
139 ** ...
140 ** bx lr
141 */
142
143 void test_clz_mem (uint32_t *a)
144 {
145 *gui = __clz (*a);
146 }
147
148 /*
149 ** test_clzl_mem:
150 ** ...
151 ** clz r[0-9]+, r[0-9]+
152 ** ...
153 ** bx lr
154 */
155
156 void test_clzl_mem (unsigned long *a)
157 {
158 *gui = __clzl (*a);
159 }
160
161 /*
162 ** test_cls_mem:
163 ** ...
164 ** clz r[0-9]+, r[0-9]+
165 ** ...
166 ** bx lr
167 */
168
169 void test_cls_mem (uint32_t *a)
170 {
171 *gui = __cls (*a);
172 }
173
174 /*
175 ** test_clsl_mem:
176 ** ...
177 ** clz r[0-9]+, r[0-9]+
178 ** ...
179 ** bx lr
180 */
181
182 void test_clsl_mem (unsigned long *a)
183 {
184 *gui = __clsl (*a);
185 }
186
187 /*
188 ** test_rev_mem:
189 ** ...
190 ** rev r[0-9]+, r[0-9]+
191 ** ...
192 ** bx lr
193 */
194
195 void test_rev_mem (uint32_t *a)
196 {
197 *g32 = __rev (*a);
198 }
199
200 /*
201 ** test_revl_mem:
202 ** ...
203 ** rev r[0-9]+, r[0-9]+
204 ** ...
205 ** bx lr
206 */
207
208 void test_revl_mem (unsigned long *a)
209 {
210 *gul = __revl (*a);
211 }
212
213 /*
214 ** test_revll_mem:
215 ** ...
216 ** rev r[0-9]+, r[0-9]+
217 ** ...
218 ** bx lr
219 */
220
221 void test_revll_mem (uint64_t *a)
222 {
223 *g64 = __revll (*a);
224 }
225
226 /*
227 ** test_ror_mem:
228 ** ...
229 ** ror r[0-9]+, r[0-9]+, r[0-9]+
230 ** ...
231 ** bx lr
232 */
233
234 void test_ror_mem (uint32_t *a, uint32_t *r)
235 {
236 *g32 = __ror (*a, *r);
237 }
238
239 /*
240 ** test_rorl_mem:
241 ** ...
242 ** ror r[0-9]+, r[0-9]+, r[0-9]+
243 ** ...
244 ** bx lr
245 */
246
247 void test_rorl_mem (unsigned long *a, uint32_t *r)
248 {
249 *gul = __rorl (*a, *r);
250 }
251
252 /*
253 ** test_revsh_mem:
254 ** ...
255 ** rev16 r[0-9]+, r[0-9]+
256 ** ...
257 ** bx lr
258 */
259
260 void test_revsh_mem (int16_t *a)
261 {
262 *g16 = __revsh (*a);
263 }
264