In isel, transform
Num % Den
into
Num - (Num / Den) * Den
if the result of Num / Den is already available.
Paths
| Differential D26090
[NVPTX] Compute 'rem' using the result of 'div', if possible. ClosedPublic Authored by jlebar on Oct 28 2016, 10:55 AM.
Details Summary In isel, transform Num % Den into Num - (Num / Den) * Den if the result of Num / Den is already available.
Diff Detail
Event Timelinejlebar added a parent revision: D26088: Don't leave unused divs/rems sitting around in BypassSlowDivision..Oct 28 2016, 10:56 AM This revision is now accepted and ready to land.Oct 28 2016, 11:21 AM Closed by commit rL285461: [NVPTX] Compute 'rem' using the result of 'div', if possible. (authored by jlebar). · Explain WhyOct 28 2016, 2:53 PM This revision was automatically updated to reflect the committed changes. Comment Actions We've been talking about this on IRC. It would be nice to have this as target-independent option, since on many platforms a generic rem is much slower than a div followed by a multiply/subtract. Only platforms with very slow hardware multiply want to use div and rem as separate instructions.
Revision Contents
Diff 76253 llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/trunk/test/CodeGen/NVPTX/divrem-combine.ll
|