<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 - [x86] unnecessary clearing of bits with 16-bit value"
   href="https://bugs.llvm.org/show_bug.cgi?id=39840">39840</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[x86] unnecessary clearing of bits with 16-bit value
          </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>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>spatel+llvm@rotateright.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>As discussed here:
<a href="https://reviews.llvm.org/D54640">https://reviews.llvm.org/D54640</a>

We have this regression test in:
test/CodeGen/X86/clear-lowbits.ll

define i16 @clear_lowbits16_ic0(i16 %val, i16 %numlowbits) nounwind {
  %numhighbits = sub i16 16, %numlowbits
  %mask = shl i16 -1, %numhighbits
  %masked = and i16 %mask, %val
  ret i16 %masked
}

$ llc -o - lowbits.ll
        movzwl  %di, %eax   <--- don't need this
        movl    $16, %ecx
        subl    %esi, %ecx
        shrl    %cl, %eax
        shll    %cl, %eax
        retq

(Note that D54640 will modify that output slightly, but not the leading
'movzwl'.)</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>