title: Efficiently combine masks in arm neon
body: <p>As part of my calculation I end up with 2 masks stored in 2 uint32x4_t variables. These came from <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489e/CIHGAGID.html" rel="nofollow noreferrer">VCEQ</a>. For further processing I want to combine these into a single q-reg or d-reg. What's preferred approach in arm neon to do it?</p>
  
  <p><a href="https://godbolt.org/g/G29W2s" rel="nofollow noreferrer">Simple solution</a>:</p>
  
  <pre><code>uint16x8_t combineMasks(uint32x4_t mask_lo, uint32x4_t mask_hi)
  {
      uint16x4_t lo = vmovn_u32(mask_lo);
      uint16x4_t hi = vmovn_u32(mask_hi);
      return vcombine_u16(lo, hi);
  }
  </code></pre>
  
  <p>Is there a better way to do it? In my case I <code>vand</code> result mask later on with some values to <a href="https://stackoverflow.com/questions/49683866/find-min-and-position-of-the-min-element-in-uint8x8-t-neon-register">find position of a min/max element</a>.</p>