[PATCH] Possible fix for PR middle-end/6600?

Roger Sayle roger@eyesopen.com
Wed May 15 17:12:00 GMT 2002


The patch below is an attempt to fix PR middle-end/6600.

The change is to distinguish the maximum number of bytes we can
copy in a single instruction (MOVE_MAX_PIECES) from the maximum
number of bytes that can be stored in a single instruction
(STORE_MAX_PIECES).  This prevents GCC trying to represent
an entire cache line by an immediate constant on some platforms.

I have bootstraped the patch on i686-pc-linux-gnu to ensure that
its well formed, but haven't tested it (natively or with a cross
compiler) on any platforms that exhibit the failure (an ICE).

Even if the correct approach to PR mid/6600 is to fix instruction
constraints in i960.md, this change should stop GCC ICEing where
it currently does in the middle-end.


Jim, could you check whether this solves your problem?

Ok for mainline if it doesn't make anything worse?


2002-05-15  Roger Sayle  <roger@eyesopen.com>

	PR middle-end/6600
	* expr.c (STORE_MAX_PIECES): New macro to avoid immediate constants
	larger than INTEGER_CST.  (can_store_by_pieces): Use it here...
	(store_by_pieces_1): ... and here to limit the largest mode used.


Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.454
diff -c -3 -p -r1.454 expr.c
*** expr.c	13 May 2002 04:50:10 -0000	1.454
--- expr.c	15 May 2002 22:29:00 -0000
*************** convert_modes (mode, oldmode, x, unsigne
*** 1403,1408 ****
--- 1403,1414 ----
  #define MOVE_MAX_PIECES   MOVE_MAX
  #endif

+ /* STORE_MAX_PIECES is the number of bytes at a time that we can
+    store efficiently.  This is MOVE_MAX_PIECES limited by the
+    number of bytes GCC can represent in an immediate constant.  */
+
+ #define STORE_MAX_PIECES  MIN (MOVE_MAX_PIECES, 2 * sizeof (HOST_WIDE_INT))
+
  /* Generate several move instructions to copy LEN bytes from block FROM to
     block TO.  (These are MEM rtx's with BLKmode).  The caller must pass FROM
     and TO through protect_from_queue before calling.
*************** can_store_by_pieces (len, constfun, cons
*** 2364,2370 ****
      {
        l = len;
        mode = VOIDmode;
!       max_size = MOVE_MAX_PIECES + 1;
        while (max_size > 1)
  	{
  	  for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
--- 2370,2376 ----
      {
        l = len;
        mode = VOIDmode;
!       max_size = STORE_MAX_PIECES + 1;
        while (max_size > 1)
  	{
  	  for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
*************** store_by_pieces_1 (data, align)
*** 2475,2481 ****
       unsigned int align;
  {
    rtx to_addr = XEXP (data->to, 0);
!   unsigned HOST_WIDE_INT max_size = MOVE_MAX_PIECES + 1;
    enum machine_mode mode = VOIDmode, tmode;
    enum insn_code icode;

--- 2481,2487 ----
       unsigned int align;
  {
    rtx to_addr = XEXP (data->to, 0);
!   unsigned HOST_WIDE_INT max_size = STORE_MAX_PIECES + 1;
    enum machine_mode mode = VOIDmode, tmode;
    enum insn_code icode;


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833



More information about the Gcc-patches mailing list