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]
Other format: [Raw text]

[m68k ICE] Fix HARD_REGNO_MODE_OK for FPU register usage


Hello!

The following code code leads to an ICE with all GCC versions > 2.95(.x)
if TARGET_68881 is disabled (either by default or -msoft-float):

  void bar(double i, double j);
  void foo(double i) { register double j asm("fp0"); bar(i,j); }

The bug is in m68k.h/HARD_REGNO_MODE_OK which doesn't check TARGET_68881
anymore since version 1.40 when Geoff Keating zapped that check. GCC 2.95
having that check simply says:

  register number for 'j' isn't suitable for data type

I believe that makes it a regression.

Gunther

-- cut --
2003-10-22  Gunther Nikl  <gni@gecko.de>

	* config/m68k/m68k.h (HARD_REGNO_MODE_OK): Only permit FPU register
	usage if 68881 use is enabled; update comment.

--- m68k.h_	Mon Oct 20 11:48:14 2003
+++ m68k.h	Wed Oct 22 11:47:53 2003
@@ -542,12 +542,13 @@ extern int target_flags;
 
 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
    On the 68000, the cpu registers can hold any mode but the 68881 registers
-   can hold only SFmode or DFmode.  */
+   can hold only SFmode or DFmode.  The 68881 registers can't hold anything
+   if 68881 use is disabled.  */
 
 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
   (((REGNO) < 16					\
     && !((REGNO) < 8 && (REGNO) + GET_MODE_SIZE (MODE) / 4 > 8))	\
-   || ((REGNO) >= 16 && (REGNO) < 24				        \
+   || ((REGNO) >= 16 && (REGNO) < 24 && TARGET_68881	\
        && (GET_MODE_CLASS (MODE) == MODE_FLOAT		\
 	   || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)		\
        && GET_MODE_UNIT_SIZE (MODE) <= 12))
-- cut --


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