From patchwork Thu Apr 6 11:24:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 747712 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 3vzL3S6rh3z9s8N for ; Thu, 6 Apr 2017 21:25:08 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RQxyXl9V"; 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:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; q=dns; s=default; b=Uw4t8FE9k/lHPLVn SzfjHuaHwpkXKiAG+q1N1/OI1ku2sVOB2lhguHFy2UQG+dkxSKC+LNGdDEy8uekA m2kOikUFWnZBbxdORpN/XmRm0B37EO+vB2tU8G1eyYvKYejoIMmnQfJtura7wFs8 DQt5MQgKnV1RsqCCDoDUEaoEcfM= 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:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; s=default; bh=iDX6AGaB4JQgn2vblydGVq 3l8Xg=; b=RQxyXl9VTFtFMhlsXDe7bIJtZoct0LXsCEc6/a15zz7Ih0M+GOWhi4 elrGWo/C//NfvnsW9MiUSyTAWh4e72i6MLVvKcB08PQBMC5rxmhshK1HckL+v3JU dLqzj0zdQD8ZfunbpQazwhGWGunsNoLNBSScCmUOGXdvdvXQRQejo= Received: (qmail 40839 invoked by alias); 6 Apr 2017 11:24:54 -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 40820 invoked by uid 89); 6 Apr 2017 11:24:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2617 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Apr 2017 11:24:51 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F2453ACEE; Thu, 6 Apr 2017 11:24:50 +0000 (UTC) Date: Thu, 6 Apr 2017 13:24:50 +0200 (CEST) From: Richard Biener To: Christophe Lyon cc: "Bin.Cheng" , Markus Trippelsdorf , gcc-patches List Subject: Re: [PATCH] Fix PR80281 In-Reply-To: Message-ID: References: <20170405113803.GA25481@x4> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 On Wed, 5 Apr 2017, Christophe Lyon wrote: > On 5 April 2017 at 13:41, Bin.Cheng wrote: > > On Wed, Apr 5, 2017 at 12:38 PM, Markus Trippelsdorf > > wrote: > >> On 2017.04.03 at 15:20 +0200, Richard Biener wrote: > >>> I'm re-testing the following variant. > >>> > >>> Richard. > >>> > >>> 2017-04-03 Richard Biener > >>> > >>> PR middle-end/80281 > >>> * match.pd (A + (-B) -> A - B): Make sure to preserve unsigned > >>> arithmetic done for the negate or the plus. Simplify. > >>> (A - (-B) -> A + B): Likewise. > >>> * fold-const.c (split_tree): Make sure to not negate pointers. > >>> > >>> * gcc.dg/torture/pr80281.c: New testcase. > >> > >> gcc.dg/tree-ssa/pr40921.c started to fail with -march=skylake: > >> > >> % gcc -march=skylake -c -O2 -fdump-tree-optimized -ffast-math -c gcc.dg/tree-ssa/pr40921.c > >> % cat pr40921.i.227t.optimized | grep "\-y" > >> _3 = -y_4(D); > > Also on AArch64. > > > > And on some arm configurations, if that's easier to reproduce: > * -mthumb/-march=armv8-a/-mfpu=crypto-neon-fp-armv8/-mfloat-abi=hard > * --with-cpu=cortex-a15 --with-fpu=neon-vfpv4 > * --with-cpu=cortex-a57 --with-fpu=crypto-neon-fp-armv8 These are all spurious -- when you allow FMAs to be detected there'll be an unary minus but which SSA name is negated depends on SSA name allocation. It's somewhat hard to fortify the testcase against the FMA case so the following simply turns off FMA detection. Tested on x86_64-unknown-linux-gnu, applied. Richard. 2017-04-06 Richard Biener PR middle-end/80281 * gcc.dg/tree-ssa/pr40921.c: Add -fp-contract=off. Index: gcc/testsuite/gcc.dg/tree-ssa/pr40921.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/pr40921.c (revision 246725) +++ gcc/testsuite/gcc.dg/tree-ssa/pr40921.c (working copy) @@ -1,26 +1,24 @@ - /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized -ffast-math" } */ +/* { dg-options "-O2 -fdump-tree-optimized -ffast-math -ffp-contract=off" } */ unsigned int foo (unsigned int x, unsigned int y, unsigned int z) { - return x + (-y * z * z); + return x + (-y * z * z); } float bar (float x, float y, float z) { - return x + (-y * z * z); + return x + (-y * z * z); } float bar2 (float x, float y, float z) { - return x + (-y * z * z * 5.0f); + return x + (-y * z * z * 5.0f); } float bar3 (float x, float y, float z) { - return x + (-y * x * -z); + return x + (-y * x * -z); } - /* { dg-final { scan-tree-dump-times "_* = -y_" 0 "optimized" } } */