This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: config/h8300/h8300.md: Add a new peephole optimization.
- To: gcc-patches at gcc dot gnu dot org
- Subject: RE: config/h8300/h8300.md: Add a new peephole optimization.
- From: Kazu Hirata <kazu at hxi dot com>
- Date: Fri, 14 Jul 2000 17:20:08 -0400
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