File size: 1,420 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--TEST--
JIT ADD: 007 Addition with immediate values
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.protect_memory=1
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?>
--FILE--
<?php
function foo($a) {
    $b = 0;
    $c = 31;
    $d = 0xfff;
    $e = 0x1000;
    $f = 0xfff000;
    $g = 0xff001;          // Cannot be encoded into imm12 field
    $h = 0x1000000;        // Cannot be encoded into imm12 field
    $i = 0xf12345678;      // Cannot be encoded into imm12 field
    $j = -31;              // Cannot be encoded into imm12 field

    $a = $a + $b;
    $a = $a + $c;
    $a = $a + $d;
    $a = $a + $e;
    $a = $a + $f;
    $a = $a + $g;
    $a = $a + $h;
    $a = $a + $i;
    $a = $a + $j;
    var_dump($a);
}

function bar($a) {
    $b = 0;
    $c = 31;
    $d = 0xfff;
    $e = 0x1000;
    $f = 0xfff000;
    $g = 0xff001;          // Cannot be encoded into imm12 field
    $h = 0x1000000;        // Cannot be encoded into imm12 field
    $i = 0xf12345678;      // Cannot be encoded into imm12 field
    $j = -31;              // Cannot be encoded into imm12 field

    $a = $a - $b;
    $a = $a - $c;
    $a = $a - $d;
    $a = $a - $e;
    $a = $a - $f;
    $a = $a - $g;
    $a = $a - $h;
    $a = $a - $i;
    $a = $a - $j;
    var_dump($a);
}

foo(42);
bar(0x1f12345678);
?>
--EXPECT--
int(64764532386)
int(68684873728)