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]
Other format: [Raw text]

Re: [PATCH, AARCH64] : Fix target/59744 - invalid use of CMN


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.


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