title: What's the equivalent of _mm_hadd_ps in NEON?
body: <p>I'm trying to convert the following code from SSE into NEON for Apple's 64-bit iOS devices:</p>
  
  <pre><code>void Matrix::TransformPoint( const float vec[ 4 ], const Matrix&amp; matTrans, float out[ 4 ] )
  {
      alignas( 16 ) float v4[ 4 ] = { vec[ 0 ], vec[ 1 ], vec[ 2 ], vec[ 3 ] };
  
      __m128 vec4 = _mm_load_ps( v4 );
      __m128 row1 = _mm_load_ps( &amp;matTrans.m[  0 ] );
      __m128 row2 = _mm_load_ps( &amp;matTrans.m[  4 ] );
      __m128 row3 = _mm_load_ps( &amp;matTrans.m[  8 ] );
      __m128 row4 = _mm_load_ps( &amp;matTrans.m[ 12 ] );
  
      __m128 r1 = _mm_mul_ps( row1, vec4 );
      __m128 r2 = _mm_mul_ps( row2, vec4 );
      __m128 r3 = _mm_mul_ps( row3, vec4 );
      __m128 r4 = _mm_mul_ps( row4, vec4 );
  
      __m128 sum_01 = _mm_hadd_ps( r1, r2 );
      __m128 sum_23 = _mm_hadd_ps( r3, r4 );
      __m128 result = _mm_hadd_ps( sum_01, sum_23 );
      _mm_store_ps( out, result );
  }
  </code></pre>
  
  <p>This is what I have so far:</p>
  
  <pre><code>alignas( 16 ) float v4[ 4 ] = { vec[ 0 ], vec[ 1 ], vec[ 2 ], vec[ 3 ] };
  
  float32x4_t vec4 = vld1q_f32( v4 );
  float32x4_t row1 = vld1q_f32( &amp;mat.m[  0 ] );
  float32x4_t row2 = vld1q_f32( &amp;mat.m[  4 ] );
  float32x4_t row3 = vld1q_f32( &amp;mat.m[  8 ] );
  float32x4_t row4 = vld1q_f32( &amp;mat.m[ 12 ] );
  
  float32x4_t r1 = vmulq_f32( row1, vec4 );
  float32x4_t r2 = vmulq_f32( row2, vec4 );
  float32x4_t r3 = vmulq_f32( row3, vec4 );
  float32x4_t r4 = vmulq_f32( row4, vec4 );
  
  float32x4_t sum_01 = ??? &lt;-- How to write this?
  float32x4_t sum_23 = ??? &lt;-- How to write this?
  float32x4_t result = ??? &lt;-- How to write this?
  vst1q_f32( out, result );
  </code></pre>
  
  <p>How do I replace <code>_mm_hadd_ps</code>?</p>