[lkml]   [2007]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [discuss] [PATCH] x86-64: memset optimization

> I am looking at current source, built with current (non-experimental) GCC
> from Fedora Core 7. If I dissassemble ether_setup, which is
> void ether_setup(struct net_device *dev)
> {
> ...
> memset(dev->broadcast, 0xFF, ETH_ALEN);
> }
> I see a tail recursion (jmp) to memset which is the code in arch/x86_64/lib/memset.S

That is likely gcc then deciding it can't use an inline memset for some reason.
It does that for example if it can't figure out the alignment or similar.
Honza (cc'ed) can probably give you more details why it happens, especially if you
give him a preprocessed self contained test case.

A simple example like
char x[6];

memset(x, 1, 6);

gives with gcc 4.1:

.p2align 4,,15
.globl f
.type f, @function
movl $16843009, x(%rip)
movw $257, x+4(%rip)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-08-19 20:27    [W:0.058 / U:9.888 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site