From: Eric Dumazet <dada1@cosmosbay.com>
To: David Miller <davem@davemloft.net>
Cc: ak@suse.de, linux@horizon.com, akepner@sgi.com, netdev@vger.kernel.org
Subject: Re: [PATCH] NET : change layout of ehash table
Date: Fri, 9 Feb 2007 10:36:58 +0100 [thread overview]
Message-ID: <200702091036.58474.dada1@cosmosbay.com> (raw)
In-Reply-To: <20070209.011542.21927454.davem@davemloft.net>
On Friday 09 February 2007 10:15, David Miller wrote:
> From: Eric Dumazet <dada1@cosmosbay.com>
> Date: Fri, 9 Feb 2007 10:06:24 +0100
>
> > Yes, but a decent C compiler for such targets should not use a
> > multiply instruction to perform a (idx * 12) operation... :)
>
> Good point.
>
> Actually, I could never get GCC to avoid a divide on sparc64 for
> certain kinds of pointer arithmetic when the elements were not
> a power of two. It probably has something to do with signedness.
>
> I think I narrowed is down to the fact that you can't legally replace
> a signed divide with shift/add/subtract. But I could be remembering
> things wrong.
Thats strange, because pointer arithmetic is unsigned...
I dont know when gcc started to use reciprocal division, maybe your gcc was
very old ?
$ cat div.c
struct s1 { int pad[3]; };
unsigned long diffptr(struct s1 *a, struct s1 *b)
{
return a - b;
}
If compiled on i386 , gcc-4.1.1 :
$ gcc -O2 -fomit-frame-pointer -S div.c
diffptr:
movl 4(%esp), %eax
subl 8(%esp), %eax
sarl $2, %eax
imull $-1431655765, %eax, %eax
ret
If compiled on x86_64 , gcc-4.1.1:
diffptr:
subq %rsi, %rdi
movabsq $-6148914691236517205, %rax
sarq $2, %rdi
imulq %rax, %rdi
movq %rdi, %rax
ret
next prev parent reply other threads:[~2007-02-09 9:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-19 8:56 [PATCH] irlan: handle out of memory errors Akinobu Mita
2006-12-19 22:47 ` Samuel Ortiz
2007-02-07 8:12 ` David Miller
2007-02-07 10:59 ` [PATCH] NET : change layout of ehash table Eric Dumazet
2007-02-08 22:56 ` David Miller
2007-02-09 9:18 ` Andi Kleen
2007-02-09 8:40 ` David Miller
2007-02-09 8:57 ` Andi Kleen
2007-02-09 9:06 ` Eric Dumazet
2007-02-09 9:15 ` David Miller
2007-02-09 9:36 ` Eric Dumazet [this message]
2007-02-09 9:43 ` David Miller
2007-02-09 10:10 ` Andi Kleen
2007-02-09 17:44 ` [PATCH] NET : UDP can use sk_hash to speedup lookups Eric Dumazet
2007-02-09 23:45 ` David Miller
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=200702091036.58474.dada1@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=ak@suse.de \
--cc=akepner@sgi.com \
--cc=davem@davemloft.net \
--cc=linux@horizon.com \
--cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.