<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 - [DAGCombine] Scalarizing vector ops with low/one demanded elements"
   href="https://bugs.llvm.org/show_bug.cgi?id=39973">39973</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DAGCombine] Scalarizing vector ops with low/one demanded elements
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>andrea.dibiagio@gmail.com, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>As mentioned in <a href="https://reviews.llvm.org/D55558">https://reviews.llvm.org/D55558</a>

<a href="https://godbolt.org/z/-1CEbS">https://godbolt.org/z/-1CEbS</a>

define i32 @knownbits_mask_extract_sext(<8 x i16> %a0) nounwind {
  %1 = and <8 x i16> %a0, <i16 15, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16
-1, i16 -1>
  %2 = extractelement <8 x i16> %1, i32 0
  %3 = sext i16 %2 to i32
  ret i32 %3
}

As this uses only a single element, should it be scalarized?

knownbits_mask_extract_sext: # @knownbits_mask_extract_sext
  vpand .LCPI0_0(%rip), %xmm0, %xmm0
  vpextrw $0, %xmm0, %eax
  retq

knownbits_mask_extract_sext_alt: # @knownbits_mask_extract_sext_alt
  vmovd %xmm0, %eax
  andl $15, %eax
  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>