diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2012-06-22 00:49:52 +0000 | 
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2012-06-22 00:49:52 +0000 | 
| commit | 0a479ae7d1585729fd9adbf5560f63fc6c70cd28 (patch) | |
| tree | b217f69a0b104067b0c732a7a3f7f7f1706add6f /llvm/lib/Target/PowerPC/PPCISelLowering.cpp | |
| parent | b820709144570a05a2e74878a86cde49989e52e0 (diff) | |
| download | bcm5719-llvm-0a479ae7d1585729fd9adbf5560f63fc6c70cd28.tar.gz bcm5719-llvm-0a479ae7d1585729fd9adbf5560f63fc6c70cd28.zip | |
Convert the PPC backend to use the new FMA infrastructure.
The existing contraction patterns are replaced with fma/fneg.
Overall functionality should be the same.
llvm-svn: 158955
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCISelLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 25 | 
1 files changed, 23 insertions, 2 deletions
| diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index dc50d860a87..e88c3fdbb50 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -132,12 +132,12 @@ PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM)    setOperationAction(ISD::FCOS , MVT::f64, Expand);    setOperationAction(ISD::FREM , MVT::f64, Expand);    setOperationAction(ISD::FPOW , MVT::f64, Expand); -  setOperationAction(ISD::FMA  , MVT::f64, Expand); +  setOperationAction(ISD::FMA  , MVT::f64, Legal);    setOperationAction(ISD::FSIN , MVT::f32, Expand);    setOperationAction(ISD::FCOS , MVT::f32, Expand);    setOperationAction(ISD::FREM , MVT::f32, Expand);    setOperationAction(ISD::FPOW , MVT::f32, Expand); -  setOperationAction(ISD::FMA  , MVT::f32, Expand); +  setOperationAction(ISD::FMA  , MVT::f32, Legal);    setOperationAction(ISD::FLT_ROUNDS_, MVT::i32, Custom); @@ -378,6 +378,7 @@ PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM)      addRegisterClass(MVT::v16i8, &PPC::VRRCRegClass);      setOperationAction(ISD::MUL, MVT::v4f32, Legal); +    setOperationAction(ISD::FMA, MVT::v4f32, Legal);      setOperationAction(ISD::MUL, MVT::v4i32, Custom);      setOperationAction(ISD::MUL, MVT::v8i16, Custom);      setOperationAction(ISD::MUL, MVT::v16i8, Custom); @@ -5876,6 +5877,26 @@ EVT PPCTargetLowering::getOptimalMemOpType(uint64_t Size,    }  } +/// isFMAFasterThanMulAndAdd - Return true if an FMA operation is faster than +/// a pair of mul and add instructions. fmuladd intrinsics will be expanded to +/// FMAs when this method returns true (and FMAs are legal), otherwise fmuladd +/// is expanded to mul + add. +bool PPCTargetLowering::isFMAFasterThanMulAndAdd(EVT VT) const { +  if (!VT.isSimple()) +    return false; + +  switch (VT.getSimpleVT().SimpleTy) { +  case MVT::f32: +  case MVT::f64: +  case MVT::v4f32: +    return true; +  default: +    break; +  } + +  return false; +} +  Sched::Preference PPCTargetLowering::getSchedulingPreference(SDNode *N) const {    if (DisableILPPref)      return TargetLowering::getSchedulingPreference(N); | 

