blob: 807c5827120a72595dc9361e7e784b6012b9c42f [file]
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: wasm-ctor-eval %s --ctors=test --kept-exports= --quiet -all -S -o - | filecheck %s
;; Multibyte stores are evaluated at compile time, and the resulting array
;; contents are serialized back into the module as elements of the array's
;; element type.
(module
;; CHECK: (type $i32_array (array (mut i32)))
(type $i32_array (array (mut i32)))
;; CHECK: (type $i16_array (array (mut i16)))
(type $i16_array (array (mut i16)))
;; CHECK: (type $v128_array (array (mut v128)))
(type $v128_array (array (mut v128)))
;; CHECK: (global $ctor-eval$global_12 (ref (exact $i32_array)) (array.new_fixed $i32_array 4
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: (i32.const 2)
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: ))
;; CHECK: (global $ctor-eval$global_13 (ref (exact $i16_array)) (array.new_fixed $i16_array 4
;; CHECK-NEXT: (i32.const 256)
;; CHECK-NEXT: (i32.const 2)
;; CHECK-NEXT: (i32.const 3)
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: ))
;; CHECK: (global $ctor-eval$global_14 (ref (exact $v128_array)) (array.new_fixed $v128_array 1
;; CHECK-NEXT: (v128.const i32x4 0x00000001 0x00000002 0x00000003 0x00000004)
;; CHECK-NEXT: ))
;; CHECK: (global $i32 (mut (ref null $i32_array)) (global.get $ctor-eval$global_12))
(global $i32 (export "i32") (mut (ref null $i32_array)) (ref.null $i32_array))
;; CHECK: (global $i16 (mut (ref null $i16_array)) (global.get $ctor-eval$global_13))
(global $i16 (export "i16") (mut (ref null $i16_array)) (ref.null $i16_array))
;; CHECK: (global $v128 (mut (ref null $v128_array)) (global.get $ctor-eval$global_14))
(global $v128 (export "v128") (mut (ref null $v128_array)) (ref.null $v128_array))
(func $test (export "test")
;; An i64 store covers two i32 elements.
(global.set $i32 (array.new_default $i32_array (i32.const 4)))
(i64.store (type $i32_array) (global.get $i32) (i32.const 4)
(i64.const 0x0000000200000001)
)
;; An unaligned i32 store covers parts of three i16 elements.
(global.set $i16 (array.new_default $i16_array (i32.const 4)))
(i32.store (type $i16_array) offset=1 (global.get $i16) (i32.const 0)
(i32.const 0x03000201)
)
;; A v128 store covers an entire v128 element.
(global.set $v128 (array.new_default $v128_array (i32.const 1)))
(v128.store (type $v128_array) (global.get $v128) (i32.const 0)
(v128.const i32x4 1 2 3 4)
)
)
)
;; CHECK: (export "i32" (global $i32))
;; CHECK: (export "i16" (global $i16))
;; CHECK: (export "v128" (global $v128))