Patch to combine.c for simd-5 failures

Richard Sandiford rsandifo@redhat.com
Wed Sep 24 20:14:00 GMT 2003


This patch fixes some compile/simd-5 failures on mips targets.
The problem was that combine.c:if_then_else_cond() was trying to
do the following for vector modes:

  /* If X is known to be either 0 or -1, those are the true and
     false values when testing X.  */
  [...]
  /* Likewise for 0 or a single bit.  */
  else if (mode != VOIDmode
	   && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
	   && exact_log2 (nz = nonzero_bits (x, mode)) >= 0)
    {
      *ptrue = gen_int_mode (nz, mode), *pfalse = const0_rtx;
      return x;
    }

and we'd then abort in trunc_int_for_mode.

Tested on i686-pc-linux-gnu, mips-sgi-irix6.5{,32} & other mips targets.
OK to install?

Richard


	* combine.c (if_then_else_cond): Tighten mode check.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.387
diff -u -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.387 combine.c
--- combine.c	14 Sep 2003 18:31:13 -0000	1.387
+++ combine.c	21 Sep 2003 15:04:54 -0000
@@ -7422,7 +7422,7 @@ if_then_else_cond (rtx x, rtx *ptrue, rt
     }
 
   /* Likewise for 0 or a single bit.  */
-  else if (mode != VOIDmode
+  else if (SCALAR_INT_MODE_P (mode)
 	   && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
 	   && exact_log2 (nz = nonzero_bits (x, mode)) >= 0)
     {



More information about the Gcc-patches mailing list