Skip to content

Commit 65eb113

Browse files
committed
[WebAssembly] Update bleeding-edge CPU features
Summary: This adds bulk memory and tail call to "bleeding-edge" CPU, since their implementation in LLVM/clang seems mostly complete. Reviewers: tlively Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D73322
1 parent 764f408 commit 65eb113

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

clang/lib/Basic/Targets/WebAssembly.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ bool WebAssemblyTargetInfo::initFeatureMap(
105105
if (CPU == "bleeding-edge") {
106106
Features["nontrapping-fptoint"] = true;
107107
Features["sign-ext"] = true;
108+
Features["bulk-memory"] = true;
108109
Features["atomics"] = true;
109110
Features["mutable-globals"] = true;
111+
Features["tail-call"] = true;
110112
setSIMDLevel(Features, SIMD128);
111113
}
112114
// Other targets do not consider user-configured features here, but while we

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,14 @@
134134
//
135135
// BLEEDING-EDGE-DAG:#define __wasm_nontrapping_fptoint__ 1{{$}}
136136
// BLEEDING-EDGE-DAG:#define __wasm_sign_ext__ 1{{$}}
137+
// BLEEDING-EDGE-DAG:#define __wasm_bulk_memory__ 1{{$}}
137138
// BLEEDING-EDGE-DAG:#define __wasm_simd128__ 1{{$}}
138139
// BLEEDING-EDGE-DAG:#define __wasm_atomics__ 1{{$}}
139140
// BLEEDING-EDGE-DAG:#define __wasm_mutable_globals__ 1{{$}}
141+
// BLEEDING-EDGE-DAG:#define __wasm_tail_call__ 1{{$}}
140142
// BLEEDING-EDGE-NOT:#define __wasm_unimplemented_simd128__ 1{{$}}
143+
// BLEEDING-EDGE-NOT:#define __wasm_exception_handling__ 1{{$}}
141144
// BLEEDING-EDGE-NOT:#define __wasm_multivalue__ 1{{$}}
142-
// BLEEDING-EDGE-NOT:#define __wasm_tail_call__ 1{{$}}
143145
// BLEEDING-EDGE-NOT:#define __wasm_reference_types__ 1{{$}}
144146

145147
// RUN: %clang -E -dM %s -o - 2>&1 \

llvm/lib/Target/WebAssembly/WebAssembly.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def : ProcessorModel<"generic", NoSchedModel, []>;
102102
def : ProcessorModel<"bleeding-edge", NoSchedModel,
103103
[FeatureSIMD128, FeatureAtomics,
104104
FeatureNontrappingFPToInt, FeatureSignExt,
105-
FeatureMutableGlobals]>;
105+
FeatureMutableGlobals, FeatureBulkMemory,
106+
FeatureTailCall]>;
106107

107108
//===----------------------------------------------------------------------===//
108109
// Target Declaration

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,16 @@ attributes #2 = { "target-features"="+reference-types" }
8383
; SIMD128-NEXT: .int8 7
8484
; SIMD128-NEXT: .ascii "simd128"
8585

86-
; +atomics, +mutable-globals, +nontrapping-fptoint, +reference-types, +sign-ext,
87-
; +simd128
88-
; BLEEDING-EDGE-NEXT: .int8 6
86+
; +atomics, +bulk-memory, +mutable-globals, +nontrapping-fptoint,
87+
; +reference-types, +sign-ext, +simd128, +tail-call
88+
; BLEEDING-EDGE-NEXT: .int8 8
8989
; BLEEDING-EDGE-NEXT: .int8 43
9090
; BLEEDING-EDGE-NEXT: .int8 7
9191
; BLEEDING-EDGE-NEXT: .ascii "atomics"
9292
; BLEEDING-EDGE-NEXT: .int8 43
93+
; BLEEDING-EDGE-NEXT: .int8 11
94+
; BLEEDING-EDGE-NEXT: .ascii "bulk-memory"
95+
; BLEEDING-EDGE-NEXT: .int8 43
9396
; BLEEDING-EDGE-NEXT: .int8 15
9497
; BLEEDING-EDGE-NEXT: .ascii "mutable-globals"
9598
; BLEEDING-EDGE-NEXT: .int8 43
@@ -104,5 +107,8 @@ attributes #2 = { "target-features"="+reference-types" }
104107
; BLEEDING-EDGE-NEXT: .int8 43
105108
; BLEEDING-EDGE-NEXT: .int8 7
106109
; BLEEDING-EDGE-NEXT: .ascii "simd128"
110+
; BLEEDING-EDGE-NEXT: .int8 43
111+
; BLEEDING-EDGE-NEXT: .int8 9
112+
; BLEEDING-EDGE-NEXT: .ascii "tail-call"
107113

108114
; CHECK-NEXT: .text

0 commit comments

Comments
 (0)