Skip to content

Commit

Permalink
[x86] add a convenience method to check for FMA capability; NFCI
Browse files Browse the repository at this point in the history
llvm-svn: 254425
  • Loading branch information
rotateright committed Dec 1, 2015
1 parent 6e8ab92 commit 60216f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Expand Up @@ -1148,7 +1148,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setOperationAction(ISD::CTTZ_ZERO_UNDEF, MVT::v8i32, Custom);
setOperationAction(ISD::CTTZ_ZERO_UNDEF, MVT::v4i64, Custom);

if (Subtarget->hasFMA() || Subtarget->hasFMA4() || Subtarget->hasAVX512()) {
if (Subtarget->hasAnyFMA()) {
setOperationAction(ISD::FMA, MVT::v8f32, Legal);
setOperationAction(ISD::FMA, MVT::v4f64, Legal);
setOperationAction(ISD::FMA, MVT::v4f32, Legal);
Expand Down Expand Up @@ -20463,7 +20463,7 @@ bool X86TargetLowering::isVectorLoadExtDesirable(SDValue) const { return true; }

bool
X86TargetLowering::isFMAFasterThanFMulAndFAdd(EVT VT) const {
if (!(Subtarget->hasFMA() || Subtarget->hasFMA4() || Subtarget->hasAVX512()))
if (!Subtarget->hasAnyFMA())
return false;

VT = VT.getScalarType();
Expand Down Expand Up @@ -26471,9 +26471,7 @@ static SDValue PerformFMACombine(SDNode *N, SelectionDAG &DAG,
return SDValue();

EVT ScalarVT = VT.getScalarType();
if ((ScalarVT != MVT::f32 && ScalarVT != MVT::f64) ||
(!Subtarget->hasFMA() && !Subtarget->hasFMA4() &&
!Subtarget->hasAVX512()))
if ((ScalarVT != MVT::f32 && ScalarVT != MVT::f64) || !Subtarget->hasAnyFMA())
return SDValue();

SDValue A = N->getOperand(0);
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/X86/X86Subtarget.h
Expand Up @@ -358,6 +358,7 @@ class X86Subtarget final : public X86GenSubtargetInfo {
// has equal or better performance on all supported targets.
bool hasFMA() const { return HasFMA && !HasFMA4; }
bool hasFMA4() const { return HasFMA4; }
bool hasAnyFMA() const { return hasFMA() || hasFMA4() || hasAVX512(); }
bool hasXOP() const { return HasXOP; }
bool hasTBM() const { return HasTBM; }
bool hasMOVBE() const { return HasMOVBE; }
Expand Down

0 comments on commit 60216f6

Please sign in to comment.