Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebAssembly] Cleanup feature tests #80780

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Feb 6, 2024

This adds missing features to the tests and removes a stale feature (unimplemented_simd128) from them.

This adds missing features to the tests and removes a stale feature
(unimplemented_simd128) from them.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Feb 6, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 6, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Heejin Ahn (aheejin)

Changes

This adds missing features to the tests and removes a stale feature (unimplemented_simd128) from them.


Full diff: https://github.com/llvm/llvm-project/pull/80780.diff

2 Files Affected:

  • (modified) clang/test/Driver/wasm-features.c (+80)
  • (modified) clang/test/Preprocessor/wasm-target-features.c (+2-1)
diff --git a/clang/test/Driver/wasm-features.c b/clang/test/Driver/wasm-features.c
index 1a43361a4a108..4fba3da7bea26 100644
--- a/clang/test/Driver/wasm-features.c
+++ b/clang/test/Driver/wasm-features.c
@@ -42,6 +42,16 @@
 // MVP-NOT: "-target-feature" "+nontrapping-fptoint"
 // BLEEDING-EDGE-NOT: "-target-feature" "-nontrapping-fptoint"
 
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultivalue 2>&1 | FileCheck %s -check-prefix=MULTIVALUE
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multivalue 2>&1 | FileCheck %s -check-prefix=NO-MULTIVALUE
+
+// MULTIVALUE: "-target-feature" "+multivalue"
+// NO-MULTIVALUE: "-target-feature" "-multivalue"
+// DEFAULT-NOT: "-target-feature" "-multivalue"
+// MVP-NOT: "-target-feature" "+multivalue"
+// GENERIC-NOT: "-target-feature" "+multivalue"
+// BLEEDING-EDGE-NOT: "-target-feature" "-multivalue"
+
 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultimemory 2>&1 | FileCheck %s -check-prefix=MULTIMEMORY
 // RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multimemory 2>&1 | FileCheck %s -check-prefix=NO-MULTIMEMORY
 
