public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: discuss@x86-64.org
Cc: Stephen Hemminger <shemminger@linux-foundation.org>,
	linux-kernel@vger.kernel.org, jh@suse.cz
Subject: Re: [discuss] [PATCH] x86-64: memset optimization
Date: Sun, 19 Aug 2007 20:24:24 +0200	[thread overview]
Message-ID: <200708192024.24864.ak@suse.de> (raw)
In-Reply-To: <20070819010430.2c8c31fc@oldman.hemminger.net>


> 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];

f()
{
        memset(x, 1, 6);
}

gives with gcc 4.1:

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

-Andi

  reply	other threads:[~2007-08-19 18:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-17 23:34 [PATCH] x86-64: memset optimization Stephen Hemminger
2007-08-18  7:17 ` Eric Dumazet
2007-08-18  9:46 ` Andi Kleen
2007-08-18 14:56   ` Stephen Hemminger
2007-08-18 18:55     ` Andi Kleen
2007-08-19  5:04       ` Stephen Hemminger
2007-08-19 18:24         ` Andi Kleen [this message]
2007-08-20 15:52           ` [discuss] " Stephen Hemminger
2007-08-20 15:51             ` Arjan van de Ven
2007-08-20 17:03               ` Roland Dreier
2007-08-20 18:16                 ` Andi Kleen
2007-08-20 18:56                 ` Jan Hubicka
2007-08-21 10:16                   ` Denys Vlasenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200708192024.24864.ak@suse.de \
    --to=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=jh@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox