wa-lang.org/wazero@v1.0.2/internal/integration_test/spectest/v2/testdata/simd_store16_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.store16_lane_0")
     8      (param $address i32) (param $x v128) (result i64) (local $ret i64)
     9      (v128.store16_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.store16_lane_1")
    13      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    14      (v128.store16_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.store16_lane_2")
    18      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    19      (v128.store16_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.store16_lane_3")
    23      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    24      (v128.store16_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.store16_lane_4")
    28      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    29      (v128.store16_lane 4 (local.get $address) (local.get $x))
    30      (local.set $ret (i64.load (local.get $address)))
    31      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    32    (func (export "v128.store16_lane_5")
    33      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    34      (v128.store16_lane 5 (local.get $address) (local.get $x))
    35      (local.set $ret (i64.load (local.get $address)))
    36      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    37    (func (export "v128.store16_lane_6")
    38      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    39      (v128.store16_lane 6 (local.get $address) (local.get $x))
    40      (local.set $ret (i64.load (local.get $address)))
    41      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    42    (func (export "v128.store16_lane_7")
    43      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    44      (v128.store16_lane 7 (local.get $address) (local.get $x))
    45      (local.set $ret (i64.load (local.get $address)))
    46      (v128.store (local.get $address) (global.get $zero))    (local.get $ret))
    47    (func (export "v128.store16_lane_0_offset_0")
    48      (param $x v128) (result i64) (local $ret i64)
    49      (v128.store16_lane offset=0 0 (i32.const 0) (local.get $x))
    50      (local.set $ret (i64.load offset=0 (i32.const 0)))
    51      (v128.store offset=0 (i32.const 0) (global.get $zero))
    52      (local.get $ret))
    53    (func (export "v128.store16_lane_1_offset_1")
    54      (param $x v128) (result i64) (local $ret i64)
    55      (v128.store16_lane offset=1 1 (i32.const 0) (local.get $x))
    56      (local.set $ret (i64.load offset=1 (i32.const 0)))
    57      (v128.store offset=1 (i32.const 0) (global.get $zero))
    58      (local.get $ret))
    59    (func (export "v128.store16_lane_2_offset_2")
    60      (param $x v128) (result i64) (local $ret i64)
    61      (v128.store16_lane offset=2 2 (i32.const 0) (local.get $x))
    62      (local.set $ret (i64.load offset=2 (i32.const 0)))
    63      (v128.store offset=2 (i32.const 0) (global.get $zero))
    64      (local.get $ret))
    65    (func (export "v128.store16_lane_3_offset_3")
    66      (param $x v128) (result i64) (local $ret i64)
    67      (v128.store16_lane offset=3 3 (i32.const 0) (local.get $x))
    68      (local.set $ret (i64.load offset=3 (i32.const 0)))
    69      (v128.store offset=3 (i32.const 0) (global.get $zero))
    70      (local.get $ret))
    71    (func (export "v128.store16_lane_4_offset_4")
    72      (param $x v128) (result i64) (local $ret i64)
    73      (v128.store16_lane offset=4 4 (i32.const 0) (local.get $x))
    74      (local.set $ret (i64.load offset=4 (i32.const 0)))
    75      (v128.store offset=4 (i32.const 0) (global.get $zero))
    76      (local.get $ret))
    77    (func (export "v128.store16_lane_5_offset_5")
    78      (param $x v128) (result i64) (local $ret i64)
    79      (v128.store16_lane offset=5 5 (i32.const 0) (local.get $x))
    80      (local.set $ret (i64.load offset=5 (i32.const 0)))
    81      (v128.store offset=5 (i32.const 0) (global.get $zero))
    82      (local.get $ret))
    83    (func (export "v128.store16_lane_6_offset_6")
    84      (param $x v128) (result i64) (local $ret i64)
    85      (v128.store16_lane offset=6 6 (i32.const 0) (local.get $x))
    86      (local.set $ret (i64.load offset=6 (i32.const 0)))
    87      (v128.store offset=6 (i32.const 0) (global.get $zero))
    88      (local.get $ret))
    89    (func (export "v128.store16_lane_7_offset_7")
    90      (param $x v128) (result i64) (local $ret i64)
    91      (v128.store16_lane offset=7 7 (i32.const 0) (local.get $x))
    92      (local.set $ret (i64.load offset=7 (i32.const 0)))
    93      (v128.store offset=7 (i32.const 0) (global.get $zero))
    94      (local.get $ret))
    95    (func (export "v128.store16_lane_0_align_1")
    96      (param $address i32) (param $x v128) (result i64) (local $ret i64)
    97      (v128.store16_lane align=1 0 (local.get $address) (local.get $x))
    98      (local.set $ret (i64.load (local.get $address)))
    99      (v128.store offset=0 (i32.const 0) (global.get $zero))
   100      (local.get $ret))
   101    (func (export "v128.store16_lane_0_align_2")
   102      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   103      (v128.store16_lane align=2 0 (local.get $address) (local.get $x))
   104      (local.set $ret (i64.load (local.get $address)))
   105      (v128.store offset=0 (i32.const 0) (global.get $zero))
   106      (local.get $ret))
   107    (func (export "v128.store16_lane_1_align_1")
   108      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   109      (v128.store16_lane align=1 1 (local.get $address) (local.get $x))
   110      (local.set $ret (i64.load (local.get $address)))
   111      (v128.store offset=1 (i32.const 0) (global.get $zero))
   112      (local.get $ret))
   113    (func (export "v128.store16_lane_1_align_2")
   114      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   115      (v128.store16_lane align=2 1 (local.get $address) (local.get $x))
   116      (local.set $ret (i64.load (local.get $address)))
   117      (v128.store offset=1 (i32.const 0) (global.get $zero))
   118      (local.get $ret))
   119    (func (export "v128.store16_lane_2_align_1")
   120      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   121      (v128.store16_lane align=1 2 (local.get $address) (local.get $x))
   122      (local.set $ret (i64.load (local.get $address)))
   123      (v128.store offset=2 (i32.const 0) (global.get $zero))
   124      (local.get $ret))
   125    (func (export "v128.store16_lane_2_align_2")
   126      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   127      (v128.store16_lane align=2 2 (local.get $address) (local.get $x))
   128      (local.set $ret (i64.load (local.get $address)))
   129      (v128.store offset=2 (i32.const 0) (global.get $zero))
   130      (local.get $ret))
   131    (func (export "v128.store16_lane_3_align_1")
   132      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   133      (v128.store16_lane align=1 3 (local.get $address) (local.get $x))
   134      (local.set $ret (i64.load (local.get $address)))
   135      (v128.store offset=3 (i32.const 0) (global.get $zero))
   136      (local.get $ret))
   137    (func (export "v128.store16_lane_3_align_2")
   138      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   139      (v128.store16_lane align=2 3 (local.get $address) (local.get $x))
   140      (local.set $ret (i64.load (local.get $address)))
   141      (v128.store offset=3 (i32.const 0) (global.get $zero))
   142      (local.get $ret))
   143    (func (export "v128.store16_lane_4_align_1")
   144      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   145      (v128.store16_lane align=1 4 (local.get $address) (local.get $x))
   146      (local.set $ret (i64.load (local.get $address)))
   147      (v128.store offset=4 (i32.const 0) (global.get $zero))
   148      (local.get $ret))
   149    (func (export "v128.store16_lane_4_align_2")
   150      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   151      (v128.store16_lane align=2 4 (local.get $address) (local.get $x))
   152      (local.set $ret (i64.load (local.get $address)))
   153      (v128.store offset=4 (i32.const 0) (global.get $zero))
   154      (local.get $ret))
   155    (func (export "v128.store16_lane_5_align_1")
   156      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   157      (v128.store16_lane align=1 5 (local.get $address) (local.get $x))
   158      (local.set $ret (i64.load (local.get $address)))
   159      (v128.store offset=5 (i32.const 0) (global.get $zero))
   160      (local.get $ret))
   161    (func (export "v128.store16_lane_5_align_2")
   162      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   163      (v128.store16_lane align=2 5 (local.get $address) (local.get $x))
   164      (local.set $ret (i64.load (local.get $address)))
   165      (v128.store offset=5 (i32.const 0) (global.get $zero))
   166      (local.get $ret))
   167    (func (export "v128.store16_lane_6_align_1")
   168      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   169      (v128.store16_lane align=1 6 (local.get $address) (local.get $x))
   170      (local.set $ret (i64.load (local.get $address)))
   171      (v128.store offset=6 (i32.const 0) (global.get $zero))
   172      (local.get $ret))
   173    (func (export "v128.store16_lane_6_align_2")
   174      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   175      (v128.store16_lane align=2 6 (local.get $address) (local.get $x))
   176      (local.set $ret (i64.load (local.get $address)))
   177      (v128.store offset=6 (i32.const 0) (global.get $zero))
   178      (local.get $ret))
   179    (func (export "v128.store16_lane_7_align_1")
   180      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   181      (v128.store16_lane align=1 7 (local.get $address) (local.get $x))
   182      (local.set $ret (i64.load (local.get $address)))
   183      (v128.store offset=7 (i32.const 0) (global.get $zero))
   184      (local.get $ret))
   185    (func (export "v128.store16_lane_7_align_2")
   186      (param $address i32) (param $x v128) (result i64) (local $ret i64)
   187      (v128.store16_lane align=2 7 (local.get $address) (local.get $x))
   188      (local.set $ret (i64.load (local.get $address)))
   189      (v128.store offset=7 (i32.const 0) (global.get $zero))
   190      (local.get $ret))
   191  )
   192  
   193  (assert_return (invoke "v128.store16_lane_0" (i32.const 0)
   194                                               (v128.const i16x8 256 0 0 0 0 0 0 0))
   195                                               (i64.const 256))
   196  (assert_return (invoke "v128.store16_lane_1" (i32.const 1)
   197                                               (v128.const i16x8 0 513 0 0 0 0 0 0))
   198                                               (i64.const 513))
   199  (assert_return (invoke "v128.store16_lane_2" (i32.const 2)
   200                                               (v128.const i16x8 0 0 770 0 0 0 0 0))
   201                                               (i64.const 770))
   202  (assert_return (invoke "v128.store16_lane_3" (i32.const 3)
   203                                               (v128.const i16x8 0 0 0 1027 0 0 0 0))
   204                                               (i64.const 1027))
   205  (assert_return (invoke "v128.store16_lane_4" (i32.const 4)
   206                                               (v128.const i16x8 0 0 0 0 1284 0 0 0))
   207                                               (i64.const 1284))
   208  (assert_return (invoke "v128.store16_lane_5" (i32.const 5)
   209                                               (v128.const i16x8 0 0 0 0 0 1541 0 0))
   210                                               (i64.const 1541))
   211  (assert_return (invoke "v128.store16_lane_6" (i32.const 6)
   212                                               (v128.const i16x8 0 0 0 0 0 0 1798 0))
   213                                               (i64.const 1798))
   214  (assert_return (invoke "v128.store16_lane_7" (i32.const 7)
   215                                               (v128.const i16x8 0 0 0 0 0 0 0 2055))
   216                                               (i64.const 2055))
   217  (assert_return (invoke "v128.store16_lane_0_offset_0" (v128.const i16x8 256 0 0 0 0 0 0 0))
   218                                                        (i64.const 256))
   219  (assert_return (invoke "v128.store16_lane_1_offset_1" (v128.const i16x8 0 513 0 0 0 0 0 0))
   220                                                        (i64.const 513))
   221  (assert_return (invoke "v128.store16_lane_2_offset_2" (v128.const i16x8 0 0 770 0 0 0 0 0))
   222                                                        (i64.const 770))
   223  (assert_return (invoke "v128.store16_lane_3_offset_3" (v128.const i16x8 0 0 0 1027 0 0 0 0))
   224                                                        (i64.const 1027))
   225  (assert_return (invoke "v128.store16_lane_4_offset_4" (v128.const i16x8 0 0 0 0 1284 0 0 0))
   226                                                        (i64.const 1284))
   227  (assert_return (invoke "v128.store16_lane_5_offset_5" (v128.const i16x8 0 0 0 0 0 1541 0 0))
   228                                                        (i64.const 1541))
   229  (assert_return (invoke "v128.store16_lane_6_offset_6" (v128.const i16x8 0 0 0 0 0 0 1798 0))
   230                                                        (i64.const 1798))
   231  (assert_return (invoke "v128.store16_lane_7_offset_7" (v128.const i16x8 0 0 0 0 0 0 0 2055))
   232                                                        (i64.const 2055))
   233  (assert_return (invoke "v128.store16_lane_0_align_1" (i32.const 0)
   234                                                       (v128.const i16x8 256 0 0 0 0 0 0 0))
   235                                                       (i64.const 256))
   236  (assert_return (invoke "v128.store16_lane_0_align_2" (i32.const 0)
   237                                                       (v128.const i16x8 256 0 0 0 0 0 0 0))
   238                                                       (i64.const 256))
   239  (assert_return (invoke "v128.store16_lane_1_align_1" (i32.const 1)
   240                                                       (v128.const i16x8 0 513 0 0 0 0 0 0))
   241                                                       (i64.const 513))
   242  (assert_return (invoke "v128.store16_lane_1_align_2" (i32.const 1)
   243                                                       (v128.const i16x8 0 513 0 0 0 0 0 0))
   244                                                       (i64.const 513))
   245  (assert_return (invoke "v128.store16_lane_2_align_1" (i32.const 2)
   246                                                       (v128.const i16x8 0 0 770 0 0 0 0 0))
   247                                                       (i64.const 770))
   248  (assert_return (invoke "v128.store16_lane_2_align_2" (i32.const 2)
   249                                                       (v128.const i16x8 0 0 770 0 0 0 0 0))
   250                                                       (i64.const 770))
   251  (assert_return (invoke "v128.store16_lane_3_align_1" (i32.const 3)
   252                                                       (v128.const i16x8 0 0 0 1027 0 0 0 0))
   253                                                       (i64.const 1027))
   254  (assert_return (invoke "v128.store16_lane_3_align_2" (i32.const 3)
   255                                                       (v128.const i16x8 0 0 0 1027 0 0 0 0))
   256                                                       (i64.const 1027))
   257  (assert_return (invoke "v128.store16_lane_4_align_1" (i32.const 4)
   258                                                       (v128.const i16x8 0 0 0 0 1284 0 0 0))
   259                                                       (i64.const 1284))
   260  (assert_return (invoke "v128.store16_lane_4_align_2" (i32.const 4)
   261                                                       (v128.const i16x8 0 0 0 0 1284 0 0 0))
   262                                                       (i64.const 1284))
   263  (assert_return (invoke "v128.store16_lane_5_align_1" (i32.const 5)
   264                                                       (v128.const i16x8 0 0 0 0 0 1541 0 0))
   265                                                       (i64.const 1541))
   266  (assert_return (invoke "v128.store16_lane_5_align_2" (i32.const 5)
   267                                                       (v128.const i16x8 0 0 0 0 0 1541 0 0))
   268                                                       (i64.const 1541))
   269  (assert_return (invoke "v128.store16_lane_6_align_1" (i32.const 6)
   270                                                       (v128.const i16x8 0 0 0 0 0 0 1798 0))
   271                                                       (i64.const 1798))
   272  (assert_return (invoke "v128.store16_lane_6_align_2" (i32.const 6)
   273                                                       (v128.const i16x8 0 0 0 0 0 0 1798 0))
   274                                                       (i64.const 1798))
   275  (assert_return (invoke "v128.store16_lane_7_align_1" (i32.const 7)
   276                                                       (v128.const i16x8 0 0 0 0 0 0 0 2055))
   277                                                       (i64.const 2055))
   278  (assert_return (invoke "v128.store16_lane_7_align_2" (i32.const 7)
   279                                                       (v128.const i16x8 0 0 0 0 0 0 0 2055))
   280                                                       (i64.const 2055))
   281  
   282  ;; type check
   283  (assert_invalid  (module (memory 1)
   284            (func (param $x v128) (result v128)
   285              (v128.store16_lane 0 (local.get $x) (i32.const 0))))
   286    "type mismatch")
   287  
   288  ;; invalid lane index
   289  (assert_invalid  (module (memory 1)
   290            (func (param $x v128) (result v128)
   291              (v128.store16_lane 8 (i32.const 0) (local.get $x))))
   292    "invalid lane index")
   293  
   294  ;; invalid memarg alignment
   295  (assert_invalid
   296    (module (memory 1)
   297            (func (param $x v128) (result v128)
   298            (v128.store16_lane align=4 0 (i32.const 0) (local.get $x))))
   299    "alignment must not be larger than natural")