LLVM API Documentation

IA64GenDAGISel.inc

Go to the documentation of this file.
00001 //===- TableGen'erated file -------------------------------------*- C++ -*-===//
00002 //
00003 // DAG Instruction Selector for the IA64 target
00004 //
00005 // Automatically generated file, do not edit!
00006 //
00007 //===----------------------------------------------------------------------===//
00008 
00009 // *** NOTE: This file is #included into the middle of the target
00010 // *** instruction selector class.  These functions are really methods.
00011 
00012 // Instance var to keep track of multiply used nodes that have 
00013 // already been selected.
00014 std::map<SDOperand, SDOperand> CodeGenMap;
00015 // Instance var to keep track of mapping of chain generating nodes
00016 // and their place handle nodes.
00017 std::map<SDOperand, SDOperand> HandleMap;
00018 // Instance var to keep track of mapping of place handle nodes
00019 // and their replacement nodes.
00020 std::map<SDOperand, SDOperand> ReplaceMap;
00021 
00022 static void findNonImmUse(SDNode* Use, SDNode* Def, bool &found, std::set<SDNode *> &Visited) {
00023   if (found || !Visited.insert(Use).second) return;
00024   for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {
00025     SDNode *N = Use->getOperand(i).Val;
00026     if (N->getNodeDepth() >= Def->getNodeDepth()) {
00027       if (N != Def) {
00028         findNonImmUse(N, Def, found, Visited);
00029       } else {
00030         found = true;
00031         break;
00032       }
00033     }
00034   }
00035 }
00036 
00037 static bool isNonImmUse(SDNode* Use, SDNode* Def) {
00038   std::set<SDNode *> Visited;
00039   bool found = false;
00040   for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {
00041     SDNode *N = Use->getOperand(i).Val;
00042     if (N != Def) {
00043       findNonImmUse(N, Def, found, Visited);
00044       if (found) break;
00045     }
00046   }
00047   return found;
00048 }
00049 
00050 // AddHandleReplacement - Note the pending replacement node for a
00051 // handle node in ReplaceMap.
00052 void AddHandleReplacement(SDNode *H, unsigned HNum, SDNode *R, unsigned RNum) {
00053   SDOperand N(H, HNum);
00054   std::map<SDOperand, SDOperand>::iterator HMI = HandleMap.find(N);
00055   if (HMI != HandleMap.end()) {
00056     ReplaceMap[HMI->second] = SDOperand(R, RNum);
00057     HandleMap.erase(N);
00058   }
00059 }
00060 
00061 // SelectDanglingHandles - Select replacements for all `dangling`
00062 // handles.Some handles do not yet have replacements because the
00063 // nodes they replacements have only dead readers.
00064 void SelectDanglingHandles() {
00065   for (std::map<SDOperand, SDOperand>::iterator I = HandleMap.begin(),
00066          E = HandleMap.end(); I != E; ++I) {
00067     SDOperand N = I->first;
00068     SDOperand R;
00069     Select(R, N.getValue(0));
00070     AddHandleReplacement(N.Val, N.ResNo, R.Val, R.ResNo);
00071   }
00072 }
00073 
00074 // ReplaceHandles - Replace all the handles with the real target
00075 // specific nodes.
00076 void ReplaceHandles() {
00077   for (std::map<SDOperand, SDOperand>::iterator I = ReplaceMap.begin(),
00078         E = ReplaceMap.end(); I != E; ++I) {
00079     SDOperand From = I->first;
00080     SDOperand To   = I->second;
00081     for (SDNode::use_iterator UI = From.Val->use_begin(), E = From.Val->use_end(); UI != E; ++UI) {
00082       SDNode *Use = *UI;
00083       std::vector<SDOperand> Ops;
00084       for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {
00085         SDOperand O = Use->getOperand(i);
00086         if (O.Val == From.Val)
00087           Ops.push_back(To);
00088         else
00089           Ops.push_back(O);
00090       }
00091       SDOperand U = SDOperand(Use, 0);
00092       CurDAG->UpdateNodeOperands(U, Ops);
00093     }
00094   }
00095 }
00096 
00097 // UpdateFoldedChain - return a SDOperand of the new chain created
00098 // if the folding were to happen. This is called when, for example,
00099 // a load is folded into a store. If the store's chain is the load,
00100 // then the resulting node's input chain would be the load's input
00101 // chain. If the store's chain is a TokenFactor and the load's
00102 // output chain feeds into in, then the new chain is a TokenFactor
00103 // with the other operands along with the input chain of the load.
00104 SDOperand UpdateFoldedChain(SelectionDAG *DAG, SDNode *N, SDNode *Chain, SDNode* &OldTF) {
00105   OldTF = NULL;
00106   if (N == Chain) {
00107     return N->getOperand(0);
00108   } else if (Chain->getOpcode() == ISD::TokenFactor &&
00109              N->isOperand(Chain)) {
00110     SDOperand Ch = SDOperand(Chain, 0);
00111     std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(Ch);
00112     if (CGMI != CodeGenMap.end())
00113       return SDOperand(0, 0);
00114     OldTF = Chain;
00115     std::vector<SDOperand> Ops;
00116     for (unsigned i = 0; i < Chain->getNumOperands(); ++i) {
00117       SDOperand Op = Chain->getOperand(i);
00118       if (Op.Val == N)
00119         Ops.push_back(N->getOperand(0));
00120       else
00121         Ops.push_back(Op);
00122     }
00123     return DAG->getNode(ISD::TokenFactor, MVT::Other, Ops);
00124   }
00125   return SDOperand(0, 0);
00126 }
00127 
00128 // SelectRoot - Top level entry to DAG isel.
00129 SDOperand SelectRoot(SDOperand N) {
00130   SDOperand ResNode;
00131   Select(ResNode, N);
00132   SelectDanglingHandles();
00133   ReplaceHandles();
00134   ReplaceMap.clear();
00135   return ResNode;
00136 }
00137 
00138 // Node transformations.
00139 
00140 // Predicate functions.
00141 inline bool Predicate_immAllOnes(SDNode *inN) {
00142   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00143  return N->isAllOnesValue(); 
00144 }
00145 inline bool Predicate_immAllOnesV(SDNode *N) {
00146 
00147   return ISD::isBuildVectorAllOnes(N);
00148 
00149 }
00150 inline bool Predicate_immAllZerosV(SDNode *N) {
00151 
00152   return ISD::isBuildVectorAllZeros(N);
00153 
00154 }
00155 inline bool Predicate_immSExt14(SDNode *inN) {
00156   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00157 
00158   // immSExt14 predicate - True if the immediate fits in a 14-bit sign extended
00159   // field.  Used by instructions like 'adds'.
00160   int64_t v = (int64_t)N->getValue();
00161   return (v <= 8191 && v >= -8192);
00162 
00163 }
00164 inline bool Predicate_is32ones(SDNode *inN) {
00165   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00166 
00167   // is32ones predicate - True if the immediate is 0x00000000FFFFFFFF 
00168   // Used to create ZXT4s appropriately 
00169   uint64_t v = (uint64_t)N->getValue();
00170   return (v == 0x00000000FFFFFFFFLL);
00171 
00172 }
00173 inline bool Predicate_isMIX1Lable(SDNode *inN) {
00174   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00175 
00176   return((uint64_t)N->getValue()==0xFF00FF00FF00FF00LL);
00177 
00178 }
00179 inline bool Predicate_isMIX1Rable(SDNode *inN) {
00180   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00181 
00182   return((uint64_t)N->getValue()==0x00FF00FF00FF00FFLL);
00183 
00184 }
00185 inline bool Predicate_isMIX2Lable(SDNode *inN) {
00186   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00187 
00188   return((uint64_t)N->getValue()==0xFFFF0000FFFF0000LL);
00189 
00190 }
00191 inline bool Predicate_isMIX2Rable(SDNode *inN) {
00192   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00193 
00194   return((uint64_t)N->getValue()==0x0000FFFF0000FFFFLL);
00195 
00196 }
00197 inline bool Predicate_isMIX4Lable(SDNode *inN) {
00198   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00199 
00200   return((uint64_t)N->getValue()==0xFFFFFFFF00000000LL);
00201 
00202 }
00203 inline bool Predicate_isMIX4Rable(SDNode *inN) {
00204   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00205 
00206   return((uint64_t)N->getValue()==0x00000000FFFFFFFFLL);
00207 
00208 }
00209 inline bool Predicate_isSHLADDimm(SDNode *inN) {
00210   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00211 
00212   // isSHLADDimm predicate - True if the immediate is exactly 1, 2, 3 or 4
00213   // - 0 is *not* okay.
00214   // Used to create shladd instructions appropriately
00215   int64_t v = (int64_t)N->getValue();
00216   return (v >= 1 && v <= 4);
00217 
00218 }
00219 inline bool Predicate_vtFP(SDNode *inN) {
00220   VTSDNode *N = cast<VTSDNode>(inN);
00221  return MVT::isFloatingPoint(N->getVT()); 
00222 }
00223 inline bool Predicate_vtInt(SDNode *inN) {
00224   VTSDNode *N = cast<VTSDNode>(inN);
00225  return MVT::isInteger(N->getVT()); 
00226 }
00227 
00228 
00229 void Select_add(SDOperand &Result, SDOperand N) {
00230   SDOperand N0(0, 0);
00231   SDOperand N00(0, 0);
00232   SDOperand N01(0, 0);
00233   SDOperand N1(0, 0);
00234   SDOperand N10(0, 0);
00235   SDOperand N11(0, 0);
00236   SDOperand Tmp0(0, 0);
00237   SDOperand Tmp1(0, 0);
00238   SDOperand Tmp2(0, 0);
00239   SDNode *ResNode;
00240   N0 = N.getOperand(0);
00241 
00242   // Pattern: (add:i64 (add:i64 GR:i64:$src1, GR:i64:$src2), 1:i64)
00243   // Emits: (ADD1:i64 GR:i64:$src1, GR:i64:$src2)
00244   // Pattern complexity = 7  cost = 1
00245   if (N0.getOpcode() == ISD::ADD) {
00246     N00 = N0.getOperand(0);
00247     N01 = N0.getOperand(1);
00248     N1 = N.getOperand(1);
00249     if (isa<ConstantSDNode>(N1)) {
00250       int64_t CN0 = cast<ConstantSDNode>(N1)->getSignExtended();
00251       if (CN0 == 1 &&
00252           N.Val->getValueType(0) == MVT::i64) {
00253         Select(Tmp1, N00);
00254         Select(Tmp2, N01);
00255         if (N.Val->hasOneUse()) {
00256           Result = CurDAG->SelectNodeTo(N.Val, IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00257         } else {
00258           ResNode = CurDAG->getTargetNode(IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00259           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00260           Result = SDOperand(ResNode, 0);
00261         }
00262         return;
00263       }
00264     }
00265   }
00266 
00267   // Pattern: (add:i64 (sub:i64 GR:i64:$src1, GR:i64:$src2), -1:i64)
00268   // Emits: (SUB1:i64 GR:i64:$src1, GR:i64:$src2)
00269   // Pattern complexity = 7  cost = 1
00270   if (N0.getOpcode() == ISD::SUB) {
00271     N00 = N0.getOperand(0);
00272     N01 = N0.getOperand(1);
00273     N1 = N.getOperand(1);
00274     if (isa<ConstantSDNode>(N1)) {
00275       int64_t CN0 = cast<ConstantSDNode>(N1)->getSignExtended();
00276       if (CN0 == -1 &&
00277           N.Val->getValueType(0) == MVT::i64) {
00278         Select(Tmp1, N00);
00279         Select(Tmp2, N01);
00280         if (N.Val->hasOneUse()) {
00281           Result = CurDAG->SelectNodeTo(N.Val, IA64::SUB1, MVT::i64, Tmp1, Tmp2);
00282         } else {
00283           ResNode = CurDAG->getTargetNode(IA64::SUB1, MVT::i64, Tmp1, Tmp2);
00284           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00285           Result = SDOperand(ResNode, 0);
00286         }
00287         return;
00288       }
00289     }
00290   }
00291 
00292   // Pattern: (add:i64 GR:i64:$src2, (shl:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isSHLADDimm>>:$imm))
00293   // Emits: (SHLADD:i64 GR:i64:$src1, (imm:i64):$imm, GR:i64:$src2)
00294   // Pattern complexity = 7  cost = 1
00295   {
00296     N1 = N.getOperand(1);
00297     if (N1.getOpcode() == ISD::SHL) {
00298       N10 = N1.getOperand(0);
00299       N11 = N1.getOperand(1);
00300       if (N11.getOpcode() == ISD::Constant &&
00301           Predicate_isSHLADDimm(N11.Val) &&
00302           N.Val->getValueType(0) == MVT::i64 &&
00303           N11.Val->getValueType(0) == MVT::i64) {
00304         Select(Tmp0, N10);
00305         uint64_t Tmp1C = (uint64_t)cast<ConstantSDNode>(N11)->getValue();
00306         Tmp1 = CurDAG->getTargetConstant(Tmp1C, MVT::i64);
00307         Select(Tmp2, N0);
00308         if (N.Val->hasOneUse()) {
00309           Result = CurDAG->SelectNodeTo(N.Val, IA64::SHLADD, MVT::i64, Tmp0, Tmp1, Tmp2);
00310         } else {
00311           ResNode = CurDAG->getTargetNode(IA64::SHLADD, MVT::i64, Tmp0, Tmp1, Tmp2);
00312           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00313           Result = SDOperand(ResNode, 0);
00314         }
00315         return;
00316       }
00317     }
00318   }
00319   if (N0.getOpcode() == ISD::ADD) {
00320     N00 = N0.getOperand(0);
00321 
00322     // Pattern: (add:i64 (add:i64 GR:i64:$src1, 1:i64), GR:i64:$src2)
00323     // Emits: (ADD1:i64 GR:i64:$src1, GR:i64:$src2)
00324     // Pattern complexity = 7  cost = 1
00325     {
00326       N01 = N0.getOperand(1);
00327       if (isa<ConstantSDNode>(N01)) {
00328         int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
00329         if (CN0 == 1) {
00330           N1 = N.getOperand(1);
00331           if (N.Val->getValueType(0) == MVT::i64) {
00332             Select(Tmp1, N00);
00333             Select(Tmp2, N1);
00334             if (N.Val->hasOneUse()) {
00335               Result = CurDAG->SelectNodeTo(N.Val, IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00336             } else {
00337               ResNode = CurDAG->getTargetNode(IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00338               SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00339               Result = SDOperand(ResNode, 0);
00340             }
00341             return;
00342           }
00343         }
00344       }
00345     }
00346 
00347     // Pattern: (add:i64 (add:i64 1:i64, GR:i64:$src1), GR:i64:$src2)
00348     // Emits: (ADD1:i64 GR:i64:$src1, GR:i64:$src2)
00349     // Pattern complexity = 7  cost = 1
00350     if (isa<ConstantSDNode>(N00)) {
00351       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
00352       if (CN0 == 1) {
00353         N01 = N0.getOperand(1);
00354         N1 = N.getOperand(1);
00355         if (N.Val->getValueType(0) == MVT::i64) {
00356           Select(Tmp1, N01);
00357           Select(Tmp2, N1);
00358           if (N.Val->hasOneUse()) {
00359             Result = CurDAG->SelectNodeTo(N.Val, IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00360           } else {
00361             ResNode = CurDAG->getTargetNode(IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00362             SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00363             Result = SDOperand(ResNode, 0);
00364           }
00365           return;
00366         }
00367       }
00368     }
00369   }
00370 
00371   // Pattern: (add:i64 1:i64, (add:i64 GR:i64:$src1, GR:i64:$src2))
00372   // Emits: (ADD1:i64 GR:i64:$src1, GR:i64:$src2)
00373   // Pattern complexity = 7  cost = 1
00374   if (isa<ConstantSDNode>(N0)) {
00375     int64_t CN0 = cast<ConstantSDNode>(N0)->getSignExtended();
00376     if (CN0 == 1) {
00377       N1 = N.getOperand(1);
00378       if (N1.getOpcode() == ISD::ADD) {
00379         N10 = N1.getOperand(0);
00380         N11 = N1.getOperand(1);
00381         if (N.Val->getValueType(0) == MVT::i64) {
00382           Select(Tmp1, N10);
00383           Select(Tmp2, N11);
00384           if (N.Val->hasOneUse()) {
00385             Result = CurDAG->SelectNodeTo(N.Val, IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00386           } else {
00387             ResNode = CurDAG->getTargetNode(IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00388             SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00389             Result = SDOperand(ResNode, 0);
00390           }
00391           return;
00392         }
00393       }
00394     }
00395   }
00396   {
00397     N1 = N.getOperand(1);
00398     if (N1.getOpcode() == ISD::ADD) {
00399       N10 = N1.getOperand(0);
00400 
00401       // Pattern: (add:i64 GR:i64:$src2, (add:i64 GR:i64:$src1, 1:i64))
00402       // Emits: (ADD1:i64 GR:i64:$src1, GR:i64:$src2)
00403       // Pattern complexity = 7  cost = 1
00404       {
00405         N11 = N1.getOperand(1);
00406         if (isa<ConstantSDNode>(N11)) {
00407           int64_t CN0 = cast<ConstantSDNode>(N11)->getSignExtended();
00408           if (CN0 == 1 &&
00409               N.Val->getValueType(0) == MVT::i64) {
00410             Select(Tmp1, N10);
00411             Select(Tmp2, N0);
00412             if (N.Val->hasOneUse()) {
00413               Result = CurDAG->SelectNodeTo(N.Val, IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00414             } else {
00415               ResNode = CurDAG->getTargetNode(IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00416               SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00417               Result = SDOperand(ResNode, 0);
00418             }
00419             return;
00420           }
00421         }
00422       }
00423 
00424       // Pattern: (add:i64 GR:i64:$src2, (add:i64 1:i64, GR:i64:$src1))
00425       // Emits: (ADD1:i64 GR:i64:$src1, GR:i64:$src2)
00426       // Pattern complexity = 7  cost = 1
00427       if (isa<ConstantSDNode>(N10)) {
00428         int64_t CN0 = cast<ConstantSDNode>(N10)->getSignExtended();
00429         if (CN0 == 1) {
00430           N11 = N1.getOperand(1);
00431           if (N.Val->getValueType(0) == MVT::i64) {
00432             Select(Tmp1, N11);
00433             Select(Tmp2, N0);
00434             if (N.Val->hasOneUse()) {
00435               Result = CurDAG->SelectNodeTo(N.Val, IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00436             } else {
00437               ResNode = CurDAG->getTargetNode(IA64::ADD1, MVT::i64, Tmp1, Tmp2);
00438               SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00439               Result = SDOperand(ResNode, 0);
00440             }
00441             return;
00442           }
00443         }
00444       }
00445     }
00446   }
00447 
00448   // Pattern: (add:i64 -1:i64, (sub:i64 GR:i64:$src1, GR:i64:$src2))
00449   // Emits: (SUB1:i64 GR:i64:$src1, GR:i64:$src2)
00450   // Pattern complexity = 7  cost = 1
00451   if (isa<ConstantSDNode>(N0)) {
00452     int64_t CN0 = cast<ConstantSDNode>(N0)->getSignExtended();
00453     if (CN0 == -1) {
00454       N1 = N.getOperand(1);
00455       if (N1.getOpcode() == ISD::SUB) {
00456         N10 = N1.getOperand(0);
00457         N11 = N1.getOperand(1);
00458         if (N.Val->getValueType(0) == MVT::i64) {
00459           Select(Tmp1, N10);
00460           Select(Tmp2, N11);
00461           if (N.Val->hasOneUse()) {
00462             Result = CurDAG->SelectNodeTo(N.Val, IA64::SUB1, MVT::i64, Tmp1, Tmp2);
00463           } else {
00464             ResNode = CurDAG->getTargetNode(IA64::SUB1, MVT::i64, Tmp1, Tmp2);
00465             SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00466             Result = SDOperand(ResNode, 0);
00467           }
00468           return;
00469         }
00470       }
00471     }
00472   }
00473 
00474   // Pattern: (add:i64 (shl:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isSHLADDimm>>:$imm), GR:i64:$src2)
00475   // Emits: (SHLADD:i64 GR:i64:$src1, (imm:i64):$imm, GR:i64:$src2)
00476   // Pattern complexity = 7  cost = 1
00477   if (N0.getOpcode() == ISD::SHL) {
00478     N00 = N0.getOperand(0);
00479     N01 = N0.getOperand(1);
00480     if (N01.getOpcode() == ISD::Constant &&
00481         Predicate_isSHLADDimm(N01.Val)) {
00482       N1 = N.getOperand(1);
00483       if (N.Val->getValueType(0) == MVT::i64 &&
00484           N01.Val->getValueType(0) == MVT::i64) {
00485         Select(Tmp0, N00);
00486         uint64_t Tmp1C = (uint64_t)cast<ConstantSDNode>(N01)->getValue();
00487         Tmp1 = CurDAG->getTargetConstant(Tmp1C, MVT::i64);
00488         Select(Tmp2, N1);
00489         if (N.Val->hasOneUse()) {
00490           Result = CurDAG->SelectNodeTo(N.Val, IA64::SHLADD, MVT::i64, Tmp0, Tmp1, Tmp2);
00491         } else {
00492           ResNode = CurDAG->getTargetNode(IA64::SHLADD, MVT::i64, Tmp0, Tmp1, Tmp2);
00493           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00494           Result = SDOperand(ResNode, 0);
00495         }
00496         return;
00497       }
00498     }
00499   }
00500   N1 = N.getOperand(1);
00501 
00502   // Pattern: (add:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_immSExt14>>:$imm)
00503   // Emits: (ADDS:i64 GR:i64:$src1, (imm:i64):$imm)
00504   // Pattern complexity = 5  cost = 1
00505   if (N1.getOpcode() == ISD::Constant &&
00506       Predicate_immSExt14(N1.Val) &&
00507       N.Val->getValueType(0) == MVT::i64) {
00508     Select(Tmp0, N0);
00509     uint64_t Tmp1C = (uint64_t)cast<ConstantSDNode>(N1)->getValue();
00510     Tmp1 = CurDAG->getTargetConstant(Tmp1C, MVT::i64);
00511     if (N.Val->hasOneUse()) {
00512       Result = CurDAG->SelectNodeTo(N.Val, IA64::ADDS, MVT::i64, Tmp0, Tmp1);
00513     } else {
00514       ResNode = CurDAG->getTargetNode(IA64::ADDS, MVT::i64, Tmp0, Tmp1);
00515       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00516       Result = SDOperand(ResNode, 0);
00517     }
00518     return;
00519   }
00520 
00521   // Pattern: (add:i64 GR:i64:$src1, GR:i64:$src2)
00522   // Emits: (ADD:i64 GR:i64:$src1, GR:i64:$src2)
00523   // Pattern complexity = 2  cost = 1
00524   if (N.Val->getValueType(0) == MVT::i64) {
00525     Select(Tmp0, N0);
00526     Select(Tmp1, N1);
00527     if (N.Val->hasOneUse()) {
00528       Result = CurDAG->SelectNodeTo(N.Val, IA64::ADD, MVT::i64, Tmp0, Tmp1);
00529     } else {
00530       ResNode = CurDAG->getTargetNode(IA64::ADD, MVT::i64, Tmp0, Tmp1);
00531       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00532       Result = SDOperand(ResNode, 0);
00533     }
00534     return;
00535   }
00536   std::cerr << "Cannot yet select: ";
00537   N.Val->dump(CurDAG);
00538   std::cerr << '\n';
00539   abort();
00540 }
00541 
00542 void Select_and(SDOperand &Result, SDOperand N) {
00543   SDOperand N0(0, 0);
00544   SDOperand N00(0, 0);
00545   SDOperand N01(0, 0);
00546   SDOperand N1(0, 0);
00547   SDOperand N10(0, 0);
00548   SDOperand N11(0, 0);
00549   SDOperand Tmp0(0, 0);
00550   SDOperand Tmp1(0, 0);
00551   SDOperand Tmp2(0, 0);
00552   SDOperand Tmp3(0, 0);
00553   SDOperand Tmp4(0, 0);
00554   SDOperand Tmp5(0, 0);
00555   SDOperand Tmp6(0, 0);
00556   SDNode *ResNode;
00557   N0 = N.getOperand(0);
00558 
00559   // Pattern: (and:i64 GR:i64:$src1, (xor:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_immAllOnes>>))
00560   // Emits: (ANDCM:i64 GR:i64:$src1, GR:i64:$src2)
00561   // Pattern complexity = 7  cost = 1
00562   {
00563     N1 = N.getOperand(1);
00564     if (N1.getOpcode() == ISD::XOR) {
00565       N10 = N1.getOperand(0);
00566       N11 = N1.getOperand(1);
00567       if (N11.getOpcode() == ISD::Constant &&
00568           Predicate_immAllOnes(N11.Val) &&
00569           N.Val->getValueType(0) == MVT::i64) {
00570         Select(Tmp0, N0);
00571         Select(Tmp1, N10);
00572         if (N.Val->hasOneUse()) {
00573           Result = CurDAG->SelectNodeTo(N.Val, IA64::ANDCM, MVT::i64, Tmp0, Tmp1);
00574         } else {
00575           ResNode = CurDAG->getTargetNode(IA64::ANDCM, MVT::i64, Tmp0, Tmp1);
00576           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00577           Result = SDOperand(ResNode, 0);
00578         }
00579         return;
00580       }
00581     }
00582   }
00583 
00584   // Pattern: (and:i64 (xor:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_immAllOnes>>), GR:i64:$src1)
00585   // Emits: (ANDCM:i64 GR:i64:$src1, GR:i64:$src2)
00586   // Pattern complexity = 7  cost = 1
00587   if (N0.getOpcode() == ISD::XOR) {
00588     N00 = N0.getOperand(0);
00589     N01 = N0.getOperand(1);
00590     if (N01.getOpcode() == ISD::Constant &&
00591         Predicate_immAllOnes(N01.Val)) {
00592       N1 = N.getOperand(1);
00593       if (N.Val->getValueType(0) == MVT::i64) {
00594         Select(Tmp0, N1);
00595         Select(Tmp1, N00);
00596         if (N.Val->hasOneUse()) {
00597           Result = CurDAG->SelectNodeTo(N.Val, IA64::ANDCM, MVT::i64, Tmp0, Tmp1);
00598         } else {
00599           ResNode = CurDAG->getTargetNode(IA64::ANDCM, MVT::i64, Tmp0, Tmp1);
00600           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00601           Result = SDOperand(ResNode, 0);
00602         }
00603         return;
00604       }
00605     }
00606   }
00607   {
00608     N1 = N.getOperand(1);
00609     if (isa<ConstantSDNode>(N1)) {
00610       int64_t CN0 = cast<ConstantSDNode>(N1)->getSignExtended();
00611 
00612       // Pattern: (and:i64 GR:i64:$src, 255:i64)
00613       // Emits: (ZXT1:i64 GR:i64:$src)
00614       // Pattern complexity = 5  cost = 1
00615       if (CN0 == 255 &&
00616           N.Val->getValueType(0) == MVT::i64) {
00617         Select(Tmp1, N0);
00618         if (N.Val->hasOneUse()) {
00619           Result = CurDAG->SelectNodeTo(N.Val, IA64::ZXT1, MVT::i64, Tmp1);
00620         } else {
00621           ResNode = CurDAG->getTargetNode(IA64::ZXT1, MVT::i64, Tmp1);
00622           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00623           Result = SDOperand(ResNode, 0);
00624         }
00625         return;
00626       }
00627 
00628       // Pattern: (and:i64 GR:i64:$src, 65535:i64)
00629       // Emits: (ZXT2:i64 GR:i64:$src)
00630       // Pattern complexity = 5  cost = 1
00631       if (CN0 == 65535 &&
00632           N.Val->getValueType(0) == MVT::i64) {
00633         Select(Tmp1, N0);
00634         if (N.Val->hasOneUse()) {
00635           Result = CurDAG->SelectNodeTo(N.Val, IA64::ZXT2, MVT::i64, Tmp1);
00636         } else {
00637           ResNode = CurDAG->getTargetNode(IA64::ZXT2, MVT::i64, Tmp1);
00638           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00639           Result = SDOperand(ResNode, 0);
00640         }
00641         return;
00642       }
00643     }
00644 
00645     // Pattern: (and:i64 GR:i64:$src, (imm:i64)<<P:Predicate_is32ones>>)
00646     // Emits: (ZXT4:i64 GR:i64:$src)
00647     // Pattern complexity = 5  cost = 1
00648     if (N1.getOpcode() == ISD::Constant &&
00649         Predicate_is32ones(N1.Val) &&
00650         N.Val->getValueType(0) == MVT::i64) {
00651       Select(Tmp0, N0);
00652       if (N.Val->hasOneUse()) {
00653         Result = CurDAG->SelectNodeTo(N.Val, IA64::ZXT4, MVT::i64, Tmp0);
00654       } else {
00655         ResNode = CurDAG->getTargetNode(IA64::ZXT4, MVT::i64, Tmp0);
00656         SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00657         Result = SDOperand(ResNode, 0);
00658       }
00659       return;
00660     }
00661   }
00662   if (isa<ConstantSDNode>(N0)) {
00663     int64_t CN0 = cast<ConstantSDNode>(N0)->getSignExtended();
00664 
00665     // Pattern: (and:i64 255:i64, GR:i64:$src)
00666     // Emits: (ZXT1:i64 GR:i64:$src)
00667     // Pattern complexity = 5  cost = 1
00668     if (CN0 == 255) {
00669       N1 = N.getOperand(1);
00670       if (N.Val->getValueType(0) == MVT::i64) {
00671         Select(Tmp1, N1);
00672         if (N.Val->hasOneUse()) {
00673           Result = CurDAG->SelectNodeTo(N.Val, IA64::ZXT1, MVT::i64, Tmp1);
00674         } else {
00675           ResNode = CurDAG->getTargetNode(IA64::ZXT1, MVT::i64, Tmp1);
00676           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00677           Result = SDOperand(ResNode, 0);
00678         }
00679         return;
00680       }
00681     }
00682 
00683     // Pattern: (and:i64 65535:i64, GR:i64:$src)
00684     // Emits: (ZXT2:i64 GR:i64:$src)
00685     // Pattern complexity = 5  cost = 1
00686     if (CN0 == 65535) {
00687       N1 = N.getOperand(1);
00688       if (N.Val->getValueType(0) == MVT::i64) {
00689         Select(Tmp1, N1);
00690         if (N.Val->hasOneUse()) {
00691           Result = CurDAG->SelectNodeTo(N.Val, IA64::ZXT2, MVT::i64, Tmp1);
00692         } else {
00693           ResNode = CurDAG->getTargetNode(IA64::ZXT2, MVT::i64, Tmp1);
00694           SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00695           Result = SDOperand(ResNode, 0);
00696         }
00697         return;
00698       }
00699     }
00700   }
00701   N1 = N.getOperand(1);
00702 
00703   // Pattern: (and:i64 GR:i64:$src1, GR:i64:$src2)
00704   // Emits: (AND:i64 GR:i64:$src1, GR:i64:$src2)
00705   // Pattern complexity = 2  cost = 1
00706   if (N.Val->getValueType(0) == MVT::i64) {
00707     Select(Tmp0, N0);
00708     Select(Tmp1, N1);
00709     if (N.Val->hasOneUse()) {
00710       Result = CurDAG->SelectNodeTo(N.Val, IA64::AND, MVT::i64, Tmp0, Tmp1);
00711     } else {
00712       ResNode = CurDAG->getTargetNode(IA64::AND, MVT::i64, Tmp0, Tmp1);
00713       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00714       Result = SDOperand(ResNode, 0);
00715     }
00716     return;
00717   }
00718 
00719   // Pattern: (and:i1 PR:i1:$src1, PR:i1:$src2)
00720   // Emits: (TPCMPNER0R0:i1 (PCMPEQUNCR0R0:i1 PR:i1:$src1), (TPCMPNER0R0:i1 (CMPEQ:i1 r0:i64, r0:i64), PR:i1:$src2))
00721   // Pattern complexity = 2  cost = 4
00722   if (N.Val->getValueType(0) == MVT::i1) {
00723     Select(Tmp0, N0);
00724     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::PCMPEQUNCR0R0, MVT::i1, Tmp0), 0);
00725     Tmp2 = CurDAG->getRegister(IA64::r0, MVT::i64);
00726     Tmp3 = CurDAG->getRegister(IA64::r0, MVT::i64);
00727     Tmp4 = SDOperand(CurDAG->getTargetNode(IA64::CMPEQ, MVT::i1, Tmp2, Tmp3), 0);
00728     Select(Tmp5, N1);
00729     Tmp6 = SDOperand(CurDAG->getTargetNode(IA64::TPCMPNER0R0, MVT::i1, Tmp4, Tmp5), 0);
00730     if (N.Val->hasOneUse()) {
00731       Result = CurDAG->SelectNodeTo(N.Val, IA64::TPCMPNER0R0, MVT::i1, Tmp1, Tmp6);
00732     } else {
00733       ResNode = CurDAG->getTargetNode(IA64::TPCMPNER0R0, MVT::i1, Tmp1, Tmp6);
00734       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00735       Result = SDOperand(ResNode, 0);
00736     }
00737     return;
00738   }
00739   std::cerr << "Cannot yet select: ";
00740   N.Val->dump(CurDAG);
00741   std::cerr << '\n';
00742   abort();
00743 }
00744 
00745 void Select_ctpop(SDOperand &Result, SDOperand N) {
00746   SDOperand N0(0, 0);
00747   SDOperand Tmp0(0, 0);
00748   SDNode *ResNode;
00749   N0 = N.getOperand(0);
00750   if (N.Val->getValueType(0) == MVT::i64) {
00751     Select(Tmp0, N0);
00752     if (N.Val->hasOneUse()) {
00753       Result = CurDAG->SelectNodeTo(N.Val, IA64::POPCNT, MVT::i64, Tmp0);
00754     } else {
00755       ResNode = CurDAG->getTargetNode(IA64::POPCNT, MVT::i64, Tmp0);
00756       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00757       Result = SDOperand(ResNode, 0);
00758     }
00759     return;
00760   }
00761   std::cerr << "Cannot yet select: ";
00762   N.Val->dump(CurDAG);
00763   std::cerr << '\n';
00764   abort();
00765 }
00766 
00767 void Select_fabs(SDOperand &Result, SDOperand N) {
00768   SDOperand N0(0, 0);
00769   SDOperand Tmp0(0, 0);
00770   SDNode *ResNode;
00771   N0 = N.getOperand(0);
00772   Select(Tmp0, N0);
00773   if (N.Val->hasOneUse()) {
00774     Result = CurDAG->SelectNodeTo(N.Val, IA64::FABS, MVT::f64, Tmp0);
00775   } else {
00776     ResNode = CurDAG->getTargetNode(IA64::FABS, MVT::f64, Tmp0);
00777     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00778     Result = SDOperand(ResNode, 0);
00779   }
00780   return;
00781 }
00782 
00783 void Select_fadd(SDOperand &Result, SDOperand N) {
00784   SDOperand N0(0, 0);
00785   SDOperand N00(0, 0);
00786   SDOperand N01(0, 0);
00787   SDOperand N1(0, 0);
00788   SDOperand N10(0, 0);
00789   SDOperand N11(0, 0);
00790   SDOperand Tmp0(0, 0);
00791   SDOperand Tmp1(0, 0);
00792   SDOperand Tmp2(0, 0);
00793   SDNode *ResNode;
00794   N0 = N.getOperand(0);
00795 
00796   // Pattern: (fadd:f64 (fmul:f64 FP:f64:$src1, FP:f64:$src2), FP:f64:$src3)
00797   // Emits: (FMA:f64 FP:f64:$src1, FP:f64:$src2, FP:f64:$src3)
00798   // Pattern complexity = 4  cost = 1
00799   if (N0.getOpcode() == ISD::FMUL) {
00800     N00 = N0.getOperand(0);
00801     N01 = N0.getOperand(1);
00802     N1 = N.getOperand(1);
00803     Select(Tmp0, N00);
00804     Select(Tmp1, N01);
00805     Select(Tmp2, N1);
00806     if (N.Val->hasOneUse()) {
00807       Result = CurDAG->SelectNodeTo(N.Val, IA64::FMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00808     } else {
00809       ResNode = CurDAG->getTargetNode(IA64::FMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00810       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00811       Result = SDOperand(ResNode, 0);
00812     }
00813     return;
00814   }
00815   N1 = N.getOperand(1);
00816 
00817   // Pattern: (fadd:f64 FP:f64:$src3, (fmul:f64 FP:f64:$src1, FP:f64:$src2))
00818   // Emits: (FMA:f64 FP:f64:$src1, FP:f64:$src2, FP:f64:$src3)
00819   // Pattern complexity = 4  cost = 1
00820   if (N1.getOpcode() == ISD::FMUL) {
00821     N10 = N1.getOperand(0);
00822     N11 = N1.getOperand(1);
00823     Select(Tmp0, N10);
00824     Select(Tmp1, N11);
00825     Select(Tmp2, N0);
00826     if (N.Val->hasOneUse()) {
00827       Result = CurDAG->SelectNodeTo(N.Val, IA64::FMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00828     } else {
00829       ResNode = CurDAG->getTargetNode(IA64::FMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00830       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00831       Result = SDOperand(ResNode, 0);
00832     }
00833     return;
00834   }
00835 
00836   // Pattern: (fadd:f64 FP:f64:$src1, FP:f64:$src2)
00837   // Emits: (FADD:f64 FP:f64:$src1, FP:f64:$src2)
00838   // Pattern complexity = 2  cost = 1
00839   Select(Tmp0, N0);
00840   Select(Tmp1, N1);
00841   if (N.Val->hasOneUse()) {
00842     Result = CurDAG->SelectNodeTo(N.Val, IA64::FADD, MVT::f64, Tmp0, Tmp1);
00843   } else {
00844     ResNode = CurDAG->getTargetNode(IA64::FADD, MVT::f64, Tmp0, Tmp1);
00845     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00846     Result = SDOperand(ResNode, 0);
00847   }
00848   return;
00849 }
00850 
00851 void Select_fmul(SDOperand &Result, SDOperand N) {
00852   SDOperand N0(0, 0);
00853   SDOperand N1(0, 0);
00854   SDOperand Tmp0(0, 0);
00855   SDOperand Tmp1(0, 0);
00856   SDNode *ResNode;
00857   N0 = N.getOperand(0);
00858   N1 = N.getOperand(1);
00859   Select(Tmp0, N0);
00860   Select(Tmp1, N1);
00861   if (N.Val->hasOneUse()) {
00862     Result = CurDAG->SelectNodeTo(N.Val, IA64::FMPY, MVT::f64, Tmp0, Tmp1);
00863   } else {
00864     ResNode = CurDAG->getTargetNode(IA64::FMPY, MVT::f64, Tmp0, Tmp1);
00865     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00866     Result = SDOperand(ResNode, 0);
00867   }
00868   return;
00869 }
00870 
00871 void Select_fneg(SDOperand &Result, SDOperand N) {
00872   SDOperand N0(0, 0);
00873   SDOperand N00(0, 0);
00874   SDOperand N000(0, 0);
00875   SDOperand N001(0, 0);
00876   SDOperand N01(0, 0);
00877   SDOperand N010(0, 0);
00878   SDOperand N011(0, 0);
00879   SDOperand Tmp0(0, 0);
00880   SDOperand Tmp1(0, 0);
00881   SDOperand Tmp2(0, 0);
00882   SDNode *ResNode;
00883   N0 = N.getOperand(0);
00884   if (N0.getOpcode() == ISD::FADD) {
00885     N00 = N0.getOperand(0);
00886 
00887     // Pattern: (fneg:f64 (fadd:f64 (fmul:f64 FP:f64:$src1, FP:f64:$src2), FP:f64:$src3))
00888     // Emits: (FNMA:f64 FP:f64:$src1, FP:f64:$src2, FP:f64:$src3)
00889     // Pattern complexity = 6  cost = 1
00890     if (N00.getOpcode() == ISD::FMUL) {
00891       N000 = N00.getOperand(0);
00892       N001 = N00.getOperand(1);
00893       N01 = N0.getOperand(1);
00894       Select(Tmp0, N000);
00895       Select(Tmp1, N001);
00896       Select(Tmp2, N01);
00897       if (N.Val->hasOneUse()) {
00898         Result = CurDAG->SelectNodeTo(N.Val, IA64::FNMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00899       } else {
00900         ResNode = CurDAG->getTargetNode(IA64::FNMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00901         SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00902         Result = SDOperand(ResNode, 0);
00903       }
00904       return;
00905     }
00906 
00907     // Pattern: (fneg:f64 (fadd:f64 FP:f64:$src3, (fmul:f64 FP:f64:$src1, FP:f64:$src2)))
00908     // Emits: (FNMA:f64 FP:f64:$src1, FP:f64:$src2, FP:f64:$src3)
00909     // Pattern complexity = 6  cost = 1
00910     N01 = N0.getOperand(1);
00911     if (N01.getOpcode() == ISD::FMUL) {
00912       N010 = N01.getOperand(0);
00913       N011 = N01.getOperand(1);
00914       Select(Tmp0, N010);
00915       Select(Tmp1, N011);
00916       Select(Tmp2, N00);
00917       if (N.Val->hasOneUse()) {
00918         Result = CurDAG->SelectNodeTo(N.Val, IA64::FNMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00919       } else {
00920         ResNode = CurDAG->getTargetNode(IA64::FNMA, MVT::f64, Tmp0, Tmp1, Tmp2);
00921         SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00922         Result = SDOperand(ResNode, 0);
00923       }
00924       return;
00925     }
00926   }
00927 
00928   // Pattern: (fneg:f64 (fabs:f64 FP:f64:$src))
00929   // Emits: (FNEGABS:f64 FP:f64:$src)
00930   // Pattern complexity = 4  cost = 1
00931   if (N0.getOpcode() == ISD::FABS) {
00932     N00 = N0.getOperand(0);
00933     Select(Tmp0, N00);
00934     if (N.Val->hasOneUse()) {
00935       Result = CurDAG->SelectNodeTo(N.Val, IA64::FNEGABS, MVT::f64, Tmp0);
00936     } else {
00937       ResNode = CurDAG->getTargetNode(IA64::FNEGABS, MVT::f64, Tmp0);
00938       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00939       Result = SDOperand(ResNode, 0);
00940     }
00941     return;
00942   }
00943 
00944   // Pattern: (fneg:f64 FP:f64:$src)
00945   // Emits: (FNEG:f64 FP:f64:$src)
00946   // Pattern complexity = 2  cost = 1
00947   Select(Tmp0, N0);
00948   if (N.Val->hasOneUse()) {
00949     Result = CurDAG->SelectNodeTo(N.Val, IA64::FNEG, MVT::f64, Tmp0);
00950   } else {
00951     ResNode = CurDAG->getTargetNode(IA64::FNEG, MVT::f64, Tmp0);
00952     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00953     Result = SDOperand(ResNode, 0);
00954   }
00955   return;
00956 }
00957 
00958 void Select_fp_to_sint(SDOperand &Result, SDOperand N) {
00959   SDOperand N0(0, 0);
00960   SDOperand Tmp0(0, 0);
00961   SDOperand Tmp1(0, 0);
00962   SDNode *ResNode;
00963   N0 = N.getOperand(0);
00964   if (N.Val->getValueType(0) == MVT::i64) {
00965     Select(Tmp0, N0);
00966     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::FCVTFXTRUNC, MVT::f64, Tmp0), 0);
00967     if (N.Val->hasOneUse()) {
00968       Result = CurDAG->SelectNodeTo(N.Val, IA64::GETFSIG, MVT::i64, Tmp1);
00969     } else {
00970       ResNode = CurDAG->getTargetNode(IA64::GETFSIG, MVT::i64, Tmp1);
00971       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00972       Result = SDOperand(ResNode, 0);
00973     }
00974     return;
00975   }
00976   std::cerr << "Cannot yet select: ";
00977   N.Val->dump(CurDAG);
00978   std::cerr << '\n';
00979   abort();
00980 }
00981 
00982 void Select_fp_to_uint(SDOperand &Result, SDOperand N) {
00983   SDOperand N0(0, 0);
00984   SDOperand Tmp0(0, 0);
00985   SDOperand Tmp1(0, 0);
00986   SDNode *ResNode;
00987   N0 = N.getOperand(0);
00988   if (N.Val->getValueType(0) == MVT::i64) {
00989     Select(Tmp0, N0);
00990     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::FCVTFXUTRUNC, MVT::f64, Tmp0), 0);
00991     if (N.Val->hasOneUse()) {
00992       Result = CurDAG->SelectNodeTo(N.Val, IA64::GETFSIG, MVT::i64, Tmp1);
00993     } else {
00994       ResNode = CurDAG->getTargetNode(IA64::GETFSIG, MVT::i64, Tmp1);
00995       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00996       Result = SDOperand(ResNode, 0);
00997     }
00998     return;
00999   }
01000   std::cerr << "Cannot yet select: ";
01001   N.Val->dump(CurDAG);
01002   std::cerr << '\n';
01003   abort();
01004 }
01005 
01006 void Select_fsub(SDOperand &Result, SDOperand N) {
01007   SDOperand N0(0, 0);
01008   SDOperand N00(0, 0);
01009   SDOperand N01(0, 0);
01010   SDOperand N1(0, 0);
01011   SDOperand Tmp0(0, 0);
01012   SDOperand Tmp1(0, 0);
01013   SDOperand Tmp2(0, 0);
01014   SDNode *ResNode;
01015   N0 = N.getOperand(0);
01016 
01017   // Pattern: (fsub:f64 (fmul:f64 FP:f64:$src1, FP:f64:$src2), FP:f64:$src3)
01018   // Emits: (FMS:f64 FP:f64:$src1, FP:f64:$src2, FP:f64:$src3)
01019   // Pattern complexity = 4  cost = 1
01020   if (N0.getOpcode() == ISD::FMUL) {
01021     N00 = N0.getOperand(0);
01022     N01 = N0.getOperand(1);
01023     N1 = N.getOperand(1);
01024     Select(Tmp0, N00);
01025     Select(Tmp1, N01);
01026     Select(Tmp2, N1);
01027     if (N.Val->hasOneUse()) {
01028       Result = CurDAG->SelectNodeTo(N.Val, IA64::FMS, MVT::f64, Tmp0, Tmp1, Tmp2);
01029     } else {
01030       ResNode = CurDAG->getTargetNode(IA64::FMS, MVT::f64, Tmp0, Tmp1, Tmp2);
01031       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01032       Result = SDOperand(ResNode, 0);
01033     }
01034     return;
01035   }
01036 
01037   // Pattern: (fsub:f64 FP:f64:$src1, FP:f64:$src2)
01038   // Emits: (FSUB:f64 FP:f64:$src1, FP:f64:$src2)
01039   // Pattern complexity = 2  cost = 1
01040   N1 = N.getOperand(1);
01041   Select(Tmp0, N0);
01042   Select(Tmp1, N1);
01043   if (N.Val->hasOneUse()) {
01044     Result = CurDAG->SelectNodeTo(N.Val, IA64::FSUB, MVT::f64, Tmp0, Tmp1);
01045   } else {
01046     ResNode = CurDAG->getTargetNode(IA64::FSUB, MVT::f64, Tmp0, Tmp1);
01047     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01048     Result = SDOperand(ResNode, 0);
01049   }
01050   return;
01051 }
01052 
01053 void Select_imm(SDOperand &Result, SDOperand N) {
01054   SDOperand Tmp0(0, 0);
01055   SDOperand Tmp1(0, 0);
01056   SDNode *ResNode;
01057 
01058   // Pattern: (imm:i64)<<P:Predicate_immSExt14>>:$imm
01059   // Emits: (ADDS:i64 r0:i64, (imm:i64)<<P:Predicate_immSExt14>>:$imm)
01060   // Pattern complexity = 3  cost = 1
01061   if (Predicate_immSExt14(N.Val) &&
01062       N.Val->getValueType(0) == MVT::i64) {
01063     Tmp0 = CurDAG->getRegister(IA64::r0, MVT::i64);
01064     uint64_t Tmp1C = (uint64_t)cast<ConstantSDNode>(N)->getValue();
01065     Tmp1 = CurDAG->getTargetConstant(Tmp1C, MVT::i64);
01066     if (N.Val->hasOneUse()) {
01067       Result = CurDAG->SelectNodeTo(N.Val, IA64::ADDS, MVT::i64, Tmp0, Tmp1);
01068     } else {
01069       ResNode = CurDAG->getTargetNode(IA64::ADDS, MVT::i64, Tmp0, Tmp1);
01070       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01071       Result = SDOperand(ResNode, 0);
01072     }
01073     return;
01074   }
01075 
01076   // Pattern: -1:i1
01077   // Emits: (CMPEQ:i1 r0:i64, r0:i64)
01078   // Pattern complexity = 3  cost = 1
01079   if (cast<ConstantSDNode>(N)->getSignExtended() == -1 &&
01080       N.Val->getValueType(0) == MVT::i1) {
01081     Tmp0 = CurDAG->getRegister(IA64::r0, MVT::i64);
01082     Tmp1 = CurDAG->getRegister(IA64::r0, MVT::i64);
01083     if (N.Val->hasOneUse()) {
01084       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPEQ, MVT::i1, Tmp0, Tmp1);
01085     } else {
01086       ResNode = CurDAG->getTargetNode(IA64::CMPEQ, MVT::i1, Tmp0, Tmp1);
01087       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01088       Result = SDOperand(ResNode, 0);
01089     }
01090     return;
01091   }
01092 
01093   // Pattern: 0:i1
01094   // Emits: (CMPNE:i1 r0:i64, r0:i64)
01095   // Pattern complexity = 3  cost = 1
01096   if (cast<ConstantSDNode>(N)->getSignExtended() == 0 &&
01097       N.Val->getValueType(0) == MVT::i1) {
01098     Tmp0 = CurDAG->getRegister(IA64::r0, MVT::i64);
01099     Tmp1 = CurDAG->getRegister(IA64::r0, MVT::i64);
01100     if (N.Val->hasOneUse()) {
01101       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPNE, MVT::i1, Tmp0, Tmp1);
01102     } else {
01103       ResNode = CurDAG->getTargetNode(IA64::CMPNE, MVT::i1, Tmp0, Tmp1);
01104       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01105       Result = SDOperand(ResNode, 0);
01106     }
01107     return;
01108   }
01109   if (N.Val->getValueType(0) == MVT::i64) {
01110     uint64_t Tmp0C = (uint64_t)cast<ConstantSDNode>(N)->getValue();
01111     Tmp0 = CurDAG->getTargetConstant(Tmp0C, MVT::i64);
01112     if (N.Val->hasOneUse()) {
01113       Result = CurDAG->SelectNodeTo(N.Val, IA64::MOVL, MVT::i64, Tmp0);
01114     } else {
01115       ResNode = CurDAG->getTargetNode(IA64::MOVL, MVT::i64, Tmp0);
01116       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01117       Result = SDOperand(ResNode, 0);
01118     }
01119     return;
01120   }
01121   std::cerr << "Cannot yet select: ";
01122   N.Val->dump(CurDAG);
01123   std::cerr << '\n';
01124   abort();
01125 }
01126 
01127 void Select_mul(SDOperand &Result, SDOperand N) {
01128   SDOperand N0(0, 0);
01129   SDOperand N1(0, 0);
01130   SDOperand Tmp0(0, 0);
01131   SDOperand Tmp1(0, 0);
01132   SDOperand Tmp2(0, 0);
01133   SDOperand Tmp3(0, 0);
01134   SDOperand Tmp4(0, 0);
01135   SDOperand Tmp5(0, 0);
01136   SDNode *ResNode;
01137   N0 = N.getOperand(0);
01138   N1 = N.getOperand(1);
01139   if (N.Val->getValueType(0) == MVT::i64) {
01140     Select(Tmp0, N0);
01141     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIGD, MVT::f64, Tmp0), 0);
01142     Select(Tmp2, N1);
01143     Tmp3 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIGD, MVT::f64, Tmp2), 0);
01144     Tmp4 = CurDAG->getRegister(IA64::F0, MVT::f64);
01145     Tmp5 = SDOperand(CurDAG->getTargetNode(IA64::XMALD, MVT::f64, Tmp1, Tmp3, Tmp4), 0);
01146     if (N.Val->hasOneUse()) {
01147       Result = CurDAG->SelectNodeTo(N.Val, IA64::GETFSIGD, MVT::i64, Tmp5);
01148     } else {
01149       ResNode = CurDAG->getTargetNode(IA64::GETFSIGD, MVT::i64, Tmp5);
01150       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01151       Result = SDOperand(ResNode, 0);
01152     }
01153     return;
01154   }
01155   std::cerr << "Cannot yet select: ";
01156   N.Val->dump(CurDAG);
01157   std::cerr << '\n';
01158   abort();
01159 }
01160 
01161 void Select_mulhs(SDOperand &Result, SDOperand N) {
01162   SDOperand N0(0, 0);
01163   SDOperand N1(0, 0);
01164   SDOperand Tmp0(0, 0);
01165   SDOperand Tmp1(0, 0);
01166   SDOperand Tmp2(0, 0);
01167   SDOperand Tmp3(0, 0);
01168   SDOperand Tmp4(0, 0);
01169   SDOperand Tmp5(0, 0);
01170   SDNode *ResNode;
01171   N0 = N.getOperand(0);
01172   N1 = N.getOperand(1);
01173   if (N.Val->getValueType(0) == MVT::i64) {
01174     Select(Tmp0, N0);
01175     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIGD, MVT::f64, Tmp0), 0);
01176     Select(Tmp2, N1);
01177     Tmp3 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIGD, MVT::f64, Tmp2), 0);
01178     Tmp4 = CurDAG->getRegister(IA64::F0, MVT::f64);
01179     Tmp5 = SDOperand(CurDAG->getTargetNode(IA64::XMAHD, MVT::f64, Tmp1, Tmp3, Tmp4), 0);
01180     if (N.Val->hasOneUse()) {
01181       Result = CurDAG->SelectNodeTo(N.Val, IA64::GETFSIGD, MVT::i64, Tmp5);
01182     } else {
01183       ResNode = CurDAG->getTargetNode(IA64::GETFSIGD, MVT::i64, Tmp5);
01184       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01185       Result = SDOperand(ResNode, 0);
01186     }
01187     return;
01188   }
01189   std::cerr << "Cannot yet select: ";
01190   N.Val->dump(CurDAG);
01191   std::cerr << '\n';
01192   abort();
01193 }
01194 
01195 void Select_mulhu(SDOperand &Result, SDOperand N) {
01196   SDOperand N0(0, 0);
01197   SDOperand N1(0, 0);
01198   SDOperand Tmp0(0, 0);
01199   SDOperand Tmp1(0, 0);
01200   SDOperand Tmp2(0, 0);
01201   SDOperand Tmp3(0, 0);
01202   SDOperand Tmp4(0, 0);
01203   SDOperand Tmp5(0, 0);
01204   SDNode *ResNode;
01205   N0 = N.getOperand(0);
01206   N1 = N.getOperand(1);
01207   if (N.Val->getValueType(0) == MVT::i64) {
01208     Select(Tmp0, N0);
01209     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIGD, MVT::f64, Tmp0), 0);
01210     Select(Tmp2, N1);
01211     Tmp3 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIGD, MVT::f64, Tmp2), 0);
01212     Tmp4 = CurDAG->getRegister(IA64::F0, MVT::f64);
01213     Tmp5 = SDOperand(CurDAG->getTargetNode(IA64::XMAHUD, MVT::f64, Tmp1, Tmp3, Tmp4), 0);
01214     if (N.Val->hasOneUse()) {
01215       Result = CurDAG->SelectNodeTo(N.Val, IA64::GETFSIGD, MVT::i64, Tmp5);
01216     } else {
01217       ResNode = CurDAG->getTargetNode(IA64::GETFSIGD, MVT::i64, Tmp5);
01218       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01219       Result = SDOperand(ResNode, 0);
01220     }
01221     return;
01222   }
01223   std::cerr << "Cannot yet select: ";
01224   N.Val->dump(CurDAG);
01225   std::cerr << '\n';
01226   abort();
01227 }
01228 
01229 void Select_or(SDOperand &Result, SDOperand N) {
01230   SDOperand N0(0, 0);
01231   SDOperand N00(0, 0);
01232   SDOperand N000(0, 0);
01233   SDOperand N001(0, 0);
01234   SDOperand N01(0, 0);
01235   SDOperand N1(0, 0);
01236   SDOperand N10(0, 0);
01237   SDOperand N100(0, 0);
01238   SDOperand N101(0, 0);
01239   SDOperand N11(0, 0);
01240   SDOperand Tmp0(0, 0);
01241   SDOperand Tmp1(0, 0);
01242   SDOperand Tmp2(0, 0);
01243   SDNode *ResNode;
01244   N0 = N.getOperand(0);
01245   if (N0.getOpcode() == ISD::AND) {
01246     N00 = N0.getOperand(0);
01247     {
01248       N01 = N0.getOperand(1);
01249       if (N01.getOpcode() == ISD::Constant) {
01250 
01251         // Pattern: (or:i64 (and:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isMIX1Lable>>), (and:i64 (srl:i64 GR:i64:$src2, 8:i64), (imm:i64)<<P:Predicate_isMIX1Lable>>))
01252         // Emits: (MIX1L:i64 GR:i64:$src1, GR:i64:$src2)
01253         // Pattern complexity = 17  cost = 1
01254         if (Predicate_isMIX1Lable(N01.Val)) {
01255           N1 = N.getOperand(1);
01256           if (N1.getOpcode() == ISD::AND) {
01257             N10 = N1.getOperand(0);
01258             if (N10.getOpcode() == ISD::SRL) {
01259               N100 = N10.getOperand(0);
01260               N101 = N10.getOperand(1);
01261               if (isa<ConstantSDNode>(N101)) {
01262                 int64_t CN0 = cast<ConstantSDNode>(N101)->getSignExtended();
01263                 if (CN0 == 8) {
01264                   N11 = N1.getOperand(1);
01265                   if (N11.getOpcode() == ISD::Constant &&
01266                       Predicate_isMIX1Lable(N11.Val) &&
01267                       N.Val->getValueType(0) == MVT::i64 &&
01268                       N101.Val->getValueType(0) == MVT::i64) {
01269                     Select(Tmp1, N00);
01270                     Select(Tmp2, N100);
01271                     if (N.Val->hasOneUse()) {
01272                       Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX1L, MVT::i64, Tmp1, Tmp2);
01273                     } else {
01274                       ResNode = CurDAG->getTargetNode(IA64::MIX1L, MVT::i64, Tmp1, Tmp2);
01275                       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01276                       Result = SDOperand(ResNode, 0);
01277                     }
01278                     return;
01279                   }
01280                 }
01281               }
01282             }
01283           }
01284         }
01285 
01286         // Pattern: (or:i64 (and:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isMIX2Lable>>), (and:i64 (srl:i64 GR:i64:$src2, 16:i64), (imm:i64)<<P:Predicate_isMIX2Lable>>))
01287         // Emits: (MIX2L:i64 GR:i64:$src1, GR:i64:$src2)
01288         // Pattern complexity = 17  cost = 1
01289         if (Predicate_isMIX2Lable(N01.Val)) {
01290           N1 = N.getOperand(1);
01291           if (N1.getOpcode() == ISD::AND) {
01292             N10 = N1.getOperand(0);
01293             if (N10.getOpcode() == ISD::SRL) {
01294               N100 = N10.getOperand(0);
01295               N101 = N10.getOperand(1);
01296               if (isa<ConstantSDNode>(N101)) {
01297                 int64_t CN0 = cast<ConstantSDNode>(N101)->getSignExtended();
01298                 if (CN0 == 16) {
01299                   N11 = N1.getOperand(1);
01300                   if (N11.getOpcode() == ISD::Constant &&
01301                       Predicate_isMIX2Lable(N11.Val) &&
01302                       N.Val->getValueType(0) == MVT::i64 &&
01303                       N101.Val->getValueType(0) == MVT::i64) {
01304                     Select(Tmp1, N00);
01305                     Select(Tmp2, N100);
01306                     if (N.Val->hasOneUse()) {
01307                       Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX2L, MVT::i64, Tmp1, Tmp2);
01308                     } else {
01309                       ResNode = CurDAG->getTargetNode(IA64::MIX2L, MVT::i64, Tmp1, Tmp2);
01310                       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01311                       Result = SDOperand(ResNode, 0);
01312                     }
01313                     return;
01314                   }
01315                 }
01316               }
01317             }
01318           }
01319         }
01320 
01321         // Pattern: (or:i64 (and:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isMIX4Lable>>), (and:i64 (srl:i64 GR:i64:$src2, 32:i64), (imm:i64)<<P:Predicate_isMIX4Lable>>))
01322         // Emits: (MIX4L:i64 GR:i64:$src1, GR:i64:$src2)
01323         // Pattern complexity = 17  cost = 1
01324         if (Predicate_isMIX4Lable(N01.Val)) {
01325           N1 = N.getOperand(1);
01326           if (N1.getOpcode() == ISD::AND) {
01327             N10 = N1.getOperand(0);
01328             if (N10.getOpcode() == ISD::SRL) {
01329               N100 = N10.getOperand(0);
01330               N101 = N10.getOperand(1);
01331               if (isa<ConstantSDNode>(N101)) {
01332                 int64_t CN0 = cast<ConstantSDNode>(N101)->getSignExtended();
01333                 if (CN0 == 32) {
01334                   N11 = N1.getOperand(1);
01335                   if (N11.getOpcode() == ISD::Constant &&
01336                       Predicate_isMIX4Lable(N11.Val) &&
01337                       N.Val->getValueType(0) == MVT::i64 &&
01338                       N101.Val->getValueType(0) == MVT::i64) {
01339                     Select(Tmp1, N00);
01340                     Select(Tmp2, N100);
01341                     if (N.Val->hasOneUse()) {
01342                       Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX4L, MVT::i64, Tmp1, Tmp2);
01343                     } else {
01344                       ResNode = CurDAG->getTargetNode(IA64::MIX4L, MVT::i64, Tmp1, Tmp2);
01345                       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01346                       Result = SDOperand(ResNode, 0);
01347                     }
01348                     return;
01349                   }
01350                 }
01351               }
01352             }
01353           }
01354         }
01355       }
01356     }
01357     if (N00.getOpcode() == ISD::SHL) {
01358       N000 = N00.getOperand(0);
01359       N001 = N00.getOperand(1);
01360       if (isa<ConstantSDNode>(N001)) {
01361         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
01362 
01363         // Pattern: (or:i64 (and:i64 (shl:i64 GR:i64:$src1, 8:i64), (imm:i64)<<P:Predicate_isMIX1Rable>>), (and:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_isMIX1Rable>>))
01364         // Emits: (MIX1R:i64 GR:i64:$src1, GR:i64:$src2)
01365         // Pattern complexity = 17  cost = 1
01366         if (CN0 == 8) {
01367           N01 = N0.getOperand(1);
01368           if (N01.getOpcode() == ISD::Constant &&
01369               Predicate_isMIX1Rable(N01.Val)) {
01370             N1 = N.getOperand(1);
01371             if (N1.getOpcode() == ISD::AND) {
01372               N10 = N1.getOperand(0);
01373               N11 = N1.getOperand(1);
01374               if (N11.getOpcode() == ISD::Constant &&
01375                   Predicate_isMIX1Rable(N11.Val) &&
01376                   N.Val->getValueType(0) == MVT::i64 &&
01377                   N001.Val->getValueType(0) == MVT::i64) {
01378                 Select(Tmp1, N000);
01379                 Select(Tmp2, N10);
01380                 if (N.Val->hasOneUse()) {
01381                   Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX1R, MVT::i64, Tmp1, Tmp2);
01382                 } else {
01383                   ResNode = CurDAG->getTargetNode(IA64::MIX1R, MVT::i64, Tmp1, Tmp2);
01384                   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01385                   Result = SDOperand(ResNode, 0);
01386                 }
01387                 return;
01388               }
01389             }
01390           }
01391         }
01392 
01393         // Pattern: (or:i64 (and:i64 (shl:i64 GR:i64:$src1, 16:i64), (imm:i64)<<P:Predicate_isMIX2Rable>>), (and:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_isMIX2Rable>>))
01394         // Emits: (MIX2R:i64 GR:i64:$src1, GR:i64:$src2)
01395         // Pattern complexity = 17  cost = 1
01396         if (CN0 == 16) {
01397           N01 = N0.getOperand(1);
01398           if (N01.getOpcode() == ISD::Constant &&
01399               Predicate_isMIX2Rable(N01.Val)) {
01400             N1 = N.getOperand(1);
01401             if (N1.getOpcode() == ISD::AND) {
01402               N10 = N1.getOperand(0);
01403               N11 = N1.getOperand(1);
01404               if (N11.getOpcode() == ISD::Constant &&
01405                   Predicate_isMIX2Rable(N11.Val) &&
01406                   N.Val->getValueType(0) == MVT::i64 &&
01407                   N001.Val->getValueType(0) == MVT::i64) {
01408                 Select(Tmp1, N000);
01409                 Select(Tmp2, N10);
01410                 if (N.Val->hasOneUse()) {
01411                   Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX2R, MVT::i64, Tmp1, Tmp2);
01412                 } else {
01413                   ResNode = CurDAG->getTargetNode(IA64::MIX2R, MVT::i64, Tmp1, Tmp2);
01414                   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01415                   Result = SDOperand(ResNode, 0);
01416                 }
01417                 return;
01418               }
01419             }
01420           }
01421         }
01422 
01423         // Pattern: (or:i64 (and:i64 (shl:i64 GR:i64:$src1, 32:i64), (imm:i64)<<P:Predicate_isMIX4Rable>>), (and:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_isMIX4Rable>>))
01424         // Emits: (MIX4R:i64 GR:i64:$src1, GR:i64:$src2)
01425         // Pattern complexity = 17  cost = 1
01426         if (CN0 == 32) {
01427           N01 = N0.getOperand(1);
01428           if (N01.getOpcode() == ISD::Constant &&
01429               Predicate_isMIX4Rable(N01.Val)) {
01430             N1 = N.getOperand(1);
01431             if (N1.getOpcode() == ISD::AND) {
01432               N10 = N1.getOperand(0);
01433               N11 = N1.getOperand(1);
01434               if (N11.getOpcode() == ISD::Constant &&
01435                   Predicate_isMIX4Rable(N11.Val) &&
01436                   N.Val->getValueType(0) == MVT::i64 &&
01437                   N001.Val->getValueType(0) == MVT::i64) {
01438                 Select(Tmp1, N000);
01439                 Select(Tmp2, N10);
01440                 if (N.Val->hasOneUse()) {
01441                   Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX4R, MVT::i64, Tmp1, Tmp2);
01442                 } else {
01443                   ResNode = CurDAG->getTargetNode(IA64::MIX4R, MVT::i64, Tmp1, Tmp2);
01444                   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01445                   Result = SDOperand(ResNode, 0);
01446                 }
01447                 return;
01448               }
01449             }
01450           }
01451         }
01452       }
01453     }
01454     if (N00.getOpcode() == ISD::SRL) {
01455       N000 = N00.getOperand(0);
01456       N001 = N00.getOperand(1);
01457       if (isa<ConstantSDNode>(N001)) {
01458         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
01459 
01460         // Pattern: (or:i64 (and:i64 (srl:i64 GR:i64:$src2, 8:i64), (imm:i64)<<P:Predicate_isMIX1Lable>>), (and:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isMIX1Lable>>))
01461         // Emits: (MIX1L:i64 GR:i64:$src1, GR:i64:$src2)
01462         // Pattern complexity = 17  cost = 1
01463         if (CN0 == 8) {
01464           N01 = N0.getOperand(1);
01465           if (N01.getOpcode() == ISD::Constant &&
01466               Predicate_isMIX1Lable(N01.Val)) {
01467             N1 = N.getOperand(1);
01468             if (N1.getOpcode() == ISD::AND) {
01469               N10 = N1.getOperand(0);
01470               N11 = N1.getOperand(1);
01471               if (N11.getOpcode() == ISD::Constant &&
01472                   Predicate_isMIX1Lable(N11.Val) &&
01473                   N.Val->getValueType(0) == MVT::i64 &&
01474                   N001.Val->getValueType(0) == MVT::i64) {
01475                 Select(Tmp1, N10);
01476                 Select(Tmp2, N000);
01477                 if (N.Val->hasOneUse()) {
01478                   Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX1L, MVT::i64, Tmp1, Tmp2);
01479                 } else {
01480                   ResNode = CurDAG->getTargetNode(IA64::MIX1L, MVT::i64, Tmp1, Tmp2);
01481                   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01482                   Result = SDOperand(ResNode, 0);
01483                 }
01484                 return;
01485               }
01486             }
01487           }
01488         }
01489 
01490         // Pattern: (or:i64 (and:i64 (srl:i64 GR:i64:$src2, 16:i64), (imm:i64)<<P:Predicate_isMIX2Lable>>), (and:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isMIX2Lable>>))
01491         // Emits: (MIX2L:i64 GR:i64:$src1, GR:i64:$src2)
01492         // Pattern complexity = 17  cost = 1
01493         if (CN0 == 16) {
01494           N01 = N0.getOperand(1);
01495           if (N01.getOpcode() == ISD::Constant &&
01496               Predicate_isMIX2Lable(N01.Val)) {
01497             N1 = N.getOperand(1);
01498             if (N1.getOpcode() == ISD::AND) {
01499               N10 = N1.getOperand(0);
01500               N11 = N1.getOperand(1);
01501               if (N11.getOpcode() == ISD::Constant &&
01502                   Predicate_isMIX2Lable(N11.Val) &&
01503                   N.Val->getValueType(0) == MVT::i64 &&
01504                   N001.Val->getValueType(0) == MVT::i64) {
01505                 Select(Tmp1, N10);
01506                 Select(Tmp2, N000);
01507                 if (N.Val->hasOneUse()) {
01508                   Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX2L, MVT::i64, Tmp1, Tmp2);
01509                 } else {
01510                   ResNode = CurDAG->getTargetNode(IA64::MIX2L, MVT::i64, Tmp1, Tmp2);
01511                   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01512                   Result = SDOperand(ResNode, 0);
01513                 }
01514                 return;
01515               }
01516             }
01517           }
01518         }
01519 
01520         // Pattern: (or:i64 (and:i64 (srl:i64 GR:i64:$src2, 32:i64), (imm:i64)<<P:Predicate_isMIX4Lable>>), (and:i64 GR:i64:$src1, (imm:i64)<<P:Predicate_isMIX4Lable>>))
01521         // Emits: (MIX4L:i64 GR:i64:$src1, GR:i64:$src2)
01522         // Pattern complexity = 17  cost = 1
01523         if (CN0 == 32) {
01524           N01 = N0.getOperand(1);
01525           if (N01.getOpcode() == ISD::Constant &&
01526               Predicate_isMIX4Lable(N01.Val)) {
01527             N1 = N.getOperand(1);
01528             if (N1.getOpcode() == ISD::AND) {
01529               N10 = N1.getOperand(0);
01530               N11 = N1.getOperand(1);
01531               if (N11.getOpcode() == ISD::Constant &&
01532                   Predicate_isMIX4Lable(N11.Val) &&
01533                   N.Val->getValueType(0) == MVT::i64 &&
01534                   N001.Val->getValueType(0) == MVT::i64) {
01535                 Select(Tmp1, N10);
01536                 Select(Tmp2, N000);
01537                 if (N.Val->hasOneUse()) {
01538                   Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX4L, MVT::i64, Tmp1, Tmp2);
01539                 } else {
01540                   ResNode = CurDAG->getTargetNode(IA64::MIX4L, MVT::i64, Tmp1, Tmp2);
01541                   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01542                   Result = SDOperand(ResNode, 0);
01543                 }
01544                 return;
01545               }
01546             }
01547           }
01548         }
01549       }
01550     }
01551     N01 = N0.getOperand(1);
01552     if (N01.getOpcode() == ISD::Constant) {
01553 
01554       // Pattern: (or:i64 (and:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_isMIX1Rable>>), (and:i64 (shl:i64 GR:i64:$src1, 8:i64), (imm:i64)<<P:Predicate_isMIX1Rable>>))
01555       // Emits: (MIX1R:i64 GR:i64:$src1, GR:i64:$src2)
01556       // Pattern complexity = 17  cost = 1
01557       if (Predicate_isMIX1Rable(N01.Val)) {
01558         N1 = N.getOperand(1);
01559         if (N1.getOpcode() == ISD::AND) {
01560           N10 = N1.getOperand(0);
01561           if (N10.getOpcode() == ISD::SHL) {
01562             N100 = N10.getOperand(0);
01563             N101 = N10.getOperand(1);
01564             if (isa<ConstantSDNode>(N101)) {
01565               int64_t CN0 = cast<ConstantSDNode>(N101)->getSignExtended();
01566               if (CN0 == 8) {
01567                 N11 = N1.getOperand(1);
01568                 if (N11.getOpcode() == ISD::Constant &&
01569                     Predicate_isMIX1Rable(N11.Val) &&
01570                     N.Val->getValueType(0) == MVT::i64 &&
01571                     N101.Val->getValueType(0) == MVT::i64) {
01572                   Select(Tmp1, N100);
01573                   Select(Tmp2, N00);
01574                   if (N.Val->hasOneUse()) {
01575                     Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX1R, MVT::i64, Tmp1, Tmp2);
01576                   } else {
01577                     ResNode = CurDAG->getTargetNode(IA64::MIX1R, MVT::i64, Tmp1, Tmp2);
01578                     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01579                     Result = SDOperand(ResNode, 0);
01580                   }
01581                   return;
01582                 }
01583               }
01584             }
01585           }
01586         }
01587       }
01588 
01589       // Pattern: (or:i64 (and:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_isMIX2Rable>>), (and:i64 (shl:i64 GR:i64:$src1, 16:i64), (imm:i64)<<P:Predicate_isMIX2Rable>>))
01590       // Emits: (MIX2R:i64 GR:i64:$src1, GR:i64:$src2)
01591       // Pattern complexity = 17  cost = 1
01592       if (Predicate_isMIX2Rable(N01.Val)) {
01593         N1 = N.getOperand(1);
01594         if (N1.getOpcode() == ISD::AND) {
01595           N10 = N1.getOperand(0);
01596           if (N10.getOpcode() == ISD::SHL) {
01597             N100 = N10.getOperand(0);
01598             N101 = N10.getOperand(1);
01599             if (isa<ConstantSDNode>(N101)) {
01600               int64_t CN0 = cast<ConstantSDNode>(N101)->getSignExtended();
01601               if (CN0 == 16) {
01602                 N11 = N1.getOperand(1);
01603                 if (N11.getOpcode() == ISD::Constant &&
01604                     Predicate_isMIX2Rable(N11.Val) &&
01605                     N.Val->getValueType(0) == MVT::i64 &&
01606                     N101.Val->getValueType(0) == MVT::i64) {
01607                   Select(Tmp1, N100);
01608                   Select(Tmp2, N00);
01609                   if (N.Val->hasOneUse()) {
01610                     Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX2R, MVT::i64, Tmp1, Tmp2);
01611                   } else {
01612                     ResNode = CurDAG->getTargetNode(IA64::MIX2R, MVT::i64, Tmp1, Tmp2);
01613                     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01614                     Result = SDOperand(ResNode, 0);
01615                   }
01616                   return;
01617                 }
01618               }
01619             }
01620           }
01621         }
01622       }
01623 
01624       // Pattern: (or:i64 (and:i64 GR:i64:$src2, (imm:i64)<<P:Predicate_isMIX4Rable>>), (and:i64 (shl:i64 GR:i64:$src1, 32:i64), (imm:i64)<<P:Predicate_isMIX4Rable>>))
01625       // Emits: (MIX4R:i64 GR:i64:$src1, GR:i64:$src2)
01626       // Pattern complexity = 17  cost = 1
01627       if (Predicate_isMIX4Rable(N01.Val)) {
01628         N1 = N.getOperand(1);
01629         if (N1.getOpcode() == ISD::AND) {
01630           N10 = N1.getOperand(0);
01631           if (N10.getOpcode() == ISD::SHL) {
01632             N100 = N10.getOperand(0);
01633             N101 = N10.getOperand(1);
01634             if (isa<ConstantSDNode>(N101)) {
01635               int64_t CN0 = cast<ConstantSDNode>(N101)->getSignExtended();
01636               if (CN0 == 32) {
01637                 N11 = N1.getOperand(1);
01638                 if (N11.getOpcode() == ISD::Constant &&
01639                     Predicate_isMIX4Rable(N11.Val) &&
01640                     N.Val->getValueType(0) == MVT::i64 &&
01641                     N101.Val->getValueType(0) == MVT::i64) {
01642                   Select(Tmp1, N100);
01643                   Select(Tmp2, N00);
01644                   if (N.Val->hasOneUse()) {
01645                     Result = CurDAG->SelectNodeTo(N.Val, IA64::MIX4R, MVT::i64, Tmp1, Tmp2);
01646                   } else {
01647                     ResNode = CurDAG->getTargetNode(IA64::MIX4R, MVT::i64, Tmp1, Tmp2);
01648                     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01649                     Result = SDOperand(ResNode, 0);
01650                   }
01651                   return;
01652                 }
01653               }
01654             }
01655           }
01656         }
01657       }
01658     }
01659   }
01660   N1 = N.getOperand(1);
01661 
01662   // Pattern: (or:i64 GR:i64:$src1, GR:i64:$src2)
01663   // Emits: (OR:i64 GR:i64:$src1, GR:i64:$src2)
01664   // Pattern complexity = 2  cost = 1
01665   if (N.Val->getValueType(0) == MVT::i64) {
01666     Select(Tmp0, N0);
01667     Select(Tmp1, N1);
01668     if (N.Val->hasOneUse()) {
01669       Result = CurDAG->SelectNodeTo(N.Val, IA64::OR, MVT::i64, Tmp0, Tmp1);
01670     } else {
01671       ResNode = CurDAG->getTargetNode(IA64::OR, MVT::i64, Tmp0, Tmp1);
01672       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01673       Result = SDOperand(ResNode, 0);
01674     }
01675     return;
01676   }
01677 
01678   // Pattern: (or:i1 PR:i1:$src1, PR:i1:$src2)
01679   // Emits: (TPCMPEQR0R0:i1 (PCMPEQUNCR0R0:i1 PR:i1:$src1), PR:i1:$src2)
01680   // Pattern complexity = 2  cost = 2
01681   if (N.Val->getValueType(0) == MVT::i1) {
01682     Select(Tmp0, N0);
01683     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::PCMPEQUNCR0R0, MVT::i1, Tmp0), 0);
01684     Select(Tmp2, N1);
01685     if (N.Val->hasOneUse()) {
01686       Result = CurDAG->SelectNodeTo(N.Val, IA64::TPCMPEQR0R0, MVT::i1, Tmp1, Tmp2);
01687     } else {
01688       ResNode = CurDAG->getTargetNode(IA64::TPCMPEQR0R0, MVT::i1, Tmp1, Tmp2);
01689       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01690       Result = SDOperand(ResNode, 0);
01691     }
01692     return;
01693   }
01694   std::cerr << "Cannot yet select: ";
01695   N.Val->dump(CurDAG);
01696   std::cerr << '\n';
01697   abort();
01698 }
01699 
01700 void Select_ret(SDOperand &Result, SDOperand N) {
01701   SDOperand Chain(0, 0);
01702   SDNode *ResNode;
01703   Chain = N.getOperand(0);
01704   Select(Chain, Chain);
01705   ResNode = CurDAG->getTargetNode(IA64::RET, MVT::Other, Chain);
01706   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
01707   Result = SDOperand(ResNode, N.ResNo);
01708   return;
01709 }
01710 
01711 void Select_retflag(SDOperand &Result, SDOperand N) {
01712   SDOperand Chain(0, 0);
01713   SDOperand InFlag(0, 0);
01714   SDNode *ResNode;
01715   Chain = N.getOperand(0);
01716   bool HasOptInFlag = false;
01717   Select(Chain, Chain);
01718   if (N.getNumOperands() == 2) {
01719     Select(InFlag, N.getOperand(1));
01720     HasOptInFlag = true;
01721   }
01722   if (HasOptInFlag)
01723     ResNode = CurDAG->getTargetNode(IA64::RET, MVT::Other, Chain, InFlag);
01724   else
01725     ResNode = CurDAG->getTargetNode(IA64::RET, MVT::Other, Chain);
01726   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
01727   Result = SDOperand(ResNode, N.ResNo);
01728   return;
01729 }
01730 
01731 void Select_select(SDOperand &Result, SDOperand N) {
01732   SDOperand N0(0, 0);
01733   SDOperand N1(0, 0);
01734   SDOperand N2(0, 0);
01735   SDOperand Tmp0(0, 0);
01736   SDOperand Tmp1(0, 0);
01737   SDOperand Tmp10(0, 0);
01738   SDOperand Tmp11(0, 0);
01739   SDOperand Tmp12(0, 0);
01740   SDOperand Tmp13(0, 0);
01741   SDOperand Tmp14(0, 0);
01742   SDOperand Tmp15(0, 0);
01743   SDOperand Tmp2(0, 0);
01744   SDOperand Tmp3(0, 0);
01745   SDOperand Tmp4(0, 0);
01746   SDOperand Tmp5(0, 0);
01747   SDOperand Tmp6(0, 0);
01748   SDOperand Tmp7(0, 0);
01749   SDOperand Tmp8(0, 0);
01750   SDOperand Tmp9(0, 0);
01751   SDNode *ResNode;
01752   N0 = N.getOperand(0);
01753   N1 = N.getOperand(1);
01754   N2 = N.getOperand(2);
01755 
01756   // Pattern: (select:f64 PR:i1:$which, FP:f64:$src1, FP:f64:$src2)
01757   // Emits: (CFMOV:f64 (FMOV:f64 FP:f64:$src2), FP:f64:$src1, PR:i1:$which)
01758   // Pattern complexity = 2  cost = 2
01759   if (N.Val->getValueType(0) == MVT::f64 &&
01760       N0.Val->getValueType(0) == MVT::i1) {
01761     Select(Tmp0, N2);
01762     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::FMOV, MVT::f64, Tmp0), 0);
01763     Select(Tmp2, N1);
01764     Select(Tmp3, N0);
01765     if (N.Val->hasOneUse()) {
01766       Result = CurDAG->SelectNodeTo(N.Val, IA64::CFMOV, MVT::f64, Tmp1, Tmp2, Tmp3);
01767     } else {
01768       ResNode = CurDAG->getTargetNode(IA64::CFMOV, MVT::f64, Tmp1, Tmp2, Tmp3);
01769       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01770       Result = SDOperand(ResNode, 0);
01771     }
01772     return;
01773   }
01774 
01775   // Pattern: (select:i64 PR:i1:$which, GR:i64:$src1, GR:i64:$src2)
01776   // Emits: (CMOV:i64 (MOV:i64 GR:i64:$src2), GR:i64:$src1, PR:i1:$which)
01777   // Pattern complexity = 2  cost = 2
01778   if (N.Val->getValueType(0) == MVT::i64 &&
01779       N0.Val->getValueType(0) == MVT::i1) {
01780     Select(Tmp0, N2);
01781     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::MOV, MVT::i64, Tmp0), 0);
01782     Select(Tmp2, N1);
01783     Select(Tmp3, N0);
01784     if (N.Val->hasOneUse()) {
01785       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMOV, MVT::i64, Tmp1, Tmp2, Tmp3);
01786     } else {
01787       ResNode = CurDAG->getTargetNode(IA64::CMOV, MVT::i64, Tmp1, Tmp2, Tmp3);
01788       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01789       Result = SDOperand(ResNode, 0);
01790     }
01791     return;
01792   }
01793 
01794   // Pattern: (select:i1 PR:i1:$which, PR:i1:$src1, PR:i1:$src2)
01795   // Emits: (CMPNE:i1 (CMOV:i64 (MOV:i64 (TPCADDIMM22:i64 (ADDS:i64 r0:i64, 0:i64), 1:i64, PR:i1:$src2)), (TPCADDIMM22:i64 (ADDS:i64 r0:i64, 0:i64), 1:i64, PR:i1:$src1), PR:i1:$which), r0:i64)
01796   // Pattern complexity = 2  cost = 7
01797   if (N.Val->getValueType(0) == MVT::i1 &&
01798       N0.Val->getValueType(0) == MVT::i1) {
01799     Tmp0 = CurDAG->getRegister(IA64::r0, MVT::i64);
01800     Tmp1 = CurDAG->getTargetConstant(0, MVT::i64);
01801     Tmp2 = SDOperand(CurDAG->getTargetNode(IA64::ADDS, MVT::i64, Tmp0, Tmp1), 0);
01802     Tmp3 = CurDAG->getTargetConstant(1, MVT::i64);
01803     Select(Tmp4, N2);
01804     Tmp5 = SDOperand(CurDAG->getTargetNode(IA64::TPCADDIMM22, MVT::i64, Tmp2, Tmp3, Tmp4), 0);
01805     Tmp6 = SDOperand(CurDAG->getTargetNode(IA64::MOV, MVT::i64, Tmp5), 0);
01806     Tmp7 = CurDAG->getRegister(IA64::r0, MVT::i64);
01807     Tmp8 = CurDAG->getTargetConstant(0, MVT::i64);
01808     Tmp9 = SDOperand(CurDAG->getTargetNode(IA64::ADDS, MVT::i64, Tmp7, Tmp8), 0);
01809     Tmp10 = CurDAG->getTargetConstant(1, MVT::i64);
01810     Select(Tmp11, N1);
01811     Tmp12 = SDOperand(CurDAG->getTargetNode(IA64::TPCADDIMM22, MVT::i64, Tmp9, Tmp10, Tmp11), 0);
01812     Select(Tmp13, N0);
01813     Tmp14 = SDOperand(CurDAG->getTargetNode(IA64::CMOV, MVT::i64, Tmp6, Tmp12, Tmp13), 0);
01814     Tmp15 = CurDAG->getRegister(IA64::r0, MVT::i64);
01815     if (N.Val->hasOneUse()) {
01816       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPNE, MVT::i1, Tmp14, Tmp15);
01817     } else {
01818       ResNode = CurDAG->getTargetNode(IA64::CMPNE, MVT::i1, Tmp14, Tmp15);
01819       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01820       Result = SDOperand(ResNode, 0);
01821     }
01822     return;
01823   }
01824   std::cerr << "Cannot yet select: ";
01825   N.Val->dump(CurDAG);
01826   std::cerr << '\n';
01827   abort();
01828 }
01829 
01830 void Select_setcc(SDOperand &Result, SDOperand N) {
01831   SDOperand N0(0, 0);
01832   SDOperand N1(0, 0);
01833   SDOperand N2(0, 0);
01834   SDOperand Tmp0(0, 0);
01835   SDOperand Tmp1(0, 0);
01836   SDNode *ResNode;
01837   N0 = N.getOperand(0);
01838   N1 = N.getOperand(1);
01839   N2 = N.getOperand(2);
01840 
01841   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETEQ:Other)
01842   // Emits: (CMPEQ:i1 GR:i64:$src1, GR:i64:$src2)
01843   // Pattern complexity = 2  cost = 1
01844   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETEQ &&
01845       N.Val->getValueType(0) == MVT::i1 &&
01846       N0.Val->getValueType(0) == MVT::i64) {
01847     Select(Tmp0, N0);
01848     Select(Tmp1, N1);
01849     if (N.Val->hasOneUse()) {
01850       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPEQ, MVT::i1, Tmp0, Tmp1);
01851     } else {
01852       ResNode = CurDAG->getTargetNode(IA64::CMPEQ, MVT::i1, Tmp0, Tmp1);
01853       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01854       Result = SDOperand(ResNode, 0);
01855     }
01856     return;
01857   }
01858 
01859   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETGT:Other)
01860   // Emits: (CMPGT:i1 GR:i64:$src1, GR:i64:$src2)
01861   // Pattern complexity = 2  cost = 1
01862   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGT &&
01863       N.Val->getValueType(0) == MVT::i1 &&
01864       N0.Val->getValueType(0) == MVT::i64) {
01865     Select(Tmp0, N0);
01866     Select(Tmp1, N1);
01867     if (N.Val->hasOneUse()) {
01868       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPGT, MVT::i1, Tmp0, Tmp1);
01869     } else {
01870       ResNode = CurDAG->getTargetNode(IA64::CMPGT, MVT::i1, Tmp0, Tmp1);
01871       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01872       Result = SDOperand(ResNode, 0);
01873     }
01874     return;
01875   }
01876 
01877   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETGE:Other)
01878   // Emits: (CMPGE:i1 GR:i64:$src1, GR:i64:$src2)
01879   // Pattern complexity = 2  cost = 1
01880   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGE &&
01881       N.Val->getValueType(0) == MVT::i1 &&
01882       N0.Val->getValueType(0) == MVT::i64) {
01883     Select(Tmp0, N0);
01884     Select(Tmp1, N1);
01885     if (N.Val->hasOneUse()) {
01886       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPGE, MVT::i1, Tmp0, Tmp1);
01887     } else {
01888       ResNode = CurDAG->getTargetNode(IA64::CMPGE, MVT::i1, Tmp0, Tmp1);
01889       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01890       Result = SDOperand(ResNode, 0);
01891     }
01892     return;
01893   }
01894 
01895   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETLT:Other)
01896   // Emits: (CMPLT:i1 GR:i64:$src1, GR:i64:$src2)
01897   // Pattern complexity = 2  cost = 1
01898   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLT &&
01899       N.Val->getValueType(0) == MVT::i1 &&
01900       N0.Val->getValueType(0) == MVT::i64) {
01901     Select(Tmp0, N0);
01902     Select(Tmp1, N1);
01903     if (N.Val->hasOneUse()) {
01904       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPLT, MVT::i1, Tmp0, Tmp1);
01905     } else {
01906       ResNode = CurDAG->getTargetNode(IA64::CMPLT, MVT::i1, Tmp0, Tmp1);
01907       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01908       Result = SDOperand(ResNode, 0);
01909     }
01910     return;
01911   }
01912 
01913   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETLE:Other)
01914   // Emits: (CMPLE:i1 GR:i64:$src1, GR:i64:$src2)
01915   // Pattern complexity = 2  cost = 1
01916   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLE &&
01917       N.Val->getValueType(0) == MVT::i1 &&
01918       N0.Val->getValueType(0) == MVT::i64) {
01919     Select(Tmp0, N0);
01920     Select(Tmp1, N1);
01921     if (N.Val->hasOneUse()) {
01922       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPLE, MVT::i1, Tmp0, Tmp1);
01923     } else {
01924       ResNode = CurDAG->getTargetNode(IA64::CMPLE, MVT::i1, Tmp0, Tmp1);
01925       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01926       Result = SDOperand(ResNode, 0);
01927     }
01928     return;
01929   }
01930 
01931   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETNE:Other)
01932   // Emits: (CMPNE:i1 GR:i64:$src1, GR:i64:$src2)
01933   // Pattern complexity = 2  cost = 1
01934   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETNE &&
01935       N.Val->getValueType(0) == MVT::i1 &&
01936       N0.Val->getValueType(0) == MVT::i64) {
01937     Select(Tmp0, N0);
01938     Select(Tmp1, N1);
01939     if (N.Val->hasOneUse()) {
01940       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPNE, MVT::i1, Tmp0, Tmp1);
01941     } else {
01942       ResNode = CurDAG->getTargetNode(IA64::CMPNE, MVT::i1, Tmp0, Tmp1);
01943       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01944       Result = SDOperand(ResNode, 0);
01945     }
01946     return;
01947   }
01948 
01949   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETULT:Other)
01950   // Emits: (CMPLTU:i1 GR:i64:$src1, GR:i64:$src2)
01951   // Pattern complexity = 2  cost = 1
01952   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULT &&
01953       N.Val->getValueType(0) == MVT::i1 &&
01954       N0.Val->getValueType(0) == MVT::i64) {
01955     Select(Tmp0, N0);
01956     Select(Tmp1, N1);
01957     if (N.Val->hasOneUse()) {
01958       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPLTU, MVT::i1, Tmp0, Tmp1);
01959     } else {
01960       ResNode = CurDAG->getTargetNode(IA64::CMPLTU, MVT::i1, Tmp0, Tmp1);
01961       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01962       Result = SDOperand(ResNode, 0);
01963     }
01964     return;
01965   }
01966 
01967   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETUGT:Other)
01968   // Emits: (CMPGTU:i1 GR:i64:$src1, GR:i64:$src2)
01969   // Pattern complexity = 2  cost = 1
01970   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGT &&
01971       N.Val->getValueType(0) == MVT::i1 &&
01972       N0.Val->getValueType(0) == MVT::i64) {
01973     Select(Tmp0, N0);
01974     Select(Tmp1, N1);
01975     if (N.Val->hasOneUse()) {
01976       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPGTU, MVT::i1, Tmp0, Tmp1);
01977     } else {
01978       ResNode = CurDAG->getTargetNode(IA64::CMPGTU, MVT::i1, Tmp0, Tmp1);
01979       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01980       Result = SDOperand(ResNode, 0);
01981     }
01982     return;
01983   }
01984 
01985   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETULE:Other)
01986   // Emits: (CMPLEU:i1 GR:i64:$src1, GR:i64:$src2)
01987   // Pattern complexity = 2  cost = 1
01988   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULE &&
01989       N.Val->getValueType(0) == MVT::i1 &&
01990       N0.Val->getValueType(0) == MVT::i64) {
01991     Select(Tmp0, N0);
01992     Select(Tmp1, N1);
01993     if (N.Val->hasOneUse()) {
01994       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPLEU, MVT::i1, Tmp0, Tmp1);
01995     } else {
01996       ResNode = CurDAG->getTargetNode(IA64::CMPLEU, MVT::i1, Tmp0, Tmp1);
01997       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01998       Result = SDOperand(ResNode, 0);
01999     }
02000     return;
02001   }
02002 
02003   // Pattern: (setcc:i1 GR:i64:$src1, GR:i64:$src2, SETUGE:Other)
02004   // Emits: (CMPGEU:i1 GR:i64:$src1, GR:i64:$src2)
02005   // Pattern complexity = 2  cost = 1
02006   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE &&
02007       N.Val->getValueType(0) == MVT::i1 &&
02008       N0.Val->getValueType(0) == MVT::i64) {
02009     Select(Tmp0, N0);
02010     Select(Tmp1, N1);
02011     if (N.Val->hasOneUse()) {
02012       Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPGEU, MVT::i1, Tmp0, Tmp1);
02013     } else {
02014       ResNode = CurDAG->getTargetNode(IA64::CMPGEU, MVT::i1, Tmp0, Tmp1);
02015       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02016       Result = SDOperand(ResNode, 0);
02017     }
02018     return;
02019   }
02020 
02021   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETEQ:Other)
02022   // Emits: (FCMPEQ:i1 FP:f64:$src1, FP:f64:$src2)
02023   // Pattern complexity = 2  cost = 1
02024   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETEQ &&
02025       N.Val->getValueType(0) == MVT::i1 &&
02026       N0.Val->getValueType(0) == MVT::f64) {
02027     Select(Tmp0, N0);
02028     Select(Tmp1, N1);
02029     if (N.Val->hasOneUse()) {
02030       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPEQ, MVT::i1, Tmp0, Tmp1);
02031     } else {
02032       ResNode = CurDAG->getTargetNode(IA64::FCMPEQ, MVT::i1, Tmp0, Tmp1);
02033       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02034       Result = SDOperand(ResNode, 0);
02035     }
02036     return;
02037   }
02038 
02039   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETGT:Other)
02040   // Emits: (FCMPGT:i1 FP:f64:$src1, FP:f64:$src2)
02041   // Pattern complexity = 2  cost = 1
02042   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGT &&
02043       N.Val->getValueType(0) == MVT::i1 &&
02044       N0.Val->getValueType(0) == MVT::f64) {
02045     Select(Tmp0, N0);
02046     Select(Tmp1, N1);
02047     if (N.Val->hasOneUse()) {
02048       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPGT, MVT::i1, Tmp0, Tmp1);
02049     } else {
02050       ResNode = CurDAG->getTargetNode(IA64::FCMPGT, MVT::i1, Tmp0, Tmp1);
02051       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02052       Result = SDOperand(ResNode, 0);
02053     }
02054     return;
02055   }
02056 
02057   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETGE:Other)
02058   // Emits: (FCMPGE:i1 FP:f64:$src1, FP:f64:$src2)
02059   // Pattern complexity = 2  cost = 1
02060   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGE &&
02061       N.Val->getValueType(0) == MVT::i1 &&
02062       N0.Val->getValueType(0) == MVT::f64) {
02063     Select(Tmp0, N0);
02064     Select(Tmp1, N1);
02065     if (N.Val->hasOneUse()) {
02066       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPGE, MVT::i1, Tmp0, Tmp1);
02067     } else {
02068       ResNode = CurDAG->getTargetNode(IA64::FCMPGE, MVT::i1, Tmp0, Tmp1);
02069       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02070       Result = SDOperand(ResNode, 0);
02071     }
02072     return;
02073   }
02074 
02075   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETLT:Other)
02076   // Emits: (FCMPLT:i1 FP:f64:$src1, FP:f64:$src2)
02077   // Pattern complexity = 2  cost = 1
02078   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLT &&
02079       N.Val->getValueType(0) == MVT::i1 &&
02080       N0.Val->getValueType(0) == MVT::f64) {
02081     Select(Tmp0, N0);
02082     Select(Tmp1, N1);
02083     if (N.Val->hasOneUse()) {
02084       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPLT, MVT::i1, Tmp0, Tmp1);
02085     } else {
02086       ResNode = CurDAG->getTargetNode(IA64::FCMPLT, MVT::i1, Tmp0, Tmp1);
02087       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02088       Result = SDOperand(ResNode, 0);
02089     }
02090     return;
02091   }
02092 
02093   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETLE:Other)
02094   // Emits: (FCMPLE:i1 FP:f64:$src1, FP:f64:$src2)
02095   // Pattern complexity = 2  cost = 1
02096   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLE &&
02097       N.Val->getValueType(0) == MVT::i1 &&
02098       N0.Val->getValueType(0) == MVT::f64) {
02099     Select(Tmp0, N0);
02100     Select(Tmp1, N1);
02101     if (N.Val->hasOneUse()) {
02102       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPLE, MVT::i1, Tmp0, Tmp1);
02103     } else {
02104       ResNode = CurDAG->getTargetNode(IA64::FCMPLE, MVT::i1, Tmp0, Tmp1);
02105       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02106       Result = SDOperand(ResNode, 0);
02107     }
02108     return;
02109   }
02110 
02111   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETNE:Other)
02112   // Emits: (FCMPNE:i1 FP:f64:$src1, FP:f64:$src2)
02113   // Pattern complexity = 2  cost = 1
02114   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETNE &&
02115       N.Val->getValueType(0) == MVT::i1 &&
02116       N0.Val->getValueType(0) == MVT::f64) {
02117     Select(Tmp0, N0);
02118     Select(Tmp1, N1);
02119     if (N.Val->hasOneUse()) {
02120       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPNE, MVT::i1, Tmp0, Tmp1);
02121     } else {
02122       ResNode = CurDAG->getTargetNode(IA64::FCMPNE, MVT::i1, Tmp0, Tmp1);
02123       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02124       Result = SDOperand(ResNode, 0);
02125     }
02126     return;
02127   }
02128 
02129   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETULT:Other)
02130   // Emits: (FCMPLTU:i1 FP:f64:$src1, FP:f64:$src2)
02131   // Pattern complexity = 2  cost = 1
02132   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULT &&
02133       N.Val->getValueType(0) == MVT::i1 &&
02134       N0.Val->getValueType(0) == MVT::f64) {
02135     Select(Tmp0, N0);
02136     Select(Tmp1, N1);
02137     if (N.Val->hasOneUse()) {
02138       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPLTU, MVT::i1, Tmp0, Tmp1);
02139     } else {
02140       ResNode = CurDAG->getTargetNode(IA64::FCMPLTU, MVT::i1, Tmp0, Tmp1);
02141       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02142       Result = SDOperand(ResNode, 0);
02143     }
02144     return;
02145   }
02146 
02147   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETUGT:Other)
02148   // Emits: (FCMPGTU:i1 FP:f64:$src1, FP:f64:$src2)
02149   // Pattern complexity = 2  cost = 1
02150   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGT &&
02151       N.Val->getValueType(0) == MVT::i1 &&
02152       N0.Val->getValueType(0) == MVT::f64) {
02153     Select(Tmp0, N0);
02154     Select(Tmp1, N1);
02155     if (N.Val->hasOneUse()) {
02156       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPGTU, MVT::i1, Tmp0, Tmp1);
02157     } else {
02158       ResNode = CurDAG->getTargetNode(IA64::FCMPGTU, MVT::i1, Tmp0, Tmp1);
02159       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02160       Result = SDOperand(ResNode, 0);
02161     }
02162     return;
02163   }
02164 
02165   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETULE:Other)
02166   // Emits: (FCMPLEU:i1 FP:f64:$src1, FP:f64:$src2)
02167   // Pattern complexity = 2  cost = 1
02168   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULE &&
02169       N.Val->getValueType(0) == MVT::i1 &&
02170       N0.Val->getValueType(0) == MVT::f64) {
02171     Select(Tmp0, N0);
02172     Select(Tmp1, N1);
02173     if (N.Val->hasOneUse()) {
02174       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPLEU, MVT::i1, Tmp0, Tmp1);
02175     } else {
02176       ResNode = CurDAG->getTargetNode(IA64::FCMPLEU, MVT::i1, Tmp0, Tmp1);
02177       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02178       Result = SDOperand(ResNode, 0);
02179     }
02180     return;
02181   }
02182 
02183   // Pattern: (setcc:i1 FP:f64:$src1, FP:f64:$src2, SETUGE:Other)
02184   // Emits: (FCMPGEU:i1 FP:f64:$src1, FP:f64:$src2)
02185   // Pattern complexity = 2  cost = 1
02186   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE &&
02187       N.Val->getValueType(0) == MVT::i1 &&
02188       N0.Val->getValueType(0) == MVT::f64) {
02189     Select(Tmp0, N0);
02190     Select(Tmp1, N1);
02191     if (N.Val->hasOneUse()) {
02192       Result = CurDAG->SelectNodeTo(N.Val, IA64::FCMPGEU, MVT::i1, Tmp0, Tmp1);
02193     } else {
02194       ResNode = CurDAG->getTargetNode(IA64::FCMPGEU, MVT::i1, Tmp0, Tmp1);
02195       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02196       Result = SDOperand(ResNode, 0);
02197     }
02198     return;
02199   }
02200   std::cerr << "Cannot yet select: ";
02201   N.Val->dump(CurDAG);
02202   std::cerr << '\n';
02203   abort();
02204 }
02205 
02206 void Select_sext_inreg(SDOperand &Result, SDOperand N) {
02207   SDOperand N0(0, 0);
02208   SDOperand N1(0, 0);
02209   SDOperand Tmp0(0, 0);
02210   SDNode *ResNode;
02211   N0 = N.getOperand(0);
02212   N1 = N.getOperand(1);
02213 
02214   // Pattern: (sext_inreg:i64 GR:i64:$src, i8:Other)
02215   // Emits: (SXT1:i64 GR:i64:$src)
02216   // Pattern complexity = 2  cost = 1
02217   if (cast<VTSDNode>(N1)->getVT() == MVT::i8 &&
02218       N.Val->getValueType(0) == MVT::i64) {
02219     Select(Tmp0, N0);
02220     if (N.Val->hasOneUse()) {
02221       Result = CurDAG->SelectNodeTo(N.Val, IA64::SXT1, MVT::i64, Tmp0);
02222     } else {
02223       ResNode = CurDAG->getTargetNode(IA64::SXT1, MVT::i64, Tmp0);
02224       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02225       Result = SDOperand(ResNode, 0);
02226     }
02227     return;
02228   }
02229 
02230   // Pattern: (sext_inreg:i64 GR:i64:$src, i16:Other)
02231   // Emits: (SXT2:i64 GR:i64:$src)
02232   // Pattern complexity = 2  cost = 1
02233   if (cast<VTSDNode>(N1)->getVT() == MVT::i16 &&
02234       N.Val->getValueType(0) == MVT::i64) {
02235     Select(Tmp0, N0);
02236     if (N.Val->hasOneUse()) {
02237       Result = CurDAG->SelectNodeTo(N.Val, IA64::SXT2, MVT::i64, Tmp0);
02238     } else {
02239       ResNode = CurDAG->getTargetNode(IA64::SXT2, MVT::i64, Tmp0);
02240       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02241       Result = SDOperand(ResNode, 0);
02242     }
02243     return;
02244   }
02245 
02246   // Pattern: (sext_inreg:i64 GR:i64:$src, i32:Other)
02247   // Emits: (SXT4:i64 GR:i64:$src)
02248   // Pattern complexity = 2  cost = 1
02249   if (cast<VTSDNode>(N1)->getVT() == MVT::i32 &&
02250       N.Val->getValueType(0) == MVT::i64) {
02251     Select(Tmp0, N0);
02252     if (N.Val->hasOneUse()) {
02253       Result = CurDAG->SelectNodeTo(N.Val, IA64::SXT4, MVT::i64, Tmp0);
02254     } else {
02255       ResNode = CurDAG->getTargetNode(IA64::SXT4, MVT::i64, Tmp0);
02256       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02257       Result = SDOperand(ResNode, 0);
02258     }
02259     return;
02260   }
02261   std::cerr << "Cannot yet select: ";
02262   N.Val->dump(CurDAG);
02263   std::cerr << '\n';
02264   abort();
02265 }
02266 
02267 void Select_shl(SDOperand &Result, SDOperand N) {
02268   SDOperand N0(0, 0);
02269   SDOperand N1(0, 0);
02270   SDOperand Tmp0(0, 0);
02271   SDOperand Tmp1(0, 0);
02272   SDNode *ResNode;
02273   N0 = N.getOperand(0);
02274   N1 = N.getOperand(1);
02275   if (N.Val->getValueType(0) == MVT::i64 &&
02276       N1.Val->getValueType(0) == MVT::i64) {
02277     Select(Tmp0, N0);
02278     Select(Tmp1, N1);
02279     if (N.Val->hasOneUse()) {
02280       Result = CurDAG->SelectNodeTo(N.Val, IA64::SHL, MVT::i64, Tmp0, Tmp1);
02281     } else {
02282       ResNode = CurDAG->getTargetNode(IA64::SHL, MVT::i64, Tmp0, Tmp1);
02283       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02284       Result = SDOperand(ResNode, 0);
02285     }
02286     return;
02287   }
02288   std::cerr << "Cannot yet select: ";
02289   N.Val->dump(CurDAG);
02290   std::cerr << '\n';
02291   abort();
02292 }
02293 
02294 void Select_sint_to_fp(SDOperand &Result, SDOperand N) {
02295   SDOperand N0(0, 0);
02296   SDOperand Tmp0(0, 0);
02297   SDOperand Tmp1(0, 0);
02298   SDOperand Tmp2(0, 0);
02299   SDNode *ResNode;
02300   N0 = N.getOperand(0);
02301   if (N0.Val->getValueType(0) == MVT::i64) {
02302     Select(Tmp0, N0);
02303     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIG, MVT::f64, Tmp0), 0);
02304     Tmp2 = SDOperand(CurDAG->getTargetNode(IA64::FCVTXF, MVT::f64, Tmp1), 0);
02305     if (N.Val->hasOneUse()) {
02306       Result = CurDAG->SelectNodeTo(N.Val, IA64::FNORMD, MVT::f64, Tmp2);
02307     } else {
02308       ResNode = CurDAG->getTargetNode(IA64::FNORMD, MVT::f64, Tmp2);
02309       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02310       Result = SDOperand(ResNode, 0);
02311     }
02312     return;
02313   }
02314   std::cerr << "Cannot yet select: ";
02315   N.Val->dump(CurDAG);
02316   std::cerr << '\n';
02317   abort();
02318 }
02319 
02320 void Select_sra(SDOperand &Result, SDOperand N) {
02321   SDOperand N0(0, 0);
02322   SDOperand N1(0, 0);
02323   SDOperand Tmp0(0, 0);
02324   SDOperand Tmp1(0, 0);
02325   SDNode *ResNode;
02326   N0 = N.getOperand(0);
02327   N1 = N.getOperand(1);
02328   if (N.Val->getValueType(0) == MVT::i64 &&
02329       N1.Val->getValueType(0) == MVT::i64) {
02330     Select(Tmp0, N0);
02331     Select(Tmp1, N1);
02332     if (N.Val->hasOneUse()) {
02333       Result = CurDAG->SelectNodeTo(N.Val, IA64::SHRS, MVT::i64, Tmp0, Tmp1);
02334     } else {
02335       ResNode = CurDAG->getTargetNode(IA64::SHRS, MVT::i64, Tmp0, Tmp1);
02336       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02337       Result = SDOperand(ResNode, 0);
02338     }
02339     return;
02340   }
02341   std::cerr << "Cannot yet select: ";
02342   N.Val->dump(CurDAG);
02343   std::cerr << '\n';
02344   abort();
02345 }
02346 
02347 void Select_srl(SDOperand &Result, SDOperand N) {
02348   SDOperand N0(0, 0);
02349   SDOperand N1(0, 0);
02350   SDOperand Tmp0(0, 0);
02351   SDOperand Tmp1(0, 0);
02352   SDNode *ResNode;
02353   N0 = N.getOperand(0);
02354   N1 = N.getOperand(1);
02355   if (N.Val->getValueType(0) == MVT::i64 &&
02356       N1.Val->getValueType(0) == MVT::i64) {
02357     Select(Tmp0, N0);
02358     Select(Tmp1, N1);
02359     if (N.Val->hasOneUse()) {
02360       Result = CurDAG->SelectNodeTo(N.Val, IA64::SHRU, MVT::i64, Tmp0, Tmp1);
02361     } else {
02362       ResNode = CurDAG->getTargetNode(IA64::SHRU, MVT::i64, Tmp0, Tmp1);
02363       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02364       Result = SDOperand(ResNode, 0);
02365     }
02366     return;
02367   }
02368   std::cerr << "Cannot yet select: ";
02369   N.Val->dump(CurDAG);
02370   std::cerr << '\n';
02371   abort();
02372 }
02373 
02374 void Select_sub(SDOperand &Result, SDOperand N) {
02375   SDOperand N0(0, 0);
02376   SDOperand N1(0, 0);
02377   SDOperand Tmp0(0, 0);
02378   SDOperand Tmp1(0, 0);
02379   SDNode *ResNode;
02380   N0 = N.getOperand(0);
02381   N1 = N.getOperand(1);
02382   if (N.Val->getValueType(0) == MVT::i64) {
02383     Select(Tmp0, N0);
02384     Select(Tmp1, N1);
02385     if (N.Val->hasOneUse()) {
02386       Result = CurDAG->SelectNodeTo(N.Val, IA64::SUB, MVT::i64, Tmp0, Tmp1);
02387     } else {
02388       ResNode = CurDAG->getTargetNode(IA64::SUB, MVT::i64, Tmp0, Tmp1);
02389       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02390       Result = SDOperand(ResNode, 0);
02391     }
02392     return;
02393   }
02394   std::cerr << "Cannot yet select: ";
02395   N.Val->dump(CurDAG);
02396   std::cerr << '\n';
02397   abort();
02398 }
02399 
02400 void Select_trunc(SDOperand &Result, SDOperand N) {
02401   SDOperand N0(0, 0);
02402   SDOperand Tmp0(0, 0);
02403   SDOperand Tmp1(0, 0);
02404   SDNode *ResNode;
02405   N0 = N.getOperand(0);
02406   Select(Tmp0, N0);
02407   Tmp1 = CurDAG->getRegister(IA64::r0, MVT::i64);
02408   if (N.Val->hasOneUse()) {
02409     Result = CurDAG->SelectNodeTo(N.Val, IA64::CMPNE, MVT::i1, Tmp0, Tmp1);
02410   } else {
02411     ResNode = CurDAG->getTargetNode(IA64::CMPNE, MVT::i1, Tmp0, Tmp1);
02412     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02413     Result = SDOperand(ResNode, 0);
02414   }
02415   return;
02416 }
02417 
02418 void Select_uint_to_fp(SDOperand &Result, SDOperand N) {
02419   SDOperand N0(0, 0);
02420   SDOperand Tmp0(0, 0);
02421   SDOperand Tmp1(0, 0);
02422   SDOperand Tmp2(0, 0);
02423   SDNode *ResNode;
02424   N0 = N.getOperand(0);
02425   if (N0.Val->getValueType(0) == MVT::i64) {
02426     Select(Tmp0, N0);
02427     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::SETFSIG, MVT::f64, Tmp0), 0);
02428     Tmp2 = SDOperand(CurDAG->getTargetNode(IA64::FCVTXUF, MVT::f64, Tmp1), 0);
02429     if (N.Val->hasOneUse()) {
02430       Result = CurDAG->SelectNodeTo(N.Val, IA64::FNORMD, MVT::f64, Tmp2);
02431     } else {
02432       ResNode = CurDAG->getTargetNode(IA64::FNORMD, MVT::f64, Tmp2);
02433       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02434       Result = SDOperand(ResNode, 0);
02435     }
02436     return;
02437   }
02438   std::cerr << "Cannot yet select: ";
02439   N.Val->dump(CurDAG);
02440   std::cerr << '\n';
02441   abort();
02442 }
02443 
02444 void Select_undef(SDOperand &Result, SDOperand N) {
02445   SDNode *ResNode;
02446 
02447   // Pattern: (undef:i64)
02448   // Emits: (IDEF_GR_D:i64)
02449   // Pattern complexity = 2  cost = 1
02450   if (N.Val->getValueType(0) == MVT::i64) {
02451     if (N.Val->hasOneUse()) {
02452       Result = CurDAG->SelectNodeTo(N.Val, IA64::IDEF_GR_D, MVT::i64);
02453     } else {
02454       ResNode = CurDAG->getTargetNode(IA64::IDEF_GR_D, MVT::i64);
02455       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02456       Result = SDOperand(ResNode, 0);
02457     }
02458     return;
02459   }
02460 
02461   // Pattern: (undef:f64)
02462   // Emits: (IDEF_FP_D:f64)
02463   // Pattern complexity = 2  cost = 1
02464   if (N.Val->getValueType(0) == MVT::f64) {
02465     if (N.Val->hasOneUse()) {
02466       Result = CurDAG->SelectNodeTo(N.Val, IA64::IDEF_FP_D, MVT::f64);
02467     } else {
02468       ResNode = CurDAG->getTargetNode(IA64::IDEF_FP_D, MVT::f64);
02469       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02470       Result = SDOperand(ResNode, 0);
02471     }
02472     return;
02473   }
02474 
02475   // Pattern: (undef:i1)
02476   // Emits: (IDEF_PR_D:i1)
02477   // Pattern complexity = 2  cost = 1
02478   if (N.Val->getValueType(0) == MVT::i1) {
02479     if (N.Val->hasOneUse()) {
02480       Result = CurDAG->SelectNodeTo(N.Val, IA64::IDEF_PR_D, MVT::i1);
02481     } else {
02482       ResNode = CurDAG->getTargetNode(IA64::IDEF_PR_D, MVT::i1);
02483       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02484       Result = SDOperand(ResNode, 0);
02485     }
02486     return;
02487   }
02488   std::cerr << "Cannot yet select: ";
02489   N.Val->dump(CurDAG);
02490   std::cerr << '\n';
02491   abort();
02492 }
02493 
02494 void Select_xor(SDOperand &Result, SDOperand N) {
02495   SDOperand N0(0, 0);
02496   SDOperand N1(0, 0);
02497   SDOperand Tmp0(0, 0);
02498   SDOperand Tmp1(0, 0);
02499   SDOperand Tmp2(0, 0);
02500   SDOperand Tmp3(0, 0);
02501   SDOperand Tmp4(0, 0);
02502   SDOperand Tmp5(0, 0);
02503   SDOperand Tmp6(0, 0);
02504   SDOperand Tmp7(0, 0);
02505   SDOperand Tmp8(0, 0);
02506   SDNode *ResNode;
02507   N0 = N.getOperand(0);
02508   N1 = N.getOperand(1);
02509 
02510   // Pattern: (xor:i64 GR:i64:$src1, GR:i64:$src2)
02511   // Emits: (XOR:i64 GR:i64:$src1, GR:i64:$src2)
02512   // Pattern complexity = 2  cost = 1
02513   if (N.Val->getValueType(0) == MVT::i64) {
02514     Select(Tmp0, N0);
02515     Select(Tmp1, N1);
02516     if (N.Val->hasOneUse()) {
02517       Result = CurDAG->SelectNodeTo(N.Val, IA64::XOR, MVT::i64, Tmp0, Tmp1);
02518     } else {
02519       ResNode = CurDAG->getTargetNode(IA64::XOR, MVT::i64, Tmp0, Tmp1);
02520       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02521       Result = SDOperand(ResNode, 0);
02522     }
02523     return;
02524   }
02525 
02526   // Pattern: (xor:i1 PR:i1:$src1, PR:i1:$src2)
02527   // Emits: (TPCMPIMM8NE:i1 (PCMPEQUNCR0R0:i1 PR:i1:$src2), 1:i64, (TPCADDS:i64 (ADDS:i64 r0:i64, 0:i64), 1:i64, PR:i1:$src2), PR:i1:$src1)
02528   // Pattern complexity = 2  cost = 4
02529   if (N.Val->getValueType(0) == MVT::i1) {
02530     Select(Tmp0, N1);
02531     Tmp1 = SDOperand(CurDAG->getTargetNode(IA64::PCMPEQUNCR0R0, MVT::i1, Tmp0), 0);
02532     Tmp2 = CurDAG->getTargetConstant(1, MVT::i64);
02533     Tmp3 = CurDAG->getRegister(IA64::r0, MVT::i64);
02534     Tmp4 = CurDAG->getTargetConstant(0, MVT::i64);
02535     Tmp5 = SDOperand(CurDAG->getTargetNode(IA64::ADDS, MVT::i64, Tmp3, Tmp4), 0);
02536     Tmp6 = CurDAG->getTargetConstant(1, MVT::i64);
02537     Tmp7 = SDOperand(CurDAG->getTargetNode(IA64::TPCADDS, MVT::i64, Tmp5, Tmp6, Tmp0), 0);
02538     Select(Tmp8, N0);
02539     if (N.Val->hasOneUse()) {
02540       Result = CurDAG->SelectNodeTo(N.Val, IA64::TPCMPIMM8NE, MVT::i1, Tmp1, Tmp2, Tmp7, Tmp8);
02541     } else {
02542       ResNode = CurDAG->getTargetNode(IA64::TPCMPIMM8NE, MVT::i1, Tmp1, Tmp2, Tmp7, Tmp8);
02543       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02544       Result = SDOperand(ResNode, 0);
02545     }
02546     return;
02547   }
02548   std::cerr << "Cannot yet select: ";
02549   N.Val->dump(CurDAG);
02550   std::cerr << '\n';
02551   abort();
02552 }
02553 
02554 void Select_zext(SDOperand &Result, SDOperand N) {
02555   SDOperand N0(0, 0);
02556   SDOperand Tmp0(0, 0);
02557   SDOperand Tmp1(0, 0);
02558   SDOperand Tmp2(0, 0);
02559   SDOperand Tmp3(0, 0);
02560   SDOperand Tmp4(0, 0);
02561   SDNode *ResNode;
02562   N0 = N.getOperand(0);
02563   Tmp0 = CurDAG->getRegister(IA64::r0, MVT::i64);
02564   Tmp1 = CurDAG->getTargetConstant(0, MVT::i64);
02565   Tmp2 = SDOperand(CurDAG->getTargetNode(IA64::ADDS, MVT::i64, Tmp0, Tmp1), 0);
02566   Tmp3 = CurDAG->getTargetConstant(1, MVT::i64);
02567   Select(Tmp4, N0);
02568   if (N.Val->hasOneUse()) {
02569     Result = CurDAG->SelectNodeTo(N.Val, IA64::TPCADDIMM22, MVT::i64, Tmp2, Tmp3, Tmp4);
02570   } else {
02571     ResNode = CurDAG->getTargetNode(IA64::TPCADDIMM22, MVT::i64, Tmp2, Tmp3, Tmp4);
02572     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02573     Result = SDOperand(ResNode, 0);
02574   }
02575   return;
02576 }
02577 
02578 void Select_INLINEASM(SDOperand& Result, SDOperand N) {
02579   std::vector<SDOperand> Ops(N.Val->op_begin(), N.Val->op_end());
02580   Select(Ops[0], N.getOperand(0)); // Select the chain.
02581 
02582   // Select the flag operand.
02583   if (Ops.back().getValueType() == MVT::Flag)
02584     Select(Ops.back(), Ops.back());
02585   SelectInlineAsmMemoryOperands(Ops, *CurDAG);
02586   std::vector<MVT::ValueType> VTs;
02587   VTs.push_back(MVT::Other);
02588   VTs.push_back(MVT::Flag);
02589   SDOperand New = CurDAG->getNode(ISD::INLINEASM, VTs, Ops);
02590   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, New.Val, 0);
02591   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, New.Val, 1);
02592   Result = New.getValue(N.ResNo);
02593   return;
02594 }
02595 
02596 // The main instruction selector code.
02597 void SelectCode(SDOperand &Result, SDOperand N) {
02598   if (N.getOpcode() >= ISD::BUILTIN_OP_END &&
02599       N.getOpcode() < (ISD::BUILTIN_OP_END+IA64::INSTRUCTION_LIST_END)) {
02600     Result = N;
02601     return;   // Already selected.
02602   }
02603 
02604   std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);
02605   if (CGMI != CodeGenMap.end()) {
02606     Result = CGMI->second;
02607     return;
02608   }
02609 
02610   switch (N.getOpcode()) {
02611   default: break;
02612   case ISD::EntryToken:       // These leaves remain the same.
02613   case ISD::BasicBlock:
02614   case ISD::Register:
02615   case ISD::HANDLENODE:
02616   case ISD::TargetConstant:
02617   case ISD::TargetConstantPool:
02618   case ISD::TargetFrameIndex:
02619   case ISD::TargetGlobalAddress: {
02620     Result = N;
02621     return;
02622   }
02623   case ISD::AssertSext:
02624   case ISD::AssertZext: {
02625     SDOperand Tmp0;
02626     Select(Tmp0, N.getOperand(0));
02627     if (!N.Val->hasOneUse())
02628       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, Tmp0.Val, Tmp0.ResNo);
02629     Result = Tmp0;
02630     return;
02631   }
02632   case ISD::TokenFactor:
02633     if (N.getNumOperands() == 2) {
02634       SDOperand Op0, Op1;
02635       Select(Op0, N.getOperand(0));
02636       Select(Op1, N.getOperand(1));
02637       Result = 
02638           CurDAG->getNode(ISD::TokenFactor, MVT::Other, Op0, Op1);
02639       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, Result.Val, Result.ResNo);
02640     } else {
02641       std::vector<SDOperand> Ops;
02642       for (unsigned i = 0, e = N.getNumOperands(); i != e; ++i) {
02643         SDOperand Val;
02644         Select(Val, N.getOperand(i));
02645         Ops.push_back(Val);
02646       }
02647       Result = 
02648           CurDAG->getNode(ISD::TokenFactor, MVT::Other, Ops);
02649       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, Result.Val, Result.ResNo);
02650     }
02651     return;
02652   case ISD::CopyFromReg: {
02653     SDOperand Chain;
02654     Select(Chain, N.getOperand(0));
02655     unsigned Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();
02656     MVT::ValueType VT = N.Val->getValueType(0);
02657     if (N.Val->getNumValues() == 2) {
02658       if (Chain == N.getOperand(0)) {
02659         Result = N; // No change
02660         return;
02661       }
02662       SDOperand New = CurDAG->getCopyFromReg(Chain, Reg, VT);
02663       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, New.Val, 0);
02664       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, New.Val, 1);
02665       Result = New.getValue(N.ResNo);
02666       return;
02667     } else {
02668       SDOperand Flag;
02669       if (N.getNumOperands() == 3) Select(Flag, N.getOperand(2));
02670       if (Chain == N.getOperand(0) &&
02671           (N.getNumOperands() == 2 || Flag == N.getOperand(2))) {
02672         Result = N; // No change
02673         return;
02674       }
02675       SDOperand New = CurDAG->getCopyFromReg(Chain, Reg, VT, Flag);
02676       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, New.Val, 0);
02677       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, New.Val, 1);
02678       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 2, New.Val, 2);
02679       Result = New.getValue(N.ResNo);
02680       return;
02681     }
02682   }
02683   case ISD::CopyToReg: {
02684     SDOperand Chain;
02685     Select(Chain, N.getOperand(0));
02686     unsigned Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();
02687     SDOperand Val;
02688     Select(Val, N.getOperand(2));
02689     Result = N;
02690     if (N.Val->getNumValues() == 1) {
02691       if (Chain != N.getOperand(0) || Val != N.getOperand(2))
02692         Result = CurDAG->getCopyToReg(Chain, Reg, Val);
02693       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Result.Val, 0);
02694     } else {
02695       SDOperand Flag(0, 0);
02696       if (N.getNumOperands() == 4) Select(Flag, N.getOperand(3));
02697       if (Chain != N.getOperand(0) || Val != N.getOperand(2) ||
02698           (N.getNumOperands() == 4 && Flag != N.getOperand(3)))
02699         Result = CurDAG->getCopyToReg(Chain, Reg, Val, Flag);
02700       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Result.Val, 0);
02701       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Result.Val, 1);
02702       Result = Result.getValue(N.ResNo);
02703     }
02704     return;
02705   }
02706   case ISD::INLINEASM:  Select_INLINEASM(Result, N); return;
02707   case ISD::ADD:                 Select_add(Result, N); return;
02708   case ISD::AND:                 Select_and(Result, N); return;
02709   case ISD::CTPOP:               Select_ctpop(Result, N); return;
02710   case ISD::FABS:                Select_fabs(Result, N); return;
02711   case ISD::FADD:                Select_fadd(Result, N); return;
02712   case ISD::FMUL:                Select_fmul(Result, N); return;
02713   case ISD::FNEG:                Select_fneg(Result, N); return;
02714   case ISD::FP_TO_SINT:          Select_fp_to_sint(Result, N); return;
02715   case ISD::FP_TO_UINT:          Select_fp_to_uint(Result, N); return;
02716   case ISD::FSUB:                Select_fsub(Result, N); return;
02717   case ISD::Constant:            Select_imm(Result, N); return;
02718   case ISD::MUL:                 Select_mul(Result, N); return;
02719   case ISD::MULHS:               Select_mulhs(Result, N); return;
02720   case ISD::MULHU:               Select_mulhu(Result, N); return;
02721   case ISD::OR:                  Select_or(Result, N); return;
02722   case ISD::RET:                 Select_ret(Result, N); return;
02723   case IA64ISD::RET_FLAG:        Select_retflag(Result, N); return;
02724   case ISD::SELECT:              Select_select(Result, N); return;
02725   case ISD::SETCC:               Select_setcc(Result, N); return;
02726   case ISD::SIGN_EXTEND_INREG:   Select_sext_inreg(Result, N); return;
02727   case ISD::SHL:                 Select_shl(Result, N); return;
02728   case ISD::SINT_TO_FP:          Select_sint_to_fp(Result, N); return;
02729   case ISD::SRA:                 Select_sra(Result, N); return;
02730   case ISD::SRL:                 Select_srl(Result, N); return;
02731   case ISD::SUB:                 Select_sub(Result, N); return;
02732   case ISD::TRUNCATE:            Select_trunc(Result, N); return;
02733   case ISD::UINT_TO_FP:          Select_uint_to_fp(Result, N); return;
02734   case ISD::UNDEF:               Select_undef(Result, N); return;
02735   case ISD::XOR:                 Select_xor(Result, N); return;
02736   case ISD::ZERO_EXTEND:         Select_zext(Result, N); return;
02737   } // end of big switch.
02738 
02739   std::cerr << "Cannot yet select: ";
02740   if (N.getOpcode() != ISD::INTRINSIC_W_CHAIN &&
02741       N.getOpcode() != ISD::INTRINSIC_WO_CHAIN &&
02742       N.getOpcode() != ISD::INTRINSIC_VOID) {
02743     N.Val->dump(CurDAG);
02744   } else {
02745     unsigned iid = cast<ConstantSDNode>(N.getOperand(N.getOperand(0).getValueType() == MVT::Other))->getValue();
02746     std::cerr << "intrinsic %"<< Intrinsic::getName((Intrinsic::ID)iid);
02747   }
02748   std::cerr << '\n';
02749   abort();
02750 }