| 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.load64_lane_0") |
| 8 |
(param $address i32) (param $x v128) (result v128) |
| 9 |
(v128.load64_lane 0 (local.get $address) (local.get $x))) |
| 10 |
(func (export "v128.load64_lane_1") |
| 11 |
(param $address i32) (param $x v128) (result v128) |
| 12 |
(v128.load64_lane 1 (local.get $address) (local.get $x))) |
| 13 |
(func (export "v128.load64_lane_0_offset_0") |
| 14 |
(param $x v128) (result v128) |
| 15 |
(v128.load64_lane offset=0 0 (i32.const 0) (local.get $x))) |
| 16 |
(func (export "v128.load64_lane_1_offset_1") |
| 17 |
(param $x v128) (result v128) |
| 18 |
(v128.load64_lane offset=1 1 (i32.const 0) (local.get $x))) |
| 19 |
(func (export "v128.load64_lane_0_align_1") |
| 20 |
(param $address i32) (param $x v128) (result v128) |
| 21 |
(v128.load64_lane align=1 0 (local.get $address) (local.get $x))) |
| 22 |
(func (export "v128.load64_lane_0_align_2") |
| 23 |
(param $address i32) (param $x v128) (result v128) |
| 24 |
(v128.load64_lane align=2 0 (local.get $address) (local.get $x))) |
| 25 |
(func (export "v128.load64_lane_0_align_4") |
| 26 |
(param $address i32) (param $x v128) (result v128) |
| 27 |
(v128.load64_lane align=4 0 (local.get $address) (local.get $x))) |
| 28 |
(func (export "v128.load64_lane_0_align_8") |
| 29 |
(param $address i32) (param $x v128) (result v128) |
| 30 |
(v128.load64_lane align=8 0 (local.get $address) (local.get $x))) |
| 31 |
(func (export "v128.load64_lane_1_align_1") |
| 32 |
(param $address i32) (param $x v128) (result v128) |
| 33 |
(v128.load64_lane align=1 1 (local.get $address) (local.get $x))) |
| 34 |
(func (export "v128.load64_lane_1_align_2") |
| 35 |
(param $address i32) (param $x v128) (result v128) |
| 36 |
(v128.load64_lane align=2 1 (local.get $address) (local.get $x))) |
| 37 |
(func (export "v128.load64_lane_1_align_4") |
| 38 |
(param $address i32) (param $x v128) (result v128) |
| 39 |
(v128.load64_lane align=4 1 (local.get $address) (local.get $x))) |
| 40 |
(func (export "v128.load64_lane_1_align_8") |
| 41 |
(param $address i32) (param $x v128) (result v128) |
| 42 |
(v128.load64_lane align=8 1 (local.get $address) (local.get $x))) |
| 43 |
) |
| 44 |
|
| 45 |
(assert_return (invoke "v128.load64_lane_0" (i32.const 0) |
| 46 |
(v128.const i64x2 0 0)) |
| 47 |
(v128.const i64x2 506097522914230528 0)) |
| 48 |
(assert_return (invoke "v128.load64_lane_1" (i32.const 1) |
| 49 |
(v128.const i64x2 0 0)) |
| 50 |
(v128.const i64x2 0 578437695752307201)) |
| 51 |
(assert_return (invoke "v128.load64_lane_0_offset_0" (v128.const i64x2 0 0)) |
| 52 |
(v128.const i64x2 506097522914230528 0)) |
| 53 |
(assert_return (invoke "v128.load64_lane_1_offset_1" (v128.const i64x2 0 0)) |
| 54 |
(v128.const i64x2 0 578437695752307201)) |
| 55 |
(assert_return (invoke "v128.load64_lane_0_align_1" (i32.const 0) |
| 56 |
(v128.const i64x2 0 0)) |
| 57 |
(v128.const i64x2 506097522914230528 0)) |
| 58 |
(assert_return (invoke "v128.load64_lane_0_align_2" (i32.const 0) |
| 59 |
(v128.const i64x2 0 0)) |
| 60 |
(v128.const i64x2 506097522914230528 0)) |
| 61 |
(assert_return (invoke "v128.load64_lane_0_align_4" (i32.const 0) |
| 62 |
(v128.const i64x2 0 0)) |
| 63 |
(v128.const i64x2 506097522914230528 0)) |
| 64 |
(assert_return (invoke "v128.load64_lane_0_align_8" (i32.const 0) |
| 65 |
(v128.const i64x2 0 0)) |
| 66 |
(v128.const i64x2 506097522914230528 0)) |
| 67 |
(assert_return (invoke "v128.load64_lane_1_align_1" (i32.const 1) |
| 68 |
(v128.const i64x2 0 0)) |
| 69 |
(v128.const i64x2 0 578437695752307201)) |
| 70 |
(assert_return (invoke "v128.load64_lane_1_align_2" (i32.const 1) |
| 71 |
(v128.const i64x2 0 0)) |
| 72 |
(v128.const i64x2 0 578437695752307201)) |
| 73 |
(assert_return (invoke "v128.load64_lane_1_align_4" (i32.const 1) |
| 74 |
(v128.const i64x2 0 0)) |
| 75 |
(v128.const i64x2 0 578437695752307201)) |
| 76 |
(assert_return (invoke "v128.load64_lane_1_align_8" (i32.const 1) |
| 77 |
(v128.const i64x2 0 0)) |
| 78 |
(v128.const i64x2 0 578437695752307201)) |
| 79 |
|
| 80 |
;; type check |
| 81 |
(assert_invalid (module (memory 1) |
| 82 |
(func (param $x v128) (result v128) |
| 83 |
(v128.load64_lane 0 (local.get $x) (i32.const 0)))) |
| 84 |
"type mismatch") |
| 85 |
|
| 86 |
;; invalid lane index |
| 87 |
(assert_invalid (module (memory 1) |
| 88 |
(func (param $x v128) (result v128) |
| 89 |
(v128.load64_lane 2 (i32.const 0) (local.get $x)))) |
| 90 |
"invalid lane index") |
| 91 |
|
| 92 |
;; invalid memarg alignment |
| 93 |
(assert_invalid |
| 94 |
(module (memory 1) |
| 95 |
(func (param $x v128) (result v128) |
| 96 |
(v128.load64_lane align=16 0 (i32.const 0) (local.get $x)))) |
| 97 |
"alignment must not be larger than natural") |