[Bug target/43892] PowerPC suboptimal "add with carry" optimization

joakim.tjernlund at transmode dot se gcc-bugzilla@gcc.gnu.org
Mon Jan 19 00:05:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43892

--- Comment #24 from joakim.tjernlund at transmode dot se <joakim.tjernlund at transmode dot se> ---
(In reply to Segher Boessenkool from comment #23)
> Do you know what addcc does?  PowerPC does not have any instruction

No, just guessing :) To me it was generic way to express add with carry

> that behaves like it at all.  So it would have to expand to a big
> fat sequence of instructions, that then hopefully are optimised to
> something sane later.  Instead, the current code expands to something
> sane immediately.

I was hoping that this 
    add 3,3,4
    subfc 0,4,3
    subfe 0,0,0
    subfc 0,0,3
    mr 3,0
could be this instead, once you had notion for carry in gcc for ppc:
    addc 3,3,4
    addze 3,3

the optimized loop would be an extra bonus



More information about the Gcc-bugs mailing list