Skip to content

Commit 6d8b255

Browse files
committed
[WebAssembly] Enable extended-const feature by default
1 parent 496fec5 commit 6d8b255

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@ NetBSD Support
235235
WebAssembly Support
236236
^^^^^^^^^^^^^^^^^^^
237237

238+
The default target CPU, "generic", now enables the `-mextended-const`
239+
flag, which correspond to the [Extended Const] proposal, which is
240+
[widely implemented in engines].
241+
242+
[Extended Const]: https://github.com/WebAssembly/extended-const
243+
[widely implemented in engines]: https://webassembly.org/features/
244+
238245
AVR Support
239246
^^^^^^^^^^^
240247

clang/lib/Basic/Targets/WebAssembly.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
168168
Features["bulk-memory"] = true;
169169
Features["bulk-memory-opt"] = true;
170170
Features["call-indirect-overlong"] = true;
171+
Features["extended-const"] = true;
171172
Features["multivalue"] = true;
172173
Features["mutable-globals"] = true;
173174
Features["nontrapping-fptoint"] = true;

clang/test/Preprocessor/wasm-target-features.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
// RUN: | FileCheck %s -check-prefix=GENERIC-INCLUDE
165165
//
166166
// GENERIC-INCLUDE-DAG: #define __wasm_bulk_memory__ 1{{$}}
167+
// GENERIC-INCLUDE-DAG: #define __wasm_extended_const__ 1{{$}}
167168
// GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
168169
// GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}
169170
// GENERIC-INCLUDE-DAG: #define __wasm_nontrapping_fptoint__ 1{{$}}
@@ -179,7 +180,6 @@
179180
//
180181
// GENERIC-NOT: #define __wasm_atomics__ 1{{$}}
181182
// GENERIC-NOT: #define __wasm_exception_handling__ 1{{$}}
182-
// GENERIC-NOT: #define __wasm_extended_const__ 1{{$}}
183183
// GENERIC-NOT: #define __wasm__fp16__ 1{{$}}
184184
// GENERIC-NOT: #define __wasm_multimemory__ 1{{$}}
185185
// GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}}

llvm/docs/ReleaseNotes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ Changes to the RISC-V Backend
110110
Changes to the WebAssembly Backend
111111
----------------------------------
112112

113+
The default target CPU, "generic", now enables the `-mextended-const`
114+
flag, which correspond to the [Extended Const] proposal, which is
115+
[widely implemented in engines].
116+
117+
[Extended Const]: https://github.com/WebAssembly/extended-const
118+
[widely implemented in engines]: https://webassembly.org/features/
119+
113120
Changes to the Windows Target
114121
-----------------------------
115122

llvm/lib/Target/WebAssembly/WebAssembly.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
123123
// the importance of the features.
124124
def : ProcessorModel<"generic", NoSchedModel,
125125
[FeatureBulkMemory, FeatureBulkMemoryOpt,
126-
FeatureCallIndirectOverlong, FeatureMultivalue,
127-
FeatureMutableGlobals, FeatureNontrappingFPToInt,
128-
FeatureReferenceTypes, FeatureSignExt]>;
126+
FeatureCallIndirectOverlong, FeatureExtendedConst,
127+
FeatureMultivalue, FeatureMutableGlobals,
128+
FeatureNontrappingFPToInt, FeatureReferenceTypes,
129+
FeatureSignExt]>;
129130

130131
// Lime1: <https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#lime1>
131132
def : ProcessorModel<"lime1", NoSchedModel,

llvm/test/CodeGen/WebAssembly/target-features-cpus.ll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ target triple = "wasm32-unknown-unknown"
1414

1515
; generic: +call-indirect-overlong, +multivalue, +mutable-globals, +reference-types, +sign-ext
1616
; GENERIC-LABEL: .custom_section.target_features,"",@
17-
; GENERIC-NEXT: .int8 8
17+
; GENERIC-NEXT: .int8 9
1818
; GENERIC-NEXT: .int8 43
1919
; GENERIC-NEXT: .int8 11
2020
; GENERIC-NEXT: .ascii "bulk-memory"
@@ -25,6 +25,9 @@ target triple = "wasm32-unknown-unknown"
2525
; GENERIC-NEXT: .int8 22
2626
; GENERIC-NEXT: .ascii "call-indirect-overlong"
2727
; GENERIC-NEXT: .int8 43
28+
; GENERIC-NEXT: .int8 14
29+
; GENERIC-NEXT: .ascii "extended-const"
30+
; GENERIC-NEXT: .int8 43
2831
; GENERIC-NEXT: .int8 10
2932
; GENERIC-NEXT: .ascii "multivalue"
3033
; GENERIC-NEXT: .int8 43

0 commit comments

Comments
 (0)