https://bugs.llvm.org/show_bug.cgi?id=32464
Bug ID: 32464
Summary: More efficient remainder lowering
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: AArch64
Assignee: unassignedb...@nondot.org
Reporter: dav...@freebsd.org
CC: efrie...@codeaurora.org, llvm-bugs@lists.llvm.org,
mcros...@codeaurora.org, t.p.northo...@gmail.com
Given the following IR:
> cat remainder.ll
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:
> C:\Users\fluttershy\work\llvm-msvc\Debug\bin\llc.exe -O3 -mcpu=cortex-a53
> remainder.ll -o - -fast-isel
.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
> C:\Users\fluttershy\work\llvm-msvc\Debug\bin\llc.exe -O3 -mcpu=cortex-a53
> remainder.ll -o -
.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
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs