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: Richard Earnshaw <rearnsha at arm dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 10 Jan 2014 17:38:59 +0000
- 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> <CA+=Sn1nbP4U_yojRzX0tARfzWXBbmWs3zu8XZs+iXFs5pyo+EQ at mail dot gmail dot com>
On 10/01/14 17:37, Andrew Pinski wrote:
> 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.
>
Why?
R.
> 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.
>