From patchwork Tue Jul 10 13:05:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 941984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-481292-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xrGlDTbS"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DYQbota9"; dkim-atps=neutral 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 41Q2X16pyZz9s00 for ; Tue, 10 Jul 2018 23:06:24 +1000 (AEST) 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:cc:content-type; q=dns; s=default; b=LvYeCOX8AXsI7SOk2ow1kd7N1v25ZD25sk/osBGZIk8 HAe7VucB60pIw9DJEQig0P7QwfbcG60nXMLfx4zBYbAd6kefvnzTxTQg9aeFho46 tq96vYQivAvnqVys5XAYB81LgvcZRI9R5VHmWrqwK+ZR6yz4Xrb6CEQ4vzsFQxjU = 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:cc:content-type; s=default; bh=OTM1ekeLmziBCTq5DINNZCT3vxU=; b=xrGlDTbSxfFrq4+8F cKJl4z83j9DEpO9Xw9gN9VZ2vhe6TYxyFg7EoYP3Uyr6/axkprXM5BDJx3Ge4rDv bVOvLv9SpP3O1nDpUUtFSIHnkMOnPwwM9l9K6AKYA10GdeC9mZ9gk8nsLeWub2SE nsKlXyBvldh+ee2r00REtzEdMU= Received: (qmail 42471 invoked by alias); 10 Jul 2018 13:06:17 -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 42459 invoked by uid 89); 10 Jul 2018 13:06:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.5 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=HX-Gm-Message-State:APt69E3, UD:tree-ssa-loop-niter.c X-HELO: mail-lf0-f48.google.com Received: from mail-lf0-f48.google.com (HELO mail-lf0-f48.google.com) (209.85.215.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jul 2018 13:06:15 +0000 Received: by mail-lf0-f48.google.com with SMTP id l16-v6so18228579lfc.13 for ; Tue, 10 Jul 2018 06:06:14 -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:cc; bh=hzA1DjI/CWZYgwFoSA6HAaOkfUkSh/KRgrtKtPnGbrE=; b=DYQbota93uheSV/czrdRUkH7BMNn6n0AtbIxur/WGT9efW3NSBYScDvoJHvw4HZGWR SySZ8gml72UY03ZK1S4UzhdMI/BWtJ6elYRNHboYgndLsgRtiFJea4oXhYzM4AXUiO2r T6noQqQVDpypN3ZsNxVF4m6T4Q0a/A2x/+LJ4= MIME-Version: 1.0 Received: by 2002:a2e:48b:0:0:0:0:0 with HTTP; Tue, 10 Jul 2018 06:05:31 -0700 (PDT) From: Kugan Vivekanandarajah Date: Tue, 10 Jul 2018 23:05:31 +1000 Message-ID: Subject: [RFC] Fix recent popcount change is breaking To: GCC Patches Cc: Jeff Law X-IsSubscribed: yes Hi, Jeff told me that the recent popcount built-in detection is causing kernel build issues as ERROR: "__popcountsi2" [drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined! I could also reproduce this. AFIK, we should check if the libfunc is defined while checking popcount? I am testing the attached RFC patch. Is this reasonable? Thanks, Kugan gcc/ChangeLog: 2018-07-10 Kugan Vivekanandarajah * tree-ssa-loop-niter.c (number_of_iterations_popcount): Check if libfunc for popcount is available. diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index f6fa2f7..2e2b9c6 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "backend.h" +#include "target.h" #include "rtl.h" #include "tree.h" #include "gimple.h" @@ -42,6 +43,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-chrec.h" #include "tree-scalar-evolution.h" #include "params.h" +#include "optabs-libfuncs.h" #include "tree-dfa.h" @@ -2570,6 +2572,10 @@ number_of_iterations_popcount (loop_p loop, edge exit, (long_long_integer_type_node)) fn = builtin_decl_implicit (BUILT_IN_POPCOUNTLL); + /* Check if libfunc for popcount is available. */ + if (!optab_libfunc (popcount_optab, + TYPE_MODE (TREE_TYPE (src)))) + return false; /* ??? Support promoting char/short to int. */ if (!fn) return false;