wa-lang.org/wazero@v1.0.2/internal/integration_test/spectest/v2/testdata/simd_store32_lane.wast (about)

     1  ;; Tests for store lane operations.
     2  
     3  
     4  (module
     5    (memory 1)
     6    (global $zero (mut v128) (v128.const i32x4 0 0 0 0))
     7    (func (export "v128.store32_lane_0")
     8      (param $address i32) (param $x v128) (result i64) (local $ret i64)
     9      (v128.store32_lane 0 (local.get $address) (local.get $x))
    10      (local.set $ret (i64.load (local.get $address)))
    11      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    12    (func (export "v128.store32_lane_1")
    13      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    14      (v128.store32_lane 1 (local.get $address) (local.get $x))
    15      (local.set $ret (i64.load (local.get $address)))
    16      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    17    (func (export "v128.store32_lane_2")
    18      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    19      (v128.store32_lane 2 (local.get $address) (local.get $x))
    20      (local.set $ret (i64.load (local.get $address)))
    21      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    22    (func (export "v128.store32_lane_3")
    23      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    24      (v128.store32_lane 3 (local.get $address) (local.get $x))
    25      (local.set $ret (i64.load (local.get $address)))
    26      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    27    (func (export "v128.store32_lane_0_offset_0")
    28      (param $x v128) (result i64) (local $ret i64)
    29      (v128.store32_lane offset=0 0 (i32.const 0) (local.get $x))
    30      (local.set $ret (i64.load offset=0 (i32.const 0)))
    31      (v128.store offset=0 (i32.const 0) (global.get $zero))
    32      (local.get $ret))
    33    (func (export "v128.store32_lane_1_offset_1")
    34      (param $x v128) (result i64) (local $ret i64)
    35      (v128.store32_lane offset=1 1 (i32.const 0) (local.get $x))
    36      (local.set $ret (i64.load offset=1 (i32.const 0)))
    37      (v128.store offset=1 (i32.const 0) (global.get $zero))
    38      (local.get $ret))
    39    (func (export "v128.store32_lane_2_offset_2")
    40      (param $x v128) (result i64) (local $ret i64)
    41      (v128.store32_lane offset=2 2 (i32.const 0) (local.get $x))
    42      (local.set $ret (i64.load offset=2 (i32.const 0)))
    43      (v128.store offset=2 (i32.const 0) (global.get $zero))
    44      (local.get $ret))
    45    (func (export "v128.store32_lane_3_offset_3")
    46      (param $x v128) (result i64) (local $ret i64)
    47      (v128.store32_lane offset=3 3 (i32.const 0) (local.get $x))
    48      (local.set $ret (i64.load offset=3 (i32.const 0)))
    49      (v128.store offset=3 (i32.const 0) (global.get $zero))
    50      (local.get $ret))
    51    (func (export "v128.store32_lane_0_align_1")
    52      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    53      (v128.store32_lane align=1 0 (local.get $address) (local.get $x))
    54      (local.set $ret (i64.load (local.get $address)))
    55      (v128.store offset=0 (i32.const 0) (global.get $zero))
    56      (local.get $ret))
    57    (func (export "v128.store32_lane_0_align_2")
    58      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    59      (v128.store32_lane align=2 0 (local.get $address) (local.get $x))
    60      (local.set $ret (i64.load (local.get $address)))
    61      (v128.store offset=0 (i32.const 0) (global.get $zero))
    62      (local.get $ret))
    63    (func (export "v128.store32_lane_0_align_4")
    64      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    65      (v128.store32_lane align=4 0 (local.get $address) (local.get $x))
    66      (local.set $ret (i64.load (local.get $address)))
    67      (v128.store offset=0 (i32.const 0) (global.get $zero))
    68      (local.get $ret))
    69    (func (export "v128.store32_lane_1_align_1")
    70      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    71      (v128.store32_lane align=1 1 (local.get $address) (local.get $x))
    72      (local.set $ret (i64.load (local.get $address)))
    73      (v128.store offset=1 (i32.const 0) (global.get $zero))
    74      (local.get $ret))
    75    (func (export "v128.store32_lane_1_align_2")
    76      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    77      (v128.store32_lane align=2 1 (local.get $address) (local.get $x))
    78      (local.set $ret (i64.load (local.get $address)))
    79      (v128.store offset=1 (i32.const 0) (global.get $zero))
    80      (local.get $ret))
    81    (func (export "v128.store32_lane_1_align_4")
    82      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    83      (v128.store32_lane align=4 1 (local.get $address) (local.get $x))
    84      (local.set $ret (i64.load (local.get $address)))
    85      (v128.store offset=1 (i32.const 0) (global.get $zero))
    86      (local.get $ret))
    87    (func (export "v128.store32_lane_2_align_1")
    88      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    89      (v128.store32_lane align=1 2 (local.get $address) (local.get $x))
    90      (local.set $ret (i64.load (local.get $address)))
    91      (v128.store offset=2 (i32.const 0) (global.get $zero))
    92      (local.get $ret))
    93    (func (export "v128.store32_lane_2_align_2")
    94      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    95      (v128.store32_lane align=2 2 (local.get $address) (local.get $x))
    96      (local.set $ret (i64.load (local.get $address)))
    97      (v128.store offset=2 (i32.const 0) (global.get $zero))
    98      (local.get $ret))
    99    (func (export "v128.store32_lane_2_align_4")
   100      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   101      (v128.store32_lane align=4 2 (local.get $address) (local.get $x))
   102      (local.set $ret (i64.load (local.get $address)))
   103      (v128.store offset=2 (i32.const 0) (global.get $zero))
   104      (local.get $ret))
   105    (func (export "v128.store32_lane_3_align_1")
   106      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   107      (v128.store32_lane align=1 3 (local.get $address) (local.get $x))
   108      (local.set $ret (i64.load (local.get $address)))
   109      (v128.store offset=3 (i32.const 0) (global.get $zero))
   110      (local.get $ret))
   111    (func (export "v128.store32_lane_3_align_2")
   112      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   113      (v128.store32_lane align=2 3 (local.get $address) (local.get $x))
   114      (local.set $ret (i64.load (local.get $address)))
   115      (v128.store offset=3 (i32.const 0) (global.get $zero))
   116      (local.get $ret))
   117    (func (export "v128.store32_lane_3_align_4")
   118      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   119      (v128.store32_lane align=4 3 (local.get $address) (local.get $x))
   120      (local.set $ret (i64.load (local.get $address)))
   121      (v128.store offset=3 (i32.const 0) (global.get $zero))
   122      (local.get $ret))
   123  )
   124  
   125  (assert_return (invoke "v128.store32_lane_0" (i32.const 0)
   126                                               (v128.const i32x4 50462976 0 0 0))
   127                                               (i64.const 50462976))
   128  (assert_return (invoke "v128.store32_lane_1" (i32.const 1)
   129                                               (v128.const i32x4 0 67305985 0 0))
   130                                               (i64.const 67305985))
   131  (assert_return (invoke "v128.store32_lane_2" (i32.const 2)
   132                                               (v128.const i32x4 0 0 84148994 0))
   133                                               (i64.const 84148994))
   134  (assert_return (invoke "v128.store32_lane_3" (i32.const 3)
   135                                               (v128.const i32x4 0 0 0 100992003))
   136                                               (i64.const 100992003))
   137  (assert_return (invoke "v128.store32_lane_0_offset_0" (v128.const i32x4 50462976 0 0 0))
   138                                                        (i64.const 50462976))
   139  (assert_return (invoke "v128.store32_lane_1_offset_1" (v128.const i32x4 0 67305985 0 0))
   140                                                        (i64.const 67305985))
   141  (assert_return (invoke "v128.store32_lane_2_offset_2" (v128.const i32x4 0 0 84148994 0))
   142                                                        (i64.const 84148994))
   143  (assert_return (invoke "v128.store32_lane_3_offset_3" (v128.const i32x4 0 0 0 100992003))
   144                                                        (i64.const 100992003))
   145  (assert_return (invoke "v128.store32_lane_0_align_1" (i32.const 0)
   146                                                       (v128.const i32x4 50462976 0 0 0))
   147                                                       (i64.const 50462976))
   148  (assert_return (invoke "v128.store32_lane_0_align_2" (i32.const 0)
   149                                                       (v128.const i32x4 50462976 0 0 0))
   150                                                       (i64.const 50462976))
   151  (assert_return (invoke "v128.store32_lane_0_align_4" (i32.const 0)
   152                                                       (v128.const i32x4 50462976 0 0 0))
   153                                                       (i64.const 50462976))
   154  (assert_return (invoke "v128.store32_lane_1_align_1" (i32.const 1)
   155                                                       (v128.const i32x4 0 67305985 0 0))
   156                                                       (i64.const 67305985))
   157  (assert_return (invoke "v128.store32_lane_1_align_2" (i32.const 1)
   158                                                       (v128.const i32x4 0 67305985 0 0))
   159                                                       (i64.const 67305985))
   160  (assert_return (invoke "v128.store32_lane_1_align_4" (i32.const 1)
   161                                                       (v128.const i32x4 0 67305985 0 0))
   162                                                       (i64.const 67305985))
   163  (assert_return (invoke "v128.store32_lane_2_align_1" (i32.const 2)
   164                                                       (v128.const i32x4 0 0 84148994 0))
   165                                                       (i64.const 84148994))
   166  (assert_return (invoke "v128.store32_lane_2_align_2" (i32.const 2)
   167                                                       (v128.const i32x4 0 0 84148994 0))
   168                                                       (i64.const 84148994))
   169  (assert_return (invoke "v128.store32_lane_2_align_4" (i32.const 2)
   170                                                       (v128.const i32x4 0 0 84148994 0))
   171                                                       (i64.const 84148994))
   172  (assert_return (invoke "v128.store32_lane_3_align_1" (i32.const 3)
   173                                                       (v128.const i32x4 0 0 0 100992003))
   174                                                       (i64.const 100992003))
   175  (assert_return (invoke "v128.store32_lane_3_align_2" (i32.const 3)
   176                                                       (v128.const i32x4 0 0 0 100992003))
   177                                                       (i64.const 100992003))
   178  (assert_return (invoke "v128.store32_lane_3_align_4" (i32.const 3)
   179                                                       (v128.const i32x4 0 0 0 100992003))
   180                                                       (i64.const 100992003))
   181  
   182  ;; type check
   183  (assert_invalid  (module (memory 1)
   184            (func (param $x v128) (result v128)
   185              (v128.store32_lane 0 (local.get $x) (i32.const 0))))
   186    "type mismatch")
   187  
   188  ;; invalid lane index
   189  (assert_invalid  (module (memory 1)
   190            (func (param $x v128) (result v128)
   191              (v128.store32_lane 4 (i32.const 0) (local.get $x))))
   192    "invalid lane index")
   193  
   194  ;; invalid memarg alignment
   195  (assert_invalid
   196    (module (memory 1)
   197            (func (param $x v128) (result v128)
   198            (v128.store32_lane align=8 0 (i32.const 0) (local.get $x))))
   199    "alignment must not be larger than natural")