From 4dedd251c1008712f6ceb44ac6c2fc8fd38d55d8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 25 Oct 2024 15:57:39 -0700 Subject: [PATCH] Test updates. --- clang/lib/Basic/Targets/WebAssembly.cpp | 1 - lld/test/wasm/lto/Inputs/libcall-archive.ll | 2 +- lld/test/wasm/lto/libcall-archive.ll | 2 +- lld/test/wasm/lto/stub-library-libcall.s | 4 ++-- lld/test/wasm/multi-table.s | 2 +- .../WebAssembly/WebAssemblyInstrBulkMemory.td | 12 ++++++------ llvm/test/CodeGen/WebAssembly/call-indirect.ll | 2 +- llvm/test/CodeGen/WebAssembly/disable-feature.ll | 4 ++-- .../CodeGen/WebAssembly/target-features-cpus.ll | 16 ++++++++++------ 9 files changed, 24 insertions(+), 21 deletions(-) diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 710849472c534d..4f7cad4398e6e0 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -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 = [&]() { diff --git a/lld/test/wasm/lto/Inputs/libcall-archive.ll b/lld/test/wasm/lto/Inputs/libcall-archive.ll index 7d8c34196dfe49..30764af83e6739 100644 --- a/lld/test/wasm/lto/Inputs/libcall-archive.ll +++ b/lld/test/wasm/lto/Inputs/libcall-archive.ll @@ -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" } diff --git a/lld/test/wasm/lto/libcall-archive.ll b/lld/test/wasm/lto/libcall-archive.ll index 5c46d2f7ed7838..0cee9a5de29f61 100644 --- a/lld/test/wasm/lto/libcall-archive.ll +++ b/lld/test/wasm/lto/libcall-archive.ll @@ -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 diff --git a/lld/test/wasm/lto/stub-library-libcall.s b/lld/test/wasm/lto/stub-library-libcall.s index d65983c0cf5bf5..40e15933f7bc39 100644 --- a/lld/test/wasm/lto/stub-library-libcall.s +++ b/lld/test/wasm/lto/stub-library-libcall.s @@ -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 @@ -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 diff --git a/lld/test/wasm/multi-table.s b/lld/test/wasm/multi-table.s index bf905ac748f9fb..3129093a25c7fb 100644 --- a/lld/test/wasm/multi-table.s +++ b/lld/test/wasm/multi-table.s @@ -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: diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td index ba394dacd7b038..79d6f21517e5d4 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td @@ -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 pattern_r, string asmstr_r = "", string asmstr_s = "", bits<32> simdop = -1> { defm "" : I; + !or(0xfc00, !and(0xff, simdop))>, + Requires<[HasBulkMemoryOpt]>; } // Bespoke types and nodes for bulk memory ops @@ -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 : @@ -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]>; } diff --git a/llvm/test/CodeGen/WebAssembly/call-indirect.ll b/llvm/test/CodeGen/WebAssembly/call-indirect.ll index 3196b4ffdd4455..e0a0d14deacba0 100644 --- a/llvm/test/CodeGen/WebAssembly/call-indirect.ll +++ b/llvm/test/CodeGen/WebAssembly/call-indirect.ll @@ -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 diff --git a/llvm/test/CodeGen/WebAssembly/disable-feature.ll b/llvm/test/CodeGen/WebAssembly/disable-feature.ll index 0684432a114dfc..5f7275f3699ede 100644 --- a/llvm/test/CodeGen/WebAssembly/disable-feature.ll +++ b/llvm/test/CodeGen/WebAssembly/disable-feature.ll @@ -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" @@ -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) diff --git a/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll b/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll index 9a517f105beb1f..1c77ad5c049a59 100644 --- a/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll +++ b/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll @@ -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 @@ -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" @@ -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"