[llvm-commits] [PATCH]IDIV->DIVB Atom Optimization

Nowicki, Tyler tyler.nowicki at intel.com
Thu Jul 19 16:05:42 PDT 2012


Hi,

Here is an optimization for Intel Atom processors which uses a DIVB instruction rather than an IDIV when both the dividend and divisor are positive values less than 256. We've tested this with a number of benchmark suites and it yields a positive performance improvement due to the slowness of a 32-bit divide on Atom architectures.

Commit message:
IDIV->DIVB optimization
  - Enabled only for Intel Atom with O2
  - Use DIVB instruction rather than IDIV when dividend and divisor are positive less than 256.
  - In the case when the quotient and remainder of a divide are used a DIV and a REM instruction will be present in the IR. In the non-Atom case they are both lowered to IDIVs and CSE removes the redundant IDIV instruction, using the quotient and remainder from the first IDIV. However, due to this optimization CSE is not able to eliminate redundant IDIV instructions because they are located in different basic blocks. This is overcome by calculating both the quotient (DIV) and remainder (REM) in each basic block that is inserted by the optimization and reusing the result values when a subsequent DIV or REM instruction uses the same operands.
  - Test cases check for the optimization when calculating a quotient, remainder, or both.

Tyler Nowicki
Intel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: final_fastdiv_svn.patch
Type: application/octet-stream
Size: 17729 bytes
Desc: final_fastdiv_svn.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120719/4b0d01a8/attachment.obj>


More information about the llvm-commits mailing list