Skip to content

Commit

Permalink
[PowerPC] add IR level isFMAFasterThanFMulAndFAdd - NFC
Browse files Browse the repository at this point in the history
And also refactor legacy MIR level isFMAFasterThanFMulAndFAdd.

Reviewed By: steven.zhang

Differential Revision: https://reviews.llvm.org/D76265
  • Loading branch information
chenzheng1030 committed Mar 19, 2020
1 parent cd1212d commit aacf022
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 11 additions & 12 deletions llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Expand Up @@ -15368,22 +15368,21 @@ bool PPCTargetLowering::allowsMisalignedMemoryAccesses(EVT VT,

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 *
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/PowerPC/PPCISelLowering.h
Expand Up @@ -907,6 +907,8 @@ namespace llvm {
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?
Expand Down

0 comments on commit aacf022

Please sign in to comment.