I am looking into optimizing the fast_increment_function in
Zend/zend-operators.h for better performance on aarch64 systems by adding
some inline assembly that will reproduce what currently exists for x86_64
and i386 systems.

My main issue at the moment is understanding what occurs in the x86_64
assembly section when the incremented register overflows. I understand that
it moves a some constant values into the registers, but I don't understand
the significance of these values or why we use them.

__asm__(
"incq (%0)\n\t"
"jno  0f\n\t"
"movl $0x0, (%0)\n\t"
"movl $0x43e00000, 0x4(%0)\n\t"
"movb %1, %c2(%0)\n"
"0:"
:
: "r"(&op1->value),
  "n"(IS_DOUBLE),
  "n"(ZVAL_OFFSETOF_TYPE)
: "cc");

Can anyone clarify the purpose of the 3 'mov' instructions?
Thanks,
Justin

Reply via email to