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

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 01:38:02 PDT 2023


dmgreen created this revision.
dmgreen added reviewers: NickGuy, samtebbs, SjoerdMeijer, labrinea.
Herald added a subscriber: hiraditya.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D146409

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


Index: llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll
===================================================================
--- llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll
+++ llvm/test/CodeGen/AArch64/complex-deinterleaving-mixed-cases.ll
@@ -358,10 +358,9 @@
 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>
Index: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
===================================================================
--- llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
+++ llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
@@ -918,13 +918,13 @@
 
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146409.506495.patch
Type: text/x-patch
Size: 1646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230320/772f3d1c/attachment.bin>


More information about the llvm-commits mailing list