← Home

BFM

Bitfield move

This instruction is usually accessed via one of its aliases, which are always preferred for disassembly.

If <imms> is greater than or equal to <immr>, this copies a bitfield of (<imms>-<immr>+1) bits starting from bit position <immr> in the source register to the least significant bits of the destination register.

If <imms> is less than <immr>, this copies a bitfield of (<imms>+1) bits from the least significant bits of the source register to bit position (regsize-<immr>) of the destination register, where regsize is the destination register size of 32 or 64 bits.

In both cases, the other bits of the destination register remain unchanged.

This instruction is used by the aliases BFC, BFI, and BFXIL.

313029282726252423222120191817161514131211109876543210
sf01100110NimmrimmsRnRd
opc

32-bit encoding

(sf == 0 && N == 0)

BFM <Wd>, <Wn>, #<immr>, #<imms>

64-bit encoding

(sf == 1 && N == 1)

BFM <Xd>, <Xn>, #<immr>, #<imms>

Decode (all encodings)

if sf == '1' && N != '1' then EndOfDecode(Decode_UNDEF); if sf == '0' && (N != '0' || immr<5> != '0' || imms<5> != '0') then EndOfDecode(Decode_UNDEF); constant integer d = UInt(Rd); constant integer n = UInt(Rn); constant integer datasize = 32 << UInt(sf); constant integer s = UInt(imms); constant integer r = UInt(immr); bits(datasize) wmask; bits(datasize) tmask; (wmask, tmask) = DecodeBitMasks(N, imms, immr, FALSE, datasize);

Assembler Symbols

<Wd>

Is the 32-bit name of the general-purpose destination register, encoded in the "Rd" field.

<Wn>

Is the 32-bit name of the general-purpose source register, encoded in the "Rn" field.

<immr>

For the "32-bit" variant: is the right rotate amount, in the range 0 to 31, encoded in the "immr" field.

For the "64-bit" variant: is the right rotate amount, in the range 0 to 63, encoded in the "immr" field.

<imms>

For the "32-bit" variant: is the leftmost bit number to be moved from the source, in the range 0 to 31, encoded in the "imms" field.

For the "64-bit" variant: is the leftmost bit number to be moved from the source, in the range 0 to 63, encoded in the "imms" field.

<Xd>

Is the 64-bit name of the general-purpose destination register, encoded in the "Rd" field.

<Xn>

Is the 64-bit name of the general-purpose source register, encoded in the "Rn" field.

Alias Conditions

AliasIs preferred when
BFCRn == '11111' && UInt(imms) < UInt(immr)
BFIRn != '11111' && UInt(imms) < UInt(immr)
BFXIL UInt(imms) >= UInt(immr)

Operation

constant bits(datasize) dst = X[d, datasize]; constant bits(datasize) src = X[n, datasize]; // Perform bitfield move on low bits constant bits(datasize) bot = (dst AND NOT(wmask)) OR (ROR(src, r) AND wmask); // Combine extension bits and result bits X[d, datasize] = (dst AND NOT(tmask)) OR (bot AND tmask);

Operational information

This instruction is a data-independent-time instruction as described in About PSTATE.DIT.


Version 2025.09 — Copyright © 2010-2025 Arm Limited or its affiliates.

This site is provided as a community resource and is NOT affiliated with nor endorsed by Arm Limited.