[patch,middle-end] Fix problem with constant doubles in emit_group_load_1

John David Anglin dave@hiauly1.hia.nrc.ca
Tue Sep 25 02:39:00 GMT 2007


The enclosed patch fixes a problem in emit_group_load_1.  The hppa64
target doesn't currently support TImode.  As a result, a load of a
128-bit vector constant needs to be handled by pieces.  However, the
128-bit constant is represented as a CONSTANT_DOUBLE.  The current
code assigns the same double to each piece.  This results in incorrect
code.  The constant is also output incorrectly.  More details are
in the PR: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33436>.

The enclosed patch has been tested on hppa64-hp-hpux11.11 and
hppa2.0w-hp-hpux11.11 with no regressions.

OK for trunk?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

:ADDPATCH middle-end:

2007-09-24  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle-end/33436
	* expr.c (emit_group_load_1): Split constant double when destination
	length is half source length.

Index: expr.c
===================================================================
--- expr.c	(revision 128693)
+++ expr.c	(working copy)
@@ -1776,8 +1776,25 @@
       else if (CONSTANT_P (src) && GET_MODE (dst) != BLKmode
                && XVECLEN (dst, 0) > 1)
         tmps[i] = simplify_gen_subreg (mode, src, GET_MODE(dst), bytepos);
-      else if (CONSTANT_P (src)
-	       || (REG_P (src) && GET_MODE (src) == mode))
+      else if (CONSTANT_P (src))
+	{
+	  HOST_WIDE_INT len = (HOST_WIDE_INT) bytelen;
+
+	  if (len == ssize)
+	    tmps[i] = src;
+	  else
+	    {
+	      rtx first, second;
+
+	      gcc_assert (2 * len == ssize);
+	      split_double (src, &first, &second);
+	      if (i)
+		tmps[i] = second;
+	      else
+		tmps[i] = first;
+	    }
+	}
+      else if (REG_P (src) && GET_MODE (src) == mode)
 	tmps[i] = src;
       else
 	tmps[i] = extract_bit_field (src, bytelen * BITS_PER_UNIT,



More information about the Gcc-patches mailing list