http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47580
Summary: Powerpc GCC fails test gcc.dg/pr41551.c if built with
--with-cpu=power7
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
Host: powerpc64-linux
Target: powerpc64-linux
Build: powerpc64-linux
Test gcc.dg/pr41551.c fails for powerpc if the default target is power7.
This is due to the fact that the expander for floatunsdidf (and others) uses
gpc_reg_operand:
(define_expand "floatunsdidf2"
[(set (match_operand:DF 0 "gpc_reg_operand" "")
(unsigned_float:DF
(match_operand:DI 1 "gpc_reg_operand" "")))]
"TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
"")
However, the corresponding VSX matcher uses vsx_register_operand:
(define_insn "vsx_floatuns<VSi><mode>2"
[(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
(unsigned_float:VSX_B (match_operand:<VSI> 1 "vsx_register_operand"
"<VSr2>,<VSr3>")))]
"VECTOR_UNIT_VSX_P (<MODE>mode)"
"x<VSv>cvux<VSc><VSs> %x0,%x1"
[(set_attr "type" "<VStype_simple>")
(set_attr "fp_type" "<VSfptype_simple>")])
Gpc_reg_operand allows the virtual stack registers while vsx_register_operand
does not. Since the test is:
__extension__ typedef __SIZE_TYPE__ size_t;
int main(void)
{
int var, *p = &var;
return (double)(size_t)(p);
}
It means the expander creates:
(insn 5 4 6 3 (set (reg:DF 125)
(unsigned_float:DF (reg/f:DI 115 virtual-stack-vars))) pr41551.c:11 -1
(nil))
Which then doesn't match when the target is VSX. There are several different
ways this can be solved:
1) Allow virtual stack registers to be used in the vsx register operands.
2) Add a new predicate that doesn't allow virtual stack registers in the
expander;
3) Add code in the expander to copy the results if it is in a virtual
register.