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]

Re: Using gen_int_mode instead of GEN_INT minot testsuite fallout on MIPS


Graham Stott <graham.stott@btinternet.com> writes:
> Hi Richard,
>
> There is some minor testsuite fallout with these patches on MIPS a
> couple of tests (see below)ICE ingen_int_mode () in both these ICE the
> mode is CCmode.

Hmm, interesting.  I suppose gen_int_mode should handle CC modes,
since there's no other constant rtx that can be used instead.  OTOH,
like you say, it doesn't really make sense to apply try_const_anchor
to CCmode.

How does the following patch look?

Thanks,
Richard


gcc/
	* emit-rtl.c (gen_int_mode): Handle CC modes.
	* cse.c (try_const_anchors): ...but punt on them here.

Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	2013-09-08 11:52:15.000000000 +0100
+++ gcc/emit-rtl.c	2013-09-11 19:32:35.702377902 +0100
@@ -417,6 +417,11 @@ gen_rtx_CONST_INT (enum machine_mode mod
 rtx
 gen_int_mode (HOST_WIDE_INT c, enum machine_mode mode)
 {
+  /* CONST_INT is used for CC modes too.  We can't make any assumptions
+     about the precision or bitsize in that case, so just pass the value
+     through unchanged.  */
+  if (GET_MODE_CLASS (mode) == MODE_CC)
+    return GEN_INT (c);
   return GEN_INT (trunc_int_for_mode (c, mode));
 }
 
Index: gcc/cse.c
===================================================================
--- gcc/cse.c	2013-09-08 11:52:15.000000000 +0100
+++ gcc/cse.c	2013-09-11 19:38:17.664399826 +0100
@@ -1354,6 +1354,11 @@ try_const_anchors (rtx src_const, enum m
   rtx lower_exp = NULL_RTX, upper_exp = NULL_RTX;
   unsigned lower_old, upper_old;
 
+  /* CONST_INT is used for CC modes, but we should leave those alone.  */
+  if (GET_MODE_CLASS (mode) == MODE_CC)
+    return NULL_RTX;
+
+  gcc_assert (SCALAR_INT_MODE_P (mode));
   if (!compute_const_anchors (src_const, &lower_base, &lower_offs,
 			      &upper_base, &upper_offs))
     return NULL_RTX;


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