@@ -50,3 +60,73 @@
 // DEFAULT-NOT: "-target-feature" "-multimemory"
 // MVP-NOT: "-target-feature" "+multimemory"
 // BLEEDING-EDGE-NOT: "-target-feature" "-multimemory"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -matomics 2>&1 | FileCheck %s -check-prefix=ATOMICS
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-atomics 2>&1 | FileCheck %s -check-prefix=NO-ATOMICS
+
+// ATOMICS: "-target-feature" "+atomics"
+// NO-ATOMICS: "-target-feature" "-atomics"
+// DEFAULT-NOT: "-target-feature" "-atomics"
+// MVP-NOT: "-target-feature" "+atomics"
+// GENERIC-NOT: "-target-feature" "+atomics"
+// BLEEDING-EDGE-NOT: "-target-feature" "-atomics"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mtail-call 2>&1 | FileCheck %s -check-prefix=TAIL-CALL
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-tail-call 2>&1 | FileCheck %s -check-prefix=NO-TAIL-CALL
+
+// TAIL-CALL: "-target-feature" "+tail-call"
+// NO-TAIL-CALL: "-target-feature" "-tail-call"
+// DEFAULT-NOT: "-target-feature" "-tail-call"
+// MVP-NOT: "-target-feature" "+tail-call"
+// GENERIC-NOT: "-target-feature" "+tail-call"
+// BLEEDING-EDGE-NOT: "-target-feature" "-tail-call"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mreference-types 2>&1 | FileCheck %s -check-prefix=REFERENCE-TYPES
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-reference-types 2>&1 | FileCheck %s -check-prefix=NO-REFERENCE-TYPES
+
+// REFERENCE-TYPES: "-target-feature" "+reference-types"
+// NO-REFERENCE-TYPES: "-target-feature" "-reference-types"
+// DEFAULT-NOT: "-target-feature" "-reference-types"
+// MVP-NOT: "-target-feature" "+reference-types"
+// GENERIC-NOT: "-target-feature" "+reference-types"
+// BLEEDING-EDGE-NOT: "-target-feature" "-reference-types"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -msimd128 2>&1 | FileCheck %s -check-prefix=SIMD128
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-simd128 2>&1 | FileCheck %s -check-prefix=NO-SIMD128
+
+// SIMD128: "-target-feature" "+simd128"
+// NO-SIMD128: "-target-feature" "-simd128"
+// DEFAULT-NOT: "-target-feature" "-simd128"
+// MVP-NOT: "-target-feature" "+simd128"
+// GENERIC-NOT: "-target-feature" "+simd128"
+// BLEEDING-EDGE-NOT: "-target-feature" "+simd128"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mrelaxed-simd 2>&1 | FileCheck %s -check-prefix=RELAXED-SIMD
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-relaxed-simd 2>&1 | FileCheck %s -check-prefix=NO-RELAXED-SIMD
+
+// RELAXED-SIMD: "-target-feature" "+relaxed-simd"
+// NO-RELAXED-SIMD: "-target-feature" "-relaxed-simd"
+// DEFAULT-NOT: "-target-feature" "-relaxed-simd"
+// MVP-NOT: "-target-feature" "+relaxed-simd"
+// GENERIC-NOT: "-target-feature" "+relaxed-simd"
+// BLEEDING-EDGE-NOT: "-target-feature" "+relaxed-simd"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mexception-handling 2>&1 | FileCheck %s -check-prefix=EXCEPTION-HANDLING
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-exception-handling 2>&1 | FileCheck %s -check-prefix=NO-EXCEPTION-HANDLING
+
+// EXCEPTION-HANDLING: "-target-feature" "+exception-handling"
+// NO-EXCEPTION-HANDLING: "-target-feature" "-exception-handling"
+// DEFAULT-NOT: "-target-feature" "-exception-handling"
+// MVP-NOT: "-target-feature" "+exception-handling"
+// GENERIC-NOT: "-target-feature" "+exception-handling"
+// BLEEDING-EDGE-NOT: "-target-feature" "+exception-handling"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mextended-const 2>&1 | FileCheck %s -check-prefix=EXTENDED-CONST
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-extended-const 2>&1 | FileCheck %s -check-prefix=NO-EXTENDED-CONST
+
+// EXTENDED-CONST: "-target-feature" "+extended-const"
+// NO-EXTENDED-CONST: "-target-feature" "-extended-const"
+// DEFAULT-NOT: "-target-feature" "-extended-const"
+// MVP-NOT: "-target-feature" "+extended-const"
+// GENERIC-NOT: "-target-feature" "+extended-const"
+// BLEEDING-EDGE-NOT: "-target-feature" "+extended-const"
diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c
index c225e226b69ba..e50c5a4afe79c 100644
--- a/clang/test/Preprocessor/wasm-target-features.c
+++ b/clang/test/Preprocessor/wasm-target-features.c
@@ -144,6 +144,7 @@
 // MVP-NOT:#define __wasm_reference_types__
 // MVP-NOT:#define __wasm_extended_const__
 // MVP-NOT:#define __wasm_multimemory__
+// MVP-NOT:#define __wasm_relaxed_simd__
 
 // RUN: %clang -E -dM %s -o - 2>&1 \
 // RUN:     -target wasm32-unknown-unknown -mcpu=bleeding-edge \
@@ -160,11 +161,11 @@
 // BLEEDING-EDGE-DAG:#define __wasm_mutable_globals__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_tail_call__ 1{{$}}
 // BLEEDING-EDGE-DAG:#define __wasm_multimemory__ 1{{$}}
-// BLEEDING-EDGE-NOT:#define __wasm_unimplemented_simd128__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_exception_handling__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_multivalue__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_reference_types__ 1{{$}}
 // BLEEDING-EDGE-NOT:#define __wasm_extended_const__ 1{{$}}
+// BLEEDING-EDGE-NOT:#define __wasm_relaxed_simd__ 1{{$}}
 
 // RUN: %clang -E -dM %s -o - 2>&1 \
 // RUN:     -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \

@aheejin aheejin merged commit ce00fdc into llvm:main Feb 6, 2024
7 checks passed
@aheejin aheejin deleted the feature_test_cleanup branch February 6, 2024 19:38
// NO-ATOMICS: "-target-feature" "-atomics"
// DEFAULT-NOT: "-target-feature" "-atomics"
// MVP-NOT: "-target-feature" "+atomics"
// GENERIC-NOT: "-target-feature" "+atomics"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR was mixed with #80775 and these GENERIC lines were what I intended for #80775 and added here by mistake. But @tlively pointed out that we had DEFAULT checks so we didn't need those lines. But later I found out that these CPU tests were not working as intended anyway and plan to delete these lines (See #80900). Sorry for the confusion...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants