This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

m68k-openbsd -fpic fix


On Thu, Jun 24, 1999 at 06:22:47PM -0600, Jeffrey A Law wrote:
>   > See http://egcs.cygnus.com/ml/egcs-bugs/1999-05/msg00764.html
>   > for an example of how critical it is.
>
> I've already stated that bug is unlikely to get fixed.

I had a look at this this morning.  Unless I'm dreadfully mistaken,
this is not a difficult bug, but in fact quite simple.

m68k can load arbitrary floating point constants directly.  There's
no need to spill them to memory, pic or non-pic.  It would probably
make for smaller code if constants that appeared more than once 
were spilled to memory earlier, but no effort has been made to do
this.  In any case, there's no need to do it during reload.

So a simple tweek to PREFERRED_RELOAD_CLASS seems to be all that's
necessary.


r~


	* m68k.h (PREFERRED_RELOAD_CLASS): Don't force any FP const_doubles
	to memory.

Index: m68k.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/m68k/m68k.h,v
retrieving revision 1.32
diff -c -p -d -r1.32 m68k.h
*** m68k.h	1999/03/01 15:06:46	1.32
--- m68k.h	1999/06/26 22:32:58
*************** extern enum reg_class regno_reg_class[];
*** 772,794 ****
     in some cases it is preferable to use a more restrictive class.
     On the 68000 series, use a data reg if possible when the
     value is a constant in the range where moveq could be used
!    and we ensure that QImodes are reloaded into data regs.
!    Also, if a floating constant needs reloading, put it in memory.
!    Don't do this for !G constants, since all patterns in the md file
!    expect them to be loaded into a register via fpmovecr.  See above.  */
  
! #define PREFERRED_RELOAD_CLASS(X,CLASS)  \
!   ((GET_CODE (X) == CONST_INT			\
!     && (unsigned) (INTVAL (X) + 0x80) < 0x100	\
!     && (CLASS) != ADDR_REGS)			\
!    ? DATA_REGS					\
!    : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS) \
!    ? DATA_REGS					\
!    : (GET_CODE (X) == CONST_DOUBLE		\
!       && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
!    ? (! CONST_DOUBLE_OK_FOR_LETTER_P (X, 'G')	\
!       && (CLASS == FP_REGS || CLASS == DATA_OR_FP_REGS) \
!       ? FP_REGS : NO_REGS)			\
     : (CLASS))
  
  /* Force QImode output reloads from subregs to be allocated to data regs,
--- 772,790 ----
     in some cases it is preferable to use a more restrictive class.
     On the 68000 series, use a data reg if possible when the
     value is a constant in the range where moveq could be used
!    and we ensure that QImodes are reloaded into data regs.  */
  
! #define PREFERRED_RELOAD_CLASS(X,CLASS)					\
!   ((GET_CODE (X) == CONST_INT						\
!     && (unsigned) (INTVAL (X) + 0x80) < 0x100				\
!     && (CLASS) != ADDR_REGS)						\
!    ? DATA_REGS								\
!    : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS)			\
!    ? DATA_REGS								\
!    : (GET_CODE (X) == CONST_DOUBLE					\
!       && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT)			\
!    ? (TARGET_68881 && (CLASS == FP_REGS || CLASS == DATA_OR_FP_REGS)	\
!       ? FP_REGS : NO_REGS)						\
     : (CLASS))
  
  /* Force QImode output reloads from subregs to be allocated to data regs,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]