deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / test / mjsunit / asm / double-lo.js
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6
7 var stdlib = this;
8 var foreign = {};
9 var heap = new ArrayBuffer(64 * 1024);
10
11
12 var m = (function(stdlib, foreign, heap) {
13   "use asm";
14   function lo1(i) {
15     i = +i;
16     return %_DoubleLo(i)|0;
17   }
18   function lo2(i, j) {
19     i = +i;
20     j = +j;
21     return %_DoubleLo(i)+%_DoubleLo(j)|0;
22   }
23   return { lo1: lo1, lo2: lo2 };
24 })(stdlib, foreign, heap);
25
26 assertEquals(0, m.lo1(0.0));
27 assertEquals(0, m.lo1(-0.0));
28 assertEquals(0, m.lo1(Infinity));
29 assertEquals(0, m.lo1(-Infinity));
30 assertEquals(0, m.lo2(0.0, 0.0));
31 assertEquals(0, m.lo2(0.0, -0.0));
32 assertEquals(0, m.lo2(-0.0, 0.0));
33 assertEquals(0, m.lo2(-0.0, -0.0));
34 for (var i = -2147483648; i < 2147483648; i += 3999773) {
35   assertEquals(%_DoubleLo(i), m.lo1(i));
36   assertEquals(i, m.lo1(%ConstructDouble(0, i)));
37   assertEquals(i, m.lo1(%ConstructDouble(i, i)));
38   assertEquals(i+i|0, m.lo2(%ConstructDouble(0, i), %ConstructDouble(0, i)));
39   assertEquals(i+i|0, m.lo2(%ConstructDouble(i, i), %ConstructDouble(i, i)));
40 }