<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 --- - extra moves generated for unary SSE ops"
   href="http://llvm.org/bugs/show_bug.cgi?id=22206">22206</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>extra moves generated for unary SSE ops
          </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>This is SSE (but not AVX) fallout from fixing correctness in <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - SQRTSS and similar scalar SSE insns are not accurately modelled"
   href="show_bug.cgi?id=14221">bug 14221</a>. This
was originally reported by Michael Kuperstein in <a href="http://reviews.llvm.org/D6885">http://reviews.llvm.org/D6885</a>.

Using llc built from r225612:

$ cat sqrtss.ll
define float @sqrtss(<4 x float> %a) {
    %res = tail call <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float> %a) nounwind
    %new = extractelement <4 x float> %res, i32 0
    %orig = extractelement <4 x float> %a, i32 0
    %add = fadd float %new, %orig
    ret float %add
}
declare <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float>) nounwind readnone 

$ ./llc sqrtss.ll -o -
..
    movaps    %xmm0, %xmm1   ## copy original value because...
    sqrtss    %xmm1, %xmm1   ## current unary op def requires src == dst
    addss    %xmm0, %xmm1   ## different bug here...
    movaps    %xmm1, %xmm0   ## could have swapped add operands to avoid mov
    retq</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>