1--TEST-- 2JIT CMP: 005 Comparisons with immediate values 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.file_update_protection=0 7opcache.jit_buffer_size=1M 8opcache.protect_memory=1 9--EXTENSIONS-- 10opcache 11--SKIPIF-- 12<?php 13if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?> 14--FILE-- 15<?php 16function foo($a) { 17 $b = 0; 18 $c = 31; 19 $d = 0xfff; 20 $e = 0x1000; 21 $f = 0xfff000; 22 $g = 0xff001; // Cannot be encoded into imm12 field 23 $h = 0x1000000; // Cannot be encoded into imm12 field 24 $i = 0xf12345678; // Cannot be encoded into imm12 field 25 26 var_dump($a > $b ? 1 : 0); 27 var_dump($a > $c ? 1 : 0); 28 var_dump($a > $d ? 1 : 0); 29 var_dump($a > $e ? 1 : 0); 30 var_dump($a > $f ? 1 : 0); 31 var_dump($a > $g ? 1 : 0); 32 var_dump($a > $h ? 1 : 0); 33 var_dump($a > $i ? 1 : 0); 34} 35 36function bar($a) { 37 $b = 0; 38 $c = -31; 39 $d = -4095; // negation of 0xfff 40 $e = -4096; // negation of 0x1000 41 $f = -16773120; // negation of 0xfff000 42 $g = -1044481; // negation of 0xff001 43 $h = -16777216; // negation of 0x1000000 44 $i = -64729929336; // negation of 0xf12345678 45 46 var_dump($a > $b ? 1 : 0); 47 var_dump($a > $c ? 1 : 0); 48 var_dump($a > $d ? 1 : 0); 49 var_dump($a > $e ? 1 : 0); 50 var_dump($a > $f ? 1 : 0); 51 var_dump($a > $g ? 1 : 0); 52 var_dump($a > $h ? 1 : 0); 53 var_dump($a > $i ? 1 : 0); 54} 55 56foo(42); 57bar(42); 58?> 59--EXPECT-- 60int(1) 61int(1) 62int(0) 63int(0) 64int(0) 65int(0) 66int(0) 67int(0) 68int(1) 69int(1) 70int(1) 71int(1) 72int(1) 73int(1) 74int(1) 75int(1) 76