From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53733 invoked by alias); 25 Jan 2018 09:04:17 -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 53717 invoked by uid 89); 25 Jan 2018 09:04:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:Thu, 11.00, business X-HELO: mail-wm0-f51.google.com Received: from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Jan 2018 09:04:15 +0000 Received: by mail-wm0-f51.google.com with SMTP id b21so13459721wme.4 for ; Thu, 25 Jan 2018 01:04:14 -0800 (PST) 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=CO7gH9bs1To0mtywvwLLAUeE6vVQJbRV1Ri4VytK5YM=; b=esgGI6NM9mzriKHkvxNMYf9dXZudlJWZywQLGxVWP9+lKq4/sr8lUnWE78JodOKGTK UY8vExHUAzgd83VdVWqhTWDbOG9o5bs2cHvtG+P0NVKqZ8kIjmkkatpitNUZliyhNGaA 2b1EEoYqnkxdvE3X4Rik/wX9Tj8n+61fyEg5wV6XwcM2tIl29kCkZK5+7NWAnWgqtHLu hA+D1JvsEJfdmGJm48cXkWGin03sjgNsyALvKGhg5DPXlHrzvOoACTg7rTnmvnKHCP0j uenGK16UghILE6DynQf/YFH+TJPpVKvw31eEztihgd2lztyffiz6xGBYRl5wMB+D5F2a EViw== X-Gm-Message-State: AKwxytfyxgzsu1lEx8TF8ATfKkBX1BbnX9uy9OrdTep+ZPc6kzfbUp4P 0DjSvdsNIzsqlOe2QBJU1tnBYw/uyKbvi24gB6U= X-Google-Smtp-Source: AH8x226V1m5S8G05E+sn4HEKVLQ/zDmfgEYfXmG9CrqfnsZaondmvUsHB2NYGh6FAepmQl2l2bC5RlMnKArnRc36kAE= X-Received: by 10.80.180.18 with SMTP id b18mr28578499edh.260.1516871053026; Thu, 25 Jan 2018 01:04:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.224.135 with HTTP; Thu, 25 Jan 2018 01:04:12 -0800 (PST) In-Reply-To: References: From: Richard Biener Date: Thu, 25 Jan 2018 10:24:00 -0000 Message-ID: Subject: Re: [RFC][PR82479] missing popcount builtin detection To: Kugan Vivekanandarajah Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg02079.txt.bz2 On Wed, Jan 24, 2018 at 10:56 PM, Kugan Vivekanandarajah wrote: > Hi All, > > Here is a patch for popcount builtin detection similar to LLVM. I > would like to queue this for review for next stage 1. > > 1. This is done part of loop-distribution and effective for -O3 and above. > 2. This does not distribute loop to detect popcount (like > memcpy/memmove). I dont think that happens in practice. Please correct > me if I am wrong. But then it has no business inside loop distribution but instead is doing final value replacement, right? You are pattern-matching the whole loop after all. I think final value replacement would already do the correct thing if you teached number of iteration analysis that niter for [local count: 955630224]: # b_11 = PHI _1 = b_11 + -1; b_8 = _1 & b_11; if (b_8 != 0) goto ; [89.00%] else goto ; [11.00%] [local count: 850510900]: goto ; [100.00%] is related to popcount (b_5). Richard. > Bootstrapped and regression tested on aarch64-linux-gnu with no new regressions. > > Thanks, > Kugan > > gcc/ChangeLog: > > 2018-01-25 Kugan Vivekanandarajah > > PR middle-end/82479 > * tree-loop-distribution.c (handle_popcount): New. > (pass_loop_distribution::execute): Use handle_popcount. > > gcc/testsuite/ChangeLog: > > 2018-01-25 Kugan Vivekanandarajah > > PR middle-end/82479 > * gcc.dg/tree-ssa/popcount.c: New test.