Related articles |
---|
Rotate Left from C da5id65536@yahoo.com (David Sexton) (2002-10-18) |
Re: Rotate Left from C f91-men@nada.kth.se (Mattias Engdegård) (2002-10-20) |
Re: Rotate Left from C mal@wyrd.be (Lieven Marchand) (2002-10-20) |
Re: Rotate Left from C torbenm@diku.dk (Torben Ægidius Mogensen) (2002-10-24) |
From: | "Mattias Engdegård" <f91-men@nada.kth.se> |
Newsgroups: | comp.compilers |
Date: | 20 Oct 2002 22:49:17 -0400 |
Organization: | Compilers Central |
References: | 02-10-065 |
Keywords: | architecture |
Posted-Date: | 20 Oct 2002 22:49:17 EDT |
"David Sexton" <da5id65536@yahoo.com> writes:
>#define KONROL32(theNum,theRot) ((theNum) << (theRot)) | ((theNum) >>
>(32 - theRot)))
>As you can see, I want to use function definitions that use the
>processor's ROL instruction rather than having to use that default
>macro which is significantly slower.
Gcc will generate a rotate instruction (if available) for the above
code. Other modern compilers likely do the same. If not, it's probably
because their programmers didn't consider rotates to be common enough
to be worth the effort. (They mostly turn up in cryptographic code
nowadays.)
>[How many machines still have rotate instructions? I thought they had
>gone out of fashion. Yes, I know the Pentium does, but its instruction
>set dates from the 1970s. -John]
PowerPC
ARM
IA-64 (kind of)
Return to the
comp.compilers page.
Search the
comp.compilers archives again.