From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59799 invoked by alias); 3 Aug 2015 07:34:15 -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 59765 invoked by uid 89); 3 Aug 2015 07:34:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f180.google.com Received: from mail-ig0-f180.google.com (HELO mail-ig0-f180.google.com) (209.85.213.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 03 Aug 2015 07:34:13 +0000 Received: by igr7 with SMTP id 7so49199778igr.0 for ; Mon, 03 Aug 2015 00:34:10 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.8.39 with SMTP id o7mr19540031iga.23.1438587250837; Mon, 03 Aug 2015 00:34:10 -0700 (PDT) Received: by 10.107.32.140 with HTTP; Mon, 3 Aug 2015 00:34:10 -0700 (PDT) In-Reply-To: <55BBBE2E.1020408@redhat.com> References: <55B5A884.4060105@linaro.org> <55B65A4B.3050705@redhat.com> <55BBA052.2060900@redhat.com> <55BBBBE6.2070207@linaro.org> <55BBBE2E.1020408@redhat.com> Date: Mon, 03 Aug 2015 07:34:00 -0000 Message-ID: Subject: Re: [PATCH] Optimize certain end of loop conditions into min/max operation From: Richard Biener To: Jeff Law Cc: Michael Collison , gcc Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00025.txt.bz2 On Fri, Jul 31, 2015 at 8:27 PM, Jeff Law wrote: > On 07/31/2015 12:18 PM, Michael Collison wrote: >> >> Hi Jeff, >> >> Yes I will create a test case. I'm not quite sure what to check for even >> in the machine dependent test case. It's quite possible for the >> instructions that are generated to change over time. > > I think we're going to want to look at the gimple IR and search for the > MIN/MAX expressions rather than the instructions. Given we don't know where > the transformation is going to land (yet), you can probably start with > -fdump-tree-optimized and scanning the .optimized dump. Yeah. FWIW I'm ok with the specialized pattern in match.pd. Indeed phiopt isn't a good fit here (though on some targets you may end up seeing a PHI node, dependent on LOGICAL_OP_NON_SHORT_CIRCUIT). For longer chains I'd say reassoc is the appropriate place to handle this as it has already code to combine &&s and ||s of conditions. Maybe you can give it a short try to only handle it there. I'm also somewhat worried about code-generation on random targets. So can you have a quick look (just for your testcase) what the code-gen difference is on primary platforms (just build some stage1 cc1s)? Thanks, Richard. > We can still do that and have the test be target specific. > > jeff >