This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH][ARM][combine] Improve opportunities to generate cmn instructions
- From: Jeff Law <law at redhat dot com>
- To: Kyrylo Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>, ebotcazou at libertysurf dot fr
- Date: Thu, 25 Jul 2013 12:07:12 -0600
- Subject: Re: [PATCH][ARM][combine] Improve opportunities to generate cmn instructions
- References: <001d01ce8951$e5f9e940$b1edbbc0$ at firstname.lastname@example.org>
On 07/25/2013 10:13 AM, Kyrylo Tkachov wrote:
Currently on arm we miss some opportunities to generate the cmn instruction
(cmn r1, r2 ~ r1 + r2 == 0)
For example, for code:
int foo (int x, int y)
if (x + y == 0)
add r0, r0, r1
cmp r0, #0
movne r0, #5
moveq r0, #25
This could be improved. During investigation I noticed that combine tries to
transform x + y == 0 into x == -y, in RTL form: (eq (x) (neg y)) which is not
the canonical form and therefore doesn't get matched by a pattern we have that
would have produced a cmn instruction. Adding a re-canonicalization step in
simplify_comparison fixes that and allows us to match the correct patterns.
A new splitter is also added to arm that will allow us to produce forms
appropriate for cmn when doing comparisons other than == in the case given
Bootstrapped on arm-linux-gnueabihf and x86_64-linux-gnu. Regtested on
arm-none-eabi on qemu.
Ok for trunk?
2013-07-25 Kyrylo Tkachov <email@example.com>
Richard Earnshaw <firstname.lastname@example.org>
* combine.c (simplify_comparison): Re-canonicalize operands
The combine part is fine. Please install.