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]

[cft] fix TCmode on powerpc et al


On Thu, Dec 02, 2004 at 11:29:37AM -0500, Andrew Pinski wrote:
> >The new failures are:
> >native gcc.sum gcc.c-torture/compile/941019-1.c
> >native gcc.sum gcc.c-torture/execute/20010605-2.c
> >native gcc.sum gcc.c-torture/execute/builtins/complex-1.c
> >native gcc.sum gcc.c-torture/execute/complex-6.c
> >native gcc.sum gcc.dg/builtins-1.c
> >native gcc.sum gcc.dg/builtins-16.c
> >native gcc.sum gcc.dg/compat/scalar-by-value-3
> >native gcc.sum gcc.dg/compat/scalar-return-3
> >native gcc.sum gcc.dg/compat/struct-by-value-18
> >native gcc.sum gcc.dg/torture/builtin-attr-1.c
> 
> We call extract_bit_field with a TC mode but since int_mode_for_mode
> for TC mode will return BLKmode, we get a crash in gen_lowpart.

Please try this.


r~



Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.752
diff -u -p -r1.752 expr.c
--- expr.c	2 Dec 2004 05:24:07 -0000	1.752
+++ expr.c	2 Dec 2004 19:29:34 -0000
@@ -2580,16 +2580,32 @@ clear_storage_libcall_fn (int for_call)
 static void
 write_complex_part (rtx cplx, rtx val, bool imag_p)
 {
+  enum machine_mode cmode;
+  enum machine_mode imode;
+  unsigned ibitsize;
+
   if (GET_CODE (cplx) == CONCAT)
-    emit_move_insn (XEXP (cplx, imag_p), val);
-  else
     {
-      enum machine_mode cmode = GET_MODE (cplx);
-      enum machine_mode imode = GET_MODE_INNER (cmode);
-      unsigned ibitsize = GET_MODE_BITSIZE (imode);
+      emit_move_insn (XEXP (cplx, imag_p), val);
+      return;
+    }
 
-      store_bit_field (cplx, ibitsize, imag_p ? ibitsize : 0, imode, val);
+  cmode = GET_MODE (cplx);
+  imode = GET_MODE_INNER (cmode);
+  ibitsize = GET_MODE_BITSIZE (imode);
+
+  /* If the sub-object is at least word sized, then we know that subregging
+     will work.  This special case is important, since store_bit_field
+     wants to operate on integer modes, and there's rarely an OImode to
+     correspond to TCmode.  */
+  if (ibitsize >= BITS_PER_WORD)
+    {
+      rtx part = simplify_gen_subreg (imode, cplx, cmode,
+				      imag_p ? GET_MODE_SIZE (imode) : 0);
+      emit_move_insn (part, val);
     }
+  else
+    store_bit_field (cplx, ibitsize, imag_p ? ibitsize : 0, imode, val);
 }
 
 /* Extract one of the components of the complex value CPLX.  Extract the
@@ -2620,6 +2636,18 @@ read_complex_part (rtx cplx, bool imag_p
 	}
     }
 
+  /* If the sub-object is at least word sized, then we know that subregging
+     will work.  This special case is important, since extract_bit_field
+     wants to operate on integer modes, and there's rarely an OImode to
+     correspond to TCmode.  */
+  if (ibitsize >= BITS_PER_WORD)
+    {
+      rtx ret = simplify_gen_subreg (imode, cplx, cmode,
+				     imag_p ? GET_MODE_SIZE (imode) : 0);
+      gcc_assert (ret != NULL);
+      return ret;
+    }
+
   return extract_bit_field (cplx, ibitsize, imag_p ? ibitsize : 0,
 			    true, NULL_RTX, imode, imode);
 }


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