Skip to content

Commit

Permalink
[ComplexDeinterleaving] Propagate fast math flags to symmetric operat…
Browse files Browse the repository at this point in the history
…ions.

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
  • Loading branch information
davemgreen committed Mar 28, 2023
1 parent 2360e53 commit dc764a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
Expand Up @@ -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;
Expand Down
Expand Up @@ -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>
Expand Down

0 comments on commit dc764a2

Please sign in to comment.