Search code examples
armneon

arm neon - divide 32x4x2 into two 32x4


I'm new to Arm and Neon.

I wanna divide int32x4x2_t A into two int32x4_t B1, int32x4_t B2.

So, if A = [1 2 3 4; 5 6 7 8], I want to make B1 to [1 2 3 4] and B2 to [5 6 7 8]

I tried

B1 = vld1q_s32(A);
B2 = vld1q_s32(A+4);

But it does not work.

How can I fix it?


Solution

  • int32x4x2_t is really just a struct that looks like

    typedef struct int32x4x2_t {
      int32x4_t val[2];
    } int32x4x2_t;
    

    So all you have to do is

    B1 = A.val[0];
    B2 = A.val[1];