Developer’s Manual
January, 2004
187
Intel XScale® Core
Developer’s Manual
Optimization Guide
A.3.2
Bit Field Manipulation
The Intel XScale
®
core shift and logical operations provide a useful way of manipulating bit fields.
Bit field operations can be optimized as follows:
;Set the bit number specified by r1 in register r0
mov r2, #1
orr r0, r0, r2, asl r1
;Clear the bit number specified by r1 in register r0
mov r2, #1
bic r0, r0, r2, asl r1
;Extract the bit-value of the bit number specified by r1 of the
;value in r0 storing the value in r0
mov r1, r0, asr r1
and r0, r1, #1
;Extract the higher order 8 bits of the value in r0 storing
;the result in r1
mov r1, r0, lsr #24