github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/integration_test/spectest/v2/testdata/simd_load16_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.load16_lane_0")
     8      (param $address i32) (param $x v128) (result v128)
     9      (v128.load16_lane 0 (local.get $address) (local.get $x)))
    10    (func (export "v128.load16_lane_1")
    11      (param $address i32) (param $x v128) (result v128)
    12      (v128.load16_lane 1 (local.get $address) (local.get $x)))
    13    (func (export "v128.load16_lane_2")
    14      (param $address i32) (param $x v128) (result v128)
    15      (v128.load16_lane 2 (local.get $address) (local.get $x)))
    16    (func (export "v128.load16_lane_3")
    17      (param $address i32) (param $x v128) (result v128)
    18      (v128.load16_lane 3 (local.get $address) (local.get $x)))
    19    (func (export "v128.load16_lane_4")
    20      (param $address i32) (param $x v128) (result v128)
    21      (v128.load16_lane 4 (local.get $address) (local.get $x)))
    22    (func (export "v128.load16_lane_5")
    23      (param $address i32) (param $x v128) (result v128)
    24      (v128.load16_lane 5 (local.get $address) (local.get $x)))
    25    (func (export "v128.load16_lane_6")
    26      (param $address i32) (param $x v128) (result v128)
    27      (v128.load16_lane 6 (local.get $address) (local.get $x)))
    28    (func (export "v128.load16_lane_7")
    29      (param $address i32) (param $x v128) (result v128)
    30      (v128.load16_lane 7 (local.get $address) (local.get $x)))
    31    (func (export "v128.load16_lane_0_offset_0")
    32      (param $x v128) (result v128)
    33      (v128.load16_lane offset=0 0 (i32.const 0) (local.get $x)))
    34    (func (export "v128.load16_lane_1_offset_1")
    35      (param $x v128) (result v128)
    36      (v128.load16_lane offset=1 1 (i32.const 0) (local.get $x)))
    37    (func (export "v128.load16_lane_2_offset_2")
    38      (param $x v128) (result v128)
    39      (v128.load16_lane offset=2 2 (i32.const 0) (local.get $x)))
    40    (func (export "v128.load16_lane_3_offset_3")
    41      (param $x v128) (result v128)
    42      (v128.load16_lane offset=3 3 (i32.const 0) (local.get $x)))
    43    (func (export "v128.load16_lane_4_offset_4")
    44      (param $x v128) (result v128)
    45      (v128.load16_lane offset=4 4 (i32.const 0) (local.get $x)))
    46    (func (export "v128.load16_lane_5_offset_5")
    47      (param $x v128) (result v128)
    48      (v128.load16_lane offset=5 5 (i32.const 0) (local.get $x)))
    49    (func (export "v128.load16_lane_6_offset_6")
    50      (param $x v128) (result v128)
    51      (v128.load16_lane offset=6 6 (i32.const 0) (local.get $x)))
    52    (func (export "v128.load16_lane_7_offset_7")
    53      (param $x v128) (result v128)
    54      (v128.load16_lane offset=7 7 (i32.const 0) (local.get $x)))
    55    (func (export "v128.load16_lane_0_align_1")
    56      (param $address i32) (param $x v128) (result v128)
    57      (v128.load16_lane align=1 0 (local.get $address) (local.get $x)))
    58    (func (export "v128.load16_lane_0_align_2")
    59      (param $address i32) (param $x v128) (result v128)
    60      (v128.load16_lane align=2 0 (local.get $address) (local.get $x)))
    61    (func (export "v128.load16_lane_1_align_1")
    62      (param $address i32) (param $x v128) (result v128)
    63      (v128.load16_lane align=1 1 (local.get $address) (local.get $x)))
    64    (func (export "v128.load16_lane_1_align_2")
    65      (param $address i32) (param $x v128) (result v128)
    66      (v128.load16_lane align=2 1 (local.get $address) (local.get $x)))
    67    (func (export "v128.load16_lane_2_align_1")
    68      (param $address i32) (param $x v128) (result v128)
    69      (v128.load16_lane align=1 2 (local.get $address) (local.get $x)))
    70    (func (export "v128.load16_lane_2_align_2")
    71      (param $address i32) (param $x v128) (result v128)
    72      (v128.load16_lane align=2 2 (local.get $address) (local.get $x)))
    73    (func (export "v128.load16_lane_3_align_1")
    74      (param $address i32) (param $x v128) (result v128)
    75      (v128.load16_lane align=1 3 (local.get $address) (local.get $x)))
    76    (func (export "v128.load16_lane_3_align_2")
    77      (param $address i32) (param $x v128) (result v128)
    78      (v128.load16_lane align=2 3 (local.get $address) (local.get $x)))
    79    (func (export "v128.load16_lane_4_align_1")
    80      (param $address i32) (param $x v128) (result v128)
    81      (v128.load16_lane align=1 4 (local.get $address) (local.get $x)))
    82    (func (export "v128.load16_lane_4_align_2")
    83      (param $address i32) (param $x v128) (result v128)
    84      (v128.load16_lane align=2 4 (local.get $address) (local.get $x)))
    85    (func (export "v128.load16_lane_5_align_1")
    86      (param $address i32) (param $x v128) (result v128)
    87      (v128.load16_lane align=1 5 (local.get $address) (local.get $x)))
    88    (func (export "v128.load16_lane_5_align_2")
    89      (param $address i32) (param $x v128) (result v128)
    90      (v128.load16_lane align=2 5 (local.get $address) (local.get $x)))
    91    (func (export "v128.load16_lane_6_align_1")
    92      (param $address i32) (param $x v128) (result v128)
    93      (v128.load16_lane align=1 6 (local.get $address) (local.get $x)))
    94    (func (export "v128.load16_lane_6_align_2")
    95      (param $address i32) (param $x v128) (result v128)
    96      (v128.load16_lane align=2 6 (local.get $address) (local.get $x)))
    97    (func (export "v128.load16_lane_7_align_1")
    98      (param $address i32) (param $x v128) (result v128)
    99      (v128.load16_lane align=1 7 (local.get $address) (local.get $x)))
   100    (func (export "v128.load16_lane_7_align_2")
   101      (param $address i32) (param $x v128) (result v128)
   102      (v128.load16_lane align=2 7 (local.get $address) (local.get $x)))
   103  )
   104  
   105  (assert_return (invoke "v128.load16_lane_0" (i32.const 0)
   106                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   107                                              (v128.const i16x8 256 0 0 0 0 0 0 0))
   108  (assert_return (invoke "v128.load16_lane_1" (i32.const 1)
   109                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   110                                              (v128.const i16x8 0 513 0 0 0 0 0 0))
   111  (assert_return (invoke "v128.load16_lane_2" (i32.const 2)
   112                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   113                                              (v128.const i16x8 0 0 770 0 0 0 0 0))
   114  (assert_return (invoke "v128.load16_lane_3" (i32.const 3)
   115                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   116                                              (v128.const i16x8 0 0 0 1027 0 0 0 0))
   117  (assert_return (invoke "v128.load16_lane_4" (i32.const 4)
   118                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   119                                              (v128.const i16x8 0 0 0 0 1284 0 0 0))
   120  (assert_return (invoke "v128.load16_lane_5" (i32.const 5)
   121                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   122                                              (v128.const i16x8 0 0 0 0 0 1541 0 0))
   123  (assert_return (invoke "v128.load16_lane_6" (i32.const 6)
   124                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   125                                              (v128.const i16x8 0 0 0 0 0 0 1798 0))
   126  (assert_return (invoke "v128.load16_lane_7" (i32.const 7)
   127                                              (v128.const i16x8 0 0 0 0 0 0 0 0))
   128                                              (v128.const i16x8 0 0 0 0 0 0 0 2055))
   129  (assert_return (invoke "v128.load16_lane_0_offset_0" (v128.const i16x8 0 0 0 0 0 0 0 0))
   130                                                       (v128.const i16x8 256 0 0 0 0 0 0 0))
   131  (assert_return (invoke "v128.load16_lane_1_offset_1" (v128.const i16x8 0 0 0 0 0 0 0 0))
   132                                                       (v128.const i16x8 0 513 0 0 0 0 0 0))
   133  (assert_return (invoke "v128.load16_lane_2_offset_2" (v128.const i16x8 0 0 0 0 0 0 0 0))
   134                                                       (v128.const i16x8 0 0 770 0 0 0 0 0))
   135  (assert_return (invoke "v128.load16_lane_3_offset_3" (v128.const i16x8 0 0 0 0 0 0 0 0))
   136                                                       (v128.const i16x8 0 0 0 1027 0 0 0 0))
   137  (assert_return (invoke "v128.load16_lane_4_offset_4" (v128.const i16x8 0 0 0 0 0 0 0 0))
   138                                                       (v128.const i16x8 0 0 0 0 1284 0 0 0))
   139  (assert_return (invoke "v128.load16_lane_5_offset_5" (v128.const i16x8 0 0 0 0 0 0 0 0))
   140                                                       (v128.const i16x8 0 0 0 0 0 1541 0 0))
   141  (assert_return (invoke "v128.load16_lane_6_offset_6" (v128.const i16x8 0 0 0 0 0 0 0 0))
   142                                                       (v128.const i16x8 0 0 0 0 0 0 1798 0))
   143  (assert_return (invoke "v128.load16_lane_7_offset_7" (v128.const i16x8 0 0 0 0 0 0 0 0))
   144                                                       (v128.const i16x8 0 0 0 0 0 0 0 2055))
   145  (assert_return (invoke "v128.load16_lane_0_align_1" (i32.const 0)
   146                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   147                                                      (v128.const i16x8 256 0 0 0 0 0 0 0))
   148  (assert_return (invoke "v128.load16_lane_0_align_2" (i32.const 0)
   149                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   150                                                      (v128.const i16x8 256 0 0 0 0 0 0 0))
   151  (assert_return (invoke "v128.load16_lane_1_align_1" (i32.const 1)
   152                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   153                                                      (v128.const i16x8 0 513 0 0 0 0 0 0))
   154  (assert_return (invoke "v128.load16_lane_1_align_2" (i32.const 1)
   155                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   156                                                      (v128.const i16x8 0 513 0 0 0 0 0 0))
   157  (assert_return (invoke "v128.load16_lane_2_align_1" (i32.const 2)
   158                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   159                                                      (v128.const i16x8 0 0 770 0 0 0 0 0))
   160  (assert_return (invoke "v128.load16_lane_2_align_2" (i32.const 2)
   161                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   162                                                      (v128.const i16x8 0 0 770 0 0 0 0 0))
   163  (assert_return (invoke "v128.load16_lane_3_align_1" (i32.const 3)
   164                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   165                                                      (v128.const i16x8 0 0 0 1027 0 0 0 0))
   166  (assert_return (invoke "v128.load16_lane_3_align_2" (i32.const 3)
   167                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   168                                                      (v128.const i16x8 0 0 0 1027 0 0 0 0))
   169  (assert_return (invoke "v128.load16_lane_4_align_1" (i32.const 4)
   170                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   171                                                      (v128.const i16x8 0 0 0 0 1284 0 0 0))
   172  (assert_return (invoke "v128.load16_lane_4_align_2" (i32.const 4)
   173                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   174                                                      (v128.const i16x8 0 0 0 0 1284 0 0 0))
   175  (assert_return (invoke "v128.load16_lane_5_align_1" (i32.const 5)
   176                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   177                                                      (v128.const i16x8 0 0 0 0 0 1541 0 0))
   178  (assert_return (invoke "v128.load16_lane_5_align_2" (i32.const 5)
   179                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   180                                                      (v128.const i16x8 0 0 0 0 0 1541 0 0))
   181  (assert_return (invoke "v128.load16_lane_6_align_1" (i32.const 6)
   182                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   183                                                      (v128.const i16x8 0 0 0 0 0 0 1798 0))
   184  (assert_return (invoke "v128.load16_lane_6_align_2" (i32.const 6)
   185                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   186                                                      (v128.const i16x8 0 0 0 0 0 0 1798 0))
   187  (assert_return (invoke "v128.load16_lane_7_align_1" (i32.const 7)
   188                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   189                                                      (v128.const i16x8 0 0 0 0 0 0 0 2055))
   190  (assert_return (invoke "v128.load16_lane_7_align_2" (i32.const 7)
   191                                                      (v128.const i16x8 0 0 0 0 0 0 0 0))
   192                                                      (v128.const i16x8 0 0 0 0 0 0 0 2055))
   193  
   194  ;; type check
   195  (assert_invalid  (module (memory 1)
   196            (func (param $x v128) (result v128)
   197              (v128.load16_lane 0 (local.get $x) (i32.const 0))))
   198    "type mismatch")
   199  
   200  ;; invalid lane index
   201  (assert_invalid  (module (memory 1)
   202            (func (param $x v128) (result v128)
   203              (v128.load16_lane 8 (i32.const 0) (local.get $x))))
   204    "invalid lane index")
   205  
   206  ;; invalid memarg alignment
   207  (assert_invalid
   208    (module (memory 1)
   209            (func (param $x v128) (result v128)
   210            (v128.load16_lane align=4 0 (i32.const 0) (local.get $x))))
   211    "alignment must not be larger than natural")