Debian Codegraph @

clang/test/Preprocessor/wasm-target-features.c

raw
1 // RUN: %clang -E -dM %s -o - 2>&1 \
2 // RUN: -target wasm32-unknown-unknown -matomics \
3 // RUN: | FileCheck %s -check-prefix=ATOMICS
4 // RUN: %clang -E -dM %s -o - 2>&1 \
5 // RUN: -target wasm64-unknown-unknown -matomics \
6 // RUN: | FileCheck %s -check-prefix=ATOMICS
7 //
8 // ATOMICS: #define __wasm_atomics__ 1{{$}}
9
10 // RUN: %clang -E -dM %s -o - 2>&1 \
11 // RUN: -target wasm32-unknown-unknown -pthread \
12 // RUN: | FileCheck %s -check-prefix=PTHREAD
13 // RUN: %clang -E -dM %s -o - 2>&1 \
14 // RUN: -target wasm64-unknown-unknown -pthread \
15 // RUN: | FileCheck %s -check-prefix=PTHREAD
16 //
17 // PTHREAD: #define __wasm_atomics__ 1{{$}}
18
19 // RUN: %clang -E -dM %s -o - 2>&1 \
20 // RUN: -target wasm32-unknown-unknown -mbulk-memory \
21 // RUN: | FileCheck %s -check-prefix=BULK-MEMORY
22 // RUN: %clang -E -dM %s -o - 2>&1 \
23 // RUN: -target wasm64-unknown-unknown -mbulk-memory \
24 // RUN: | FileCheck %s -check-prefix=BULK-MEMORY
25 //
26 // BULK-MEMORY: #define __wasm_bulk_memory__ 1{{$}}
27
28 // RUN: %clang -E -dM %s -o - 2>&1 \
29 // RUN: -target wasm32-unknown-unknown -mexception-handling \
30 // RUN: | FileCheck %s -check-prefix=EXCEPTION-HANDLING
31 // RUN: %clang -E -dM %s -o - 2>&1 \
32 // RUN: -target wasm64-unknown-unknown -mexception-handling \
33 // RUN: | FileCheck %s -check-prefix=EXCEPTION-HANDLING
34 //
35 // EXCEPTION-HANDLING: #define __wasm_exception_handling__ 1{{$}}
36
37 // RUN: %clang -E -dM %s -o - 2>&1 \
38 // RUN: -target wasm32-unknown-unknown -mextended-const \
39 // RUN: | FileCheck %s -check-prefix=EXTENDED-CONST
40 // RUN: %clang -E -dM %s -o - 2>&1 \
41 // RUN: -target wasm64-unknown-unknown -mextended-const \
42 // RUN: | FileCheck %s -check-prefix=EXTENDED-CONST
43 //
44 // EXTENDED-CONST: #define __wasm_extended_const__ 1{{$}}
45
46 // RUN: %clang -E -dM %s -o - 2>&1 \
47 // RUN: -target wasm32-unknown-unknown -mfp16 \
48 // RUN: | FileCheck %s -check-prefix=FP16
49 // RUN: %clang -E -dM %s -o - 2>&1 \
50 // RUN: -target wasm64-unknown-unknown -mfp16 \
51 // RUN: | FileCheck %s -check-prefix=FP16
52 //
53 // FP16: #define __wasm_fp16__ 1{{$}}
54
55 // RUN: %clang -E -dM %s -o - 2>&1 \
56 // RUN: -target wasm32-unknown-unknown -mgc \
57 // RUN: | FileCheck %s -check-prefix=GC
58 // RUN: %clang -E -dM %s -o - 2>&1 \
59 // RUN: -target wasm64-unknown-unknown -mgc \
60 // RUN: | FileCheck %s -check-prefix=GC
61 //
62 // GC: #define __wasm_gc__ 1{{$}}
63
64 // RUN: %clang -E -dM %s -o - 2>&1 \
65 // RUN: -target wasm32-unknown-unknown -mmultimemory \
66 // RUN: | FileCheck %s -check-prefix=MULTIMEMORY
67 // RUN: %clang -E -dM %s -o - 2>&1 \
68 // RUN: -target wasm64-unknown-unknown -mmultimemory \
69 // RUN: | FileCheck %s -check-prefix=MULTIMEMORY
70 //
71 // MULTIMEMORY: #define __wasm_multimemory__ 1{{$}}
72
73 // RUN: %clang -E -dM %s -o - 2>&1 \
74 // RUN: -target wasm32-unknown-unknown -mmultivalue \
75 // RUN: | FileCheck %s -check-prefix=MULTIVALUE
76 // RUN: %clang -E -dM %s -o - 2>&1 \
77 // RUN: -target wasm64-unknown-unknown -mmultivalue \
78 // RUN: | FileCheck %s -check-prefix=MULTIVALUE
79 //
80 // MULTIVALUE: #define __wasm_multivalue__ 1{{$}}
81
82 // RUN: %clang -E -dM %s -o - 2>&1 \
83 // RUN: -target wasm32-unknown-unknown -mmutable-globals \
84 // RUN: | FileCheck %s -check-prefix=MUTABLE-GLOBALS
85 // RUN: %clang -E -dM %s -o - 2>&1 \
86 // RUN: -target wasm64-unknown-unknown -mmutable-globals \
87 // RUN: | FileCheck %s -check-prefix=MUTABLE-GLOBALS
88 //
89 // MUTABLE-GLOBALS: #define __wasm_mutable_globals__ 1{{$}}
90
91 // RUN: %clang -E -dM %s -o - 2>&1 \
92 // RUN: -target wasm32-unknown-unknown -mnontrapping-fptoint \
93 // RUN: | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
94 // RUN: %clang -E -dM %s -o - 2>&1 \
95 // RUN: -target wasm64-unknown-unknown -mnontrapping-fptoint \
96 // RUN: | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
97 //
98 // NONTRAPPING-FPTOINT: #define __wasm_nontrapping_fptoint__ 1{{$}}
99
100 // RUN: %clang -E -dM %s -o - 2>&1 \
101 // RUN: -target wasm32-unknown-unknown -mreference-types \
102 // RUN: | FileCheck %s -check-prefix=REFERENCE-TYPES
103 // RUN: %clang -E -dM %s -o - 2>&1 \
104 // RUN: -target wasm64-unknown-unknown -mreference-types \
105 // RUN: | FileCheck %s -check-prefix=REFERENCE-TYPES
106 //
107 // REFERENCE-TYPES: #define __wasm_reference_types__ 1{{$}}
108
109 // RUN: %clang -E -dM %s -o - 2>&1 \
110 // RUN: -target wasm32-unknown-unknown -mrelaxed-simd \
111 // RUN: | FileCheck %s -check-prefix=RELAXED-SIMD
112 // RUN: %clang -E -dM %s -o - 2>&1 \
113 // RUN: -target wasm64-unknown-unknown -mrelaxed-simd \
114 // RUN: | FileCheck %s -check-prefix=RELAXED-SIMD
115 //
116 // RELAXED-SIMD: #define __wasm_relaxed_simd__ 1{{$}}
117
118 // RUN: %clang -E -dM %s -o - 2>&1 \
119 // RUN: -target wasm32-unknown-unknown -msign-ext \
120 // RUN: | FileCheck %s -check-prefix=SIGN-EXT
121 // RUN: %clang -E -dM %s -o - 2>&1 \
122 // RUN: -target wasm64-unknown-unknown -msign-ext \
123 // RUN: | FileCheck %s -check-prefix=SIGN-EXT
124 //
125 // SIGN-EXT: #define __wasm_sign_ext__ 1{{$}}
126
127 // RUN: %clang -E -dM %s -o - 2>&1 \
128 // RUN: -target wasm32-unknown-unknown -msimd128 \
129 // RUN: | FileCheck %s -check-prefix=SIMD128
130 // RUN: %clang -E -dM %s -o - 2>&1 \
131 // RUN: -target wasm64-unknown-unknown -msimd128 \
132 // RUN: | FileCheck %s -check-prefix=SIMD128
133 //
134 // SIMD128: #define __wasm_simd128__ 1{{$}}
135
136 // RUN: %clang -E -dM %s -o - 2>&1 \
137 // RUN: -target wasm32-unknown-unknown -mtail-call \
138 // RUN: | FileCheck %s -check-prefix=TAIL-CALL
139 // RUN: %clang -E -dM %s -o - 2>&1 \
140 // RUN: -target wasm64-unknown-unknown -mtail-call \
141 // RUN: | FileCheck %s -check-prefix=TAIL-CALL
142 //
143 // TAIL-CALL: #define __wasm_tail_call__ 1{{$}}
144
145 // RUN: %clang -E -dM %s -o - 2>&1 \
146 // RUN: -target wasm32-unknown-unknown -mcpu=mvp \
147 // RUN: | FileCheck %s -check-prefix=MVP
148 // RUN: %clang -E -dM %s -o - 2>&1 \
149 // RUN: -target wasm64-unknown-unknown -mcpu=mvp \
150 // RUN: | FileCheck %s -check-prefix=MVP
151 //
152 // MVP-NOT: #define __wasm_atomics__ 1{{$}}
153 // MVP-NOT: #define __wasm_bulk_memory__ 1{{$}}
154 // MVP-NOT: #define __wasm_exception_handling__ 1{{$}}
155 // MVP-NOT: #define __wasm_extended_const__ 1{{$}}
156 // MVP-NOT: #define __wasm_fp16__ 1{{$}}
157 // MVP-NOT: #define __wasm_gc__ 1{{$}}
158 // MVP-NOT: #define __wasm_multimemory__ 1{{$}}
159 // MVP-NOT: #define __wasm_multivalue__ 1{{$}}
160 // MVP-NOT: #define __wasm_mutable_globals__ 1{{$}}
161 // MVP-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}}
162 // MVP-NOT: #define __wasm_reference_types__ 1{{$}}
163 // MVP-NOT: #define __wasm_relaxed_simd__ 1{{$}}
164 // MVP-NOT: #define __wasm_sign_ext__ 1{{$}}
165 // MVP-NOT: #define __wasm_simd128__ 1{{$}}
166 // MVP-NOT: #define __wasm_tail_call__ 1{{$}}
167 // MVP-NOT: #define __wasm_wide_arithmetic__ 1{{$}}
168
169 // RUN: %clang -E -dM %s -o - 2>&1 \
170 // RUN: -target wasm32-unknown-unknown -mcpu=generic \
171 // RUN: | FileCheck %s -check-prefix=GENERIC-INCLUDE
172 // RUN: %clang -E -dM %s -o - 2>&1 \
173 // RUN: -target wasm64-unknown-unknown -mcpu=generic \
174 // RUN: | FileCheck %s -check-prefix=GENERIC-INCLUDE
175 //
176 // GENERIC-INCLUDE-DAG: #define __wasm_bulk_memory__ 1{{$}}
177 // GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
178 // GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}
179 // GENERIC-INCLUDE-DAG: #define __wasm_nontrapping_fptoint__ 1{{$}}
180 // GENERIC-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}}
181 // GENERIC-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}}
182 //
183 // RUN: %clang -E -dM %s -o - 2>&1 \
184 // RUN: -target wasm32-unknown-unknown -mcpu=generic \
185 // RUN: | FileCheck %s -check-prefix=GENERIC
186 // RUN: %clang -E -dM %s -o - 2>&1 \
187 // RUN: -target wasm64-unknown-unknown -mcpu=generic \
188 // RUN: | FileCheck %s -check-prefix=GENERIC
189 //
190 // GENERIC-NOT: #define __wasm_atomics__ 1{{$}}
191 // GENERIC-NOT: #define __wasm_exception_handling__ 1{{$}}
192 // GENERIC-NOT: #define __wasm_extended_const__ 1{{$}}
193 // GENERIC-NOT: #define __wasm__fp16__ 1{{$}}
194 // GENERIC-NOT: #define __wasm_gc__ 1{{$}}
195 // GENERIC-NOT: #define __wasm_multimemory__ 1{{$}}
196 // GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}}
197 // GENERIC-NOT: #define __wasm_simd128__ 1{{$}}
198 // GENERIC-NOT: #define __wasm_tail_call__ 1{{$}}
199 // GENERIC-NOT: #define __wasm_wide_arithmetic__ 1{{$}}
200
201 // RUN: %clang -E -dM %s -o - 2>&1 \
202 // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge \
203 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-INCLUDE
204 // RUN: %clang -E -dM %s -o - 2>&1 \
205 // RUN: -target wasm64-unknown-unknown -mcpu=bleeding-edge \
206 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-INCLUDE
207 //
208 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_atomics__ 1{{$}}
209 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_bulk_memory__ 1{{$}}
210 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_exception_handling__ 1{{$}}
211 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_extended_const__ 1{{$}}
212 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_fp16__ 1{{$}}
213 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_gc__ 1{{$}}
214 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multimemory__ 1{{$}}
215 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
216 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}
217 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_nontrapping_fptoint__ 1{{$}}
218 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}}
219 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_relaxed_simd__ 1{{$}}
220 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}}
221 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_simd128__ 1{{$}}
222 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_tail_call__ 1{{$}}
223 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_wide_arithmetic__ 1{{$}}
224
225 // RUN: %clang -E -dM %s -o - 2>&1 \
226 // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
227 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
228 // RUN: %clang -E -dM %s -o - 2>&1 \
229 // RUN: -target wasm64-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
230 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
231 //
232 // BLEEDING-EDGE-NO-SIMD128-NOT: #define __wasm_simd128__ 1{{$}}
233
234 // RUN: %clang -E -dM %s -o - 2>&1 \
235 // RUN: -target wasm32-unknown-unknown -mwide-arithmetic \
236 // RUN: | FileCheck %s -check-prefix=WIDE-ARITHMETIC
237 // RUN: %clang -E -dM %s -o - 2>&1 \
238 // RUN: -target wasm64-unknown-unknown -mwide-arithmetic \
239 // RUN: | FileCheck %s -check-prefix=WIDE-ARITHMETIC
240 //
241 // WIDE-ARITHMETIC: #define __wasm_wide_arithmetic__ 1{{$}}