Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebAssembly] Update generic and bleeding-edge CPUs #96584

Merged
merged 5 commits into from
Jul 2, 2024
Merged
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
12 changes: 8 additions & 4 deletions llvm/lib/Target/WebAssembly/WebAssembly.td
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
// consideration given to available support in relevant engines and tools, and
// the importance of the features.
def : ProcessorModel<"generic", NoSchedModel,
[FeatureSignExt, FeatureMutableGlobals]>;
[FeatureMultivalue, FeatureMutableGlobals,
FeatureReferenceTypes, FeatureSignExt]>;

// Latest and greatest experimental version of WebAssembly. Bugs included!
def : ProcessorModel<"bleeding-edge", NoSchedModel,
[FeatureSIMD128, FeatureAtomics,
FeatureNontrappingFPToInt, FeatureSignExt,
FeatureMutableGlobals, FeatureBulkMemory,
[FeatureAtomics, FeatureBulkMemory,
FeatureExceptionHandling, FeatureExtendedConst,
FeatureHalfPrecision, FeatureMultiMemory,
FeatureMultivalue, FeatureMutableGlobals,
FeatureNontrappingFPToInt, FeatureRelaxedSIMD,
FeatureReferenceTypes, FeatureSIMD128, FeatureSignExt,
FeatureTailCall]>;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/WebAssembly/call-indirect.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -asm-verbose=false -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
; RUN: llc < %s -asm-verbose=false -mattr=+reference-types -O2 | FileCheck --check-prefixes=CHECK,REF %s
; RUN: llc < %s -asm-verbose=false -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=OBJ %s

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/WebAssembly/function-pointer64.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: llc < %s -asm-verbose=false -O2 | FileCheck %s
; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 | FileCheck %s
; RUN: llc < %s -asm-verbose=false -mattr=+reference-types -O2 | FileCheck --check-prefix=REF %s
; RUN: llc < %s -asm-verbose=false -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=YAML %s
; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=YAML %s

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

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/WebAssembly/reg-stackify.ll
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ define i32 @stackpointer_dependency(ptr readnone) {
; NOREGS-NEXT: local.tee 0
; NOREGS: i32.load 0
; NOREGS-NEXT: i32.load 0
; NOREGS-NEXT: call_indirect (i32, i32) -> (i32)
; NOREGS-NEXT: call_indirect __indirect_function_table, (i32, i32) -> (i32)
%class.call_indirect = type { ptr }
define i32 @call_indirect_stackify(ptr %objptr, i32 %arg) {
%obj = load ptr, ptr %objptr
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/WebAssembly/swiftcc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ define swiftcc void @bar() {
call swiftcc void @foo(i32 1, i32 2)

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

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

%err = alloca swifterror ptr, align 4

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

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

ret void
Expand Down
39 changes: 34 additions & 5 deletions llvm/test/CodeGen/WebAssembly/target-features-cpus.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,62 @@ target triple = "wasm32-unknown-unknown"
; mvp: should not contain the target features section
; MVP-NOT: .custom_section.target_features,"",@

; generic: +mutable-globals, +sign-ext
; generic: +multivalue, +mutable-globals, +reference-types, +sign-ext
; GENERIC-LABEL: .custom_section.target_features,"",@
; GENERIC-NEXT: .int8 2
; GENERIC-NEXT: .int8 4
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 10
; GENERIC-NEXT: .ascii "multivalue"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 15
; GENERIC-NEXT: .ascii "mutable-globals"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 15
; GENERIC-NEXT: .ascii "reference-types"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 8
; GENERIC-NEXT: .ascii "sign-ext"

; bleeding-edge: +atomics, +bulk-memory, +mutable-globals, +nontrapping-fptoint,
; +sign-ext, +simd128, +tail-call
; bleeding-edge: +atomics, +bulk-memory, +exception-handling, +extended-const,
; +half-precision, +multimemory, +multivalue, +mutable-globals,
; +nontrapping-fptoint, +relaxed-simd, +reference-types,
; +simd128, +sign-ext, +tail-call
; BLEEDING-EDGE-LABEL: .section .custom_section.target_features,"",@
; BLEEDING-EDGE-NEXT: .int8 7
; BLEEDING-EDGE-NEXT: .int8 14
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 7
; BLEEDING-EDGE-NEXT: .ascii "atomics"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 11
; BLEEDING-EDGE-NEXT: .ascii "bulk-memory"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 18
; BLEEDING-EDGE-NEXT: .ascii "exception-handling"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 14
; BLEEDING-EDGE-NEXT: .ascii "extended-const"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 14
; BLEEDING-EDGE-NEXT: .ascii "half-precision"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 11
; BLEEDING-EDGE-NEXT: .ascii "multimemory"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 10
; BLEEDING-EDGE-NEXT: .ascii "multivalue"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 15
; BLEEDING-EDGE-NEXT: .ascii "mutable-globals"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 19
; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 15
; BLEEDING-EDGE-NEXT: .ascii "reference-types"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 12
; BLEEDING-EDGE-NEXT: .ascii "relaxed-simd"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 8
; BLEEDING-EDGE-NEXT: .ascii "sign-ext"
; BLEEDING-EDGE-NEXT: .int8 43
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/MC/WebAssembly/function-alias.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc -filetype=obj %s -o - | llvm-readobj --symbols - | FileCheck %s
; RUN: llc -filetype=obj %s -mattr=-reference-types -o - | llvm-readobj --symbols - | FileCheck %s
; RUN: llc -filetype=obj %s -mattr=+reference-types -o - | llvm-readobj --symbols - | FileCheck --check-prefix=REF %s

target triple = "wasm32-unknown-unknown-wasm"
Expand Down
5 changes: 5 additions & 0 deletions llvm/test/MC/WebAssembly/no-dead-strip.ll
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ entry:
; CHECK-NEXT: Segment: 3
; CHECK-NEXT: Offset: 8
; CHECK-NEXT: Size: 8
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Kind: TABLE
; CHECK-NEXT: Name: __indirect_function_table
; CHECK-NEXT: Flags: [ UNDEFINED, NO_STRIP ]
; CHECK-NEXT: Table: 0
; CHECK-NEXT: SegmentInfo:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Name: .data.gv0
Expand Down
Loading