Clang Project

clang_source_code/test/Preprocessor/wasm-target-features.c
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 -munimplemented-simd128 \
12// RUN:   | FileCheck %s -check-prefix=SIMD128-UNIMPLEMENTED
13// RUN: %clang -E -dM %s -o - 2>&1 \
14// RUN:     -target wasm64-unknown-unknown -munimplemented-simd128 \
15// RUN:   | FileCheck %s -check-prefix=SIMD128-UNIMPLEMENTED
16//
17// SIMD128-UNIMPLEMENTED:#define __wasm_unimplemented_simd128__ 1{{$}}
18
19// RUN: %clang -E -dM %s -o - 2>&1 \
20// RUN:     -target wasm32-unknown-unknown -mnontrapping-fptoint \
21// RUN:   | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
22// RUN: %clang -E -dM %s -o - 2>&1 \
23// RUN:     -target wasm64-unknown-unknown -mnontrapping-fptoint \
24// RUN:   | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
25//
26// NONTRAPPING-FPTOINT:#define __wasm_nontrapping_fptoint__ 1{{$}}
27
28// RUN: %clang -E -dM %s -o - 2>&1 \
29// RUN:     -target wasm32-unknown-unknown -msign-ext \
30// RUN:   | FileCheck %s -check-prefix=SIGN-EXT
31// RUN: %clang -E -dM %s -o - 2>&1 \
32// RUN:     -target wasm64-unknown-unknown -msign-ext \
33// RUN:   | FileCheck %s -check-prefix=SIGN-EXT
34//
35// SIGN-EXT:#define __wasm_sign_ext__ 1{{$}}
36
37// RUN: %clang -E -dM %s -o - 2>&1 \
38// RUN:     -target wasm32-unknown-unknown -mexception-handling \
39// RUN:   | FileCheck %s -check-prefix=EXCEPTION-HANDLING
40// RUN: %clang -E -dM %s -o - 2>&1 \
41// RUN:     -target wasm64-unknown-unknown -mexception-handling \
42// RUN:   | FileCheck %s -check-prefix=EXCEPTION-HANDLING
43//
44// EXCEPTION-HANDLING:#define __wasm_exception_handling__ 1{{$}}
45
46// RUN: %clang -E -dM %s -o - 2>&1 \
47// RUN:     -target wasm32-unknown-unknown -mbulk-memory \
48// RUN:   | FileCheck %s -check-prefix=BULK-MEMORY
49// RUN: %clang -E -dM %s -o - 2>&1 \
50// RUN:     -target wasm64-unknown-unknown -mbulk-memory \
51// RUN:   | FileCheck %s -check-prefix=BULK-MEMORY
52//
53// BULK-MEMORY:#define __wasm_bulk_memory__ 1{{$}}
54
55// RUN: %clang -E -dM %s -o - 2>&1 \
56// RUN:     -target wasm32-unknown-unknown -matomics \
57// RUN:   | FileCheck %s -check-prefix=ATOMICS
58// RUN: %clang -E -dM %s -o - 2>&1 \
59// RUN:     -target wasm64-unknown-unknown -matomics \
60// RUN:   | FileCheck %s -check-prefix=ATOMICS
61//
62// ATOMICS:#define __wasm_atomics__ 1{{$}}
63
64// RUN: %clang -E -dM %s -o - 2>&1 \
65// RUN:     -target wasm32-unknown-unknown -pthread \
66// RUN:   | FileCheck %s -check-prefix=PTHREAD
67// RUN: %clang -E -dM %s -o - 2>&1 \
68// RUN:     -target wasm64-unknown-unknown -pthread \
69// RUN:   | FileCheck %s -check-prefix=PTHREAD
70//
71// PTHREAD:#define __wasm_atomics__ 1{{$}}
72
73// RUN: %clang -E -dM %s -o - 2>&1 \
74// RUN:     -target wasm32-unknown-unknown -mcpu=mvp \
75// RUN:   | FileCheck %s -check-prefix=MVP
76// RUN: %clang -E -dM %s -o - 2>&1 \
77// RUN:     -target wasm64-unknown-unknown -mcpu=mvp \
78// RUN:   | FileCheck %s -check-prefix=MVP
79//
80// MVP-NOT:#define __wasm_simd128__
81// MVP-NOT:#define __wasm_unimplemented_simd128__
82// MVP-NOT:#define __wasm_nontrapping_fptoint__
83// MVP-NOT:#define __wasm_sign_ext__
84// MVP-NOT:#define __wasm_exception_handling__
85// MVP-NOT:#define __wasm_bulk_memory__
86// MVP-NOT:#define __wasm_atomics__
87
88// RUN: %clang -E -dM %s -o - 2>&1 \
89// RUN:     -target wasm32-unknown-unknown -mcpu=bleeding-edge \
90// RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE
91// RUN: %clang -E -dM %s -o - 2>&1 \
92// RUN:     -target wasm64-unknown-unknown -mcpu=bleeding-edge \
93// RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE
94//
95// BLEEDING-EDGE-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}}
96// BLEEDING-EDGE-DAG:#define __wasm_sign_ext__ 1{{$}}
97// BLEEDING-EDGE-DAG:#define __wasm_simd128__ 1{{$}}
98// BLEEDING-EDGE-DAG:#define __wasm_atomics__ 1{{$}}
99// BLEEDING-EDGE-NOT:#define __wasm_unimplemented_simd128__ 1{{$}}
100
101// RUN: %clang -E -dM %s -o - 2>&1 \
102// RUN:     -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
103// RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
104// RUN: %clang -E -dM %s -o - 2>&1 \
105// RUN:     -target wasm64-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
106// RUN:   | FileCheck %s -check-prefix=BLEEDING-EDGE-NO-SIMD128
107//
108// BLEEDING-EDGE-NO-SIMD128-NOT:#define __wasm_simd128__
109