<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 - vpmovmskb+cmp equivalent to vmovmskps+cmp should maybe lower to vmovmskps"
   href="https://bugs.llvm.org/show_bug.cgi?id=37087">37087</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>vpmovmskb+cmp equivalent to vmovmskps+cmp should maybe lower to vmovmskps
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </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>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This snippet of code (see it live: <a href="https://godbolt.org/g/NuiGgc">https://godbolt.org/g/NuiGgc</a>):

Generates:

wrong_instr: # @wrong_instr
  vmovaps xmm0, xmmword ptr [rsi]
  vcmpeqps xmm0, xmm0, xmmword ptr [rdi]
  vpmovmskb eax, xmm0
  cmp eax, 65535
  sete al
  ret
correct_instr: # @correct_instr
  vmovaps xmm0, xmmword ptr [rsi]
  vcmpeqps xmm0, xmm0, xmmword ptr [rdi]
  vmovmskps eax, xmm0
  cmp eax, 15
  sete al
  ret

Note how "wrong_istr" uses, as specified, pmovmskb. AFAICT both snippets are
semantically equivalent.

On broadwell and haswell these intrinsics have identical performance (from
Agner's tables):

PMOVMSKB r,v   mops fused: 1 mops unfused: 1 ports: p0 latency: 3 throughput: 1
MOVMSKPS r32,x mops fused: 1 mops unfused: 1 ports: p0 latency: 3 throughput: 1

On skylake MOVMSKPS appears to be slightly better:

PMOVMSKB   r,v mops fused: 1 mops unfused: 1 ports: p0 latency: 2-3 throughput:
1
MOVMSKPS r32,x mops fused: 1 mops unfused: 1 ports: p0 latency: 2   throughput:
1

Depending on the CPU, switching from operating on floating-point vectors to
operating on integer vectors might introduce extra latency in which case
movmskps would be preferable in this situation.</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>