From 9048e1010baf56fc1210fbbc90056e11aecdbf14 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 26 Oct 2006 21:55:50 +0000 Subject: [PATCH] Change load PatFrag to ignore indexed load. llvm-svn: 31210 --- lib/Target/TargetSelectionDAG.td | 93 +++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 31 deletions(-) diff --git a/lib/Target/TargetSelectionDAG.td b/lib/Target/TargetSelectionDAG.td index bb67cbfbeff..0d4da01f57b 100644 --- a/lib/Target/TargetSelectionDAG.td +++ b/lib/Target/TargetSelectionDAG.td @@ -399,79 +399,110 @@ def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>; def vnot_conv : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV_bc)>; def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>; +// load fragments. def load : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - return ISD::isNON_EXTLoad(N); + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::NON_EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED; + return false; }]>; // extending load fragments. def extloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i1; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i1; return false; }]>; def extloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i8; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i8; return false; }]>; def extloadi16 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i16; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i16; return false; }]>; def extloadi32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i32; return false; }]>; def extloadf32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::f32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::f32; return false; }]>; -def sextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i1; +def sextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i1; return false; }]>; -def sextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i8; +def sextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i8; return false; }]>; def sextloadi16 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i16; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i16; return false; }]>; def sextloadi32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i32; return false; }]>; -def zextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i1; +def zextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i1; return false; }]>; -def zextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i8; +def zextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i8; return false; }]>; def zextloadi16 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i16; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i16; return false; }]>; def zextloadi32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i32; return false; }]>; +// store fragments. def store : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ return ISD::isNON_TRUNCStore(N);