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]

[PATCH] Fix simd-2.c failure on powerpc


The following patch fixes the current testsuite failure of
gcc.c-torture/execute/simd-2.c on PowerPC which was exposed
by a recent GCSE bug fix of mine.

The analysis of the failure and description of the two fixes are
given in http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00615.html

Many thanks also to David Anglin for confirming that my approach
to reg_overlap_mentioned_p was sane.  The hunk below is slightly
different to his suggested patch (intended to support the VAX):
http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00625.html

The second and third operands of ZERO_EXTRACT should always be
constant integers and therefore we only need to examine the
first operand.  The idiom of testing for ZERO_EXTRACT, SIGN_EXTRACT
and STRICT_LOW_PART appears elsewhere in rtlanal.c, and reusing
it means that this patch should also handle the sign_extract case.

[Dave, you might want to confirm that this patch still works for
your VAX port.  Many thanks again].


The following patch has been tested on powerpc-ibm-aix5.2.0.0 with
a full "make bootstrap", all languages except Ada, treelang and
Java?, and regression tested with a top-level "make -k check" with
no new regressions.  It fixes the two failures of simd-2.c at -O3.
[Many thanks to IBM for providing the AIX server].

Ok for mainline?  These are also latent bugs in gcc 3.3 and so this
patch may be appropriate for the release branch.

Many thanks in advance,


2003-04-10  Roger Sayle  <roger at eyesopen dot com>

	* combine.c (can_combine_p): Don't attempt to combine if the
	destination of the set is neither a register nor cc0.
	* rtlanal.c (reg_overlap_mentioned_p): Handle ZERO_EXTRACT
	and SIGN_EXTRACT.


Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.354
diff -c -3 -p -r1.354 combine.c
*** combine.c	1 Apr 2003 18:33:49 -0000	1.354
--- combine.c	9 Apr 2003 22:39:09 -0000
*************** can_combine_p (insn, i3, pred, succ, pde
*** 1089,1094 ****
--- 1089,1096 ----
  	 makes sure that those insns don't disappear.  */
        || find_reg_note (insn, REG_RETVAL, NULL_RTX)
  #endif
+       /* DEST must be either a REG or CC0.  */
+       || ! (REG_P (dest) || CC0_P (dest))
        /* Make sure that DEST is not used after SUCC but before I3.  */
        || (succ && ! all_adjacent
  	  && reg_used_between_p (dest, succ, i3))
Index: rtlanal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtlanal.c,v
retrieving revision 1.152
diff -c -3 -p -r1.152 rtlanal.c
*** rtlanal.c	30 Mar 2003 20:46:57 -0000	1.152
--- rtlanal.c	9 Apr 2003 22:39:10 -0000
*************** reg_overlap_mentioned_p (x, in)
*** 1573,1579 ****
    unsigned int regno, endregno;

    /* Overly conservative.  */
!   if (GET_CODE (x) == STRICT_LOW_PART)
      x = XEXP (x, 0);

    /* If either argument is a constant, then modifying X can not affect IN.  */
--- 1573,1581 ----
    unsigned int regno, endregno;

    /* Overly conservative.  */
!   if (GET_CODE (x) == STRICT_LOW_PART
!       || GET_CODE (x) == ZERO_EXTRACT
!       || GET_CODE (x) == SIGN_EXTRACT)
      x = XEXP (x, 0);

    /* If either argument is a constant, then modifying X can not affect IN.  */

Roger
--
Roger Sayle,                         E-mail: roger at eyesopen dot 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


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