From: hpa@zytor.com (H. Peter Anvin)
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/12] random pt4: Create new rol32/ror32 bitops
Date: Mon, 24 Jan 2005 22:16:35 +0000 (UTC) [thread overview]
Message-ID: <ct3s43$ree$1@terminus.zytor.com> (raw)
In-Reply-To: 200501230247_MC3-1-93FA-7A4E@compuserve.com
Followup to: <200501230247_MC3-1-93FA-7A4E@compuserve.com>
By author: Chuck Ebbert <76306.1226@compuserve.com>
In newsgroup: linux.dev.kernel
>
> On Sat, 22 Jan 2005 at 20:13:24 -0800 Matt Mackall wrote:
>
> > So I think tweaks for x86 at least are unnecessary.
>
> So the compiler looks for that specific sequence of instructions:
>
> (a << b) | (a >> (sizeof(a) * 8 - b)
>
> and recognizes that it means rotation? Wow.
>
You know, there is a LOT of instructions like that. x86 has a single
instruction to do:
a = b + (c << 3) + 3600;
(Assuming a, b and c are in eax, ebx, and ecx, respecively, the
instruction is "leal 3600(%ebx,%ecx,3),%eax".)
The C compiler really needs to recognize these kinds of idioms, not
just in the source, but that occur natually as a result of code
generation and optimizations. The compiler lingo for this is
"peephole optimization."
-hpa
next prev parent reply other threads:[~2005-01-24 22:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-23 7:44 [PATCH 1/12] random pt4: Create new rol32/ror32 bitops Chuck Ebbert
2005-01-24 22:16 ` H. Peter Anvin [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-01-23 2:10 Chuck Ebbert
2005-01-23 2:45 ` Matt Mackall
2005-01-23 3:19 ` Andi Kleen
2005-01-23 4:13 ` Matt Mackall
2005-01-21 21:41 [PATCH 0/12] random pt4: Moving and sharing code Matt Mackall
2005-01-21 21:41 ` [PATCH 1/12] random pt4: Create new rol32/ror32 bitops Matt Mackall
2005-01-25 21:02 ` Denis 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='ct3s43$ree$1@terminus.zytor.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox