Debian Codegraph @

js/src/jit-test/tests/wasm/spec/memory64/float_memory.wast.js

raw
1 /* Copyright 2021 Mozilla Foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 // ./test/core/float_memory.wast
17
18 // ./test/core/float_memory.wast:5
19 let $0 = instantiate(`(module
20 (memory (data "\\00\\00\\a0\\7f"))
21
22 (func (export "f32.load") (result f32) (f32.load (i32.const 0)))
23 (func (export "i32.load") (result i32) (i32.load (i32.const 0)))
24 (func (export "f32.store") (f32.store (i32.const 0) (f32.const nan:0x200000)))
25 (func (export "i32.store") (i32.store (i32.const 0) (i32.const 0x7fa00000)))
26 (func (export "reset") (i32.store (i32.const 0) (i32.const 0)))
27 )`);
28
29 // ./test/core/float_memory.wast:15
30 assert_return(() => invoke($0, `i32.load`, []), [value("i32", 2141192192)]);
31
32 // ./test/core/float_memory.wast:16
33 assert_return(() => invoke($0, `f32.load`, []), [bytes("f32", [0x0, 0x0, 0xa0, 0x7f])]);
34
35 // ./test/core/float_memory.wast:17
36 invoke($0, `reset`, []);
37
38 // ./test/core/float_memory.wast:18
39 assert_return(() => invoke($0, `i32.load`, []), [value("i32", 0)]);
40
41 // ./test/core/float_memory.wast:19
42 assert_return(() => invoke($0, `f32.load`, []), [value("f32", 0)]);
43
44 // ./test/core/float_memory.wast:20
45 invoke($0, `f32.store`, []);
46
47 // ./test/core/float_memory.wast:21
48 assert_return(() => invoke($0, `i32.load`, []), [value("i32", 2141192192)]);
49
50 // ./test/core/float_memory.wast:22
51 assert_return(() => invoke($0, `f32.load`, []), [bytes("f32", [0x0, 0x0, 0xa0, 0x7f])]);
52
53 // ./test/core/float_memory.wast:23
54 invoke($0, `reset`, []);
55
56 // ./test/core/float_memory.wast:24
57 assert_return(() => invoke($0, `i32.load`, []), [value("i32", 0)]);
58
59 // ./test/core/float_memory.wast:25
60 assert_return(() => invoke($0, `f32.load`, []), [value("f32", 0)]);
61
62 // ./test/core/float_memory.wast:26
63 invoke($0, `i32.store`, []);
64
65 // ./test/core/float_memory.wast:27
66 assert_return(() => invoke($0, `i32.load`, []), [value("i32", 2141192192)]);
67
68 // ./test/core/float_memory.wast:28
69 assert_return(() => invoke($0, `f32.load`, []), [bytes("f32", [0x0, 0x0, 0xa0, 0x7f])]);
70
71 // ./test/core/float_memory.wast:30
72 let $1 = instantiate(`(module
73 (memory (data "\\00\\00\\00\\00\\00\\00\\f4\\7f"))
74
75 (func (export "f64.load") (result f64) (f64.load (i32.const 0)))
76 (func (export "i64.load") (result i64) (i64.load (i32.const 0)))
77 (func (export "f64.store") (f64.store (i32.const 0) (f64.const nan:0x4000000000000)))
78 (func (export "i64.store") (i64.store (i32.const 0) (i64.const 0x7ff4000000000000)))
79 (func (export "reset") (i64.store (i32.const 0) (i64.const 0)))
80 )`);
81
82 // ./test/core/float_memory.wast:40
83 assert_return(() => invoke($1, `i64.load`, []), [value("i64", 9219994337134247936n)]);
84
85 // ./test/core/float_memory.wast:41
86 assert_return(
87 () => invoke($1, `f64.load`, []),
88 [bytes("f64", [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x7f])],
89 );
90
91 // ./test/core/float_memory.wast:42
92 invoke($1, `reset`, []);
93
94 // ./test/core/float_memory.wast:43
95 assert_return(() => invoke($1, `i64.load`, []), [value("i64", 0n)]);
96
97 // ./test/core/float_memory.wast:44
98 assert_return(() => invoke($1, `f64.load`, []), [value("f64", 0)]);
99
100 // ./test/core/float_memory.wast:45
101 invoke($1, `f64.store`, []);
102
103 // ./test/core/float_memory.wast:46
104 assert_return(() => invoke($1, `i64.load`, []), [value("i64", 9219994337134247936n)]);
105
106 // ./test/core/float_memory.wast:47
107 assert_return(
108 () => invoke($1, `f64.load`, []),
109 [bytes("f64", [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x7f])],
110 );
111
112 // ./test/core/float_memory.wast:48
113 invoke($1, `reset`, []);
114
115 // ./test/core/float_memory.wast:49
116 assert_return(() => invoke($1, `i64.load`, []), [value("i64", 0n)]);
117
118 // ./test/core/float_memory.wast:50
119 assert_return(() => invoke($1, `f64.load`, []), [value("f64", 0)]);
120
121 // ./test/core/float_memory.wast:51
122 invoke($1, `i64.store`, []);
123
124 // ./test/core/float_memory.wast:52
125 assert_return(() => invoke($1, `i64.load`, []), [value("i64", 9219994337134247936n)]);
126
127 // ./test/core/float_memory.wast:53
128 assert_return(
129 () => invoke($1, `f64.load`, []),
130 [bytes("f64", [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x7f])],
131 );
132
133 // ./test/core/float_memory.wast:57
134 let $2 = instantiate(`(module
135 (memory (data "\\00\\00\\00\\a0\\7f"))
136
137 (func (export "f32.load") (result f32) (f32.load (i32.const 1)))
138 (func (export "i32.load") (result i32) (i32.load (i32.const 1)))
139 (func (export "f32.store") (f32.store (i32.const 1) (f32.const nan:0x200000)))
140 (func (export "i32.store") (i32.store (i32.const 1) (i32.const 0x7fa00000)))
141 (func (export "reset") (i32.store (i32.const 1) (i32.const 0)))
142 )`);
143
144 // ./test/core/float_memory.wast:67
145 assert_return(() => invoke($2, `i32.load`, []), [value("i32", 2141192192)]);
146
147 // ./test/core/float_memory.wast:68
148 assert_return(() => invoke($2, `f32.load`, []), [bytes("f32", [0x0, 0x0, 0xa0, 0x7f])]);
149
150 // ./test/core/float_memory.wast:69
151 invoke($2, `reset`, []);
152
153 // ./test/core/float_memory.wast:70
154 assert_return(() => invoke($2, `i32.load`, []), [value("i32", 0)]);
155
156 // ./test/core/float_memory.wast:71
157 assert_return(() => invoke($2, `f32.load`, []), [value("f32", 0)]);
158
159 // ./test/core/float_memory.wast:72
160 invoke($2, `f32.store`, []);
161
162 // ./test/core/float_memory.wast:73
163 assert_return(() => invoke($2, `i32.load`, []), [value("i32", 2141192192)]);
164
165 // ./test/core/float_memory.wast:74
166 assert_return(() => invoke($2, `f32.load`, []), [bytes("f32", [0x0, 0x0, 0xa0, 0x7f])]);
167
168 // ./test/core/float_memory.wast:75
169 invoke($2, `reset`, []);
170
171 // ./test/core/float_memory.wast:76
172 assert_return(() => invoke($2, `i32.load`, []), [value("i32", 0)]);
173
174 // ./test/core/float_memory.wast:77
175 assert_return(() => invoke($2, `f32.load`, []), [value("f32", 0)]);
176
177 // ./test/core/float_memory.wast:78
178 invoke($2, `i32.store`, []);
179
180 // ./test/core/float_memory.wast:79
181 assert_return(() => invoke($2, `i32.load`, []), [value("i32", 2141192192)]);
182
183 // ./test/core/float_memory.wast:80
184 assert_return(() => invoke($2, `f32.load`, []), [bytes("f32", [0x0, 0x0, 0xa0, 0x7f])]);
185
186 // ./test/core/float_memory.wast:82
187 let $3 = instantiate(`(module
188 (memory (data "\\00\\00\\00\\00\\00\\00\\00\\f4\\7f"))
189
190 (func (export "f64.load") (result f64) (f64.load (i32.const 1)))
191 (func (export "i64.load") (result i64) (i64.load (i32.const 1)))
192 (func (export "f64.store") (f64.store (i32.const 1) (f64.const nan:0x4000000000000)))
193 (func (export "i64.store") (i64.store (i32.const 1) (i64.const 0x7ff4000000000000)))
194 (func (export "reset") (i64.store (i32.const 1) (i64.const 0)))
195 )`);
196
197 // ./test/core/float_memory.wast:92
198 assert_return(() => invoke($3, `i64.load`, []), [value("i64", 9219994337134247936n)]);
199
200 // ./test/core/float_memory.wast:93
201 assert_return(
202 () => invoke($3, `f64.load`, []),
203 [bytes("f64", [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x7f])],
204 );
205
206 // ./test/core/float_memory.wast:94
207 invoke($3, `reset`, []);
208
209 // ./test/core/float_memory.wast:95
210 assert_return(() => invoke($3, `i64.load`, []), [value("i64", 0n)]);
211
212 // ./test/core/float_memory.wast:96
213 assert_return(() => invoke($3, `f64.load`, []), [value("f64", 0)]);
214
215 // ./test/core/float_memory.wast:97
216 invoke($3, `f64.store`, []);
217
218 // ./test/core/float_memory.wast:98
219 assert_return(() => invoke($3, `i64.load`, []), [value("i64", 9219994337134247936n)]);
220
221 // ./test/core/float_memory.wast:99
222 assert_return(
223 () => invoke($3, `f64.load`, []),
224 [bytes("f64", [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x7f])],
225 );
226
227 // ./test/core/float_memory.wast:100
228 invoke($3, `reset`, []);
229
230 // ./test/core/float_memory.wast:101
231 assert_return(() => invoke($3, `i64.load`, []), [value("i64", 0n)]);
232
233 // ./test/core/float_memory.wast:102
234 assert_return(() => invoke($3, `f64.load`, []), [value("f64", 0)]);
235
236 // ./test/core/float_memory.wast:103
237 invoke($3, `i64.store`, []);
238
239 // ./test/core/float_memory.wast:104
240 assert_return(() => invoke($3, `i64.load`, []), [value("i64", 9219994337134247936n)]);
241
242 // ./test/core/float_memory.wast:105
243 assert_return(
244 () => invoke($3, `f64.load`, []),
245 [bytes("f64", [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf4, 0x7f])],
246 );
247
248 // ./test/core/float_memory.wast:109
249 let $4 = instantiate(`(module
250 (memory (data "\\01\\00\\d0\\7f"))
251
252 (func (export "f32.load") (result f32) (f32.load (i32.const 0)))
253 (func (export "i32.load") (result i32) (i32.load (i32.const 0)))
254 (func (export "f32.store") (f32.store (i32.const 0) (f32.const nan:0x500001)))
255 (func (export "i32.store") (i32.store (i32.const 0) (i32.const 0x7fd00001)))
256 (func (export "reset") (i32.store (i32.const 0) (i32.const 0)))
257 )`);
258
259 // ./test/core/float_memory.wast:119
260 assert_return(() => invoke($4, `i32.load`, []), [value("i32", 2144337921)]);
261
262 // ./test/core/float_memory.wast:120
263 assert_return(() => invoke($4, `f32.load`, []), [bytes("f32", [0x1, 0x0, 0xd0, 0x7f])]);
264
265 // ./test/core/float_memory.wast:121
266 invoke($4, `reset`, []);
267
268 // ./test/core/float_memory.wast:122
269 assert_return(() => invoke($4, `i32.load`, []), [value("i32", 0)]);
270
271 // ./test/core/float_memory.wast:123
272 assert_return(() => invoke($4, `f32.load`, []), [value("f32", 0)]);
273
274 // ./test/core/float_memory.wast:124
275 invoke($4, `f32.store`, []);
276
277 // ./test/core/float_memory.wast:125
278 assert_return(() => invoke($4, `i32.load`, []), [value("i32", 2144337921)]);
279
280 // ./test/core/float_memory.wast:126
281 assert_return(() => invoke($4, `f32.load`, []), [bytes("f32", [0x1, 0x0, 0xd0, 0x7f])]);
282
283 // ./test/core/float_memory.wast:127
284 invoke($4, `reset`, []);
285
286 // ./test/core/float_memory.wast:128
287 assert_return(() => invoke($4, `i32.load`, []), [value("i32", 0)]);
288
289 // ./test/core/float_memory.wast:129
290 assert_return(() => invoke($4, `f32.load`, []), [value("f32", 0)]);
291
292 // ./test/core/float_memory.wast:130
293 invoke($4, `i32.store`, []);
294
295 // ./test/core/float_memory.wast:131
296 assert_return(() => invoke($4, `i32.load`, []), [value("i32", 2144337921)]);
297
298 // ./test/core/float_memory.wast:132
299 assert_return(() => invoke($4, `f32.load`, []), [bytes("f32", [0x1, 0x0, 0xd0, 0x7f])]);
300
301 // ./test/core/float_memory.wast:134
302 let $5 = instantiate(`(module
303 (memory (data "\\01\\00\\00\\00\\00\\00\\fc\\7f"))
304
305 (func (export "f64.load") (result f64) (f64.load (i32.const 0)))
306 (func (export "i64.load") (result i64) (i64.load (i32.const 0)))
307 (func (export "f64.store") (f64.store (i32.const 0) (f64.const nan:0xc000000000001)))
308 (func (export "i64.store") (i64.store (i32.const 0) (i64.const 0x7ffc000000000001)))
309 (func (export "reset") (i64.store (i32.const 0) (i64.const 0)))
310 )`);
311
312 // ./test/core/float_memory.wast:144
313 assert_return(() => invoke($5, `i64.load`, []), [value("i64", 9222246136947933185n)]);
314
315 // ./test/core/float_memory.wast:145
316 assert_return(
317 () => invoke($5, `f64.load`, []),
318 [bytes("f64", [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x7f])],
319 );
320
321 // ./test/core/float_memory.wast:146
322 invoke($5, `reset`, []);
323
324 // ./test/core/float_memory.wast:147
325 assert_return(() => invoke($5, `i64.load`, []), [value("i64", 0n)]);
326
327 // ./test/core/float_memory.wast:148
328 assert_return(() => invoke($5, `f64.load`, []), [value("f64", 0)]);
329
330 // ./test/core/float_memory.wast:149
331 invoke($5, `f64.store`, []);
332
333 // ./test/core/float_memory.wast:150
334 assert_return(() => invoke($5, `i64.load`, []), [value("i64", 9222246136947933185n)]);
335
336 // ./test/core/float_memory.wast:151
337 assert_return(
338 () => invoke($5, `f64.load`, []),
339 [bytes("f64", [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x7f])],
340 );
341
342 // ./test/core/float_memory.wast:152
343 invoke($5, `reset`, []);
344
345 // ./test/core/float_memory.wast:153
346 assert_return(() => invoke($5, `i64.load`, []), [value("i64", 0n)]);
347
348 // ./test/core/float_memory.wast:154
349 assert_return(() => invoke($5, `f64.load`, []), [value("f64", 0)]);
350
351 // ./test/core/float_memory.wast:155
352 invoke($5, `i64.store`, []);
353
354 // ./test/core/float_memory.wast:156
355 assert_return(() => invoke($5, `i64.load`, []), [value("i64", 9222246136947933185n)]);
356
357 // ./test/core/float_memory.wast:157
358 assert_return(
359 () => invoke($5, `f64.load`, []),
360 [bytes("f64", [0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x7f])],
361 );