github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/integration_test/spectest/v2/testdata/simd_store64_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.store64_lane_0")
     8      (param $address i32) (param $x v128) (result i64) (local $ret i64)
     9      (v128.store64_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.store64_lane_1")
    13      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    14      (v128.store64_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.store64_lane_0_offset_0")
    18      (param $x v128) (result i64) (local $ret i64)
    19      (v128.store64_lane offset=0 0 (i32.const 0) (local.get $x))
    20      (local.set $ret (i64.load offset=0 (i32.const 0)))
    21      (v128.store offset=0 (i32.const 0) (global.get $zero))
    22      (local.get $ret))
    23    (func (export "v128.store64_lane_1_offset_1")
    24      (param $x v128) (result i64) (local $ret i64)
    25      (v128.store64_lane offset=1 1 (i32.const 0) (local.get $x))
    26      (local.set $ret (i64.load offset=1 (i32.const 0)))
    27      (v128.store offset=1 (i32.const 0) (global.get $zero))
    28      (local.get $ret))
    29    (func (export "v128.store64_lane_0_align_1")
    30      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    31      (v128.store64_lane align=1 0 (local.get $address) (local.get $x))
    32      (local.set $ret (i64.load (local.get $address)))
    33      (v128.store offset=0 (i32.const 0) (global.get $zero))
    34      (local.get $ret))
    35    (func (export "v128.store64_lane_0_align_2")
    36      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    37      (v128.store64_lane align=2 0 (local.get $address) (local.get $x))
    38      (local.set $ret (i64.load (local.get $address)))
    39      (v128.store offset=0 (i32.const 0) (global.get $zero))
    40      (local.get $ret))
    41    (func (export "v128.store64_lane_0_align_4")
    42      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    43      (v128.store64_lane align=4 0 (local.get $address) (local.get $x))
    44      (local.set $ret (i64.load (local.get $address)))
    45      (v128.store offset=0 (i32.const 0) (global.get $zero))
    46      (local.get $ret))
    47    (func (export "v128.store64_lane_0_align_8")
    48      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    49      (v128.store64_lane align=8 0 (local.get $address) (local.get $x))
    50      (local.set $ret (i64.load (local.get $address)))
    51      (v128.store offset=0 (i32.const 0) (global.get $zero))
    52      (local.get $ret))
    53    (func (export "v128.store64_lane_1_align_1")
    54      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    55      (v128.store64_lane align=1 1 (local.get $address) (local.get $x))
    56      (local.set $ret (i64.load (local.get $address)))
    57      (v128.store offset=1 (i32.const 0) (global.get $zero))
    58      (local.get $ret))
    59    (func (export "v128.store64_lane_1_align_2")
    60      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    61      (v128.store64_lane align=2 1 (local.get $address) (local.get $x))
    62      (local.set $ret (i64.load (local.get $address)))
    63      (v128.store offset=1 (i32.const 0) (global.get $zero))
    64      (local.get $ret))
    65    (func (export "v128.store64_lane_1_align_4")
    66      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    67      (v128.store64_lane align=4 1 (local.get $address) (local.get $x))
    68      (local.set $ret (i64.load (local.get $address)))
    69      (v128.store offset=1 (i32.const 0) (global.get $zero))
    70      (local.get $ret))
    71    (func (export "v128.store64_lane_1_align_8")
    72      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    73      (v128.store64_lane align=8 1 (local.get $address) (local.get $x))
    74      (local.set $ret (i64.load (local.get $address)))
    75      (v128.store offset=1 (i32.const 0) (global.get $zero))
    76      (local.get $ret))
    77  )
    78  
    79  (assert_return (invoke "v128.store64_lane_0" (i32.const 0)
    80                                               (v128.const i64x2 506097522914230528 0))
    81                                               (i64.const 506097522914230528))
    82  (assert_return (invoke "v128.store64_lane_1" (i32.const 1)
    83                                               (v128.const i64x2 0 578437695752307201))
    84                                               (i64.const 578437695752307201))
    85  (assert_return (invoke "v128.store64_lane_0_offset_0" (v128.const i64x2 506097522914230528 0))
    86                                                        (i64.const 506097522914230528))
    87  (assert_return (invoke "v128.store64_lane_1_offset_1" (v128.const i64x2 0 578437695752307201))
    88                                                        (i64.const 578437695752307201))
    89  (assert_return (invoke "v128.store64_lane_0_align_1" (i32.const 0)
    90                                                       (v128.const i64x2 506097522914230528 0))
    91                                                       (i64.const 506097522914230528))
    92  (assert_return (invoke "v128.store64_lane_0_align_2" (i32.const 0)
    93                                                       (v128.const i64x2 506097522914230528 0))
    94                                                       (i64.const 506097522914230528))
    95  (assert_return (invoke "v128.store64_lane_0_align_4" (i32.const 0)
    96                                                       (v128.const i64x2 506097522914230528 0))
    97                                                       (i64.const 506097522914230528))
    98  (assert_return (invoke "v128.store64_lane_0_align_8" (i32.const 0)
    99                                                       (v128.const i64x2 506097522914230528 0))
   100                                                       (i64.const 506097522914230528))
   101  (assert_return (invoke "v128.store64_lane_1_align_1" (i32.const 1)
   102                                                       (v128.const i64x2 0 578437695752307201))
   103                                                       (i64.const 578437695752307201))
   104  (assert_return (invoke "v128.store64_lane_1_align_2" (i32.const 1)
   105                                                       (v128.const i64x2 0 578437695752307201))
   106                                                       (i64.const 578437695752307201))
   107  (assert_return (invoke "v128.store64_lane_1_align_4" (i32.const 1)
   108                                                       (v128.const i64x2 0 578437695752307201))
   109                                                       (i64.const 578437695752307201))
   110  (assert_return (invoke "v128.store64_lane_1_align_8" (i32.const 1)
   111                                                       (v128.const i64x2 0 578437695752307201))
   112                                                       (i64.const 578437695752307201))
   113  
   114  ;; type check
   115  (assert_invalid  (module (memory 1)
   116            (func (param $x v128) (result v128)
   117              (v128.store64_lane 0 (local.get $x) (i32.const 0))))
   118    "type mismatch")
   119  
   120  ;; invalid lane index
   121  (assert_invalid  (module (memory 1)
   122            (func (param $x v128) (result v128)
   123              (v128.store64_lane 2 (i32.const 0) (local.get $x))))
   124    "invalid lane index")
   125  
   126  ;; invalid memarg alignment
   127  (assert_invalid
   128    (module (memory 1)
   129            (func (param $x v128) (result v128)
   130            (v128.store64_lane align=16 0 (i32.const 0) (local.get $x))))
   131    "alignment must not be larger than natural")