This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51839] New: GCC not generating adc instruction for canonical multi-precision add sequence
- From: "svfuerst at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Jan 2012 19:35:38 +0000
- Subject: [Bug c/51839] New: GCC not generating adc instruction for canonical multi-precision add sequence
- Auto-submitted: auto-generated
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