Skip to content

Commit fb6e024

Browse files
authored
[WebAssembly] Update generic and bleeding-edge CPUs (#96584)
This updates the list of features in 'generic' and 'bleeding-edge' CPUs in the backend to match https://github.com/llvm/llvm-project/blob/4e0a0eae58f7a6998866719f7eb970096a2a52e9/clang/lib/Basic/Targets/WebAssembly.cpp#L150-L178 This updates existing CodeGen tests in a way that, if a test has separate RUN lines for a reference-types test and a non-reference-types test, I added -mattr=-reference-types to the no-reftype test's RUN command line. I didn't delete existing -mattr=+reference-types lines in reftype tests because having it helps readability. Also, when tests is not really about reference-types but they have to updated because they happen to contain call_indirect lines because now call_indirect will take __indirect_function_table as an argument, I just added the table argument to the expected output. `target-features-cpus.ll` has been updated reflecting the newly added features.
1 parent 122db8b commit fb6e024

File tree

8 files changed

+56
-18
lines changed

8 files changed

+56
-18
lines changed

llvm/lib/Target/WebAssembly/WebAssembly.td

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,17 @@ 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-
[FeatureSignExt, FeatureMutableGlobals]>;
113+
[FeatureMultivalue, FeatureMutableGlobals,
114+
FeatureReferenceTypes, FeatureSignExt]>;
114115

115116
// Latest and greatest experimental version of WebAssembly. Bugs included!
116117
def : ProcessorModel<"bleeding-edge", NoSchedModel,
117-
[FeatureSIMD128, FeatureAtomics,
118-
FeatureNontrappingFPToInt, FeatureSignExt,
119-
FeatureMutableGlobals, FeatureBulkMemory,
118+
[FeatureAtomics, FeatureBulkMemory,
119+
FeatureExceptionHandling, FeatureExtendedConst,
120+
FeatureHalfPrecision, FeatureMultiMemory,
121+
FeatureMultivalue, FeatureMutableGlobals,
122+
FeatureNontrappingFPToInt, FeatureRelaxedSIMD,
123+
FeatureReferenceTypes, FeatureSIMD128, FeatureSignExt,
120124
FeatureTailCall]>;
121125

122126
//===----------------------------------------------------------------------===//

llvm/test/CodeGen/WebAssembly/call-indirect.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc < %s -asm-verbose=false -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
1+
; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
22
; RUN: llc < %s -asm-verbose=false -mattr=+reference-types -O2 | FileCheck --check-prefixes=CHECK,REF %s
33
; RUN: llc < %s -asm-verbose=false -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=OBJ %s
44

llvm/test/CodeGen/WebAssembly/function-pointer64.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
; RUN: llc < %s -asm-verbose=false -O2 | FileCheck %s
1+
; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 | FileCheck %s
22
; RUN: llc < %s -asm-verbose=false -mattr=+reference-types -O2 | FileCheck --check-prefix=REF %s
3-
; RUN: llc < %s -asm-verbose=false -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=YAML %s
3+
; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=YAML %s
44

55
; This tests pointer features that may codegen differently in wasm64.
66

llvm/test/CodeGen/WebAssembly/reg-stackify.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ define i32 @stackpointer_dependency(ptr readnone) {
649649
; NOREGS-NEXT: local.tee 0
650650
; NOREGS: i32.load 0
651651
; NOREGS-NEXT: i32.load 0
652-
; NOREGS-NEXT: call_indirect (i32, i32) -> (i32)
652+
; NOREGS-NEXT: call_indirect __indirect_function_table, (i32, i32) -> (i32)
653653
%class.call_indirect = type { ptr }
654654
define i32 @call_indirect_stackify(ptr %objptr, i32 %arg) {
655655
%obj = load ptr, ptr %objptr

llvm/test/CodeGen/WebAssembly/swiftcc.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ define swiftcc void @bar() {
1919
call swiftcc void @foo(i32 1, i32 2)
2020

2121
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
22-
; CHECK: call_indirect (i32, i32, i32, i32) -> ()
22+
; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
2323
call swiftcc void %1(i32 1, i32 2)
2424

2525
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
26-
; CHECK: call_indirect (i32, i32, i32, i32) -> ()
26+
; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
2727
call swiftcc void %1(i32 1, i32 2, i32 swiftself 3)
2828

2929
%err = alloca swifterror ptr, align 4
3030

3131
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
32-
; CHECK: call_indirect (i32, i32, i32, i32) -> ()
32+
; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
3333
call swiftcc void %1(i32 1, i32 2, ptr swifterror %err)
3434

3535
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
36-
; CHECK: call_indirect (i32, i32, i32, i32) -> ()
36+
; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
3737
call swiftcc void %1(i32 1, i32 2, i32 swiftself 3, ptr swifterror %err)
3838

3939
ret void

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

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,62 @@ target triple = "wasm32-unknown-unknown"
1111
; mvp: should not contain the target features section
1212
; MVP-NOT: .custom_section.target_features,"",@
1313

14-
; generic: +mutable-globals, +sign-ext
14+
; generic: +multivalue, +mutable-globals, +reference-types, +sign-ext
1515
; GENERIC-LABEL: .custom_section.target_features,"",@
16-
; GENERIC-NEXT: .int8 2
16+
; GENERIC-NEXT: .int8 4
17+
; GENERIC-NEXT: .int8 43
18+
; GENERIC-NEXT: .int8 10
19+
; GENERIC-NEXT: .ascii "multivalue"
1720
; GENERIC-NEXT: .int8 43
1821
; GENERIC-NEXT: .int8 15
1922
; GENERIC-NEXT: .ascii "mutable-globals"
2023
; GENERIC-NEXT: .int8 43
24+
; GENERIC-NEXT: .int8 15
25+
; GENERIC-NEXT: .ascii "reference-types"
26+
; GENERIC-NEXT: .int8 43
2127
; GENERIC-NEXT: .int8 8
2228
; GENERIC-NEXT: .ascii "sign-ext"
2329

24-
; bleeding-edge: +atomics, +bulk-memory, +mutable-globals, +nontrapping-fptoint,
25-
; +sign-ext, +simd128, +tail-call
30+
; bleeding-edge: +atomics, +bulk-memory, +exception-handling, +extended-const,
31+
; +half-precision, +multimemory, +multivalue, +mutable-globals,
32+
; +nontrapping-fptoint, +relaxed-simd, +reference-types,
33+
; +simd128, +sign-ext, +tail-call
2634
; BLEEDING-EDGE-LABEL: .section .custom_section.target_features,"",@
27-
; BLEEDING-EDGE-NEXT: .int8 7
35+
; BLEEDING-EDGE-NEXT: .int8 14
2836
; BLEEDING-EDGE-NEXT: .int8 43
2937
; BLEEDING-EDGE-NEXT: .int8 7
3038
; BLEEDING-EDGE-NEXT: .ascii "atomics"
3139
; BLEEDING-EDGE-NEXT: .int8 43
3240
; BLEEDING-EDGE-NEXT: .int8 11
3341
; BLEEDING-EDGE-NEXT: .ascii "bulk-memory"
3442
; BLEEDING-EDGE-NEXT: .int8 43
43+
; BLEEDING-EDGE-NEXT: .int8 18
44+
; BLEEDING-EDGE-NEXT: .ascii "exception-handling"
45+
; BLEEDING-EDGE-NEXT: .int8 43
46+
; BLEEDING-EDGE-NEXT: .int8 14
47+
; BLEEDING-EDGE-NEXT: .ascii "extended-const"
48+
; BLEEDING-EDGE-NEXT: .int8 43
49+
; BLEEDING-EDGE-NEXT: .int8 14
50+
; BLEEDING-EDGE-NEXT: .ascii "half-precision"
51+
; BLEEDING-EDGE-NEXT: .int8 43
52+
; BLEEDING-EDGE-NEXT: .int8 11
53+
; BLEEDING-EDGE-NEXT: .ascii "multimemory"
54+
; BLEEDING-EDGE-NEXT: .int8 43
55+
; BLEEDING-EDGE-NEXT: .int8 10
56+
; BLEEDING-EDGE-NEXT: .ascii "multivalue"
57+
; BLEEDING-EDGE-NEXT: .int8 43
3558
; BLEEDING-EDGE-NEXT: .int8 15
3659
; BLEEDING-EDGE-NEXT: .ascii "mutable-globals"
3760
; BLEEDING-EDGE-NEXT: .int8 43
3861
; BLEEDING-EDGE-NEXT: .int8 19
3962
; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint"
4063
; BLEEDING-EDGE-NEXT: .int8 43
64+
; BLEEDING-EDGE-NEXT: .int8 15
65+
; BLEEDING-EDGE-NEXT: .ascii "reference-types"
66+
; BLEEDING-EDGE-NEXT: .int8 43
67+
; BLEEDING-EDGE-NEXT: .int8 12
68+
; BLEEDING-EDGE-NEXT: .ascii "relaxed-simd"
69+
; BLEEDING-EDGE-NEXT: .int8 43
4170
; BLEEDING-EDGE-NEXT: .int8 8
4271
; BLEEDING-EDGE-NEXT: .ascii "sign-ext"
4372
; BLEEDING-EDGE-NEXT: .int8 43

llvm/test/MC/WebAssembly/function-alias.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -filetype=obj %s -o - | llvm-readobj --symbols - | FileCheck %s
1+
; RUN: llc -filetype=obj %s -mattr=-reference-types -o - | llvm-readobj --symbols - | FileCheck %s
22
; RUN: llc -filetype=obj %s -mattr=+reference-types -o - | llvm-readobj --symbols - | FileCheck --check-prefix=REF %s
33

44
target triple = "wasm32-unknown-unknown-wasm"

llvm/test/MC/WebAssembly/no-dead-strip.ll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ entry:
5050
; CHECK-NEXT: Segment: 3
5151
; CHECK-NEXT: Offset: 8
5252
; CHECK-NEXT: Size: 8
53+
; CHECK-NEXT: - Index: 5
54+
; CHECK-NEXT: Kind: TABLE
55+
; CHECK-NEXT: Name: __indirect_function_table
56+
; CHECK-NEXT: Flags: [ UNDEFINED, NO_STRIP ]
57+
; CHECK-NEXT: Table: 0
5358
; CHECK-NEXT: SegmentInfo:
5459
; CHECK-NEXT: - Index: 0
5560
; CHECK-NEXT: Name: .data.gv0

0 commit comments

Comments
 (0)