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

     1  ;; Tests for load lane operations.
     2  
     3  
     4  (module
     5    (memory 1)
     6    (data (i32.const 0) "\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F")
     7    (func (export "v128.load32_lane_0")
     8      (param $address i32) (param $x v128) (result v128)
     9      (v128.load32_lane 0 (local.get $address) (local.get $x)))
    10    (func (export "v128.load32_lane_1")
    11      (param $address i32) (param $x v128) (result v128)
    12      (v128.load32_lane 1 (local.get $address) (local.get $x)))
    13    (func (export "v128.load32_lane_2")
    14      (param $address i32) (param $x v128) (result v128)
    15      (v128.load32_lane 2 (local.get $address) (local.get $x)))
    16    (func (export "v128.load32_lane_3")
    17      (param $address i32) (param $x v128) (result v128)
    18      (v128.load32_lane 3 (local.get $address) (local.get $x)))
    19    (func (export "v128.load32_lane_0_offset_0")
    20      (param $x v128) (result v128)
    21      (v128.load32_lane offset=0 0 (i32.const 0) (local.get $x)))
    22    (func (export "v128.load32_lane_1_offset_1")
    23      (param $x v128) (result v128)
    24      (v128.load32_lane offset=1 1 (i32.const 0) (local.get $x)))
    25    (func (export "v128.load32_lane_2_offset_2")
    26      (param $x v128) (result v128)
    27      (v128.load32_lane offset=2 2 (i32.const 0) (local.get $x)))
    28    (func (export "v128.load32_lane_3_offset_3")
    29      (param $x v128) (result v128)
    30      (v128.load32_lane offset=3 3 (i32.const 0) (local.get $x)))
    31    (func (export "v128.load32_lane_0_align_1")
    32      (param $address i32) (param $x v128) (result v128)
    33      (v128.load32_lane align=1 0 (local.get $address) (local.get $x)))
    34    (func (export "v128.load32_lane_0_align_2")
    35      (param $address i32) (param $x v128) (result v128)
    36      (v128.load32_lane align=2 0 (local.get $address) (local.get $x)))
    37    (func (export "v128.load32_lane_0_align_4")
    38      (param $address i32) (param $x v128) (result v128)
    39      (v128.load32_lane align=4 0 (local.get $address) (local.get $x)))
    40    (func (export "v128.load32_lane_1_align_1")
    41      (param $address i32) (param $x v128) (result v128)
    42      (v128.load32_lane align=1 1 (local.get $address) (local.get $x)))
    43    (func (export "v128.load32_lane_1_align_2")
    44      (param $address i32) (param $x v128) (result v128)
    45      (v128.load32_lane align=2 1 (local.get $address) (local.get $x)))
    46    (func (export "v128.load32_lane_1_align_4")
    47      (param $address i32) (param $x v128) (result v128)
    48      (v128.load32_lane align=4 1 (local.get $address) (local.get $x)))
    49    (func (export "v128.load32_lane_2_align_1")
    50      (param $address i32) (param $x v128) (result v128)
    51      (v128.load32_lane align=1 2 (local.get $address) (local.get $x)))
    52    (func (export "v128.load32_lane_2_align_2")
    53      (param $address i32) (param $x v128) (result v128)
    54      (v128.load32_lane align=2 2 (local.get $address) (local.get $x)))
    55    (func (export "v128.load32_lane_2_align_4")
    56      (param $address i32) (param $x v128) (result v128)
    57      (v128.load32_lane align=4 2 (local.get $address) (local.get $x)))
    58    (func (export "v128.load32_lane_3_align_1")
    59      (param $address i32) (param $x v128) (result v128)
    60      (v128.load32_lane align=1 3 (local.get $address) (local.get $x)))
    61    (func (export "v128.load32_lane_3_align_2")
    62      (param $address i32) (param $x v128) (result v128)
    63      (v128.load32_lane align=2 3 (local.get $address) (local.get $x)))
    64    (func (export "v128.load32_lane_3_align_4")
    65      (param $address i32) (param $x v128) (result v128)
    66      (v128.load32_lane align=4 3 (local.get $address) (local.get $x)))
    67  )
    68  
    69  (assert_return (invoke "v128.load32_lane_0" (i32.const 0)
    70                                              (v128.const i32x4 0 0 0 0))
    71                                              (v128.const i32x4 50462976 0 0 0))
    72  (assert_return (invoke "v128.load32_lane_1" (i32.const 1)
    73                                              (v128.const i32x4 0 0 0 0))
    74                                              (v128.const i32x4 0 67305985 0 0))
    75  (assert_return (invoke "v128.load32_lane_2" (i32.const 2)
    76                                              (v128.const i32x4 0 0 0 0))
    77                                              (v128.const i32x4 0 0 84148994 0))
    78  (assert_return (invoke "v128.load32_lane_3" (i32.const 3)
    79                                              (v128.const i32x4 0 0 0 0))
    80                                              (v128.const i32x4 0 0 0 100992003))
    81  (assert_return (invoke "v128.load32_lane_0_offset_0" (v128.const i32x4 0 0 0 0))
    82                                                       (v128.const i32x4 50462976 0 0 0))
    83  (assert_return (invoke "v128.load32_lane_1_offset_1" (v128.const i32x4 0 0 0 0))
    84                                                       (v128.const i32x4 0 67305985 0 0))
    85  (assert_return (invoke "v128.load32_lane_2_offset_2" (v128.const i32x4 0 0 0 0))
    86                                                       (v128.const i32x4 0 0 84148994 0))
    87  (assert_return (invoke "v128.load32_lane_3_offset_3" (v128.const i32x4 0 0 0 0))
    88                                                       (v128.const i32x4 0 0 0 100992003))
    89  (assert_return (invoke "v128.load32_lane_0_align_1" (i32.const 0)
    90                                                      (v128.const i32x4 0 0 0 0))
    91                                                      (v128.const i32x4 50462976 0 0 0))
    92  (assert_return (invoke "v128.load32_lane_0_align_2" (i32.const 0)
    93                                                      (v128.const i32x4 0 0 0 0))
    94                                                      (v128.const i32x4 50462976 0 0 0))
    95  (assert_return (invoke "v128.load32_lane_0_align_4" (i32.const 0)
    96                                                      (v128.const i32x4 0 0 0 0))
    97                                                      (v128.const i32x4 50462976 0 0 0))
    98  (assert_return (invoke "v128.load32_lane_1_align_1" (i32.const 1)
    99                                                      (v128.const i32x4 0 0 0 0))
   100                                                      (v128.const i32x4 0 67305985 0 0))
   101  (assert_return (invoke "v128.load32_lane_1_align_2" (i32.const 1)
   102                                                      (v128.const i32x4 0 0 0 0))
   103                                                      (v128.const i32x4 0 67305985 0 0))
   104  (assert_return (invoke "v128.load32_lane_1_align_4" (i32.const 1)
   105                                                      (v128.const i32x4 0 0 0 0))
   106                                                      (v128.const i32x4 0 67305985 0 0))
   107  (assert_return (invoke "v128.load32_lane_2_align_1" (i32.const 2)
   108                                                      (v128.const i32x4 0 0 0 0))
   109                                                      (v128.const i32x4 0 0 84148994 0))
   110  (assert_return (invoke "v128.load32_lane_2_align_2" (i32.const 2)
   111                                                      (v128.const i32x4 0 0 0 0))
   112                                                      (v128.const i32x4 0 0 84148994 0))
   113  (assert_return (invoke "v128.load32_lane_2_align_4" (i32.const 2)
   114                                                      (v128.const i32x4 0 0 0 0))
   115                                                      (v128.const i32x4 0 0 84148994 0))
   116  (assert_return (invoke "v128.load32_lane_3_align_1" (i32.const 3)
   117                                                      (v128.const i32x4 0 0 0 0))
   118                                                      (v128.const i32x4 0 0 0 100992003))
   119  (assert_return (invoke "v128.load32_lane_3_align_2" (i32.const 3)
   120                                                      (v128.const i32x4 0 0 0 0))
   121                                                      (v128.const i32x4 0 0 0 100992003))
   122  (assert_return (invoke "v128.load32_lane_3_align_4" (i32.const 3)
   123                                                      (v128.const i32x4 0 0 0 0))
   124                                                      (v128.const i32x4 0 0 0 100992003))
   125  
   126  ;; type check
   127  (assert_invalid  (module (memory 1)
   128            (func (param $x v128) (result v128)
   129              (v128.load32_lane 0 (local.get $x) (i32.const 0))))
   130    "type mismatch")
   131  
   132  ;; invalid lane index
   133  (assert_invalid  (module (memory 1)
   134            (func (param $x v128) (result v128)
   135              (v128.load32_lane 4 (i32.const 0) (local.get $x))))
   136    "invalid lane index")
   137  
   138  ;; invalid memarg alignment
   139  (assert_invalid
   140    (module (memory 1)
   141            (func (param $x v128) (result v128)
   142            (v128.load32_lane align=8 0 (i32.const 0) (local.get $x))))
   143    "alignment must not be larger than natural")