pkhtb
Pack Halfword Top Bottom
PKHTB<c> <Rd>, <Rn>, <Rm> {, ASR #<imm>}
Combines top half of Rn with bottom half of shifted Rm.
Details
Packs the top halfword of Rn with the bottom halfword of (Rm shifted right). Assembles a 32-bit result by taking bits [31:16] from Rn and bits [15:0] from the shifted Rm. Condition flags N, Z, C, V are unaffected. A32-only instruction requiring DSP extension.
Pseudocode Operation
shifted_rm ← Rm >> shift_imm
Rd[15:0] ← shifted_rm[15:0]
Rd[31:16] ← Rn[31:16]
Example
PKHTB r0, r1, r2
Encoding
Binary Layout
cond
01101000
Rn
Rd
imm5
1
01
Rm
Operands
-
Rd
Destination general-purpose register -
Rn
Top Src -
Rm
Bottom Src
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x06800050 | PKHTB{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, ASR #<imm>} | A32 | cond | 01101000 | Rn | Rd | imm5 | 1 | 01 | Rm | ||
| 0xEAC00020 | PKHTB{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, ASR #<imm>} | T32 | 1110101 | 0110 | 0 | Rn | 0 | imm3 | Rd | imm2 | 1 | 0 | Rm |
Description
Pack Halfword combines one halfword of its first operand with the other halfword of its shifted second operand.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = Shift(R[m], shift_t, shift_n, PSTATE.C); // PSTATE.C ignored
R[d]<15:0> = if tbform then operand2<15:0> else R[n]<15:0>;
R[d]<31:16> = if tbform then R[n]<31:16> else operand2<31:16>;