<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 - More efficient remainder lowering"
   href="https://bugs.llvm.org/show_bug.cgi?id=32464">32464</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>More efficient remainder lowering
          </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>Windows NT
          </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: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>davide@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>efriedma@codeaurora.org, llvm-bugs@lists.llvm.org, mcrosier@codeaurora.org, t.p.northover@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given the following IR:

<span class="quote">> cat remainder.ll</span >
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnu"

define i32 @tinky(i32 %j) local_unnamed_addr #0 {
entry:
  %rem = srem i32 %j, 255
  ret i32 %rem
}

attributes #0 = { norecurse nounwind readnone
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false"
"less-precise-fpmad"="false" "no-frame-pointer-elim"="true"
"no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false"
"no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="cortex-a53"
"target-features"="+crc,-crypto,-fp-armv8,-neon" "unsafe-fp-math"="false"
"use-soft-float"="false" }

!llvm.ident = !{!0}


Fast-isel seems to generate slightly faster/shorter code than SelectionDAG:

<span class="quote">> C:\Users\fluttershy\work\llvm-msvc\Debug\bin\llc.exe -O3 -mcpu=cortex-a53 remainder.ll -o - -fast-isel</span >
        .text
        .file   "remainder.ll"
        .globl  tinky
        .p2align        2
        .type   tinky,@function
tinky:                                  // @tinky
// BB#0:                                // %entry
        orr     w8, wzr, #0xff
        sdiv    w9, w0, w8
        msub    w0, w9, w8, w0
        ret
.Lfunc_end0:
        .size   tinky, .Lfunc_end0-tinky


        .ident  "clang version 5.0.0 (trunk 298784) (llvm/trunk 298825)"
        .section        ".note.GNU-stack","",@progbits


<span class="quote">> C:\Users\fluttershy\work\llvm-msvc\Debug\bin\llc.exe -O3 -mcpu=cortex-a53 remainder.ll -o -</span >
        .text
        .file   "remainder.ll"
        .globl  tinky
        .p2align        2
        .type   tinky,@function
tinky:                                  // @tinky
// BB#0:                                // %entry
        orr     w8, wzr, #0xff
        sdiv    w8, w0, w8
        lsl     w9, w8, #8
        sub             w8, w9, w8
        sub             w0, w0, w8
        ret
.Lfunc_end0:
        .size   tinky, .Lfunc_end0-tinky


        .ident  "clang version 5.0.0 (trunk 298784) (llvm/trunk 298825)"
        .section        ".note.GNU-stack","",@progbits</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>