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

Reply via email to