From patchwork Mon Jul 20 14:28:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 497751 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7D3AC140778 for ; Tue, 21 Jul 2015 00:28:19 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Z8zhu/no; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=ggriiqkDPjPuWgUC99OKIn8IuTIyy5sql02NwA6MLEb wgkOHKFoggSx6yi6uaVOwFqKIjoIUsRI2bL2zAH03HBKGgbw3k74Xc3m7IUwvh9L 704qOq0TfldktXm8Cr0R1qC4MIdSR62R3R5opKgjGZ1uwsWjfI9YTxy8HB3+Fy+Y = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=a3XcZAAUHqOUzO8eCtK4jQMZbpQ=; b=Z8zhu/noTA/FMx+li IySYflGe+Dq2JkFEhp57IVwlnN4mRWUtUaAN+hrzLexli8I2GIAasqSwcBPGoOAG XFW+9fq7gkBy+kZBdyqit+gS71H3tOTeRMmTLS07cccGOLdGvX2VOnFuc9K63Zhh 4bAlRKezsAgsWzxNxakwMZZckE= Received: (qmail 62088 invoked by alias); 20 Jul 2015 14:28:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 62033 invoked by uid 89); 20 Jul 2015 14:28:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Jul 2015 14:28:08 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-26-DfTeUis0SSWqICx4GcZTVQ-1; Mon, 20 Jul 2015 15:28:03 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Jul 2015 15:28:02 +0100 Message-ID: <55AD0572.3010200@arm.com> Date: Mon, 20 Jul 2015 15:28:02 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches CC: Richard Biener Subject: [PATCH][match.pd] PR middle-end/66915 Restrict A - B -> A + (-B) to non-fixed-point types X-MC-Unique: DfTeUis0SSWqICx4GcZTVQ-1 X-IsSubscribed: yes 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 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 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.