This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, AARCH64] : Fix target/59744 - invalid use of CMN
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Richard Earnshaw <rearnsha at arm dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 10 Jan 2014 09:37:47 -0800
- Subject: Re: [PATCH, AARCH64] : Fix target/59744 - invalid use of CMN
- Authentication-results: sourceware.org; auth=none
- References: <52D00E39 dot 5040107 at arm dot com>
On Fri, Jan 10, 2014 at 7:14 AM, Richard Earnshaw <rearnsha@arm.com> wrote:
> It's incorrect to use CMN to compare with a negated operand if the
> following condition is an inequality. This is because of boundary
> conditions when the negated operations overflow (or when zero), since
> the flags are then not the swapped version of the comparison.
I think the functions in the testcase need noclone attribute also.
Thanks,
Andrew
>
> This patch restricts the pattern to CC_Zmode (a new mode for the
> comparison flags).
>
> gcc:
> PR target/59744
> * aarch64-modes.def (CC_Zmode): New flags mode.
> * aarch64.c (aarch64_select_cc_mode): Only allow NEG when the
> condition represents an equality.
> (aarch64_get_condition_code0): Handle CC_Zmode.
> * aarch64.md (compare_neg<mode>): Restrict to equality
> operations.
>
> testsuite:
> PR target/59744
> * gcc.target/aarch64/cmn-neg.c: Use equality comparisons.
> * gcc.target/aarch64/cmn-neg2.c: New test.
>
> Committed to trunk.
>
> R.