[PATCH] D11926: [NVPTX] Use 32-bit divides instead of 64-bit divides where possible

Mark Heffernan via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 18:18:09 PDT 2015


meheff created this revision.
meheff added reviewers: jingyue, jholewinski.
meheff added a subscriber: llvm-commits.
Herald added a subscriber: jholewinski.

For NVPTX, try to use 32-bit division instead of 64-bit division when the dividend and divisor
fit in 32-bit. This speeds up some internal benchmarks significantly. The underlying reason
is that many index computations are carried out in 64-bits but never actually exceed the
capacity of a 32-bit word.

http://reviews.llvm.org/D11926

Files:
  lib/Target/NVPTX/NVPTXISelLowering.cpp

Index: lib/Target/NVPTX/NVPTXISelLowering.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -124,6 +124,10 @@
   // condition branches.
   setJumpIsExpensive(true);
 
+  // Wide divides are _very_ slow. Try to reduce the width of the divide if
+  // possible.
+  addBypassSlowDiv(64, 32);
+
   // By default, use the Source scheduling
   if (sched4reg)
     setSchedulingPreference(Sched::RegPressure);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11926.31755.patch
Type: text/x-patch
Size: 514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150811/6c2be7ba/attachment.bin>


More information about the llvm-commits mailing list