<html>
    <head>
      <base href="https://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 --- - inefficient code for i16 bit"
   href="https://llvm.org/bugs/show_bug.cgi?id=31667">31667</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>inefficient code for i16 bit
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>asaf.badouh@intel.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>asaf.badouh@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>amjad.aboud@intel.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given:
define i16 @test(i16 %data) {
entry:
  %shr1 = lshr i16 %data, 1
  %shr1.1 = lshr i16 %data, 3
  %ret = sub i16 %shr1.1, %shr1
  ret i16 %ret
}

Generated asm:
movl    %ecx, %eax
andl    $65528, %eax  # imm = 0xFFF8
andl    $65534, %ecx  # imm = 0xFFFE
shrl    %ecx
shrl    $3, %eax
subl    %ecx, %eax
retq

The optimal expected asm:
andl    $65535, %eax  # imm = 0xFFFF
movl    %eax, %ecx
shrl    %ecx
shrl    $3, %eax
subl    %ecx, %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>