summaryrefslogtreecommitdiff
path: root/test/lit/basic/shared-i31.wast
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-07-12 16:48:06 -0400
committerGitHub <noreply@github.com>2024-07-12 13:48:06 -0700
commiteda6530a187add28f06d9ab84d78b21b5001a6df (patch)
treeb731f8dc5a32a1b8e969f47f82f497909a236c71 /test/lit/basic/shared-i31.wast
parent0e0e08db6280dec4f4fcce2dff3ba07445c45b8a (diff)
downloadbinaryen-eda6530a187add28f06d9ab84d78b21b5001a6df.tar.gz
binaryen-eda6530a187add28f06d9ab84d78b21b5001a6df.tar.bz2
binaryen-eda6530a187add28f06d9ab84d78b21b5001a6df.zip
[threads] ref.i31_shared (#6735)
Implement `ref.i31_shared` the new instruction for creating references to shared i31s. Implement binary and text parsing and emitting as well as interpretation. Copy the upstream spec test for i31 and modify it so that all the heap types are shared. Comment out some parts that we do not yet support.
Diffstat (limited to 'test/lit/basic/shared-i31.wast')
-rw-r--r--test/lit/basic/shared-i31.wast37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/lit/basic/shared-i31.wast b/test/lit/basic/shared-i31.wast
new file mode 100644
index 000000000..b448bcad3
--- /dev/null
+++ b/test/lit/basic/shared-i31.wast
@@ -0,0 +1,37 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: wasm-opt %s -all -S -o - | filecheck %s
+;; RUN: wasm-opt %s -all --roundtrip -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (type $0 (func (param (ref null (shared i31))) (result i32)))
+
+ ;; CHECK: (type $1 (func (param i32) (result (ref (shared i31)))))
+
+ ;; CHECK: (func $make (type $1) (param $0 i32) (result (ref (shared i31)))
+ ;; CHECK-NEXT: (ref.i31_shared
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $make (param i32) (result (ref (shared i31)))
+ (ref.i31_shared (local.get 0))
+ )
+
+ ;; CHECK: (func $get_s (type $0) (param $0 (ref null (shared i31))) (result i32)
+ ;; CHECK-NEXT: (i31.get_s
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $get_s (param (ref null (shared i31))) (result i32)
+ (i31.get_s (local.get 0))
+ )
+
+ ;; CHECK: (func $get_u (type $0) (param $0 (ref null (shared i31))) (result i32)
+ ;; CHECK-NEXT: (i31.get_u
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $get_u (param (ref null (shared i31))) (result i32)
+ (i31.get_u (local.get 0))
+ )
+)