[PATCH] D14997: [X86][FMA4] Prefer FMA4 to FMA

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 14:25:06 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL254339: [X86][FMA4] Prefer FMA4 to FMA (authored by RKSimon).

Changed prior to commit:
  http://reviews.llvm.org/D14997?vs=41177&id=41436#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14997

Files:
  llvm/trunk/lib/Target/X86/X86Subtarget.h
  llvm/trunk/test/CodeGen/X86/fma-commute-x86.ll
  llvm/trunk/test/CodeGen/X86/fma_patterns.ll
  llvm/trunk/test/CodeGen/X86/fma_patterns_wide.ll

Index: llvm/trunk/test/CodeGen/X86/fma_patterns_wide.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/fma_patterns_wide.ll
+++ llvm/trunk/test/CodeGen/X86/fma_patterns_wide.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast | FileCheck %s --check-prefix=FMA
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=FMA
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=FMA4
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast | FileCheck %s --check-prefix=FMA4
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f -fp-contract=fast | FileCheck %s --check-prefix=AVX512
 
Index: llvm/trunk/test/CodeGen/X86/fma-commute-x86.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/fma-commute-x86.ll
+++ llvm/trunk/test/CodeGen/X86/fma-commute-x86.ll
@@ -1,5 +1,5 @@
 ; RUN: llc < %s -mtriple=x86_64-pc-win32 -mcpu=core-avx2 | FileCheck %s
-; RUN: llc < %s -mtriple=x86_64-pc-win32 -mattr=+fma,+fma4 | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-pc-win32 -mattr=+fma | FileCheck %s
 ; RUN: llc < %s -mcpu=bdver2 -mtriple=x86_64-pc-win32 -mattr=-fma4 | FileCheck %s
 
 attributes #0 = { nounwind }
Index: llvm/trunk/test/CodeGen/X86/fma_patterns.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/fma_patterns.ll
+++ llvm/trunk/test/CodeGen/X86/fma_patterns.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4,+fma -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA4
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+fma4 -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=FMA4
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=AVX512
 
Index: llvm/trunk/lib/Target/X86/X86Subtarget.h
===================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h
@@ -354,9 +354,10 @@
   bool hasXSAVEC() const { return HasXSAVEC; }
   bool hasXSAVES() const { return HasXSAVES; }
   bool hasPCLMUL() const { return HasPCLMUL; }
-  bool hasFMA() const { return HasFMA; }
-  // FIXME: Favor FMA when both are enabled. Is this the right thing to do?
-  bool hasFMA4() const { return HasFMA4 && !HasFMA; }
+  // Prefer FMA4 to FMA - its better for commutation/memory folding and
+  // has equal or better performance on all supported targets.
+  bool hasFMA() const { return HasFMA && !HasFMA4; }
+  bool hasFMA4() const { return HasFMA4; }
   bool hasXOP() const { return HasXOP; }
   bool hasTBM() const { return HasTBM; }
   bool hasMOVBE() const { return HasMOVBE; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14997.41436.patch
Type: text/x-patch
Size: 3440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151130/4f5957d5/attachment.bin>


More information about the llvm-commits mailing list