Bit manipulation

There are a set of instructions for manipulating bits within a register. This figure shows some examples:

The BFI instruction inserts a bit field into a register. In the preceding figure, BFI is taking a 6-bit field from the source register (W0) and inserting it at bit position 9 in the destination register.

UBFX extracts a bit field. In the preceding figure, UBFX is taking a 7-bit field from bit position 18 in the source register, and placing it in the destination register.

Other instructions can reverse byte or bit order, as you can see in this figure:

 

REV16 and RBIT are particularly useful when you are handling data that is in a different endianness.

Previous Next