Fix alpha-linux core dump reported by H.J. Lu.
authorJim Wilson <wilson@cygnus.com>
Tue, 2 Sep 1997 19:37:05 +0000 (19:37 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Tue, 2 Sep 1997 19:37:05 +0000 (12:37 -0700)
* alpha/alpha.h (PREFERRED_RELOAD_CLASS): Return NO_REGS if NO_REGS
is passed in.
* emit-rtl.c (gen_lowpart_common): Add code to convert CONST_INT to
SFmode for 64 bit hosts.

From-SVN: r15035

gcc/ChangeLog
gcc/config/alpha/alpha.h
gcc/emit-rtl.c

index 94e3097a802db3b3d675d6a00f7c32e391a7d073..1f7438def7f47b4d9c7415f78c5910efd9c2e28f 100644 (file)
@@ -1,3 +1,10 @@
+Tue Sep  2 12:00:36 1997  Jim Wilson  <wilson@cygnus.com>
+
+       * alpha/alpha.h (PREFERRED_RELOAD_CLASS): Return NO_REGS if NO_REGS
+       is passed in.
+       * emit-rtl.c (gen_lowpart_common): Add code to convert CONST_INT to
+       SFmode for 64 bit hosts.
+       
 Tue Sep  2 13:42:38 1997  Paul N. Hilfinger  <hilfingr@CS.Berkeley.EDU>
 
        * fixincludes: Permits spaces between # and define.  Discard C++
index 16d73983c891aba80c6a09a7f77cff3d41202a57..232920c2d61d89b5b7ddf981694e99773051e726 100644 (file)
@@ -691,7 +691,7 @@ enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS,
 
 #define PREFERRED_RELOAD_CLASS(X, CLASS)               \
   (CONSTANT_P (X) && (X) != const0_rtx && (X) != CONST0_RTX (GET_MODE (X)) \
-   ? ((CLASS) == FLOAT_REGS ? NO_REGS : GENERAL_REGS)                  \
+   ? ((CLASS) == FLOAT_REGS || (CLASS) == NO_REGS ? NO_REGS : GENERAL_REGS)\
    : (CLASS))
 
 /* Loading and storing HImode or QImode values to and from memory
index 650c01c7852476701274ecfe7ed3a385cc4d1873..86948de9905d728f3a58739685c286a124b58420 100644 (file)
@@ -809,6 +809,26 @@ gen_lowpart_common (mode, x)
       return CONST_DOUBLE_FROM_REAL_VALUE (u.d, mode);
     }
 #endif
+
+  /* We need an extra case for machines where HOST_BITS_PER_WIDE_INT is the
+     same as sizeof (double), such as the alpha.  We only handle the
+     REAL_ARITHMETIC case, which is easy.  Testing HOST_BITS_PER_WIDE_INT
+     is not strictly necessary, but is done to restrict this code to cases
+     where it is known to work.  */
+#ifdef REAL_ARITHMETIC
+  else if (mode == SFmode
+          && GET_CODE (x) == CONST_INT
+          && GET_MODE_BITSIZE (mode) * 2 == HOST_BITS_PER_WIDE_INT)
+    {
+      REAL_VALUE_TYPE r;
+      HOST_WIDE_INT i;
+
+      i = INTVAL (x);
+      r = REAL_VALUE_FROM_TARGET_SINGLE (i);
+      return CONST_DOUBLE_FROM_REAL_VALUE (r, mode);
+    }
+#endif
+
   /* Similarly, if this is converting a floating-point value into a
      single-word integer.  Only do this is the host and target parameters are
      compatible.  */