Skip to content

Commit f21586a

Browse files
shqkingdstogov
authored andcommitted
Support failed JIT test case: cmp_002.phpt
'smart_branch_opcode' JMPZ is used in this test case. Similar to the previous patch, I still didn't get why NaN check is missing for the cases ">" and ">=". In our implementation, we add such checks.
1 parent a6ee6af commit f21586a

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4320,7 +4320,66 @@ static int zend_jit_cmp_long_long(dasm_State **Dst,
43204320
static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, bool swap, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr)
43214321
{
43224322
if (smart_branch_opcode) {
4323-
| brk #0 // TODO
4323+
if (smart_branch_opcode == ZEND_JMPZ) {
4324+
switch (opline->opcode) {
4325+
case ZEND_IS_EQUAL:
4326+
case ZEND_IS_IDENTICAL:
4327+
case ZEND_CASE:
4328+
case ZEND_CASE_STRICT:
4329+
| brk #0 // TODO
4330+
break;
4331+
case ZEND_IS_NOT_EQUAL:
4332+
| brk #0 // TODO
4333+
break;
4334+
case ZEND_IS_NOT_IDENTICAL:
4335+
| brk #0 // TODO
4336+
break;
4337+
case ZEND_IS_SMALLER:
4338+
if (swap) {
4339+
if (exit_addr) {
4340+
| brk #0 // TODO
4341+
} else {
4342+
| bvs => target_label // TODO: why the NaN check is missing in x86?
4343+
| bls => target_label
4344+
}
4345+
} else {
4346+
if (exit_addr) {
4347+
| brk #0 // TODO
4348+
} else {
4349+
| bhs => target_label
4350+
}
4351+
}
4352+
break;
4353+
case ZEND_IS_SMALLER_OR_EQUAL:
4354+
if (swap) {
4355+
if (exit_addr) {
4356+
| brk #0 // TODO
4357+
} else {
4358+
| bvs => target_label // TODO: why the NaN check is missing in x86?
4359+
| blo => target_label
4360+
}
4361+
} else {
4362+
if (exit_addr) {
4363+
| brk #0 // TODO
4364+
} else {
4365+
| bhi => target_label
4366+
}
4367+
}
4368+
break;
4369+
default:
4370+
ZEND_UNREACHABLE();
4371+
}
4372+
} else if (smart_branch_opcode == ZEND_JMPNZ) {
4373+
| brk #0 // TODO
4374+
} else if (smart_branch_opcode == ZEND_JMPZNZ) {
4375+
| brk #0 // TODO
4376+
} else if (smart_branch_opcode == ZEND_JMPZ_EX) {
4377+
| brk #0 // TODO
4378+
} else if (smart_branch_opcode == ZEND_JMPNZ_EX) {
4379+
| brk #0 // TODO
4380+
} else {
4381+
ZEND_UNREACHABLE();
4382+
}
43244383
} else {
43254384
switch (opline->opcode) {
43264385
case ZEND_IS_EQUAL:

0 commit comments

Comments
 (0)