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: 141511 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3861477ljj; Tue, 10 Jul 2018 06:06:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe7hvVhPF0iG/TXC1RjZ0rgiXZIAUqFfRSAU+hbDSpI4FJ7F/Q5ec8fewb6L/xpVQr5gU0g X-Received: by 2002:a63:551e:: with SMTP id j30-v6mr21938222pgb.92.1531227989315; Tue, 10 Jul 2018 06:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531227989; cv=none; d=google.com; s=arc-20160816; b=f+8Qqn6UCykXmh8U26Wz5uTTfuJl7CpXpmWPoNxchnX1D1H2Jlkh9SkixZXxobMOP1 P1+Cm2faQqjMGeH2sCq5F2m5Dv2PhlcrdfrV22+flzDIAtpXr/uanYjpCV40nOkUV/RJ fGETzlfdZOG/DnxGlLY4qTGI5Q6+BrYQ6PsZEVT309SOgvscnrmNSBQebTKc//968NO5 l4M1TriO0EwbgL8Rsg1RVTZeS66tGzfkdsZzDJIuxlHZ6yR5QypJKONn8AphJi6VDZDZ +jzbi8oDHUYyL45Ot4MfFPzvJyPD3EbfokLcCg2D0V7YqdpjbSFPua9v8EcyIS8wxkq9 q7qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc: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=6J43FEFIzSYhGKdqUNcX8B14TgAZWddtbBggRI8sOno=; b=qMMqRfyXt9ryGcRkY+p68lux2m5N1pkOX9/2xj/FzdovelHIFZ/rskYX9G4u10UyjX gesekqqCfu82/uGQ8jsIdIC5X3tXqobu7DQ+T9fJqaTYokcjqVjmv7elYQ/a94rZ1tyb ZaIa9aiZ2UvOTZ0WL7n7ExnrFqAca5u1sekYUMckkcDkg4azVNJG/CZQSJZnhUjqBbtF nVknzG10oaCmyxMY5jCr6Viar8U9wkMy0YKwINdLRcAzDQzlZRjQ5zpg6eIt70d2LDGB kLnwWw7K8EHdhMbCT9M9JXPcrN08k29G/SLNdbzIGKw9EbrMjD6MGQ5X13cLcxNyyPcT i+5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=V8XS6xiW; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DYQbota9; spf=pass (google.com: domain of gcc-patches-return-481292-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-481292-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 f18-v6si15810867pgd.16.2018.07.10.06.06.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 06:06:29 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-481292-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=V8XS6xiW; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DYQbota9; spf=pass (google.com: domain of gcc-patches-return-481292-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-481292-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:cc:content-type; q=dns; s=default; b=t2mJBDU8eX0KKlxZd4ievTQ5E50u5eZyeDfEegIffph OQ1ViDKlsVTSg2gjZ2638Pnb9Hwq/4tYdLI0Bpye4cQS2fpEvdz8+vb3voFqIwUj shWOAfbdcRXPaKbwEoc19pp1wGfGEx15CyCM9t5KX0a+bFDF/JK2WacaNjcLPGHU = 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=V8XS6xiWlAgHuMmIJ jtA6c1i2SX0o2pUJn9U5rXTiC0m99G8+9o24oAIz2ywfkNuMFzluskzXP551rRl4 sr13tywKuLTovOqFWnZ/NkoD12runtIlye3lfnWn8GBwwznczcJ3GqPjAzACFmR2 pYSS3WfGJoDtL0Z18G1Y0Rp2dQ= 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;