diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h --- a/llvm/lib/Target/PowerPC/PPCISelLowering.h +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h @@ -907,6 +907,8 @@ bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, EVT VT) const override; + bool isFMAFasterThanFMulAndFAdd(const Function &F, Type *Ty) const override; + const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override; // Should we expand the build vector with shuffles? diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -15368,22 +15368,21 @@ bool PPCTargetLowering::isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, EVT VT) const { - VT = VT.getScalarType(); - - if (!VT.isSimple()) - return false; + return isFMAFasterThanFMulAndFAdd( + MF.getFunction(), VT.getTypeForEVT(MF.getFunction().getContext())); +} - switch (VT.getSimpleVT().SimpleTy) { - case MVT::f32: - case MVT::f64: +bool PPCTargetLowering::isFMAFasterThanFMulAndFAdd(const Function &F, + Type *Ty) const { + switch (Ty->getScalarType()->getTypeID()) { + case Type::FloatTyID: + case Type::DoubleTyID: return true; - case MVT::f128: - return (EnableQuadPrecision && Subtarget.hasP9Vector()); + case Type::FP128TyID: + return EnableQuadPrecision && Subtarget.hasP9Vector(); default: - break; + return false; } - - return false; } const MCPhysReg *