From c79548b93a81ccf7609413da1345a7570c51b9ba Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 7 Dec 2022 16:06:53 -0600 Subject: Add standard versions of WasmGC casts (#5331) We previously supported only the non-standard cast instructions introduced when we were experimenting with nominal types. Parse the names and opcodes of their standard counterparts and switch to emitting the standard names and opcodes. Port all of the tests to use the standard instructions, but add additional tests showing that the non-standard versions are still parsed correctly. --- test/lit/binary/legacy-static-casts.test | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/lit/binary/legacy-static-casts.test (limited to 'test/lit/binary/legacy-static-casts.test') diff --git a/test/lit/binary/legacy-static-casts.test b/test/lit/binary/legacy-static-casts.test new file mode 100644 index 000000000..53218ba65 --- /dev/null +++ b/test/lit/binary/legacy-static-casts.test @@ -0,0 +1,40 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; Test that the opcodes for the deprecated *_static cast instructions still parse. + +;; RUN: wasm-opt %s.wasm -all -S -o - | filecheck %s +;; CHECK: (type ${} (struct )) + +;; CHECK: (type $none_=>_none (func)) + +;; CHECK: (func $0 (type $none_=>_none) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (ref.test ${} +;; CHECK-NEXT: (ref.null none) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (ref.cast null ${} +;; CHECK-NEXT: (ref.null none) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (ref.cast_nop ${} +;; CHECK-NEXT: (ref.null none) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (block $label$1 (result (ref null ${})) +;; CHECK-NEXT: (br_on_cast $label$1 ${} +;; CHECK-NEXT: (ref.null none) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (block $label$2 (result (ref null ${})) +;; CHECK-NEXT: (br_on_cast_fail $label$2 ${} +;; CHECK-NEXT: (ref.null none) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) -- cgit v1.2.3