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 -mhalf-precision \
48 // RUN: | FileCheck %s -check-prefix=HALF-PRECISION
49 // RUN: %clang -E -dM %s -o - 2>&1 \
50 // RUN: -target wasm64-unknown-unknown -mhalf-precision \
51 // RUN: | FileCheck %s -check-prefix=HALF-PRECISION
52 //
53 // HALF-PRECISION: #define __wasm_half_precision__ 1{{$}}
54
55 // RUN: %clang -E -dM %s -o - 2>&1 \
56 // RUN: -target wasm32-unknown-unknown -mmultimemory \
57 // RUN: | FileCheck %s -check-prefix=MULTIMEMORY
58 // RUN: %clang -E -dM %s -o - 2>&1 \
59 // RUN: -target wasm64-unknown-unknown -mmultimemory \
60 // RUN: | FileCheck %s -check-prefix=MULTIMEMORY
61 //
62 // MULTIMEMORY: #define __wasm_multimemory__ 1{{$}}
63
64 // RUN: %clang -E -dM %s -o - 2>&1 \
65 // RUN: -target wasm32-unknown-unknown -mmultivalue \
66 // RUN: | FileCheck %s -check-prefix=MULTIVALUE
67 // RUN: %clang -E -dM %s -o - 2>&1 \
68 // RUN: -target wasm64-unknown-unknown -mmultivalue \
69 // RUN: | FileCheck %s -check-prefix=MULTIVALUE
70 //
71 // MULTIVALUE: #define __wasm_multivalue__ 1{{$}}
72
73 // RUN: %clang -E -dM %s -o - 2>&1 \
74 // RUN: -target wasm32-unknown-unknown -mmutable-globals \
75 // RUN: | FileCheck %s -check-prefix=MUTABLE-GLOBALS
76 // RUN: %clang -E -dM %s -o - 2>&1 \
77 // RUN: -target wasm64-unknown-unknown -mmutable-globals \
78 // RUN: | FileCheck %s -check-prefix=MUTABLE-GLOBALS
79 //
80 // MUTABLE-GLOBALS: #define __wasm_mutable_globals__ 1{{$}}
81
82 // RUN: %clang -E -dM %s -o - 2>&1 \
83 // RUN: -target wasm32-unknown-unknown -mnontrapping-fptoint \
84 // RUN: | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
85 // RUN: %clang -E -dM %s -o - 2>&1 \
86 // RUN: -target wasm64-unknown-unknown -mnontrapping-fptoint \
87 // RUN: | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
88 //
89 // NONTRAPPING-FPTOINT: #define __wasm_nontrapping_fptoint__ 1{{$}}
90
91 // RUN: %clang -E -dM %s -o - 2>&1 \
92 // RUN: -target wasm32-unknown-unknown -mreference-types \
93 // RUN: | FileCheck %s -check-prefix=REFERENCE-TYPES
94 // RUN: %clang -E -dM %s -o - 2>&1 \
95 // RUN: -target wasm64-unknown-unknown -mreference-types \
96 // RUN: | FileCheck %s -check-prefix=REFERENCE-TYPES
97 //
98 // REFERENCE-TYPES: #define __wasm_reference_types__ 1{{$}}
99
100 // RUN: %clang -E -dM %s -o - 2>&1 \
101 // RUN: -target wasm32-unknown-unknown -mrelaxed-simd \
102 // RUN: | FileCheck %s -check-prefix=RELAXED-SIMD
103 // RUN: %clang -E -dM %s -o - 2>&1 \
104 // RUN: -target wasm64-unknown-unknown -mrelaxed-simd \
105 // RUN: | FileCheck %s -check-prefix=RELAXED-SIMD
106 //
107 // RELAXED-SIMD: #define __wasm_relaxed_simd__ 1{{$}}
108
109 // RUN: %clang -E -dM %s -o - 2>&1 \
110 // RUN: -target wasm32-unknown-unknown -msign-ext \
111 // RUN: | FileCheck %s -check-prefix=SIGN-EXT
112 // RUN: %clang -E -dM %s -o - 2>&1 \
113 // RUN: -target wasm64-unknown-unknown -msign-ext \
114 // RUN: | FileCheck %s -check-prefix=SIGN-EXT
115 //
116 // SIGN-EXT: #define __wasm_sign_ext__ 1{{$}}
117
118 // RUN: %clang -E -dM %s -o - 2>&1 \
119 // RUN: -target wasm32-unknown-unknown -msimd128 \
120 // RUN: | FileCheck %s -check-prefix=SIMD128
121 // RUN: %clang -E -dM %s -o - 2>&1 \
122 // RUN: -target wasm64-unknown-unknown -msimd128 \
123 // RUN: | FileCheck %s -check-prefix=SIMD128
124 //
125 // SIMD128: #define __wasm_simd128__ 1{{$}}
126
127 // RUN: %clang -E -dM %s -o - 2>&1 \
128 // RUN: -target wasm32-unknown-unknown -mtail-call \
129 // RUN: | FileCheck %s -check-prefix=TAIL-CALL
130 // RUN: %clang -E -dM %s -o - 2>&1 \
131 // RUN: -target wasm64-unknown-unknown -mtail-call \
132 // RUN: | FileCheck %s -check-prefix=TAIL-CALL
133 //
134 // TAIL-CALL: #define __wasm_tail_call__ 1{{$}}
135
136 // RUN: %clang -E -dM %s -o - 2>&1 \
137 // RUN: -target wasm32-unknown-unknown -mcpu=mvp \
138 // RUN: | FileCheck %s -check-prefix=MVP
139 // RUN: %clang -E -dM %s -o - 2>&1 \
140 // RUN: -target wasm64-unknown-unknown -mcpu=mvp \
141 // RUN: | FileCheck %s -check-prefix=MVP
142 //
143 // MVP-NOT: #define __wasm_atomics__ 1{{$}}
144 // MVP-NOT: #define __wasm_bulk_memory__ 1{{$}}
145 // MVP-NOT: #define __wasm_exception_handling__ 1{{$}}
146 // MVP-NOT: #define __wasm_extended_const__ 1{{$}}
147 // MVP-NOT: #define __wasm_half_precision__ 1{{$}}
148 // MVP-NOT: #define __wasm_multimemory__ 1{{$}}
149 // MVP-NOT: #define __wasm_multivalue__ 1{{$}}
150 // MVP-NOT: #define __wasm_mutable_globals__ 1{{$}}
151 // MVP-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}}
152 // MVP-NOT: #define __wasm_reference_types__ 1{{$}}
153 // MVP-NOT: #define __wasm_relaxed_simd__ 1{{$}}
154 // MVP-NOT: #define __wasm_sign_ext__ 1{{$}}
155 // MVP-NOT: #define __wasm_simd128__ 1{{$}}
156 // MVP-NOT: #define __wasm_tail_call__ 1{{$}}
157
158 // RUN: %clang -E -dM %s -o - 2>&1 \
159 // RUN: -target wasm32-unknown-unknown -mcpu=generic \
160 // RUN: | FileCheck %s -check-prefix=GENERIC-INCLUDE
161 // RUN: %clang -E -dM %s -o - 2>&1 \
162 // RUN: -target wasm64-unknown-unknown -mcpu=generic \
163 // RUN: | FileCheck %s -check-prefix=GENERIC-INCLUDE
164 //
165 // GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
166 // GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}
167 // GENERIC-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}}
168 // GENERIC-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}}
169 //
170 // RUN: %clang -E -dM %s -o - 2>&1 \
171 // RUN: -target wasm32-unknown-unknown -mcpu=generic \
172 // RUN: | FileCheck %s -check-prefix=GENERIC
173 // RUN: %clang -E -dM %s -o - 2>&1 \
174 // RUN: -target wasm64-unknown-unknown -mcpu=generic \
175 // RUN: | FileCheck %s -check-prefix=GENERIC
176 //
177 // GENERIC-NOT: #define __wasm_atomics__ 1{{$}}
178 // GENERIC-NOT: #define __wasm_bulk_memory__ 1{{$}}
179 // GENERIC-NOT: #define __wasm_exception_handling__ 1{{$}}
180 // GENERIC-NOT: #define __wasm_extended_const__ 1{{$}}
181 // GENERIC-NOT: #define __wasm_half_precision__ 1{{$}}
182 // GENERIC-NOT: #define __wasm_multimemory__ 1{{$}}
183 // GENERIC-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}}
184 // GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}}
185 // GENERIC-NOT: #define __wasm_simd128__ 1{{$}}
186 // GENERIC-NOT: #define __wasm_tail_call__ 1{{$}}
187
188 // RUN: %clang -E -dM %s -o - 2>&1 \
189 // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge \
190 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-INCLUDE
191 // RUN: %clang -E -dM %s -o - 2>&1 \
192 // RUN: -target wasm64-unknown-unknown -mcpu=bleeding-edge \
193 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-INCLUDE
194 //
195 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_atomics__ 1{{$}}
196 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_bulk_memory__ 1{{$}}
197 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_exception_handling__ 1{{$}}
198 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_extended_const__ 1{{$}}
199 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_half_precision__ 1{{$}}
200 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multimemory__ 1{{$}}
201 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
202 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}
203 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_nontrapping_fptoint__ 1{{$}}
204 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}}
205 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_relaxed_simd__ 1{{$}}
206 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}}
207 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_simd128__ 1{{$}}
208 // BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_tail_call__ 1{{$}}
209
210 // RUN: %clang -E -dM %s -o - 2>&1 \
211 // RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
212 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
213 // RUN: %clang -E -dM %s -o - 2>&1 \
214 // RUN: -target wasm64-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
215 // RUN: | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
216 //
217 // BLEEDING-EDGE-NO-SIMD128-NOT: #define __wasm_simd128__ 1{{$}}