This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16961] New: Poor x86-64 performance
- From: "tomstdenis at iahu dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2004 13:08:25 -0000
- Subject: [Bug c/16961] New: Poor x86-64 performance
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
On the AMD64 using "-march=k8" we see really poor performance. My beef is two
issues.
First off, 128-bit unsigned additions are emulated when addq/adcq will do the
job just fine. For example,
typedef unsigned long mp_word __attribute__ ((mode(TI)));
mp_word a, b;
void test(void) { a += b; }
Produces via [-O3 -fomit-frame-pointer -march=k8]
movq a(%rip), %r10
movq b(%rip), %r8
xorl %ecx, %ecx
movq a+8(%rip), %rdi
movq b+8(%rip), %r9
leaq (%r10,%r8), %rax
leaq (%rdi,%r9), %rsi
cmpq %r10, %rax
movq %rax, a(%rip)
setb %cl
leaq (%rcx,%rsi), %rdx
movq %rdx, a+8(%rip)
ret
Which is insane.
The second beef is loop unrolling. Somehow between the 32-bit cores and
64-bit targets it was made WAY WORSE.
In the old method loops could be handled with something like
while (n&3) { do(); update_for_loop(); }
while (n) {
do(); do(); do(); do();
update_for_loop4x();
}
Now I'm seeing
top: goto off[n&7];
off_7: do(); update_for_loop();
off_6: do(); update_for_loop();
off_5: do(); update_for_loop();
off_4: do(); update_for_loop();
...
if (n) goto top;
In my case it's updating pointers in the "update_for_loop()" when it really
doesn't have to.
Tom
--
Summary: Poor x86-64 performance
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tomstdenis at iahu dot ca
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: gcc version 3.4.1 (Gentoo Linux 3.4.1, ssp-3.4-2, pie-
8.7.6.3)
GCC host triplet: Linux timmy 2.6.7-gentoo-r11 #1 Thu Aug 5 01:49:49 UTC
2004 x86_
GCC target triplet: gcc version 3.4.1 (Gentoo Linux 3.4.1, ssp-3.4-2, pie-
8.7.6.3)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16961