<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 - AVX-512: Extractelement is not optimal for i1 vectors"
   href="https://bugs.llvm.org/show_bug.cgi?id=33692">33692</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AVX-512: Extractelement is not optimal for i1 vectors
          </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>Windows NT
          </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>elena.demikhovsky@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>operation extractelement <16 x i1> %vec, i32 const // Not only 16
can generate more optimal code:

; This code in loop preheader
  %v_mask = icmp slt <16 x i32> %a, %b

; This code inside the loop vector body
  %s_mask = extractelement <16 x i1> %v_mask, i32 5
  br i1 %s_mask, label %pred.if, label %pred.continue

pred.if:                                     
 ..

 pred.continue:

vpcmpgtd        %zmm0, %zmm1, %k0
#The instructions bellow are inside the loop body

kshiftlw        $10, %k0, %k0
kshiftrw        $15, %k0, %k0
kmovd   %k0, %eax
testb   $1, %al
je      .LBB0_2

More optimal code:

 vpcmpgtd        %zmm0, %zmm1, %k0
 vpmovm2b %k0, %xmm2

#The instructions bellow will be inside the loop body

  vpextrb %xmm2, %eax
  testb   $1, %al
  je      .LBB0_2</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>