Skip to content

Commit 897297e

Browse files
authored
[WebAssembly] Fix CPU tests in wasm-features.c (#80900)
The CPU tests in this file are not working as intended. Specifying `-mcpu=[mvp|generic|bleeding-edge]` in `clang` command line does NOT add arguments like `-target-feature`, `+feature-name`, ... to `clang-14` command line. Specifying `-mcpu=[mvp|generic|bleeding-edge]` in `clang` command line will just add `-target-cpu` `[mvp|generic|bleeding-edge]` to `clang-14` command line, and individual features are added here within `clang-14` invocation: https://github.com/llvm/llvm-project/blob/5b780c8c6c558ec283a9eec485a4f172df0f9fe1/clang/lib/Basic/Targets/WebAssembly.cpp#L150-L163 The reason these CPU tests are passing is because they only have `-NOT` checks, and we don't emit `-target-feature` arguments for them anyway, the test passes, but they don't check what they are supposed to check. This make CPU tests only check `-target-cpu` lines instead of individual features, which will not be emitted.
1 parent 4476727 commit 897297e

File tree

1 file changed

+6
-48
lines changed

1 file changed

+6
-48
lines changed

clang/test/Driver/wasm-features.c

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,131 +2,89 @@
22

33
// CHECK: "-fvisibility=hidden"
44

5-
// RUN: %clang --target=wasm32-unknown-unknown -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
65
// 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
78
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mcpu=bleeding-edge 2>&1 | FileCheck %s -check-prefix=BLEEDING-EDGE
89

10+
// MVP: "-target-cpu" "mvp"
11+
// GENERIC: "-target-cpu" "generic"
12+
// BLEEDING-EDGE: "-target-cpu" "bleeding-edge"
13+
914
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mbulk-memory 2>&1 | FileCheck %s -check-prefix=BULK-MEMORY
1015
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-bulk-memory 2>&1 | FileCheck %s -check-prefix=NO-BULK-MEMORY
1116

1217
// BULK-MEMORY: "-target-feature" "+bulk-memory"
1318
// NO-BULK-MEMORY: "-target-feature" "-bulk-memory"
14-
// DEFAULT-NOT: "-target-feature" "-bulk-memory"
15-
// MVP-NOT: "-target-feature" "+bulk-memory"
16-
// BLEEDING-EDGE-NOT: "-target-feature" "-bulk-memory"
1719

1820
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mmutable-globals 2>&1 | FileCheck %s -check-prefix=MUTABLE-GLOBALS
1921
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-mutable-globals 2>&1 | FileCheck %s -check-prefix=NO-MUTABLE-GLOBALS
2022

2123
// MUTABLE-GLOBALS: "-target-feature" "+mutable-globals"
2224
// NO-MUTABLE-GLOBALS: "-target-feature" "-mutable-globals"
23-
// DEFAULT-NOT: "-target-feature" "-mutable-globals"
24-
// MVP-NOT: "-target-feature" "+mutable-globals"
25-
// BLEEDING-EDGE-NOT: "-target-feature" "-mutable-globals"
2625

2726
// RUN: %clang --target=wasm32-unknown-unknown -### %s -msign-ext 2>&1 | FileCheck %s -check-prefix=SIGN-EXT
2827
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-sign-ext 2>&1 | FileCheck %s -check-prefix=NO-SIGN-EXT
2928

3029
// SIGN-EXT: "-target-feature" "+sign-ext"
3130
// NO-SIGN-EXT: "-target-feature" "-sign-ext"
32-
// DEFAULT-NOT: "-target-feature" "-sign-ext"
33-
// MVP-NOT: "-target-feature" "+sign-ext"
34-
// BLEEDING-EDGE-NOT: "-target-feature" "-sign-ext"
3531

3632
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mnontrapping-fptoint 2>&1 | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
3733
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-nontrapping-fptoint 2>&1 | FileCheck %s -check-prefix=NO-NONTRAPPING-FPTOINT
3834

3935
// NONTRAPPING-FPTOINT: "-target-feature" "+nontrapping-fptoint"
4036
// NO-NONTRAPPING-FPTOINT: "-target-feature" "-nontrapping-fptoint"
41-
// DEFAULT-NOT: "-target-feature" "-nontrapping-fptoint"
42-
// MVP-NOT: "-target-feature" "+nontrapping-fptoint"
43-
// BLEEDING-EDGE-NOT: "-target-feature" "-nontrapping-fptoint"
4437

4538
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultivalue 2>&1 | FileCheck %s -check-prefix=MULTIVALUE
4639
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multivalue 2>&1 | FileCheck %s -check-prefix=NO-MULTIVALUE
4740

4841
// MULTIVALUE: "-target-feature" "+multivalue"
4942
// NO-MULTIVALUE: "-target-feature" "-multivalue"
50-
// DEFAULT-NOT: "-target-feature" "-multivalue"
51-
// MVP-NOT: "-target-feature" "+multivalue"
52-
// GENERIC-NOT: "-target-feature" "+multivalue"
53-
// BLEEDING-EDGE-NOT: "-target-feature" "-multivalue"
5443

5544
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultimemory 2>&1 | FileCheck %s -check-prefix=MULTIMEMORY
5645
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multimemory 2>&1 | FileCheck %s -check-prefix=NO-MULTIMEMORY
5746

5847
// MULTIMEMORY: "-target-feature" "+multimemory"
5948
// NO-MULTIMEMORY: "-target-feature" "-multimemory"
60-
// DEFAULT-NOT: "-target-feature" "-multimemory"
61-
// MVP-NOT: "-target-feature" "+multimemory"
62-
// BLEEDING-EDGE-NOT: "-target-feature" "-multimemory"
6349

6450
// RUN: %clang --target=wasm32-unknown-unknown -### %s -matomics 2>&1 | FileCheck %s -check-prefix=ATOMICS
6551
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-atomics 2>&1 | FileCheck %s -check-prefix=NO-ATOMICS
6652

6753
// ATOMICS: "-target-feature" "+atomics"
6854
// NO-ATOMICS: "-target-feature" "-atomics"
69-
// DEFAULT-NOT: "-target-feature" "-atomics"
70-
// MVP-NOT: "-target-feature" "+atomics"
71-
// GENERIC-NOT: "-target-feature" "+atomics"
72-
// BLEEDING-EDGE-NOT: "-target-feature" "-atomics"
7355

7456
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mtail-call 2>&1 | FileCheck %s -check-prefix=TAIL-CALL
7557
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-tail-call 2>&1 | FileCheck %s -check-prefix=NO-TAIL-CALL
7658

7759
// TAIL-CALL: "-target-feature" "+tail-call"
7860
// NO-TAIL-CALL: "-target-feature" "-tail-call"
79-
// DEFAULT-NOT: "-target-feature" "-tail-call"
80-
// MVP-NOT: "-target-feature" "+tail-call"
81-
// GENERIC-NOT: "-target-feature" "+tail-call"
82-
// BLEEDING-EDGE-NOT: "-target-feature" "-tail-call"
8361

8462
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mreference-types 2>&1 | FileCheck %s -check-prefix=REFERENCE-TYPES
8563
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-reference-types 2>&1 | FileCheck %s -check-prefix=NO-REFERENCE-TYPES
8664

8765
// REFERENCE-TYPES: "-target-feature" "+reference-types"
8866
// NO-REFERENCE-TYPES: "-target-feature" "-reference-types"
89-
// DEFAULT-NOT: "-target-feature" "-reference-types"
90-
// MVP-NOT: "-target-feature" "+reference-types"
91-
// GENERIC-NOT: "-target-feature" "+reference-types"
92-
// BLEEDING-EDGE-NOT: "-target-feature" "-reference-types"
9367

9468
// RUN: %clang --target=wasm32-unknown-unknown -### %s -msimd128 2>&1 | FileCheck %s -check-prefix=SIMD128
9569
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-simd128 2>&1 | FileCheck %s -check-prefix=NO-SIMD128
9670

9771
// SIMD128: "-target-feature" "+simd128"
9872
// NO-SIMD128: "-target-feature" "-simd128"
99-
// DEFAULT-NOT: "-target-feature" "-simd128"
100-
// MVP-NOT: "-target-feature" "+simd128"
101-
// GENERIC-NOT: "-target-feature" "+simd128"
102-
// BLEEDING-EDGE-NOT: "-target-feature" "+simd128"
10373

10474
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mrelaxed-simd 2>&1 | FileCheck %s -check-prefix=RELAXED-SIMD
10575
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-relaxed-simd 2>&1 | FileCheck %s -check-prefix=NO-RELAXED-SIMD
10676

10777
// RELAXED-SIMD: "-target-feature" "+relaxed-simd"
10878
// NO-RELAXED-SIMD: "-target-feature" "-relaxed-simd"
109-
// DEFAULT-NOT: "-target-feature" "-relaxed-simd"
110-
// MVP-NOT: "-target-feature" "+relaxed-simd"
111-
// GENERIC-NOT: "-target-feature" "+relaxed-simd"
112-
// BLEEDING-EDGE-NOT: "-target-feature" "+relaxed-simd"
11379

11480
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mexception-handling 2>&1 | FileCheck %s -check-prefix=EXCEPTION-HANDLING
11581
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-exception-handling 2>&1 | FileCheck %s -check-prefix=NO-EXCEPTION-HANDLING
11682

11783
// EXCEPTION-HANDLING: "-target-feature" "+exception-handling"
11884
// NO-EXCEPTION-HANDLING: "-target-feature" "-exception-handling"
119-
// DEFAULT-NOT: "-target-feature" "-exception-handling"
120-
// MVP-NOT: "-target-feature" "+exception-handling"
121-
// GENERIC-NOT: "-target-feature" "+exception-handling"
122-
// BLEEDING-EDGE-NOT: "-target-feature" "+exception-handling"
12385

12486
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mextended-const 2>&1 | FileCheck %s -check-prefix=EXTENDED-CONST
12587
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-extended-const 2>&1 | FileCheck %s -check-prefix=NO-EXTENDED-CONST
12688

12789
// EXTENDED-CONST: "-target-feature" "+extended-const"
12890
// NO-EXTENDED-CONST: "-target-feature" "-extended-const"
129-
// DEFAULT-NOT: "-target-feature" "-extended-const"
130-
// MVP-NOT: "-target-feature" "+extended-const"
131-
// GENERIC-NOT: "-target-feature" "+extended-const"
132-
// BLEEDING-EDGE-NOT: "-target-feature" "+extended-const"

0 commit comments

Comments
 (0)