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: [Committed] PR rtl-optimization/29797: ifcvt.c vs BITS_BIG_ENDIAN


On 11/13/06, Roger Sayle <roger@eyesopen.com> wrote:

The following patch is a very slightly modified version Michael Matz's fix for the wrong-code regression. My patch to implement PR9814 didn't take into account the influence of BITS_BIG_ENDIAN on the semantics of zero_extract. Indeed, this can be confirmed by noticing that the added gcc.dg/pr9814-1.c testcase isn't being optimized on powerpc and other BITS_BIG_ENDIAN targets. Adding the appropriate logic to correct for BITS_BIG_ENDIAN corrects, this and addresses the miscompilation bug.

int test1(int x)
{
  if (x & 2)
    x |= 2;
  return x;
}

On powerpc-unknown-linux-gnu previously generated:

test1:  andi. 0,3,2
        beqlr- 0
        ori 3,3,2
        blr

and with the correction below we now generate:

test1: blr


This patch has been tested against mainline on powerpc-unknown-linux-gnu with a full "make bootstrap", all default languages, and regression tested with a top-level "make -k check" with no new failures. Andrew Pinski has also tested a similar patch on powerpc-darwin without problems. However, Richard Guenther has reported problems on ppc64 on the 4.1 branch. I suspect this might be a bad interaction with an independent latent bug on older branches, or a 64-bit issue perhaps addressed by the variant of this patch below. To avoid problems, I'll fully test against the 4.1 and 4.2 branches on both ppc and ppc64 before backporting.

It turns out this was a mistake on my side where I used GET_MODE_BITSIZE before extracting the mode...

So, sorry for the confusion.
Richard.


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