public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51839] New: GCC not generating adc instruction for canonical multi-precision add sequence
@ 2012-01-12 19:36 svfuerst at gmail dot com
  2021-02-17 13:51 ` [Bug middle-end/51839] " chfast at gmail dot com
  2021-08-07 17:57 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: svfuerst at gmail dot com @ 2012-01-12 19:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51839

             Bug #: 51839
           Summary: GCC not generating adc instruction for canonical
                    multi-precision add sequence
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: svfuerst@gmail.com


The multi-precision add

void foo(unsigned long long *x, unsigned long long y, unsigned long long z)
{
    x[0] += y;
    x[1] += z + (x[0] < y);
}

compiles into:

mov    %rsi,%rax
add    (%rdi),%rax
add    0x8(%rdi),%rdx
cmp    %rax,%rsi
mov    %rax,(%rdi)
seta   %al
movzbl %al,%eax
add    %rax,%rdx
mov    %rdx,0x8(%rdi)
retq

Instead, gcc could use the adc instruction, yielding the wanted:

add    %rsi, (%rdi)
adc    %rdx, 8(%rdi)
retq


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/51839] GCC not generating adc instruction for canonical multi-precision add sequence
  2012-01-12 19:36 [Bug c/51839] New: GCC not generating adc instruction for canonical multi-precision add sequence svfuerst at gmail dot com
@ 2021-02-17 13:51 ` chfast at gmail dot com
  2021-08-07 17:57 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: chfast at gmail dot com @ 2021-02-17 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

Paweł Bylica <chfast at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chfast at gmail dot com

--- Comment #1 from Paweł Bylica <chfast at gmail dot com> ---
This is fixed in GCC 8.1 (at least for add+adc pair).
https://godbolt.org/z/9j4f6r

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/51839] GCC not generating adc instruction for canonical multi-precision add sequence
  2012-01-12 19:36 [Bug c/51839] New: GCC not generating adc instruction for canonical multi-precision add sequence svfuerst at gmail dot com
  2021-02-17 13:51 ` [Bug middle-end/51839] " chfast at gmail dot com
@ 2021-08-07 17:57 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-07 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |8.0
         Resolution|---                         |FIXED
           Keywords|                            |missed-optimization

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So this was implemented with the following revisions:
r6-3012
r6-5232
r8-7547
And maybe a few others were needed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-07 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 19:36 [Bug c/51839] New: GCC not generating adc instruction for canonical multi-precision add sequence svfuerst at gmail dot com
2021-02-17 13:51 ` [Bug middle-end/51839] " chfast at gmail dot com
2021-08-07 17:57 ` pinskia at gcc dot gnu.org

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).