On Fri, Oct 31, 2014 at 8:53 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Fri, Oct 31, 2014 at 08:45:54PM +0100, Uros Bizjak wrote: >> Attached patch works around PR 63620. Patched gcc will allow only a >> subset of CONST_DOUBLEs in FP push patterns. This subset will result >> in direct immediates that can always be encoded directly in the insn >> stream. These won't be reloaded through memory, and will avoid PIC >> register re-materialization issues. OTOH, the patch will generate >> non-optimal push sequences when general registers are available. >> >> 2014-10-31 Uros Bizjak <ubiz...@gmail.com> >> >> PR target/63620 >> * config/i386/i386.md (*pushtf): Allow only CONST_DOUBLES that won't >> be reloaded through memory. >> (*pushxf): Ditto. >> (*pushdf): Ditto. >> >> The patch was bootstrapped and regression tested on x86_64-linux-gnu >> {-m32}. The patch was also checked with Darwin crosscompiler on the >> testcases in the PR. > > Can't you limit the workaround to ix86_use_pseudo_pic_reg () only > if it is about PIC register changes?
Indeed, thanks for the suggestion. I will amend the patch with the attached. Thanks, Uros.
Index: i386-protos.h =================================================================== --- i386-protos.h (revision 216987) +++ i386-protos.h (working copy) @@ -42,6 +42,8 @@ extern void ix86_reset_previous_fndecl (void); +extern bool ix86_use_pseudo_pic_reg (void); + #ifdef RTX_CODE extern int standard_80387_constant_p (rtx); extern const char *standard_80387_constant_opcode (rtx); Index: i386.c =================================================================== --- i386.c (revision 216987) +++ i386.c (working copy) @@ -6158,7 +6158,7 @@ /* Return 1 if pseudo register should be created and used to hold GOT address for PIC code. */ -static bool +bool ix86_use_pseudo_pic_reg (void) { if ((TARGET_64BIT Index: i386.md =================================================================== --- i386.md (revision 216987) +++ i386.md (working copy) @@ -2738,7 +2738,8 @@ [(set (match_operand:TF 0 "push_operand" "=<,<") (match_operand:TF 1 "general_no_elim_operand" "x,*roF"))] "(TARGET_64BIT || TARGET_SSE) - && (!can_create_pseudo_p () + && (!ix86_use_pseudo_pic_reg () + || !can_create_pseudo_p () || GET_CODE (operands[1]) != CONST_DOUBLE || standard_sse_constant_p (operands[1]))" { @@ -2766,7 +2767,8 @@ (define_insn "*pushxf" [(set (match_operand:XF 0 "push_operand" "=<,<") (match_operand:XF 1 "general_no_elim_operand" "f,Yx*roF"))] - "!can_create_pseudo_p () + "!ix86_use_pseudo_pic_reg () + || !can_create_pseudo_p () || GET_CODE (operands[1]) != CONST_DOUBLE || standard_80387_constant_p (operands[1]) > 0" { @@ -2800,7 +2802,8 @@ (define_insn "*pushdf" [(set (match_operand:DF 0 "push_operand" "=<,<,<,<") (match_operand:DF 1 "general_no_elim_operand" "f,Yd*roF,rmF,x"))] - "!can_create_pseudo_p () + "!ix86_use_pseudo_pic_reg () + || !can_create_pseudo_p () || GET_CODE (operands[1]) != CONST_DOUBLE || (!(TARGET_SSE2 && TARGET_SSE_MATH) && standard_80387_constant_p (operands[1]) > 0)