Skip to content

Commit

Permalink
Test updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Oct 25, 2024
1 parent 2e061f9 commit 4dedd25
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 21 deletions.
1 change: 0 additions & 1 deletion clang/lib/Basic/Targets/WebAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ bool WebAssemblyTargetInfo::initFeatureMap(
Features["mutable-globals"] = true;
Features["nontrapping-fptoint"] = true;
Features["reference-types"] = true;
Features["call-indirect-overlong"] = true;
Features["sign-ext"] = true;
};
auto addLime1Features = [&]() {
Expand Down
2 changes: 1 addition & 1 deletion lld/test/wasm/lto/Inputs/libcall-archive.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ define void @memcpy() #0 {
ret void
}

attributes #0 = { "target-features"="-bulk-memory" }
attributes #0 = { "target-features"="-bulk-memory,-bulk-memory-opt" }
2 changes: 1 addition & 1 deletion lld/test/wasm/lto/libcall-archive.ll
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ entry:

declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1)

attributes #0 = { "target-features"="-bulk-memory" }
attributes #0 = { "target-features"="-bulk-memory,-bulk-memory-opt" }

; CHECK: - Type: CUSTOM
; CHECK-NEXT: Name: name
Expand Down
4 changes: 2 additions & 2 deletions lld/test/wasm/lto/stub-library-libcall.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t_main.o %t/main.s
# RUN: llvm-as %S/Inputs/foo.ll -o %t_foo.o
# RUN: llvm-as %S/Inputs/libcall.ll -o %t_libcall.o
# RUN: wasm-ld -mllvm -mattr=-bulk-memory %t_main.o %t_libcall.o %t_foo.o %p/Inputs/stub.so -o %t.wasm
# RUN: wasm-ld -mllvm -mattr=-bulk-memory,-bulk-memory-opt %t_main.o %t_libcall.o %t_foo.o %p/Inputs/stub.so -o %t.wasm
# RUN: obj2yaml %t.wasm | FileCheck %s

# The function `func_with_libcall` will generate an undefined reference to
Expand All @@ -12,7 +12,7 @@
# If %t_foo.o is not included in the link we get an undefined symbol reported
# to the dependency of memcpy on the foo export:

# RUN: not wasm-ld -mllvm -mattr=-bulk-memory %t_main.o %t_libcall.o %p/Inputs/stub.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING %s
# RUN: not wasm-ld -mllvm -mattr=-bulk-memory,-bulk-memory-opt %t_main.o %t_libcall.o %p/Inputs/stub.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING %s
# MISSING: stub.so: undefined symbol: foo. Required by memcpy

#--- main.s
Expand Down
2 changes: 1 addition & 1 deletion lld/test/wasm/multi-table.s
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ call_indirect_explicit_tables:
call_indirect table_b, () -> ()
end_function

# RT-MVP: wasm-ld: error: object file not built with 'reference-types' feature conflicts with import of table table_a by file
# RT-MVP: wasm-ld: error: object file not built with 'call-indirect-overlong' feature conflicts with import of table table_a by file

# CHECK: --- !WASM
# CHECK-NEXT: FileHeader:
Expand Down
12 changes: 6 additions & 6 deletions llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
///
//===----------------------------------------------------------------------===//

// Instruction requiring HasBulkMemory and the bulk memory prefix byte
// Instruction requiring HasBulkMemoryOpt and the bulk memory prefix byte
multiclass BULK_I<dag oops_r, dag iops_r, dag oops_s, dag iops_s,
list<dag> pattern_r, string asmstr_r = "",
string asmstr_s = "", bits<32> simdop = -1> {
defm "" : I<oops_r, iops_r, oops_s, iops_s, pattern_r, asmstr_r, asmstr_s,
!or(0xfc00, !and(0xff, simdop))>;
!or(0xfc00, !and(0xff, simdop))>,
Requires<[HasBulkMemoryOpt]>;
}

