Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 981523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:33:19+00:00 2026-05-16T04:33:19+00:00

I have a A = a1 a2 a3 a4 b1 b2 b3 b4 c1

  • 0

I have a

A = a1 a2 a3 a4
    b1 b2 b3 b4
    c1 c2 c3 c4
    d1 d2 d3 d4

I have 2 rows with me,

float32x2_t a = a1 a2
float32x2_t b = b1 b2

From these how can I get a –

float32x4_t result = b1 a1 b2 a2

Is there any single NEON SIMD instruction which can merge these two rows?
Or how can I achieve this using as minimum steps as possible using intrinsics?

I thought of using the zip/unzip intrinsics but the datatype the zip function returns, which is float32x2x2_t, is not suitable for me, I need a float32x4_t datatype.

float32x2x2_t vzip_f32 (float32x2_t, float32x2_t)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:33:19+00:00Added an answer on May 16, 2026 at 4:33 am

    This is difficult.. There is not a single instruction that can do this, and the best solution depends on if your data is in memory or if they are already in registers.

    You need two operations at least to do the conversion.. First a vector turn which permutes your arguments like this:

    a = a1 a2
    b = b1 b2
    
    vtrn.32  a, b
    
    a = a1 b1 
    b = a2 b2
    

    And then you have to swap the arguments of each operation. Either by reversing each vector on it’s own or by treating the two vectors as a quad vector and do a long reverse.

    temp = {a, b} 
    temp = a1 b1 a2 b2
    
    vrev64.32 temp, temp
    
    temp = b1 a1 b2 a2    <-- this is what you want.
    

    If you load your data from memory you can skip the first vtrn.32 instruction because NEON can do this while it loads the data using the vld2.32 instruction. Here is a little assembler function that does just that:

    .globl asmtest
    
    asmtest:
            vld2.32     {d0-d1}, [r0]   # load two vectors and transose
            vrev64.32   q0, q0          # reverse within d0 and d1
            vst1.32     {d0-d1}, [r0]   # store result
            mov pc, lr                  # return from subroutine..
    

    Btw, a little note: The instructions vtrn.32, vzip.32 and vuzp.32 are identical (but only if you’re working with 32 bit entities)

    And with NEON intrinsics? Well – simply said you’re screwed. As you’ve already found out you can’t directly cast from one type to another and you can’t directly mix quad and double vectors.

    This is the best I came up with using intrinsics (it does not use the vld2.32 trick for readability):

    int main (int argc, char **args)
    {
      const float32_t data[4] =
      {
        1, 2, 3, 4
      };
    
      float32_t     output[4];
    
      /* load test vectors */
      float32x2_t   a = vld1_f32 (data + 0);
      float32x2_t   b = vld1_f32 (data + 2);
    
      /* transpose and convert to float32x4_t */
      float32x2x2_t temp   = vzip_f32 (b,a);
      float32x4_t   result = vcombine_f32 (temp.val[0], temp.val[1]);
    
      /* store for printing */
      vst1q_f32 (output, result);
    
      /* print out the original and transposed result */
      printf ("%f %f %f %f\n", data[0],   data[1],   data[2],   data[3]);
      printf ("%f %f %f %f\n", output[0], output[1], output[2], output[3]);
    }
    

    If you’re using GCC this will work, but the code generated by GCC will be horrible and slow. NEON intrinsic support is still very young. You’ll probably get better performance with a straight forward C-code here..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have rows over 60000 in my table. How can I delete rows from
I have 5 rows of data coming into my database every 2 hours from
I have rows from a table in jqGrid. I manipulate the behaviour of cellEdit
the main tableview will have rows that is added/created from the user and that
Let's say I have rows of data retrieved from a relational database tables (perhaps
I have rows of text data that can vary between 0 and 100, and
How can we have global Expand/Collapse for JQGrid when we have rows grouped on
I have rows loaded from the database via ajax using jquery. It grabs a
I have rows like these on postgres: name | address | college john |
I have a table which can have rows and columns added to and removed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.