[llvm] dc764a2 - [ComplexDeinterleaving] Propagate fast math flags to symmetric operations.

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 04:12:09 PDT 2023


Author: David Green
Date: 2023-03-28T12:12:02+01:00
New Revision: dc764a2e2d0cfb621547d44bba2e55f11d129ed5

URL: https://github.com/llvm/llvm-project/commit/dc764a2e2d0cfb621547d44bba2e55f11d129ed5
DIFF: https://github.com/llvm/llvm-project/commit/dc764a2e2d0cfb621547d44bba2e55f11d129ed5.diff

LOG: [ComplexDeinterleaving] Propagate fast math flags to symmetric operations.

This is a simple patch to make sure fast math flags are propagated through to
the newly created symmetric operations, which can help with later
simplifications.

Differential Revision: https://reviews.llvm.org/D146409

Added: 
    

Modified: 
    llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
    llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
index fcc25d900e6ed..36fad9e6f9585 100644
--- a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
+++ b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
@@ -918,13 +918,13 @@ static Value *replaceSymmetricNode(ComplexDeinterleavingGraph::RawNodePtr Node,
 
   switch (I->getOpcode()) {
   case Instruction::FNeg:
-    return B.CreateFNeg(InputA);
+    return B.CreateFNegFMF(InputA, I);
   case Instruction::FAdd:
-    return B.CreateFAdd(InputA, InputB);
+    return B.CreateFAddFMF(InputA, InputB, I);
   case Instruction::FSub:
-    return B.CreateFSub(InputA, InputB);
+    return B.CreateFSubFMF(InputA, InputB, I);
   case Instruction::FMul:
-    return B.CreateFMul(InputA, InputB);
+    return B.CreateFMulFMF(InputA, InputB, I);
   }
 
   return nullptr;

diff  --git a/llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll b/llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll
index fd989180ae152..9aa6a856bc02c 100644
--- a/llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll
+++ b/llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll
@@ -358,10 +358,9 @@ entry:
 define <4 x float> @mul_addequal(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
 ; CHECK-LABEL: mul_addequal:
 ; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    movi v3.2d, #0000000000000000
-; CHECK-NEXT:    fcmla v3.4s, v0.4s, v1.4s, #0
-; CHECK-NEXT:    fcmla v3.4s, v0.4s, v1.4s, #90
-; CHECK-NEXT:    fadd v0.4s, v3.4s, v2.4s
+; CHECK-NEXT:    fcmla v2.4s, v0.4s, v1.4s, #0
+; CHECK-NEXT:    fcmla v2.4s, v0.4s, v1.4s, #90
+; CHECK-NEXT:    mov v0.16b, v2.16b
 ; CHECK-NEXT:    ret
 entry:
   %strided.vec = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>


        


More information about the llvm-commits mailing list