<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 - [ppc] Slow code for reverse bits"
   href="https://bugs.llvm.org/show_bug.cgi?id=33093">33093</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ppc] Slow code for reverse bits
          </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: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>carrot@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The reverse bits source code is:

unsigned int ReverseBits(unsigned int n) {
  n = ((n >> 1) & 0x55555555) | ((n & 0x55555555) << 1);
  n = ((n >> 2) & 0x33333333) | ((n & 0x33333333) << 2);
  n = ((n >> 4) & 0x0F0F0F0F) | ((n & 0x0F0F0F0F) << 4);
  return ((n & 0xff000000u) >> 24) | ((n & 0x00ff0000u) >> 8) | ((n &
0x0000ff00u) << 8) | ((n & 0x000000ffu) << 24);

}

LLVM generates:

# BB#0:                                 # %entry
        rlwinm 4, 3, 1, 0, 31
        rlwimi 4, 3, 3, 30, 30
        rlwimi 4, 3, 5, 29, 29
        rlwimi 4, 3, 7, 28, 28
        rlwimi 4, 3, 9, 27, 27
        rlwimi 4, 3, 11, 26, 26
        rlwimi 4, 3, 13, 25, 25
        rlwimi 4, 3, 15, 24, 24
        rlwimi 4, 3, 17, 23, 23
        rlwimi 4, 3, 19, 22, 22
        rlwimi 4, 3, 21, 21, 21
        rlwimi 4, 3, 23, 20, 20
        rlwimi 4, 3, 25, 19, 19
        rlwimi 4, 3, 27, 18, 18
        rlwimi 4, 3, 29, 17, 17
        rlwimi 4, 3, 31, 16, 16
        rlwimi 4, 3, 3, 14, 14
        rlwimi 4, 3, 5, 13, 13
        rlwimi 4, 3, 7, 12, 12
        rlwimi 4, 3, 9, 11, 11
        rlwimi 4, 3, 11, 10, 10
        rlwimi 4, 3, 13, 9, 9
        rlwimi 4, 3, 15, 8, 8
        rlwimi 4, 3, 17, 7, 7
        rlwimi 4, 3, 19, 6, 6
        rlwimi 4, 3, 21, 5, 5
        rlwimi 4, 3, 23, 4, 4
        rlwimi 4, 3, 25, 3, 3
        rlwimi 4, 3, 27, 2, 2
        rlwimi 4, 3, 29, 1, 1
        rlwimi 4, 3, 31, 0, 0
        mr 3, 4
        blr

All of the instructions are in a dependence chain. It is much slower than the
algorithm shown in the source code.</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>