ubfx
Unsigned Bit Field Extract (Thumb)
UBFX <Rd>, <Rn>, #<lsb>, #<width>
Extracts and zero-extends bits.
Pseudocode Operation
lsb_val ← ZeroExtend(imm3:imm2, 6)
width_val ← ZeroExtend(width, 5)
extracted ← (Rn >> lsb_val)[width_val-1:0]
Rd ← ZeroExtend(extracted, 32)
Example
UBFX r0, r1, #0, #width
Encoding
Binary Layout
11110
31:27
0
26
11
25:24
11
23:22
0
21
0
20
Rn
19:16
0
15
imm3
14:12
Rd
11:8
imm2
7:6
0
5
widthm1
4:0
Operands
-
Rd
Destination general-purpose register -
Rn
First source / base general-purpose register
Reference
View in Arm A64 ISA Reference ↗
Arm AArch32 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x07E00050 | UBFX{<c>}{<q>} <Rd>, <Rn>, #<lsb>, #<width> | A32 | cond | 01111 | 1 | 1 | widthm1 | Rd | lsb | 101 | Rn | ||
| 0xF3C00000 | UBFX{<c>}{<q>} <Rd>, <Rn>, #<lsb>, #<width> | T32 | 11110 | 0 | 11 | 11 | 0 | 0 | Rn | 0 | imm3 | Rd | imm2 | 0 | widthm1 |
Description
Unsigned Bit Field Extract extracts any number of adjacent bits at any position from a register, zero-extends them to 32 bits, and writes the result to the destination register.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
R[d] = ZeroExtend(R[n]<msbit:lsbit>, 32);