sbfm
Signed Bitfield Move
SBFM <Wd>, <Wn>, #<immr>, #<imms>
Extracts/Inserts bitfield with sign extension.
Details
Extracts a bitfield from Wn with sign extension and places it in Wd. The bitfield is defined by immr (rotate right amount) and imms (field size), with the field width determined by the difference between imms and immr (plus 1). The extracted value is sign-extended to fill the 32-bit destination. No condition flags are affected. This is an AArch64 instruction.
Pseudocode Operation
Example
SBFM w0, w1, #immr, #imms
Encoding
Binary Layout
0
00
100110
0
immr
imms
Rn
Rd
Operands
-
Wd
Destination 32-bit integer register -
Wn
First source / base 32-bit integer register -
immr
Rotate -
imms
Size
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x13000000 | SBFM <Wd>, <Wn>, #<immr>, #<imms> | A64 | 0 | 00 | 100110 | 0 | immr | imms | Rn | Rd | ||
| 0x93400000 | SBFM <Xd>, <Xn>, #<immr>, #<imms> | A64 | 1 | 00 | 100110 | 1 | immr | imms | Rn | Rd |
Description
Signed Bitfield Move 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 destination bits below the bitfield are set to zero, and the bits above the bitfield are set to a copy of the most significant bit of the bitfield.
Operation
bits(datasize) src = X[n, datasize]; // perform bitfield move on low bits bits(datasize) bot = ROR(src, r) AND wmask; // determine extension bits (sign, zero or dest register) bits(datasize) top = Replicate(src<s>, datasize); // combine extension bits and result bits X[d, datasize] = (top AND NOT(tmask)) OR (bot AND tmask);