Search code examples
assemblypowerpc

What does the extldi instruction do? (PowerPc)


I don't understand the instruction extldi. The exact operation I want to work out is:

r12 = 0xB070

extldi    r11, r12, 31,17

I've looked through many different documentation sources but can't seem to come across a good enough example in order for me to understand it; Rather than giving me the answer I would like an explanation so that it helps in the future.

Thanks in advance.


Solution

  • extldi is an extended mnemonic for rldicr which is Rotate Left Doubleword Immediate then Clear Right

    extldi Rx,Ry,n,b is equivalent to rldicr Rx,Ry,b,n-1

    Additional information can be found by consulting the PowerPC Architecture Book, Version 2.02, available here


    EDIT - Further information about rldicr:

    Rotate the contents of a general purpose register left by the number of bits specified by an immediate value. Clear a specified number of low-order bits. Place the results in another general purpose register.

    rldicr has four parameters:

    • RA Specifies the target general purpose register for the result of the instruction.
    • RS Specifies the source general purpose register containing the operand.
    • SH Specifies the (immediate) shift value for the operation.
    • ME Specifies the end value (bit number) of the mask for the operation.

    Caution: This instruction is defined only for 64-bit implementations. Using it on a 32-bit implementation will cause the system illegal instruction error handler to be invoked.

    Regarding your situation, you just plugin the numbers and you're done. I hope this edit will please you.