https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85216
Bug ID: 85216
Summary: Performance issue with PHP on ppc64 systems
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: tpearson at raptorengineering dot com
Target Milestone: ---
On ppc64[el] systems, GCC emits suboptimal code for the PHP VM (version 7.2.3)
that results in significant performance loss versus a standard x86 machine.
This centers around the HYBRID_BREAK() function converting into two slow
instructions on ppc64el versus one fast instruction on x86.
x86 generated assembly example:
.L33600:
# php7.2-7.2.3/Zend/zend_vm_execute.h:59809:
ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
.loc 2 59809 0
call ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER #
jmp *(%r15) # opline.199_67->handler
ppc64el generated assembly example:
.L35825:
# php7.2-7.2.3/Zend/zend_vm_execute.h:59809:
ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
.loc 2 59809 0
bl ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER #
# php7.2-7.2.3/Zend/zend_vm_execute.h:59810:
HYBRID_BREAK();
.loc 2 59810 0
ld 9,0(29) # opline.200_67->handler, gotovar.1505_2678
mtctr 9 # gotovar.1505_2678, gotovar.1505_2678
bctr
Note the additional assembly instructions emitted for HYBRID_BREAK(); perf
indicates these are consuming considerable amounts of time on ppc64el while the
equivalent jmp on x86 consumes almost no time at all.
I'm not sure if this is a POWER9 quirk (cache problem) or what the correct
assembler should be, just that there is a serious performance loss with the
current emitted assembler versus the x86 equivalent.
Thanks!