...

Text file src/github.com/tetratelabs/wazero/internal/integration_test/spectest/v2/testdata/simd_store.wast

Documentation: github.com/tetratelabs/wazero/internal/integration_test/spectest/v2/testdata

     1;; v128.store operater with normal argument (e.g. (i8x16, i16x8, i32x4, f32x4))
     2
     3(module
     4  (memory 1)
     5  (func (export "v128.store_i8x16") (result v128)
     6    (v128.store (i32.const 0) (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
     7    (v128.load (i32.const 0))
     8  )
     9  (func (export "v128.store_i16x8") (result v128)
    10    (v128.store (i32.const 0) (v128.const i16x8 0 1 2 3 4 5 6 7))
    11    (v128.load (i32.const 0))
    12  )
    13  (func (export "v128.store_i16x8_2") (result v128)
    14    (v128.store (i32.const 0) (v128.const i16x8 012_345 012_345 012_345 012_345 012_345 012_345 012_345 012_345))
    15    (v128.load (i32.const 0))
    16  )
    17  (func (export "v128.store_i16x8_3") (result v128)
    18    (v128.store (i32.const 0) (v128.const i16x8 0x0_1234 0x0_1234 0x0_1234 0x0_1234 0x0_1234 0x0_1234 0x0_1234 0x0_1234))
    19    (v128.load (i32.const 0))
    20  )
    21  (func (export "v128.store_i32x4") (result v128)
    22    (v128.store (i32.const 0) (v128.const i32x4 0 1 2 3))
    23    (v128.load (i32.const 0))
    24  )
    25  (func (export "v128.store_i32x4_2") (result v128)
    26    (v128.store (i32.const 0) (v128.const i32x4 0_123_456_789 0_123_456_789 0_123_456_789 0_123_456_789))
    27    (v128.load (i32.const 0))
    28  )
    29  (func (export "v128.store_i32x4_3") (result v128)
    30    (v128.store (i32.const 0) (v128.const i32x4 0x0_1234_5678 0x0_1234_5678 0x0_1234_5678 0x0_1234_5678))
    31    (v128.load (i32.const 0))
    32  )
    33
    34  (func (export "v128.store_f32x4") (result v128)
    35    (v128.store (i32.const 0) (v128.const f32x4 0 1 2 3))
    36    (v128.load (i32.const 0))
    37  )
    38)
    39
    40(assert_return (invoke "v128.store_i8x16") (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
    41(assert_return (invoke "v128.store_i16x8") (v128.const i16x8 0 1 2 3 4 5 6 7))
    42(assert_return (invoke "v128.store_i16x8_2") (v128.const i16x8 12345 12345 12345 12345 12345 12345 12345 12345))
    43(assert_return (invoke "v128.store_i16x8_3") (v128.const i16x8 0x1234 0x1234 0x1234 0x1234 0x1234 0x1234 0x1234 0x1234))
    44(assert_return (invoke "v128.store_i32x4") (v128.const i32x4 0 1 2 3))
    45(assert_return (invoke "v128.store_i32x4_2") (v128.const i32x4 123456789 123456789 123456789 123456789))
    46(assert_return (invoke "v128.store_i32x4_3") (v128.const i32x4 0x12345678 0x12345678 0x12345678 0x12345678))
    47(assert_return (invoke "v128.store_f32x4") (v128.const f32x4 0 1 2 3))
    48
    49
    50;; v128.store operator as the argument of control constructs and instructions
    51
    52(module
    53  (memory 1)
    54  (func (export "as-block-value")
    55    (block (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0)))
    56  )
    57  (func (export "as-loop-value")
    58    (loop (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0)))
    59  )
    60  (func (export "as-br-value")
    61    (block (br 0 (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0))))
    62  )
    63  (func (export "as-br_if-value")
    64    (block
    65      (br_if 0 (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0)) (i32.const 1))
    66    )
    67  )
    68  (func (export "as-br_if-value-cond")
    69    (block
    70      (br_if 0 (i32.const 6) (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0)))
    71    )
    72  )
    73  (func (export "as-br_table-value")
    74    (block
    75      (br_table 0 (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0)) (i32.const 1))
    76    )
    77  )
    78  (func (export "as-return-value")
    79    (return (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0)))
    80  )
    81  (func (export "as-if-then")
    82    (if (i32.const 1) (then (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0))))
    83  )
    84  (func (export "as-if-else")
    85    (if (i32.const 0) (then) (else (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0))))
    86  )
    87)
    88
    89(assert_return (invoke "as-block-value"))
    90(assert_return (invoke "as-loop-value"))
    91(assert_return (invoke "as-br-value"))
    92(assert_return (invoke "as-br_if-value"))
    93(assert_return (invoke "as-br_if-value-cond"))
    94(assert_return (invoke "as-br_table-value"))
    95(assert_return (invoke "as-return-value"))
    96(assert_return (invoke "as-if-then"))
    97(assert_return (invoke "as-if-else"))
    98
    99
   100;; Unknown operator(e.g. v128.store8, v128.store16, v128.store32)
   101
   102(assert_malformed
   103  (module quote
   104    "(memory 1)"
   105    "(func (v128.store8 (i32.const 0) (v128.const i32x4 0 0 0 0)))"
   106  )
   107  "unknown operator"
   108)
   109(assert_malformed
   110  (module quote
   111    "(memory 1)"
   112    "(func (v128.store16 (i32.const 0) (v128.const i32x4 0 0 0 0)))"
   113  )
   114  "unknown operator"
   115)
   116(assert_malformed
   117  (module quote
   118    "(memory 1)"
   119    "(func (v128.store32 (i32.const 0) (v128.const i32x4 0 0 0 0)))"
   120  )
   121  "unknown operator"
   122)
   123
   124
   125;; Type mismatched (e.g. v128.load(f32.const 0), type address empty)
   126
   127(assert_invalid
   128  (module (memory 1) (func (v128.store (f32.const 0) (v128.const i32x4 0 0 0 0))))
   129  "type mismatch"
   130)
   131(assert_invalid
   132  (module (memory 1) (func (local v128) (block (br_if 0 (v128.store)))))
   133  "type mismatch"
   134)
   135(assert_invalid
   136  (module (memory 1) (func (result v128) (v128.store (i32.const 0) (v128.const i32x4 0 0 0 0))))
   137  "type mismatch"
   138)
   139
   140
   141;; Test operation with empty argument
   142
   143(assert_invalid
   144  (module (memory 0)
   145    (func $v128.store-1st-arg-empty
   146      (v128.store (v128.const i32x4 0 0 0 0))
   147    )
   148  )
   149  "type mismatch"
   150)
   151(assert_invalid
   152  (module (memory 0)
   153    (func $v128.store-2nd-arg-empty
   154      (v128.store (i32.const 0))
   155    )
   156  )
   157  "type mismatch"
   158)
   159(assert_invalid
   160  (module (memory 0)
   161    (func $v128.store-arg-empty
   162      (v128.store)
   163    )
   164  )
   165  "type mismatch"
   166)

View as plain text