https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68421
Bug ID: 68421
Summary: unused copy of global register variable into another
gpr
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: acsawdey at gcc dot gnu.org
CC: bergner at gcc dot gnu.org
Target Milestone: ---
Target: ppc64le
Created attachment 36767
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36767&action=edit
test case for unused registers
There are unneeded moves from the global register variables to other registers
generated.
register zend_execute_data *execute_data __asm__("r28");
register const zend_op *opline __asm__("r29");
int ZEND_IS_SMALLER_SPEC_CV_CV_HANDLER(void)
{
zval *op1, *op2, *result;
op1 = _get_zval_ptr_cv_undef(execute_data, opline->op1.var);
if (__builtin_expect(!!(zval_get_type(&(*(op1))) == 4), 1)) {
if (__builtin_expect(!!(zval_get_type(&(*(op2))) == 4), 1)) {
do { (*(((zval*)(((char*)(execute_data)) +
((int)(opline->result.var)))))).u1.type_info = ((*(op1)).value.lval <
(*(op2)).value.lval) ? 3 : 2; } while (0);
}
}
((execute_data)->opline) = opline;
}
generates:
ZEND_IS_SMALLER_SPEC_CV_CV_HANDLER:
lwa 6,0(29)
mr 8,29
mr 10,28
add 9,28,6
lbz 9,8(9)
cmpwi 7,9,4
bne 7,.L3
li 7,0
lbz 9,8(7)
cmpwi 7,9,4
bne 7,.L3
ldx 9,28,6
ld 6,0(7)
lwa 7,4(29)
cmpd 7,9,6
add 7,28,7
mfcr 9,1
rlwinm 9,9,29,1
addi 9,9,2
stw 9,8(7)
.L3:
std 8,0(10)
Registers 8 and 10 are never used, 28 and 29 are used directly.
Generated by trunk 230468 on ppc64le with:
gcc -O3 -S min_unused_regs10.c