Home > OS >  How do I interpret the instruction `mov v2.2d[0],x14` in aarch64 assembly?
How do I interpret the instruction `mov v2.2d[0],x14` in aarch64 assembly?

Time:04-19

I have run into this line in an assembly program:

mov v2.2d[0],x14

and I'm having a very difficult time understanding what it does.

It appears to be a NEON instruction but I can't understand what it is doing nor how to tickle clang into compiling it. What is this instruction doing?

CodePudding user response:

From the manual:

C7.2.201 MOV (from general)

[...] This instruction can insert data into individual elements within a SIMD&FP register without clearing the remaining bits to zero.

Its form is MOV <Vd>.<Ts>[<index>], <R><n>, where <Ts> is one of B, H, S or D.
So the solution you're looking for is:

mov v2.d[0], x14

The vector registers are a bit weird in that some instructions require a number in front of the element selector to determine whether it should be used as a 64-bit or 128-bit vector, whereas in other instructions this is implied and thus there is no number in front of the element selector.

The fact that GCC allows the number to be specified in any context is a non-standard extension.

  • Related