Hi all,

This patch fixes the PR in question which is a miscompilation of 
gcc.dg/fixed-point/unary.c on arm.
It just restricts the A - B -> A + (-B) transformation when the type is 
fixed-point.

This fixes the testcase for me.
Is this the right approach?

Bootstrap and test on arm and x86 running.

Ok if testing is clean?

Thanks,
Kyrill


2015-07-20  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

    PR middle-end/66915
    * match.pd (A - B -> A + (-B)): Don't allow folding
    when type if a fixed-point type.
commit c6669b5cde3d7b504aec388282e7af955af58681
Author: Kyrylo Tkachov <kyrylo.tkac...@arm.com>
Date:   Mon Jul 20 15:02:17 2015 +0100

    [match.pd] PR middle-end/66915 Restrict A - B -> A + (-B) to non-fixed-point types

diff --git a/gcc/match.pd b/gcc/match.pd
index 4427000..3d7b32e 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -522,8 +522,8 @@ along with GCC; see the file COPYING3.  If not see
 /* A - B -> A + (-B) if B is easily negatable.  */
 (simplify
  (minus @0 negate_expr_p@1)
- (plus @0 (negate @1)))
-
+ (if (!FIXED_POINT_TYPE_P (type))
+ (plus @0 (negate @1))))
 
 /* Try to fold (type) X op CST -> (type) (X op ((type-x) CST))
    when profitable.

Reply via email to