summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/bug679493-2.js
blob: 4cb089c1c2137df83682af0193009fcdaa28ecf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// IM: Test generated code
function neg(x) {
    return -x;
}
assertEq(neg(0), -0);
assertEq(neg(1), -1);
assertEq(neg(-1), 1);
assertEq(neg(-2147483648), 2147483648);
assertEq(neg(-1.3), 1.3);
assertEq(neg(1.45), -1.45);

// IM: Test constant folding
function neg2(){
    var x = 1;
    var y = -x;
    return y;
}
assertEq(neg2(), -1);
function neg3(){
    var x = 0;
    var y = -x;
    return y;
}
assertEq(neg3(), -0);
function neg4(){
    var x = -2147483648;
    var y = -x;
    return y;
}
assertEq(neg4(), 2147483648);