0

RRX example, uses the CPSR C flag as a 33rd bit.

   ldr r0,=#0x5
   ldr r1,=#0x0000000F
   cmp r0,#1 <================set carry = 1
   RRX r0,r1 <================ output = 0x80000007

ROR example, the LSB(Least Significant Bit) becomes the MSB(Most Significant Bit)

   ldr r1,=#0x0000000F
   ROR r0,r1,#1 <================ output = 0x80000007

I understand how to operate these instructions, but I wonder what's the purpose ? In what scenarios would you actually need these instructions? Thank you.

David
  • 273
  • 1
  • 12
  • 2
    Does this answer your question? [What's the purpose of the rotate instructions (ROL, RCL on x86)?](https://stackoverflow.com/questions/4976636/whats-the-purpose-of-the-rotate-instructions-rol-rcl-on-x86) Even though this one mentions ARM and the other uses x86 as an example, both questions are about why you'd want to use rotates, which is a processor-agnostic question. – Thomas Jager Jan 11 '22 at 13:25

0 Answers0