Switch the canonical FMA term operand order to match both the comment I wrote and the usual LLVM convention.
llvm-svn: 157708
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 647ff6b..3b8489f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -5771,7 +5771,7 @@
return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N0, N2);
// Canonicalize (fma c, x, y) -> (fma x, c, y)
- if (!N0CFP && N1CFP)
+ if (N0CFP && !N1CFP)
return DAG.getNode(ISD::FMA, N->getDebugLoc(), VT, N1, N0, N2);
return SDValue();
diff --git a/llvm/test/CodeGen/ARM/fusedMAC.ll b/llvm/test/CodeGen/ARM/fusedMAC.ll
index 8ebca02..da0789e 100644
--- a/llvm/test/CodeGen/ARM/fusedMAC.ll
+++ b/llvm/test/CodeGen/ARM/fusedMAC.ll
@@ -192,7 +192,7 @@
define float @test_fma_canonicalize(float %a, float %b) nounwind {
; CHECK: test_fma_canonicalize
; CHECK: vmov.f32 s0
-; CHECK: vfma.f32 s2, s0, s1
+; CHECK: vfma.f32 s2, s1, s0
%ret = call float @llvm.fma.f32(float 2.0, float %a, float %b)
ret float %ret
}