[PATCH] D28196: [X86] Tune bypassing of slow division for Intel CPUs

Nikolai Bozhenov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 31 06:43:46 PST 2016


n.bozhenov created this revision.
n.bozhenov added reviewers: spatel, craig.topper, bkramer, jlebar.
n.bozhenov added subscribers: llvm-commits, zansari, DavidKreitzer, aaboud, volkalexey.

64-bit integer division in Intel CPUs is extremely slow, much slower
than 32-bit division. On the other hand, 8-bit and 16-bit divisions
aren't any faster. The only important exception is Atom where DIV8
is fastest. Because of that, the patch

1. Enables bypassing of 64-bit division for Atom, Silvermont and all big cores.
2. Modifies 64-bit bypassing to use 32-bit division instead of 16-bit one. This doesn't make the shorter division slower but increases chances of taking it. Moreover, it's much more likely to prove at compile-time that a value fits 32 bits and doesn't require a run-time check (e.g. zext i32 to i64).


https://reviews.llvm.org/D28196

Files:
  lib/Target/X86/X86.td
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86Subtarget.h
  test/CodeGen/X86/atom-bypass-slow-division-64.ll
  test/CodeGen/X86/slow-div.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28196.82763.patch
Type: text/x-patch
Size: 5432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161231/e30cdb39/attachment.bin>


More information about the llvm-commits mailing list