From 9ef1127008ce94cf626daed346a3c1ee03063617 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 9 Jul 2022 15:03:54 +0200 Subject: [PATCH] Apply tentative llvm fix for avoiding fma on PowerPC SPE Merge llvm review D77558, by Justin Hibbits: PowerPC: Don't hoist float multiply + add to fused operation on SPE SPE doesn't have a fmadd instruction, so don't bother hoisting a multiply and add sequence to this, as it'd become just a library call. Hoisting happens too late for the CTR usability test to veto using the CTR in a loop, and results in an assert "Invalid PPC CTR loop!". Reported by: alfredo Obtained from: https://reviews.llvm.org/D77558 MFC after: 3 days --- .../llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index d9d37638c8a7..f4aa38733fef 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -16623,6 +16623,8 @@ bool PPCTargetLowering::isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, bool PPCTargetLowering::isFMAFasterThanFMulAndFAdd(const Function &F, Type *Ty) const { + if (Subtarget.hasSPE()) + return false; switch (Ty->getScalarType()->getTypeID()) { case Type::FloatTyID: case Type::DoubleTyID: