[PATCH] [AArch64] Combine multiple FDIVs with the same divisor

Hao Liu Hao.Liu at arm.com
Wed Nov 19 23:04:36 PST 2014


Hi t.p.northover,

Hi Tim and other reviewers,

This patch try to combine multiple FDIVs with the same divisor to one FDIV and multiple FMULs. This can have benefit on performance because a FMUL is much faster than a FDIV.
E.g. we combine:
       a / D; 
       b / D; 
       c / D;
To
       recip = 1.0 / D;
       a * recip;
       b * recip;
       c * recip;

This is not always benefit, as we can see that the critical path increases from one FDIV to one FDIV and one FMUL, which may cause regressions. So this patch will only do such combine when there are more than 2 FDIVs.

This patch can only benefit some special benchmarks. 
Our performance test on Cortex-A57 shows only SPEC2006 benchmark 188.ammp has 2.5%-3.0% improvement.

Review please.

Thanks,
-Hao

http://reviews.llvm.org/D6334

Files:
  lib/Target/AArch64/AArch64ISelLowering.cpp
  test/CodeGen/AArch64/fdiv-combine.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6334.16414.patch
Type: text/x-patch
Size: 8148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141120/f99ecaa9/attachment.bin>


More information about the llvm-commits mailing list