From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by sourceware.org (Postfix) with ESMTPS id A0AEF3858C54 for ; Wed, 7 Jun 2023 06:32:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0AEF3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-75ec93ada25so201331085a.2 for ; Tue, 06 Jun 2023 23:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686119566; x=1688711566; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iQ68ig8lwmB1DNA70nUCR1RTUwQQzI4j1fbtJrPUI+E=; b=Vd3oN6W8k4sO1i25w2cbmaLnH02GBUED2IWCffwJ8OjtdsxFI2YLIZNr7riv/+vVlu 2bsPbqGVi9YNe52qn1QAv2A8v81YGbUNM0Dqrwam3VlB5i4pSYu1RwTofkh1pI0njsFn Gy2fZSH22NzoW3DB4xhHonsJ2/1XCY9IZ9OwTbS0+J8RMi1mRrd8XOgKqv4UkQ60vIKp +4mwT38BGTdQohDbpFQ4XzeTCYj4L1zK0lc92xpWoaF24+nLJoWjwh4jn8Tjd0kYEcmq qB8f4rhorwPPuxHpU/EM3cmgZ0S+3bqzjycTBa11lAQFTaU8SdqDVLcOVuQeQ8dMAG7t eWrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686119566; x=1688711566; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iQ68ig8lwmB1DNA70nUCR1RTUwQQzI4j1fbtJrPUI+E=; b=FaW807JzW8QpYXOs9ZWKkwHk4B6vfAFz/PjXazXKP+HkdBIXLfhSYBWTNADIKs53Zu RoO28BEFCk8aUpFZHH+48xtLAhWeq41Mep9fqPM6TeUOyx3zNcbpG6hTEjk+WIT/gyG8 lRNoIam25igyKbiy/ykCJjsO5KB405z0pGNVuPyluhiLnuOAC0KYdFHLYiPv3I73Xe4S DUy8kUO1YUrxCXxgknlbzxzj0koxu1aV2r9wjNfVcEY18Zfl83cijrxjh3cdcaaFhTFT FACriekDPzyE89bGWIRwynJn4U2fwmTS43TDfBaRQtLUv2NQlWK9bDSnAjRFrcGwZGAl njdQ== X-Gm-Message-State: AC+VfDz4eI9wG+gKfyQdrcnIQP4XAU7Y6fhVpAl+fpS7ypDpwINwja9U EYr+FLnfCKYTBZBQrBCY6TqhDTrgV6EyFW+aY3oqbFRVAhc= X-Google-Smtp-Source: ACHHUZ6FKKG8iJqgNirQnZRqDFxLi5IkXjt0gUh6ix6xJTXpFflPA3Eo+ku8uE6VpziULCBVWncJ091xKbgBaoDQGJI= X-Received: by 2002:a05:6214:2529:b0:628:6253:e481 with SMTP id gg9-20020a056214252900b006286253e481mr1849915qvb.51.1686119565945; Tue, 06 Jun 2023 23:32:45 -0700 (PDT) MIME-Version: 1.0 References: <037101d998cb$6aa8f120$3ffad360$@nextmovesoftware.com> In-Reply-To: <037101d998cb$6aa8f120$3ffad360$@nextmovesoftware.com> From: Uros Bizjak Date: Wed, 7 Jun 2023 08:32:34 +0200 Message-ID: Subject: Re: [x86 PATCH] PR target/31985: Improve memory operand use with doubleword add. To: Roger Sayle Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jun 7, 2023 at 1:05=E2=80=AFAM Roger Sayle wrote: > > > This patch addresses the last remaining issue with PR target/31985, that > GCC could make better use of memory addressing modes when implementing > double word addition. This is achieved by adding a define_insn_and_split > that combines an *add3_doubleword with a *concat3, so > that the components of the concat can be used directly, without first > being loaded into a double word register. > > For test_c in the bugzilla PR: > > Before: > pushl %ebx > subl $16, %esp > movl 28(%esp), %eax > movl 36(%esp), %ecx > movl 32(%esp), %ebx > movl 24(%esp), %edx > addl %ecx, %eax > adcl %ebx, %edx > movl %eax, 8(%esp) > movl %edx, 12(%esp) > addl $16, %esp > popl %ebx > ret > > After: > test_c: > subl $20, %esp > movl 36(%esp), %eax > movl 32(%esp), %edx > addl 28(%esp), %eax > adcl 24(%esp), %edx > movl %eax, 8(%esp) > movl %edx, 12(%esp) > addl $20, %esp > ret > > > If this approach is considered acceptable, similar splitters can be > used for other doubleword operations. Yes, the approach looks good to me. But please take care not to interfere with STV transformations. > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target_board=3Dunix{-m32} > with no new failures. Ok for mainline? > > 2023-06-07 Roger Sayle > > gcc/ChangeLog > PR target/31985 > * config/i386/i386.md (*add3_doubleword_concat): New > define_insn_and_split combine *add3_doubleword with a > *concat3 for more efficient lowering after reload. > > gcc/testsuite/ChangeLog > PR target/31985 > * gcc.target/i386/pr31985.c: New test case. OK. Thanks, Uros. > > > Roger > -- >