xref: /llvm-project/clang/test/Driver/wasm-features.c (revision c2293b33ddc6c722178087d85b2b4312ea830d12)
1 // RUN: %clang --target=wasm32-unknown-unknown -### %s -fsyntax-only 2>&1 | FileCheck %s
2 
3 // CHECK: "-fvisibility=hidden"
4 
5 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mcpu=mvp 2>&1 | FileCheck %s -check-prefix=MVP
6 // RUN: %clang --target=wasm32-unknown-unknown -### %s 2>&1 | FileCheck %s -check-prefix=GENERIC
7 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mcpu=generic 2>&1 | FileCheck %s -check-prefix=GENERIC
8 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mcpu=bleeding-edge 2>&1 | FileCheck %s -check-prefix=BLEEDING-EDGE
9 
10 // MVP: "-target-cpu" "mvp"
11 // GENERIC: "-target-cpu" "generic"
12 // BLEEDING-EDGE: "-target-cpu" "bleeding-edge"
13 
14 // RUN: %clang --target=wasm32-unknown-unknown -### %s -matomics 2>&1 | FileCheck %s -check-prefix=ATOMICS
15 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-atomics 2>&1 | FileCheck %s -check-prefix=NO-ATOMICS
16 
17 // ATOMICS: "-target-feature" "+atomics"
18 // NO-ATOMICS: "-target-feature" "-atomics"
19 
20 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mbulk-memory 2>&1 | FileCheck %s -check-prefix=BULK-MEMORY
21 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-bulk-memory 2>&1 | FileCheck %s -check-prefix=NO-BULK-MEMORY
22 
23 // BULK-MEMORY: "-target-feature" "+bulk-memory"
24 // NO-BULK-MEMORY: "-target-feature" "-bulk-memory"
25 
26 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mexception-handling 2>&1 | FileCheck %s -check-prefix=EXCEPTION-HANDLING
27 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-exception-handling 2>&1 | FileCheck %s -check-prefix=NO-EXCEPTION-HANDLING
28 
29 // EXCEPTION-HANDLING: "-target-feature" "+exception-handling"
30 // NO-EXCEPTION-HANDLING: "-target-feature" "-exception-handling"
31 
32 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mextended-const 2>&1 | FileCheck %s -check-prefix=EXTENDED-CONST
33 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-extended-const 2>&1 | FileCheck %s -check-prefix=NO-EXTENDED-CONST
34 
35 // EXTENDED-CONST: "-target-feature" "+extended-const"
36 // NO-EXTENDED-CONST: "-target-feature" "-extended-const"
37 
38 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mfp16 2>&1 | FileCheck %s -check-prefix=HALF-PRECISION
39 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-fp16 2>&1 | FileCheck %s -check-prefix=NO-HALF-PRECISION
40 
41 // HALF-PRECISION: "-target-feature" "+fp16"
42 // NO-HALF-PRECISION: "-target-feature" "-fp16"
43 
44 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultimemory 2>&1 | FileCheck %s -check-prefix=MULTIMEMORY
45 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multimemory 2>&1 | FileCheck %s -check-prefix=NO-MULTIMEMORY
46 
47 // MULTIMEMORY: "-target-feature" "+multimemory"
48 // NO-MULTIMEMORY: "-target-feature" "-multimemory"
49 
50 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultivalue 2>&1 | FileCheck %s -check-prefix=MULTIVALUE
51 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multivalue 2>&1 | FileCheck %s -check-prefix=NO-MULTIVALUE
52 
53 // MULTIVALUE: "-target-feature" "+multivalue"
54 // NO-MULTIVALUE: "-target-feature" "-multivalue"
55 
56 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mmutable-globals 2>&1 | FileCheck %s -check-prefix=MUTABLE-GLOBALS
57 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-mutable-globals 2>&1 | FileCheck %s -check-prefix=NO-MUTABLE-GLOBALS
58 
59 // MUTABLE-GLOBALS: "-target-feature" "+mutable-globals"
60 // NO-MUTABLE-GLOBALS: "-target-feature" "-mutable-globals"
61 
62 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mnontrapping-fptoint 2>&1 | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
63 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-nontrapping-fptoint 2>&1 | FileCheck %s -check-prefix=NO-NONTRAPPING-FPTOINT
64 
65 // NONTRAPPING-FPTOINT: "-target-feature" "+nontrapping-fptoint"
66 // NO-NONTRAPPING-FPTOINT: "-target-feature" "-nontrapping-fptoint"
67 
68 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mreference-types 2>&1 | FileCheck %s -check-prefix=REFERENCE-TYPES
69 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-reference-types 2>&1 | FileCheck %s -check-prefix=NO-REFERENCE-TYPES
70 
71 // REFERENCE-TYPES: "-target-feature" "+reference-types"
72 // NO-REFERENCE-TYPES: "-target-feature" "-reference-types"
73 
74 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mrelaxed-simd 2>&1 | FileCheck %s -check-prefix=RELAXED-SIMD
75 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-relaxed-simd 2>&1 | FileCheck %s -check-prefix=NO-RELAXED-SIMD
76 
77 // RELAXED-SIMD: "-target-feature" "+relaxed-simd"
78 // NO-RELAXED-SIMD: "-target-feature" "-relaxed-simd"
79 
80 // RUN: %clang --target=wasm32-unknown-unknown -### %s -msign-ext 2>&1 | FileCheck %s -check-prefix=SIGN-EXT
81 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-sign-ext 2>&1 | FileCheck %s -check-prefix=NO-SIGN-EXT
82 
83 // SIGN-EXT: "-target-feature" "+sign-ext"
84 // NO-SIGN-EXT: "-target-feature" "-sign-ext"
85 
86 // RUN: %clang --target=wasm32-unknown-unknown -### %s -msimd128 2>&1 | FileCheck %s -check-prefix=SIMD128
87 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-simd128 2>&1 | FileCheck %s -check-prefix=NO-SIMD128
88 
89 // SIMD128: "-target-feature" "+simd128"
90 // NO-SIMD128: "-target-feature" "-simd128"
91 
92 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mtail-call 2>&1 | FileCheck %s -check-prefix=TAIL-CALL
93 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-tail-call 2>&1 | FileCheck %s -check-prefix=NO-TAIL-CALL
94 
95 // TAIL-CALL: "-target-feature" "+tail-call"
96 // NO-TAIL-CALL: "-target-feature" "-tail-call"
97 
98 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mwide-arithmetic 2>&1 | FileCheck %s -check-prefix=WIDE-ARITH
99 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-wide-arithmetic 2>&1 | FileCheck %s -check-prefix=NO-WIDE-ARITH
100 
101 // WIDE-ARITH: "-target-feature" "+wide-arithmetic"
102 // NO-WIDE-ARITH: "-target-feature" "-wide-arithmetic"
103