This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize ix86_expand_clrmem
- From: Andi Kleen <ak at muc dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 05 Aug 2004 15:58:32 +0200
- Subject: Re: [PATCH] Optimize ix86_expand_clrmem
- References: <20040805132811.GU8296@devserv.devel.redhat.com>
Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> For say:
> void foo (char *p, long *q)
> {
> __builtin_memset (p, 0, 7);
> __builtin_memset (q, 0, 9);
> }
I also noticed that a bigger constant size aligned memset is often
unrolled far too much on Opteron.
And memset behaves different depending on if it is called with 0
or a different value argument.
e.g.
void f(unsigned long *foo)
{
__builtin_memset(foo, 0xff, 9*8);
}
generates
movq $-1, %rax
movq %rax, (%rdi)
movq %rax, 8(%rdi)
movq %rax, 16(%rdi)
movq %rax, 24(%rdi)
movq %rax, 32(%rdi)
movq %rax, 40(%rdi)
movq %rax, 48(%rdi)
movq %rax, 56(%rdi)
movq %rax, 64(%rdi)
ret
but when I change the value to 0 it generates a call to a memset.
-Andi