Recent

Author Topic: AARCH64, instruction encoding  (Read 653 times)

LemonParty

  • Sr. Member
  • ****
  • Posts: 353
AARCH64, instruction encoding
« on: September 09, 2025, 08:49:32 pm »
Hello.
I trying to figure out how encoding of AARCH64 instructions occur. And can't understand how immediate value and register are encoded. I studying instruction movz https://developer.arm.com/documentation/ddi0602/2025-06/Base-Instructions/MOVZ--Move-wide-with-zero-
Does anybody know how it work?
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

jamie

  • Hero Member
  • *****
  • Posts: 7300
Re: AARCH64, instruction encoding
« Reply #1 on: September 10, 2025, 01:44:48 am »
Looks to me like the other Movz I've seen.

Move a smaller type into a larger type and zero out the leftover region of the destination.

So, a 16 bit memory type can be moved into a 32/64 bit register with the remainder cleared?

Just my guess really..

Jamie

The only true wisdom is knowing you know nothing

Khrys

  • Sr. Member
  • ****
  • Posts: 342
Re: AARCH64, instruction encoding
« Reply #2 on: September 10, 2025, 07:51:23 am »
Here's an example for moving  0xABCD'0000'0000'0000  into  x0:

movz x0, #0xABCD, lsl #48

1 10100101 11 1010101111001101 00000
│        │  │                │     └─ Rd (aka Xd because sf = 1); 0 → x0
│        │  │                └─────── imm16; 0xABCD
│        │  └──────────────────────── hw;    3      → shift left by 48 bits
│        └─────────────────────────── opc;   0xA5   → movz opcode
└──────────────────────────────────── sf;    1      → 64-bit destination

LemonParty

  • Sr. Member
  • ****
  • Posts: 353
Re: AARCH64, instruction encoding
« Reply #3 on: September 10, 2025, 08:51:12 am »
Thank you, Khrys. This helped.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

LemonParty

  • Sr. Member
  • ****
  • Posts: 353
Re: AARCH64, instruction encoding
« Reply #4 on: September 11, 2025, 07:11:25 pm »
If anybody else interesting in this topic I found a site with a good documentation:
https://finkmartin.com/aarch64/index.html
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Khrys

  • Sr. Member
  • ****
  • Posts: 342
Re: AARCH64, instruction encoding
« Reply #5 on: September 12, 2025, 06:43:54 am »
If anybody else interesting in this topic I found a site with a good documentation:
https://finkmartin.com/aarch64/index.html

Thanks for sharing this!  :)  I'll add a bookmark and place it next to Félix Cloutier's x86 reference.
Love this kind of static site that loads instantly and does only one thing, but does so extremely well.

 

TinyPortal © 2005-2018