<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 --- - [AVX512] bitcast and compare of compile-time i1 vector not optimized well"
   href="http://llvm.org/bugs/show_bug.cgi?id=20678">20678</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AVX512] bitcast and compare of compile-time i1 vector not optimized well
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>matt@pharr.org
          </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>Created <span class=""><a href="attachment.cgi?id=12906" name="attach_12906" title="test case">attachment 12906</a> <a href="attachment.cgi?id=12906&action=edit" title="test case">[details]</a></span>
test case

The attached test program has the following at its start:

  br i1 icmp ne (i16 bitcast (<16 x i1> <i1 true, i1 true, i1 true, i1 true, i1
true, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 false, i1
false, i1 false, i1 false, i1 false> to i16), i16 0), label %safe_if_run_true,
label %safe_if_after_true

It seems that LLVM isn't determining that this is a compile-time constant test,
since the following code is generated for the function.  (In addition to the
unnecessary movw/testw/je at the start, not also that there is a redundant movw
after the je.)

_add___UM_vyfvyf:                       ## @add___UM_vyfvyf
## BB#0:                                ## %allocas
    movw    $255, %ax
    testw    %ax, %ax
    je    LBB1_2
## BB#1:                                ## %safe_if_run_true
    movw    $255, %ax
    kmovw     %eax, %k1
    vmovups    %zmm1, _array(%rip) {%k1}
LBB1_2:                                 ## %safe_if_after_true
    vaddps     %zmm1, %zmm0, %zmm0
    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>