[testsuite] Fix directives order
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / pragma_cpp_predefs_1.c
blobbfb044f5d145636d4d2cc731a38bc6e5455e0fb9
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -march=armv8-a+crypto" } */
4 /* Test that pragma option pushing and popping works.
5 Also that CPP predefines redefinitions on #pragma works. */
7 #pragma GCC push_options
8 #pragma GCC target ("arch=armv8-a+nofp+nosimd")
9 #ifdef __ARM_FEATURE_FMA
10 #error "__ARM_FEATURE_FMA is defined but should not be!"
11 #endif
13 #ifdef __ARM_FP
14 #error "__ARM_FP is defined but should not be!"
15 #endif
17 #pragma GCC push_options
18 #pragma GCC target ("arch=armv8-a+fp+nosimd")
19 #ifndef __ARM_FP
20 #error "__ARM_FP is not defined but should be!"
21 #endif
23 #ifdef __ARM_NEON
24 #error "__ARM_NEON is defined but should not be!"
25 #endif
27 #pragma GCC push_options
28 #pragma GCC target ("arch=armv8-a+fp+simd")
30 #ifndef __ARM_NEON
31 #error "__ARM_NEON is not defined but should be!"
32 #endif
34 #ifdef __ARM_FEATURE_CRYPTO
35 #error "__ARM_FEATURE_CRYPTO is defined but should not be!"
36 #endif
38 #pragma GCC push_options
39 #pragma GCC target ("arch=armv8-a+fp+simd+crypto")
41 #ifndef __ARM_FEATURE_CRYPTO
42 #error "__ARM_FEATURE_CRYPTO is not defined but should be!"
43 #endif
45 #pragma GCC pop_options
47 #ifndef __ARM_NEON
48 #error "__ARM_NEON is not defined but should be!"
49 #endif
51 #ifdef __ARM_FEATURE_CRYPTO
52 #error "__ARM_FEATURE_CRYPTO is defined but should not be!"
53 #endif
56 #pragma GCC pop_options
58 #ifndef __ARM_FP
59 #error "__ARM_FP is not defined but should be!"
60 #endif
62 #ifdef __ARM_NEON
63 #error "__ARM_NEON is defined but should not be!"
64 #endif
66 #pragma GCC pop_options
68 #ifdef __ARM_FP
69 #error "__ARM_FP is defined but should not be!"
70 #endif
72 #ifdef __ARM_NEON
73 #error "__ARM_NEON is defined but should not be!"
74 #endif
76 /* And again, but using cpu=. */
78 #pragma GCC push_options
79 #pragma GCC target ("cpu=cortex-a53+nofp+nosimd")
80 #ifdef __ARM_FEATURE_FMA
81 #error "__ARM_FEATURE_FMA is defined but should not be!"
82 #endif
84 #ifdef __ARM_FP
85 #error "__ARM_FP is defined but should not be!"
86 #endif
88 #pragma GCC push_options
89 #pragma GCC target ("cpu=cortex-a53+fp+nosimd")
90 #ifndef __ARM_FP
91 #error "__ARM_FP is not defined but should be!"
92 #endif
94 #ifdef __ARM_NEON
95 #error "__ARM_NEON is defined but should not be!"
96 #endif
98 #pragma GCC push_options
99 #pragma GCC target ("cpu=cortex-a53+fp+simd+nocrypto")
101 #ifndef __ARM_NEON
102 #error "__ARM_NEON is not defined but should be!"
103 #endif
105 #ifdef __ARM_FEATURE_CRYPTO
106 #error "__ARM_FEATURE_CRYPTO is defined but should not be!"
107 #endif
109 #pragma GCC push_options
110 #pragma GCC target ("cpu=cortex-a53+fp+simd+crypto")
112 #ifndef __ARM_FEATURE_CRYPTO
113 #error "__ARM_FEATURE_CRYPTO is not defined but should be!"
114 #endif
117 #pragma GCC pop_options
119 #ifndef __ARM_NEON
120 #error "__ARM_NEON is not defined but should be!"
121 #endif
123 #ifdef __ARM_FEATURE_CRYPTO
124 #error "__ARM_FEATURE_CRYPTO is defined but should not be!"
125 #endif
128 #pragma GCC pop_options
130 #ifndef __ARM_FP
131 #error "__ARM_FP is not defined but should be!"
132 #endif
134 #ifdef __ARM_NEON
135 #error "__ARM_NEON is defined but should not be!"
136 #endif
138 #pragma GCC pop_options
140 #ifdef __ARM_FP
141 #error "__ARM_FP is defined but should not be!"
142 #endif
144 #ifdef __ARM_NEON
145 #error "__ARM_NEON is defined but should not be!"
146 #endif
148 /* And again, but using just the ISA extensions. */
150 #pragma GCC push_options
151 #pragma GCC target ("+nofp")
152 #ifdef __ARM_FEATURE_FMA
153 #error "__ARM_FEATURE_FMA is defined but should not be!"
154 #endif
156 #ifdef __ARM_FP
157 #error "__ARM_FP is defined but should not be!"
158 #endif
160 #pragma GCC push_options
161 #pragma GCC target ("+fp+nosimd")
162 #ifndef __ARM_FP
163 #error "__ARM_FP is not defined but should be!"
164 #endif
166 #ifdef __ARM_NEON
167 #error "__ARM_NEON is defined but should not be!"
168 #endif
170 #pragma GCC push_options
171 #pragma GCC target ("+fp+simd+nocrypto")
173 #ifndef __ARM_NEON
174 #error "__ARM_NEON is not defined but should be!"
175 #endif
177 #ifdef __ARM_FEATURE_CRYPTO
178 #error "__ARM_FEATURE_CRYPTO is defined but should not be!"
179 #endif
181 #pragma GCC push_options
182 #pragma GCC target ("+fp+simd+crypto")
184 #ifndef __ARM_FEATURE_CRYPTO
185 #error "__ARM_FEATURE_CRYPTO is not defined but should be!"
186 #endif
188 #pragma GCC pop_options
190 #ifndef __ARM_NEON
191 #error "__ARM_NEON is not defined but should be!"
192 #endif
194 #ifdef __ARM_FEATURE_CRYPTO
195 #error "__ARM_FEATURE_CRYPTO is defined but should not be!"
196 #endif
199 #pragma GCC pop_options
201 #ifndef __ARM_FP
202 #error "__ARM_FP is not defined but should be!"
203 #endif
205 #ifdef __ARM_NEON
206 #error "__ARM_NEON is defined but should not be!"
207 #endif
209 #pragma GCC pop_options
211 #ifdef __ARM_FP
212 #error "__ARM_FP is defined but should not be!"
213 #endif
215 #ifdef __ARM_NEON
216 #error "__ARM_NEON is defined but should not be!"
217 #endif
219 /* Make sure that general-regs-only works too. */
220 #pragma GCC push_options
221 #pragma GCC target ("general-regs-only")
222 #ifdef __ARM_FEATURE_FMA
223 #error "__ARM_FEATURE_FMA is defined but should not be!"
224 #endif
226 #ifdef __ARM_FP
227 #error "__ARM_FP is defined but should not be!"
228 #endif
230 #ifdef __ARM_NEON
231 #error "__ARM_NEON is defined but should not be!"
232 #endif
234 #ifdef __ARM_FEATURE_CRYPTO
235 #error "__ARM_FEATURE_CRYPTO is defined but should not be!"
236 #endif
238 #pragma GCC pop_options
240 /* Also check that crc re-defines work. */
241 #pragma GCC target ("+nocrc")
242 #ifdef __ARM_FEATURE_CRC32
243 #error "__ARM_FEATURE_CRC32 is defined but should not be!"
244 #endif
246 #pragma GCC target ("+crc")
247 #ifndef __ARM_FEATURE_CRC32
248 #error "__ARM_FEATURE_CRC32 is not defined but should be!"
249 #endif
252 foo (int a)
254 return a;