title: Conditional structures in SSE
body: <p>I have some trouble with a "special" kind of conditional structure in SSE/C++. The following pseudo code illustrates what I want to do:</p>
  
  <pre><code>    for-loop ...
          // some SSE calculations
          __m128i a = ... // a contains four 32-bit ints
          __m128i b = ... // b contains four 32-bit ints
  
          if any of the four ints in a is less than its corresponding int in b
              vector.push_back(e.g. first component of a)
  </code></pre>
  
  <p>So I do quite a few SSE calculations and as the result of these calculations, I have two __m128i values, each containing four 32-bit integer. This part is working fine. But now I want to push something into a vector, if at least one of the four ints in <code>a</code> is less than the corresponding int in <code>b</code>. I have no idea how I can achieve this.</p>
  
  <p>I know the <code>_mm_cmplt_epi32</code> function, but so far I failed to use it to solve my specific problem.</p>
  
  <p>EDIT:</p>
  
  <p>Yeah, actually I'm searching for a clever solution. I have a solution, but that looks very, very strange.</p>
  
  <pre><code>for-loop ...
      // some SSE calculations
      __m128i a = ... // a contains four 32-bit ints
      __m128i b = ... // b contains four 32-bit ints
  
      long long i[2] __attribute__((aligned (16)));
  
      __m128i cmp = _mm_cmplt_epi32(a, b);
      _mm_store_si128(reinterpret_cast&lt;__m128i*&gt;(i), cmp);
  
         if(i[0] || i[1]) {
              vector.push_back(...)
  </code></pre>
  
  <p>I hope, there is a better way...</p>