Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ NetBSD Support
WebAssembly Support
^^^^^^^^^^^^^^^^^^^

The default target CPU, "generic", now enables the `-mextended-const`
flag, which correspond to the [Extended Const] proposal, which is
[widely implemented in engines].

[Extended Const]: https://github.com/WebAssembly/extended-const
[widely implemented in engines]: https://webassembly.org/features/

AVR Support
^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions clang/lib/Basic/Targets/WebAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
Features["bulk-memory"] = true;
Features["bulk-memory-opt"] = true;
Features["call-indirect-overlong"] = true;
Features["extended-const"] = true;
Features["multivalue"] = true;
Features["mutable-globals"] = true;
Features["nontrapping-fptoint"] = true;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Preprocessor/wasm-target-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
// RUN: | FileCheck %s -check-prefix=GENERIC-INCLUDE
//
// GENERIC-INCLUDE-DAG: #define __wasm_bulk_memory__ 1{{$}}
// GENERIC-INCLUDE-DAG: #define __wasm_extended_const__ 1{{$}}
// GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
// GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}
// GENERIC-INCLUDE-DAG: #define __wasm_nontrapping_fptoint__ 1{{$}}
Expand All @@ -179,7 +180,6 @@
//
// GENERIC-NOT: #define __wasm_atomics__ 1{{$}}
// GENERIC-NOT: #define __wasm_exception_handling__ 1{{$}}
// GENERIC-NOT: #define __wasm_extended_const__ 1{{$}}
// GENERIC-NOT: #define __wasm__fp16__ 1{{$}}
// GENERIC-NOT: #define __wasm_multimemory__ 1{{$}}
// GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}}
Expand Down
7 changes: 7 additions & 0 deletions llvm/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ Changes to the RISC-V Backend
Changes to the WebAssembly Backend
----------------------------------

The default target CPU, "generic", now enables the `-mextended-const`
flag, which correspond to the [Extended Const] proposal, which is
[widely implemented in engines].

[Extended Const]: https://github.com/WebAssembly/extended-const
[widely implemented in engines]: https://webassembly.org/features/

Changes to the Windows Target
-----------------------------

Expand Down
7 changes: 4 additions & 3 deletions llvm/lib/Target/WebAssembly/WebAssembly.td
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
// the importance of the features.
def : ProcessorModel<"generic", NoSchedModel,
[FeatureBulkMemory, FeatureBulkMemoryOpt,
FeatureCallIndirectOverlong, FeatureMultivalue,
FeatureMutableGlobals, FeatureNontrappingFPToInt,
FeatureReferenceTypes, FeatureSignExt]>;
FeatureCallIndirectOverlong, FeatureExtendedConst,
FeatureMultivalue, FeatureMutableGlobals,
FeatureNontrappingFPToInt, FeatureReferenceTypes,
FeatureSignExt]>;

// Lime1: <https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#lime1>
def : ProcessorModel<"lime1", NoSchedModel,
Expand Down
5 changes: 4 additions & 1 deletion llvm/test/CodeGen/WebAssembly/target-features-cpus.ll
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ target triple = "wasm32-unknown-unknown"

; generic: +call-indirect-overlong, +multivalue, +mutable-globals, +reference-types, +sign-ext
; GENERIC-LABEL: .custom_section.target_features,"",@
; GENERIC-NEXT: .int8 8
; GENERIC-NEXT: .int8 9
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 11
; GENERIC-NEXT: .ascii "bulk-memory"
Expand All @@ -25,6 +25,9 @@ target triple = "wasm32-unknown-unknown"
; GENERIC-NEXT: .int8 22
; GENERIC-NEXT: .ascii "call-indirect-overlong"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 14
; GENERIC-NEXT: .ascii "extended-const"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 10
; GENERIC-NEXT: .ascii "multivalue"
; GENERIC-NEXT: .int8 43
Expand Down