This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

split a 32bit value in 2 16bit value

  • Note: This was originally posted on 23rd July 2011 at http://forums.arm.com


    There's no instruction to split two registers like that.

    For parallel comparisons there's a set of instructions that performs add or subtract operations on 8-bit or 16-bit quantities and sets the GE registers based on whether or not the result overflows (there are signed and unsigned versions). Then you can use the sel instruction to conditionally select from two registers based on the GE bits.

    You might be able to adapt sasx/ssax/uasx/usax to do what you want. That'll exchange the top and bottom halfwords then add one halfword and subtract the other, while setting GE.


    Thank's exophase.
    I will have a look to those instruction.

    My main purpose is to try have more free register by saving 2 16bit in the same 32bit register.
    But the operation is usefull if it does not take too many time !
  • Note: This was originally posted on 22nd July 2011 at http://forums.arm.com

    There's no instruction to split two registers like that.

    For parallel comparisons there's a set of instructions that performs add or subtract operations on 8-bit or 16-bit quantities and sets the GE registers based on whether or not the result overflows (there are signed and unsigned versions). Then you can use the sel instruction to conditionally select from two registers based on the GE bits.

    You might be able to adapt sasx/ssax/uasx/usax to do what you want. That'll exchange the top and bottom halfwords then add one halfword and subtract the other, while setting GE.