From patchwork Thu Jun 28 00:25:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 140381 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1529493ljj; Wed, 27 Jun 2018 17:26:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc8R4+LDvUCJmK/vppoHv3jZzGz2valPJVXM+dcNX5KqcAx5PXm8wL9w9btXY5m2kWJwiMr X-Received: by 2002:a62:c819:: with SMTP id z25-v6mr7231654pff.44.1530145615119; Wed, 27 Jun 2018 17:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530145615; cv=none; d=google.com; s=arc-20160816; b=xE9mX0ysg7adoKNGo0HfwXd/EsAwilnBQ9joO8LMZIBacoXW/R9S9t5tzhIAazQYSm uboUees4dwBG+5BGE0rXYsCbFDeRHfBRoNAtESfZztQtYbMA6vVdpCyUxPgkttfFBjhS OuA9BCUiIri4YnoTvjE63tIFDRfwtcg2N+9oyK17CHuzz2SsCvDfDd8lXRCV21qDxsZh NL2DRwJccYBDVJW3a5WWsPFbOvO9vBco8nBgIRgwafBjHyCQc3O7hWx8UPKfVQkU/LIF dCL2AQz0/yNrzbgR+hakoLeQd3D8m/53HdVtYDXS3MjJdtmB4UsZyVNvBHYzosdbW2hH EAdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature :delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=4vVAMCToBkbT2YpbXe4e08JN6R27VJWv2dz6EaJ03x0=; b=VC1QY0rSVUkVc7Cs91CF9DvpcFbgUgmS9t+cnvZPzsN+0mk2wHR1FAqTd9ru6N70Re 8A9vGApOXBgVR+5BrK6bGG6AgHekEMbg6V6g7XXXkYXWdjZV3Q4rNGIT/JNW0CxZ8Jm/ TYgGkCrHrM8U39PT6+nB/6RmBdSboNWMV49VRc5glGPa4gBXwKtm9XCNHhVoi/2nGye8 sQuxluGxoc8r28uucth6H7zwbAn0wN0XDzrBzWnDV29/Jk6w9e60dCrDihnWVrt95+dr GcljtMDmQ+LslJw3dUrDWac+ASZME/RLw+1ioov00ZJeqpBvY6TRCTxm8QAzuQKLBKtT KgWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Rjv5TUEs; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MBLlKFmV; spf=pass (google.com: domain of gcc-patches-return-480614-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-480614-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id p185-v6si1827147pga.476.2018.06.27.17.26.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 17:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-480614-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Rjv5TUEs; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MBLlKFmV; spf=pass (google.com: domain of gcc-patches-return-480614-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-480614-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=c+OweZah154K6TCFgNY7MyYfgXPhBXpUL+qXv97/Dahcwe zVxDeH2I4iTy5Mg2de3KzXSa6+8rPhxVNczB3TQaAZB5XDOtj3YVgZqMh41UC3hZ V/IIoDDCsyUOGz2V/0Ajo3O8UehVGWvkUrPeQF22H918kW43d1MWVRG8mDems= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=cXT+yzt5BhR05q1DeyN2sHRwOSQ=; b=Rjv5TUEsM4Ck9KBzi367 zkxsI6OCeX1/VP7MuP4Y1zjKZyrs87kS0KXzEqqeggS2DQa73U5TRa6jtQLCcFKg EFwUqfdFt++Cf9Un6Fn+rqjgjdULMLYuuevlVNp3I7hnfiyVQ3F9Aaa5ToDSHr0o btmc1iz/ylvl+4ZEUYjzHdU= Received: (qmail 109493 invoked by alias); 28 Jun 2018 00:26:43 -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 109478 invoked by uid 89); 28 Jun 2018 00:26:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:t22-v6s X-HELO: mail-lj1-f176.google.com Received: from mail-lj1-f176.google.com (HELO mail-lj1-f176.google.com) (209.85.208.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Jun 2018 00:26:41 +0000 Received: by mail-lj1-f176.google.com with SMTP id t22-v6so3007470ljc.11 for ; Wed, 27 Jun 2018 17:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=q1xsPK7MNWh0emFFZpIqS0BVJ8Kulsgk4rGwUARu2UM=; b=MBLlKFmVQ8hAwy/UGJoVP1piKo/CiPe8o2oXMBbHVuzmPW0x54socXrQ1vvJyUGU8I 28ukSg9T5D4t5erxctAqC9UA2oqt8FKezTbcAEci807IItZhZNnPD/j9JCY/lvYLnAam 7cUdXTk68tCtyyTXlVhCi6QZj+b9WfzpJctl4= MIME-Version: 1.0 Received: by 2002:a2e:6c02:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 17:25:58 -0700 (PDT) From: Kugan Vivekanandarajah Date: Thu, 28 Jun 2018 10:25:58 +1000 Message-ID: Subject: [ABSU_EXPR] Add some of the missing patterns in match,pd To: GCC Patches X-IsSubscribed: yes Hi, This patch adds some of the missing patterns in match.pd for ABSU_EXPR. Bootstrap and regression testing on x86_64-linux-gnu. Is this OK if no regressions. Thanks, Kugan gcc/ChangeLog: 2018-06-28 Kugan Vivekanandarajah * match.pd (absu(x)*absu(x) -> x*x): Handle. (absu(absu(X)) -> absu(X)): Likewise. (absu(-X) -> absu(X)): Likewise. (absu(X) where X is nonnegative -> X): Likewise. >From 374ee7928039c16cb091bd02d5efd4c493aab86e Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Mon, 18 Jun 2018 10:51:06 +1000 Subject: [PATCH] add absu patterns Change-Id: Ied504be83f00041a6c815d23e16a394b71445f27 --- gcc/match.pd | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index c1e0963..a356a92 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -571,10 +571,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (copysigns (op @0) @1) (copysigns @0 @1)))) -/* abs(x)*abs(x) -> x*x. Should be valid for all types. */ -(simplify - (mult (abs@1 @0) @1) - (mult @0 @0)) +/* abs(x)*abs(x) -> x*x. Should be valid for all types. + also for absu(x)*absu(x) -> x*x. */ +(for op (abs absu) + (simplify + (mult (op@1 @0) @1) + (mult @0 @0))) /* cos(copysign(x, y)) -> cos(x). Similarly for cosh. */ (for coss (COS COSH) @@ -1013,15 +1015,24 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && tree_nop_conversion_p (type, TREE_TYPE (@2))) (bit_xor (convert @1) (convert @2)))) -(simplify - (abs (abs@1 @0)) - @1) -(simplify - (abs (negate @0)) - (abs @0)) -(simplify - (abs tree_expr_nonnegative_p@0) - @0) +/* Convert abs (abs (X)) into abs (X). + also absu (absu (X)) into absu (X). */ +(for op (abs absu) + (simplify + (op (op@1 @0)) + @1)) + +/* Convert abs[u] (-X) -> abs[u] (X). */ +(for op (abs absu) + (simplify + (op (negate @0)) + (op @0))) + +/* Convert abs[u] (X) where X is nonnegative -> (X). */ +(for op (abs absu) + (simplify + (op tree_expr_nonnegative_p@0) + @0)) /* A few cases of fold-const.c negate_expr_p predicate. */ (match negate_expr_p -- 2.7.4