com php-src: Improved code for unordered comparison: ext/opcache/jit/zend_jit_x86.dasc ext/opcache/tests /jit/cmp_003.phpt
| From: | Dmitry Stogov | Date: | Mon, 06 May 2019 13:07:48 +0000 |
| Subject: | com php-src: Improved code for unordered comparison: ext/opcache/jit/zend_jit_x86.dasc ext/opcache/tests /jit/cmp_003.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106043@lists.php.net to get a copy of this message | ||
Commit: 66a1d821d3092db9cf8923b91361aca66d12f791
Author: Dmitry Stogov <dmitry@zend.com> Mon, 6 May 2019 16:07:48 +0300
Parents: 17a43fe2a5d4d5f986668876885d8090d801c613
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=66a1d821d3092db9cf8923b91361aca66d12f791
Log:
Improved code for unordered comparison
Changed paths:
M ext/opcache/jit/zend_jit_x86.dasc
M ext/opcache/tests/jit/cmp_003.phpt
Diff:
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 7fa2f16..1d6ea01 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -5530,8 +5530,8 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline,
i
case ZEND_IS_EQUAL:
case ZEND_IS_IDENTICAL:
case ZEND_CASE:
- | jp => target_label
| jne => target_label
+ | jp => target_label
break;
case ZEND_IS_NOT_EQUAL:
case ZEND_IS_NOT_IDENTICAL:
@@ -5541,20 +5541,18 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op
*opline, i
break;
case ZEND_IS_SMALLER:
if (swap) {
- | jp => target_label
| jbe => target_label
} else {
- | jp => target_label
| jae => target_label
+ | jp => target_label
}
break;
case ZEND_IS_SMALLER_OR_EQUAL:
if (swap) {
- | jp => target_label
| jb => target_label
} else {
- | jp => target_label
| ja => target_label
+ | jp => target_label
}
break;
default:
@@ -5574,8 +5572,8 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline,
i
break;
case ZEND_IS_NOT_EQUAL:
case ZEND_IS_NOT_IDENTICAL:
- | jp => target_label
| jne => target_label
+ | jp => target_label
break;
case ZEND_IS_SMALLER:
if (swap) {
@@ -5608,8 +5606,8 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline,
i
case ZEND_IS_EQUAL:
case ZEND_IS_IDENTICAL:
case ZEND_CASE:
- | jp => target_label
| jne => target_label
+ | jp => target_label
break;
case ZEND_IS_NOT_EQUAL:
case ZEND_IS_NOT_IDENTICAL:
@@ -5618,20 +5616,18 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op
*opline, i
break;
case ZEND_IS_SMALLER:
if (swap) {
- | jp => target_label
| jbe => target_label
} else {
- | jp => target_label
| jae => target_label
+ | jp => target_label
}
break;
case ZEND_IS_SMALLER_OR_EQUAL:
if (swap) {
- | jp => target_label
| jb => target_label
} else {
- | jp => target_label
| ja => target_label
+ | jp => target_label
}
break;
default:
@@ -5649,8 +5645,8 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline,
i
case ZEND_IS_IDENTICAL:
case ZEND_CASE:
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
- | jp => target_label
| jne => target_label
+ | jp => target_label
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
break;
case ZEND_IS_NOT_EQUAL:
@@ -5664,26 +5660,24 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op
*opline, i
case ZEND_IS_SMALLER:
if (swap) {
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
- | jp => target_label
| jbe => target_label
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
} else {
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
- | jp => target_label
| jae => target_label
+ | jp => target_label
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
}
break;
case ZEND_IS_SMALLER_OR_EQUAL:
if (swap) {
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
- | jp => target_label
| jb => target_label
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
} else {
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
- | jp => target_label
| ja => target_label
+ | jp => target_label
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
}
break;
@@ -5709,8 +5703,8 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline,
i
case ZEND_IS_NOT_EQUAL:
case ZEND_IS_NOT_IDENTICAL:
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
- | jp => target_label
| jne => target_label
+ | jp => target_label
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
break;
case ZEND_IS_SMALLER:
diff --git a/ext/opcache/tests/jit/cmp_003..phpt b/ext/opcache/tests/jit/cmp_003.phpt
index 4623030..7e1aab6 100644
--- a/ext/opcache/tests/jit/cmp_003.phpt
+++ b/ext/opcache/tests/jit/cmp_003.phpt
@@ -113,6 +113,19 @@ var_dump($i < $b || f());
var_dump($i > $b || f());
var_dump($i <= $b || f());
var_dump($i >= $b || f());
+$a=NAN;
+var_dump($a == $b);
+var_dump($a != $b);
+var_dump($a < $b);
+var_dump($a > $b);
+var_dump($a <= $b);
+var_dump($a >= $b);
+var_dump($a == $b ? 1 : 0);
+var_dump($a != $b ? 1 : 0);
+var_dump($a < $b ? 1 : 0);
+var_dump($a > $b ? 1 : 0);
+var_dump($a <= $b ? 1 : 0);
+var_dump($a >= $b ? 1 : 0);
?>
--EXPECT--
bool(false)
@@ -167,3 +180,15 @@ bool(true)
!bool(false)
!bool(false)
!bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)