00963a0d032d0e8dd58b1b4396d89bc9a1548b19
[platform/framework/web/lwnode.git] /
1 ;; Tests for i64x2 arithmetic operations on major boundary values and all special values.
2
3
4 (module
5   (func (export "i64x2.add") (param v128 v128) (result v128) (i64x2.add (local.get 0) (local.get 1)))
6   (func (export "i64x2.sub") (param v128 v128) (result v128) (i64x2.sub (local.get 0) (local.get 1)))
7   (func (export "i64x2.mul") (param v128 v128) (result v128) (i64x2.mul (local.get 0) (local.get 1)))
8   (func (export "i64x2.neg") (param v128) (result v128) (i64x2.neg (local.get 0)))
9 )
10
11
12 ;; i64x2.add
13 (assert_return (invoke "i64x2.add" (v128.const i64x2 0 0)
14                                    (v128.const i64x2 0 0))
15                                    (v128.const i64x2 0 0))
16 (assert_return (invoke "i64x2.add" (v128.const i64x2 0 0)
17                                    (v128.const i64x2 1 1))
18                                    (v128.const i64x2 1 1))
19 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
20                                    (v128.const i64x2 1 1))
21                                    (v128.const i64x2 2 2))
22 (assert_return (invoke "i64x2.add" (v128.const i64x2 0 0)
23                                    (v128.const i64x2 -1 -1))
24                                    (v128.const i64x2 -1 -1))
25 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
26                                    (v128.const i64x2 -1 -1))
27                                    (v128.const i64x2 0 0))
28 (assert_return (invoke "i64x2.add" (v128.const i64x2 -1 -1)
29                                    (v128.const i64x2 -1 -1))
30                                    (v128.const i64x2 -2 -2))
31 (assert_return (invoke "i64x2.add" (v128.const i64x2 4611686018427387903 4611686018427387903)
32                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
33                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
34 (assert_return (invoke "i64x2.add" (v128.const i64x2 4611686018427387904 4611686018427387904)
35                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
36                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
37 (assert_return (invoke "i64x2.add" (v128.const i64x2 -4611686018427387903 -4611686018427387903)
38                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
39                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
40 (assert_return (invoke "i64x2.add" (v128.const i64x2 -4611686018427387904 -4611686018427387904)
41                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
42                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
43 (assert_return (invoke "i64x2.add" (v128.const i64x2 -4611686018427387905 -4611686018427387905)
44                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
45                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
46 (assert_return (invoke "i64x2.add" (v128.const i64x2 9223372036854775805 9223372036854775805)
47                                    (v128.const i64x2 1 1))
48                                    (v128.const i64x2 9223372036854775806 9223372036854775806))
49 (assert_return (invoke "i64x2.add" (v128.const i64x2 9223372036854775806 9223372036854775806)
50                                    (v128.const i64x2 1 1))
51                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
52 (assert_return (invoke "i64x2.add" (v128.const i64x2 9223372036854775808 9223372036854775808)
53                                    (v128.const i64x2 1 1))
54                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
55 (assert_return (invoke "i64x2.add" (v128.const i64x2 -9223372036854775806 -9223372036854775806)
56                                    (v128.const i64x2 -1 -1))
57                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
58 (assert_return (invoke "i64x2.add" (v128.const i64x2 -9223372036854775807 -9223372036854775807)
59                                    (v128.const i64x2 -1 -1))
60                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
61 (assert_return (invoke "i64x2.add" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
62                                    (v128.const i64x2 -1 -1))
63                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
64 (assert_return (invoke "i64x2.add" (v128.const i64x2 9223372036854775807 9223372036854775807)
65                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
66                                    (v128.const i64x2 -2 -2))
67 (assert_return (invoke "i64x2.add" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
68                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
69                                    (v128.const i64x2 0 0))
70 (assert_return (invoke "i64x2.add" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
71                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
72                                    (v128.const i64x2 1 1))
73 (assert_return (invoke "i64x2.add" (v128.const i64x2 18446744073709551615 18446744073709551615)
74                                    (v128.const i64x2 0 0))
75                                    (v128.const i64x2 -1 -1))
76 (assert_return (invoke "i64x2.add" (v128.const i64x2 18446744073709551615 18446744073709551615)
77                                    (v128.const i64x2 1 1))
78                                    (v128.const i64x2 0 0))
79 (assert_return (invoke "i64x2.add" (v128.const i64x2 18446744073709551615 18446744073709551615)
80                                    (v128.const i64x2 -1 -1))
81                                    (v128.const i64x2 -2 -2))
82 (assert_return (invoke "i64x2.add" (v128.const i64x2 18446744073709551615 18446744073709551615)
83                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
84                                    (v128.const i64x2 9223372036854775806 9223372036854775806))
85 (assert_return (invoke "i64x2.add" (v128.const i64x2 18446744073709551615 18446744073709551615)
86                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
87                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
88 (assert_return (invoke "i64x2.add" (v128.const i64x2 18446744073709551615 18446744073709551615)
89                                    (v128.const i64x2 18446744073709551615 18446744073709551615))
90                                    (v128.const i64x2 -2 -2))
91 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x3fffffffffffffff 0x3fffffffffffffff)
92                                    (v128.const i64x2 0x4000000000000000 0x4000000000000000))
93                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
94 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x4000000000000000 0x4000000000000000)
95                                    (v128.const i64x2 0x4000000000000000 0x4000000000000000))
96                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
97 (assert_return (invoke "i64x2.add" (v128.const i64x2 -0x3fffffffffffffff -0x3fffffffffffffff)
98                                    (v128.const i64x2 -0x40000000fffffff -0x40000000fffffff))
99                                    (v128.const i64x2 -4899916394847535102 -4899916394847535102))
100 (assert_return (invoke "i64x2.add" (v128.const i64x2 -0x4000000000000000 -0x4000000000000000)
101                                    (v128.const i64x2 -0x400000000000000 -0x400000000000000))
102                                    (v128.const i64x2 -4899916394579099648 -4899916394579099648))
103 (assert_return (invoke "i64x2.add" (v128.const i64x2 -0x4000000000000000 -0x4000000000000000)
104                                    (v128.const i64x2 -0x400000000000001 -0x400000000000001))
105                                    (v128.const i64x2 -4899916394579099649 -4899916394579099649))
106 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
107                                    (v128.const i64x2 0x7ffffffffffffff 0x7ffffffffffffff))
108                                    (v128.const i64x2 -8646911284551352322 -8646911284551352322))
109 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
110                                    (v128.const i64x2 0x01 0x01))
111                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
112 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
113                                    (v128.const i64x2 -0x01 -0x01))
114                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
115 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
116                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
117                                    (v128.const i64x2 -1 -1))
118 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
119                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
120                                    (v128.const i64x2 0 0))
121 (assert_return (invoke "i64x2.add" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
122                                    (v128.const i64x2 0x01 0x01))
123                                    (v128.const i64x2 0 0))
124 (assert_return (invoke "i64x2.add" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
125                                    (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff))
126                                    (v128.const i64x2 -2 -2))
127 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
128                                    (v128.const i8x16 0 0 0 0 0 0 0 0x80 0 0 0 0 0 0 0 0x80))
129                                    (v128.const i64x2 -1 -1))
130 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
131                                    (v128.const i8x16 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255))
132                                    (v128.const i64x2 0 0))
133 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
134                                    (v128.const i16x8 0 0 0 0x8000 0 0 0 0x8000))
135                                    (v128.const i64x2 -1 -1))
136 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
137                                    (v128.const i16x8 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff))
138                                    (v128.const i64x2 0 0))
139 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
140                                    (v128.const i32x4 0 0x80000000 0 0x80000000))
141                                    (v128.const i64x2 -1 -1))
142 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
143                                    (v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff))
144                                    (v128.const i64x2 0 0))
145 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
146                                    (v128.const f64x2 +0.0 +0.0))
147                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
148 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
149                                    (v128.const f64x2 -0.0 -0.0))
150                                    (v128.const i64x2 0 0))
151 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
152                                    (v128.const f64x2 1.0 1.0))
153                                    (v128.const i64x2 0xbff0000000000000 0xbff0000000000000))
154 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
155                                    (v128.const f64x2 -1.0 -1.0))
156                                    (v128.const i64x2 0x3ff0000000000000 0x3ff0000000000000))
157 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
158                                    (v128.const f64x2 +inf +inf))
159                                    (v128.const i64x2 0x7ff0000000000001 0x7ff0000000000001))
160 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
161                                    (v128.const f64x2 -inf -inf))
162                                    (v128.const i64x2 0xfff0000000000001 0xfff0000000000001))
163 (assert_return (invoke "i64x2.add" (v128.const i64x2 1 1)
164                                    (v128.const f64x2 nan nan))
165                                    (v128.const i64x2 0x7ff8000000000001 0x7ff8000000000001))
166 (assert_return (invoke "i64x2.add" (v128.const i64x2 0 1)
167                                    (v128.const i64x2 0 0xffffffffffffffff))
168                                    (v128.const i64x2 0 0))
169 (assert_return (invoke "i64x2.add" (v128.const i64x2 0 1)
170                                    (v128.const i64x2 0 2))
171                                    (v128.const i64x2 0 3))
172 (assert_return (invoke "i64x2.add" (v128.const i64x2 01_234_567_890_123_456_789 01_234_567_890_123_456_789)
173                                    (v128.const i64x2 01_234_567_890_123_456_789 01_234_567_890_123_456_789))
174                                    (v128.const i64x2 02_469_135_780_246_913_578 02_469_135_780_246_913_578))
175 (assert_return (invoke "i64x2.add" (v128.const i64x2 0x0_1234_5678_90AB_cdef 0x0_1234_5678_90AB_cdef)
176                                    (v128.const i64x2 0x0_90AB_cdef_1234_5678 0x0_90AB_cdef_1234_5678))
177                                    (v128.const i64x2 0x0_a2e0_2467_a2e0_2467 0x0_a2e0_2467_a2e0_2467))
178
179 ;; i64x2.sub
180 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0 0)
181                                    (v128.const i64x2 0 0))
182                                    (v128.const i64x2 0 0))
183 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0 0)
184                                    (v128.const i64x2 1 1))
185                                    (v128.const i64x2 -1 -1))
186 (assert_return (invoke "i64x2.sub" (v128.const i64x2 1 1)
187                                    (v128.const i64x2 1 1))
188                                    (v128.const i64x2 0 0))
189 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0 0)
190                                    (v128.const i64x2 -1 -1))
191                                    (v128.const i64x2 1 1))
192 (assert_return (invoke "i64x2.sub" (v128.const i64x2 1 1)
193                                    (v128.const i64x2 -1 -1))
194                                    (v128.const i64x2 2 2))
195 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -1 -1)
196                                    (v128.const i64x2 -1 -1))
197                                    (v128.const i64x2 0 0))
198 (assert_return (invoke "i64x2.sub" (v128.const i64x2 4611686018427387903 4611686018427387903)
199                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
200                                    (v128.const i64x2 -1 -1))
201 (assert_return (invoke "i64x2.sub" (v128.const i64x2 4611686018427387904 4611686018427387904)
202                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
203                                    (v128.const i64x2 0 0))
204 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -4611686018427387903 -4611686018427387903)
205                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
206                                    (v128.const i64x2 1 1))
207 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -4611686018427387904 -4611686018427387904)
208                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
209                                    (v128.const i64x2 0 0))
210 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -4611686018427387905 -4611686018427387905)
211                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
212                                    (v128.const i64x2 -1 -1))
213 (assert_return (invoke "i64x2.sub" (v128.const i64x2 9223372036854775805 9223372036854775805)
214                                    (v128.const i64x2 1 1))
215                                    (v128.const i64x2 9223372036854775804 9223372036854775804))
216 (assert_return (invoke "i64x2.sub" (v128.const i64x2 9223372036854775806 9223372036854775806)
217                                    (v128.const i64x2 1 1))
218                                    (v128.const i64x2 9223372036854775805 9223372036854775805))
219 (assert_return (invoke "i64x2.sub" (v128.const i64x2 9223372036854775808 9223372036854775808)
220                                    (v128.const i64x2 1 1))
221                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
222 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -9223372036854775806 -9223372036854775806)
223                                    (v128.const i64x2 -1 -1))
224                                    (v128.const i64x2 -9223372036854775805 -9223372036854775805))
225 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -9223372036854775807 -9223372036854775807)
226                                    (v128.const i64x2 -1 -1))
227                                    (v128.const i64x2 -9223372036854775806 -9223372036854775806))
228 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
229                                    (v128.const i64x2 -1 -1))
230                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
231 (assert_return (invoke "i64x2.sub" (v128.const i64x2 9223372036854775807 9223372036854775807)
232                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
233                                    (v128.const i64x2 0 0))
234 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
235                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
236                                    (v128.const i64x2 0 0))
237 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
238                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
239                                    (v128.const i64x2 -1 -1))
240 (assert_return (invoke "i64x2.sub" (v128.const i64x2 18446744073709551615 18446744073709551615)
241                                    (v128.const i64x2 0 0))
242                                    (v128.const i64x2 -1 -1))
243 (assert_return (invoke "i64x2.sub" (v128.const i64x2 18446744073709551615 18446744073709551615)
244                                    (v128.const i64x2 1 1))
245                                    (v128.const i64x2 -2 -2))
246 (assert_return (invoke "i64x2.sub" (v128.const i64x2 18446744073709551615 18446744073709551615)
247                                    (v128.const i64x2 -1 -1))
248                                    (v128.const i64x2 0 0))
249 (assert_return (invoke "i64x2.sub" (v128.const i64x2 18446744073709551615 18446744073709551615)
250                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
251                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
252 (assert_return (invoke "i64x2.sub" (v128.const i64x2 18446744073709551615 18446744073709551615)
253                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
254                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
255 (assert_return (invoke "i64x2.sub" (v128.const i64x2 18446744073709551615 18446744073709551615)
256                                    (v128.const i64x2 18446744073709551615 18446744073709551615))
257                                    (v128.const i64x2 0 0))
258 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x3fffffffffffffff 0x3fffffffffffffff)
259                                    (v128.const i64x2 0x4000000000000000 0x4000000000000000))
260                                    (v128.const i64x2 -1 -1))
261 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x4000000000000000 0x4000000000000000)
262                                    (v128.const i64x2 0x4000000000000000 0x4000000000000000))
263                                    (v128.const i64x2 0 0))
264 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -0x3fffffffffffffff -0x3fffffffffffffff)
265                                    (v128.const i64x2 -0x40000000fffffff -0x40000000fffffff))
266                                    (v128.const i64x2 -4323455642007240704 -4323455642007240704))
267 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -0x4000000000000000 -0x4000000000000000)
268                                    (v128.const i64x2 -0x400000000000000 -0x400000000000000))
269                                    (v128.const i64x2 -4323455642275676160 -4323455642275676160))
270 (assert_return (invoke "i64x2.sub" (v128.const i64x2 -0x4000000000000000 -0x4000000000000000)
271                                    (v128.const i64x2 -0x400000000000001 -0x400000000000001))
272                                    (v128.const i64x2 -4323455642275676159 -4323455642275676159))
273 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
274                                    (v128.const i64x2 0x7ffffffffffffff 0x7ffffffffffffff))
275                                    (v128.const i64x2 8646911284551352320 8646911284551352320))
276 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
277                                    (v128.const i64x2 0x01 0x01))
278                                    (v128.const i64x2 9223372036854775806 9223372036854775806))
279 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
280                                    (v128.const i64x2 -0x01 -0x01))
281                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
282 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
283                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
284                                    (v128.const i64x2 -1 -1))
285 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
286                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
287                                    (v128.const i64x2 0 0))
288 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
289                                    (v128.const i64x2 0x01 0x01))
290                                    (v128.const i64x2 -2 -2))
291 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
292                                    (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff))
293                                    (v128.const i64x2 0 0))
294 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
295                                    (v128.const i8x16 0 0 0 0 0 0 0 0x80 0 0 0 0 0 0 0 0x80))
296                                    (v128.const i64x2 -1 -1))
297 (assert_return (invoke "i64x2.sub" (v128.const i64x2 1 1)
298                                    (v128.const i8x16 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255))
299                                    (v128.const i64x2 2 2))
300 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
301                                    (v128.const i16x8 0 0 0 0x8000 0 0 0 0x8000))
302                                    (v128.const i64x2 -1 -1))
303 (assert_return (invoke "i64x2.sub" (v128.const i64x2 1 1)
304                                    (v128.const i16x8 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff))
305                                    (v128.const i64x2 2 2))
306 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
307                                    (v128.const i32x4 0 0x80000000 0 0x80000000))
308                                    (v128.const i64x2 -1 -1))
309 (assert_return (invoke "i64x2.sub" (v128.const i64x2 1 1)
310                                    (v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff))
311                                    (v128.const i64x2 2 2))
312 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
313                                    (v128.const f64x2 +0.0 +0.0))
314                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
315 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
316                                    (v128.const f64x2 -0.0 -0.0))
317                                    (v128.const i64x2 0 0))
318 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
319                                    (v128.const f64x2 1.0 1.0))
320                                    (v128.const i64x2 0x4010000000000000 0x4010000000000000))
321 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
322                                    (v128.const f64x2 -1.0 -1.0))
323                                    (v128.const i64x2 0xc010000000000000 0xc010000000000000))
324 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x1 0x1)
325                                    (v128.const f64x2 +inf +inf))
326                                    (v128.const i64x2 0x8010000000000001 0x8010000000000001))
327 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x1 0x1)
328                                    (v128.const f64x2 -inf -inf))
329                                    (v128.const i64x2 0x0010000000000001 0x0010000000000001))
330 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x1 0x1)
331                                    (v128.const f64x2 nan nan))
332                                    (v128.const i64x2 0x8008000000000001 0x8008000000000001))
333 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0 1)
334                                    (v128.const i64x2 0 0xffffffffffffffff))
335                                    (v128.const i64x2 0 0x02))
336 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0 1)
337                                    (v128.const i64x2 0 2))
338                                    (v128.const i64x2 0 -1))
339 (assert_return (invoke "i64x2.sub" (v128.const i64x2 03_214_567_890_123_456_789 03_214_567_890_123_456_789)
340                                    (v128.const i64x2 01_234_567_890_123_456_789 01_234_567_890_123_456_789))
341                                    (v128.const i64x2 01_980_000_000_000_000_000 01_980_000_000_000_000_000))
342 (assert_return (invoke "i64x2.sub" (v128.const i64x2 0x0_90AB_cdef_8765_4321 0x0_90AB_cdef_8765_4321)
343                                    (v128.const i64x2 0x0_1234_5678_90AB_cdef 0x0_1234_5678_90AB_cdef))
344                                    (v128.const i64x2 0x0_7e77_7776_f6b9_7532 0x0_7e77_7776_f6b9_7532))
345
346 ;; i64x2.mul
347 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0 0)
348                                    (v128.const i64x2 0 0))
349                                    (v128.const i64x2 0 0))
350 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0 0)
351                                    (v128.const i64x2 1 1))
352                                    (v128.const i64x2 0 0))
353 (assert_return (invoke "i64x2.mul" (v128.const i64x2 1 1)
354                                    (v128.const i64x2 1 1))
355                                    (v128.const i64x2 1 1))
356 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0 0)
357                                    (v128.const i64x2 -1 -1))
358                                    (v128.const i64x2 0 0))
359 (assert_return (invoke "i64x2.mul" (v128.const i64x2 1 1)
360                                    (v128.const i64x2 -1 -1))
361                                    (v128.const i64x2 -1 -1))
362 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -1 -1)
363                                    (v128.const i64x2 -1 -1))
364                                    (v128.const i64x2 1 1))
365 (assert_return (invoke "i64x2.mul" (v128.const i64x2 4611686018427387903 4611686018427387903)
366                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
367                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
368 (assert_return (invoke "i64x2.mul" (v128.const i64x2 4611686018427387904 4611686018427387904)
369                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
370                                    (v128.const i64x2 0 0))
371 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -4611686018427387903 -4611686018427387903)
372                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
373                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
374 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -4611686018427387904 -4611686018427387904)
375                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
376                                    (v128.const i64x2 0 0))
377 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -4611686018427387905 -4611686018427387905)
378                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
379                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
380 (assert_return (invoke "i64x2.mul" (v128.const i64x2 9223372036854775805 9223372036854775805)
381                                    (v128.const i64x2 1 1))
382                                    (v128.const i64x2 9223372036854775805 9223372036854775805))
383 (assert_return (invoke "i64x2.mul" (v128.const i64x2 9223372036854775806 9223372036854775806)
384                                    (v128.const i64x2 1 1))
385                                    (v128.const i64x2 9223372036854775806 9223372036854775806))
386 (assert_return (invoke "i64x2.mul" (v128.const i64x2 9223372036854775808 9223372036854775808)
387                                    (v128.const i64x2 1 1))
388                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
389 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -9223372036854775806 -9223372036854775806)
390                                    (v128.const i64x2 -1 -1))
391                                    (v128.const i64x2 9223372036854775806 9223372036854775806))
392 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -9223372036854775807 -9223372036854775807)
393                                    (v128.const i64x2 -1 -1))
394                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
395 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
396                                    (v128.const i64x2 -1 -1))
397                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
398 (assert_return (invoke "i64x2.mul" (v128.const i64x2 9223372036854775807 9223372036854775807)
399                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
400                                    (v128.const i64x2 1 1))
401 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
402                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
403                                    (v128.const i64x2 0 0))
404 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -9223372036854775808 -9223372036854775808)
405                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
406                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
407 (assert_return (invoke "i64x2.mul" (v128.const i64x2 18446744073709551615 18446744073709551615)
408                                    (v128.const i64x2 0 0))
409                                    (v128.const i64x2 0 0))
410 (assert_return (invoke "i64x2.mul" (v128.const i64x2 18446744073709551615 18446744073709551615)
411                                    (v128.const i64x2 1 1))
412                                    (v128.const i64x2 -1 -1))
413 (assert_return (invoke "i64x2.mul" (v128.const i64x2 18446744073709551615 18446744073709551615)
414                                    (v128.const i64x2 -1 -1))
415                                    (v128.const i64x2 1 1))
416 (assert_return (invoke "i64x2.mul" (v128.const i64x2 18446744073709551615 18446744073709551615)
417                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
418                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
419 (assert_return (invoke "i64x2.mul" (v128.const i64x2 18446744073709551615 18446744073709551615)
420                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
421                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
422 (assert_return (invoke "i64x2.mul" (v128.const i64x2 18446744073709551615 18446744073709551615)
423                                    (v128.const i64x2 18446744073709551615 18446744073709551615))
424                                    (v128.const i64x2 1 1))
425 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x3fffffffffffffff 0x3fffffffffffffff)
426                                    (v128.const i64x2 0x4000000000000000 0x4000000000000000))
427                                    (v128.const i64x2 -4611686018427387904 -4611686018427387904))
428 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x4000000000000000 0x4000000000000000)
429                                    (v128.const i64x2 0x4000000000000000 0x4000000000000000))
430                                    (v128.const i64x2 0 0))
431 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -0x3fffffffffffffff -0x3fffffffffffffff)
432                                    (v128.const i64x2 -0x40000000fffffff -0x40000000fffffff))
433                                    (v128.const i64x2 -4899916394847535103 -4899916394847535103))
434 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -0x4000000000000000 -0x4000000000000000)
435                                    (v128.const i64x2 -0x400000000000000 -0x400000000000000))
436                                    (v128.const i64x2 0 0))
437 (assert_return (invoke "i64x2.mul" (v128.const i64x2 -0x4000000000000000 -0x4000000000000000)
438                                    (v128.const i64x2 -0x400000000000001 -0x400000000000001))
439                                    (v128.const i64x2 4611686018427387904 4611686018427387904))
440 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
441                                    (v128.const i64x2 0x7ffffffffffffff 0x7ffffffffffffff))
442                                    (v128.const i64x2 8646911284551352321 8646911284551352321))
443 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
444                                    (v128.const i64x2 0x01 0x01))
445                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
446 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
447                                    (v128.const i64x2 -0x01 -0x01))
448                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
449 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)
450                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
451                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
452 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
453                                    (v128.const i64x2 0x8000000000000000 0x8000000000000000))
454                                    (v128.const i64x2 0 0))
455 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
456                                    (v128.const i64x2 0x01 0x01))
457                                    (v128.const i64x2 -1 -1))
458 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
459                                    (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff))
460                                    (v128.const i64x2 1 1))
461 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
462                                    (v128.const i8x16 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2))
463                                    (v128.const i64x2 0 0))
464 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
465                                    (v128.const i8x16 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255))
466                                    (v128.const i64x2 1 1))
467 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
468                                    (v128.const i16x8 0 0 0 0x02 0 0 0 0x02))
469                                    (v128.const i64x2 0 0))
470 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
471                                    (v128.const i16x8 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff))
472                                    (v128.const i64x2 1 1))
473 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x8000000000000000 0x8000000000000000)
474                                    (v128.const i32x4 0 0x02 0 0x02))
475                                    (v128.const i64x2 0 0))
476 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)
477                                    (v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff))
478                                    (v128.const i64x2 1 1))
479 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x80000000 0x80000000)
480                                    (v128.const f64x2 +0.0 +0.0))
481                                    (v128.const i64x2 0 0))
482 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x80000000 0x80000000)
483                                    (v128.const f64x2 -0.0 -0.0))
484                                    (v128.const i64x2 0 0))
485 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x80000000 0x80000000)
486                                    (v128.const f64x2 1.0 1.0))
487                                    (v128.const i64x2 0 0))
488 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x80000000 0x80000000)
489                                    (v128.const f64x2 -1.0 -1.0))
490                                    (v128.const i64x2 0 0))
491 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x1 0x1)
492                                    (v128.const f64x2 +inf +inf))
493                                    (v128.const i64x2 0x7ff0000000000000 0x7ff0000000000000))
494 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x1 0x1)
495                                    (v128.const f64x2 -inf -inf))
496                                    (v128.const i64x2 0xfff0000000000000 0xfff0000000000000))
497 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x1 0x1)
498                                    (v128.const f64x2 nan nan))
499                                    (v128.const i64x2 0x7ff8000000000000 0x7ff8000000000000))
500 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0 1)
501                                    (v128.const i64x2 0 0xffffffffffffffff))
502                                    (v128.const i64x2 0 0xffffffffffffffff))
503 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0 1)
504                                    (v128.const i64x2 0 2))
505                                    (v128.const i64x2 0 0x02))
506 (assert_return (invoke "i64x2.mul" (v128.const i64x2 01_234_567_890_123_456_789 01_234_567_890_123_456_789)
507                                    (v128.const i64x2 01_234_567_890_123_456_789 01_234_567_890_123_456_789))
508                                    (v128.const i64x2 09_710_478_858_155_731_897 09_710_478_858_155_731_897))
509 (assert_return (invoke "i64x2.mul" (v128.const i64x2 0x0_1234_5678_90AB_cdef 0x0_1234_5678_90AB_cdef)
510                                    (v128.const i64x2 0x0_90AB_cdef_8765_4321 0x0_90AB_cdef_8765_4321))
511                                    (v128.const i64x2 0x0_602f_05e9_e556_18cf 0x0_602f_05e9_e556_18cf))
512
513 ;; i64x2.neg
514 (assert_return (invoke "i64x2.neg" (v128.const i64x2 0 0))
515                                    (v128.const i64x2 0 0))
516 (assert_return (invoke "i64x2.neg" (v128.const i64x2 1 1))
517                                    (v128.const i64x2 -1 -1))
518 (assert_return (invoke "i64x2.neg" (v128.const i64x2 -1 -1))
519                                    (v128.const i64x2 1 1))
520 (assert_return (invoke "i64x2.neg" (v128.const i64x2 9223372036854775806 9223372036854775806))
521                                    (v128.const i64x2 -9223372036854775806 -9223372036854775806))
522 (assert_return (invoke "i64x2.neg" (v128.const i64x2 -9223372036854775807 -9223372036854775807))
523                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
524 (assert_return (invoke "i64x2.neg" (v128.const i64x2 -9223372036854775808 -9223372036854775808))
525                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
526 (assert_return (invoke "i64x2.neg" (v128.const i64x2 9223372036854775807 9223372036854775807))
527                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
528 (assert_return (invoke "i64x2.neg" (v128.const i64x2 18446744073709551615 18446744073709551615))
529                                    (v128.const i64x2 1 1))
530 (assert_return (invoke "i64x2.neg" (v128.const i64x2 0x01 0x01))
531                                    (v128.const i64x2 -1 -1))
532 (assert_return (invoke "i64x2.neg" (v128.const i64x2 -0x01 -0x01))
533                                    (v128.const i64x2 1 1))
534 (assert_return (invoke "i64x2.neg" (v128.const i64x2 -0x8000000000000000 -0x8000000000000000))
535                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
536 (assert_return (invoke "i64x2.neg" (v128.const i64x2 -0x7fffffffffffffff -0x7fffffffffffffff))
537                                    (v128.const i64x2 9223372036854775807 9223372036854775807))
538 (assert_return (invoke "i64x2.neg" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff))
539                                    (v128.const i64x2 -9223372036854775807 -9223372036854775807))
540 (assert_return (invoke "i64x2.neg" (v128.const i64x2 0x8000000000000000 0x8000000000000000))
541                                    (v128.const i64x2 -9223372036854775808 -9223372036854775808))
542 (assert_return (invoke "i64x2.neg" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff))
543                                    (v128.const i64x2 1 1))
544
545 ;; type check
546 (assert_invalid (module (func (result v128) (i64x2.neg (i32.const 0)))) "type mismatch")
547 (assert_invalid (module (func (result v128) (i64x2.add (i32.const 0) (f32.const 0.0)))) "type mismatch")
548 (assert_invalid (module (func (result v128) (i64x2.sub (i32.const 0) (f32.const 0.0)))) "type mismatch")
549 (assert_invalid (module (func (result v128) (i64x2.mul (i32.const 0) (f32.const 0.0)))) "type mismatch")
550
551 ;; Test operation with empty argument
552
553 (assert_invalid
554   (module
555     (func $i64x2.neg-arg-empty (result v128)
556       (i64x2.neg)
557     )
558   )
559   "type mismatch"
560 )
561 (assert_invalid
562   (module
563     (func $i64x2.add-1st-arg-empty (result v128)
564       (i64x2.add (v128.const i64x2 0 0))
565     )
566   )
567   "type mismatch"
568 )
569 (assert_invalid
570   (module
571     (func $i64x2.add-arg-empty (result v128)
572       (i64x2.add)
573     )
574   )
575   "type mismatch"
576 )
577 (assert_invalid
578   (module
579     (func $i64x2.sub-1st-arg-empty (result v128)
580       (i64x2.sub (v128.const i64x2 0 0))
581     )
582   )
583   "type mismatch"
584 )
585 (assert_invalid
586   (module
587     (func $i64x2.sub-arg-empty (result v128)
588       (i64x2.sub)
589     )
590   )
591   "type mismatch"
592 )
593 (assert_invalid
594   (module
595     (func $i64x2.mul-1st-arg-empty (result v128)
596       (i64x2.mul (v128.const i64x2 0 0))
597     )
598   )
599   "type mismatch"
600 )
601 (assert_invalid
602   (module
603     (func $i64x2.mul-arg-empty (result v128)
604       (i64x2.mul)
605     )
606   )
607   "type mismatch"
608 )
609
610 ;; combination
611 (module
612   (func (export "add-sub") (param v128 v128 v128) (result v128)
613     (i64x2.add (i64x2.sub (local.get 0) (local.get 1))(local.get 2)))
614   (func (export "mul-add") (param v128 v128 v128) (result v128)
615     (i64x2.mul (i64x2.add (local.get 0) (local.get 1))(local.get 2)))
616   (func (export "mul-sub") (param v128 v128 v128) (result v128)
617     (i64x2.mul (i64x2.sub (local.get 0) (local.get 1))(local.get 2)))
618   (func (export "sub-add") (param v128 v128 v128) (result v128)
619     (i64x2.sub (i64x2.add (local.get 0) (local.get 1))(local.get 2)))
620   (func (export "add-neg") (param v128 v128) (result v128)
621     (i64x2.add (i64x2.neg (local.get 0)) (local.get 1)))
622   (func (export "mul-neg") (param v128 v128) (result v128)
623     (i64x2.mul (i64x2.neg (local.get 0)) (local.get 1)))
624   (func (export "sub-neg") (param v128 v128) (result v128)
625     (i64x2.sub (i64x2.neg (local.get 0)) (local.get 1)))
626 )
627
628 (assert_return (invoke "add-sub" (v128.const i64x2 0 1)
629                                  (v128.const i64x2 0 2)
630                                  (v128.const i64x2 0 2))
631                                  (v128.const i64x2 0 1))
632 (assert_return (invoke "mul-add" (v128.const i64x2 0 1)
633                                  (v128.const i64x2 0 1)
634                                  (v128.const i64x2 2 2))
635                                  (v128.const i64x2 0 4))
636 (assert_return (invoke "mul-sub" (v128.const i64x2 0 2)
637                                  (v128.const i64x2 0 1)
638                                  (v128.const i64x2 0 1))
639                                  (v128.const i64x2 0 1))
640 (assert_return (invoke "sub-add" (v128.const i64x2 0 1)
641                                  (v128.const i64x2 0 2)
642                                  (v128.const i64x2 0 2))
643                                  (v128.const i64x2 0 1))
644 (assert_return (invoke "add-neg" (v128.const i64x2 0 1)
645                                  (v128.const i64x2 0 1))
646                                  (v128.const i64x2 0 0))
647 (assert_return (invoke "mul-neg" (v128.const i64x2 0 1)
648                                  (v128.const i64x2 2 2))
649                                  (v128.const i64x2 0 -2))
650 (assert_return (invoke "sub-neg" (v128.const i64x2 0 1)
651                                  (v128.const i64x2 0 1))
652                                  (v128.const i64x2 0 -2))