Skip to content

Commit 95ad4b2

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 c5f82f7 commit 95ad4b2

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
@@ -630,6 +630,15 @@ NetBSD Support
630630
WebAssembly Support
631631
^^^^^^^^^^^^^^^^^^^
632632

633+
The default target CPU, "generic", now enables the `-mnontrapping-fptoint`
634+
and `-mbulk-memory` flags, which correspond to the [Bulk Memory Operations]
635+
and [Non-trapping float-to-int Conversions] language features, which are
636+
[widely implemented in engines].
637+
638+
[Bulk Memory Operations]: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
639+
[Non-trapping float-to-int Conversions]: https://github.com/WebAssembly/spec/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md
640+
[widely implemented in engines]: https://webassembly.org/features/
641+
633642
AVR Support
634643
^^^^^^^^^^^
635644

clang/lib/Basic/Targets/WebAssembly.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ bool WebAssemblyTargetInfo::initFeatureMap(
151151
llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
152152
const std::vector<std::string> &FeaturesVec) const {
153153
auto addGenericFeatures = [&]() {
154+
Features["bulk-memory"] = true;
154155
Features["multivalue"] = true;
155156
Features["mutable-globals"] = true;
157+
Features["nontrapping-fptoint"] = true;
156158
Features["reference-types"] = true;
157159
Features["sign-ext"] = true;
158160
};

llvm/docs/ReleaseNotes.md

+9
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ Changes to the RISC-V Backend
169169
Changes to the WebAssembly Backend
170170
----------------------------------
171171

172+
The default target CPU, "generic", now enables the `-mnontrapping-fptoint`
173+
and `-mbulk-memory` flags, which correspond to the [Bulk Memory Operations]
174+
and [Non-trapping float-to-int Conversions] language features, which are
175+
[widely implemented in engines].
176+
177+
[Bulk Memory Operations]: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md
178+
[Non-trapping float-to-int Conversions]: https://github.com/WebAssembly/spec/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md
179+
[widely implemented in engines]: https://webassembly.org/features/
180+
172181
Changes to the Windows Target
173182
-----------------------------
174183

llvm/lib/Target/WebAssembly/WebAssembly.td

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
110110
// consideration given to available support in relevant engines and tools, and
111111
// the importance of the features.
112112
def : ProcessorModel<"generic", NoSchedModel,
113-
[FeatureMultivalue, FeatureMutableGlobals,
113+
[FeatureBulkMemory, FeatureMultivalue,
114+
FeatureMutableGlobals, FeatureNontrappingFPToInt,
114115
FeatureReferenceTypes, FeatureSignExt]>;
115116

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

0 commit comments

Comments
 (0)