Skip to content
Open
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
49 changes: 49 additions & 0 deletions tests/misc_testsuite/gc/const-expr-gc-simd.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
;;! gc = true
;;! simd = true

;; Tests for GC const-expression evaluation with SIMD types.

;; Simple v128.const global
(module
(global $g v128 (v128.const i32x4 1 2 3 4))

(func (export "v128-simple") (result v128)
(global.get $g)
)
)
(assert_return (invoke "v128-simple") (v128.const i32x4 1 2 3 4))

;; struct.new_default with a v128 field
(module
(type $s (struct (field v128)))

(global $g anyref (struct.new_default $s))

(func (export "v128-struct-default") (result v128)
(struct.get $s 0 (ref.cast (ref $s) (global.get $g)))
)
)
(assert_return (invoke "v128-struct-default") (v128.const i32x4 0 0 0 0))

;; array.new_fixed with v128.const elements
(module
(type $arr (array v128))

(global $g anyref (array.new_fixed $arr 2
(v128.const i32x4 1 2 3 4)
(v128.const i32x4 5 6 7 8)
))

(func (export "v128-array-len") (result i32)
(array.len (ref.cast (ref $arr) (global.get $g)))
)
(func (export "v128-array-elem0") (result v128)
(array.get $arr (ref.cast (ref $arr) (global.get $g)) (i32.const 0))
)
(func (export "v128-array-elem1") (result v128)
(array.get $arr (ref.cast (ref $arr) (global.get $g)) (i32.const 1))
)
)
(assert_return (invoke "v128-array-len") (i32.const 2))
(assert_return (invoke "v128-array-elem0") (v128.const i32x4 1 2 3 4))
(assert_return (invoke "v128-array-elem1") (v128.const i32x4 5 6 7 8))
Loading