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]

Make m32c build, fix PSImode truncation


This patch here:
  http://gcc.gnu.org/ml/gcc-patches/2012-10/msg00661.html

changed simplification code from
     case TRUNCATE:
-      /* We can't handle truncation to a partial integer mode here
-         because we don't know the real bitsize of the partial
-         integer mode.  */
-      if (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
-        break;

to
+      if (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
+       {
+         if (TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (op)))
+           return rtl_hooks.gen_lowpart_no_emit (mode, op);
+         /* We can't handle truncation to a partial integer mode here
+            because we don't know the real bitsize of the partial
+            integer mode.  */
+         break;
+       }

This is problematic for m32c; it defines TRULY_NOOP_TRUNCATION as 1, and
it's not really possible to define it meaningfully for partial int
modes, since it only gets passed precisions. Allowing subregs of PSImode
values leads to out of registers reload failures, so it kind of relies
on the previous behaviour.

The patch below restores the old behaviour. Bootstrapped and tested on
x86_64-linux, and it makes m32c build. Ok?


Bernd
	* simplify-rtx.c (simplify_unary_operation_1): Don't try to
	simplify truncations of partial int modes.

diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 791f91a..6a8221c 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1038,12 +1038,6 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
 
       if (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
 	{
-	  if (TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (op)))
-	    {
-	      temp = rtl_hooks.gen_lowpart_no_emit (mode, op);
-	      if (temp)
-		return temp;
-	    }
 	  /* We can't handle truncation to a partial integer mode here
 	     because we don't know the real bitsize of the partial
 	     integer mode.  */

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