OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-wasm | 5 // Flags: --expose-wasm |
6 | 6 |
7 function WrapInAsmModule(func) { | 7 function WrapInAsmModule(func) { |
8 function MODULE_NAME(stdlib) { | 8 function MODULE_NAME(stdlib) { |
9 "use asm"; | 9 "use asm"; |
10 var imul = stdlib.Math.imul; | 10 var imul = stdlib.Math.imul; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 var funcs = [ | 212 var funcs = [ |
213 i32_add, | 213 i32_add, |
214 i32_sub, | 214 i32_sub, |
215 i32_mul, | 215 i32_mul, |
216 i32_div, | 216 i32_div, |
217 i32_mod, | 217 i32_mod, |
218 i32_and, | 218 i32_and, |
219 i32_or, | 219 i32_or, |
220 i32_xor, | 220 i32_xor, |
221 // TODO(titzer): i32_shl on arm | 221 i32_shl, |
222 // TODO(titzer): i32_shr on arm | 222 i32_shr, |
223 // TODO(titzer): i32_sar on arm | 223 i32_sar, |
224 i32_eq, | 224 i32_eq, |
225 i32_ne, | 225 i32_ne, |
226 i32_lt, | 226 i32_lt, |
227 i32_lteq, | 227 i32_lteq, |
228 i32_gt, | 228 i32_gt, |
229 i32_gteq, | 229 i32_gteq, |
230 i32_min, | 230 i32_min, |
231 i32_max, | 231 i32_max, |
232 i32_abs | 232 i32_abs |
233 ]; | 233 ]; |
234 | 234 |
235 (function () { | 235 (function () { |
236 for (func of funcs) { | 236 for (func of funcs) { |
237 RunThreeWayTest(WrapInAsmModule(func), function (module) { | 237 RunThreeWayTest(WrapInAsmModule(func), function (module) { |
238 if (func.length == 1) { | 238 if (func.length == 1) { |
239 for (a of inputs) { | 239 for (a of inputs) { |
240 assertEquals(func(a), module.main(a)); | 240 assertEquals(func(a), module.main(a)); |
241 } | 241 } |
242 } else { | 242 } else { |
243 for (a of inputs) { | 243 for (a of inputs) { |
244 for (b of inputs) { | 244 for (b of inputs) { |
245 assertEquals(func(a, b), module.main(a, b)); | 245 assertEquals(func(a, b), module.main(a, b)); |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
249 }); | 249 }); |
250 } | 250 } |
251 | 251 |
252 })(); | 252 })(); |
OLD | NEW |