Search code examples
androidarmsimdneonarm64

Porting ARM NEON code to AARCH64, many questions


I'm porting some ARM NEON code to 64-bit ARM-v8, but I can't find a good documentation about it.

Many features seems to be gone, and I don't know how to implement the same function without using them.

So, the general question is: where can I find a complete reference for the new SIMD implementation, including explanation of how to do the same simple tasks which are explained in the many ARM-NEON tutorials?

Some questions about particular features:

1 - How do I load a value in all the lane of a Dx register? The old code was

    mov R0, #42
    vdup.8 D0, R0

My guess is:

    mov W0, #42
    dup V0.8B, W0

2 - How do I load multiple Dx/Qx registers with interleaved data? In the old code this was:

    vld4.8 {D0-D3}, [R0]!

But I can't find anything in the new docs.

I understand it's a completely new model, but it's not very well-documented (or at least, I'm unable to find any reference with readable samples)


Solution

  • The documentation on using ARMv8 in Android is not very good, but for your specific questions, they're answered quite well in this document:

    ARMv8 Instruction Set Overview

    To answer your specific questions:

    mov R0, #42
    vdup.8 D0, R0
    

    becomes

    mov w0,#42
    dup v0.8b,w0
    

    and

    vld4.8 {d0-d3}, [r0]!
    

    becomes

     ld4 {v0.8b,v1.8b,v2.8b,v3.8b},[x0],#32