movk

Move Keep

MOVK <Wd>, #<imm16> {, lsl #<shift>}

Inserts a 16-bit immediate into a register, keeping other bits unchanged.

Pseudocode Operation

shift_amount ← hw × 16
mask ← 0xFFFF ≪ shift_amount
Wd ← (Wd ∧ ¬mask) ∨ (imm16 ≪ shift_amount)

Example

MOVK w0, #16

Encoding

Binary Layout
0
31
11
30:29
100101
28:23
hw
22:21
imm16
20:5
Rd
4:0
 
Format Data Processing
Opcode 0x72800000
Extension Base

Operands

  • Wd
    Destination 32-bit integer register
  • imm16
    Imm
  • shift
    Shift (0,16)

Related

More in Base

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x72800000 MOVK <Wd>, #<imm>{, LSL #<shift>} A64 0 | 11 | 100101 | hw | imm16 | Rd
0xF2800000 MOVK <Xd>, #<imm>{, LSL #<shift>} A64 1 | 11 | 100101 | hw | imm16 | Rd

Description

Move wide with keep moves an optionally-shifted 16-bit immediate value into a register, keeping other bits unchanged.

Operation

bits(datasize) result;

result = X[d, datasize];
result<pos+15:pos> = imm16;
X[d, datasize] = result;