From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: * 4 converted to << 2 for networking code
Date: 10 Jan 2001 16:29:27 -0800 [thread overview]
Message-ID: <93iup7$6s4$1@cesium.transmeta.com> (raw)
In-Reply-To: <20010110174859.R7498@prosa.it> <3A5C778C.CFB363F3@didntduck.org> <20010110180322.T7498@prosa.it> <20010110161146.A3252@unthought.net>
Followup to: <20010110161146.A3252@unthought.net>
By author: =?iso-8859-1?Q?Jakob_=D8stergaard?= <jakob@unthought.net>
In newsgroup: linux.dev.kernel
>
> On most processors <<2 is slower than *4.
>
That's a funny statement. Which processors do you include in "most"?
That has not been my experience.
> It's outright stupid to write <<2 when we mean *4 in order to optimize for one out of a
> gazillion supported architectures - even more so when the compiler
> for the one CPU where <<2 is faster, will actually generate a shift
> instead of a multiply as a part of the standard optimization.
>
> One question for the GCC people: Will gcc change <<2 to *4 on other
> architectures ? If so, then my case is not quite as strong of course.
>
gcc should consider the statements equivalent, and generate whichever
pattern is preferred. On an i386 that may mean take a pattern such as
foo = (bar << 2) + quux;
... and generate ...
lea ecx,[esi*4+ebx]
-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-11 0:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-10 16:48 * 4 converted to << 2 for networking code antirez
2001-01-10 14:38 ` David S. Miller
2001-01-10 14:54 ` Brian Gerst
2001-01-10 17:03 ` antirez
2001-01-10 15:11 ` Jakob Østergaard
2001-01-10 15:18 ` Mike Harrold
2001-01-10 15:31 ` Chris Jones
2001-01-10 16:23 ` Jamie Lokier
2001-01-10 16:26 ` Mike Harrold
2001-01-10 17:25 ` antirez
2001-01-10 16:25 ` Pauline Middelink
2001-01-11 0:29 ` H. Peter Anvin [this message]
2001-01-10 22:21 ` Matthias Andree
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='93iup7$6s4$1@cesium.transmeta.com' \
--to=hpa@zytor.com \
--cc=linux-kernel@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.