<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 - Mips2 and Mips3 produce inefficient lowerings for partial shifts"
   href="https://bugs.llvm.org/show_bug.cgi?id=32293">32293</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Mips2 and Mips3 produce inefficient lowerings for partial shifts
          </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>Linux
          </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: MIPS
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kyle+llvm@iteratee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Mips2 and Mips3 produce inefficient lowerings for partial shifts:

on Mips2 shl lowers to code that looks like:

if (!x)
 ... (Don't modify x)
if (!x)
 ...

specifically:

# BB#0:                                 # %entry
        sllv    $1, $5, $7
        andi    $6, $7, 32
        bnez    $6, $BB4_2
        move     $2, $1
# BB#1:                                 # %entry
        sllv    $2, $4, $7
        not     $3, $7
        srl     $4, $5, 1
        srlv    $3, $4, $3
        or      $2, $2, $3
$BB4_2:                                 # %entry
        bnez    $6, $BB4_4
        addiu   $3, $zero, 0
# BB#3:                                 # %entry
        move     $3, $1
$BB4_4:                                 # %entry
        jr      $ra
        nop

With more careful lowering, the double compare can be eliminated:

# BB#0:                                 # %entry
        andi    $6, $7, 32
        beqz    $6, $BB4_2
        sllv    $1, $5, $7
# BB#1:
        move     $2, $1
        jr      $ra
        addiu   $3, $zero, 0
$BB4_2:                                 # %entry
        sllv    $2, $4, $7
        not     $3, $7
        srl     $4, $5, 1
        srlv    $3, $4, $3
        jr      $ra
        or      $2, $2, $3

The lowering produces 2 selects which each create a branch instruction on the
same condition.

If we're worried about this, we could try to produce better code for these
targets in selection dag.</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>