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]

RE: config/h8300/h8300.md: Add a new peephole optimization.


Hi Michael,

> You might get better code by adding two separate patterns to 
> specifically add
> -1 and -2 then by using a peephole, which only works if the 
> two patterns are
> adjacent.  If you add separate patterns, the optimization is 
> handled earlier in
> the compilation.

Well, there is already a define_split that splits addition/subtraction of a
small integer constant into a sequence of increment/decrement of #1, #2, and
#4.  My peephole takes the last one and convert it into another version of
increment/decrement that sets cc0 so that we don't have to do "mov r0,r0"
just to see if the result is zero.

In case of a addition/subtraction of a large constant, regular add/sub.[bwl]
work well as they set cc0 properly.

Thanks,

Kazu Hirata

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