This is the mail archive of the gcc@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]

Re: "xordi3" pattern in arm.md


> What purpose does this pattern serve?  It just performs splitting, and a test 
> case like the one below seems to produce rather better code without it.
> 
> void g (unsigned long long);
> f(unsigned long long l)
> { g(l ^ 0x1000000010000000ULL); }

Right, but that constant is somewhat unusual in that both halves of it are 
valid immediate ARM constants.  Also remember that splitting the 
operations up into subreg operations too early can limit the opportunities 
for combine and the other optimizers to work well.  Consider

long long x (long long y)
{
  long long z = ~0LL;
  return (y ^ z) + 1;
}


With the xordi3 pattern in, this compiles to 

        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, current_function_anonymous_args = 0
        @ link register save eliminated.
        rsbs    r0, r0, #0
        rsc     r1, r1, #0
        mov     pc, lr

Without it, I suspect that we would miss the optimization altogether. 

It might be worth creating a peephole2 pattern for this case.

R.


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