<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - x86 backend widens v2f32 vectors only to do more work in software operations later for `sin`, `cos` etc."
   href="https://bugs.llvm.org/show_bug.cgi?id=38527">38527</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>x86 backend widens v2f32 vectors only to do more work in software operations later for `sin`, `cos` etc.
          </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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>simonas+llvm.org@kazlauskas.me
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20678" name="attach_20678" title="Simple fsin call on v2f32">attachment 20678</a> <a href="attachment.cgi?id=20678&action=edit" title="Simple fsin call on v2f32">[details]</a></span>
Simple fsin call on v2f32

Given the attached LLVM IR, running llc on it as such

<span class="quote">> llc winsimd.ll -O3 -filetype=asm -o -</span >

Will result in following assembly being generated


        movq    %rdi, %rbx
        movsd   (%rdi), %xmm0           # xmm0 = mem[0],zero
        movaps  %xmm0, (%rsp)           # 16-byte Spill
        callq   sinf
        movaps  %xmm0, 16(%rsp)         # 16-byte Spill
        movaps  (%rsp), %xmm0           # 16-byte Reload
        callq   sinf
        movaps  16(%rsp), %xmm1         # 16-byte Reload
        unpcklps        %xmm0, %xmm1    # xmm1 =
xmm1[0],xmm0[0],xmm1[1],xmm0[1]
        movaps  %xmm1, 16(%rsp)         # 16-byte Spill
        movaps  (%rsp), %xmm0           # 16-byte Reload
        callq   sinf
        movaps  %xmm0, 32(%rsp)         # 16-byte Spill
        pshufd  $229, (%rsp), %xmm0     # 16-byte Folded Reload
                                        # xmm0 = mem[1,1,2,3]
        callq   sinf
        movdqa  32(%rsp), %xmm1         # 16-byte Reload
        punpckldq       %xmm0, %xmm1    # xmm1 =
xmm1[0],xmm0[0],xmm1[1],xmm0[1]
        <snip>

Note how this generates 4 distinct calls to `sinf`, although 2 should be
sufficient. This happens, because the backend legalises the operation on v2f32
to v4f32, as indicated by `-debug` output from `llc`. However, the backend then
neglects to take care to not calculate `sinf` on the `undef` components of the
vector, resulting in extra work.</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>