From patchwork Tue May 7 14:31:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 1932510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gjlay.de header.i=@gjlay.de header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=LiUWB71L; dkim=pass header.d=gjlay.de header.i=@gjlay.de header.a=ed25519-sha256 header.s=strato-dkim-0003 header.b=FkV47Icl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYghJ4SNbz1xnT for ; Wed, 8 May 2024 00:31:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C7A95384DD00 for ; Tue, 7 May 2024 14:31:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.25]) by sourceware.org (Postfix) with ESMTPS id A82193858D1E for ; Tue, 7 May 2024 14:31:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A82193858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gjlay.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gjlay.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A82193858D1E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=85.215.255.25 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1715092285; cv=pass; b=jbncaG22MdtEfquPTP16wE7F/lALG699/6BL3tKWBcP6PhKnTu+L+VcknFX+3AsRXKqxu1UtHa2dC6380xGvGnepjgKQFbX9wLU/+qZQNbby6nsAVFjqMHIp4WQ06nmyhLARofKVoqXwOYKJDt8oHionn3X1OF8pOxjN2TQ5oZs= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1715092285; c=relaxed/simple; bh=PQNABqp+iyy3TrSip9YxvqLTQOd2Uz5Fo5KhcA/aHMY=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: To:Subject; b=Tl4c+7WYaGL4P2YdWYgOgQLAEjN69KWzac8H4MLJXk3E93gR6B19n7RKvaa1KJGghCJeorbgy11OCkFD/rEAAN6WdpcBGyaP4/tIRKr4KuQFZNpfffd/hw5fMEmd8yiWFaiB3RhJWFuFoyKpgrOM2dm8SbkEXeb7dAuZ8ljYpns= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1715092282; cv=none; d=strato.com; s=strato-dkim-0002; b=pLh9BMnYqpbORgkaZCZU1XEy66vRf4fzyioL7eXPf8VDt80z6WijMIK6mnTS6mWs/Q PB2Ubi/8rPQAg7dvIaC9kElK4rqew/w3M1WN1tizTEgNROfo84Z1kxWLILymZKr2KXqU PC2g9Ilxt62naqPhIuFpQ9e6QojSZS3YEngGHzMznLq2O1y7qcytBwetOJ761HIlUMQJ H1HjDLt4ci6ze87iQEwxL7qoDLh23KYCIkw5T7/MFj6kAYTF9w0VhGsYVTjESUHCGUsv bU6khAClU3igme/eGFAy8eGDsyisT0Qhq3A6IjMxctQkAiSMgfa/rgfiBBS6Tc6d5TZt LVvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1715092282; s=strato-dkim-0002; d=strato.com; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=IKClEEHLhRD+rDEo6L2yu4o70kRufN3A4Q5tRTV/emI=; b=Cx394ngmd92jG4tcr0ONDBgQNurgRLFqyjBZhtFtReX+qMVyl9+RfV1p+DzBGAhLOf rxWX64zVynwbHUs/iFK5Fu+mXGMAIYeD98u5zticmjpOcmhJPhugdFbmX7a6b/9QZ5wo Sv5McK9P3FriFCEfK73XdW6jDCjFBOUWl7NWFP5XWuTG/3/uDnqtRmOCayVFn+CjUsNd pow+Q4+jnSeu21tu6wmjqFuReQFMUFB8UtSsW5lwTHiOq43dkFA1pBaUqzyxfIbrFEY+ 5OnwSpZAvXpPDAx3xQzVaZF/4oVyUHlAgTLY3/Go9IOqgzSBFUEuRx6gz91vNcTDq5eU qMYg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1715092282; s=strato-dkim-0002; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=IKClEEHLhRD+rDEo6L2yu4o70kRufN3A4Q5tRTV/emI=; b=LiUWB71Ly10w5ccPW1MIOSEIKDS1+nHj21WWIwP6XQAwzva9BJoYecmnh8JbTgwVSt 2NAd5sIGQtGWtk2O4h4tDAzo2ot1dZpYahJ10hIcY8PWUof0p3A/njnDhPZHNzGXC6QK qyGZksWyKsfklxJYaMDdk8ctHQuT/4/5qY47V2FWu+pSs9Ptr1vLwsUL4eTX/dRau4wS mPmyuaOnoQxNHQ6p3IECZb0jApwDYcd5SzP0kY8EQZ3TcGWdzrCyJ8INwyocL4P1UASB aG7Wcd5fcL+E+Nhel7HlneNDQIsyIE4QPuwaXQtS7UCTTzx2+QmUotNi9mxUC9jKlm3X v9PQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1715092282; s=strato-dkim-0003; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=IKClEEHLhRD+rDEo6L2yu4o70kRufN3A4Q5tRTV/emI=; b=FkV47Iclg4Bi333fQqSgXEZqed1SNz1DbVMHxlNrJRWV9bKdPyR0VBa01jXkRm08TN 7XXPtao+CKN3279z92Aw== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKT7Qq0xotTetVnKkahNK6p2y+LQ4kG4HR" Received: from [192.168.2.102] by smtp.strato.de (RZmta 50.5.0 DYNA|AUTH) with ESMTPSA id xcdf44047EVMrbe (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Tue, 7 May 2024 16:31:22 +0200 (CEST) Message-ID: <94a7ab92-30b5-4e05-8762-803a3954f888@gjlay.de> Date: Tue, 7 May 2024 16:31:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Georg-Johann Lay To: "gcc-patches@gcc.gnu.org" Subject: [patch,avr,applied] PR target/114835 - Tweak __popcountqi2 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Applied this tweak as proposed in the PR. Johann --- commit 6b73a9879a4503ebee2cb1a3ad243f60c922ca31 Author: Wolfgang Hospital Date: Tue May 7 16:24:39 2024 +0200 AVR: target/114835 - Tweak popcountqi2 libgcc/ PR target/114835 * config/avr/lib1funcs.S (__popcountqi2): Use code that is one instruction shorter / faster. diff --git a/libgcc/config/avr/lib1funcs.S b/libgcc/config/avr/lib1funcs.S index af4d7d97016..4ac31fa104e 100644 --- a/libgcc/config/avr/lib1funcs.S +++ b/libgcc/config/avr/lib1funcs.S @@ -3050,21 +3050,21 @@ DEFUN __popcountdi2 ;; r24 = popcount8 (r24) ;; clobbers: __tmp_reg__ DEFUN __popcountqi2 - mov __tmp_reg__, r24 - andi r24, 1 - lsr __tmp_reg__ - lsr __tmp_reg__ - adc r24, __zero_reg__ - lsr __tmp_reg__ - adc r24, __zero_reg__ - lsr __tmp_reg__ - adc r24, __zero_reg__ - lsr __tmp_reg__ - adc r24, __zero_reg__ - lsr __tmp_reg__ - adc r24, __zero_reg__ - lsr __tmp_reg__ - adc r24, __tmp_reg__ + mov __tmp_reg__, r24 ; oeoeoeoe + andi r24, 0xAA ; o0o0o0o0 + lsr r24 ; 0o0o0o0o + ;; Four values 0, 1 or 2: # bits set o+e + sub __tmp_reg__, r24 ; 44332211 + mov r24, __tmp_reg__ ; 44332211 + andi r24, 0x33 ; 00330011 + eor __tmp_reg__, r24 ; 44002200 + lsr __tmp_reg__ ; 04400220 + lsr __tmp_reg__ ; 00440022 + add r24, __tmp_reg__ ; 04210421 + mov __tmp_reg__, r24 ; h421l421 + swap __tmp_reg__ ; l421h421 + add r24, __tmp_reg__ ; 84218421 + andi r24, 0xf ; 00008421 /17 ret ENDF __popcountqi2 #endif /* defined (L_popcountqi2) */