Reputation: 731
This instruction is an ARMv8 neon instruction but I'm not able to understand the elements of it. Can anyone elaborate on this?
Upvotes: 4
Views: 4085
Reputation: 822
The instruction is an ARMv8 Load-Store Multiple Structure; which is an Advanced SIMD instruction.
LD1 - loads multiple 1-element structures
v0 - vector register 0 in this case, could be v1, v2,...
.16b - indicates you are loading 16 (1 byte) elements from memory. This can be 8 or 4H(alve words) or 8H... See the manual for more.
%[n] - I don't know what (%) is for; however, if you're using the instruction directly (i.e., not as an inline, etc) then [] - contains your vector address/pointer or the register holding array address.
In my partial code sample below, you will see a sample array in the .data section. A pointer in x10. The load instruction of 16 single byte elements, then proof of the load in a gdb print statement.
I compiled with gcc; therefore, other compilers may require a different syntax. #armv8 #simd
.data
array: .byte 7,3,1,6,7,1,7,6,5,3,1,3,3,0,6,2,4,9,1,9,2,2,5,1,1,9,6,7,4,4,2,6,5,7,4,7,4,2,3,5,5,3,4,9,1,9,4,9,3,4
...
ldr x10,=array
...
// Load multiple 1-element structures (to one register)
ld1 {v0.16b}, [x10] // load 16 byte values into vector 0
...
(gdb) p $v0.b.s
$4 = {7, 3, 1, 6, 7, 1, 7, 6, 5, 3, 1, 3, 3, 0, 6, 2}
Upvotes: 2
Reputation: 3024
This is not called NEON anymore, the SIMD instructions are part of the armv8 standard set.
So, you load a single register (16 bytes) from a memory location specified by the %[in] parameter.
Upvotes: 2
Reputation: 399703
Looking at the ARM NEON programming quick reference, we learn:
{<prefix>}<op>{<suffix>} Vd.<T>, Vn.<T>, Vm.<T>
.v0
is a 128-bit NEON vector register.16b
matches the <T>
part, which means "type" (16B
means 16 bytes, i.e. the full 128 bits are being used).The in
part probably comes from surrounding C code.
Upvotes: 0