[clang] [llvm] [WebAssembly] Enable nontrapping-fptoint and bulk-memory by default. (PR #112049)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 14:28:51 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Dan Gohman (sunfishcode)
<details>
<summary>Changes</summary>
We were prepared to enable these features [back in February], but they got pulled for what appear to be unrelated reasons. So let's have another try at enabling them!
Another motivation here is that it'd be convenient for the [Trail1 proposal] if "trail1" is a superset of "generic".
[back in February]: https://github.com/WebAssembly/tool-conventions/issues/158#issuecomment-1931119512
[Trail1 proposal]: https://github.com/llvm/llvm-project/pull/112035
---
Full diff: https://github.com/llvm/llvm-project/pull/112049.diff
4 Files Affected:
- (modified) clang/docs/ReleaseNotes.rst (+9)
- (modified) clang/lib/Basic/Targets/WebAssembly.cpp (+2)
- (modified) llvm/docs/ReleaseNotes.md (+9)
- (modified) llvm/lib/Target/WebAssembly/WebAssembly.td (+2-1)
``````````diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e74dd1a5fb32da..aec48e32dc85a8 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -627,6 +627,15 @@ NetBSD Support
WebAssembly Support
^^^^^^^^^^^^^^^^^^^
+The default target CPU, "generic", now enables the `-mnontrapping-fptoint`
+and `-mbulk-memory` flags, which correspond to the [Bulk Memory Operations]
+and [Non-trapping float-to-int Conversions] language features, which are
+[widely implemented in engines].
+
+[Bulk Memory Operations]: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
+[Non-trapping float-to-int Conversions]: https://github.com/WebAssembly/spec/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md
+[widely implemented in engines]: https://webassembly.org/features/
+
AVR Support
^^^^^^^^^^^
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp
index 5ac9421663adea..1ac8f14f8cb175 100644
--- a/clang/lib/Basic/Targets/WebAssembly.cpp
+++ b/clang/lib/Basic/Targets/WebAssembly.cpp
@@ -151,8 +151,10 @@ bool WebAssemblyTargetInfo::initFeatureMap(
llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
const std::vector<std::string> &FeaturesVec) const {
auto addGenericFeatures = [&]() {
+ Features["bulk-memory"] = true;
Features["multivalue"] = true;
Features["mutable-globals"] = true;
+ Features["nontrapping-fptoint"] = true;
Features["reference-types"] = true;
Features["sign-ext"] = true;
};
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index dcdd7a25c7fbee..1d4197f25f4422 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -164,6 +164,15 @@ Changes to the RISC-V Backend
Changes to the WebAssembly Backend
----------------------------------
+The default target CPU, "generic", now enables the `-mnontrapping-fptoint`
+and `-mbulk-memory` flags, which correspond to the [Bulk Memory Operations]
+and [Non-trapping float-to-int Conversions] language features, which are
+[widely implemented in engines].
+
+[Bulk Memory Operations]: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
+[Non-trapping float-to-int Conversions]: https://github.com/WebAssembly/spec/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md
+[widely implemented in engines]: https://webassembly.org/features/
+
Changes to the Windows Target
-----------------------------
diff --git a/llvm/lib/Target/WebAssembly/WebAssembly.td b/llvm/lib/Target/WebAssembly/WebAssembly.td
index c632d4a74355d8..1e22707db23e91 100644
--- a/llvm/lib/Target/WebAssembly/WebAssembly.td
+++ b/llvm/lib/Target/WebAssembly/WebAssembly.td
@@ -110,7 +110,8 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
// consideration given to available support in relevant engines and tools, and
// the importance of the features.
def : ProcessorModel<"generic", NoSchedModel,
- [FeatureMultivalue, FeatureMutableGlobals,
+ [FeatureBulkMemory, FeatureMultivalue,
+ FeatureMutableGlobals, FeatureNontrappingFPToInt,
FeatureReferenceTypes, FeatureSignExt]>;
// Latest and greatest experimental version of WebAssembly. Bugs included!
``````````
</details>
https://github.com/llvm/llvm-project/pull/112049
More information about the llvm-commits
mailing list