<html>
    <head>
      <base href="http://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 --- - PPC: 64-bit signed integer division by power of 2 isn't optimized into sradi + addze"
   href="http://llvm.org/bugs/show_bug.cgi?id=20732">20732</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PPC: 64-bit signed integer division by power of 2 isn't optimized into sradi + addze
          </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: PowerPC
          </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>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using llc built from r216267:

$ cat div.ll
define i64 @foo(i64 %n) {
  %div = sdiv i64 %n, 8
  ret i64 %div
}

$ ./llc -mtriple=powerpc64 div.ll -o -
...
    li 4, 8
    divd 3, 3, 4
    blr

-------------------------------------------------------

I think this can be optimized to:
       sradi 3, 3, 3
    addze 3, 3
    blr



The fix for this bug should model what AArch64TargetLowering::BuildSDIVPow2()
does. PPC should not use "setPow2SDivIsCheap()" to execute the current code in
PPCDAGToDAGISel::Select(). There's a "FIXME" in the code comments about this.</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>