0

I'm designing a processor, and have created a list of frequently used ALU operations. Rotate and rotate through carry are found in almost all processors, and I would like to know why. Besides some obscure mention of cryptography, I don't see what these have to offer that bitshifts can't do.

Also, is there any reason to implement an 8 and 16 bit version of these operations, or just 32 bit? Thanks for any help.

tayfun2150
  • 23
  • 4
  • possible duplicate of [What's the purpose of the rotate instructions (ROL, RCL on x86)?](http://stackoverflow.com/questions/4976636/whats-the-purpose-of-the-rotate-instructions-rol-rcl-on-x86) – James Oct 13 '14 at 23:08

1 Answers1

0

Actually, bitshifts are in some cases an awkward replacement for rotates.

I don't know about cryptography, but I do much hardware programming.

Many devices for example get their data nibble-wise. If you can rotate, it's easier to prepare data for this. If you have bit shift only you are forced to backup the value in an extra variable/register.

Thus rotate is actually very useful, especially in controllers with little memory, where every byte counts. I believe this is the reason why every processor offers rotates. Hope this helps.

dumbo
  • 21
  • 3