<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - will it blend? apparently not [SSE, AVX, X86]"
   href="http://llvm.org/bugs/show_bug.cgi?id=22483">22483</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>will it blend? apparently not [SSE, AVX, X86]
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>define float @blendv(float %x, float %y) {
  %cmp = fcmp oge float %x, %y
  %sel = select i1 %cmp, float %x, float %y
  ret float %sel
}

Or in C:

float blendv(float x, float y) {
        if (x >= y) return x;
        return y;
}

There are no scalar FP select instructions for xmm registers (at least through
AVX2 from what I can tell)...just like there are no scalar FP logical ops (and,
xor, or, andn). Consistent unorthogonality?

Currently (r228316), we generate:
$ llc  -mattr=avx blend.ll -o -
...
    vcmpless    %xmm0, %xmm1, %xmm2
    vandps    %xmm0, %xmm2, %xmm0
    vandnps    %xmm1, %xmm2, %xmm1
    vorps    %xmm0, %xmm1, %xmm0
    retq

I think that we'd be better off using 'vblendvps'; this was added with SSE4.1:
    vcmpless    %xmm0, %xmm1, %xmm2
    vblendvps    %xmm2, %xmm0, %xmm1, %xmm0
    retq

I'm not sure what's in bits 32:127 of the output reg in either case, but we're
not worse off using blendv?

FWIW, icc 15 just does a compare and branch:
        vcomiss   %xmm1, %xmm0
        jae       L_L3
        vmovaps   %xmm1, %xmm0
L_L3:
        ret</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>