3.9.1. BFC and BFI

Bit Field Clear and Bit Field Insert.

Syntax

BFC{cond} Rd, #lsb, #width
BFI{cond} Rd, Rn, #lsb, #width

Where:

cond

Is an optional condition code. See Conditional execution.

Rd

Is the destination register.

Rn

Is the source register.

lsb

Is the position of the least significant bit of the bit field. lsb must be in the range 0-31.

width

Is the width of the bit field and must be in the range 1-32−lsb.

Operation

BFC clears a bit field in a register. It clears width bits in Rd, starting at the low bit position lsb. Other bits in Rd are unchanged.

BFI copies a bit field into one register from another register. It replaces width bits in Rd starting at the low bit position lsb, with width bits from Rn starting at bit[0]. Other bits in Rd are unchanged.

Restrictions

Do not use SP and do not use PC.

Condition flags

These instructions do not affect the flags.

Examples

    BFC   R4, #8, #12       ; Clear bit 8 to bit 19 (12 bits) of R4 to 0
    BFI   R9, R2, #8, #12   ; Replace bit 8 to bit 19 (12 bits) of R9 with
                            ; bit 0 to bit 11 from R2.

Copyright © 2015, 2018 Arm. All rights reserved.ARM DUI 0646C
Non-ConfidentialID121118