[X86][FMA4] Prefer FMA4 to FMA
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 30 Nov 2015 22:22:06 +0000 (22:22 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 30 Nov 2015 22:22:06 +0000 (22:22 +0000)
commit0f73ee481b5c64201c9be66a309d353ee0a677c8
tree0fcea9fde71fb600f857bc5599bef4da8e524962
parenta586fd2c5665c75c1b2870b1361d794ac25caf9e
[X86][FMA4] Prefer FMA4 to FMA

We currently output FMA instructions on targets which support both FMA4 + FMA (i.e. later Bulldozer CPUS bdver2/bdver3/bdver4).

This patch flips this so FMA4 is preferred; this is for several reasons:

1 - FMA4 is non-destructive reducing the need for mov instructions.
2 - Its more straighforward to commute and fold inputs (although the recent work on FMA has reduced this difference).
3 - All supported targets have FMA4 performance equal or better to FMA - Piledriver (bdver2) in particular has half the throughput when executing FMA instructions.

Its looks like no future AMD processor lines will support FMA4 after the Bulldozer series so we're not causing problems for later CPUs.

Differential Revision: http://reviews.llvm.org/D14997

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254339 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86Subtarget.h
test/CodeGen/X86/fma-commute-x86.ll
test/CodeGen/X86/fma_patterns.ll
test/CodeGen/X86/fma_patterns_wide.ll