Re: how to inline "ROR/ROL" asm instructions in C ?? (help wanted)

New Message Reply About this list Date view Thread view Subject view Author view

Marcus Watts (mdw@umich.edu)
Mon, 05 Oct 98 18:54:53 -0400


Dan McDonald <danmcd@Eng.Sun.COM> writes:
> SPARC has no rotate instruction, and neither does MIPS or PowerPC. Instead,

Um, actually, not quite. PowerPC has rotate instructions. Other machines
that have rotates appear to include the h8-300 (whatever that is), i960,
m88k, and pyramid. To be fair, it does seem to be a popular fad to
leave out rotates (and indeed neither sparc nor mips have them.)

Some compilers actually know how to generate rotate instructions.
Gnu cc 2.6.2 for i386 will produce a rotate instruction for this
code:
        subr(j)
                unsigned long j;
        {
                return (j<<5 | (j >> (32-5)));
        }
(It's not very smart about this. Changing | to + breaks this.
Also, it doesn't know how to generate a rotate by a variable
amount, which is a shame because this really helps rc6.)

Using inline asm code to produce a rotate may actually be a bad
thing on these machines.

                                        -Marcus Watts
                                        UM ITD PD&D Umich Systems Group


New Message Reply About this list Date view Thread view Subject view Author view

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

The following archive was created by hippie-mail 7.98617-22 on Sat Apr 10 1999 - 01:15:19