On Fri, Jan 10, 2014 at 9:38 AM, Richard Earnshaw <rearn...@arm.com> wrote: > On 10/01/14 17:37, Andrew Pinski wrote: >> On Fri, Jan 10, 2014 at 7:14 AM, Richard Earnshaw <rearn...@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?
Because the functions could be cloned for IPA constant propagation as the argument for the functions are constants. Thanks, Andrew Pinski > > 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. >> > >