Switch the canonical FMA term operand order to match both the comment I wrote and...
authorOwen Anderson <resistor@mac.com>
Wed, 30 May 2012 18:54:50 +0000 (18:54 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 30 May 2012 18:54:50 +0000 (18:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157708 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/ARM/fusedMAC.ll

index 647ff6b6b206a3aaa897916349094dcac3980930..3b8489f03b92654ce08d57062de44a81c704301d 100644 (file)
@@ -5771,7 +5771,7 @@ SDValue DAGCombiner::visitFMA(SDNode *N) {
     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();
index 8ebca02df99d59dd54e24756c8c1b9f19f14ed7d..da0789ec3e5fb44712c9309090089635046ec01b 100644 (file)
@@ -192,7 +192,7 @@ define float @test_fma_const_fold(float %a, float %b) nounwind {
 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
 }