1 // RUN: %clang -E -dM %s -o - 2>&1 \
2 // RUN:     -target wasm32-unknown-unknown -msimd128 \
3 // RUN:   | FileCheck %s -check-prefix=SIMD128
4 // RUN: %clang -E -dM %s -o - 2>&1 \
5 // RUN:     -target wasm64-unknown-unknown -msimd128 \
6 // RUN:   | FileCheck %s -check-prefix=SIMD128
7 //
8 // SIMD128:#define __wasm_simd128__ 1{{$}}
9 
10 // RUN: %clang -E -dM %s -o - 2>&1 \
11 // RUN:     -target wasm32-unknown-unknown -mnontrapping-fptoint \
12 // RUN:   | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
13 // RUN: %clang -E -dM %s -o - 2>&1 \
14 // RUN:     -target wasm64-unknown-unknown -mnontrapping-fptoint \
15 // RUN:   | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
16 //
17 // NONTRAPPING-FPTOINT:#define __wasm_nontrapping_fptoint__ 1{{$}}
18 
19 // RUN: %clang -E -dM %s -o - 2>&1 \
20 // RUN:     -target wasm32-unknown-unknown -msign-ext \
21 // RUN:   | FileCheck %s -check-prefix=SIGN-EXT
22 // RUN: %clang -E -dM %s -o - 2>&1 \
23 // RUN:     -target wasm64-unknown-unknown -msign-ext \
24 // RUN:   | FileCheck %s -check-prefix=SIGN-EXT
25 //
26 // SIGN-EXT:#define __wasm_sign_ext__ 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 -mbulk-memory \
39 // RUN:   | FileCheck %s -check-prefix=BULK-MEMORY
40 // RUN: %clang -E -dM %s -o - 2>&1 \
41 // RUN:     -target wasm64-unknown-unknown -mbulk-memory \
42 // RUN:   | FileCheck %s -check-prefix=BULK-MEMORY
43 //
44 // BULK-MEMORY:#define __wasm_bulk_memory__ 1{{$}}
45 
46 // RUN: %clang -E -dM %s -o - 2>&1 \
47 // RUN:     -target wasm32-unknown-unknown -matomics \
48 // RUN:   | FileCheck %s -check-prefix=ATOMICS
49 // RUN: %clang -E -dM %s -o - 2>&1 \
50 // RUN:     -target wasm64-unknown-unknown -matomics \
51 // RUN:   | FileCheck %s -check-prefix=ATOMICS
52 //
53 // ATOMICS:#define __wasm_atomics__ 1{{$}}
54 
55 // RUN: %clang -E -dM %s -o - 2>&1 \
56 // RUN:     -target wasm32-unknown-unknown -pthread \
57 // RUN:   | FileCheck %s -check-prefix=PTHREAD
58 // RUN: %clang -E -dM %s -o - 2>&1 \
59 // RUN:     -target wasm64-unknown-unknown -pthread \
60 // RUN:   | FileCheck %s -check-prefix=PTHREAD
61 //
62 // PTHREAD:#define __wasm_atomics__ 1{{$}}
63 
64 // RUN: %clang -E -dM %s -o - 2>&1 \
65 // RUN:     -target wasm32-unknown-unknown -mmutable-globals \
66 // RUN:   | FileCheck %s -check-prefix=MUTABLE-GLOBALS
67 // RUN: %clang -E -dM %s -o - 2>&1 \
68 // RUN:     -target wasm64-unknown-unknown -mmutable-globals \
69 // RUN:   | FileCheck %s -check-prefix=MUTABLE-GLOBALS
70 //
71 // MUTABLE-GLOBALS:#define __wasm_mutable_globals__ 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 -mtail-call \
84 // RUN:   | FileCheck %s -check-prefix=TAIL-CALL
85 // RUN: %clang -E -dM %s -o - 2>&1 \
86 // RUN:     -target wasm64-unknown-unknown -mtail-call \
87 // RUN:   | FileCheck %s -check-prefix=TAIL-CALL
88 //
89 // TAIL-CALL:#define __wasm_tail_call__ 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 -mcpu=mvp \
102 // RUN:   | FileCheck %s -check-prefix=MVP
103 // RUN: %clang -E -dM %s -o - 2>&1 \
104 // RUN:     -target wasm64-unknown-unknown -mcpu=mvp \
105 // RUN:   | FileCheck %s -check-prefix=MVP
106 //
107 // MVP-NOT:#define __wasm_simd128__
108 // MVP-NOT:#define __wasm_nontrapping_fptoint__
109 // MVP-NOT:#define __wasm_sign_ext__
110 // MVP-NOT:#define __wasm_exception_handling__
111 // MVP-NOT:#define __wasm_bulk_memory__
112 // MVP-NOT:#define __wasm_atomics__
113 // MVP-NOT:#define __wasm_mutable_globals__
114 // MVP-NOT:#define __wasm_multivalue__
115 // MVP-NOT:#define __wasm_tail_call__
116 // MVP-NOT:#define __wasm_reference_types__
117 
118 // RUN: %clang -E -dM %s -o - 2>&1 \
119 // RUN:     -target wasm32-unknown-unknown -mcpu=bleeding-edge \
120 // RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE
121 // RUN: %clang -E -dM %s -o - 2>&1 \
122 // RUN:     -target wasm64-unknown-unknown -mcpu=bleeding-edge \
123 // RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE
124 //
125 // BLEEDING-EDGE-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}}
126 // BLEEDING-EDGE-DAG:#define __wasm_sign_ext__ 1{{$}}
127 // BLEEDING-EDGE-DAG:#define __wasm_bulk_memory__ 1{{$}}
128 // BLEEDING-EDGE-DAG:#define __wasm_simd128__ 1{{$}}
129 // BLEEDING-EDGE-DAG:#define __wasm_atomics__ 1{{$}}
130 // BLEEDING-EDGE-DAG:#define __wasm_mutable_globals__ 1{{$}}
131 // BLEEDING-EDGE-DAG:#define __wasm_tail_call__ 1{{$}}
132 // BLEEDING-EDGE-NOT:#define __wasm_unimplemented_simd128__ 1{{$}}
133 // BLEEDING-EDGE-NOT:#define __wasm_exception_handling__ 1{{$}}
134 // BLEEDING-EDGE-NOT:#define __wasm_multivalue__ 1{{$}}
135 // BLEEDING-EDGE-NOT:#define __wasm_reference_types__ 1{{$}}
136 
137 // RUN: %clang -E -dM %s -o - 2>&1 \
138 // RUN:     -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
139 // RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
140 // RUN: %clang -E -dM %s -o - 2>&1 \
141 // RUN:     -target wasm64-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
142 // RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
143 //
144 // BLEEDING-EDGE-NO-SIMD128-NOT:#define __wasm_simd128__
145