[PATCH] D31169: [DAGCombiner] Initial support for the fast-math flag contract

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 09:42:14 PDT 2017


anemet marked 7 inline comments as done.
anemet added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:8753-8756
+  if (Aggressive && isContractableFMUL(N0) && isContractableFMUL(N1)) {
     if (N0.getNode()->use_size() > N1.getNode()->use_size())
       std::swap(N0, N1);
   }
----------------
spatel wrote:
> I think this diff exposes a possibility that didn't exist before, so it's worth adding a test for it:
> 
>   define float @cannot_choose_fma(float %f1, float %f2, float %f3, float %f4) {
>     %mul1 = fmul contract float %f1, %f2
>     %mul2 = fmul float %f3, %f4
>     %add = fadd contract float %mul1, %mul2
>     %second_use_of_mul1 = fdiv float %mul1, %add
>     ret float %second_use_of_mul1
>   }
> 
>   $ ./llc -o - fma.ll -mtriple=powerpc64-darwin 
>     fmuls f0, f3, f4
>     fmuls f13, f1, f2
>     fmadds f0, f1, f2, f0
>     fdivs f1, f13, f0
> 
Makes sense, I've added it.  Thanks for all your feedback and sorry again about the testing mishap.  I haven't worked on the backend for a while.


https://reviews.llvm.org/D31169





More information about the llvm-commits mailing list