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: 697307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3tMtn83xQtz9t0G for ; Tue, 22 Nov 2016 03:08:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Ij7TI7tR"; dkim-atps=neutral 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=OMe6Yq6Vi8F/z3E827hiWEghWwpIJIlhJro0w5xSMKxXwZ+aJO Z+KaoEA4yI7bEJfn2c/PILBpZUcBXKdx2CtzSfJXC0CJeYVV0BKd8R7FQtc8FZxS AM4mAbnerbfM6MZW8rnFyxPB9zdKclnnoi+toMJJFMt2aUWmxSee2pkak= 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=Ij7TI7tR4zy+cf1kRfug 2NRGyBQYyXg5Myl2sZ9yU0xnPe6BnY7pFqsCEV4ekDvIGjbBMywmIDIMn5H69y2k 0AfORBbA7BaHISeL4WIDJ4rdF8X5qd6Me8Qe270MnsliZKVaKzqdJ1zEt2ZCaDqM 4Z198//ccdJUjwcWBiEei/k= 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);