<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 - Regression: LLVM9 trunk misoptimization of llvm.x86.sse.movmsk.ps for i586-unknown-linux-gnu"
   href="https://bugs.llvm.org/show_bug.cgi?id=42870">42870</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression: LLVM9 trunk misoptimization of llvm.x86.sse.movmsk.ps for i586-unknown-linux-gnu
          </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>release blocker
          </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>gonzalobg88@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLVM8 opt and LLVM9 (trunk) opt, do optimize llvm.x86.sse.movmsk.ps
differently. LLVM8 leaves it as is, while LLVM9 transforms it to (see godbolt:
<a href="https://godbolt.org/z/35BloZ">https://godbolt.org/z/35BloZ</a>): 

define i32 @_ZN7example15_mm_movemask_ps17h9d7ca884d8f840c4E(<4 x float>*
noalias nocapture readonly dereferenceable(16) %a) unnamed_addr #0 {
start:
  %0 = bitcast <4 x float>* %a to <4 x i32>*
  %1 = load <4 x i32>, <4 x i32>* %0, align 16
  %2 = icmp slt <4 x i32> %1, zeroinitializer
  %3 = bitcast <4 x i1> %2 to i4
  %4 = zext i4 %3 to i32
  ret i32 %4
}

As a consequence, LLVM8 produces the following machine code for mm_movemask_ps
on i586-unknown-linux-gnu:

example::_mm_movemask_ps: # @example::_mm_movemask_ps
        mov     eax, dword ptr [esp + 4]
        movaps  xmm0, xmmword ptr [eax]
        movmskps        eax, xmm0
        ret

while LLVM9 produces:

example::_mm_movemask_ps: # @example::_mm_movemask_ps
        mov     eax, dword ptr [esp + 4]
        cmp     dword ptr [eax], 0
        sets    cl
        cmp     dword ptr [eax + 4], 0
        sets    dl
        add     dl, dl
        or      dl, cl
        cmp     dword ptr [eax + 8], 0
        sets    cl
        cmp     dword ptr [eax + 12], 0
        sets    al
        add     al, al
        or      al, cl
        shl     al, 2
        or      al, dl
        movzx   eax, al
        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>