public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/94804] Failure to elide useless movs in 128-bit addition with __int128_t arguments
Date: Thu, 19 Jan 2023 23:20:29 +0000	[thread overview]
Message-ID: <bug-94804-4-xU3lhGlw8d@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94804-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94804

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |101926
            Summary|Failure to elide useless    |Failure to elide useless
                   |movs in 128-bit addition    |movs in 128-bit addition
                   |                            |with __int128_t arguments

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is ra issue with arguments really.
We get good code with:
```
using i128 = __int128;
i128 sub128(i128 *a, i128 *b)
{
    return *a - *b;
}
```
```
        movq    (%rdi), %rax
        movq    8(%rdi), %rdx
        subq    (%rsi), %rax
        sbbq    8(%rsi), %rdx
```

With:
```
using i128 = __int128;

void sub128(i128 a, i128 b, i128 *c)
{
    *c =  a - b;
}
```
We get not so good code (extra movs):
```
        movq    %rsi, %rax
        movq    %rdi, %rsi
        movq    %rax, %rdi
        subq    %rdx, %rsi
        sbbq    %rcx, %rdi
        movq    %rsi, (%r8)
        movq    %rdi, 8(%r8)
```


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101926
[Bug 101926] [meta-bug] struct/complex argument passing and return should be
improved

  parent reply	other threads:[~2023-01-19 23:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 16:42 [Bug rtl-optimization/94804] New: Failure to elide useless movs in 128-bit addition gabravier at gmail dot com
2020-04-27 20:50 ` [Bug rtl-optimization/94804] " gabravier at gmail dot com
2020-04-28  6:49 ` glisse at gcc dot gnu.org
2020-04-28  7:41 ` rguenth at gcc dot gnu.org
2020-04-28 12:38 ` gabravier at gmail dot com
2020-04-28 17:14 ` glisse at gcc dot gnu.org
2023-01-19 23:17 ` pinskia at gcc dot gnu.org
2023-01-19 23:20 ` pinskia at gcc dot gnu.org [this message]
2023-01-19 23:23 ` [Bug rtl-optimization/94804] Failure to elide useless movs in 128-bit addition with __int128_t arguments pinskia at gcc dot gnu.org

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=bug-94804-4-xU3lhGlw8d@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).