// Bespoke types and nodes for bulk memory ops
Expand Down Expand Up @@ -51,8 +52,7 @@ defm INIT_A#B :
(outs), (ins i32imm_op:$seg, i32imm_op:$idx),
[],
"memory.init\t$seg, $idx, $dest, $offset, $size",
"memory.init\t$seg, $idx", 0x08>,
Requires<[HasBulkMemory]>;
"memory.init\t$seg, $idx", 0x08>;

let mayLoad = 1, mayStore = 1 in
defm COPY_A#B :
Expand Down Expand Up @@ -89,14 +89,14 @@ defm CPY_A#B : I<(outs), (ins i32imm_op:$src_idx, i32imm_op:$dst_idx,
rc:$dst, rc:$src, rc:$len
)],
"", "", 0>,
Requires<[HasBulkMemory]>;
Requires<[HasBulkMemoryOpt]>;

let usesCustomInserter = 1, isCodeGenOnly = 1, mayStore = 1 in
defm SET_A#B : I<(outs), (ins i32imm_op:$idx, rc:$dst, I32:$value, rc:$size),
(outs), (ins i32imm_op:$idx),
[(wasm_memset (i32 imm:$idx), rc:$dst, I32:$value, rc:$size)],
"", "", 0>,
Requires<[HasBulkMemory]>;
Requires<[HasBulkMemoryOpt]>;

}

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 -mattr=-reference-types,call-indirect-overlong -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
; RUN: llc < %s -asm-verbose=false -mattr=-reference-types,-call-indirect-overlong -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
; RUN: llc < %s -asm-verbose=false -mattr=+call-indirect-overlong -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/disable-feature.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mattr=-sign-ext,-bulk-memory | FileCheck %s
; RUN: llc < %s -mattr=-sign-ext,-bulk-memory,-bulk-memory-opt | FileCheck %s

target triple = "wasm32-unknown-unknown"

Expand All @@ -21,7 +21,7 @@ define i8 @not_use_extend8_s(i8 %v, i8 %x) {
ret i8 %a
}

attributes #0 = { "target-features"="+bulk-memory," }
attributes #0 = { "target-features"="+bulk-memory-opt" }

declare void @llvm.memset.p0.i32(ptr, i8, i32, i1)

Expand Down
16 changes: 10 additions & 6 deletions llvm/test/CodeGen/WebAssembly/target-features-cpus.ll
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ 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 6
; GENERIC-NEXT: .int8 8
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 11
; GENERIC-NEXT: .ascii "bulk-memory"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 15
; GENERIC-NEXT: .ascii "bulk-memory-opt"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 22
; GENERIC-NEXT: .ascii "call-indirect-overlong"
; GENERIC-NEXT: .int8 43
Expand All @@ -37,15 +40,16 @@ target triple = "wasm32-unknown-unknown"
; GENERIC-NEXT: .int8 8
; GENERIC-NEXT: .ascii "sign-ext"

; lime1: +bulk-memory-opt, +call-indirect-overlong, +extended-const, +multivalue, +mutable-globals, +nontrapping-fptoint, +sign-ext
; lime1: +bulk-memory-opt, +call-indirect-overlong, +extended-const, +multivalue,
; +mutable-globals, +nontrapping-fptoint, +sign-ext
; LIME1-LABEL: .custom_section.target_features,"",@
; LIME1-NEXT: .int8 6
; LIME1-NEXT: .int8 7
; LIME1-NEXT: .int8 43
; LIME1-NEXT: .int8 15
; LIME1-NEXT: .int8 "bulk-memory-opt"
; LIME1-NEXT: .ascii "bulk-memory-opt"
; LIME1-NEXT: .int8 43
; LIME1-NEXT: .int8 22
; LIME1-NEXT: .int8 "call-indirect-overlong"
; LIME1-NEXT: .ascii "call-indirect-overlong"
; LIME1-NEXT: .int8 43
; LIME1-NEXT: .int8 14
; LIME1-NEXT: .ascii "extended-const"
Expand All @@ -68,7 +72,7 @@ target triple = "wasm32-unknown-unknown"
; +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 14
; BLEEDING-EDGE-NEXT: .int8 16
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 7
; BLEEDING-EDGE-NEXT: .ascii "atomics"
Expand Down

0 comments on commit 4dedd25

Please sign in to comment.