...
1;; Tests for the extract_lane, replace_lane, swizzle and shuffle group instructions
2
3
4(module
5 (func (export "i8x16_extract_lane_s-first") (param v128) (result i32)
6 (i8x16.extract_lane_s 0 (local.get 0)))
7 (func (export "i8x16_extract_lane_s-last") (param v128) (result i32)
8 (i8x16.extract_lane_s 15 (local.get 0)))
9 (func (export "i8x16_extract_lane_u-first") (param v128) (result i32)
10 (i8x16.extract_lane_u 0 (local.get 0)))
11 (func (export "i8x16_extract_lane_u-last") (param v128) (result i32)
12 (i8x16.extract_lane_u 15 (local.get 0)))
13 (func (export "i16x8_extract_lane_s-first") (param v128) (result i32)
14 (i16x8.extract_lane_s 0 (local.get 0)))
15 (func (export "i16x8_extract_lane_s-last") (param v128) (result i32)
16 (i16x8.extract_lane_s 7 (local.get 0)))
17 (func (export "i16x8_extract_lane_u-first") (param v128) (result i32)
18 (i16x8.extract_lane_u 0 (local.get 0)))
19 (func (export "i16x8_extract_lane_u-last") (param v128) (result i32)
20 (i16x8.extract_lane_u 7 (local.get 0)))
21 (func (export "i32x4_extract_lane-first") (param v128) (result i32)
22 (i32x4.extract_lane 0 (local.get 0)))
23 (func (export "i32x4_extract_lane-last") (param v128) (result i32)
24 (i32x4.extract_lane 3 (local.get 0)))
25 (func (export "f32x4_extract_lane-first") (param v128) (result f32)
26 (f32x4.extract_lane 0 (local.get 0)))
27 (func (export "f32x4_extract_lane-last") (param v128) (result f32)
28 (f32x4.extract_lane 3 (local.get 0)))
29 (func (export "i8x16_replace_lane-first") (param v128 i32) (result v128)
30 (i8x16.replace_lane 0 (local.get 0) (local.get 1)))
31 (func (export "i8x16_replace_lane-last") (param v128 i32) (result v128)
32 (i8x16.replace_lane 15 (local.get 0) (local.get 1)))
33 (func (export "i16x8_replace_lane-first") (param v128 i32) (result v128)
34 (i16x8.replace_lane 0 (local.get 0) (local.get 1)))
35 (func (export "i16x8_replace_lane-last") (param v128 i32) (result v128)
36 (i16x8.replace_lane 7 (local.get 0) (local.get 1)))
37 (func (export "i32x4_replace_lane-first") (param v128 i32) (result v128)
38 (i32x4.replace_lane 0 (local.get 0) (local.get 1)))
39 (func (export "i32x4_replace_lane-last") (param v128 i32) (result v128)
40 (i32x4.replace_lane 3 (local.get 0) (local.get 1)))
41 (func (export "f32x4_replace_lane-first") (param v128 f32) (result v128)
42 (f32x4.replace_lane 0 (local.get 0) (local.get 1)))
43 (func (export "f32x4_replace_lane-last") (param v128 f32) (result v128)
44 (f32x4.replace_lane 3 (local.get 0) (local.get 1)))
45 (func (export "i64x2_extract_lane-first") (param v128) (result i64)
46 (i64x2.extract_lane 0 (local.get 0)))
47 (func (export "i64x2_extract_lane-last") (param v128) (result i64)
48 (i64x2.extract_lane 1 (local.get 0)))
49 (func (export "f64x2_extract_lane-first") (param v128) (result f64)
50 (f64x2.extract_lane 0 (local.get 0)))
51 (func (export "f64x2_extract_lane-last") (param v128) (result f64)
52 (f64x2.extract_lane 1 (local.get 0)))
53 (func (export "i64x2_replace_lane-first") (param v128 i64) (result v128)
54 (i64x2.replace_lane 0 (local.get 0) (local.get 1)))
55 (func (export "i64x2_replace_lane-last") (param v128 i64) (result v128)
56 (i64x2.replace_lane 1 (local.get 0) (local.get 1)))
57 (func (export "f64x2_replace_lane-first") (param v128 f64) (result v128)
58 (f64x2.replace_lane 0 (local.get 0) (local.get 1)))
59 (func (export "f64x2_replace_lane-last") (param v128 f64) (result v128)
60 (f64x2.replace_lane 1 (local.get 0) (local.get 1)))
61
62 ;; Swizzle and shuffle
63 (func (export "v8x16_swizzle") (param v128 v128) (result v128)
64 (i8x16.swizzle (local.get 0) (local.get 1)))
65 (func (export "v8x16_shuffle-1") (param v128 v128) (result v128)
66 (i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (local.get 0) (local.get 1)))
67 (func (export "v8x16_shuffle-2") (param v128 v128) (result v128)
68 (i8x16.shuffle 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 (local.get 0) (local.get 1)))
69 (func (export "v8x16_shuffle-3") (param v128 v128) (result v128)
70 (i8x16.shuffle 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 (local.get 0) (local.get 1)))
71 (func (export "v8x16_shuffle-4") (param v128 v128) (result v128)
72 (i8x16.shuffle 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 (local.get 0) (local.get 1)))
73 (func (export "v8x16_shuffle-5") (param v128 v128) (result v128)
74 (i8x16.shuffle 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (local.get 0) (local.get 1)))
75 (func (export "v8x16_shuffle-6") (param v128 v128) (result v128)
76 (i8x16.shuffle 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 (local.get 0) (local.get 1)))
77 (func (export "v8x16_shuffle-7") (param v128 v128) (result v128)
78 (i8x16.shuffle 0 0 0 0 0 0 0 0 16 16 16 16 16 16 16 16 (local.get 0) (local.get 1)))
79)
80
81(assert_return (invoke "i8x16_extract_lane_s-first" (v128.const i8x16 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 127))
82(assert_return (invoke "i8x16_extract_lane_s-first" (v128.const i8x16 0x7f 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 127))
83(assert_return (invoke "i8x16_extract_lane_s-first" (v128.const i8x16 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const -1))
84(assert_return (invoke "i8x16_extract_lane_s-first" (v128.const i8x16 0xff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const -1))
85(assert_return (invoke "i8x16_extract_lane_u-first" (v128.const i8x16 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 255))
86(assert_return (invoke "i8x16_extract_lane_u-first" (v128.const i8x16 0xff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 255))
87(assert_return (invoke "i8x16_extract_lane_s-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -128)) (i32.const -128))
88(assert_return (invoke "i8x16_extract_lane_s-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x80)) (i32.const -128))
89(assert_return (invoke "i8x16_extract_lane_u-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1)) (i32.const 255))
90(assert_return (invoke "i8x16_extract_lane_u-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0xff)) (i32.const 255))
91(assert_return (invoke "i8x16_extract_lane_u-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -128)) (i32.const 128))
92(assert_return (invoke "i8x16_extract_lane_u-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x80)) (i32.const 128))
93
94(assert_return (invoke "i16x8_extract_lane_s-first" (v128.const i16x8 32767 0 0 0 0 0 0 0)) (i32.const 32767))
95(assert_return (invoke "i16x8_extract_lane_s-first" (v128.const i16x8 0x7fff 0 0 0 0 0 0 0)) (i32.const 32767))
96(assert_return (invoke "i16x8_extract_lane_s-first" (v128.const i16x8 65535 0 0 0 0 0 0 0)) (i32.const -1))
97(assert_return (invoke "i16x8_extract_lane_s-first" (v128.const i16x8 0xffff 0 0 0 0 0 0 0)) (i32.const -1))
98(assert_return (invoke "i16x8_extract_lane_s-first" (v128.const i16x8 012_345 0 0 0 0 0 0 0)) (i32.const 12345))
99(assert_return (invoke "i16x8_extract_lane_s-first" (v128.const i16x8 -0x0_1234 0 0 0 0 0 0 0)) (i32.const -0x1234))
100(assert_return (invoke "i16x8_extract_lane_u-first" (v128.const i16x8 65535 0 0 0 0 0 0 0)) (i32.const 65535))
101(assert_return (invoke "i16x8_extract_lane_u-first" (v128.const i16x8 0xffff 0 0 0 0 0 0 0)) (i32.const 65535))
102(assert_return (invoke "i16x8_extract_lane_u-first" (v128.const i16x8 012_345 0 0 0 0 0 0 0)) (i32.const 12345))
103(assert_return (invoke "i16x8_extract_lane_u-first" (v128.const i16x8 -0x0_1234 0 0 0 0 0 0 0)) (i32.const 60876))
104(assert_return (invoke "i16x8_extract_lane_s-last" (v128.const i16x8 0 0 0 0 0 0 0 -32768)) (i32.const -32768))
105(assert_return (invoke "i16x8_extract_lane_s-last" (v128.const i16x8 0 0 0 0 0 0 0 0x8000)) (i32.const -32768))
106(assert_return (invoke "i16x8_extract_lane_s-last" (v128.const i16x8 0 0 0 0 0 0 0 06_789)) (i32.const 6789))
107(assert_return (invoke "i16x8_extract_lane_s-last" (v128.const i16x8 0 0 0 0 0 0 0 -0x0_6789)) (i32.const -0x6789))
108(assert_return (invoke "i16x8_extract_lane_u-last" (v128.const i16x8 0 0 0 0 0 0 0 -1)) (i32.const 65535))
109(assert_return (invoke "i16x8_extract_lane_u-last" (v128.const i16x8 0 0 0 0 0 0 0 0xffff)) (i32.const 65535))
110(assert_return (invoke "i16x8_extract_lane_u-last" (v128.const i16x8 0 0 0 0 0 0 0 -32768)) (i32.const 32768))
111(assert_return (invoke "i16x8_extract_lane_u-last" (v128.const i16x8 0 0 0 0 0 0 0 0x8000)) (i32.const 32768))
112(assert_return (invoke "i16x8_extract_lane_u-last" (v128.const i16x8 0 0 0 0 0 0 0 06_789)) (i32.const 6789))
113(assert_return (invoke "i16x8_extract_lane_u-last" (v128.const i16x8 0 0 0 0 0 0 0 -0x0_6789)) (i32.const 39031))
114
115(assert_return (invoke "i32x4_extract_lane-first" (v128.const i32x4 2147483647 0 0 0)) (i32.const 2147483647))
116(assert_return (invoke "i32x4_extract_lane-first" (v128.const i32x4 0x7fffffff 0 0 0)) (i32.const 2147483647))
117(assert_return (invoke "i32x4_extract_lane-first" (v128.const i32x4 4294967295 0 0 0)) (i32.const -1))
118(assert_return (invoke "i32x4_extract_lane-first" (v128.const i32x4 0xffffffff 0 0 0)) (i32.const -1))
119(assert_return (invoke "i32x4_extract_lane-first" (v128.const i32x4 01_234_567_890 0 0 0)) (i32.const 1234567890))
120(assert_return (invoke "i32x4_extract_lane-first" (v128.const i32x4 -0x0_1234_5678 0 0 0)) (i32.const -0x12345678))
121(assert_return (invoke "i32x4_extract_lane-last" (v128.const i32x4 0 0 0 -2147483648)) (i32.const -2147483648))
122(assert_return (invoke "i32x4_extract_lane-last" (v128.const i32x4 0 0 0 0x80000000)) (i32.const -2147483648))
123(assert_return (invoke "i32x4_extract_lane-last" (v128.const i32x4 0 0 0 -1)) (i32.const -1))
124(assert_return (invoke "i32x4_extract_lane-last" (v128.const i32x4 0 0 0 0xffffffff)) (i32.const -1))
125(assert_return (invoke "i32x4_extract_lane-last" (v128.const i32x4 0 0 0 0_987_654_321)) (i32.const 987654321))
126(assert_return (invoke "i32x4_extract_lane-last" (v128.const i32x4 0 0 0 -0x0_1234_5678)) (i32.const -0x12345678))
127
128(assert_return (invoke "i64x2_extract_lane-first" (v128.const i64x2 9223372036854775807 0)) (i64.const 9223372036854775807))
129(assert_return (invoke "i64x2_extract_lane-first" (v128.const i64x2 0x7ffffffffffffffe 0)) (i64.const 0x7ffffffffffffffe))
130(assert_return (invoke "i64x2_extract_lane-first" (v128.const i64x2 18446744073709551615 0)) (i64.const -1))
131(assert_return (invoke "i64x2_extract_lane-first" (v128.const i64x2 0xffffffffffffffff 0)) (i64.const -1))
132(assert_return (invoke "i64x2_extract_lane-first" (v128.const i64x2 01_234_567_890_123_456_789 0)) (i64.const 1234567890123456789))
133(assert_return (invoke "i64x2_extract_lane-first" (v128.const i64x2 0x0_1234_5678_90AB_cdef 0)) (i64.const 0x1234567890abcdef))
134(assert_return (invoke "i64x2_extract_lane-last" (v128.const i64x2 0 9223372036854775808)) (i64.const -9223372036854775808))
135(assert_return (invoke "i64x2_extract_lane-last" (v128.const i64x2 0 0x8000000000000000)) (i64.const -0x8000000000000000))
136(assert_return (invoke "i64x2_extract_lane-last" (v128.const i64x2 0 0x8000000000000000)) (i64.const 0x8000000000000000))
137(assert_return (invoke "i64x2_extract_lane-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x7f)) (i64.const 9223372036854775807))
138(assert_return (invoke "i64x2_extract_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0x8000)) (i64.const -9223372036854775808))
139(assert_return (invoke "i64x2_extract_lane-last" (v128.const i32x4 0 0 0xffffffff 0x7fffffff)) (i64.const 9223372036854775807))
140(assert_return (invoke "i64x2_extract_lane-last" (v128.const f64x2 -inf +inf)) (i64.const 0x7ff0000000000000))
141(assert_return (invoke "i64x2_extract_lane-last" (v128.const i64x2 0 01_234_567_890_123_456_789)) (i64.const 1234567890123456789))
142(assert_return (invoke "i64x2_extract_lane-last" (v128.const i64x2 0 0x0_1234_5678_90AB_cdef)) (i64.const 0x1234567890abcdef))
143
144(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 -5.0 0.0 0.0 0.0)) (f32.const -5.0))
145(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 1e38 0.0 0.0 0.0)) (f32.const 1e38))
146(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 0x1.fffffep127 0.0 0.0 0.0)) (f32.const 0x1.fffffep127))
147(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 0x1p127 0.0 0.0 0.0)) (f32.const 0x1p127))
148(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 inf 0.0 0.0 0.0)) (f32.const inf))
149(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 nan inf 0.0 0.0)) (f32.const nan))
150(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 0123456789.0123456789e+019 0.0 0.0 0.0)) (f32.const 123456789.0123456789e+019))
151(assert_return (invoke "f32x4_extract_lane-first" (v128.const f32x4 0x0123456789ABCDEF.019aFp-019 0.0 0.0 0.0)) (f32.const 0x123456789ABCDEF.019aFp-019))
152(assert_return (invoke "f32x4_extract_lane-last" (v128.const f32x4 0.0 0.0 0.0 -1e38)) (f32.const -1e38))
153(assert_return (invoke "f32x4_extract_lane-last" (v128.const f32x4 0.0 0.0 0.0 -0x1.fffffep127)) (f32.const -0x1.fffffep127))
154(assert_return (invoke "f32x4_extract_lane-last" (v128.const f32x4 0.0 0.0 0.0 -0x1p127)) (f32.const -0x1p127))
155(assert_return (invoke "f32x4_extract_lane-last" (v128.const f32x4 0.0 0.0 0.0 -inf)) (f32.const -inf))
156(assert_return (invoke "f32x4_extract_lane-last" (v128.const f32x4 0.0 0.0 -inf nan)) (f32.const nan))
157(assert_return (invoke "f32x4_extract_lane-last" (v128.const f32x4 0.0 0.0 0.0 0123456789.)) (f32.const 123456789.0))
158(assert_return (invoke "f32x4_extract_lane-last" (v128.const f32x4 0.0 0.0 0.0 0x0123456789ABCDEF.)) (f32.const 0x123456789ABCDEF.0p0))
159
160(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 -1.5 0.0)) (f64.const -1.5))
161(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 1.5 0.0)) (f64.const 1.5))
162(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 -1.7976931348623157e-308 0x0p+0)) (f64.const -1.7976931348623157e-308))
163(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 1.7976931348623157e-308 0x0p-0)) (f64.const 1.7976931348623157e-308))
164(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 -0x1.fffffffffffffp-1023 0x0p+0)) (f64.const -0x1.fffffffffffffp-1023))
165(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 0x1.fffffffffffffp-1023 0x0p-0)) (f64.const 0x1.fffffffffffffp-1023))
166(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 -inf 0.0)) (f64.const -inf))
167(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 inf 0.0)) (f64.const inf))
168(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 -nan -0.0)) (f64.const -nan))
169(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 nan 0.0)) (f64.const nan))
170(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 0123456789.0123456789e+019 0.0)) (f64.const 123456789.0123456789e+019))
171(assert_return (invoke "f64x2_extract_lane-first" (v128.const f64x2 0x0123456789ABCDEFabcdef.0123456789ABCDEFabcdefp-019 0.0)) (f64.const 0x123456789ABCDEFabcdef.0123456789ABCDEFabcdefp-019))
172(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0.0 2.25)) (f64.const 2.25))
173(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0.0 -2.25)) (f64.const -2.25))
174(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0x0p-0 -1.7976931348623157e+308)) (f64.const -1.7976931348623157e+308))
175(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0x0p+0 1.7976931348623157e+308)) (f64.const 1.7976931348623157e+308))
176(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0x0p-0 -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023))
177(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0x0p+0 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023))
178(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 -0.0 -inf)) (f64.const -inf))
179(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0.0 inf)) (f64.const inf))
180(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 -0.0 -nan)) (f64.const -nan))
181(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0.0 nan)) (f64.const nan))
182(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0.0 0123456789.)) (f64.const 123456789.0))
183(assert_return (invoke "f64x2_extract_lane-last" (v128.const f64x2 0.0 0x0123456789ABCDEFabcdef.)) (f64.const 0x123456789ABCDEFabcdef.0))
184
185(assert_return (invoke "f64x2_extract_lane-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (f64.const 0.0))
186(assert_return (invoke "f64x2_extract_lane-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x80)) (f64.const -0.0))
187(assert_return (invoke "f64x2_extract_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0x4000)) (f64.const 2.0))
188(assert_return (invoke "f64x2_extract_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0xc000)) (f64.const -2.0))
189(assert_return (invoke "f64x2_extract_lane-last" (v128.const i32x4 0 0 0xffffffff 0x7fefffff)) (f64.const 0x1.fffffffffffffp+1023))
190(assert_return (invoke "f64x2_extract_lane-last" (v128.const i32x4 0 0 0 0x00100000)) (f64.const 0x1.0000000000000p-1022))
191(assert_return (invoke "f64x2_extract_lane-last" (v128.const i32x4 0 0 0xffffffff 0x000fffff)) (f64.const 0x1.ffffffffffffep-1023))
192(assert_return (invoke "f64x2_extract_lane-last" (v128.const i32x4 0 0 1 0)) (f64.const 0x0.0000000000002p-1023))
193
194(assert_return (invoke "i8x16_replace_lane-first" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 127)) (v128.const i8x16 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
195(assert_return (invoke "i8x16_replace_lane-first" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 128)) (v128.const i8x16 -128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
196(assert_return (invoke "i8x16_replace_lane-first" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 255)) (v128.const i8x16 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
197(assert_return (invoke "i8x16_replace_lane-first" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 256)) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
198(assert_return (invoke "i8x16_replace_lane-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const -128)) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -128))
199(assert_return (invoke "i8x16_replace_lane-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const -129)) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127))
200(assert_return (invoke "i8x16_replace_lane-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 32767)) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0xff))
201(assert_return (invoke "i8x16_replace_lane-last" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const -32768)) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
202
203(assert_return (invoke "i16x8_replace_lane-first" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 32767)) (v128.const i16x8 32767 0 0 0 0 0 0 0))
204(assert_return (invoke "i16x8_replace_lane-first" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 32768)) (v128.const i16x8 -32768 0 0 0 0 0 0 0))
205(assert_return (invoke "i16x8_replace_lane-first" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 65535)) (v128.const i16x8 -1 0 0 0 0 0 0 0))
206(assert_return (invoke "i16x8_replace_lane-first" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 65536)) (v128.const i16x8 0 0 0 0 0 0 0 0))
207(assert_return (invoke "i16x8_replace_lane-first" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 012345)) (v128.const i16x8 012_345 0 0 0 0 0 0 0))
208(assert_return (invoke "i16x8_replace_lane-first" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const -0x01234)) (v128.const i16x8 -0x0_1234 0 0 0 0 0 0 0))
209(assert_return (invoke "i16x8_replace_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const -32768)) (v128.const i16x8 0 0 0 0 0 0 0 -32768))
210(assert_return (invoke "i16x8_replace_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const -32769)) (v128.const i16x8 0 0 0 0 0 0 0 32767))
211(assert_return (invoke "i16x8_replace_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 0x7fffffff)) (v128.const i16x8 0 0 0 0 0 0 0 0xffff))
212(assert_return (invoke "i16x8_replace_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 0x80000000)) (v128.const i16x8 0 0 0 0 0 0 0 0))
213(assert_return (invoke "i16x8_replace_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 054321)) (v128.const i16x8 0 0 0 0 0 0 0 054_321))
214(assert_return (invoke "i16x8_replace_lane-last" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const -0x04321)) (v128.const i16x8 0 0 0 0 0 0 0 -0x0_4321))
215
216(assert_return (invoke "i32x4_replace_lane-first" (v128.const i32x4 0 0 0 0) (i32.const 2147483647)) (v128.const i32x4 2147483647 0 0 0))
217(assert_return (invoke "i32x4_replace_lane-first" (v128.const i32x4 0 0 0 0) (i32.const 4294967295)) (v128.const i32x4 -1 0 0 0))
218(assert_return (invoke "i32x4_replace_lane-first" (v128.const i32x4 0 0 0 0) (i32.const 01234567890)) (v128.const i32x4 01_234_567_890 0 0 0))
219(assert_return (invoke "i32x4_replace_lane-first" (v128.const i32x4 0 0 0 0) (i32.const -0x012345678)) (v128.const i32x4 -0x0_1234_5678 0 0 0))
220(assert_return (invoke "i32x4_replace_lane-last" (v128.const i32x4 0 0 0 0) (i32.const 2147483648)) (v128.const i32x4 0 0 0 2147483648))
221(assert_return (invoke "i32x4_replace_lane-last" (v128.const i32x4 0 0 0 0) (i32.const -2147483648)) (v128.const i32x4 0 0 0 -2147483648))
222(assert_return (invoke "i32x4_replace_lane-last" (v128.const i32x4 0 0 0 0) (i32.const 01234567890)) (v128.const i32x4 0 0 0 01_234_567_890))
223(assert_return (invoke "i32x4_replace_lane-last" (v128.const i32x4 0 0 0 0) (i32.const -0x012345678)) (v128.const i32x4 0 0 0 -0x0_1234_5678))
224
225(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 53.0)) (v128.const f32x4 53.0 0.0 0.0 0.0))
226(assert_return (invoke "f32x4_replace_lane-first" (v128.const i32x4 0 0 0 0 ) (f32.const 53.0)) (v128.const f32x4 53.0 0.0 0.0 0.0))
227(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const nan)) (v128.const f32x4 nan 0.0 0.0 0.0))
228(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const inf)) (v128.const f32x4 inf 0.0 0.0 0.0))
229(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 nan 0.0 0.0 0.0) (f32.const 3.14)) (v128.const f32x4 3.14 0.0 0.0 0.0))
230(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 inf 0.0 0.0 0.0) (f32.const 1e38)) (v128.const f32x4 1e38 0.0 0.0 0.0))
231(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 inf 0.0 0.0 0.0) (f32.const 0x1.fffffep127)) (v128.const f32x4 0x1.fffffep127 0.0 0.0 0.0))
232(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 inf 0.0 0.0 0.0) (f32.const 0x1p127)) (v128.const f32x4 0x1p127 0.0 0.0 0.0))
233(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0123456789)) (v128.const f32x4 0123456789 0.0 0.0 0.0))
234(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0123456789.)) (v128.const f32x4 0123456789. 0.0 0.0 0.0))
235(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0x0123456789ABCDEF)) (v128.const f32x4 0x0123456789ABCDEF 0.0 0.0 0.0))
236(assert_return (invoke "f32x4_replace_lane-first" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0x0123456789ABCDEF.)) (v128.const f32x4 0x0123456789ABCDEF. 0.0 0.0 0.0))
237(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const -53.0)) (v128.const f32x4 0.0 0.0 0.0 -53.0))
238(assert_return (invoke "f32x4_replace_lane-last" (v128.const i32x4 0 0 0 0) (f32.const -53.0)) (v128.const f32x4 0.0 0.0 0.0 -53.0))
239(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const nan)) (v128.const f32x4 0.0 0.0 0.0 nan))
240(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const -inf)) (v128.const f32x4 0.0 0.0 0.0 -inf))
241(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 nan) (f32.const 3.14)) (v128.const f32x4 0.0 0.0 0.0 3.14))
242(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 -inf) (f32.const -1e38)) (v128.const f32x4 0.0 0.0 0.0 -1e38))
243(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 -inf) (f32.const -0x1.fffffep127)) (v128.const f32x4 0.0 0.0 0.0 -0x1.fffffep127))
244(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 -inf) (f32.const -0x1p127)) (v128.const f32x4 0.0 0.0 0.0 -0x1p127))
245(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0123456789e019)) (v128.const f32x4 0.0 0.0 0.0 0123456789e019))
246(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0123456789.e+019)) (v128.const f32x4 0.0 0.0 0.0 0123456789.e+019))
247(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0x0123456789ABCDEFp019)) (v128.const f32x4 0.0 0.0 0.0 0x0123456789ABCDEFp019))
248(assert_return (invoke "f32x4_replace_lane-last" (v128.const f32x4 0.0 0.0 0.0 0.0) (f32.const 0x0123456789ABCDEF.p-019)) (v128.const f32x4 0.0 0.0 0.0 0x0123456789ABCDEF.p-019))
249
250(assert_return (invoke "i64x2_replace_lane-first" (v128.const i64x2 0 0) (i64.const 9223372036854775807)) (v128.const i64x2 9223372036854775807 0))
251(assert_return (invoke "i64x2_replace_lane-first" (v128.const i64x2 0 0) (i64.const 18446744073709551615)) (v128.const i64x2 -1 0))
252(assert_return (invoke "i64x2_replace_lane-first" (v128.const i64x2 0 0) (i64.const 01234567890123456789)) (v128.const i64x2 01_234_567_890_123_456_789 0))
253(assert_return (invoke "i64x2_replace_lane-first" (v128.const i64x2 0 0) (i64.const 0x01234567890abcdef)) (v128.const i64x2 0x0_1234_5678_90AB_cdef 0))
254(assert_return (invoke "i64x2_replace_lane-last" (v128.const i64x2 0 0) (i64.const 9223372036854775808)) (v128.const i64x2 0 9223372036854775808))
255(assert_return (invoke "i64x2_replace_lane-last" (v128.const i64x2 0 0) (i64.const 9223372036854775808)) (v128.const i64x2 0 -9223372036854775808))
256(assert_return (invoke "i64x2_replace_lane-last" (v128.const i64x2 0 0) (i64.const 01234567890123456789)) (v128.const i64x2 0 01_234_567_890_123_456_789))
257(assert_return (invoke "i64x2_replace_lane-last" (v128.const i64x2 0 0) (i64.const 0x01234567890abcdef)) (v128.const i64x2 0 0x0_1234_5678_90AB_cdef))
258
259(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 1.0 1.0) (f64.const 0x0p+0)) (v128.const f64x2 0.0 1.0))
260(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 -1.0 -1.0) (f64.const -0x0p-0)) (v128.const f64x2 -0.0 -1.0))
261(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const 1.25)) (v128.const f64x2 1.25 0.0))
262(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const -1.25)) (v128.const f64x2 -1.25 0.0))
263(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 -nan 0.0) (f64.const -1.7976931348623157e+308)) (v128.const f64x2 -1.7976931348623157e+308 0.0))
264(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 nan 0.0) (f64.const 1.7976931348623157e+308)) (v128.const f64x2 1.7976931348623157e+308 0.0))
265(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 -inf 0.0) (f64.const -0x1.fffffffffffffp-1023)) (v128.const f64x2 -0x1.fffffffffffffp-1023 0.0))
266(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 inf 0.0) (f64.const 0x1.fffffffffffffp-1023)) (v128.const f64x2 0x1.fffffffffffffp-1023 0.0))
267(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const -nan)) (v128.const f64x2 -nan 0.0))
268(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const nan)) (v128.const f64x2 nan 0.0))
269(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const -inf)) (v128.const f64x2 -inf 0.0))
270(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const inf)) (v128.const f64x2 inf 0.0))
271(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const 0123456789)) (v128.const f64x2 0123456789 0.0))
272(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const 0123456789.)) (v128.const f64x2 0123456789. 0.0))
273(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const 0x0123456789ABCDEFabcdef)) (v128.const f64x2 0x0123456789ABCDEFabcdef 0.0))
274(assert_return (invoke "f64x2_replace_lane-first" (v128.const f64x2 0.0 0.0) (f64.const 0x0123456789ABCDEFabcdef.)) (v128.const f64x2 0x0123456789ABCDEFabcdef. 0.0))
275(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 2.0 2.0) (f64.const 0.0)) (v128.const f64x2 2.0 0.0))
276(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 -2.0 -2.0) (f64.const -0.0)) (v128.const f64x2 -2.0 -0.0))
277(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const 2.25)) (v128.const f64x2 0.0 2.25))
278(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const -2.25)) (v128.const f64x2 0.0 -2.25))
279(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 -nan) (f64.const -1.7976931348623157e+308)) (v128.const f64x2 0.0 -1.7976931348623157e+308))
280(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 nan) (f64.const 1.7976931348623157e+308)) (v128.const f64x2 0.0 1.7976931348623157e+308))
281(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 -inf) (f64.const -0x1.fffffffffffffp-1023)) (v128.const f64x2 0.0 -0x1.fffffffffffffp-1023))
282(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 inf) (f64.const 0x1.fffffffffffffp-1023)) (v128.const f64x2 0.0 0x1.fffffffffffffp-1023))
283(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const -nan)) (v128.const f64x2 0.0 -nan))
284(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const nan)) (v128.const f64x2 0.0 nan))
285(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const -inf)) (v128.const f64x2 0.0 -inf))
286(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const inf)) (v128.const f64x2 0.0 inf))
287(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const 0123456789e019)) (v128.const f64x2 0.0 0123456789e019))
288(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const 0123456789e+019)) (v128.const f64x2 0.0 0123456789e+019))
289(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const 0123456789.e019)) (v128.const f64x2 0.0 0123456789.e019))
290(assert_return (invoke "f64x2_replace_lane-last" (v128.const f64x2 0.0 0.0) (f64.const 0123456789.e-019)) (v128.const f64x2 0.0 0123456789.e-019))
291
292(assert_return (invoke "v8x16_swizzle"
293 (v128.const i8x16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31)
294 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
295 (v128.const i8x16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31))
296(assert_return (invoke "v8x16_swizzle"
297 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
298 (v128.const i8x16 -8 -7 -6 -5 -4 -3 -2 -1 16 17 18 19 20 21 22 23))
299 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
300(assert_return (invoke "v8x16_swizzle"
301 (v128.const i8x16 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115)
302 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
303 (v128.const i8x16 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100))
304(assert_return (invoke "v8x16_swizzle"
305 (v128.const i8x16 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115)
306 (v128.const i8x16 -1 1 -2 2 -3 3 -4 4 -5 5 -6 6 -7 7 -8 8))
307 (v128.const i8x16 0 101 0 102 0 103 0 104 0 105 0 106 0 107 0 108))
308(assert_return (invoke "v8x16_swizzle"
309 (v128.const i8x16 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115)
310 (v128.const i8x16 9 16 10 17 11 18 12 19 13 20 14 21 15 22 16 23))
311 (v128.const i8x16 109 0 110 0 111 0 112 0 113 0 114 0 115 0 0 0))
312(assert_return (invoke "v8x16_swizzle"
313 (v128.const i8x16 0x64 0x65 0x66 0x67 0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73)
314 (v128.const i8x16 9 16 10 17 11 18 12 19 13 20 14 21 15 22 16 23))
315 (v128.const i8x16 0x6d 0 0x6e 0 0x6f 0 0x70 0 0x71 0 0x72 0 0x73 0 0 0))
316(assert_return (invoke "v8x16_swizzle"
317 (v128.const i16x8 0x6465 0x6667 0x6869 0x6a6b 0x6c6d 0x6e6f 0x7071 0x7273)
318 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
319 (v128.const i16x8 0x6465 0x6667 0x6869 0x6a6b 0x6c6d 0x6e6f 0x7071 0x7273))
320(assert_return (invoke "v8x16_swizzle"
321 (v128.const i32x4 0x64656667 0x68696a6b 0x6c6d6e6f 0x70717273)
322 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
323 (v128.const i32x4 0x73727170 0x6f6e6d6c 0x6b6a6968 0x67666564))
324(assert_return (invoke "v8x16_swizzle"
325 (v128.const f32x4 nan -nan inf -inf)
326 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
327 (v128.const i32x4 0x7fc00000 0xffc00000 0x7f800000 0xff800000))
328(assert_return (invoke "v8x16_swizzle"
329 (v128.const i32x4 0x67666564 0x6b6a6968 0x6f6e6d5c 0x73727170)
330 (v128.const f32x4 0.0 -0.0 inf -inf))
331 (v128.const i32x4 0x64646464 0x00646464 0x00006464 0x00006464))
332
333(assert_return (invoke "v8x16_shuffle-1"
334 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
335 (v128.const i8x16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31))
336 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
337(assert_return (invoke "v8x16_shuffle-2"
338 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
339 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
340 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
341(assert_return (invoke "v8x16_shuffle-3"
342 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
343 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
344 (v128.const i8x16 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16))
345(assert_return (invoke "v8x16_shuffle-4"
346 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
347 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
348 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
349(assert_return (invoke "v8x16_shuffle-5"
350 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
351 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
352 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
353(assert_return (invoke "v8x16_shuffle-6"
354 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
355 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
356 (v128.const i8x16 -16 -16 -16 -16 -16 -16 -16 -16 -16 -16 -16 -16 -16 -16 -16 -16))
357(assert_return (invoke "v8x16_shuffle-7"
358 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
359 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
360 (v128.const i8x16 0 0 0 0 0 0 0 0 -16 -16 -16 -16 -16 -16 -16 -16))
361(assert_return (invoke "v8x16_shuffle-1"
362 (v128.const i8x16 0x64 0x65 0x66 0x67 0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73)
363 (v128.const i8x16 0xf0 0xf1 0xf2 0xf3 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff))
364 (v128.const i8x16 0x64 0x65 0x66 0x67 0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73))
365(assert_return (invoke "v8x16_shuffle-1"
366 (v128.const i16x8 0x0100 0x0302 0x0504 0x0706 0x0908 0x0b0a 0x0d0c 0x0f0e)
367 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1))
368 (v128.const i16x8 0x0100 0x0302 0x0504 0x0706 0x0908 0x0b0a 0x0d0c 0x0f0e))
369(assert_return (invoke "v8x16_shuffle-2"
370 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
371 (v128.const i32x4 0xf3f2f1f0 0xf7f6f5f4 0xfbfaf9f8 0xfffefdfc))
372 (v128.const i32x4 0xf3f2f1f0 0xf7f6f5f4 0xfbfaf9f8 0xfffefdfc))
373(assert_return (invoke "v8x16_shuffle-1"
374 (v128.const i32x4 0x10203 0x4050607 0x8090a0b 0xc0d0e0f)
375 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
376 (v128.const i32x4 0x10203 0x4050607 0x8090a0b 0xc0d0e0f))
377(assert_return (invoke "v8x16_shuffle-1"
378 (v128.const f32x4 1.0 nan inf -inf)
379 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
380 (v128.const i32x4 0x3f800000 0x7fc00000 0x7f800000 0xff800000))
381(assert_return (invoke "v8x16_shuffle-1"
382 (v128.const i32x4 0x10203 0x4050607 0x8090a0b 0xc0d0e0f)
383 (v128.const f32x4 -0.0 nan inf -inf))
384 (v128.const i32x4 0x10203 0x4050607 0x8090a0b 0xc0d0e0f))
385
386;; More literals
387(assert_return (invoke "v8x16_swizzle"
388 (v128.const i32x4 1_234_567_890 0x1234_5678 01_234_567_890 0x0_1234_5678)
389 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
390 (v128.const i32x4 0x4996_02d2 0x1234_5678 0x4996_02d2 0x1234_5678))
391(assert_return (invoke "v8x16_shuffle-1"
392 (v128.const i64x2 1_234_567_890_123_456_789_0 0x1234_5678_90AB_cdef)
393 (v128.const i64x2 01_234_567_890_123_456_789_0 0x0_1234_5678_90AB_cdef))
394 (v128.const i32x4 0xeb1f_0ad2 0xab54_a98c 0x90ab_cdef 0x1234_5678))
395
396;; Syntax errors for negative values
397
398(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_s -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
399(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_u -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
400(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_s -1 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "unexpected token")
401(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_u -1 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "unexpected token")
402(assert_malformed (module quote "(func (result i32) (i32x4.extract_lane -1 (v128.const i32x4 0 0 0 0)))") "unexpected token")
403(assert_malformed (module quote "(func (result f32) (f32x4.extract_lane -1 (v128.const f32x4 0 0 0 0)))") "unexpected token")
404(assert_malformed (module quote "(func (result v128) (i8x16.replace_lane -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
405(assert_malformed (module quote "(func (result v128) (i16x8.replace_lane -1 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
406(assert_malformed (module quote "(func (result v128) (i32x4.replace_lane -1 (v128.const i32x4 0 0 0 0) (i32.const 1)))") "unexpected token")
407(assert_malformed (module quote "(func (result v128) (f32x4.replace_lane -1 (v128.const f32x4 0 0 0 0) (i32.const 1)))") "unexpected token")
408(assert_malformed (module quote "(func (result i64) (i64x2.extract_lane -1 (v128.const i64x2 0 0)))") "unexpected token")
409(assert_malformed (module quote "(func (result f64) (f64x2.extract_lane -1 (v128.const f64x2 0 0)))") "unexpected token")
410(assert_malformed (module quote "(func (result v128) (i64x2.replace_lane -1 (v128.const i64x2 0 0) (i64.const 1)))") "unexpected token")
411(assert_malformed (module quote "(func (result v128) (f64x2.replace_lane -1 (v128.const f64x2 0 0) (f64.const 1)))") "unexpected token")
412
413;; Malformed lane index value
414
415(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_s 256 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "malformed lane index")
416(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_u 256 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "malformed lane index")
417(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_s 256 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "malformed lane index")
418(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_u 256 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "malformed lane index")
419(assert_malformed (module quote "(func (result i32) (i32x4.extract_lane 256 (v128.const i32x4 0 0 0 0)))") "malformed lane index")
420(assert_malformed (module quote "(func (result f32) (f32x4.extract_lane 256 (v128.const f32x4 0 0 0 0)))") "malformed lane index")
421(assert_malformed (module quote "(func (result v128) (i8x16.replace_lane 256 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))") "malformed lane index")
422(assert_malformed (module quote "(func (result v128) (i16x8.replace_lane 256 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))") "malformed lane index")
423(assert_malformed (module quote "(func (result v128) (i32x4.replace_lane 256 (v128.const i32x4 0 0 0 0) (i32.const 1)))") "malformed lane index")
424(assert_malformed (module quote "(func (result v128) (f32x4.replace_lane 256 (v128.const f32x4 0 0 0 0) (i32.const 1)))") "malformed lane index")
425(assert_malformed (module quote "(func (result i64) (i64x2.extract_lane 256 (v128.const i64x2 0 0)))") "malformed lane index")
426(assert_malformed (module quote "(func (result f64) (f64x2.extract_lane 256 (v128.const f64x2 0 0)))") "malformed lane index")
427(assert_malformed (module quote "(func (result v128) (i64x2.replace_lane 256 (v128.const i64x2 0 0) (i64.const 1)))") "malformed lane index")
428(assert_malformed (module quote "(func (result v128) (f64x2.replace_lane 256 (v128.const f64x2 0 0) (f64.const 1)))") "malformed lane index")
429
430;; Invalid lane index value
431
432(assert_invalid (module (func (result i32) (i8x16.extract_lane_s 16 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
433(assert_invalid (module (func (result i32) (i8x16.extract_lane_s 255 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
434(assert_invalid (module (func (result i32) (i8x16.extract_lane_u 16 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
435(assert_invalid (module (func (result i32) (i8x16.extract_lane_u 255 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
436(assert_invalid (module (func (result i32) (i16x8.extract_lane_s 8 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index")
437(assert_invalid (module (func (result i32) (i16x8.extract_lane_s 255 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index")
438(assert_invalid (module (func (result i32) (i16x8.extract_lane_u 8 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index")
439(assert_invalid (module (func (result i32) (i16x8.extract_lane_u 255 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index")
440(assert_invalid (module (func (result i32) (i32x4.extract_lane 4 (v128.const i32x4 0 0 0 0)))) "invalid lane index")
441(assert_invalid (module (func (result i32) (i32x4.extract_lane 255 (v128.const i32x4 0 0 0 0)))) "invalid lane index")
442(assert_invalid (module (func (result f32) (f32x4.extract_lane 4 (v128.const f32x4 0 0 0 0)))) "invalid lane index")
443(assert_invalid (module (func (result f32) (f32x4.extract_lane 255 (v128.const f32x4 0 0 0 0)))) "invalid lane index")
444(assert_invalid (module (func (result v128) (i8x16.replace_lane 16 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index")
445(assert_invalid (module (func (result v128) (i8x16.replace_lane 255 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index")
446(assert_invalid (module (func (result v128) (i16x8.replace_lane 16 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index")
447(assert_invalid (module (func (result v128) (i16x8.replace_lane 255 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index")
448(assert_invalid (module (func (result v128) (i32x4.replace_lane 4 (v128.const i32x4 0 0 0 0) (i32.const 1)))) "invalid lane index")
449(assert_invalid (module (func (result v128) (i32x4.replace_lane 255 (v128.const i32x4 0 0 0 0) (i32.const 1)))) "invalid lane index")
450(assert_invalid (module (func (result v128) (f32x4.replace_lane 4 (v128.const f32x4 0 0 0 0) (f32.const 1)))) "invalid lane index")
451(assert_invalid (module (func (result v128) (f32x4.replace_lane 255 (v128.const f32x4 0 0 0 0) (f32.const 1)))) "invalid lane index")
452(assert_invalid (module (func (result i64) (i64x2.extract_lane 2 (v128.const i64x2 0 0)))) "invalid lane index")
453(assert_invalid (module (func (result i64) (i64x2.extract_lane 255 (v128.const i64x2 0 0)))) "invalid lane index")
454(assert_invalid (module (func (result f64) (f64x2.extract_lane 2 (v128.const f64x2 0 0)))) "invalid lane index")
455(assert_invalid (module (func (result f64) (f64x2.extract_lane 255 (v128.const f64x2 0 0)))) "invalid lane index")
456(assert_invalid (module (func (result v128) (i64x2.replace_lane 2 (v128.const i64x2 0 0) (i64.const 1)))) "invalid lane index")
457(assert_invalid (module (func (result v128) (i64x2.replace_lane 255 (v128.const i64x2 0 0) (i64.const 1)))) "invalid lane index")
458(assert_invalid (module (func (result v128) (f64x2.replace_lane 2 (v128.const f64x2 0 0) (f64.const 1)))) "invalid lane index")
459(assert_invalid (module (func (result v128) (f64x2.replace_lane 255 (v128.const f64x2 0 0) (f64.const 1.0)))) "invalid lane index")
460
461;; Lane index is determined by the instruction's interpretation only.
462
463(assert_invalid (module (func (result i32) (i16x8.extract_lane_s 8 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
464(assert_invalid (module (func (result i32) (i16x8.extract_lane_u 8 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
465(assert_invalid (module (func (result i32) (i32x4.extract_lane 4 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
466(assert_invalid (module (func (result i32) (f32x4.extract_lane 4 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index")
467(assert_invalid (module (func (result v128) (i16x8.replace_lane 8 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index")
468(assert_invalid (module (func (result v128) (i32x4.replace_lane 4 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index")
469(assert_invalid (module (func (result v128) (f32x4.replace_lane 4 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (f32.const 1)))) "invalid lane index")
470(assert_invalid (module (func (result i64) (i64x2.extract_lane 2 (v128.const i64x2 0 0)))) "invalid lane index")
471(assert_invalid (module (func (result f64) (f64x2.extract_lane 2 (v128.const f64x2 0 0)))) "invalid lane index")
472(assert_invalid (module (func (result v128) (i64x2.replace_lane 2 (v128.const i64x2 0 0) (i64.const 1)))) "invalid lane index")
473(assert_invalid (module (func (result v128) (f64x2.replace_lane 2 (v128.const f64x2 0 0) (f64.const 1.0)))) "invalid lane index")
474
475;; Invalid parameters: required v128 but pass other types
476
477(assert_invalid (module (func (result i32) (i8x16.extract_lane_s 0 (i32.const 0)))) "type mismatch")
478(assert_invalid (module (func (result i32) (i8x16.extract_lane_u 0 (i64.const 0)))) "type mismatch")
479(assert_invalid (module (func (result i32) (i8x16.extract_lane_s 0 (f32.const 0.0)))) "type mismatch")
480(assert_invalid (module (func (result i32) (i8x16.extract_lane_u 0 (f64.const 0.0)))) "type mismatch")
481(assert_invalid (module (func (result i32) (i32x4.extract_lane 0 (i32.const 0)))) "type mismatch")
482(assert_invalid (module (func (result f32) (f32x4.extract_lane 0 (f32.const 0.0)))) "type mismatch")
483(assert_invalid (module (func (result v128) (i8x16.replace_lane 0 (i32.const 0) (i32.const 1)))) "type mismatch")
484(assert_invalid (module (func (result v128) (i16x8.replace_lane 0 (i64.const 0) (i32.const 1)))) "type mismatch")
485(assert_invalid (module (func (result v128) (i32x4.replace_lane 0 (i32.const 0) (i32.const 1)))) "type mismatch")
486(assert_invalid (module (func (result v128) (f32x4.replace_lane 0 (f32.const 0.0) (i32.const 1)))) "type mismatch")
487(assert_invalid (module (func (result i64) (i64x2.extract_lane 0 (i64.const 0)))) "type mismatch")
488(assert_invalid (module (func (result f64) (f64x2.extract_lane 0 (f64.const 0.0)))) "type mismatch")
489(assert_invalid (module (func (result v128) (i32x4.replace_lane 0 (i32.const 0) (i32.const 1)))) "type mismatch")
490(assert_invalid (module (func (result v128) (f32x4.replace_lane 0 (f32.const 0.0) (i32.const 1)))) "type mismatch")
491
492;; Invalid types for the replaced value
493
494(assert_invalid (module (func (result v128) (i8x16.replace_lane 0 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (f32.const 1.0)))) "type mismatch")
495(assert_invalid (module (func (result v128) (i16x8.replace_lane 0 (v128.const i16x8 0 0 0 0 0 0 0 0) (f64.const 1.0)))) "type mismatch")
496(assert_invalid (module (func (result v128) (i32x4.replace_lane 0 (v128.const i32x4 0 0 0 0) (f32.const 1.0)))) "type mismatch")
497(assert_invalid (module (func (result v128) (f32x4.replace_lane 0 (v128.const f32x4 0 0 0 0) (i32.const 1)))) "type mismatch")
498
499(assert_invalid (module (func (result v128) (i64x2.replace_lane 0 (v128.const i64x2 0 0) (f64.const 1.0)))) "type mismatch")
500(assert_invalid (module (func (result v128) (f64x2.replace_lane 0 (v128.const f64x2 0 0) (i64.const 1)))) "type mismatch")
501
502;; Invalid types for swizzle and shuffle values
503(assert_invalid (module (func (result v128)
504 (i8x16.swizzle (i32.const 1) (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)))) "type mismatch")
505(assert_invalid (module (func (result v128)
506 (i8x16.swizzle (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) (i32.const 2)))) "type mismatch")
507(assert_invalid (module (func (result v128)
508 (i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (f32.const 3.0)
509 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)))) "type mismatch")
510(assert_invalid (module (func (result v128)
511 (i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
512 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) (f32.const 4.0)))) "type mismatch")
513
514;; i8x16.shuffle: the 1st argument must be 16-byte literals in 0..32
515(assert_malformed (module quote "(func (param v128) (result v128)"
516 "(i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (local.get 0) (local.get 0)))")
517 "invalid lane length")
518(assert_malformed (module quote "(func (param v128) (result v128)"
519 "(i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (local.get 0) (local.get 0)))")
520 "invalid lane length")
521(assert_malformed (module quote "(func (result v128)"
522 "(i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -1"
523 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)"
524 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index")
525(assert_malformed (module quote "(func (result v128)"
526 "(i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 256"
527 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)"
528 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index")
529(assert_invalid (module (func (result v128)
530 (i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 255
531 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)
532 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))) "invalid lane index")
533
534;; Possible wrong instruction names that'd be used
535
536(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane 0 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unknown operator")
537(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane 0 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "unknown operator")
538(assert_malformed (module quote "(func (result i32) (i32x4.extract_lane_s 0 (v128.const i32x4 0 0 0 0)))") "unknown operator")
539(assert_malformed (module quote "(func (result i32) (i32x4.extract_lane_u 0 (v128.const i32x4 0 0 0 0)))") "unknown operator")
540(assert_malformed (module quote "(func (result i32) (i64x2.extract_lane_s 0 (v128.const i64x2 0 0)))") "unknown operator")
541(assert_malformed (module quote "(func (result i32) (i64x2.extract_lane_u 0 (v128.const i64x2 0 0)))") "unknown operator")
542
543
544;; Old shuffle instruction names will not work
545(assert_malformed (module quote "(func (result v128) "
546 "(i8x16.shuffle1 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) "
547 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)))")
548 "unknown operator")
549(assert_malformed (module quote "(func (result v128) "
550 "(i8x16.shuffle2_imm 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 "
551 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) "
552 "(v128.const i8x16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31)))")
553 "unknown operator")
554;; i8x16 not v8x16
555(assert_malformed (module quote "(func (result v128) "
556 "(v8x16.swizzle (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) "
557 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)))")
558 "unknown operator")
559(assert_malformed (module quote "(func (result v128) "
560 "(v8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 "
561 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) "
562 "(v128.const i8x16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31)))")
563 "unknown operator")
564
565
566;; Malformed lane index
567
568;; Pass params as the lane index
569
570(assert_malformed (module quote "(func (param i32) (result i32) (i8x16.extract_lane_s (local.get 0) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
571(assert_malformed (module quote "(func (param i32) (result i32) (i8x16.extract_lane_u (local.get 0) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
572(assert_malformed (module quote "(func (param i32) (result i32) (i16x8.extract_lane_s (local.get 0) (v128.const i16x8 0 0 0 0 0 0 0 0)))") "unexpected token")
573(assert_malformed (module quote "(func (param i32) (result i32) (i16x8.extract_lane_u (local.get 0) (v128.const i16x8 0 0 0 0 0 0 0 0)))") "unexpected token")
574(assert_malformed (module quote "(func (param i32) (result i32) (i32x4.extract_lane (local.get 0) (v128.const i32x4 0 0 0 0)))") "unexpected token")
575(assert_malformed (module quote "(func (param i32) (result f32) (f32x4.extract_lane (local.get 0) (v128.const f32x4 0 0 0 0)))") "unexpected token")
576(assert_malformed (module quote "(func (param i32) (result v128) (i8x16.replace_lane (local.get 0) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
577(assert_malformed (module quote "(func (param i32) (result v128) (i16x8.replace_lane (local.get 0) (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
578(assert_malformed (module quote "(func (param i32) (result v128) (i32x4.replace_lane (local.get 0) (v128.const i32x4 0 0 0 0) (i32.const 1)))") "unexpected token")
579(assert_malformed (module quote "(func (param i32) (result v128) (f32x4.replace_lane (local.get 0) (v128.const f32x4 0 0 0 0) (f32.const 1.0)))") "unexpected token")
580
581(assert_malformed (module quote "(func (param i32) (result i64) (i64x2.extract_lane (local.get 0) (v128.const i64x2 0 0)))") "unexpected token")
582(assert_malformed (module quote "(func (param i32) (result f64) (f64x2.extract_lane (local.get 0) (v128.const f64x2 0 0)))") "unexpected token")
583(assert_malformed (module quote "(func (param i32) (result v128) (i64x2.replace_lane (local.get 0) (v128.const i64x2 0 0) (i64.const 1)))") "unexpected token")
584(assert_malformed (module quote "(func (param i32) (result v128) (f64x2.replace_lane (local.get 0) (v128.const f64x2 0 0) (f64.const 1.0)))") "unexpected token")
585
586;; Pass non-literal as the lane index
587
588(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_s 1.5 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
589(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_u nan (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
590(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_s inf (v128.const i16x8 0 0 0 0 0 0 0 0)))") "unexpected token")
591(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_u -inf (v128.const i16x8 0 0 0 0 0 0 0 0)))") "unexpected token")
592(assert_malformed (module quote "(func (result i32) (i32x4.extract_lane nan (v128.const i32x4 0 0 0 0)))") "unexpected token")
593(assert_malformed (module quote "(func (result f32) (f32x4.extract_lane nan (v128.const f32x4 0 0 0 0)))") "unexpected token")
594(assert_malformed (module quote "(func (result v128) (i8x16.replace_lane -2.5 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
595(assert_malformed (module quote "(func (result v128) (i16x8.replace_lane nan (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
596(assert_malformed (module quote "(func (result v128) (i32x4.replace_lane inf (v128.const i32x4 0 0 0 0) (i32.const 1)))") "unexpected token")
597(assert_malformed (module quote "(func (result v128) (f32x4.replace_lane -inf (v128.const f32x4 0 0 0 0) (f32.const 1.1)))") "unexpected token")
598
599;; i8x16.shuffle expects a 16-byte literals as first argument
600(assert_malformed (module quote "(func (result v128) "
601 "(i8x16.shuffle (v128.const i8x16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) "
602 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) "
603 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "invalid lane length")
604(assert_malformed (module quote "(func (result v128) "
605 "(i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15.0) "
606 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) "
607 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index")
608(assert_malformed (module quote "(func (result v128) "
609 "(i8x16.shuffle 0.5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) "
610 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) "
611 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index")
612(assert_malformed (module quote "(func (result v128) "
613 "(i8x16.shuffle -inf 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) "
614 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) "
615 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index")
616(assert_malformed (module quote "(func (result v128) "
617 "(i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 inf) "
618 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) "
619 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index")
620(assert_malformed (module quote "(func (result v128) "
621 "(i8x16.shuffle nan 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) "
622 "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) "
623 "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index")
624
625
626;; Combination with each other
627
628(module
629 ;; as *.replace_lane's operand
630 (func (export "i8x16_extract_lane_s") (param v128 v128) (result v128)
631 (i8x16.replace_lane 0 (local.get 0) (i8x16.extract_lane_s 0 (local.get 1))))
632 (func (export "i8x16_extract_lane_u") (param v128 v128) (result v128)
633 (i8x16.replace_lane 0 (local.get 0) (i8x16.extract_lane_u 0 (local.get 1))))
634 (func (export "i16x8_extract_lane_s") (param v128 v128) (result v128)
635 (i16x8.replace_lane 0 (local.get 0) (i16x8.extract_lane_s 0 (local.get 1))))
636 (func (export "i16x8_extract_lane_u") (param v128 v128) (result v128)
637 (i16x8.replace_lane 0 (local.get 0) (i16x8.extract_lane_u 0 (local.get 1))))
638 (func (export "i32x4_extract_lane") (param v128 v128) (result v128)
639 (i32x4.replace_lane 0 (local.get 0) (i32x4.extract_lane 0 (local.get 1))))
640 (func (export "f32x4_extract_lane") (param v128 v128) (result v128)
641 (i32x4.replace_lane 0 (local.get 0) (i32x4.extract_lane 0 (local.get 1))))
642 (func (export "i64x2_extract_lane") (param v128 v128) (result v128)
643 (i64x2.replace_lane 0 (local.get 0) (i64x2.extract_lane 0 (local.get 1))))
644 (func (export "f64x2_extract_lane") (param v128 v128) (result v128)
645 (f64x2.replace_lane 0 (local.get 0) (f64x2.extract_lane 0 (local.get 1))))
646
647 ;; as *.extract_lane's operand
648 (func (export "i8x16_replace_lane-s") (param v128 i32) (result i32)
649 (i8x16.extract_lane_s 15 (i8x16.replace_lane 15 (local.get 0) (local.get 1))))
650 (func (export "i8x16_replace_lane-u") (param v128 i32) (result i32)
651 (i8x16.extract_lane_u 15 (i8x16.replace_lane 15 (local.get 0) (local.get 1))))
652 (func (export "i16x8_replace_lane-s") (param v128 i32) (result i32)
653 (i16x8.extract_lane_s 7 (i16x8.replace_lane 7 (local.get 0) (local.get 1))))
654 (func (export "i16x8_replace_lane-u") (param v128 i32) (result i32)
655 (i16x8.extract_lane_u 7 (i16x8.replace_lane 7 (local.get 0) (local.get 1))))
656 (func (export "i32x4_replace_lane") (param v128 i32) (result i32)
657 (i32x4.extract_lane 3 (i32x4.replace_lane 3 (local.get 0) (local.get 1))))
658 (func (export "f32x4_replace_lane") (param v128 f32) (result f32)
659 (f32x4.extract_lane 3 (f32x4.replace_lane 3 (local.get 0) (local.get 1))))
660 (func (export "i64x2_replace_lane") (param v128 i64) (result i64)
661 (i64x2.extract_lane 1 (i64x2.replace_lane 1 (local.get 0) (local.get 1))))
662 (func (export "f64x2_replace_lane") (param v128 f64) (result f64)
663 (f64x2.extract_lane 1 (f64x2.replace_lane 1 (local.get 0) (local.get 1))))
664
665 ;; i8x16.replace outputs as shuffle operand
666 (func (export "as-v8x16_swizzle-operand") (param v128 i32 v128) (result v128)
667 (i8x16.swizzle (i8x16.replace_lane 0 (local.get 0) (local.get 1)) (local.get 2)))
668 (func (export "as-v8x16_shuffle-operands") (param v128 i32 v128 i32) (result v128)
669 (i8x16.shuffle 16 1 18 3 20 5 22 7 24 9 26 11 28 13 30 15
670 (i8x16.replace_lane 0 (local.get 0) (local.get 1))
671 (i8x16.replace_lane 15 (local.get 2) (local.get 3))))
672)
673
674(assert_return (invoke "i8x16_extract_lane_s" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (v128.const i8x16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)) (v128.const i8x16 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
675(assert_return (invoke "i8x16_extract_lane_u" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (v128.const i8x16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)) (v128.const i8x16 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
676(assert_return (invoke "i16x8_extract_lane_s" (v128.const i16x8 0 0 0 0 0 0 0 0) (v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) (v128.const i16x8 -1 0 0 0 0 0 0 0))
677(assert_return (invoke "i16x8_extract_lane_u" (v128.const i16x8 0 0 0 0 0 0 0 0) (v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) (v128.const i16x8 65535 0 0 0 0 0 0 0))
678(assert_return (invoke "i32x4_extract_lane" (v128.const i32x4 0 0 0 0) (v128.const i32x4 0x10000 -1 -1 -1)) (v128.const i32x4 65536 0 0 0))
679(assert_return (invoke "f32x4_extract_lane" (v128.const f32x4 0 0 0 0) (v128.const f32x4 1e38 nan nan nan)) (v128.const f32x4 1e38 0 0 0))
680(assert_return (invoke "i8x16_replace_lane-s" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 255)) (i32.const -1))
681(assert_return (invoke "i8x16_replace_lane-u" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 255)) (i32.const 255))
682(assert_return (invoke "i16x8_replace_lane-s" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 65535)) (i32.const -1))
683(assert_return (invoke "i16x8_replace_lane-u" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 65535)) (i32.const 65535))
684(assert_return (invoke "i32x4_replace_lane" (v128.const i32x4 0 0 0 0) (i32.const -1)) (i32.const -1))
685(assert_return (invoke "f32x4_replace_lane" (v128.const f32x4 0 0 0 0) (f32.const 1.25)) (f32.const 1.25))
686
687(assert_return (invoke "i64x2_extract_lane" (v128.const i64x2 0 0) (v128.const i64x2 0xffffffffffffffff -1)) (v128.const i64x2 0xffffffffffffffff 0))
688(assert_return (invoke "f64x2_extract_lane" (v128.const f64x2 0 0) (v128.const f64x2 1e308 nan)) (v128.const f64x2 1e308 0))
689(assert_return (invoke "i64x2_replace_lane" (v128.const i64x2 0 0) (i64.const -1)) (i64.const -1))
690(assert_return (invoke "f64x2_replace_lane" (v128.const f64x2 0 0) (f64.const 2.5)) (f64.const 2.5))
691
692(assert_return (invoke "as-v8x16_swizzle-operand"
693 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) (i32.const 255)
694 (v128.const i8x16 -1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1))
695 (v128.const i8x16 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1))
696(assert_return (invoke "as-v8x16_shuffle-operands"
697 (v128.const i8x16 0 255 0 255 15 255 0 255 255 255 0 255 127 255 0 255) (i32.const 1)
698 (v128.const i8x16 0x55 0 0x55 0 0x55 0 0x55 0 0x55 0 0x55 0 0x55 1 0x55 -1) (i32.const 0))
699 (v128.const i8x16 0x55 0xff 0x55 0xff 0x55 0xff 0x55 0xff 0x55 0xff 0x55 0xff 0x55 0xff 0x55 0xff))
700
701;; Combination with other SIMD instructions
702
703(module
704 ;; Constructing SIMD values
705 (func (export "as-i8x16_splat-operand") (param v128) (result v128)
706 (i8x16.splat (i8x16.extract_lane_s 0 (local.get 0))))
707 (func (export "as-i16x8_splat-operand") (param v128) (result v128)
708 (i16x8.splat (i16x8.extract_lane_u 0 (local.get 0))))
709 (func (export "as-i32x4_splat-operand") (param v128) (result v128)
710 (i32x4.splat (i32x4.extract_lane 0 (local.get 0))))
711 (func (export "as-f32x4_splat-operand") (param v128) (result v128)
712 (f32x4.splat (f32x4.extract_lane 0 (local.get 0))))
713 (func (export "as-i64x2_splat-operand") (param v128) (result v128)
714 (i64x2.splat (i64x2.extract_lane 0 (local.get 0))))
715 (func (export "as-f64x2_splat-operand") (param v128) (result v128)
716 (f64x2.splat (f64x2.extract_lane 0 (local.get 0))))
717
718 ;; Integer arithmetic
719 (func (export "as-i8x16_add-operands") (param v128 i32 v128 i32) (result v128)
720 (i8x16.add (i8x16.replace_lane 0 (local.get 0) (local.get 1)) (i8x16.replace_lane 15 (local.get 2) (local.get 3))))
721 (func (export "as-i16x8_add-operands") (param v128 i32 v128 i32) (result v128)
722 (i16x8.add (i16x8.replace_lane 0 (local.get 0) (local.get 1)) (i16x8.replace_lane 7 (local.get 2) (local.get 3))))
723 (func (export "as-i32x4_add-operands") (param v128 i32 v128 i32) (result v128)
724 (i32x4.add (i32x4.replace_lane 0 (local.get 0) (local.get 1)) (i32x4.replace_lane 3 (local.get 2) (local.get 3))))
725 (func (export "as-i64x2_add-operands") (param v128 i64 v128 i64) (result v128)
726 (i64x2.add (i64x2.replace_lane 0 (local.get 0) (local.get 1)) (i64x2.replace_lane 1 (local.get 2) (local.get 3))))
727
728 (func (export "swizzle-as-i8x16_add-operands") (param v128 v128 v128 v128) (result v128)
729 (i8x16.add (i8x16.swizzle (local.get 0) (local.get 1)) (i8x16.swizzle (local.get 2) (local.get 3))))
730 (func (export "shuffle-as-i8x16_sub-operands") (param v128 v128 v128 v128) (result v128)
731 (i8x16.sub (i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (local.get 0) (local.get 1))
732 (i8x16.shuffle 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 (local.get 2) (local.get 3))))
733
734 ;; Boolean horizontal reductions
735 (func (export "as-i8x16_any_true-operand") (param v128 i32) (result i32)
736 (v128.any_true (i8x16.replace_lane 0 (local.get 0) (local.get 1))))
737 (func (export "as-i16x8_any_true-operand") (param v128 i32) (result i32)
738 (v128.any_true (i16x8.replace_lane 0 (local.get 0) (local.get 1))))
739 (func (export "as-i32x4_any_true-operand1") (param v128 i32) (result i32)
740 (v128.any_true (i32x4.replace_lane 0 (local.get 0) (local.get 1))))
741 (func (export "as-i32x4_any_true-operand2") (param v128 i64) (result i32)
742 (v128.any_true (i64x2.replace_lane 0 (local.get 0) (local.get 1))))
743
744 (func (export "swizzle-as-i8x16_all_true-operands") (param v128 v128) (result i32)
745 (i8x16.all_true (i8x16.swizzle (local.get 0) (local.get 1))))
746 (func (export "shuffle-as-i8x16_any_true-operands") (param v128 v128) (result i32)
747 (v128.any_true (i8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (local.get 0) (local.get 1))))
748)
749
750(assert_return (invoke "as-i8x16_splat-operand" (v128.const i8x16 0xff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (v128.const i8x16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1))
751(assert_return (invoke "as-i16x8_splat-operand" (v128.const i16x8 -1 -1 -1 -1 0 0 0 0)) (v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1))
752(assert_return (invoke "as-i32x4_splat-operand" (v128.const i32x4 0x10000 0 0 0)) (v128.const i32x4 65536 65536 65536 65536))
753(assert_return (invoke "as-f32x4_splat-operand" (v128.const f32x4 3.14 nan nan nan)) (v128.const f32x4 3.14 3.14 3.14 3.14))
754(assert_return (invoke "as-i64x2_splat-operand" (v128.const i64x2 -1 0)) (v128.const i64x2 -1 -1))
755(assert_return (invoke "as-f64x2_splat-operand" (v128.const f64x2 inf nan)) (v128.const f64x2 inf inf))
756(assert_return (invoke "as-i8x16_add-operands"
757 (v128.const i8x16 0xff 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16) (i32.const 1)
758 (v128.const i8x16 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0xff) (i32.const 1))
759 (v128.const i8x16 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17))
760(assert_return (invoke "as-i16x8_add-operands"
761 (v128.const i16x8 -1 4 9 16 25 36 49 64) (i32.const 1)
762 (v128.const i16x8 64 49 36 25 16 9 4 -1) (i32.const 1))
763 (v128.const i16x8 65 53 45 41 41 45 53 65))
764(assert_return (invoke "as-i32x4_add-operands"
765 (v128.const i32x4 -1 8 27 64) (i32.const 1) (v128.const i32x4 64 27 8 -1) (i32.const 1)) (v128.const i32x4 65 35 35 65))
766(assert_return (invoke "as-i64x2_add-operands"
767 (v128.const i64x2 -1 8) (i64.const 1) (v128.const i64x2 64 27) (i64.const 1)) (v128.const i64x2 65 9))
768
769(assert_return (invoke "swizzle-as-i8x16_add-operands"
770 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
771 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
772 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
773 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
774 (v128.const i8x16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1))
775(assert_return (invoke "shuffle-as-i8x16_sub-operands"
776 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
777 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)
778 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
779 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
780 (v128.const i8x16 -15 -13 -11 -9 -7 -5 -3 -1 1 3 5 7 9 11 13 15))
781
782(assert_return (invoke "as-i8x16_any_true-operand" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)) (i32.const 1))
783(assert_return (invoke "as-i16x8_any_true-operand" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)) (i32.const 1))
784(assert_return (invoke "as-i32x4_any_true-operand1" (v128.const i32x4 1 0 0 0) (i32.const 0)) (i32.const 0))
785(assert_return (invoke "as-i32x4_any_true-operand2" (v128.const i64x2 1 0) (i64.const 0)) (i32.const 0))
786
787(assert_return (invoke "swizzle-as-i8x16_all_true-operands"
788 (v128.const i8x16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)
789 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) (i32.const 1))
790(assert_return (invoke "swizzle-as-i8x16_all_true-operands"
791 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
792 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16)) (i32.const 0))
793(assert_return (invoke "shuffle-as-i8x16_any_true-operands"
794 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
795 (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) (i32.const 1))
796
797;; Load and store
798
799(module
800 (memory 1)
801 (func (export "as-v128_store-operand-1") (param v128 i32) (result v128)
802 (v128.store (i32.const 0) (i8x16.replace_lane 0 (local.get 0) (local.get 1)))
803 (v128.load (i32.const 0)))
804 (func (export "as-v128_store-operand-2") (param v128 i32) (result v128)
805 (v128.store (i32.const 0) (i16x8.replace_lane 0 (local.get 0) (local.get 1)))
806 (v128.load (i32.const 0)))
807 (func (export "as-v128_store-operand-3") (param v128 i32) (result v128)
808 (v128.store (i32.const 0) (i32x4.replace_lane 0 (local.get 0) (local.get 1)))
809 (v128.load (i32.const 0)))
810 (func (export "as-v128_store-operand-4") (param v128 f32) (result v128)
811 (v128.store (i32.const 0) (f32x4.replace_lane 0 (local.get 0) (local.get 1)))
812 (v128.load (i32.const 0)))
813 (func (export "as-v128_store-operand-5") (param v128 i64) (result v128)
814 (v128.store (i32.const 0) (i64x2.replace_lane 0 (local.get 0) (local.get 1)))
815 (v128.load (i32.const 0)))
816 (func (export "as-v128_store-operand-6") (param v128 f64) (result v128)
817 (v128.store (i32.const 0) (f64x2.replace_lane 0 (local.get 0) (local.get 1)))
818 (v128.load (i32.const 0)))
819)
820
821(assert_return (invoke "as-v128_store-operand-1" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)) (v128.const i8x16 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
822(assert_return (invoke "as-v128_store-operand-2" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 256)) (v128.const i16x8 0x100 0 0 0 0 0 0 0))
823(assert_return (invoke "as-v128_store-operand-3" (v128.const i32x4 0 0 0 0) (i32.const 0xffffffff)) (v128.const i32x4 -1 0 0 0))
824(assert_return (invoke "as-v128_store-operand-4" (v128.const f32x4 0 0 0 0) (f32.const 3.14)) (v128.const f32x4 3.14 0 0 0))
825(assert_return (invoke "as-v128_store-operand-5" (v128.const i64x2 0 0) (i64.const 0xffffffffffffffff)) (v128.const i64x2 -1 0))
826(assert_return (invoke "as-v128_store-operand-6" (v128.const f64x2 0 0) (f64.const 3.14)) (v128.const f64x2 3.14 0))
827
828;; As the argument of wasm core ops
829
830(module
831 (global $g (mut v128) (v128.const f32x4 0.0 0.0 0.0 0.0))
832 (global $h (mut v128) (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
833 (func (export "as-if-condition-value") (param v128) (result i32)
834 (if (result i32) (i8x16.extract_lane_s 0 (local.get 0)) (then (i32.const 0xff)) (else (i32.const 0))))
835 (func (export "as-return-value-1") (param v128 i32) (result v128)
836 (return (i16x8.replace_lane 0 (local.get 0) (local.get 1))))
837 (func (export "as-local_set-value") (param v128) (result i32) (local i32)
838 (local.set 1 (i32x4.extract_lane 0 (local.get 0)))
839 (return (local.get 1)))
840 (func (export "as-global_set-value-1") (param v128 f32) (result v128)
841 (global.set $g (f32x4.replace_lane 0 (local.get 0) (local.get 1)))
842 (return (global.get $g)))
843
844 (func (export "as-return-value-2") (param v128 v128) (result v128)
845 (return (i8x16.swizzle (local.get 0) (local.get 1))))
846 (func (export "as-global_set-value-2") (param v128 v128) (result v128)
847 (global.set $h (i8x16.shuffle 0 1 2 3 4 5 6 7 24 25 26 27 28 29 30 31 (local.get 0) (local.get 1)))
848 (return (global.get $h)))
849
850 (func (export "as-local_set-value-1") (param v128) (result i64) (local i64)
851 (local.set 1 (i64x2.extract_lane 0 (local.get 0)))
852 (return (local.get 1)))
853 (func (export "as-global_set-value-3") (param v128 f64) (result v128)
854 (global.set $g (f64x2.replace_lane 0 (local.get 0) (local.get 1)))
855 (return (global.get $g)))
856)
857
858(assert_return (invoke "as-if-condition-value" (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (i32.const 0))
859(assert_return (invoke "as-return-value-1" (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)) (v128.const i16x8 1 0 0 0 0 0 0 0))
860(assert_return (invoke "as-local_set-value" (v128.const i32x4 -1 -1 -1 -1)) (i32.const -1))
861(assert_return (invoke "as-global_set-value-1" (v128.const f32x4 0 0 0 0)(f32.const 3.14)) (v128.const f32x4 3.14 0 0 0))
862
863(assert_return (invoke "as-return-value-2"
864 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
865 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
866 (v128.const i8x16 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16))
867(assert_return (invoke "as-global_set-value-2"
868 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
869 (v128.const i8x16 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1))
870 (v128.const i8x16 -16 -15 -14 -13 -12 -11 -10 -9 8 7 6 5 4 3 2 1))
871
872(assert_return (invoke "as-local_set-value-1" (v128.const i64x2 -1 -1)) (i64.const -1))
873(assert_return (invoke "as-global_set-value-3" (v128.const f64x2 0 0)(f64.const 3.14)) (v128.const f64x2 3.14 0))
874
875;; Non-nat lane index
876
877(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_u +0x0f (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
878(assert_malformed (module quote "(func (result f32) (f32x4.extract_lane +03 (v128.const f32x4 0 0 0 0)))") "unexpected token")
879(assert_malformed (module quote "(func (result i64) (i64x2.extract_lane +1 (v128.const i64x2 0 0)))") "unexpected token")
880(assert_malformed (module quote "(func (result v128) (i8x16.replace_lane +015 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
881(assert_malformed (module quote "(func (result v128) (i16x8.replace_lane +0x7 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))") "unexpected token")
882(assert_malformed (module quote "(func (result v128) (i32x4.replace_lane +3 (v128.const i32x4 0 0 0 0) (i32.const 1)))") "unexpected token")
883(assert_malformed (module quote "(func (result v128) (f64x2.replace_lane +0x01 (v128.const f64x2 0 0) (f64.const 1.0)))") "unexpected token")
884
885;; Lane index literal
886
887(module (func (result i32) (i8x16.extract_lane_s 0x0f (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))))
888(module (func (result i32) (i16x8.extract_lane_s 0x07 (v128.const i16x8 0 0 0 0 0 0 0 0))))
889(module (func (result i32) (i16x8.extract_lane_u 0x0_7 (v128.const i16x8 0 0 0 0 0 0 0 0))))
890(module (func (result i32) (i32x4.extract_lane 03 (v128.const i32x4 0 0 0 0))))
891(module (func (result f64) (f64x2.extract_lane 0x1 (v128.const f64x2 0 0))))
892(module (func (result v128) (f32x4.replace_lane 0x3 (v128.const f32x4 0 0 0 0) (f32.const 1.0))))
893(module (func (result v128) (i64x2.replace_lane 01 (v128.const i64x2 0 0) (i64.const 1))))
894
895;; 1.0 is malformed lane index
896
897(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_s 1.0 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "unexpected token")
898
899;; Test operation with empty argument
900
901(assert_malformed
902 (module quote
903 "(func $i8x16.extract_lane_s-1st-arg-empty (result i32)"
904 " (i8x16.extract_lane_s (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))"
905 ")"
906 )
907 "unexpected token"
908)
909(assert_invalid
910 (module
911 (func $i8x16.extract_lane_s-2nd-arg-empty (result i32)
912 (i8x16.extract_lane_s 0)
913 )
914 )
915 "type mismatch"
916)
917(assert_malformed
918 (module quote
919 "(func $i8x16.extract_lane_s-arg-empty (result i32)"
920 " (i8x16.extract_lane_s)"
921 ")"
922 )
923 "unexpected token"
924)
925(assert_malformed
926 (module quote
927 "(func $i16x8.extract_lane_u-1st-arg-empty (result i32)"
928 " (i16x8.extract_lane_u (v128.const i16x8 0 0 0 0 0 0 0 0))"
929 ")"
930 )
931 "unexpected token"
932)
933(assert_invalid
934 (module
935 (func $i16x8.extract_lane_u-2nd-arg-empty (result i32)
936 (i16x8.extract_lane_u 0)
937 )
938 )
939 "type mismatch"
940)
941(assert_malformed
942 (module quote
943 "(func $i16x8.extract_lane_u-arg-empty (result i32)"
944 " (i16x8.extract_lane_u)"
945 ")"
946 )
947 "unexpected token"
948)
949(assert_malformed
950 (module quote
951 "(func $i32x4.extract_lane-1st-arg-empty (result i32)"
952 " (i32x4.extract_lane (v128.const i32x4 0 0 0 0))"
953 ")"
954 )
955 "unexpected token"
956)
957(assert_invalid
958 (module
959 (func $i32x4.extract_lane-2nd-arg-empty (result i32)
960 (i32x4.extract_lane 0)
961 )
962 )
963 "type mismatch"
964)
965(assert_malformed
966 (module quote
967 "(func $i32x4.extract_lane-arg-empty (result i32)"
968 " (i32x4.extract_lane)"
969 ")"
970 )
971 "unexpected token"
972)
973(assert_malformed
974 (module quote
975 "(func $i64x2.extract_lane-1st-arg-empty (result i64)"
976 " (i64x2.extract_lane (v128.const i64x2 0 0))"
977 ")"
978 )
979 "unexpected token"
980)
981(assert_invalid
982 (module
983 (func $i64x2.extract_lane-2nd-arg-empty (result i64)
984 (i64x2.extract_lane 0)
985 )
986 )
987 "type mismatch"
988)
989(assert_malformed
990 (module quote
991 "(func $i64x2.extract_lane-arg-empty (result i64)"
992 " (i64x2.extract_lane)"
993 ")"
994 )
995 "unexpected token"
996)
997(assert_malformed
998 (module quote
999 "(func $f32x4.extract_lane-1st-arg-empty (result f32)"
1000 " (f32x4.extract_lane (v128.const f32x4 0 0 0 0))"
1001 ")"
1002 )
1003 "unexpected token"
1004)
1005(assert_invalid
1006 (module
1007 (func $f32x4.extract_lane-2nd-arg-empty (result f32)
1008 (f32x4.extract_lane 0)
1009 )
1010 )
1011 "type mismatch"
1012)
1013(assert_malformed
1014 (module quote
1015 "(func $f32x4.extract_lane-arg-empty (result f32)"
1016 " (f32x4.extract_lane)"
1017 ")"
1018 )
1019 "unexpected token"
1020)
1021(assert_malformed
1022 (module quote
1023 "(func $f64x2.extract_lane-1st-arg-empty (result f64)"
1024 " (f64x2.extract_lane (v128.const f64x2 0 0))"
1025 ")"
1026 )
1027 "unexpected token"
1028)
1029(assert_invalid
1030 (module
1031 (func $f64x2.extract_lane-2nd-arg-empty (result f64)
1032 (f64x2.extract_lane 0)
1033 )
1034 )
1035 "type mismatch"
1036)
1037(assert_malformed
1038 (module quote
1039 "(func $f64x2.extract_lane-arg-empty (result f64)"
1040 " (f64x2.extract_lane)"
1041 ")"
1042 )
1043 "unexpected token"
1044)
1045(assert_malformed
1046 (module quote
1047 "(func $i8x16.replace_lane-1st-arg-empty (result v128)"
1048 " (i8x16.replace_lane (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1))"
1049 ")"
1050 )
1051 "unexpected token"
1052)
1053(assert_invalid
1054 (module
1055 (func $i8x16.replace_lane-2nd-arg-empty (result v128)
1056 (i8x16.replace_lane 0 (i32.const 1))
1057 )
1058 )
1059 "type mismatch"
1060)
1061(assert_invalid
1062 (module
1063 (func $i8x16.replace_lane-3rd-arg-empty (result v128)
1064 (i8x16.replace_lane 0 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
1065 )
1066 )
1067 "type mismatch"
1068)
1069(assert_malformed
1070 (module quote
1071 "(func $i8x16.replace_lane-arg-empty (result v128)"
1072 " (i8x16.replace_lane)"
1073 ")"
1074 )
1075 "unexpected token"
1076)
1077(assert_malformed
1078 (module quote
1079 "(func $i16x8.replace_lane-1st-arg-empty (result v128)"
1080 " (i16x8.replace_lane (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1))"
1081 ")"
1082 )
1083 "unexpected token"
1084)
1085(assert_invalid
1086 (module
1087 (func $i16x8.replace_lane-2nd-arg-empty (result v128)
1088 (i16x8.replace_lane 0 (i32.const 1))
1089 )
1090 )
1091 "type mismatch"
1092)
1093(assert_invalid
1094 (module
1095 (func $i16x8.replace_lane-3rd-arg-empty (result v128)
1096 (i16x8.replace_lane 0 (v128.const i16x8 0 0 0 0 0 0 0 0))
1097 )
1098 )
1099 "type mismatch"
1100)
1101(assert_malformed
1102 (module quote
1103 "(func $i16x8.replace_lane-arg-empty (result v128)"
1104 " (i16x8.replace_lane)"
1105 ")"
1106 )
1107 "unexpected token"
1108)
1109(assert_malformed
1110 (module quote
1111 "(func $i32x4.replace_lane-1st-arg-empty (result v128)"
1112 " (i32x4.replace_lane (v128.const i32x4 0 0 0 0) (i32.const 1))"
1113 ")"
1114 )
1115 "unexpected token"
1116)
1117(assert_invalid
1118 (module
1119 (func $i32x4.replace_lane-2nd-arg-empty (result v128)
1120 (i32x4.replace_lane 0 (i32.const 1))
1121 )
1122 )
1123 "type mismatch"
1124)
1125(assert_invalid
1126 (module
1127 (func $i32x4.replace_lane-3rd-arg-empty (result v128)
1128 (i32x4.replace_lane 0 (v128.const i32x4 0 0 0 0))
1129 )
1130 )
1131 "type mismatch"
1132)
1133(assert_malformed
1134 (module quote
1135 "(func $i32x4.replace_lane-arg-empty (result v128)"
1136 " (i32x4.replace_lane)"
1137 ")"
1138 )
1139 "unexpected token"
1140)
1141(assert_malformed
1142 (module quote
1143 "(func $f32x4.replace_lane-1st-arg-empty (result v128)"
1144 " (f32x4.replace_lane (v128.const f32x4 0 0 0 0) (f32.const 1.0))"
1145 ")"
1146 )
1147 "unexpected token"
1148)
1149(assert_invalid
1150 (module
1151 (func $f32x4.replace_lane-2nd-arg-empty (result v128)
1152 (f32x4.replace_lane 0 (f32.const 1.0))
1153 )
1154 )
1155 "type mismatch"
1156)
1157(assert_invalid
1158 (module
1159 (func $f32x4.replace_lane-3rd-arg-empty (result v128)
1160 (f32x4.replace_lane 0 (v128.const f32x4 0 0 0 0))
1161 )
1162 )
1163 "type mismatch"
1164)
1165(assert_malformed
1166 (module quote
1167 "(func $f32x4.replace_lane-arg-empty (result v128)"
1168 " (f32x4.replace_lane)"
1169 ")"
1170 )
1171 "unexpected token"
1172)
1173(assert_malformed
1174 (module quote
1175 "(func $i64x2.replace_lane-1st-arg-empty (result v128)"
1176 " (i64x2.replace_lane (v128.const i64x2 0 0) (i64.const 1))"
1177 ")"
1178 )
1179 "unexpected token"
1180)
1181(assert_invalid
1182 (module
1183 (func $i64x2.replace_lane-2nd-arg-empty (result v128)
1184 (i64x2.replace_lane 0 (i64.const 1))
1185 )
1186 )
1187 "type mismatch"
1188)
1189(assert_invalid
1190 (module
1191 (func $i64x2.replace_lane-3rd-arg-empty (result v128)
1192 (i64x2.replace_lane 0 (v128.const i64x2 0 0))
1193 )
1194 )
1195 "type mismatch"
1196)
1197(assert_malformed
1198 (module quote
1199 "(func $i64x2.replace_lane-arg-empty (result v128)"
1200 " (i64x2.replace_lane)"
1201 ")"
1202 )
1203 "unexpected token"
1204)
1205(assert_malformed
1206 (module quote
1207 "(func $f64x2.replace_lane-1st-arg-empty (result v128)"
1208 " (f64x2.replace_lane (v128.const f64x2 0 0) (f64.const 1.0))"
1209 ")"
1210 )
1211 "unexpected token"
1212)
1213(assert_invalid
1214 (module
1215 (func $f64x2.replace_lane-2nd-arg-empty (result v128)
1216 (f64x2.replace_lane 0 (f64.const 1.0))
1217 )
1218 )
1219 "type mismatch"
1220)
1221(assert_invalid
1222 (module
1223 (func $f64x2.replace_lane-3rd-arg-empty (result v128)
1224 (f64x2.replace_lane 0 (v128.const f64x2 0 0))
1225 )
1226 )
1227 "type mismatch"
1228)
1229(assert_malformed
1230 (module quote
1231 "(func $f64x2.replace_lane-arg-empty (result v128)"
1232 " (f64x2.replace_lane)"
1233 ")"
1234 )
1235 "unexpected token"
1236)
1237(assert_malformed
1238 (module quote
1239 "(func $i8x16.shuffle-1st-arg-empty (result v128)"
1240 " (i8x16.shuffle"
1241 " (v128.const i8x16 0 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15)"
1242 " (v128.const i8x16 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15 16)"
1243 " )"
1244 ")"
1245 )
1246 "invalid lane length"
1247)
1248(assert_invalid
1249 (module
1250 (func $i8x16.shuffle-2nd-arg-empty (result v128)
1251 (i8x16.shuffle 0 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15
1252 (v128.const i8x16 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15 16)
1253 )
1254 )
1255 )
1256 "type mismatch"
1257)
1258(assert_malformed
1259 (module quote
1260 "(func $i8x16.shuffle-arg-empty (result v128)"
1261 " (i8x16.shuffle)"
1262 ")"
1263 )
1264 "invalid lane length"
1265)
View as plain text