llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Heejin Ahn (aheejin) <details> <summary>Changes</summary> This enables nontrapping-fptoint, multivlaue, reference-types, and bulk-memory in `-mcpu=generic` configuration. These proposals have been standardized and supported in all major browsers for several years at this point: https://github.com/WebAssembly/proposals/blob/main/finished-proposals.md --- Full diff: https://github.com/llvm/llvm-project/pull/80923.diff 3 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+4) - (modified) clang/lib/Basic/Targets/WebAssembly.cpp (+12-6) - (modified) clang/test/Preprocessor/wasm-target-features.c (+4-4) ``````````diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 802c44b6c86080..5a07dcca106876 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -259,6 +259,10 @@ AIX Support WebAssembly Support ^^^^^^^^^^^^^^^^^^^ +The -mcpu=generic configuration now enables nontrapping-fptoint, multivalue, +reference-types, and bulk-memory.These proposals are standardized and available +in all major engines. + AVR Support ^^^^^^^^^^^ diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index f1c925d90cb649..38fe4013090f40 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -147,19 +147,25 @@ void WebAssemblyTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features, bool WebAssemblyTargetInfo::initFeatureMap( llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector<std::string> &FeaturesVec) const { - if (CPU == "bleeding-edge") { - Features["nontrapping-fptoint"] = true; + auto addGenericFeatures = [&]() { Features["sign-ext"] = true; + Features["mutable-globals"] = true; + Features["nontrapping-fptoint"] = true; Features["bulk-memory"] = true; + Features["reference-types"] = true; + Features["multivalue"] = true; + }; + auto addBleedingEdgeFeatures = [&]() { Features["atomics"] = true; - Features["mutable-globals"] = true; Features["tail-call"] = true; - Features["reference-types"] = true; Features["multimemory"] = true; setSIMDLevel(Features, SIMD128, true); + }; + if (CPU == "bleeding-edge") { + addGenericFeatures(); + addBleedingEdgeFeatures(); } else if (CPU == "generic") { - Features["sign-ext"] = true; - Features["mutable-globals"] = true; + addGenericFeatures(); } return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c index eccd432aa8eee6..5834e6d183bc9c 100644 --- a/clang/test/Preprocessor/wasm-target-features.c +++ b/clang/test/Preprocessor/wasm-target-features.c @@ -155,15 +155,15 @@ // // GENERIC-DAG:#define __wasm_sign_ext__ 1{{$}} // GENERIC-DAG:#define __wasm_mutable_globals__ 1{{$}} -// GENERIC-NOT:#define __wasm_nontrapping_fptoint__ 1{{$}} -// GENERIC-NOT:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}} +// GENERIC-DAG:#define __wasm_bulk_memory__ 1{{$}} +// GENERIC-DAG:#define __wasm_multivalue__ 1{{$}} +// GENERIC-DAG:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_simd128__ 1{{$}} // GENERIC-NOT:#define __wasm_atomics__ 1{{$}} // GENERIC-NOT:#define __wasm_tail_call__ 1{{$}} // GENERIC-NOT:#define __wasm_multimemory__ 1{{$}} // GENERIC-NOT:#define __wasm_exception_handling__ 1{{$}} -// GENERIC-NOT:#define __wasm_multivalue__ 1{{$}} -// GENERIC-NOT:#define __wasm_reference_types__ 1{{$}} // GENERIC-NOT:#define __wasm_extended_const__ 1{{$}} // RUN: %clang -E -dM %s -o - 2>&1 \ `````````` </details> https://github.com/llvm/llvm-project/pull/80923 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits