From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74707 invoked by alias); 15 Aug 2017 14:08:07 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 74433 invoked by uid 89); 15 Aug 2017 14:07:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-wm0-f67.google.com Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Aug 2017 14:07:43 +0000 Received: by mail-wm0-f67.google.com with SMTP id r77so1589348wmd.2 for ; Tue, 15 Aug 2017 07:07:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IrknG6Za0Ght1v3x3UnNi/WcXO8FyD2UnGhVJ4+nrpw=; b=j/UbE5iome4V0vzSv3jAzDm5uVitU+tLB5U6N1cvtNE6ttEkkFd4xYzgSqZBJn/CC4 +D8o5efOq3S6ZyIUdeAGyTUt05f5GnW8bcg5IAaU4sGqTjl8fMxnUC0Frb0YtUxe7aiR zTxcCGBZz9yY61eyY3+NEfjD5fsBDz5o9zYJldUym1bSc13zoARvpt9wyxFoxDLPO9Fq dr+RoDc0UuSe3U5dd9oOxyDIEnG/LiuVRB6Jj9zTxW8yGnghrRAaDq5xjqQwx2j9fGkv Iu3O07folRe4FhRMD2XQymJkd1rxHMLy9TQ6baWH8zVSoWsuLgf0RngLVT76WFcSt7WI 4r1g== X-Gm-Message-State: AHYfb5gBNdYTW8RalozOv0uCoHVNyFqRCNB+Bpdk8uGarASPcVt14uTX uJqdLuZm+OcbN27SYn+s/AeMBJANWA== X-Received: by 10.80.194.146 with SMTP id o18mr15273667edf.197.1502806061497; Tue, 15 Aug 2017 07:07:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.180.249 with HTTP; Tue, 15 Aug 2017 07:07:41 -0700 (PDT) In-Reply-To: References: From: Richard Biener Date: Tue, 15 Aug 2017 14:22:00 -0000 Message-ID: Subject: Re: [PATCH] Factor out division by squares and remove division around comparisons (2/2) To: Jackson Woodruff Cc: wilco.dijkstra@arm.com, kyrylo.tkachov@foss.arm.com, "Joseph S. Myers" , GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00942.txt.bz2 On Thu, Aug 10, 2017 at 4:10 PM, Jackson Woodruff wrote: > Hi all, > > The patch implements the some of the division optimizations discussed in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026 . > > We now reassociate (as discussed in the bug report): > > x / (y * y) -> x * (1 / y) * (1 / y) > > If it is reasonable to do so. This is done with > -funsafe-math-optimizations. > > Bootstrapped and regtested with part (1/2). OK for trunk? I believe your enhancement shows the inherent weakness of CSE of reciprocals in that it works from the defs. It will handle x / (y * y) but not x / (y * y * y). I think a rewrite of this mini-pass is warranted. Richard. > Jackson > > gcc/ > > 2017-08-03 Jackson Woodruff > > PR 71026/tree-optimization > * tree-ssa-math-opts (is_division_by_square, > is_square_of, insert_sqaure_reciprocals): New. > (insert_reciprocals): Change to insert reciprocals > before a division by a square. > (execute_cse_reciprocals_1): Change to consider > division by a square. > > > gcc/testsuite > > 2017-08-03 Jackson Woodruff > > PR 71026/tree-optimization > * gcc.dg/associate_division_1.c: New. >