From patchwork Mon Nov 21 16:08:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 83264 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp1616508obn; Mon, 21 Nov 2016 08:08:33 -0800 (PST) X-Received: by 10.129.40.7 with SMTP id o7mr16167501ywo.185.1479744513274; Mon, 21 Nov 2016 08:08:33 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g67si4929240ywh.457.2016.11.21.08.08.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Nov 2016 08:08:33 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-442149-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; spf=pass (google.com: domain of gcc-patches-return-442149-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-442149-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=npdzZmeKSpzHuRpPwgLeobsaBgLluvPKumnoL9IQjHMtfzObmU 6LejZhZBEQKhC/jKgNf+i+PYo/hcM5sUUcLYHKoAnqDTxe3f4XXRNgx0p51U1Cu3 xT0wOON6uIy5E4o8x2Si8fdqHW+xvwhJIZPCNeTlIy+S3DPBiinouHykY= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=HDBICopwyN8WS3xNcPemsaO4THY=; b=OZAk1nTzGrAIJvZkaThm Vnf43WdGF/+wGNV2i4bzfVzv6lfgEHGj+DbP2D/BkcmoP7DoV113Fdm9PNkAeg9f 0uDxt2GQuLWUn7xm4oDYJKFBMT8080+QybNNki1MmgiNItBsugKKt9yPyeDcnC7t nfDLzuw9V+GOB2f3b5civng= Received: (qmail 95005 invoked by alias); 21 Nov 2016 16:08:20 -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 94963 invoked by uid 89); 21 Nov 2016 16:08:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=uintval, UINTVAL, Hx-languages-length:1577, sk:simplif X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.216) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Nov 2016 16:08:09 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwR/bcHRirORRW3yMcVao= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (mail.hightec-rt.com [213.135.1.215]) by smtp.strato.de (RZmta 39.9 DYNA|AUTH) with ESMTPSA id Z04d2bsALG864R2 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 21 Nov 2016 17:08:06 +0100 (CET) To: gcc-patches Cc: Denis Chertykov From: Georg-Johann Lay Subject: [patch,avr,committed] Use popcount_hwi instead of home-brew code. Message-ID: <387cc145-df21-089d-0a13-5d907c5f0db2@gjlay.de> Date: Mon, 21 Nov 2016 17:08:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes http://gcc.gnu.org/r242670 Committed as obvious code clean-up. Johann gcc/ * config/avr/avr.c (avr_popcount): Remove static function. (avr_popcount_each_byte, avr_out_bitop): Use popcount_hwi instead. Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 242660) +++ config/avr/avr.c (working copy) @@ -243,23 +243,6 @@ avr_tolower (char *lo, const char *up) } -/* Custom function to count number of set bits. */ - -static inline int -avr_popcount (unsigned int val) -{ - int pop = 0; - - while (val) - { - val &= val-1; - pop++; - } - - return pop; -} - - /* Constraint helper function. XVAL is a CONST_INT or a CONST_DOUBLE. Return true if the least significant N_BYTES bytes of XVAL all have a popcount in POP_MASK and false, otherwise. POP_MASK represents a subset @@ -280,7 +263,7 @@ avr_popcount_each_byte (rtx xval, int n_ rtx xval8 = simplify_gen_subreg (QImode, xval, mode, i); unsigned int val8 = UINTVAL (xval8) & GET_MODE_MASK (QImode); - if (0 == (pop_mask & (1 << avr_popcount (val8)))) + if (0 == (pop_mask & (1 << popcount_hwi (val8)))) return false; } @@ -8135,7 +8118,7 @@ avr_out_bitop (rtx insn, rtx *xop, int * unsigned int val8 = UINTVAL (xval8) & GET_MODE_MASK (QImode); /* Number of bits set in the current byte of the constant. */ - int pop8 = avr_popcount (val8); + int pop8 = popcount_hwi (val8); /* Registers R16..R31 can operate with immediate. */ bool ld_reg_p = test_hard_reg_class (LD_REGS, reg8);