From: Uros Bizjak <ubizjak@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [x86 PATCH] PR target/31985: Improve memory operand use with doubleword add.
Date: Wed, 7 Jun 2023 08:32:34 +0200 [thread overview]
Message-ID: <CAFULd4Y5_b3tDkdvMWzq=T=197nnvkqLhvM9Noa_gA5CoW-53g@mail.gmail.com> (raw)
In-Reply-To: <037101d998cb$6aa8f120$3ffad360$@nextmovesoftware.com>
On Wed, Jun 7, 2023 at 1:05 AM Roger Sayle <roger@nextmovesoftware.com> 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 *add<dwi>3_doubleword with a *concat<mode><dwi>3, 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=unix{-m32}
> with no new failures. Ok for mainline?
>
> 2023-06-07 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> PR target/31985
> * config/i386/i386.md (*add<dwi>3_doubleword_concat): New
> define_insn_and_split combine *add<dwi>3_doubleword with a
> *concat<mode><dwi>3 for more efficient lowering after reload.
>
> gcc/testsuite/ChangeLog
> PR target/31985
> * gcc.target/i386/pr31985.c: New test case.
OK.
Thanks,
Uros.
>
>
> Roger
> --
>
next prev parent reply other threads:[~2023-06-07 6:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 23:05 Roger Sayle
2023-06-07 6:32 ` Uros Bizjak [this message]
2023-06-07 7:07 ` Uros Bizjak
2023-06-15 22:04 ` Roger Sayle
2023-06-16 7:13 ` Uros Bizjak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFULd4Y5_b3tDkdvMWzq=T=197nnvkqLhvM9Noa_gA5CoW-53g@mail.gmail.com' \
--to=ubizjak@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=roger@nextmovesoftware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).