title: Select unique/deduplication in SSE/AVX
body: <p><strong>Problem</strong><br>
  Are there any computationally feasible approaches to intra-register deduplication of a set of integers using x86 SIMD instructions?</p>
  
  <p><strong>Example</strong><br>
  We have a 4-tuple register R1 = {3, 9, 2, 9}, and wish to obtain register R2 = {3, 9, 2, NULL}.</p>
  
  <p><strong>Restrictions</strong><br>
  <em>Stablility</em>. Preservation of the input order is of no significance.  </p>
  
  <p><em>Output</em>. However, any removed values/NULLs must be at the beginning and/or end of the register:  </p>
  
  <ul>
  <li>{null, 1, 2, 3} - OK</li>
  <li>{1, 2, null, null} - OK</li>
  <li>{null, 2, null, null} - OK</li>
  <li>{null, 2, null, 1} - Invalid order</li>
  <li>{null, null, null, null} - Invalid output</li>
  </ul>
  
  <p>It is obviously a bonus if it is known to produce one particular output format. Please assume NULL to effectively mean 0 (zero).</p>
  
  <p><em>Generality</em>. Must be able to tolerate the absence of duplicates, and in this case produce an output equivalent to the input register.  </p>
  
  <p><em>Instruction sets</em>. I'm looking for solutions for any or all of: SSE2-SSSE3; SSE4.x; AVX-AVX2</p>