Skip to content

Commit c4327c9

Browse files
committed
[WebAssembly] Enable nontrapping-fptoint and bulk-memory by default.
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]: WebAssembly/tool-conventions#158 (comment) [Trail1 proposal]: llvm#112035
1 parent 1184458 commit c4327c9

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

clang/docs/ReleaseNotes.rst

+9
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,15 @@ NetBSD Support
671671
WebAssembly Support
672672
^^^^^^^^^^^^^^^^^^^
673673

674+
The default target CPU, "generic", now enables the `-mnontrapping-fptoint`
675+
and `-mbulk-memory` flags, which correspond to the [Bulk Memory Operations]
676+
and [Non-trapping float-to-int Conversions] language features, which are
677+
[widely implemented in engines].
678+
679+
[Bulk Memory Operations]: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
680+
[Non-trapping float-to-int Conversions]: https://github.com/WebAssembly/spec/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md
681+
[widely implemented in engines]: https://webassembly.org/features/
682+
674683
AVR Support
675684
^^^^^^^^^^^
676685

clang/lib/Basic/Targets/WebAssembly.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ bool WebAssemblyTargetInfo::initFeatureMap(
154154
llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
155155
const std::vector<std::string> &FeaturesVec) const {
156156
auto addGenericFeatures = [&]() {
157+
Features["bulk-memory"] = true;
157158
Features["multivalue"] = true;
158159
Features["mutable-globals"] = true;
160+
Features["nontrapping-fptoint"] = true;
159161
Features["reference-types"] = true;
160162
Features["sign-ext"] = true;
161163
};

llvm/docs/ReleaseNotes.md

+9
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ Changes to the RISC-V Backend
175175
Changes to the WebAssembly Backend
176176
----------------------------------
177177

178+
The default target CPU, "generic", now enables the `-mnontrapping-fptoint`
179+
and `-mbulk-memory` flags, which correspond to the [Bulk Memory Operations]
180+
and [Non-trapping float-to-int Conversions] language features, which are
181+
[widely implemented in engines].
182+
183+
[Bulk Memory Operations]: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
184+
[Non-trapping float-to-int Conversions]: https://github.com/WebAssembly/spec/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md
185+
[widely implemented in engines]: https://webassembly.org/features/
186+
178187
Changes to the Windows Target
179188
-----------------------------
180189

llvm/lib/Target/WebAssembly/WebAssembly.td

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
114114
// consideration given to available support in relevant engines and tools, and
115115
// the importance of the features.
116116
def : ProcessorModel<"generic", NoSchedModel,
117-
[FeatureMultivalue, FeatureMutableGlobals,
117+
[FeatureBulkMemory, FeatureMultivalue,
118+
FeatureMutableGlobals, FeatureNontrappingFPToInt,
118119
FeatureReferenceTypes, FeatureSignExt]>;
119120

120121
// Latest and greatest experimental version of WebAssembly. Bugs included!

0 commit comments

Comments
 (0)