LLVM API Documentation

AlphaGenDAGISel.inc

Go to the documentation of this file.
00001 //===- TableGen'erated file -------------------------------------*- C++ -*-===//
00002 //
00003 // DAG Instruction Selector for the Alpha 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 #if defined(__GNUC__) && \
00013     ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)))
00014 #define NOINLINE __attribute__((noinline))
00015 #else
00016 
00017 #define NOINLINE
00018 
00019 #endif
00020 
00021 // Instance var to keep track of multiply used nodes that have 
00022 // already been selected.
00023 std::map<SDOperand, SDOperand> CodeGenMap;
00024 // Instance var to keep track of mapping of chain generating nodes
00025 // and their place handle nodes.
00026 std::map<SDOperand, SDOperand> HandleMap;
00027 // Instance var to keep track of mapping of place handle nodes
00028 // and their replacement nodes.
00029 std::map<SDOperand, SDOperand> ReplaceMap;
00030 // Keep track of nodes that are currently being selecte and therefore
00031 // should not be folded.
00032 std::set<SDNode*> InFlightSet;
00033 
00034 static void findNonImmUse(SDNode* Use, SDNode* Def, bool &found, std::set<SDNode *> &Visited) {
00035   if (found || !Visited.insert(Use).second) return;
00036   for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {
00037     SDNode *N = Use->getOperand(i).Val;
00038     if (N != Def) {
00039       findNonImmUse(N, Def, found, Visited);
00040     } else {
00041       found = true;
00042       break;
00043     }
00044   }
00045 }
00046 
00047 static bool isNonImmUse(SDNode* Use, SDNode* Def) {
00048   std::set<SDNode *> Visited;
00049   bool found = false;
00050   for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {
00051     SDNode *N = Use->getOperand(i).Val;
00052     if (N != Def) {
00053       findNonImmUse(N, Def, found, Visited);
00054       if (found) break;
00055     }
00056   }
00057   return found;
00058 }
00059 
00060 // AddHandleReplacement - Note the pending replacement node for a
00061 // handle node in ReplaceMap.
00062 void AddHandleReplacement(SDNode *H, unsigned HNum, SDNode *R, unsigned RNum) {
00063   SDOperand N(H, HNum);
00064   std::map<SDOperand, SDOperand>::iterator HMI = HandleMap.find(N);
00065   if (HMI != HandleMap.end()) {
00066     ReplaceMap[HMI->second] = SDOperand(R, RNum);
00067     HandleMap.erase(N);
00068   }
00069 }
00070 
00071 // SelectDanglingHandles - Select replacements for all `dangling`
00072 // handles.Some handles do not yet have replacements because the
00073 // nodes they replacements have only dead readers.
00074 void SelectDanglingHandles() {
00075   for (std::map<SDOperand, SDOperand>::iterator I = HandleMap.begin(),
00076          E = HandleMap.end(); I != E; ++I) {
00077     SDOperand N = I->first;
00078     SDOperand R;
00079     Select(R, N.getValue(0));
00080     AddHandleReplacement(N.Val, N.ResNo, R.Val, R.ResNo);
00081   }
00082 }
00083 
00084 // ReplaceHandles - Replace all the handles with the real target
00085 // specific nodes.
00086 void ReplaceHandles() {
00087   for (std::map<SDOperand, SDOperand>::iterator I = ReplaceMap.begin(),
00088         E = ReplaceMap.end(); I != E; ++I) {
00089     SDOperand From = I->first;
00090     SDOperand To   = I->second;
00091     for (SDNode::use_iterator UI = From.Val->use_begin(), E = From.Val->use_end(); UI != E; ++UI) {
00092       SDNode *Use = *UI;
00093       std::vector<SDOperand> Ops;
00094       for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i){
00095         SDOperand O = Use->getOperand(i);
00096         if (O.Val == From.Val)
00097           Ops.push_back(To);
00098         else
00099           Ops.push_back(O);
00100       }
00101       SDOperand U = SDOperand(Use, 0);
00102       CurDAG->UpdateNodeOperands(U, Ops);
00103     }
00104   }
00105 }
00106 
00107 // SelectRoot - Top level entry to DAG isel.
00108 SDOperand SelectRoot(SDOperand N) {
00109   SDOperand ResNode;
00110   Select(ResNode, N);
00111   SelectDanglingHandles();
00112   ReplaceHandles();
00113   ReplaceMap.clear();
00114   return ResNode;
00115 }
00116 
00117 // Node transformations.
00118 inline SDOperand Transform_negX(SDNode *inN) {
00119   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00120  //negate
00121   return getI64Imm(~N->getValue() + 1);
00122 
00123 }
00124 inline SDOperand Transform_nearP2X(SDNode *inN) {
00125   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00126 
00127   return getI64Imm(Log2_64(getNearPower2((uint64_t)N->getValue())));
00128 
00129 }
00130 inline SDOperand Transform_nearP2RemX(SDNode *inN) {
00131   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00132 
00133   uint64_t x = abs(N->getValue() - getNearPower2((uint64_t)N->getValue()));
00134   return getI64Imm(Log2_64(x));
00135 
00136 }
00137 inline SDOperand Transform_invX(SDNode *inN) {
00138   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00139  //invert
00140   return getI64Imm(~N->getValue());
00141 
00142 }
00143 inline SDOperand Transform_iZAPX(SDNode *inN) {
00144   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00145  // get imm to ZAPi
00146   return getI64Imm(get_zapImm((uint64_t)N->getValue()));
00147 
00148 }
00149 inline SDOperand Transform_SExt32(SDNode *inN) {
00150   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00151  //signed extend int to long
00152   return getI64Imm(((int64_t)N->getValue() << 32) >> 32);
00153 
00154 }
00155 inline SDOperand Transform_SExt16(SDNode *inN) {
00156   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00157  //signed extend int to long
00158   return getI64Imm(((int64_t)N->getValue() << 48) >> 48);
00159 
00160 }
00161 inline SDOperand Transform_LL16(SDNode *inN) {
00162   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00163  //lda part of constant
00164   return getI64Imm(get_lda16(N->getValue()));
00165 
00166 }
00167 inline SDOperand Transform_LH16(SDNode *inN) {
00168   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00169  //ldah part of constant (or more if too big)
00170   return getI64Imm(get_ldah16(N->getValue()));
00171 
00172 }
00173 
00174 // Predicate functions.
00175 inline bool Predicate_immAllOnes(SDNode *inN) {
00176   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00177  return N->isAllOnesValue(); 
00178 }
00179 inline bool Predicate_immAllOnesV(SDNode *N) {
00180 
00181   return ISD::isBuildVectorAllOnes(N);
00182 
00183 }
00184 inline bool Predicate_immAllOnesV_bc(SDNode *N) {
00185 
00186   return ISD::isBuildVectorAllOnes(N);
00187 
00188 }
00189 inline bool Predicate_immAllZerosV(SDNode *N) {
00190 
00191   return ISD::isBuildVectorAllZeros(N);
00192 
00193 }
00194 inline bool Predicate_immConst2Part(SDNode *inN) {
00195   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00196 
00197   //true if imm fits in a LDAH LDA pair
00198   int64_t val = (int64_t)N->getValue();
00199   return (val <= IMM_FULLHIGH  && val >= IMM_FULLLOW);
00200 
00201 }
00202 inline bool Predicate_immConst2PartInt(SDNode *inN) {
00203   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00204 
00205   //true if imm fits in a LDAH LDA pair with zeroext
00206   uint64_t uval = N->getValue();
00207   int32_t val32 = (int32_t)uval;
00208   return ((uval >> 32) == 0 && //empty upper bits
00209           val32 <= IMM_FULLHIGH);
00210 //          val32 >= IMM_FULLLOW  + IMM_LOW  * IMM_MULT); //Always True
00211 
00212 }
00213 inline bool Predicate_immFPZ(SDNode *inN) {
00214   ConstantFPSDNode *N = cast<ConstantFPSDNode>(inN);
00215  //the only fpconstant nodes are +/- 0.0
00216   return true;
00217 
00218 }
00219 inline bool Predicate_immRem1(SDNode *inN) {
00220   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00221 
00222   return N->getValue() - getNearPower2((uint64_t)N->getValue()) == 1;
00223 
00224 }
00225 inline bool Predicate_immRem1n(SDNode *inN) {
00226   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00227 
00228   return getNearPower2((uint64_t)N->getValue()) - N->getValue() == 1;
00229 
00230 }
00231 inline bool Predicate_immRem3(SDNode *inN) {
00232   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00233 
00234   return N->getValue() - getNearPower2((uint64_t)N->getValue()) == 3;
00235 
00236 }
00237 inline bool Predicate_immRem3n(SDNode *inN) {
00238   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00239 
00240   return getNearPower2((uint64_t)N->getValue()) - N->getValue() == 3;
00241 
00242 }
00243 inline bool Predicate_immRem4(SDNode *inN) {
00244   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00245 
00246   return N->getValue() - getNearPower2((uint64_t)N->getValue()) == 4;
00247 
00248 }
00249 inline bool Predicate_immRem4n(SDNode *inN) {
00250   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00251 
00252   return getNearPower2((uint64_t)N->getValue()) - N->getValue() == 4;
00253 
00254 }
00255 inline bool Predicate_immRem5(SDNode *inN) {
00256   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00257 
00258   return N->getValue() - getNearPower2((uint64_t)N->getValue()) == 5;
00259 
00260 }
00261 inline bool Predicate_immRem5n(SDNode *inN) {
00262   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00263 
00264   return getNearPower2((uint64_t)N->getValue()) - N->getValue() == 5;
00265 
00266 }
00267 inline bool Predicate_immRemP2(SDNode *inN) {
00268   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00269 
00270   return isPowerOf2_64(N->getValue() - getNearPower2((uint64_t)N->getValue()));
00271 
00272 }
00273 inline bool Predicate_immRemP2n(SDNode *inN) {
00274   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00275 
00276   return isPowerOf2_64(getNearPower2((uint64_t)N->getValue()) - N->getValue());
00277 
00278 }
00279 inline bool Predicate_immSExt16(SDNode *inN) {
00280   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00281  //imm fits in 16 bit sign extended field
00282   return ((int64_t)N->getValue() << 48) >> 48 == (int64_t)N->getValue();
00283 
00284 }
00285 inline bool Predicate_immSExt16int(SDNode *inN) {
00286   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00287  //(int)imm fits in a 16 bit sign extended field
00288   return ((int64_t)N->getValue() << 48) >> 48 == ((int64_t)N->getValue() << 32) >> 32;
00289 
00290 }
00291 inline bool Predicate_immUExt8(SDNode *inN) {
00292   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00293  //imm fits in 8 bit zero extended field
00294   return (uint64_t)N->getValue() == (uint8_t)N->getValue();
00295 
00296 }
00297 inline bool Predicate_immUExt8ME(SDNode *inN) {
00298   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00299  //use this imm for mulqi
00300   int64_t d =  abs((int64_t)N->getValue() - (int64_t)getNearPower2((uint64_t)N->getValue()));
00301   if (isPowerOf2_64(d)) return false;
00302   switch (d) {
00303     case 1: case 3: case 5: return false; 
00304     default: return (uint64_t)N->getValue() == (uint8_t)N->getValue();
00305   };
00306 
00307 }
00308 inline bool Predicate_immUExt8inv(SDNode *inN) {
00309   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00310  //inverted imm fits in 8 bit zero extended field
00311   return (uint64_t)~N->getValue() == (uint8_t)~N->getValue();
00312 
00313 }
00314 inline bool Predicate_immUExt8neg(SDNode *inN) {
00315   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00316  //negated imm fits in 8 bit zero extended field
00317   return ((uint64_t)~N->getValue() + 1) == (uint8_t)((uint64_t)~N->getValue() + 1);
00318 
00319 }
00320 inline bool Predicate_immZAP(SDNode *inN) {
00321   ConstantSDNode *N = cast<ConstantSDNode>(inN);
00322  //imm is good for zapi
00323   uint64_t build = get_zapImm((uint64_t)N->getValue());
00324   return build != 0;
00325 
00326 }
00327 inline bool Predicate_vtFP(SDNode *inN) {
00328   VTSDNode *N = cast<VTSDNode>(inN);
00329  return MVT::isFloatingPoint(N->getVT()); 
00330 }
00331 inline bool Predicate_vtInt(SDNode *inN) {
00332   VTSDNode *N = cast<VTSDNode>(inN);
00333  return MVT::isInteger(N->getVT()); 
00334 }
00335 
00336 
00337 void Emit_0(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0) NOINLINE {
00338   SDOperand Tmp0(0, 0);
00339   SDNode *ResNode = NULL;
00340   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00341   Select(Tmp0, N0);
00342   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00343   if (N.Val->hasOneUse()) {
00344     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0);
00345   } else {
00346     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0);
00347     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00348     Result = SDOperand(ResNode, 0);
00349   }
00350   return;
00351 }
00352 void Select_Alpha_cvtqs(SDOperand &Result, SDOperand N) {
00353   SDOperand N0(0, 0);
00354   SDOperand Tmp0(0, 0);
00355   SDNode *ResNode = NULL;
00356   N0 = N.getOperand(0);
00357   if (N.Val->getValueType(0) == MVT::f32 &&
00358       N0.Val->getValueType(0) == MVT::f64) {
00359     Emit_0(Result, N, Alpha::CVTQS, MVT::f32, N0);
00360     return;
00361   }
00362   std::cerr << "Cannot yet select: ";
00363   N.Val->dump(CurDAG);
00364   std::cerr << '\n';
00365   abort();
00366 }
00367 
00368 void Select_Alpha_cvtqt(SDOperand &Result, SDOperand N) {
00369   SDOperand N0(0, 0);
00370   SDOperand Tmp0(0, 0);
00371   SDNode *ResNode = NULL;
00372   N0 = N.getOperand(0);
00373   if (N.Val->getValueType(0) == MVT::f64 &&
00374       N0.Val->getValueType(0) == MVT::f64) {
00375     Emit_0(Result, N, Alpha::CVTQT, MVT::f64, N0);
00376     return;
00377   }
00378   std::cerr << "Cannot yet select: ";
00379   N.Val->dump(CurDAG);
00380   std::cerr << '\n';
00381   abort();
00382 }
00383 
00384 void Select_Alpha_cvttq(SDOperand &Result, SDOperand N) {
00385   SDOperand N0(0, 0);
00386   SDOperand Tmp0(0, 0);
00387   SDNode *ResNode = NULL;
00388   N0 = N.getOperand(0);
00389   if (N.Val->getValueType(0) == MVT::f64) {
00390     Emit_0(Result, N, Alpha::CVTTQ, MVT::f64, N0);
00391     return;
00392   }
00393   std::cerr << "Cannot yet select: ";
00394   N.Val->dump(CurDAG);
00395   std::cerr << '\n';
00396   abort();
00397 }
00398 
00399 void Select_Alpha_ftoit(SDOperand &Result, SDOperand N) {
00400   SDOperand N0(0, 0);
00401   SDOperand Tmp0(0, 0);
00402   SDNode *ResNode = NULL;
00403   N0 = N.getOperand(0);
00404   if (N0.Val->getValueType(0) == MVT::f64) {
00405     Emit_0(Result, N, Alpha::FTOIT, MVT::i64, N0);
00406     return;
00407   }
00408   std::cerr << "Cannot yet select: ";
00409   N.Val->dump(CurDAG);
00410   std::cerr << '\n';
00411   abort();
00412 }
00413 
00414 void Emit_1(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
00415   SDOperand Tmp0(0, 0);
00416   SDOperand Tmp1(0, 0);
00417   SDNode *ResNode = NULL;
00418   N1 = N.getOperand(1);
00419   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
00420   Tmp0 = N0;
00421   Select(Tmp1, N1);
00422   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
00423   if (N.Val->hasOneUse()) {
00424     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
00425   } else {
00426     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
00427     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00428     Result = SDOperand(ResNode, 0);
00429   }
00430   return;
00431 }
00432 void Select_Alpha_gprelhi(SDOperand &Result, SDOperand N) {
00433   SDOperand N0(0, 0);
00434   SDOperand N1(0, 0);
00435   SDOperand Tmp0(0, 0);
00436   SDOperand Tmp1(0, 0);
00437   SDNode *ResNode = NULL;
00438   N0 = N.getOperand(0);
00439 
00440   // Pattern: (Alpha_gprelhi:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
00441   // Emits: (LDAHr:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
00442   // Pattern complexity = 4  cost = 1  size = 0
00443   if (N0.getOpcode() == ISD::TargetGlobalAddress) {
00444     Emit_1(Result, N, Alpha::LDAHr, MVT::i64, N0, N1);
00445     return;
00446   }
00447 
00448   // Pattern: (Alpha_gprelhi:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
00449   // Emits: (LDAHr:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
00450   // Pattern complexity = 4  cost = 1
00451   if (N0.getOpcode() == ISD::TargetConstantPool) {
00452     Emit_1(Result, N, Alpha::LDAHr, MVT::i64, N0, N1);
00453     return;
00454   }
00455   std::cerr << "Cannot yet select: ";
00456   N.Val->dump(CurDAG);
00457   std::cerr << '\n';
00458   abort();
00459 }
00460 
00461 void Select_Alpha_gprello(SDOperand &Result, SDOperand N) {
00462   SDOperand N0(0, 0);
00463   SDOperand N1(0, 0);
00464   SDOperand Tmp0(0, 0);
00465   SDOperand Tmp1(0, 0);
00466   SDNode *ResNode = NULL;
00467   N0 = N.getOperand(0);
00468 
00469   // Pattern: (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
00470   // Emits: (LDAr:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
00471   // Pattern complexity = 4  cost = 1  size = 0
00472   if (N0.getOpcode() == ISD::TargetGlobalAddress) {
00473     Emit_1(Result, N, Alpha::LDAr, MVT::i64, N0, N1);
00474     return;
00475   }
00476 
00477   // Pattern: (Alpha_gprello:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
00478   // Emits: (LDAr:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
00479   // Pattern complexity = 4  cost = 1
00480   if (N0.getOpcode() == ISD::TargetConstantPool) {
00481     Emit_1(Result, N, Alpha::LDAr, MVT::i64, N0, N1);
00482     return;
00483   }
00484   std::cerr << "Cannot yet select: ";
00485   N.Val->dump(CurDAG);
00486   std::cerr << '\n';
00487   abort();
00488 }
00489 
00490 void Select_Alpha_itoft(SDOperand &Result, SDOperand N) {
00491   SDOperand N0(0, 0);
00492   SDOperand Tmp0(0, 0);
00493   SDNode *ResNode = NULL;
00494   N0 = N.getOperand(0);
00495   if (N.Val->getValueType(0) == MVT::f64) {
00496     Emit_0(Result, N, Alpha::ITOFT, MVT::f64, N0);
00497     return;
00498   }
00499   std::cerr << "Cannot yet select: ";
00500   N.Val->dump(CurDAG);
00501   std::cerr << '\n';
00502   abort();
00503 }
00504 
00505 void Select_Alpha_rellit(SDOperand &Result, SDOperand N) {
00506   SDOperand N0(0, 0);
00507   SDOperand N1(0, 0);
00508   SDOperand Tmp0(0, 0);
00509   SDOperand Tmp1(0, 0);
00510   SDNode *ResNode = NULL;
00511   N0 = N.getOperand(0);
00512 
00513   // Pattern: (Alpha_rellit:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
00514   // Emits: (LDQl:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
00515   // Pattern complexity = 4  cost = 1  size = 0
00516   if (N0.getOpcode() == ISD::TargetGlobalAddress) {
00517     Emit_1(Result, N, Alpha::LDQl, MVT::i64, N0, N1);
00518     return;
00519   }
00520 
00521   // Pattern: (Alpha_rellit:i64 (texternalsym:i64):$ext, GPRC:i64:$RB)
00522   // Emits: (LDQl:i64 (texternalsym:i64):$ext, GPRC:i64:$RB)
00523   // Pattern complexity = 4  cost = 1
00524   if (N0.getOpcode() == ISD::TargetExternalSymbol) {
00525     Emit_1(Result, N, Alpha::LDQl, MVT::i64, N0, N1);
00526     return;
00527   }
00528   std::cerr << "Cannot yet select: ";
00529   N.Val->dump(CurDAG);
00530   std::cerr << '\n';
00531   abort();
00532 }
00533 
00534 void Emit_2(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
00535   SDOperand Tmp1(0, 0);
00536   SDOperand Tmp2(0, 0);
00537   SDNode *ResNode = NULL;
00538   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
00539   Select(Tmp1, N00);
00540   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
00541   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
00542   if (N.Val->hasOneUse()) {
00543     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
00544   } else {
00545     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
00546     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00547     Result = SDOperand(ResNode, 0);
00548   }
00549   return;
00550 }
00551 void Emit_3(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
00552   SDOperand Tmp1(0, 0);
00553   SDOperand Tmp2(0, 0);
00554   SDOperand Tmp3(0, 0);
00555   SDNode *ResNode = NULL;
00556   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
00557   Select(Tmp1, N00);
00558   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
00559   Tmp3 = Transform_negX(Tmp2.Val);
00560   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
00561   if (N.Val->hasOneUse()) {
00562     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp3);
00563   } else {
00564     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp3);
00565     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00566     Result = SDOperand(ResNode, 0);
00567   }
00568   return;
00569 }
00570 void Emit_4(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
00571   SDOperand Tmp1(0, 0);
00572   SDOperand Tmp2(0, 0);
00573   SDNode *ResNode = NULL;
00574   N1 = N.getOperand(1);
00575   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
00576   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
00577   Select(Tmp1, N00);
00578   Select(Tmp2, N1);
00579   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
00580   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
00581   if (N.Val->hasOneUse()) {
00582     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
00583   } else {
00584     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
00585     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00586     Result = SDOperand(ResNode, 0);
00587   }
00588   return;
00589 }
00590 void Emit_5(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N10, SDOperand &N11) NOINLINE {
00591   SDOperand Tmp1(0, 0);
00592   SDOperand Tmp2(0, 0);
00593   SDNode *ResNode = NULL;
00594   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
00595   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00596   Select(Tmp1, N10);
00597   Select(Tmp2, N0);
00598   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
00599   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00600   if (N.Val->hasOneUse()) {
00601     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
00602   } else {
00603     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
00604     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00605     Result = SDOperand(ResNode, 0);
00606   }
00607   return;
00608 }
00609 void Emit_6(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
00610   SDOperand Tmp0(0, 0);
00611   SDOperand Tmp1(0, 0);
00612   SDNode *ResNode = NULL;
00613   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00614   Select(Tmp0, N0);
00615   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
00616   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00617   if (N.Val->hasOneUse()) {
00618     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
00619   } else {
00620     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
00621     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00622     Result = SDOperand(ResNode, 0);
00623   }
00624   return;
00625 }
00626 void Emit_7(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
00627   SDOperand Tmp0(0, 0);
00628   SDOperand Tmp1(0, 0);
00629   SDOperand Tmp2(0, 0);
00630   SDNode *ResNode = NULL;
00631   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00632   Select(Tmp0, N0);
00633   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
00634   Tmp2 = Transform_negX(Tmp1.Val);
00635   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00636   if (N.Val->hasOneUse()) {
00637     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp2);
00638   } else {
00639     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2);
00640     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00641     Result = SDOperand(ResNode, 0);
00642   }
00643   return;
00644 }
00645 void Emit_8(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
00646   SDOperand Tmp0(0, 0);
00647   SDOperand Tmp1(0, 0);
00648   SDNode *ResNode = NULL;
00649   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00650   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
00651   Select(Tmp1, N0);
00652   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00653   if (N.Val->hasOneUse()) {
00654     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
00655   } else {
00656     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
00657     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00658     Result = SDOperand(ResNode, 0);
00659   }
00660   return;
00661 }
00662 void Emit_9(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
00663   SDOperand Tmp0(0, 0);
00664   SDOperand Tmp1(0, 0);
00665   SDNode *ResNode = NULL;
00666   N0 = N.getOperand(0);
00667   N1 = N.getOperand(1);
00668   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00669   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
00670   Select(Tmp0, N0);
00671   Select(Tmp1, N1);
00672   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00673   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
00674   if (N.Val->hasOneUse()) {
00675     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
00676   } else {
00677     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
00678     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00679     Result = SDOperand(ResNode, 0);
00680   }
00681   return;
00682 }
00683 void Select_add(SDOperand &Result, SDOperand N) {
00684   SDOperand N0(0, 0);
00685   SDOperand N00(0, 0);
00686   SDOperand N01(0, 0);
00687   SDOperand N1(0, 0);
00688   SDOperand N10(0, 0);
00689   SDOperand N11(0, 0);
00690   SDOperand Tmp0(0, 0);
00691   SDOperand Tmp1(0, 0);
00692   SDOperand Tmp2(0, 0);
00693   SDOperand Tmp3(0, 0);
00694   SDNode *ResNode = NULL;
00695   {
00696     N0 = N.getOperand(0);
00697     if (N0.getOpcode() == ISD::SHL) {
00698       N00 = N0.getOperand(0);
00699       N01 = N0.getOperand(1);
00700       if (isa<ConstantSDNode>(N01)) {
00701         int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
00702 
00703         // Pattern: (add:i64 (shl:i64 GPRC:i64:$RA, 2:i64), (imm:i64)<<P:Predicate_immUExt8>>:$L)
00704         // Emits: (S4ADDQi:i64 GPRC:i64:$RA, (imm:i64):$L)
00705         // Pattern complexity = 10  cost = 1  size = 0
00706         if (CN0 == 2) {
00707           N1 = N.getOperand(1);
00708           if (N1.getOpcode() == ISD::Constant &&
00709               Predicate_immUExt8(N1.Val)) {
00710             Emit_2(Result, N, Alpha::S4ADDQi, MVT::i64, N0, N00, N01, N1);
00711             return;
00712           }
00713         }
00714         if (CN0 == 3) {
00715           N1 = N.getOperand(1);
00716           if (N1.getOpcode() == ISD::Constant) {
00717 
00718             // Pattern: (add:i64 (shl:i64 GPRC:i64:$RA, 3:i64), (imm:i64)<<P:Predicate_immUExt8>>:$L)
00719             // Emits: (S8ADDQi:i64 GPRC:i64:$RA, (imm:i64):$L)
00720             // Pattern complexity = 10  cost = 1  size = 0
00721             if (Predicate_immUExt8(N1.Val)) {
00722               Emit_2(Result, N, Alpha::S8ADDQi, MVT::i64, N0, N00, N01, N1);
00723               return;
00724             }
00725 
00726             // Pattern: (add:i64 (shl:i64 GPRC:i64:$RA, 3:i64), (imm:i64)<<P:Predicate_immUExt8neg>><<X:negX>>:$L)
00727             // Emits: (S8SUBQi:i64 GPRC:i64:$RA, (negX:i64 (imm:i64):$L))
00728             // Pattern complexity = 10  cost = 1
00729             if (Predicate_immUExt8neg(N1.Val)) {
00730               Emit_3(Result, N, Alpha::S8SUBQi, MVT::i64, N0, N00, N01, N1);
00731               return;
00732             }
00733           }
00734         }
00735 
00736         // Pattern: (add:i64 (shl:i64 GPRC:i64:$RA, 2:i64), GPRC:i64:$RB)
00737         // Emits: (S4ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00738         // Pattern complexity = 7  cost = 1  size = 0
00739         if (CN0 == 2) {
00740           Emit_4(Result, N, Alpha::S4ADDQ, MVT::i64, N0, N00, N01, N1);
00741           return;
00742         }
00743 
00744         // Pattern: (add:i64 (shl:i64 GPRC:i64:$RA, 3:i64), GPRC:i64:$RB)
00745         // Emits: (S8ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00746         // Pattern complexity = 7  cost = 1
00747         if (CN0 == 3) {
00748           Emit_4(Result, N, Alpha::S8ADDQ, MVT::i64, N0, N00, N01, N1);
00749           return;
00750         }
00751       }
00752     }
00753     N1 = N.getOperand(1);
00754     if (N1.getOpcode() == ISD::SHL) {
00755       N10 = N1.getOperand(0);
00756       N11 = N1.getOperand(1);
00757       if (isa<ConstantSDNode>(N11)) {
00758         int64_t CN0 = cast<ConstantSDNode>(N11)->getSignExtended();
00759 
00760         // Pattern: (add:i64 GPRC:i64:$RB, (shl:i64 GPRC:i64:$RA, 2:i64))
00761         // Emits: (S4ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00762         // Pattern complexity = 7  cost = 1  size = 0
00763         if (CN0 == 2) {
00764           Emit_5(Result, N, Alpha::S4ADDQ, MVT::i64, N0, N1, N10, N11);
00765           return;
00766         }
00767 
00768         // Pattern: (add:i64 GPRC:i64:$RB, (shl:i64 GPRC:i64:$RA, 3:i64))
00769         // Emits: (S8ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00770         // Pattern complexity = 7  cost = 1
00771         if (CN0 == 3) {
00772           Emit_5(Result, N, Alpha::S8ADDQ, MVT::i64, N0, N1, N10, N11);
00773           return;
00774         }
00775       }
00776     }
00777     if (N1.getOpcode() == ISD::Constant) {
00778 
00779       // Pattern: (add:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
00780       // Emits: (ADDQi:i64 GPRC:i64:$RA, (imm:i64):$L)
00781       // Pattern complexity = 5  cost = 1  size = 0
00782       if (Predicate_immUExt8(N1.Val)) {
00783         Emit_6(Result, N, Alpha::ADDQi, MVT::i64, N0, N1);
00784         return;
00785       }
00786 
00787       // Pattern: (add:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8neg>><<X:negX>>:$L)
00788       // Emits: (SUBQi:i64 GPRC:i64:$RA, (negX:i64 (imm:i64):$L))
00789       // Pattern complexity = 5  cost = 1  size = 0
00790       if (Predicate_immUExt8neg(N1.Val)) {
00791         Emit_7(Result, N, Alpha::SUBQi, MVT::i64, N0, N1);
00792         return;
00793       }
00794 
00795       // Pattern: (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP)
00796       // Emits: (LDA:i64 (imm:i64):$DISP, GPRC:i64:$RB)
00797       // Pattern complexity = 5  cost = 1
00798       if (Predicate_immSExt16(N1.Val)) {
00799         Emit_8(Result, N, Alpha::LDA, MVT::i64, N0, N1);
00800         return;
00801       }
00802     }
00803   }
00804 
00805   // Pattern: (add:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00806   // Emits: (ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00807   // Pattern complexity = 2  cost = 1
00808   Emit_9(Result, N, Alpha::ADDQ, MVT::i64, N0, N1);
00809   return;
00810 }
00811 
00812 void Emit_10(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N010, SDOperand &N011, SDOperand &N1) NOINLINE {
00813   SDOperand Tmp2(0, 0);
00814   SDOperand Tmp3(0, 0);
00815   SDNode *ResNode = NULL;
00816   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
00817   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N010.Val);
00818   Select(Tmp2, N00);
00819   Select(Tmp3, N010);
00820   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
00821   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N010.Val);
00822   if (N.Val->hasOneUse()) {
00823     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp2, Tmp3);
00824   } else {
00825     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3);
00826     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00827     Result = SDOperand(ResNode, 0);
00828   }
00829   return;
00830 }
00831 void Emit_11(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N110, SDOperand &N111) NOINLINE {
00832   SDOperand Tmp2(0, 0);
00833   SDOperand Tmp3(0, 0);
00834   SDNode *ResNode = NULL;
00835   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
00836   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N110.Val);
00837   Select(Tmp2, N10);
00838   Select(Tmp3, N110);
00839   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
00840   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N110.Val);
00841   if (N.Val->hasOneUse()) {
00842     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp2, Tmp3);
00843   } else {
00844     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3);
00845     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00846     Result = SDOperand(ResNode, 0);
00847   }
00848   return;
00849 }
00850 void Emit_12(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N10, SDOperand &N11) NOINLINE {
00851   SDOperand Tmp0(0, 0);
00852   SDOperand Tmp1(0, 0);
00853   SDNode *ResNode = NULL;
00854   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00855   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
00856   Select(Tmp0, N0);
00857   Select(Tmp1, N10);
00858   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00859   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
00860   if (N.Val->hasOneUse()) {
00861     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
00862   } else {
00863     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
00864     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00865     Result = SDOperand(ResNode, 0);
00866   }
00867   return;
00868 }
00869 void Emit_13(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
00870   SDOperand Tmp0(0, 0);
00871   SDOperand Tmp1(0, 0);
00872   SDNode *ResNode = NULL;
00873   N1 = N.getOperand(1);
00874   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
00875   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
00876   Select(Tmp0, N1);
00877   Select(Tmp1, N00);
00878   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
00879   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
00880   if (N.Val->hasOneUse()) {
00881     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
00882   } else {
00883     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
00884     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00885     Result = SDOperand(ResNode, 0);
00886   }
00887   return;
00888 }
00889 void Emit_14(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
00890   SDOperand Tmp0(0, 0);
00891   SDOperand Tmp1(0, 0);
00892   SDOperand Tmp2(0, 0);
00893   SDNode *ResNode = NULL;
00894   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00895   Select(Tmp0, N0);
00896   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
00897   Tmp2 = Transform_invX(Tmp1.Val);
00898   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00899   if (N.Val->hasOneUse()) {
00900     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp2);
00901   } else {
00902     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2);
00903     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00904     Result = SDOperand(ResNode, 0);
00905   }
00906   return;
00907 }
00908 void Emit_15(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
00909   SDOperand Tmp0(0, 0);
00910   SDOperand Tmp1(0, 0);
00911   SDOperand Tmp2(0, 0);
00912   SDNode *ResNode = NULL;
00913   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
00914   Select(Tmp0, N0);
00915   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
00916   Tmp2 = Transform_iZAPX(Tmp1.Val);
00917   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
00918   if (N.Val->hasOneUse()) {
00919     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp2);
00920   } else {
00921     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2);
00922     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
00923     Result = SDOperand(ResNode, 0);
00924   }
00925   return;
00926 }
00927 void Select_and(SDOperand &Result, SDOperand N) {
00928   SDOperand N0(0, 0);
00929   SDOperand N00(0, 0);
00930   SDOperand N01(0, 0);
00931   SDOperand N010(0, 0);
00932   SDOperand N011(0, 0);
00933   SDOperand N1(0, 0);
00934   SDOperand N10(0, 0);
00935   SDOperand N11(0, 0);
00936   SDOperand N110(0, 0);
00937   SDOperand N111(0, 0);
00938   SDOperand Tmp0(0, 0);
00939   SDOperand Tmp1(0, 0);
00940   SDOperand Tmp2(0, 0);
00941   SDOperand Tmp3(0, 0);
00942   SDNode *ResNode = NULL;
00943   {
00944     N0 = N.getOperand(0);
00945     if (N0.getOpcode() == ISD::SRL) {
00946       N00 = N0.getOperand(0);
00947       N01 = N0.getOperand(1);
00948       if (N01.getOpcode() == ISD::SHL) {
00949         N010 = N01.getOperand(0);
00950         N011 = N01.getOperand(1);
00951         if (isa<ConstantSDNode>(N011)) {
00952           int64_t CN0 = cast<ConstantSDNode>(N011)->getSignExtended();
00953           if (CN0 == 3) {
00954             N1 = N.getOperand(1);
00955             if (isa<ConstantSDNode>(N1)) {
00956               int64_t CN1 = cast<ConstantSDNode>(N1)->getSignExtended();
00957 
00958               // Pattern: (and:i64 (srl:i64 GPRC:i64:$RA, (shl:i64 GPRC:i64:$RB, 3:i64)), 255:i64)
00959               // Emits: (EXTBL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00960               // Pattern complexity = 12  cost = 1  size = 0
00961               if (CN1 == 255) {
00962                 Emit_10(Result, N, Alpha::EXTBL, MVT::i64, N0, N00, N01, N010, N011, N1);
00963                 return;
00964               }
00965 
00966               // Pattern: (and:i64 (srl:i64 GPRC:i64:$RA, (shl:i64 GPRC:i64:$RB, 3:i64)), 65535:i64)
00967               // Emits: (EXTWL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00968               // Pattern complexity = 12  cost = 1  size = 0
00969               if (CN1 == 65535) {
00970                 Emit_10(Result, N, Alpha::EXTWL, MVT::i64, N0, N00, N01, N010, N011, N1);
00971                 return;
00972               }
00973 
00974               // Pattern: (and:i64 (srl:i64 GPRC:i64:$RA, (shl:i64 GPRC:i64:$RB, 3:i64)), 2147483647:i64)
00975               // Emits: (EXTLL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00976               // Pattern complexity = 12  cost = 1
00977               if (CN1 == 2147483647) {
00978                 Emit_10(Result, N, Alpha::EXTLL, MVT::i64, N0, N00, N01, N010, N011, N1);
00979                 return;
00980               }
00981             }
00982           }
00983         }
00984       }
00985     }
00986     if (isa<ConstantSDNode>(N0)) {
00987       int64_t CN0 = cast<ConstantSDNode>(N0)->getSignExtended();
00988 
00989       // Pattern: (and:i64 255:i64, (srl:i64 GPRC:i64:$RA, (shl:i64 GPRC:i64:$RB, 3:i64)))
00990       // Emits: (EXTBL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
00991       // Pattern complexity = 12  cost = 1  size = 0
00992       if (CN0 == 255) {
00993         N1 = N.getOperand(1);
00994         if (N1.getOpcode() == ISD::SRL) {
00995           N10 = N1.getOperand(0);
00996           N11 = N1.getOperand(1);
00997           if (N11.getOpcode() == ISD::SHL) {
00998             N110 = N11.getOperand(0);
00999             N111 = N11.getOperand(1);
01000             if (isa<ConstantSDNode>(N111)) {
01001               int64_t CN1 = cast<ConstantSDNode>(N111)->getSignExtended();
01002               if (CN1 == 3) {
01003                 Emit_11(Result, N, Alpha::EXTBL, MVT::i64, N0, N1, N10, N11, N110, N111);
01004                 return;
01005               }
01006             }
01007           }
01008         }
01009       }
01010 
01011       // Pattern: (and:i64 65535:i64, (srl:i64 GPRC:i64:$RA, (shl:i64 GPRC:i64:$RB, 3:i64)))
01012       // Emits: (EXTWL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
01013       // Pattern complexity = 12  cost = 1  size = 0
01014       if (CN0 == 65535) {
01015         N1 = N.getOperand(1);
01016         if (N1.getOpcode() == ISD::SRL) {
01017           N10 = N1.getOperand(0);
01018           N11 = N1.getOperand(1);
01019           if (N11.getOpcode() == ISD::SHL) {
01020             N110 = N11.getOperand(0);
01021             N111 = N11.getOperand(1);
01022             if (isa<ConstantSDNode>(N111)) {
01023               int64_t CN1 = cast<ConstantSDNode>(N111)->getSignExtended();
01024               if (CN1 == 3) {
01025                 Emit_11(Result, N, Alpha::EXTWL, MVT::i64, N0, N1, N10, N11, N110, N111);
01026                 return;
01027               }
01028             }
01029           }
01030         }
01031       }
01032 
01033       // Pattern: (and:i64 2147483647:i64, (srl:i64 GPRC:i64:$RA, (shl:i64 GPRC:i64:$RB, 3:i64)))
01034       // Emits: (EXTLL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
01035       // Pattern complexity = 12  cost = 1
01036       if (CN0 == 2147483647) {
01037         N1 = N.getOperand(1);
01038         if (N1.getOpcode() == ISD::SRL) {
01039           N10 = N1.getOperand(0);
01040           N11 = N1.getOperand(1);
01041           if (N11.getOpcode() == ISD::SHL) {
01042             N110 = N11.getOperand(0);
01043             N111 = N11.getOperand(1);
01044             if (isa<ConstantSDNode>(N111)) {
01045               int64_t CN1 = cast<ConstantSDNode>(N111)->getSignExtended();
01046               if (CN1 == 3) {
01047                 Emit_11(Result, N, Alpha::EXTLL, MVT::i64, N0, N1, N10, N11, N110, N111);
01048                 return;
01049               }
01050             }
01051           }
01052         }
01053       }
01054     }
01055 
01056     // Pattern: (and:i64 GPRC:i64:$RA, (xor:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immAllOnes>>))
01057     // Emits: (BIC:i64 GPRC:i64:$RA, GPRC:i64:$RB)
01058     // Pattern complexity = 7  cost = 1  size = 0
01059     {
01060       N1 = N.getOperand(1);
01061       if (N1.getOpcode() == ISD::XOR) {
01062         N10 = N1.getOperand(0);
01063         N11 = N1.getOperand(1);
01064         if (N11.getOpcode() == ISD::Constant &&
01065             Predicate_immAllOnes(N11.Val)) {
01066           Emit_12(Result, N, Alpha::BIC, MVT::i64, N0, N1, N10, N11);
01067           return;
01068         }
01069       }
01070     }
01071 
01072     // Pattern: (and:i64 (xor:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immAllOnes>>), GPRC:i64:$RA)
01073     // Emits: (BIC:i64 GPRC:i64:$RA, GPRC:i64:$RB)
01074     // Pattern complexity = 7  cost = 1  size = 0
01075     if (N0.getOpcode() == ISD::XOR) {
01076       N00 = N0.getOperand(0);
01077       N01 = N0.getOperand(1);
01078       if (N01.getOpcode() == ISD::Constant &&
01079           Predicate_immAllOnes(N01.Val)) {
01080         Emit_13(Result, N, Alpha::BIC, MVT::i64, N0, N00, N01, N1);
01081         return;
01082       }
01083     }
01084     N1 = N.getOperand(1);
01085     if (N1.getOpcode() == ISD::Constant) {
01086 
01087       // Pattern: (and:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
01088       // Emits: (ANDi:i64 GPRC:i64:$RA, (imm:i64):$L)
01089       // Pattern complexity = 5  cost = 1  size = 0
01090       if (Predicate_immUExt8(N1.Val)) {
01091         Emit_6(Result, N, Alpha::ANDi, MVT::i64, N0, N1);
01092         return;
01093       }
01094 
01095       // Pattern: (and:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8inv>><<X:invX>>:$L)
01096       // Emits: (BICi:i64 GPRC:i64:$RA, (invX:i64 (imm:i64):$L))
01097       // Pattern complexity = 5  cost = 1  size = 0
01098       if (Predicate_immUExt8inv(N1.Val)) {
01099         Emit_14(Result, N, Alpha::BICi, MVT::i64, N0, N1);
01100         return;
01101       }
01102 
01103       // Pattern: (and:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immZAP>><<X:iZAPX>>:$L)
01104       // Emits: (ZAPNOTi:i64 GPRC:i64:$RA, (iZAPX:i64 (imm:i64):$L))
01105       // Pattern complexity = 5  cost = 1
01106       if (Predicate_immZAP(N1.Val)) {
01107         Emit_15(Result, N, Alpha::ZAPNOTi, MVT::i64, N0, N1);
01108         return;
01109       }
01110     }
01111   }
01112 
01113   // Pattern: (and:i64 GPRC:i64:$RA, GPRC:i64:$RB)
01114   // Emits: (AND:i64 GPRC:i64:$RA, GPRC:i64:$RB)
01115   // Pattern complexity = 2  cost = 1
01116   Emit_9(Result, N, Alpha::AND, MVT::i64, N0, N1);
01117   return;
01118 }
01119 
01120 void Emit_16(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1) NOINLINE {
01121   SDOperand Tmp0(0, 0);
01122   SDNode *ResNode = NULL;
01123   Select(Tmp0, N1);
01124   Select(Chain, Chain);
01125   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Chain);
01126   Chain = SDOperand(ResNode, 0);
01127   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01128   Result = SDOperand(ResNode, N.ResNo);
01129   return;
01130 }
01131 void Select_br(SDOperand &Result, SDOperand N) {
01132   SDOperand Chain(0, 0);
01133   SDOperand N1(0, 0);
01134   SDOperand Tmp0(0, 0);
01135   SDNode *ResNode = NULL;
01136   Chain = N.getOperand(0);
01137   N1 = N.getOperand(1);
01138   if (N1.getOpcode() == ISD::BasicBlock) {
01139     Emit_16(Result, N, Alpha::BR, Chain, N1);
01140     return;
01141   }
01142   std::cerr << "Cannot yet select: ";
01143   N.Val->dump(CurDAG);
01144   std::cerr << '\n';
01145   abort();
01146 }
01147 
01148 void Emit_17(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N12, SDOperand &N2) NOINLINE {
01149   SDOperand Tmp1(0, 0);
01150   SDOperand Tmp2(0, 0);
01151   SDNode *ResNode = NULL;
01152   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
01153   Select(Tmp1, N10);
01154   Select(Tmp2, N2);
01155   Select(Chain, Chain);
01156   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
01157   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp1, Tmp2, Chain);
01158   Chain = SDOperand(ResNode, 0);
01159   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01160   Result = SDOperand(ResNode, N.ResNo);
01161   return;
01162 }
01163 void Emit_18(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2) NOINLINE {
01164   SDOperand Tmp1(0, 0);
01165   SDOperand Tmp2(0, 0);
01166   SDNode *ResNode = NULL;
01167   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
01168   Select(Tmp1, N10);
01169   Select(Tmp2, N2);
01170   Select(Chain, Chain);
01171   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
01172   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp1, Tmp2, Chain);
01173   Chain = SDOperand(ResNode, 0);
01174   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01175   Result = SDOperand(ResNode, N.ResNo);
01176   return;
01177 }
01178 void Emit_19(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N12, SDOperand &N2) NOINLINE {
01179   SDOperand Tmp0(0, 0);
01180   SDOperand Tmp1(0, 0);
01181   SDNode *ResNode = NULL;
01182   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
01183   Select(Tmp0, N10);
01184   Select(Tmp1, N2);
01185   Select(Chain, Chain);
01186   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
01187   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Chain);
01188   Chain = SDOperand(ResNode, 0);
01189   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01190   Result = SDOperand(ResNode, N.ResNo);
01191   return;
01192 }
01193 void Emit_20(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2) NOINLINE {
01194   SDOperand Tmp1(0, 0);
01195   SDOperand Tmp2(0, 0);
01196   SDNode *ResNode = NULL;
01197   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N11.Val);
01198   Select(Tmp1, N11);
01199   Select(Tmp2, N2);
01200   Select(Chain, Chain);
01201   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N11.Val);
01202   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp1, Tmp2, Chain);
01203   Chain = SDOperand(ResNode, 0);
01204   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01205   Result = SDOperand(ResNode, N.ResNo);
01206   return;
01207 }
01208 void Emit_21(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N12, SDOperand &N2) NOINLINE {
01209   SDOperand Tmp0(0, 0);
01210   SDOperand Tmp1(0, 0);
01211   SDOperand Tmp2(0, 0);
01212   SDOperand Tmp3(0, 0);
01213   SDNode *ResNode = NULL;
01214   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
01215   Select(Tmp0, N10);
01216   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N11)->getValue()), MVT::i64);
01217   Tmp2 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1), 0);
01218   Select(Tmp3, N2);
01219   Select(Chain, Chain);
01220   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
01221   ResNode = CurDAG->getTargetNode(Opc1, MVT::Other, Tmp2, Tmp3, Chain);
01222   Chain = SDOperand(ResNode, 0);
01223   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01224   Result = SDOperand(ResNode, N.ResNo);
01225   return;
01226 }
01227 void Emit_22(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N12, SDOperand &N2) NOINLINE {
01228   SDOperand Tmp0(0, 0);
01229   SDOperand Tmp1(0, 0);
01230   SDOperand Tmp2(0, 0);
01231   SDOperand Tmp3(0, 0);
01232   SDNode *ResNode = NULL;
01233   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
01234   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N11.Val);
01235   Select(Tmp0, N10);
01236   Select(Tmp1, N11);
01237   Tmp2 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1), 0);
01238   Select(Tmp3, N2);
01239   Select(Chain, Chain);
01240   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
01241   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N11.Val);
01242   ResNode = CurDAG->getTargetNode(Opc1, MVT::Other, Tmp2, Tmp3, Chain);
01243   Chain = SDOperand(ResNode, 0);
01244   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01245   Result = SDOperand(ResNode, N.ResNo);
01246   return;
01247 }
01248 void Emit_23(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N12, SDOperand &N2) NOINLINE {
01249   SDOperand Tmp0(0, 0);
01250   SDOperand Tmp1(0, 0);
01251   SDOperand Tmp2(0, 0);
01252   SDOperand Tmp3(0, 0);
01253   SDNode *ResNode = NULL;
01254   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N11.Val);
01255   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
01256   Select(Tmp0, N11);
01257   Select(Tmp1, N10);
01258   Tmp2 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1), 0);
01259   Select(Tmp3, N2);
01260   Select(Chain, Chain);
01261   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N11.Val);
01262   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
01263   ResNode = CurDAG->getTargetNode(Opc1, MVT::Other, Tmp2, Tmp3, Chain);
01264   Chain = SDOperand(ResNode, 0);
01265   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01266   Result = SDOperand(ResNode, N.ResNo);
01267   return;
01268 }
01269 void Emit_24(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N2) NOINLINE {
01270   SDOperand Tmp0(0, 0);
01271   SDOperand Tmp1(0, 0);
01272   SDNode *ResNode = NULL;
01273   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
01274   Select(Tmp0, N1);
01275   Select(Tmp1, N2);
01276   Select(Chain, Chain);
01277   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
01278   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Chain);
01279   Chain = SDOperand(ResNode, 0);
01280   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01281   Result = SDOperand(ResNode, N.ResNo);
01282   return;
01283 }
01284 void Select_brcond(SDOperand &Result, SDOperand N) {
01285   SDOperand Chain(0, 0);
01286   SDOperand N1(0, 0);
01287   SDOperand N10(0, 0);
01288   SDOperand N11(0, 0);
01289   SDOperand N12(0, 0);
01290   SDOperand N2(0, 0);
01291   SDOperand Tmp0(0, 0);
01292   SDOperand Tmp1(0, 0);
01293   SDOperand Tmp2(0, 0);
01294   SDOperand Tmp3(0, 0);
01295   SDNode *ResNode = NULL;
01296   Chain = N.getOperand(0);
01297   N1 = N.getOperand(1);
01298   if (N1.getOpcode() == ISD::SETCC) {
01299     N10 = N1.getOperand(0);
01300     N11 = N1.getOperand(1);
01301     if (isa<ConstantSDNode>(N11)) {
01302       int64_t CN0 = cast<ConstantSDNode>(N11)->getSignExtended();
01303       if (CN0 == 0) {
01304         N12 = N1.getOperand(2);
01305 
01306         // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, 0:i64, SETEQ:Other), (bb:Other):$DISP)
01307         // Emits: (BEQ:void GPRC:i64:$RA, (bb:Other):$DISP)
01308         // Pattern complexity = 7  cost = 1  size = 0
01309         if (cast<CondCodeSDNode>(N12)->get() == ISD::SETEQ) {
01310           N2 = N.getOperand(2);
01311           if (N2.getOpcode() == ISD::BasicBlock &&
01312               N10.Val->getValueType(0) == MVT::i64) {
01313             Emit_17(Result, N, Alpha::BEQ, Chain, N1, N10, N11, N12, N2);
01314             return;
01315           }
01316         }
01317 
01318         // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, 0:i64, SETGE:Other), (bb:Other):$DISP)
01319         // Emits: (BGE:void GPRC:i64:$RA, (bb:Other):$DISP)
01320         // Pattern complexity = 7  cost = 1  size = 0
01321         if (cast<CondCodeSDNode>(N12)->get() == ISD::SETGE) {
01322           N2 = N.getOperand(2);
01323           if (N2.getOpcode() == ISD::BasicBlock &&
01324               N10.Val->getValueType(0) == MVT::i64) {
01325             Emit_17(Result, N, Alpha::BGE, Chain, N1, N10, N11, N12, N2);
01326             return;
01327           }
01328         }
01329 
01330         // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, 0:i64, SETGT:Other), (bb:Other):$DISP)
01331         // Emits: (BGT:void GPRC:i64:$RA, (bb:Other):$DISP)
01332         // Pattern complexity = 7  cost = 1
01333         if (cast<CondCodeSDNode>(N12)->get() == ISD::SETGT) {
01334           N2 = N.getOperand(2);
01335           if (N2.getOpcode() == ISD::BasicBlock &&
01336               N10.Val->getValueType(0) == MVT::i64) {
01337             Emit_17(Result, N, Alpha::BGT, Chain, N1, N10, N11, N12, N2);
01338             return;
01339           }
01340         }
01341       }
01342     }
01343   }
01344 
01345   // Pattern: (brcond:void (and:i64 GPRC:i64:$RA, 1:i64), (bb:Other):$DISP)
01346   // Emits: (BLBS:void GPRC:i64:$RA, (bb:Other):$DISP)
01347   // Pattern complexity = 7  cost = 1  size = 0
01348   if (N1.getOpcode() == ISD::AND) {
01349     N10 = N1.getOperand(0);
01350     N11 = N1.getOperand(1);
01351     if (isa<ConstantSDNode>(N11)) {
01352       int64_t CN0 = cast<ConstantSDNode>(N11)->getSignExtended();
01353       if (CN0 == 1) {
01354         N2 = N.getOperand(2);
01355         if (N2.getOpcode() == ISD::BasicBlock) {
01356           Emit_18(Result, N, Alpha::BLBS, Chain, N1, N10, N11, N2);
01357           return;
01358         }
01359       }
01360     }
01361   }
01362   if (N1.getOpcode() == ISD::SETCC) {
01363     N10 = N1.getOperand(0);
01364     N11 = N1.getOperand(1);
01365     if (isa<ConstantSDNode>(N11)) {
01366       int64_t CN0 = cast<ConstantSDNode>(N11)->getSignExtended();
01367       if (CN0 == 0) {
01368         N12 = N1.getOperand(2);
01369 
01370         // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, 0:i64, SETLE:Other), (bb:Other):$DISP)
01371         // Emits: (BLE:void GPRC:i64:$RA, (bb:Other):$DISP)
01372         // Pattern complexity = 7  cost = 1  size = 0
01373         if (cast<CondCodeSDNode>(N12)->get() == ISD::SETLE) {
01374           N2 = N.getOperand(2);
01375           if (N2.getOpcode() == ISD::BasicBlock &&
01376               N10.Val->getValueType(0) == MVT::i64) {
01377             Emit_17(Result, N, Alpha::BLE, Chain, N1, N10, N11, N12, N2);
01378             return;
01379           }
01380         }
01381 
01382         // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, 0:i64, SETLT:Other), (bb:Other):$DISP)
01383         // Emits: (BLT:void GPRC:i64:$RA, (bb:Other):$DISP)
01384         // Pattern complexity = 7  cost = 1  size = 0
01385         if (cast<CondCodeSDNode>(N12)->get() == ISD::SETLT) {
01386           N2 = N.getOperand(2);
01387           if (N2.getOpcode() == ISD::BasicBlock &&
01388               N10.Val->getValueType(0) == MVT::i64) {
01389             Emit_17(Result, N, Alpha::BLT, Chain, N1, N10, N11, N12, N2);
01390             return;
01391           }
01392         }
01393 
01394         // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, 0:i64, SETNE:Other), (bb:Other):$DISP)
01395         // Emits: (BNE:void GPRC:i64:$RA, (bb:Other):$DISP)
01396         // Pattern complexity = 7  cost = 1
01397         if (cast<CondCodeSDNode>(N12)->get() == ISD::SETNE) {
01398           N2 = N.getOperand(2);
01399           if (N2.getOpcode() == ISD::BasicBlock &&
01400               N10.Val->getValueType(0) == MVT::i64) {
01401             Emit_17(Result, N, Alpha::BNE, Chain, N1, N10, N11, N12, N2);
01402             return;
01403           }
01404         }
01405       }
01406     }
01407     if (N11.getOpcode() == ISD::TargetConstantFP &&
01408         Predicate_immFPZ(N11.Val)) {
01409       N12 = N1.getOperand(2);
01410 
01411       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETEQ:Other), (bb:Other):$DISP)
01412       // Emits: (FBEQ:void F8RC:f64:$RA, (bb:Other):$DISP)
01413       // Pattern complexity = 7  cost = 1  size = 0
01414       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETEQ) {
01415         N2 = N.getOperand(2);
01416         if (N2.getOpcode() == ISD::BasicBlock &&
01417             N10.Val->getValueType(0) == MVT::f64) {
01418           Emit_19(Result, N, Alpha::FBEQ, Chain, N1, N10, N11, N12, N2);
01419           return;
01420         }
01421       }
01422 
01423       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETGE:Other), (bb:Other):$DISP)
01424       // Emits: (FBGE:void F8RC:f64:$RA, (bb:Other):$DISP)
01425       // Pattern complexity = 7  cost = 1  size = 0
01426       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETGE) {
01427         N2 = N.getOperand(2);
01428         if (N2.getOpcode() == ISD::BasicBlock &&
01429             N10.Val->getValueType(0) == MVT::f64) {
01430           Emit_19(Result, N, Alpha::FBGE, Chain, N1, N10, N11, N12, N2);
01431           return;
01432         }
01433       }
01434 
01435       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETGT:Other), (bb:Other):$DISP)
01436       // Emits: (FBGT:void F8RC:f64:$RA, (bb:Other):$DISP)
01437       // Pattern complexity = 7  cost = 1  size = 0
01438       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETGT) {
01439         N2 = N.getOperand(2);
01440         if (N2.getOpcode() == ISD::BasicBlock &&
01441             N10.Val->getValueType(0) == MVT::f64) {
01442           Emit_19(Result, N, Alpha::FBGT, Chain, N1, N10, N11, N12, N2);
01443           return;
01444         }
01445       }
01446 
01447       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETLE:Other), (bb:Other):$DISP)
01448       // Emits: (FBLE:void F8RC:f64:$RA, (bb:Other):$DISP)
01449       // Pattern complexity = 7  cost = 1  size = 0
01450       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETLE) {
01451         N2 = N.getOperand(2);
01452         if (N2.getOpcode() == ISD::BasicBlock &&
01453             N10.Val->getValueType(0) == MVT::f64) {
01454           Emit_19(Result, N, Alpha::FBLE, Chain, N1, N10, N11, N12, N2);
01455           return;
01456         }
01457       }
01458 
01459       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETLT:Other), (bb:Other):$DISP)
01460       // Emits: (FBLT:void F8RC:f64:$RA, (bb:Other):$DISP)
01461       // Pattern complexity = 7  cost = 1  size = 0
01462       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETLT) {
01463         N2 = N.getOperand(2);
01464         if (N2.getOpcode() == ISD::BasicBlock &&
01465             N10.Val->getValueType(0) == MVT::f64) {
01466           Emit_19(Result, N, Alpha::FBLT, Chain, N1, N10, N11, N12, N2);
01467           return;
01468         }
01469       }
01470 
01471       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETNE:Other), (bb:Other):$DISP)
01472       // Emits: (FBNE:void F8RC:f64:$RA, (bb:Other):$DISP)
01473       // Pattern complexity = 7  cost = 1  size = 0
01474       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETNE) {
01475         N2 = N.getOperand(2);
01476         if (N2.getOpcode() == ISD::BasicBlock &&
01477             N10.Val->getValueType(0) == MVT::f64) {
01478           Emit_19(Result, N, Alpha::FBNE, Chain, N1, N10, N11, N12, N2);
01479           return;
01480         }
01481       }
01482 
01483       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETOEQ:Other), (bb:Other):$DISP)
01484       // Emits: (FBEQ:void F8RC:f64:$RA, (bb:Other):$DISP)
01485       // Pattern complexity = 7  cost = 1  size = 0
01486       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOEQ) {
01487         N2 = N.getOperand(2);
01488         if (N2.getOpcode() == ISD::BasicBlock &&
01489             N10.Val->getValueType(0) == MVT::f64) {
01490           Emit_19(Result, N, Alpha::FBEQ, Chain, N1, N10, N11, N12, N2);
01491           return;
01492         }
01493       }
01494 
01495       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETUEQ:Other), (bb:Other):$DISP)
01496       // Emits: (FBEQ:void F8RC:f64:$RA, (bb:Other):$DISP)
01497       // Pattern complexity = 7  cost = 1  size = 0
01498       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUEQ) {
01499         N2 = N.getOperand(2);
01500         if (N2.getOpcode() == ISD::BasicBlock &&
01501             N10.Val->getValueType(0) == MVT::f64) {
01502           Emit_19(Result, N, Alpha::FBEQ, Chain, N1, N10, N11, N12, N2);
01503           return;
01504         }
01505       }
01506 
01507       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETOGE:Other), (bb:Other):$DISP)
01508       // Emits: (FBGE:void F8RC:f64:$RA, (bb:Other):$DISP)
01509       // Pattern complexity = 7  cost = 1  size = 0
01510       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOGE) {
01511         N2 = N.getOperand(2);
01512         if (N2.getOpcode() == ISD::BasicBlock &&
01513             N10.Val->getValueType(0) == MVT::f64) {
01514           Emit_19(Result, N, Alpha::FBGE, Chain, N1, N10, N11, N12, N2);
01515           return;
01516         }
01517       }
01518 
01519       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETUGE:Other), (bb:Other):$DISP)
01520       // Emits: (FBGE:void F8RC:f64:$RA, (bb:Other):$DISP)
01521       // Pattern complexity = 7  cost = 1  size = 0
01522       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUGE) {
01523         N2 = N.getOperand(2);
01524         if (N2.getOpcode() == ISD::BasicBlock &&
01525             N10.Val->getValueType(0) == MVT::f64) {
01526           Emit_19(Result, N, Alpha::FBGE, Chain, N1, N10, N11, N12, N2);
01527           return;
01528         }
01529       }
01530 
01531       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETOGT:Other), (bb:Other):$DISP)
01532       // Emits: (FBGT:void F8RC:f64:$RA, (bb:Other):$DISP)
01533       // Pattern complexity = 7  cost = 1  size = 0
01534       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOGT) {
01535         N2 = N.getOperand(2);
01536         if (N2.getOpcode() == ISD::BasicBlock &&
01537             N10.Val->getValueType(0) == MVT::f64) {
01538           Emit_19(Result, N, Alpha::FBGT, Chain, N1, N10, N11, N12, N2);
01539           return;
01540         }
01541       }
01542 
01543       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETUGT:Other), (bb:Other):$DISP)
01544       // Emits: (FBGT:void F8RC:f64:$RA, (bb:Other):$DISP)
01545       // Pattern complexity = 7  cost = 1  size = 0
01546       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUGT) {
01547         N2 = N.getOperand(2);
01548         if (N2.getOpcode() == ISD::BasicBlock &&
01549             N10.Val->getValueType(0) == MVT::f64) {
01550           Emit_19(Result, N, Alpha::FBGT, Chain, N1, N10, N11, N12, N2);
01551           return;
01552         }
01553       }
01554 
01555       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETOLE:Other), (bb:Other):$DISP)
01556       // Emits: (FBLE:void F8RC:f64:$RA, (bb:Other):$DISP)
01557       // Pattern complexity = 7  cost = 1  size = 0
01558       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOLE) {
01559         N2 = N.getOperand(2);
01560         if (N2.getOpcode() == ISD::BasicBlock &&
01561             N10.Val->getValueType(0) == MVT::f64) {
01562           Emit_19(Result, N, Alpha::FBLE, Chain, N1, N10, N11, N12, N2);
01563           return;
01564         }
01565       }
01566 
01567       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETULE:Other), (bb:Other):$DISP)
01568       // Emits: (FBLE:void F8RC:f64:$RA, (bb:Other):$DISP)
01569       // Pattern complexity = 7  cost = 1  size = 0
01570       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETULE) {
01571         N2 = N.getOperand(2);
01572         if (N2.getOpcode() == ISD::BasicBlock &&
01573             N10.Val->getValueType(0) == MVT::f64) {
01574           Emit_19(Result, N, Alpha::FBLE, Chain, N1, N10, N11, N12, N2);
01575           return;
01576         }
01577       }
01578 
01579       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETOLT:Other), (bb:Other):$DISP)
01580       // Emits: (FBLT:void F8RC:f64:$RA, (bb:Other):$DISP)
01581       // Pattern complexity = 7  cost = 1  size = 0
01582       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOLT) {
01583         N2 = N.getOperand(2);
01584         if (N2.getOpcode() == ISD::BasicBlock &&
01585             N10.Val->getValueType(0) == MVT::f64) {
01586           Emit_19(Result, N, Alpha::FBLT, Chain, N1, N10, N11, N12, N2);
01587           return;
01588         }
01589       }
01590 
01591       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETULT:Other), (bb:Other):$DISP)
01592       // Emits: (FBLT:void F8RC:f64:$RA, (bb:Other):$DISP)
01593       // Pattern complexity = 7  cost = 1  size = 0
01594       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETULT) {
01595         N2 = N.getOperand(2);
01596         if (N2.getOpcode() == ISD::BasicBlock &&
01597             N10.Val->getValueType(0) == MVT::f64) {
01598           Emit_19(Result, N, Alpha::FBLT, Chain, N1, N10, N11, N12, N2);
01599           return;
01600         }
01601       }
01602 
01603       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETONE:Other), (bb:Other):$DISP)
01604       // Emits: (FBNE:void F8RC:f64:$RA, (bb:Other):$DISP)
01605       // Pattern complexity = 7  cost = 1  size = 0
01606       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETONE) {
01607         N2 = N.getOperand(2);
01608         if (N2.getOpcode() == ISD::BasicBlock &&
01609             N10.Val->getValueType(0) == MVT::f64) {
01610           Emit_19(Result, N, Alpha::FBNE, Chain, N1, N10, N11, N12, N2);
01611           return;
01612         }
01613       }
01614 
01615       // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, (fpimm:f64)<<P:Predicate_immFPZ>>, SETUNE:Other), (bb:Other):$DISP)
01616       // Emits: (FBNE:void F8RC:f64:$RA, (bb:Other):$DISP)
01617       // Pattern complexity = 7  cost = 1
01618       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUNE) {
01619         N2 = N.getOperand(2);
01620         if (N2.getOpcode() == ISD::BasicBlock &&
01621             N10.Val->getValueType(0) == MVT::f64) {
01622           Emit_19(Result, N, Alpha::FBNE, Chain, N1, N10, N11, N12, N2);
01623           return;
01624         }
01625       }
01626     }
01627   }
01628 
01629   // Pattern: (brcond:void (and:i64 1:i64, GPRC:i64:$RA), (bb:Other):$DISP)
01630   // Emits: (BLBS:void GPRC:i64:$RA, (bb:Other):$DISP)
01631   // Pattern complexity = 7  cost = 1  size = 0
01632   if (N1.getOpcode() == ISD::AND) {
01633     N10 = N1.getOperand(0);
01634     if (isa<ConstantSDNode>(N10)) {
01635       int64_t CN0 = cast<ConstantSDNode>(N10)->getSignExtended();
01636       if (CN0 == 1) {
01637         N11 = N1.getOperand(1);
01638         N2 = N.getOperand(2);
01639         if (N2.getOpcode() == ISD::BasicBlock) {
01640           Emit_20(Result, N, Alpha::BLBS, Chain, N1, N10, N11, N2);
01641           return;
01642         }
01643       }
01644     }
01645   }
01646   if (N1.getOpcode() == ISD::SETCC) {
01647     N10 = N1.getOperand(0);
01648     N11 = N1.getOperand(1);
01649 
01650     // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L, SETNE:Other), (bb:Other):$DISP)
01651     // Emits: (BEQ:void (CMPEQi:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L), (bb:Other):$DISP)
01652     // Pattern complexity = 7  cost = 2  size = 0
01653     if (N11.getOpcode() == ISD::Constant &&
01654         Predicate_immUExt8(N11.Val)) {
01655       N12 = N1.getOperand(2);
01656       if (cast<CondCodeSDNode>(N12)->get() == ISD::SETNE) {
01657         N2 = N.getOperand(2);
01658         if (N2.getOpcode() == ISD::BasicBlock) {
01659           Emit_21(Result, N, Alpha::CMPEQi, Alpha::BEQ, MVT::i64, Chain, N1, N10, N11, N12, N2);
01660           return;
01661         }
01662       }
01663     }
01664     N12 = N1.getOperand(2);
01665 
01666     // Pattern: (brcond:void (setcc:i64 GPRC:i64:$RA, GPRC:i64:$RB, SETNE:Other), (bb:Other):$DISP)
01667     // Emits: (BEQ:void (CMPEQ:i64 GPRC:i64:$RA, GPRC:i64:$RB), (bb:Other):$DISP)
01668     // Pattern complexity = 4  cost = 2  size = 0
01669     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETNE) {
01670       N2 = N.getOperand(2);
01671       if (N2.getOpcode() == ISD::BasicBlock &&
01672           N10.Val->getValueType(0) == MVT::i64) {
01673         Emit_22(Result, N, Alpha::CMPEQ, Alpha::BEQ, MVT::i64, Chain, N1, N10, N11, N12, N2);
01674         return;
01675       }
01676     }
01677 
01678     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETEQ:Other), (bb:Other):$DISP)
01679     // Emits: (FBNE:void (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01680     // Pattern complexity = 4  cost = 2  size = 0
01681     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETEQ) {
01682       N2 = N.getOperand(2);
01683       if (N2.getOpcode() == ISD::BasicBlock &&
01684           N10.Val->getValueType(0) == MVT::f64) {
01685         Emit_22(Result, N, Alpha::CMPTEQ, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01686         return;
01687       }
01688     }
01689 
01690     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOEQ:Other), (bb:Other):$DISP)
01691     // Emits: (FBNE:void (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01692     // Pattern complexity = 4  cost = 2  size = 0
01693     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOEQ) {
01694       N2 = N.getOperand(2);
01695       if (N2.getOpcode() == ISD::BasicBlock &&
01696           N10.Val->getValueType(0) == MVT::f64) {
01697         Emit_22(Result, N, Alpha::CMPTEQ, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01698         return;
01699       }
01700     }
01701 
01702     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUEQ:Other), (bb:Other):$DISP)
01703     // Emits: (FBNE:void (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01704     // Pattern complexity = 4  cost = 2  size = 0
01705     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUEQ) {
01706       N2 = N.getOperand(2);
01707       if (N2.getOpcode() == ISD::BasicBlock &&
01708           N10.Val->getValueType(0) == MVT::f64) {
01709         Emit_22(Result, N, Alpha::CMPTEQ, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01710         return;
01711       }
01712     }
01713 
01714     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETLT:Other), (bb:Other):$DISP)
01715     // Emits: (FBNE:void (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01716     // Pattern complexity = 4  cost = 2  size = 0
01717     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETLT) {
01718       N2 = N.getOperand(2);
01719       if (N2.getOpcode() == ISD::BasicBlock &&
01720           N10.Val->getValueType(0) == MVT::f64) {
01721         Emit_22(Result, N, Alpha::CMPTLT, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01722         return;
01723       }
01724     }
01725 
01726     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOLT:Other), (bb:Other):$DISP)
01727     // Emits: (FBNE:void (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01728     // Pattern complexity = 4  cost = 2  size = 0
01729     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOLT) {
01730       N2 = N.getOperand(2);
01731       if (N2.getOpcode() == ISD::BasicBlock &&
01732           N10.Val->getValueType(0) == MVT::f64) {
01733         Emit_22(Result, N, Alpha::CMPTLT, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01734         return;
01735       }
01736     }
01737 
01738     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETULT:Other), (bb:Other):$DISP)
01739     // Emits: (FBNE:void (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01740     // Pattern complexity = 4  cost = 2  size = 0
01741     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETULT) {
01742       N2 = N.getOperand(2);
01743       if (N2.getOpcode() == ISD::BasicBlock &&
01744           N10.Val->getValueType(0) == MVT::f64) {
01745         Emit_22(Result, N, Alpha::CMPTLT, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01746         return;
01747       }
01748     }
01749 
01750     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETLE:Other), (bb:Other):$DISP)
01751     // Emits: (FBNE:void (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01752     // Pattern complexity = 4  cost = 2  size = 0
01753     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETLE) {
01754       N2 = N.getOperand(2);
01755       if (N2.getOpcode() == ISD::BasicBlock &&
01756           N10.Val->getValueType(0) == MVT::f64) {
01757         Emit_22(Result, N, Alpha::CMPTLE, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01758         return;
01759       }
01760     }
01761 
01762     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOLE:Other), (bb:Other):$DISP)
01763     // Emits: (FBNE:void (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01764     // Pattern complexity = 4  cost = 2  size = 0
01765     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOLE) {
01766       N2 = N.getOperand(2);
01767       if (N2.getOpcode() == ISD::BasicBlock &&
01768           N10.Val->getValueType(0) == MVT::f64) {
01769         Emit_22(Result, N, Alpha::CMPTLE, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01770         return;
01771       }
01772     }
01773 
01774     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETULE:Other), (bb:Other):$DISP)
01775     // Emits: (FBNE:void (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01776     // Pattern complexity = 4  cost = 2  size = 0
01777     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETULE) {
01778       N2 = N.getOperand(2);
01779       if (N2.getOpcode() == ISD::BasicBlock &&
01780           N10.Val->getValueType(0) == MVT::f64) {
01781         Emit_22(Result, N, Alpha::CMPTLE, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01782         return;
01783       }
01784     }
01785 
01786     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETGT:Other), (bb:Other):$DISP)
01787     // Emits: (FBNE:void (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA), (bb:Other):$DISP)
01788     // Pattern complexity = 4  cost = 2  size = 0
01789     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETGT) {
01790       N2 = N.getOperand(2);
01791       if (N2.getOpcode() == ISD::BasicBlock &&
01792           N10.Val->getValueType(0) == MVT::f64) {
01793         Emit_23(Result, N, Alpha::CMPTLT, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01794         return;
01795       }
01796     }
01797 
01798     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOGT:Other), (bb:Other):$DISP)
01799     // Emits: (FBNE:void (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA), (bb:Other):$DISP)
01800     // Pattern complexity = 4  cost = 2  size = 0
01801     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOGT) {
01802       N2 = N.getOperand(2);
01803       if (N2.getOpcode() == ISD::BasicBlock &&
01804           N10.Val->getValueType(0) == MVT::f64) {
01805         Emit_23(Result, N, Alpha::CMPTLT, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01806         return;
01807       }
01808     }
01809 
01810     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUGT:Other), (bb:Other):$DISP)
01811     // Emits: (FBNE:void (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA), (bb:Other):$DISP)
01812     // Pattern complexity = 4  cost = 2  size = 0
01813     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUGT) {
01814       N2 = N.getOperand(2);
01815       if (N2.getOpcode() == ISD::BasicBlock &&
01816           N10.Val->getValueType(0) == MVT::f64) {
01817         Emit_23(Result, N, Alpha::CMPTLT, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01818         return;
01819       }
01820     }
01821 
01822     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETGE:Other), (bb:Other):$DISP)
01823     // Emits: (FBNE:void (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA), (bb:Other):$DISP)
01824     // Pattern complexity = 4  cost = 2  size = 0
01825     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETGE) {
01826       N2 = N.getOperand(2);
01827       if (N2.getOpcode() == ISD::BasicBlock &&
01828           N10.Val->getValueType(0) == MVT::f64) {
01829         Emit_23(Result, N, Alpha::CMPTLE, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01830         return;
01831       }
01832     }
01833 
01834     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOGE:Other), (bb:Other):$DISP)
01835     // Emits: (FBNE:void (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA), (bb:Other):$DISP)
01836     // Pattern complexity = 4  cost = 2  size = 0
01837     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETOGE) {
01838       N2 = N.getOperand(2);
01839       if (N2.getOpcode() == ISD::BasicBlock &&
01840           N10.Val->getValueType(0) == MVT::f64) {
01841         Emit_23(Result, N, Alpha::CMPTLE, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01842         return;
01843       }
01844     }
01845 
01846     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUGE:Other), (bb:Other):$DISP)
01847     // Emits: (FBNE:void (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA), (bb:Other):$DISP)
01848     // Pattern complexity = 4  cost = 2  size = 0
01849     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUGE) {
01850       N2 = N.getOperand(2);
01851       if (N2.getOpcode() == ISD::BasicBlock &&
01852           N10.Val->getValueType(0) == MVT::f64) {
01853         Emit_23(Result, N, Alpha::CMPTLE, Alpha::FBNE, MVT::f64, Chain, N1, N10, N11, N12, N2);
01854         return;
01855       }
01856     }
01857 
01858     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETNE:Other), (bb:Other):$DISP)
01859     // Emits: (FBEQ:void (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01860     // Pattern complexity = 4  cost = 2  size = 0
01861     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETNE) {
01862       N2 = N.getOperand(2);
01863       if (N2.getOpcode() == ISD::BasicBlock &&
01864           N10.Val->getValueType(0) == MVT::f64) {
01865         Emit_22(Result, N, Alpha::CMPTEQ, Alpha::FBEQ, MVT::f64, Chain, N1, N10, N11, N12, N2);
01866         return;
01867       }
01868     }
01869 
01870     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETONE:Other), (bb:Other):$DISP)
01871     // Emits: (FBEQ:void (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01872     // Pattern complexity = 4  cost = 2  size = 0
01873     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETONE) {
01874       N2 = N.getOperand(2);
01875       if (N2.getOpcode() == ISD::BasicBlock &&
01876           N10.Val->getValueType(0) == MVT::f64) {
01877         Emit_22(Result, N, Alpha::CMPTEQ, Alpha::FBEQ, MVT::f64, Chain, N1, N10, N11, N12, N2);
01878         return;
01879       }
01880     }
01881 
01882     // Pattern: (brcond:void (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUNE:Other), (bb:Other):$DISP)
01883     // Emits: (FBEQ:void (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB), (bb:Other):$DISP)
01884     // Pattern complexity = 4  cost = 2
01885     if (cast<CondCodeSDNode>(N12)->get() == ISD::SETUNE) {
01886       N2 = N.getOperand(2);
01887       if (N2.getOpcode() == ISD::BasicBlock &&
01888           N10.Val->getValueType(0) == MVT::f64) {
01889         Emit_22(Result, N, Alpha::CMPTEQ, Alpha::FBEQ, MVT::f64, Chain, N1, N10, N11, N12, N2);
01890         return;
01891       }
01892     }
01893   }
01894 
01895   // Pattern: (brcond:void GPRC:i64:$RA, (bb:Other):$DISP)
01896   // Emits: (BNE:void GPRC:i64:$RA, (bb:Other):$DISP)
01897   // Pattern complexity = 2  cost = 1
01898   N2 = N.getOperand(2);
01899   if (N2.getOpcode() == ISD::BasicBlock) {
01900     Emit_24(Result, N, Alpha::BNE, Chain, N1, N2);
01901     return;
01902   }
01903   std::cerr << "Cannot yet select: ";
01904   N.Val->dump(CurDAG);
01905   std::cerr << '\n';
01906   abort();
01907 }
01908 
01909 void Emit_25(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1) NOINLINE {
01910   SDOperand Tmp0(0, 0);
01911   SDNode *ResNode = NULL;
01912   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
01913   Select(Chain, Chain);
01914   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Chain);
01915   Chain = SDOperand(ResNode, 0);
01916   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
01917   Result = SDOperand(ResNode, N.ResNo);
01918   return;
01919 }
01920 void Select_callseq_end(SDOperand &Result, SDOperand N) {
01921   SDOperand Chain(0, 0);
01922   SDOperand N1(0, 0);
01923   SDOperand Tmp0(0, 0);
01924   SDNode *ResNode = NULL;
01925   Chain = N.getOperand(0);
01926   N1 = N.getOperand(1);
01927   if (N1.getOpcode() == ISD::Constant) {
01928     Emit_25(Result, N, Alpha::ADJUSTSTACKDOWN, Chain, N1);
01929     return;
01930   }
01931   std::cerr << "Cannot yet select: ";
01932   N.Val->dump(CurDAG);
01933   std::cerr << '\n';
01934   abort();
01935 }
01936 
01937 void Select_callseq_start(SDOperand &Result, SDOperand N) {
01938   SDOperand Chain(0, 0);
01939   SDOperand N1(0, 0);
01940   SDOperand Tmp0(0, 0);
01941   SDNode *ResNode = NULL;
01942   Chain = N.getOperand(0);
01943   N1 = N.getOperand(1);
01944   if (N1.getOpcode() == ISD::Constant) {
01945     Emit_25(Result, N, Alpha::ADJUSTSTACKUP, Chain, N1);
01946     return;
01947   }
01948   std::cerr << "Cannot yet select: ";
01949   N.Val->dump(CurDAG);
01950   std::cerr << '\n';
01951   abort();
01952 }
01953 
01954 void Emit_26(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0) NOINLINE {
01955   SDOperand Tmp0(0, 0);
01956   SDNode *ResNode = NULL;
01957   N0 = N.getOperand(0);
01958   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
01959   Select(Tmp0, N0);
01960   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
01961   if (N.Val->hasOneUse()) {
01962     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0);
01963   } else {
01964     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0);
01965     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
01966     Result = SDOperand(ResNode, 0);
01967   }
01968   return;
01969 }
01970 void Select_ctlz(SDOperand &Result, SDOperand N) {
01971   SDOperand N0(0, 0);
01972   SDOperand Tmp0(0, 0);
01973   SDNode *ResNode = NULL;
01974   Emit_26(Result, N, Alpha::CTLZ, MVT::i64, N0);
01975   return;
01976 }
01977 
01978 void Select_ctpop(SDOperand &Result, SDOperand N) {
01979   SDOperand N0(0, 0);
01980   SDOperand Tmp0(0, 0);
01981   SDNode *ResNode = NULL;
01982   Emit_26(Result, N, Alpha::CTPOP, MVT::i64, N0);
01983   return;
01984 }
01985 
01986 void Select_cttz(SDOperand &Result, SDOperand N) {
01987   SDOperand N0(0, 0);
01988   SDOperand Tmp0(0, 0);
01989   SDNode *ResNode = NULL;
01990   Emit_26(Result, N, Alpha::CTTZ, MVT::i64, N0);
01991   return;
01992 }
01993 
01994 void Emit_27(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2, SDOperand &N3) NOINLINE {
01995   SDOperand Tmp0(0, 0);
01996   SDOperand Tmp1(0, 0);
01997   SDNode *ResNode = NULL;
01998   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
01999   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N11)->getValue()), MVT::i64);
02000   Select(Tmp1, N10);
02001   Select(Chain, Chain);
02002   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
02003   ResNode = CurDAG->getTargetNode(Opc0, VT0, MVT::Other, Tmp0, Tmp1, Chain);
02004   Chain = SDOperand(ResNode, 1);
02005   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
02006   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Chain.Val, Chain.ResNo);
02007   if (N.ResNo == 0) AddHandleReplacement(N.Val, 1, Chain.Val, Chain.ResNo);
02008   Result = SDOperand(ResNode, N.ResNo);
02009   return;
02010 }
02011 void Emit_28(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N2, SDOperand &N3) NOINLINE {
02012   SDOperand Tmp0(0, 0);
02013   SDOperand Tmp1(0, 0);
02014   SDNode *ResNode = NULL;
02015   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
02016   Tmp0 = CurDAG->getTargetConstant(0, MVT::i64);
02017   Select(Tmp1, N1);
02018   Select(Chain, Chain);
02019   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
02020   ResNode = CurDAG->getTargetNode(Opc0, VT0, MVT::Other, Tmp0, Tmp1, Chain);
02021   Chain = SDOperand(ResNode, 1);
02022   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
02023   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Chain.Val, Chain.ResNo);
02024   if (N.ResNo == 0) AddHandleReplacement(N.Val, 1, Chain.Val, Chain.ResNo);
02025   Result = SDOperand(ResNode, N.ResNo);
02026   return;
02027 }
02028 void Select_extld(SDOperand &Result, SDOperand N) {
02029   if (N.ResNo == 1 && N.getValue(0).hasOneUse()) {
02030     SDOperand Dummy = CurDAG->getNode(ISD::HANDLENODE, MVT::Other, N);
02031     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Dummy.Val, 0);
02032     SelectionDAG::InsertISelMapEntry(HandleMap, N.Val, 1, Dummy.Val, 0);
02033     Result = Dummy;
02034     return;
02035   }
02036   SDOperand Chain(0, 0);
02037   SDOperand N1(0, 0);
02038   SDOperand N10(0, 0);
02039   SDOperand N11(0, 0);
02040   SDOperand N2(0, 0);
02041   SDOperand N3(0, 0);
02042   SDOperand Tmp0(0, 0);
02043   SDOperand Tmp1(0, 0);
02044   SDNode *ResNode = NULL;
02045   Chain = N.getOperand(0);
02046   N1 = N.getOperand(1);
02047   if (N1.getOpcode() == ISD::ADD) {
02048     N10 = N1.getOperand(0);
02049     N11 = N1.getOperand(1);
02050     if (N11.getOpcode() == ISD::Constant &&
02051         Predicate_immSExt16(N11.Val)) {
02052       N2 = N.getOperand(2);
02053       N3 = N.getOperand(3);
02054 
02055       // Pattern: (extld:i64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i8:Other)
02056       // Emits: (LDBU:i64 (imm:i64)<<P:Predicate_immSExt16>>:$DISP, GPRC:i64:$RB)
02057       // Pattern complexity = 7  cost = 1  size = 0
02058       if (cast<VTSDNode>(N3)->getVT() == MVT::i8 &&
02059           N.Val->getValueType(0) == MVT::i64) {
02060         Emit_27(Result, N, Alpha::LDBU, MVT::i64, Chain, N1, N10, N11, N2, N3);
02061         return;
02062       }
02063 
02064       // Pattern: (extld:i64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i16:Other)
02065       // Emits: (LDWU:i64 (imm:i64)<<P:Predicate_immSExt16>>:$DISP, GPRC:i64:$RB)
02066       // Pattern complexity = 7  cost = 1  size = 0
02067       if (cast<VTSDNode>(N3)->getVT() == MVT::i16 &&
02068           N.Val->getValueType(0) == MVT::i64) {
02069         Emit_27(Result, N, Alpha::LDWU, MVT::i64, Chain, N1, N10, N11, N2, N3);
02070         return;
02071       }
02072 
02073       // Pattern: (extld:i64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i32:Other)
02074       // Emits: (LDL:i64 (imm:i64)<<P:Predicate_immSExt16>>:$DISP, GPRC:i64:$RB)
02075       // Pattern complexity = 7  cost = 1
02076       if (cast<VTSDNode>(N3)->getVT() == MVT::i32 &&
02077           N.Val->getValueType(0) == MVT::i64) {
02078         Emit_27(Result, N, Alpha::LDL, MVT::i64, Chain, N1, N10, N11, N2, N3);
02079         return;
02080       }
02081     }
02082   }
02083   N2 = N.getOperand(2);
02084   N3 = N.getOperand(3);
02085 
02086   // Pattern: (extld:i64 GPRC:i64:$addr, srcvalue:Other:$dummy, i8:Other)
02087   // Emits: (LDBU:i64 0:i64, GPRC:i64:$addr)
02088   // Pattern complexity = 2  cost = 1  size = 0
02089   if (cast<VTSDNode>(N3)->getVT() == MVT::i8 &&
02090       N.Val->getValueType(0) == MVT::i64 &&
02091       N1.Val->getValueType(0) == MVT::i64) {
02092     Emit_28(Result, N, Alpha::LDBU, MVT::i64, Chain, N1, N2, N3);
02093     return;
02094   }
02095 
02096   // Pattern: (extld:i64 GPRC:i64:$addr, srcvalue:Other:$dummy, i16:Other)
02097   // Emits: (LDWU:i64 0:i64, GPRC:i64:$addr)
02098   // Pattern complexity = 2  cost = 1  size = 0
02099   if (cast<VTSDNode>(N3)->getVT() == MVT::i16 &&
02100       N.Val->getValueType(0) == MVT::i64 &&
02101       N1.Val->getValueType(0) == MVT::i64) {
02102     Emit_28(Result, N, Alpha::LDWU, MVT::i64, Chain, N1, N2, N3);
02103     return;
02104   }
02105 
02106   // Pattern: (extld:i64 GPRC:i64:$addr, srcvalue:Other:$dummy, i32:Other)
02107   // Emits: (LDL:i64 0:i64, GPRC:i64:$addr)
02108   // Pattern complexity = 2  cost = 1
02109   if (cast<VTSDNode>(N3)->getVT() == MVT::i32 &&
02110       N.Val->getValueType(0) == MVT::i64 &&
02111       N1.Val->getValueType(0) == MVT::i64) {
02112     Emit_28(Result, N, Alpha::LDL, MVT::i64, Chain, N1, N2, N3);
02113     return;
02114   }
02115   std::cerr << "Cannot yet select: ";
02116   N.Val->dump(CurDAG);
02117   std::cerr << '\n';
02118   abort();
02119 }
02120 
02121 void Emit_29(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0) NOINLINE {
02122   SDOperand Tmp0(0, 0);
02123   SDOperand Tmp1(0, 0);
02124   SDNode *ResNode = NULL;
02125   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02126   Tmp0 = CurDAG->getRegister(Alpha::F31, MVT::f64);
02127   Select(Tmp1, N0);
02128   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02129   if (N.Val->hasOneUse()) {
02130     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
02131   } else {
02132     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
02133     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02134     Result = SDOperand(ResNode, 0);
02135   }
02136   return;
02137 }
02138 void Emit_30(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0) NOINLINE {
02139   SDOperand Tmp0(0, 0);
02140   SDOperand Tmp1(0, 0);
02141   SDNode *ResNode = NULL;
02142   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02143   Tmp0 = CurDAG->getRegister(Alpha::F31, MVT::f32);
02144   Select(Tmp1, N0);
02145   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02146   if (N.Val->hasOneUse()) {
02147     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
02148   } else {
02149     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
02150     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02151     Result = SDOperand(ResNode, 0);
02152   }
02153   return;
02154 }
02155 void Select_fabs(SDOperand &Result, SDOperand N) {
02156   SDOperand N0(0, 0);
02157   SDOperand Tmp0(0, 0);
02158   SDOperand Tmp1(0, 0);
02159   SDNode *ResNode = NULL;
02160   N0 = N.getOperand(0);
02161 
02162   // Pattern: (fabs:f64 F8RC:f64:$RB)
02163   // Emits: (CPYST:f64 F31:f64, F8RC:f64:$RB)
02164   // Pattern complexity = 2  cost = 1  size = 0
02165   if (N.Val->getValueType(0) == MVT::f64) {
02166     Emit_29(Result, N, Alpha::CPYST, MVT::f64, N0);
02167     return;
02168   }
02169 
02170   // Pattern: (fabs:f32 F4RC:f32:$RB)
02171   // Emits: (CPYSS:f32 F31:f32, F4RC:f32:$RB)
02172   // Pattern complexity = 2  cost = 1
02173   if (N.Val->getValueType(0) == MVT::f32) {
02174     Emit_30(Result, N, Alpha::CPYSS, MVT::f32, N0);
02175     return;
02176   }
02177   std::cerr << "Cannot yet select: ";
02178   N.Val->dump(CurDAG);
02179   std::cerr << '\n';
02180   abort();
02181 }
02182 
02183 void Emit_31(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
02184   SDOperand Tmp0(0, 0);
02185   SDOperand Tmp1(0, 0);
02186   SDNode *ResNode = NULL;
02187   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02188   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
02189   Select(Tmp0, N0);
02190   Select(Tmp1, N1);
02191   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02192   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
02193   if (N.Val->hasOneUse()) {
02194     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
02195   } else {
02196     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
02197     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02198     Result = SDOperand(ResNode, 0);
02199   }
02200   return;
02201 }
02202 void Select_fadd(SDOperand &Result, SDOperand N) {
02203   SDOperand N0(0, 0);
02204   SDOperand N1(0, 0);
02205   SDOperand Tmp0(0, 0);
02206   SDOperand Tmp1(0, 0);
02207   SDNode *ResNode = NULL;
02208   N0 = N.getOperand(0);
02209   N1 = N.getOperand(1);
02210 
02211   // Pattern: (fadd:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02212   // Emits: (ADDS:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02213   // Pattern complexity = 2  cost = 1  size = 0
02214   if (N.Val->getValueType(0) == MVT::f32) {
02215     Emit_31(Result, N, Alpha::ADDS, MVT::f32, N0, N1);
02216     return;
02217   }
02218 
02219   // Pattern: (fadd:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02220   // Emits: (ADDT:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02221   // Pattern complexity = 2  cost = 1
02222   if (N.Val->getValueType(0) == MVT::f64) {
02223     Emit_31(Result, N, Alpha::ADDT, MVT::f64, N0, N1);
02224     return;
02225   }
02226   std::cerr << "Cannot yet select: ";
02227   N.Val->dump(CurDAG);
02228   std::cerr << '\n';
02229   abort();
02230 }
02231 
02232 void Emit_32(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N10) NOINLINE {
02233   SDOperand Tmp0(0, 0);
02234   SDOperand Tmp1(0, 0);
02235   SDNode *ResNode = NULL;
02236   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
02237   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02238   Select(Tmp0, N10);
02239   Select(Tmp1, N0);
02240   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
02241   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02242   if (N.Val->hasOneUse()) {
02243     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
02244   } else {
02245     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
02246     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02247     Result = SDOperand(ResNode, 0);
02248   }
02249   return;
02250 }
02251 void Emit_33(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
02252   SDOperand Tmp0(0, 0);
02253   SDOperand Tmp1(0, 0);
02254   SDNode *ResNode = NULL;
02255   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
02256   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02257   Select(Tmp0, N1);
02258   Select(Tmp1, N0);
02259   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
02260   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02261   if (N.Val->hasOneUse()) {
02262     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
02263   } else {
02264     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
02265     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02266     Result = SDOperand(ResNode, 0);
02267   }
02268   return;
02269 }
02270 void Select_fcopysign(SDOperand &Result, SDOperand N) {
02271   SDOperand N0(0, 0);
02272   SDOperand N1(0, 0);
02273   SDOperand N10(0, 0);
02274   SDOperand Tmp0(0, 0);
02275   SDOperand Tmp1(0, 0);
02276   SDNode *ResNode = NULL;
02277   N0 = N.getOperand(0);
02278   N1 = N.getOperand(1);
02279   if (N1.getOpcode() == ISD::FNEG) {
02280     N10 = N1.getOperand(0);
02281 
02282     // Pattern: (fcopysign:f32 F4RC:f32:$A, (fneg:f32 F4RC:f32:$B))
02283     // Emits: (CPYSNS:f32 F4RC:f32:$B, F4RC:f32:$A)
02284     // Pattern complexity = 4  cost = 1  size = 0
02285     if (N.Val->getValueType(0) == MVT::f32 &&
02286         N1.Val->getValueType(0) == MVT::f32) {
02287       Emit_32(Result, N, Alpha::CPYSNS, MVT::f32, N0, N1, N10);
02288       return;
02289     }
02290 
02291     // Pattern: (fcopysign:f64 F8RC:f64:$A, (fneg:f64 F8RC:f64:$B))
02292     // Emits: (CPYSNT:f64 F8RC:f64:$B, F8RC:f64:$A)
02293     // Pattern complexity = 4  cost = 1  size = 0
02294     if (N.Val->getValueType(0) == MVT::f64 &&
02295         N1.Val->getValueType(0) == MVT::f64) {
02296       Emit_32(Result, N, Alpha::CPYSNT, MVT::f64, N0, N1, N10);
02297       return;
02298     }
02299 
02300     // Pattern: (fcopysign:f32 F4RC:f32:$A, (fneg:f64 F8RC:f64:$B))
02301     // Emits: (CPYSNSt:f32 F8RC:f64:$B, F4RC:f32:$A)
02302     // Pattern complexity = 4  cost = 1  size = 0
02303     if (N.Val->getValueType(0) == MVT::f32 &&
02304         N1.Val->getValueType(0) == MVT::f64) {
02305       Emit_32(Result, N, Alpha::CPYSNSt, MVT::f32, N0, N1, N10);
02306       return;
02307     }
02308 
02309     // Pattern: (fcopysign:f64 F8RC:f64:$A, (fneg:f32 F4RC:f32:$B))
02310     // Emits: (CPYSNTs:f64 F4RC:f32:$B, F8RC:f64:$A)
02311     // Pattern complexity = 4  cost = 1
02312     if (N.Val->getValueType(0) == MVT::f64 &&
02313         N1.Val->getValueType(0) == MVT::f32) {
02314       Emit_32(Result, N, Alpha::CPYSNTs, MVT::f64, N0, N1, N10);
02315       return;
02316     }
02317   }
02318 
02319   // Pattern: (fcopysign:f32 F4RC:f32:$RB, F4RC:f32:$RA)
02320   // Emits: (CPYSS:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02321   // Pattern complexity = 2  cost = 1  size = 0
02322   if (N.Val->getValueType(0) == MVT::f32 &&
02323       N1.Val->getValueType(0) == MVT::f32) {
02324     Emit_33(Result, N, Alpha::CPYSS, MVT::f32, N0, N1);
02325     return;
02326   }
02327   if (N.Val->getValueType(0) == MVT::f64) {
02328 
02329     // Pattern: (fcopysign:f64 F8RC:f64:$RB, F8RC:f64:$RA)
02330     // Emits: (CPYST:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02331     // Pattern complexity = 2  cost = 1  size = 0
02332     if (N1.Val->getValueType(0) == MVT::f64) {
02333       Emit_33(Result, N, Alpha::CPYST, MVT::f64, N0, N1);
02334       return;
02335     }
02336 
02337     // Pattern: (fcopysign:f64 F8RC:f64:$RB, F4RC:f32:$RA)
02338     // Emits: (CPYSTs:f64 F4RC:f32:$RA, F8RC:f64:$RB)
02339     // Pattern complexity = 2  cost = 1
02340     if (N1.Val->getValueType(0) == MVT::f32) {
02341       Emit_33(Result, N, Alpha::CPYSTs, MVT::f64, N0, N1);
02342       return;
02343     }
02344   }
02345 
02346   // Pattern: (fcopysign:f32 F4RC:f32:$RB, F8RC:f64:$RA)
02347   // Emits: (CPYSSt:f32 F8RC:f64:$RA, F4RC:f32:$RB)
02348   // Pattern complexity = 2  cost = 1
02349   if (N.Val->getValueType(0) == MVT::f32 &&
02350       N1.Val->getValueType(0) == MVT::f64) {
02351     Emit_33(Result, N, Alpha::CPYSSt, MVT::f32, N0, N1);
02352     return;
02353   }
02354   std::cerr << "Cannot yet select: ";
02355   N.Val->dump(CurDAG);
02356   std::cerr << '\n';
02357   abort();
02358 }
02359 
02360 void Select_fdiv(SDOperand &Result, SDOperand N) {
02361   SDOperand N0(0, 0);
02362   SDOperand N1(0, 0);
02363   SDOperand Tmp0(0, 0);
02364   SDOperand Tmp1(0, 0);
02365   SDNode *ResNode = NULL;
02366   N0 = N.getOperand(0);
02367   N1 = N.getOperand(1);
02368 
02369   // Pattern: (fdiv:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02370   // Emits: (DIVS:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02371   // Pattern complexity = 2  cost = 1  size = 0
02372   if (N.Val->getValueType(0) == MVT::f32) {
02373     Emit_31(Result, N, Alpha::DIVS, MVT::f32, N0, N1);
02374     return;
02375   }
02376 
02377   // Pattern: (fdiv:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02378   // Emits: (DIVT:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02379   // Pattern complexity = 2  cost = 1
02380   if (N.Val->getValueType(0) == MVT::f64) {
02381     Emit_31(Result, N, Alpha::DIVT, MVT::f64, N0, N1);
02382     return;
02383   }
02384   std::cerr << "Cannot yet select: ";
02385   N.Val->dump(CurDAG);
02386   std::cerr << '\n';
02387   abort();
02388 }
02389 
02390 void Select_fextend(SDOperand &Result, SDOperand N) {
02391   SDOperand N0(0, 0);
02392   SDOperand Tmp0(0, 0);
02393   SDNode *ResNode = NULL;
02394   Emit_26(Result, N, Alpha::CVTST, MVT::f64, N0);
02395   return;
02396 }
02397 
02398 void Select_fmul(SDOperand &Result, SDOperand N) {
02399   SDOperand N0(0, 0);
02400   SDOperand N1(0, 0);
02401   SDOperand Tmp0(0, 0);
02402   SDOperand Tmp1(0, 0);
02403   SDNode *ResNode = NULL;
02404   N0 = N.getOperand(0);
02405   N1 = N.getOperand(1);
02406 
02407   // Pattern: (fmul:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02408   // Emits: (MULS:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02409   // Pattern complexity = 2  cost = 1  size = 0
02410   if (N.Val->getValueType(0) == MVT::f32) {
02411     Emit_31(Result, N, Alpha::MULS, MVT::f32, N0, N1);
02412     return;
02413   }
02414 
02415   // Pattern: (fmul:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02416   // Emits: (MULT:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02417   // Pattern complexity = 2  cost = 1
02418   if (N.Val->getValueType(0) == MVT::f64) {
02419     Emit_31(Result, N, Alpha::MULT, MVT::f64, N0, N1);
02420     return;
02421   }
02422   std::cerr << "Cannot yet select: ";
02423   N.Val->dump(CurDAG);
02424   std::cerr << '\n';
02425   abort();
02426 }
02427 
02428 void Emit_34(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01) NOINLINE {
02429   SDOperand Tmp0(0, 0);
02430   SDOperand Tmp1(0, 0);
02431   SDNode *ResNode = NULL;
02432   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
02433   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
02434   Select(Tmp0, N01);
02435   Select(Tmp1, N00);
02436   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
02437   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
02438   if (N.Val->hasOneUse()) {
02439     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
02440   } else {
02441     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
02442     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02443     Result = SDOperand(ResNode, 0);
02444   }
02445   return;
02446 }
02447 void Emit_35(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0) NOINLINE {
02448   SDOperand Tmp0(0, 0);
02449   SDNode *ResNode = NULL;
02450   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02451   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02452   Select(Tmp0, N0);
02453   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02454   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02455   if (N.Val->hasOneUse()) {
02456     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp0);
02457   } else {
02458     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp0);
02459     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02460     Result = SDOperand(ResNode, 0);
02461   }
02462   return;
02463 }
02464 void Select_fneg(SDOperand &Result, SDOperand N) {
02465   SDOperand N0(0, 0);
02466   SDOperand N00(0, 0);
02467   SDOperand N01(0, 0);
02468   SDOperand Tmp0(0, 0);
02469   SDOperand Tmp1(0, 0);
02470   SDNode *ResNode = NULL;
02471   N0 = N.getOperand(0);
02472   if (N0.getOpcode() == ISD::FCOPYSIGN) {
02473     N00 = N0.getOperand(0);
02474     N01 = N0.getOperand(1);
02475 
02476     // Pattern: (fneg:f32 (fcopysign:f32 F4RC:f32:$RB, F4RC:f32:$RA))
02477     // Emits: (CPYSNS:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02478     // Pattern complexity = 4  cost = 1  size = 0
02479     if (N.Val->getValueType(0) == MVT::f32 &&
02480         N01.Val->getValueType(0) == MVT::f32) {
02481       Emit_34(Result, N, Alpha::CPYSNS, MVT::f32, N0, N00, N01);
02482       return;
02483     }
02484     if (N.Val->getValueType(0) == MVT::f64) {
02485 
02486       // Pattern: (fneg:f64 (fcopysign:f64 F8RC:f64:$RB, F8RC:f64:$RA))
02487       // Emits: (CPYSNT:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02488       // Pattern complexity = 4  cost = 1  size = 0
02489       if (N01.Val->getValueType(0) == MVT::f64) {
02490         Emit_34(Result, N, Alpha::CPYSNT, MVT::f64, N0, N00, N01);
02491         return;
02492       }
02493 
02494       // Pattern: (fneg:f64 (fcopysign:f64 F8RC:f64:$RB, F4RC:f32:$RA))
02495       // Emits: (CPYSNTs:f64 F4RC:f32:$RA, F8RC:f64:$RB)
02496       // Pattern complexity = 4  cost = 1
02497       if (N01.Val->getValueType(0) == MVT::f32) {
02498         Emit_34(Result, N, Alpha::CPYSNTs, MVT::f64, N0, N00, N01);
02499         return;
02500       }
02501     }
02502 
02503     // Pattern: (fneg:f32 (fcopysign:f32 F4RC:f32:$RB, F8RC:f64:$RA))
02504     // Emits: (CPYSNSt:f32 F8RC:f64:$RA, F4RC:f32:$RB)
02505     // Pattern complexity = 4  cost = 1
02506     if (N.Val->getValueType(0) == MVT::f32 &&
02507         N01.Val->getValueType(0) == MVT::f64) {
02508       Emit_34(Result, N, Alpha::CPYSNSt, MVT::f32, N0, N00, N01);
02509       return;
02510     }
02511   }
02512 
02513   // Pattern: (fneg:f64 F8RC:f64:$RB)
02514   // Emits: (CPYSNT:f64 F8RC:f64:$RB, F8RC:f64:$RB)
02515   // Pattern complexity = 2  cost = 1  size = 0
02516   if (N.Val->getValueType(0) == MVT::f64) {
02517     Emit_35(Result, N, Alpha::CPYSNT, MVT::f64, N0);
02518     return;
02519   }
02520 
02521   // Pattern: (fneg:f32 F4RC:f32:$RB)
02522   // Emits: (CPYSNS:f32 F4RC:f32:$RB, F4RC:f32:$RB)
02523   // Pattern complexity = 2  cost = 1
02524   if (N.Val->getValueType(0) == MVT::f32) {
02525     Emit_35(Result, N, Alpha::CPYSNS, MVT::f32, N0);
02526     return;
02527   }
02528   std::cerr << "Cannot yet select: ";
02529   N.Val->dump(CurDAG);
02530   std::cerr << '\n';
02531   abort();
02532 }
02533 
02534 void Select_fround(SDOperand &Result, SDOperand N) {
02535   SDOperand N0(0, 0);
02536   SDOperand Tmp0(0, 0);
02537   SDNode *ResNode = NULL;
02538   Emit_26(Result, N, Alpha::CVTTS, MVT::f32, N0);
02539   return;
02540 }
02541 
02542 void Select_fsqrt(SDOperand &Result, SDOperand N) {
02543   SDOperand N0(0, 0);
02544   SDOperand Tmp0(0, 0);
02545   SDNode *ResNode = NULL;
02546   N0 = N.getOperand(0);
02547 
02548   // Pattern: (fsqrt:f32 F4RC:f32:$RB)
02549   // Emits: (SQRTS:f32 F4RC:f32:$RB)
02550   // Pattern complexity = 2  cost = 1  size = 0
02551   if (N.Val->getValueType(0) == MVT::f32) {
02552     Emit_0(Result, N, Alpha::SQRTS, MVT::f32, N0);
02553     return;
02554   }
02555 
02556   // Pattern: (fsqrt:f64 F8RC:f64:$RB)
02557   // Emits: (SQRTT:f64 F8RC:f64:$RB)
02558   // Pattern complexity = 2  cost = 1
02559   if (N.Val->getValueType(0) == MVT::f64) {
02560     Emit_0(Result, N, Alpha::SQRTT, MVT::f64, N0);
02561     return;
02562   }
02563   std::cerr << "Cannot yet select: ";
02564   N.Val->dump(CurDAG);
02565   std::cerr << '\n';
02566   abort();
02567 }
02568 
02569 void Select_fsub(SDOperand &Result, SDOperand N) {
02570   SDOperand N0(0, 0);
02571   SDOperand N1(0, 0);
02572   SDOperand Tmp0(0, 0);
02573   SDOperand Tmp1(0, 0);
02574   SDNode *ResNode = NULL;
02575   N0 = N.getOperand(0);
02576   N1 = N.getOperand(1);
02577 
02578   // Pattern: (fsub:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02579   // Emits: (SUBS:f32 F4RC:f32:$RA, F4RC:f32:$RB)
02580   // Pattern complexity = 2  cost = 1  size = 0
02581   if (N.Val->getValueType(0) == MVT::f32) {
02582     Emit_31(Result, N, Alpha::SUBS, MVT::f32, N0, N1);
02583     return;
02584   }
02585 
02586   // Pattern: (fsub:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02587   // Emits: (SUBT:f64 F8RC:f64:$RA, F8RC:f64:$RB)
02588   // Pattern complexity = 2  cost = 1
02589   if (N.Val->getValueType(0) == MVT::f64) {
02590     Emit_31(Result, N, Alpha::SUBT, MVT::f64, N0, N1);
02591     return;
02592   }
02593   std::cerr << "Cannot yet select: ";
02594   N.Val->dump(CurDAG);
02595   std::cerr << '\n';
02596   abort();
02597 }
02598 
02599 void Emit_36(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0) NOINLINE {
02600   SDOperand Tmp0(0, 0);
02601   SDOperand Tmp1(0, 0);
02602   SDNode *ResNode = NULL;
02603   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N)->getValue()), MVT::i64);
02604   Tmp1 = CurDAG->getRegister(Alpha::R31, MVT::i64);
02605   if (N.Val->hasOneUse()) {
02606     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
02607   } else {
02608     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
02609     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02610     Result = SDOperand(ResNode, 0);
02611   }
02612   return;
02613 }
02614 void Emit_37(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1) NOINLINE {
02615   SDOperand Tmp0(0, 0);
02616   SDOperand Tmp1(0, 0);
02617   SDOperand Tmp2(0, 0);
02618   SDOperand Tmp3(0, 0);
02619   SDOperand Tmp4(0, 0);
02620   SDNode *ResNode = NULL;
02621   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N)->getValue()), MVT::i64);
02622   Tmp1 = Transform_LL16(Tmp0.Val);
02623   Tmp2 = Transform_LH16(Tmp0.Val);
02624   Tmp3 = CurDAG->getRegister(Alpha::R31, MVT::i64);
02625   Tmp4 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3), 0);
02626   if (N.Val->hasOneUse()) {
02627     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp1, Tmp4);
02628   } else {
02629     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp1, Tmp4);
02630     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02631     Result = SDOperand(ResNode, 0);
02632   }
02633   return;
02634 }
02635 void Emit_38(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1) NOINLINE {
02636   SDOperand Tmp0(0, 0);
02637   SDOperand Tmp1(0, 0);
02638   SDOperand Tmp2(0, 0);
02639   SDOperand Tmp3(0, 0);
02640   SDOperand Tmp4(0, 0);
02641   SDNode *ResNode = NULL;
02642   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N)->getValue()), MVT::i64);
02643   Tmp1 = Transform_SExt16(Tmp0.Val);
02644   Tmp2 = CurDAG->getRegister(Alpha::R31, MVT::i64);
02645   Tmp3 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2), 0);
02646   Tmp4 = CurDAG->getTargetConstant(15, MVT::i64);
02647   if (N.Val->hasOneUse()) {
02648     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp3, Tmp4);
02649   } else {
02650     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp3, Tmp4);
02651     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02652     Result = SDOperand(ResNode, 0);
02653   }
02654   return;
02655 }
02656 void Emit_39(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, unsigned Opc2, MVT::ValueType VT0, MVT::ValueType VT1, MVT::ValueType VT2) NOINLINE {
02657   SDOperand Tmp0(0, 0);
02658   SDOperand Tmp1(0, 0);
02659   SDOperand Tmp2(0, 0);
02660   SDOperand Tmp3(0, 0);
02661   SDOperand Tmp4(0, 0);
02662   SDOperand Tmp5(0, 0);
02663   SDOperand Tmp6(0, 0);
02664   SDOperand Tmp7(0, 0);
02665   SDOperand Tmp8(0, 0);
02666   SDNode *ResNode = NULL;
02667   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N)->getValue()), MVT::i64);
02668   Tmp1 = Transform_SExt32(Tmp0.Val);
02669   Tmp2 = Transform_LL16(Tmp1.Val);
02670   Tmp3 = Transform_SExt32(Tmp0.Val);
02671   Tmp4 = Transform_LH16(Tmp3.Val);
02672   Tmp5 = CurDAG->getRegister(Alpha::R31, MVT::i64);
02673   Tmp6 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp4, Tmp5), 0);
02674   Tmp7 = SDOperand(CurDAG->getTargetNode(Opc1, VT1, Tmp2, Tmp6), 0);
02675   Tmp8 = CurDAG->getTargetConstant(15, MVT::i64);
02676   if (N.Val->hasOneUse()) {
02677     Result = CurDAG->SelectNodeTo(N.Val, Opc2, VT2, Tmp7, Tmp8);
02678   } else {
02679     ResNode = CurDAG->getTargetNode(Opc2, VT2, Tmp7, Tmp8);
02680     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02681     Result = SDOperand(ResNode, 0);
02682   }
02683   return;
02684 }
02685 void Select_imm(SDOperand &Result, SDOperand N) {
02686   SDOperand Tmp0(0, 0);
02687   SDOperand Tmp1(0, 0);
02688   SDOperand Tmp2(0, 0);
02689   SDOperand Tmp3(0, 0);
02690   SDOperand Tmp4(0, 0);
02691   SDOperand Tmp5(0, 0);
02692   SDOperand Tmp6(0, 0);
02693   SDOperand Tmp7(0, 0);
02694   SDOperand Tmp8(0, 0);
02695   SDNode *ResNode = NULL;
02696 
02697   // Pattern: (imm:i64)<<P:Predicate_immSExt16>>:$imm
02698   // Emits: (LDA:i64 (imm:i64)<<P:Predicate_immSExt16>>:$imm, R31:i64)
02699   // Pattern complexity = 3  cost = 1  size = 0
02700   if (Predicate_immSExt16(N.Val)) {
02701     Emit_36(Result, N, Alpha::LDA, MVT::i64);
02702     return;
02703   }
02704 
02705   // Pattern: (imm:i64)<<P:Predicate_immConst2Part>>:$imm
02706   // Emits: (LDA:i64 (LL16:i64 (imm:i64)<<P:Predicate_immConst2Part>>:$imm), (LDAH:i64 (LH16:i64 (imm:i64)<<P:Predicate_immConst2Part>>:$imm), R31:i64))
02707   // Pattern complexity = 3  cost = 2  size = 0
02708   if (Predicate_immConst2Part(N.Val)) {
02709     Emit_37(Result, N, Alpha::LDAH, Alpha::LDA, MVT::i64, MVT::i64);
02710     return;
02711   }
02712 
02713   // Pattern: (imm:i64)<<P:Predicate_immSExt16int>><<X:SExt16>>:$imm
02714   // Emits: (ZAPNOTi:i64 (LDA:i64 (SExt16:i64 (imm:i64)<<P:Predicate_immSExt16int>><<X:SExt16>>:$imm), R31:i64), 15:i64)
02715   // Pattern complexity = 3  cost = 2  size = 0
02716   if (Predicate_immSExt16int(N.Val)) {
02717     Emit_38(Result, N, Alpha::LDA, Alpha::ZAPNOTi, MVT::i64, MVT::i64);
02718     return;
02719   }
02720 
02721   // Pattern: (imm:i64)<<P:Predicate_immConst2PartInt>><<X:SExt32>>:$imm
02722   // Emits: (ZAPNOTi:i64 (LDA:i64 (LL16:i64 (SExt32:i64 (imm:i64)<<P:Predicate_immConst2PartInt>><<X:SExt32>>:$imm)), (LDAH:i64 (LH16:i64 (SExt32:i64 (imm:i64)<<P:Predicate_immConst2PartInt>><<X:SExt32>>:$imm)), R31:i64)), 15:i64)
02723   // Pattern complexity = 3  cost = 3
02724   if (Predicate_immConst2PartInt(N.Val)) {
02725     Emit_39(Result, N, Alpha::LDAH, Alpha::LDA, Alpha::ZAPNOTi, MVT::i64, MVT::i64, MVT::i64);
02726     return;
02727   }
02728   std::cerr << "Cannot yet select: ";
02729   N.Val->dump(CurDAG);
02730   std::cerr << '\n';
02731   abort();
02732 }
02733 
02734 void Emit_40(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11) NOINLINE {
02735   SDOperand Tmp0(0, 0);
02736   SDOperand Tmp1(0, 0);
02737   SDNode *ResNode = NULL;
02738   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
02739   Tmp0 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N11)->getValue()), MVT::i64);
02740   Select(Tmp1, N10);
02741   Select(Chain, Chain);
02742   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
02743   ResNode = CurDAG->getTargetNode(Opc0, VT0, MVT::Other, Tmp0, Tmp1, Chain);
02744   Chain = SDOperand(ResNode, 1);
02745   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
02746   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Chain.Val, Chain.ResNo);
02747   if (N.ResNo == 0) AddHandleReplacement(N.Val, 1, Chain.Val, Chain.ResNo);
02748   Result = SDOperand(ResNode, N.ResNo);
02749   return;
02750 }
02751 void Emit_41(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11) NOINLINE {
02752   SDOperand Tmp0(0, 0);
02753   SDOperand Tmp1(0, 0);
02754   SDNode *ResNode = NULL;
02755   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N11.Val);
02756   Tmp0 = N10;
02757   Select(Tmp1, N11);
02758   Select(Chain, Chain);
02759   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N11.Val);
02760   ResNode = CurDAG->getTargetNode(Opc0, VT0, MVT::Other, Tmp0, Tmp1, Chain);
02761   Chain = SDOperand(ResNode, 1);
02762   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
02763   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Chain.Val, Chain.ResNo);
02764   if (N.ResNo == 0) AddHandleReplacement(N.Val, 1, Chain.Val, Chain.ResNo);
02765   Result = SDOperand(ResNode, N.ResNo);
02766   return;
02767 }
02768 void Emit_42(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1) NOINLINE {
02769   SDOperand Tmp0(0, 0);
02770   SDOperand Tmp1(0, 0);
02771   SDNode *ResNode = NULL;
02772   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
02773   Tmp0 = CurDAG->getTargetConstant(0, MVT::i64);
02774   Select(Tmp1, N1);
02775   Select(Chain, Chain);
02776   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
02777   ResNode = CurDAG->getTargetNode(Opc0, VT0, MVT::Other, Tmp0, Tmp1, Chain);
02778   Chain = SDOperand(ResNode, 1);
02779   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
02780   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Chain.Val, Chain.ResNo);
02781   if (N.ResNo == 0) AddHandleReplacement(N.Val, 1, Chain.Val, Chain.ResNo);
02782   Result = SDOperand(ResNode, N.ResNo);
02783   return;
02784 }
02785 void Select_load(SDOperand &Result, SDOperand N) {
02786   if (N.ResNo == 1 && N.getValue(0).hasOneUse()) {
02787     SDOperand Dummy = CurDAG->getNode(ISD::HANDLENODE, MVT::Other, N);
02788     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Dummy.Val, 0);
02789     SelectionDAG::InsertISelMapEntry(HandleMap, N.Val, 1, Dummy.Val, 0);
02790     Result = Dummy;
02791     return;
02792   }
02793   SDOperand Chain(0, 0);
02794   SDOperand N1(0, 0);
02795   SDOperand N10(0, 0);
02796   SDOperand N11(0, 0);
02797   SDOperand Tmp0(0, 0);
02798   SDOperand Tmp1(0, 0);
02799   SDNode *ResNode = NULL;
02800   Chain = N.getOperand(0);
02801   N1 = N.getOperand(1);
02802   if (N1.getOpcode() == ISD::ADD) {
02803     N10 = N1.getOperand(0);
02804     N11 = N1.getOperand(1);
02805     if (N11.getOpcode() == ISD::Constant &&
02806         Predicate_immSExt16(N11.Val)) {
02807 
02808       // Pattern: (load:i64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP))
02809       // Emits: (LDQ:i64 (imm:i64):$DISP, GPRC:i64:$RB)
02810       // Pattern complexity = 7  cost = 1  size = 0
02811       if (N.Val->getValueType(0) == MVT::i64) {
02812         Emit_40(Result, N, Alpha::LDQ, MVT::i64, Chain, N1, N10, N11);
02813         return;
02814       }
02815 
02816       // Pattern: (load:f32 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP))
02817       // Emits: (LDS:f32 (imm:i64):$DISP, GPRC:i64:$RB)
02818       // Pattern complexity = 7  cost = 1  size = 0
02819       if (N.Val->getValueType(0) == MVT::f32) {
02820         Emit_40(Result, N, Alpha::LDS, MVT::f32, Chain, N1, N10, N11);
02821         return;
02822       }
02823 
02824       // Pattern: (load:f64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP))
02825       // Emits: (LDT:f64 (imm:i64):$DISP, GPRC:i64:$RB)
02826       // Pattern complexity = 7  cost = 1
02827       if (N.Val->getValueType(0) == MVT::f64) {
02828         Emit_40(Result, N, Alpha::LDT, MVT::f64, Chain, N1, N10, N11);
02829         return;
02830       }
02831     }
02832   }
02833   if (N1.getOpcode() == AlphaISD::GPRelLo) {
02834     N10 = N1.getOperand(0);
02835     if (N10.getOpcode() == ISD::TargetGlobalAddress) {
02836       N11 = N1.getOperand(1);
02837 
02838       // Pattern: (load:i64 (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB))
02839       // Emits: (LDQr:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
02840       // Pattern complexity = 6  cost = 1  size = 0
02841       if (N.Val->getValueType(0) == MVT::i64) {
02842         Emit_41(Result, N, Alpha::LDQr, MVT::i64, Chain, N1, N10, N11);
02843         return;
02844       }
02845 
02846       // Pattern: (load:f32 (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB))
02847       // Emits: (LDSr:f32 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
02848       // Pattern complexity = 6  cost = 1  size = 0
02849       if (N.Val->getValueType(0) == MVT::f32) {
02850         Emit_41(Result, N, Alpha::LDSr, MVT::f32, Chain, N1, N10, N11);
02851         return;
02852       }
02853 
02854       // Pattern: (load:f64 (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB))
02855       // Emits: (LDTr:f64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
02856       // Pattern complexity = 6  cost = 1
02857       if (N.Val->getValueType(0) == MVT::f64) {
02858         Emit_41(Result, N, Alpha::LDTr, MVT::f64, Chain, N1, N10, N11);
02859         return;
02860       }
02861     }
02862     if (N10.getOpcode() == ISD::TargetConstantPool) {
02863       N11 = N1.getOperand(1);
02864 
02865       // Pattern: (load:i64 (Alpha_gprello:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB))
02866       // Emits: (LDQr:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
02867       // Pattern complexity = 6  cost = 1  size = 0
02868       if (N.Val->getValueType(0) == MVT::i64) {
02869         Emit_41(Result, N, Alpha::LDQr, MVT::i64, Chain, N1, N10, N11);
02870         return;
02871       }
02872 
02873       // Pattern: (load:f32 (Alpha_gprello:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB))
02874       // Emits: (LDSr:f32 (tconstpool:i64):$DISP, GPRC:i64:$RB)
02875       // Pattern complexity = 6  cost = 1  size = 0
02876       if (N.Val->getValueType(0) == MVT::f32) {
02877         Emit_41(Result, N, Alpha::LDSr, MVT::f32, Chain, N1, N10, N11);
02878         return;
02879       }
02880 
02881       // Pattern: (load:f64 (Alpha_gprello:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB))
02882       // Emits: (LDTr:f64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
02883       // Pattern complexity = 6  cost = 1
02884       if (N.Val->getValueType(0) == MVT::f64) {
02885         Emit_41(Result, N, Alpha::LDTr, MVT::f64, Chain, N1, N10, N11);
02886         return;
02887       }
02888     }
02889   }
02890 
02891   // Pattern: (load:i64 GPRC:i64:$addr)
02892   // Emits: (LDQ:i64 0:i64, GPRC:i64:$addr)
02893   // Pattern complexity = 2  cost = 1  size = 0
02894   if (N.Val->getValueType(0) == MVT::i64 &&
02895       N1.Val->getValueType(0) == MVT::i64) {
02896     Emit_42(Result, N, Alpha::LDQ, MVT::i64, Chain, N1);
02897     return;
02898   }
02899 
02900   // Pattern: (load:f64 GPRC:i64:$addr)
02901   // Emits: (LDT:f64 0:i64, GPRC:i64:$addr)
02902   // Pattern complexity = 2  cost = 1  size = 0
02903   if (N.Val->getValueType(0) == MVT::f64 &&
02904       N1.Val->getValueType(0) == MVT::i64) {
02905     Emit_42(Result, N, Alpha::LDT, MVT::f64, Chain, N1);
02906     return;
02907   }
02908 
02909   // Pattern: (load:f32 GPRC:i64:$addr)
02910   // Emits: (LDS:f32 0:i64, GPRC:i64:$addr)
02911   // Pattern complexity = 2  cost = 1
02912   if (N.Val->getValueType(0) == MVT::f32 &&
02913       N1.Val->getValueType(0) == MVT::i64) {
02914     Emit_42(Result, N, Alpha::LDS, MVT::f32, Chain, N1);
02915     return;
02916   }
02917   std::cerr << "Cannot yet select: ";
02918   N.Val->dump(CurDAG);
02919   std::cerr << '\n';
02920   abort();
02921 }
02922 
02923 void Emit_43(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
02924   SDOperand Tmp1(0, 0);
02925   SDNode *ResNode = NULL;
02926   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02927   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02928   Select(Tmp1, N0);
02929   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02930   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02931   if (N.Val->hasOneUse()) {
02932     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp1);
02933   } else {
02934     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp1);
02935     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02936     Result = SDOperand(ResNode, 0);
02937   }
02938   return;
02939 }
02940 void Emit_44(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
02941   SDOperand Tmp1(0, 0);
02942   SDNode *ResNode = NULL;
02943   N1 = N.getOperand(1);
02944   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
02945   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
02946   Select(Tmp1, N1);
02947   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
02948   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
02949   if (N.Val->hasOneUse()) {
02950     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp1);
02951   } else {
02952     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp1);
02953     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02954     Result = SDOperand(ResNode, 0);
02955   }
02956   return;
02957 }
02958 void Emit_45(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1, SDOperand &N0, SDOperand &N1) NOINLINE {
02959   SDOperand Tmp0(0, 0);
02960   SDOperand Tmp1(0, 0);
02961   SDOperand Tmp2(0, 0);
02962   SDOperand Tmp3(0, 0);
02963   SDNode *ResNode = NULL;
02964   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02965   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02966   Select(Tmp0, N0);
02967   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
02968   Tmp2 = Transform_nearP2X(Tmp1.Val);
02969   Tmp3 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2), 0);
02970   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02971   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02972   if (N.Val->hasOneUse()) {
02973     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp3, Tmp0);
02974   } else {
02975     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp3, Tmp0);
02976     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
02977     Result = SDOperand(ResNode, 0);
02978   }
02979   return;
02980 }
02981 void Emit_46(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1, SDOperand &N0, SDOperand &N1) NOINLINE {
02982   SDOperand Tmp0(0, 0);
02983   SDOperand Tmp1(0, 0);
02984   SDOperand Tmp2(0, 0);
02985   SDOperand Tmp3(0, 0);
02986   SDNode *ResNode = NULL;
02987   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
02988   Select(Tmp0, N0);
02989   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp0.Val);
02990   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
02991   Tmp2 = Transform_nearP2X(Tmp1.Val);
02992   Tmp3 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2), 0);
02993   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
02994   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp0.Val);
02995   if (N.Val->hasOneUse()) {
02996     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp0, Tmp3);
02997   } else {
02998     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp0, Tmp3);
02999     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03000     Result = SDOperand(ResNode, 0);
03001   }
03002   return;
03003 }
03004 void Emit_47(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, unsigned Opc2, MVT::ValueType VT0, MVT::ValueType VT1, MVT::ValueType VT2, SDOperand &N0, SDOperand &N1) NOINLINE {
03005   SDOperand Tmp0(0, 0);
03006   SDOperand Tmp1(0, 0);
03007   SDOperand Tmp2(0, 0);
03008   SDOperand Tmp3(0, 0);
03009   SDOperand Tmp4(0, 0);
03010   SDNode *ResNode = NULL;
03011   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
03012   Select(Tmp0, N0);
03013   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
03014   Tmp2 = Transform_nearP2X(Tmp1.Val);
03015   Tmp3 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2), 0);
03016   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp0.Val);
03017   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp0.Val);
03018   Tmp4 = SDOperand(CurDAG->getTargetNode(Opc1, VT1, Tmp0, Tmp0), 0);
03019   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
03020   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp0.Val);
03021   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp0.Val);
03022   if (N.Val->hasOneUse()) {
03023     Result = CurDAG->SelectNodeTo(N.Val, Opc2, VT2, Tmp3, Tmp4);
03024   } else {
03025     ResNode = CurDAG->getTargetNode(Opc2, VT2, Tmp3, Tmp4);
03026     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03027     Result = SDOperand(ResNode, 0);
03028   }
03029   return;
03030 }
03031 void Emit_48(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, unsigned Opc2, MVT::ValueType VT0, MVT::ValueType VT1, MVT::ValueType VT2, SDOperand &N0, SDOperand &N1) NOINLINE {
03032   SDOperand Tmp0(0, 0);
03033   SDOperand Tmp1(0, 0);
03034   SDOperand Tmp2(0, 0);
03035   SDOperand Tmp3(0, 0);
03036   SDOperand Tmp4(0, 0);
03037   SDOperand Tmp5(0, 0);
03038   SDNode *ResNode = NULL;
03039   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
03040   Select(Tmp0, N0);
03041   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
03042   Tmp2 = Transform_nearP2X(Tmp1.Val);
03043   Tmp3 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2), 0);
03044   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp0.Val);
03045   Tmp4 = Transform_nearP2RemX(Tmp1.Val);
03046   Tmp5 = SDOperand(CurDAG->getTargetNode(Opc1, VT1, Tmp0, Tmp4), 0);
03047   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
03048   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp0.Val);
03049   if (N.Val->hasOneUse()) {
03050     Result = CurDAG->SelectNodeTo(N.Val, Opc2, VT2, Tmp3, Tmp5);
03051   } else {
03052     ResNode = CurDAG->getTargetNode(Opc2, VT2, Tmp3, Tmp5);
03053     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03054     Result = SDOperand(ResNode, 0);
03055   }
03056   return;
03057 }
03058 void Select_mul(SDOperand &Result, SDOperand N) {
03059   SDOperand N0(0, 0);
03060   SDOperand N1(0, 0);
03061   SDOperand Tmp0(0, 0);
03062   SDOperand Tmp1(0, 0);
03063   SDOperand Tmp2(0, 0);
03064   SDOperand Tmp3(0, 0);
03065   SDOperand Tmp4(0, 0);
03066   SDOperand Tmp5(0, 0);
03067   SDNode *ResNode = NULL;
03068   {
03069     N0 = N.getOperand(0);
03070     {
03071       N1 = N.getOperand(1);
03072 
03073       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8ME>>:$L)
03074       // Emits: (MULQi:i64 GPRC:i64:$RA, (imm:i64):$L)
03075       // Pattern complexity = 5  cost = 1  size = 0
03076       if (N1.getOpcode() == ISD::Constant &&
03077           Predicate_immUExt8ME(N1.Val)) {
03078         Emit_6(Result, N, Alpha::MULQi, MVT::i64, N0, N1);
03079         return;
03080       }
03081       if (isa<ConstantSDNode>(N1)) {
03082         int64_t CN0 = cast<ConstantSDNode>(N1)->getSignExtended();
03083 
03084         // Pattern: (mul:i64 GPRC:i64:$RA, 5:i64)
03085         // Emits: (S4ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RA)
03086         // Pattern complexity = 5  cost = 1  size = 0
03087         if (CN0 == 5) {
03088           Emit_43(Result, N, Alpha::S4ADDQ, MVT::i64, N0, N1);
03089           return;
03090         }
03091 
03092         // Pattern: (mul:i64 GPRC:i64:$RA, 3:i64)
03093         // Emits: (S4SUBQ:i64 GPRC:i64:$RA, GPRC:i64:$RA)
03094         // Pattern complexity = 5  cost = 1
03095         if (CN0 == 3) {
03096           Emit_43(Result, N, Alpha::S4SUBQ, MVT::i64, N0, N1);
03097           return;
03098         }
03099       }
03100     }
03101     if (isa<ConstantSDNode>(N0)) {
03102       int64_t CN0 = cast<ConstantSDNode>(N0)->getSignExtended();
03103 
03104       // Pattern: (mul:i64 5:i64, GPRC:i64:$RA)
03105       // Emits: (S4ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RA)
03106       // Pattern complexity = 5  cost = 1  size = 0
03107       if (CN0 == 5) {
03108         Emit_44(Result, N, Alpha::S4ADDQ, MVT::i64, N0, N1);
03109         return;
03110       }
03111 
03112       // Pattern: (mul:i64 3:i64, GPRC:i64:$RA)
03113       // Emits: (S4SUBQ:i64 GPRC:i64:$RA, GPRC:i64:$RA)
03114       // Pattern complexity = 5  cost = 1
03115       if (CN0 == 3) {
03116         Emit_44(Result, N, Alpha::S4SUBQ, MVT::i64, N0, N1);
03117         return;
03118       }
03119     }
03120     N1 = N.getOperand(1);
03121     if (N1.getOpcode() == ISD::Constant) {
03122 
03123       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRem1>>:$imm)
03124       // Emits: (ADDQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRem1>>:$imm)), GPRC:i64:$RA)
03125       // Pattern complexity = 5  cost = 2  size = 0
03126       if (Predicate_immRem1(N1.Val)) {
03127         Emit_45(Result, N, Alpha::SL, Alpha::ADDQ, MVT::i64, MVT::i64, N0, N1);
03128         return;
03129       }
03130 
03131       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRem4>>:$imm)
03132       // Emits: (S4ADDQ:i64 GPRC:i64:$RA, (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRem4>>:$imm)))
03133       // Pattern complexity = 5  cost = 2  size = 0
03134       if (Predicate_immRem4(N1.Val)) {
03135         Emit_46(Result, N, Alpha::SL, Alpha::S4ADDQ, MVT::i64, MVT::i64, N0, N1);
03136         return;
03137       }
03138 
03139       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRem1n>>:$imm)
03140       // Emits: (SUBQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRem1n>>:$imm)), GPRC:i64:$RA)
03141       // Pattern complexity = 5  cost = 2  size = 0
03142       if (Predicate_immRem1n(N1.Val)) {
03143         Emit_45(Result, N, Alpha::SL, Alpha::SUBQ, MVT::i64, MVT::i64, N0, N1);
03144         return;
03145       }
03146 
03147       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRem3>>:$imm)
03148       // Emits: (ADDQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRem3>>:$imm)), (S4SUBQ:i64 GPRC:i64:$RA, GPRC:i64:$RA))
03149       // Pattern complexity = 5  cost = 3  size = 0
03150       if (Predicate_immRem3(N1.Val)) {
03151         Emit_47(Result, N, Alpha::SL, Alpha::S4SUBQ, Alpha::ADDQ, MVT::i64, MVT::i64, MVT::i64, N0, N1);
03152         return;
03153       }
03154 
03155       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRem5>>:$imm)
03156       // Emits: (ADDQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRem5>>:$imm)), (S4ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RA))
03157       // Pattern complexity = 5  cost = 3  size = 0
03158       if (Predicate_immRem5(N1.Val)) {
03159         Emit_47(Result, N, Alpha::SL, Alpha::S4ADDQ, Alpha::ADDQ, MVT::i64, MVT::i64, MVT::i64, N0, N1);
03160         return;
03161       }
03162 
03163       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRemP2>>:$imm)
03164       // Emits: (ADDQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRemP2>>:$imm)), (SLi:i64 GPRC:i64:$RA, (nearP2RemX:i64 (imm:i64)<<P:Predicate_immRemP2>>:$imm)))
03165       // Pattern complexity = 5  cost = 3  size = 0
03166       if (Predicate_immRemP2(N1.Val)) {
03167         Emit_48(Result, N, Alpha::SL, Alpha::SLi, Alpha::ADDQ, MVT::i64, MVT::i64, MVT::i64, N0, N1);
03168         return;
03169       }
03170 
03171       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRem3n>>:$imm)
03172       // Emits: (SUBQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRem3n>>:$imm)), (S4SUBQ:i64 GPRC:i64:$RA, GPRC:i64:$RA))
03173       // Pattern complexity = 5  cost = 3  size = 0
03174       if (Predicate_immRem3n(N1.Val)) {
03175         Emit_47(Result, N, Alpha::SL, Alpha::S4SUBQ, Alpha::SUBQ, MVT::i64, MVT::i64, MVT::i64, N0, N1);
03176         return;
03177       }
03178 
03179       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRem5n>>:$imm)
03180       // Emits: (SUBQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRem5n>>:$imm)), (S4ADDQ:i64 GPRC:i64:$RA, GPRC:i64:$RA))
03181       // Pattern complexity = 5  cost = 3  size = 0
03182       if (Predicate_immRem5n(N1.Val)) {
03183         Emit_47(Result, N, Alpha::SL, Alpha::S4ADDQ, Alpha::SUBQ, MVT::i64, MVT::i64, MVT::i64, N0, N1);
03184         return;
03185       }
03186 
03187       // Pattern: (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immRemP2n>>:$imm)
03188       // Emits: (SUBQ:i64 (SL:i64 GPRC:i64:$RA, (nearP2X:i64 (imm:i64)<<P:Predicate_immRemP2n>>:$imm)), (SLi:i64 GPRC:i64:$RA, (nearP2RemX:i64 (imm:i64)<<P:Predicate_immRemP2n>>:$imm)))
03189       // Pattern complexity = 5  cost = 3
03190       if (Predicate_immRemP2n(N1.Val)) {
03191         Emit_48(Result, N, Alpha::SL, Alpha::SLi, Alpha::SUBQ, MVT::i64, MVT::i64, MVT::i64, N0, N1);
03192         return;
03193       }
03194     }
03195   }
03196 
03197   // Pattern: (mul:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03198   // Emits: (MULQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03199   // Pattern complexity = 2  cost = 1
03200   Emit_9(Result, N, Alpha::MULQ, MVT::i64, N0, N1);
03201   return;
03202 }
03203 
03204 void Emit_49(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, unsigned Opc2, unsigned Opc3, unsigned Opc4, MVT::ValueType VT0, MVT::ValueType VT1, MVT::ValueType VT2, MVT::ValueType VT3, MVT::ValueType VT4, SDOperand &N0, SDOperand &N1) NOINLINE {
03205   SDOperand Tmp0(0, 0);
03206   SDOperand Tmp1(0, 0);
03207   SDOperand Tmp2(0, 0);
03208   SDOperand Tmp3(0, 0);
03209   SDOperand Tmp4(0, 0);
03210   SDOperand Tmp5(0, 0);
03211   SDOperand Tmp6(0, 0);
03212   SDOperand Tmp7(0, 0);
03213   SDNode *ResNode = NULL;
03214   N0 = N.getOperand(0);
03215   N1 = N.getOperand(1);
03216   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
03217   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03218   Select(Tmp0, N0);
03219   Select(Tmp1, N1);
03220   Tmp2 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1), 0);
03221   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp1.Val);
03222   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp0.Val);
03223   Tmp3 = CurDAG->getRegister(Alpha::R31, MVT::i64);
03224   Tmp4 = SDOperand(CurDAG->getTargetNode(Opc1, VT1, Tmp1, Tmp3, Tmp0), 0);
03225   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp0.Val);
03226   SelectionDAG::InsertInFlightSetEntry(InFlightSet, Tmp1.Val);
03227   Tmp5 = CurDAG->getRegister(Alpha::R31, MVT::i64);
03228   Tmp6 = SDOperand(CurDAG->getTargetNode(Opc2, VT2, Tmp0, Tmp5, Tmp1), 0);
03229   Tmp7 = SDOperand(CurDAG->getTargetNode(Opc3, VT3, Tmp4, Tmp6), 0);
03230   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
03231   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03232   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp1.Val);
03233   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp0.Val);
03234   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp0.Val);
03235   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, Tmp1.Val);
03236   if (N.Val->hasOneUse()) {
03237     Result = CurDAG->SelectNodeTo(N.Val, Opc4, VT4, Tmp2, Tmp7);
03238   } else {
03239     ResNode = CurDAG->getTargetNode(Opc4, VT4, Tmp2, Tmp7);
03240     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03241     Result = SDOperand(ResNode, 0);
03242   }
03243   return;
03244 }
03245 void Select_mulhs(SDOperand &Result, SDOperand N) {
03246   SDOperand N0(0, 0);
03247   SDOperand N1(0, 0);
03248   SDOperand Tmp0(0, 0);
03249   SDOperand Tmp1(0, 0);
03250   SDOperand Tmp2(0, 0);
03251   SDOperand Tmp3(0, 0);
03252   SDOperand Tmp4(0, 0);
03253   SDOperand Tmp5(0, 0);
03254   SDOperand Tmp6(0, 0);
03255   SDOperand Tmp7(0, 0);
03256   SDNode *ResNode = NULL;
03257   Emit_49(Result, N, Alpha::UMULH, Alpha::CMOVGE, Alpha::CMOVGE, Alpha::ADDQ, Alpha::SUBQ, MVT::i64, MVT::i64, MVT::i64, MVT::i64, MVT::i64, N0, N1);
03258   return;
03259 }
03260 
03261 void Select_mulhu(SDOperand &Result, SDOperand N) {
03262   SDOperand N0(0, 0);
03263   SDOperand N1(0, 0);
03264   SDOperand Tmp0(0, 0);
03265   SDOperand Tmp1(0, 0);
03266   SDNode *ResNode = NULL;
03267 
03268   // Pattern: (mulhu:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
03269   // Emits: (UMULHi:i64 GPRC:i64:$RA, (imm:i64):$L)
03270   // Pattern complexity = 5  cost = 1  size = 0
03271   {
03272     N0 = N.getOperand(0);
03273     N1 = N.getOperand(1);
03274     if (N1.getOpcode() == ISD::Constant &&
03275         Predicate_immUExt8(N1.Val)) {
03276       Emit_6(Result, N, Alpha::UMULHi, MVT::i64, N0, N1);
03277       return;
03278     }
03279   }
03280 
03281   // Pattern: (mulhu:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03282   // Emits: (UMULH:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03283   // Pattern complexity = 2  cost = 1
03284   Emit_9(Result, N, Alpha::UMULH, MVT::i64, N0, N1);
03285   return;
03286 }
03287 
03288 void Select_or(SDOperand &Result, SDOperand N) {
03289   SDOperand N0(0, 0);
03290   SDOperand N00(0, 0);
03291   SDOperand N01(0, 0);
03292   SDOperand N1(0, 0);
03293   SDOperand N10(0, 0);
03294   SDOperand N11(0, 0);
03295   SDOperand Tmp0(0, 0);
03296   SDOperand Tmp1(0, 0);
03297   SDOperand Tmp2(0, 0);
03298   SDNode *ResNode = NULL;
03299   {
03300     N0 = N.getOperand(0);
03301 
03302     // Pattern: (or:i64 GPRC:i64:$RA, (xor:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immAllOnes>>))
03303     // Emits: (ORNOT:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03304     // Pattern complexity = 7  cost = 1  size = 0
03305     {
03306       N1 = N.getOperand(1);
03307       if (N1.getOpcode() == ISD::XOR) {
03308         N10 = N1.getOperand(0);
03309         N11 = N1.getOperand(1);
03310         if (N11.getOpcode() == ISD::Constant &&
03311             Predicate_immAllOnes(N11.Val)) {
03312           Emit_12(Result, N, Alpha::ORNOT, MVT::i64, N0, N1, N10, N11);
03313           return;
03314         }
03315       }
03316     }
03317 
03318     // Pattern: (or:i64 (xor:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immAllOnes>>), GPRC:i64:$RA)
03319     // Emits: (ORNOT:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03320     // Pattern complexity = 7  cost = 1  size = 0
03321     if (N0.getOpcode() == ISD::XOR) {
03322       N00 = N0.getOperand(0);
03323       N01 = N0.getOperand(1);
03324       if (N01.getOpcode() == ISD::Constant &&
03325           Predicate_immAllOnes(N01.Val)) {
03326         Emit_13(Result, N, Alpha::ORNOT, MVT::i64, N0, N00, N01, N1);
03327         return;
03328       }
03329     }
03330     N1 = N.getOperand(1);
03331     if (N1.getOpcode() == ISD::Constant) {
03332 
03333       // Pattern: (or:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
03334       // Emits: (BISi:i64 GPRC:i64:$RA, (imm:i64):$L)
03335       // Pattern complexity = 5  cost = 1  size = 0
03336       if (Predicate_immUExt8(N1.Val)) {
03337         Emit_6(Result, N, Alpha::BISi, MVT::i64, N0, N1);
03338         return;
03339       }
03340 
03341       // Pattern: (or:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8inv>><<X:invX>>:$L)
03342       // Emits: (ORNOTi:i64 GPRC:i64:$RA, (invX:i64 (imm:i64):$L))
03343       // Pattern complexity = 5  cost = 1
03344       if (Predicate_immUExt8inv(N1.Val)) {
03345         Emit_14(Result, N, Alpha::ORNOTi, MVT::i64, N0, N1);
03346         return;
03347       }
03348     }
03349   }
03350 
03351   // Pattern: (or:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03352   // Emits: (BIS:i64 GPRC:i64:$RA, GPRC:i64:$RB)
03353   // Pattern complexity = 2  cost = 1
03354   Emit_9(Result, N, Alpha::BIS, MVT::i64, N0, N1);
03355   return;
03356 }
03357 
03358 void Emit_50(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, bool HasInFlag) NOINLINE {
03359   SDOperand InFlag(0, 0);
03360   SDNode *ResNode = NULL;
03361   Chain = N.getOperand(0);
03362   HasInFlag = (N.getOperand(N.getNumOperands()-1).getValueType() == MVT::Flag);
03363   Select(Chain, Chain);
03364   if (HasInFlag)
03365     Select(InFlag, N.getOperand(N.getNumOperands()-1));
03366   ResNode = HasInFlag ? CurDAG->getTargetNode(Opc0, MVT::Other, Chain, InFlag) : CurDAG->getTargetNode(Opc0, MVT::Other, Chain);
03367   Chain = SDOperand(ResNode, 0);
03368   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
03369   Result = SDOperand(ResNode, N.ResNo);
03370   return;
03371 }
03372 void Select_retflag(SDOperand &Result, SDOperand N) {
03373   SDOperand Chain(0, 0);
03374   SDOperand InFlag(0, 0);
03375   SDNode *ResNode = NULL;
03376   bool HasInFlag = false;
03377   Emit_50(Result, N, Alpha::RETDAGp, Chain, HasInFlag);
03378   return;
03379 }
03380 
03381 void Emit_51(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N02, SDOperand &N1, SDOperand &N2) NOINLINE {
03382   SDOperand Tmp1(0, 0);
03383   SDOperand Tmp2(0, 0);
03384   SDOperand Tmp3(0, 0);
03385   SDNode *ResNode = NULL;
03386   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03387   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
03388   Select(Tmp1, N1);
03389   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N2)->getValue()), MVT::i64);
03390   Select(Tmp3, N00);
03391   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03392   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
03393   if (N.Val->hasOneUse()) {
03394     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2, Tmp3);
03395   } else {
03396     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2, Tmp3);
03397     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03398     Result = SDOperand(ResNode, 0);
03399   }
03400   return;
03401 }
03402 void Emit_52(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N2) NOINLINE {
03403   SDOperand Tmp1(0, 0);
03404   SDOperand Tmp2(0, 0);
03405   SDOperand Tmp3(0, 0);
03406   SDNode *ResNode = NULL;
03407   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03408   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
03409   Select(Tmp1, N1);
03410   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N2)->getValue()), MVT::i64);
03411   Select(Tmp3, N00);
03412   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03413   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
03414   if (N.Val->hasOneUse()) {
03415     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2, Tmp3);
03416   } else {
03417     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2, Tmp3);
03418     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03419     Result = SDOperand(ResNode, 0);
03420   }
03421   return;
03422 }
03423 void Emit_53(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N2) NOINLINE {
03424   SDOperand Tmp1(0, 0);
03425   SDOperand Tmp2(0, 0);
03426   SDOperand Tmp3(0, 0);
03427   SDNode *ResNode = NULL;
03428   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03429   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
03430   Select(Tmp1, N1);
03431   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N2)->getValue()), MVT::i64);
03432   Select(Tmp3, N01);
03433   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03434   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
03435   if (N.Val->hasOneUse()) {
03436     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2, Tmp3);
03437   } else {
03438     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2, Tmp3);
03439     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03440     Result = SDOperand(ResNode, 0);
03441   }
03442   return;
03443 }
03444 void Emit_54(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N2) NOINLINE {
03445   SDOperand Tmp1(0, 0);
03446   SDOperand Tmp2(0, 0);
03447   SDOperand Tmp3(0, 0);
03448   SDNode *ResNode = NULL;
03449   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
03450   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03451   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
03452   Select(Tmp1, N2);
03453   Select(Tmp2, N1);
03454   Select(Tmp3, N00);
03455   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
03456   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03457   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
03458   if (N.Val->hasOneUse()) {
03459     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2, Tmp3);
03460   } else {
03461     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2, Tmp3);
03462     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03463     Result = SDOperand(ResNode, 0);
03464   }
03465   return;
03466 }
03467 void Emit_55(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N02, SDOperand &N1, SDOperand &N2) NOINLINE {
03468   SDOperand Tmp1(0, 0);
03469   SDOperand Tmp2(0, 0);
03470   SDOperand Tmp3(0, 0);
03471   SDNode *ResNode = NULL;
03472   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
03473   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03474   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
03475   Select(Tmp1, N2);
03476   Select(Tmp2, N1);
03477   Select(Tmp3, N00);
03478   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
03479   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03480   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
03481   if (N.Val->hasOneUse()) {
03482     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2, Tmp3);
03483   } else {
03484     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2, Tmp3);
03485     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03486     Result = SDOperand(ResNode, 0);
03487   }
03488   return;
03489 }
03490 void Emit_56(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N2) NOINLINE {
03491   SDOperand Tmp1(0, 0);
03492   SDOperand Tmp2(0, 0);
03493   SDOperand Tmp3(0, 0);
03494   SDNode *ResNode = NULL;
03495   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
03496   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03497   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
03498   Select(Tmp1, N2);
03499   Select(Tmp2, N1);
03500   Select(Tmp3, N01);
03501   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
03502   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03503   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
03504   if (N.Val->hasOneUse()) {
03505     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2, Tmp3);
03506   } else {
03507     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2, Tmp3);
03508     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03509     Result = SDOperand(ResNode, 0);
03510   }
03511   return;
03512 }
03513 void Emit_57(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
03514   SDOperand Tmp0(0, 0);
03515   SDOperand Tmp1(0, 0);
03516   SDOperand Tmp2(0, 0);
03517   SDNode *ResNode = NULL;
03518   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03519   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
03520   Select(Tmp0, N1);
03521   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N2)->getValue()), MVT::i64);
03522   Select(Tmp2, N0);
03523   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03524   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
03525   if (N.Val->hasOneUse()) {
03526     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1, Tmp2);
03527   } else {
03528     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1, Tmp2);
03529     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03530     Result = SDOperand(ResNode, 0);
03531   }
03532   return;
03533 }
03534 void Emit_58(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N02, SDOperand &N1, SDOperand &N2) NOINLINE {
03535   SDOperand Tmp0(0, 0);
03536   SDOperand Tmp1(0, 0);
03537   SDOperand Tmp2(0, 0);
03538   SDOperand Tmp3(0, 0);
03539   SDOperand Tmp4(0, 0);
03540   SDNode *ResNode = NULL;
03541   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
03542   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03543   Select(Tmp0, N2);
03544   Select(Tmp1, N1);
03545   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
03546   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
03547   Select(Tmp2, N00);
03548   Select(Tmp3, N01);
03549   Tmp4 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3), 0);
03550   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
03551   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03552   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
03553   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
03554   if (N.Val->hasOneUse()) {
03555     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp0, Tmp1, Tmp4);
03556   } else {
03557     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp0, Tmp1, Tmp4);
03558     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03559     Result = SDOperand(ResNode, 0);
03560   }
03561   return;
03562 }
03563 void Emit_59(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N02, SDOperand &N1, SDOperand &N2) NOINLINE {
03564   SDOperand Tmp0(0, 0);
03565   SDOperand Tmp1(0, 0);
03566   SDOperand Tmp2(0, 0);
03567   SDOperand Tmp3(0, 0);
03568   SDOperand Tmp4(0, 0);
03569   SDNode *ResNode = NULL;
03570   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
03571   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03572   Select(Tmp0, N2);
03573   Select(Tmp1, N1);
03574   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
03575   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
03576   Select(Tmp2, N01);
03577   Select(Tmp3, N00);
03578   Tmp4 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3), 0);
03579   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
03580   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03581   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
03582   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
03583   if (N.Val->hasOneUse()) {
03584     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp0, Tmp1, Tmp4);
03585   } else {
03586     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp0, Tmp1, Tmp4);
03587     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03588     Result = SDOperand(ResNode, 0);
03589   }
03590   return;
03591 }
03592 void Emit_60(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
03593   SDOperand Tmp0(0, 0);
03594   SDOperand Tmp1(0, 0);
03595   SDOperand Tmp2(0, 0);
03596   SDNode *ResNode = NULL;
03597   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
03598   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03599   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
03600   Select(Tmp0, N2);
03601   Select(Tmp1, N1);
03602   Select(Tmp2, N0);
03603   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
03604   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03605   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
03606   if (N.Val->hasOneUse()) {
03607     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1, Tmp2);
03608   } else {
03609     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1, Tmp2);
03610     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03611     Result = SDOperand(ResNode, 0);
03612   }
03613   return;
03614 }
03615 void Emit_61(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
03616   SDOperand Tmp0(0, 0);
03617   SDOperand Tmp1(0, 0);
03618   SDOperand Tmp2(0, 0);
03619   SDNode *ResNode = NULL;
03620   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
03621   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
03622   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
03623   Select(Tmp0, N1);
03624   Select(Tmp1, N2);
03625   Select(Tmp2, N0);
03626   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
03627   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
03628   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
03629   if (N.Val->hasOneUse()) {
03630     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1, Tmp2);
03631   } else {
03632     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1, Tmp2);
03633     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
03634     Result = SDOperand(ResNode, 0);
03635   }
03636   return;
03637 }
03638 void Select_select(SDOperand &Result, SDOperand N) {
03639   SDOperand N0(0, 0);
03640   SDOperand N00(0, 0);
03641   SDOperand N01(0, 0);
03642   SDOperand N02(0, 0);
03643   SDOperand N1(0, 0);
03644   SDOperand N2(0, 0);
03645   SDOperand Tmp0(0, 0);
03646   SDOperand Tmp1(0, 0);
03647   SDOperand Tmp2(0, 0);
03648   SDOperand Tmp3(0, 0);
03649   SDOperand Tmp4(0, 0);
03650   SDNode *ResNode = NULL;
03651   N0 = N.getOperand(0);
03652   if (N0.getOpcode() == ISD::SETCC) {
03653     N00 = N0.getOperand(0);
03654     N01 = N0.getOperand(1);
03655     if (isa<ConstantSDNode>(N01)) {
03656       int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
03657       if (CN0 == 0) {
03658         N02 = N0.getOperand(2);
03659 
03660         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETNE:Other), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03661         // Emits: (CMOVEQi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03662         // Pattern complexity = 10  cost = 1  size = 0
03663         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETNE) {
03664           N1 = N.getOperand(1);
03665           N2 = N.getOperand(2);
03666           if (N2.getOpcode() == ISD::Constant &&
03667               Predicate_immUExt8(N2.Val) &&
03668               N00.Val->getValueType(0) == MVT::i64) {
03669             Emit_51(Result, N, Alpha::CMOVEQi, MVT::i64, N0, N00, N01, N02, N1, N2);
03670             return;
03671           }
03672         }
03673 
03674         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETLT:Other), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03675         // Emits: (CMOVGEi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03676         // Pattern complexity = 10  cost = 1  size = 0
03677         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLT) {
03678           N1 = N.getOperand(1);
03679           N2 = N.getOperand(2);
03680           if (N2.getOpcode() == ISD::Constant &&
03681               Predicate_immUExt8(N2.Val) &&
03682               N00.Val->getValueType(0) == MVT::i64) {
03683             Emit_51(Result, N, Alpha::CMOVGEi, MVT::i64, N0, N00, N01, N02, N1, N2);
03684             return;
03685           }
03686         }
03687 
03688         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETLE:Other), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03689         // Emits: (CMOVGTi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03690         // Pattern complexity = 10  cost = 1  size = 0
03691         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLE) {
03692           N1 = N.getOperand(1);
03693           N2 = N.getOperand(2);
03694           if (N2.getOpcode() == ISD::Constant &&
03695               Predicate_immUExt8(N2.Val) &&
03696               N00.Val->getValueType(0) == MVT::i64) {
03697             Emit_51(Result, N, Alpha::CMOVGTi, MVT::i64, N0, N00, N01, N02, N1, N2);
03698             return;
03699           }
03700         }
03701 
03702         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETGT:Other), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03703         // Emits: (CMOVLEi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03704         // Pattern complexity = 10  cost = 1  size = 0
03705         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGT) {
03706           N1 = N.getOperand(1);
03707           N2 = N.getOperand(2);
03708           if (N2.getOpcode() == ISD::Constant &&
03709               Predicate_immUExt8(N2.Val) &&
03710               N00.Val->getValueType(0) == MVT::i64) {
03711             Emit_51(Result, N, Alpha::CMOVLEi, MVT::i64, N0, N00, N01, N02, N1, N2);
03712             return;
03713           }
03714         }
03715 
03716         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETGE:Other), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03717         // Emits: (CMOVLTi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03718         // Pattern complexity = 10  cost = 1  size = 0
03719         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGE) {
03720           N1 = N.getOperand(1);
03721           N2 = N.getOperand(2);
03722           if (N2.getOpcode() == ISD::Constant &&
03723               Predicate_immUExt8(N2.Val) &&
03724               N00.Val->getValueType(0) == MVT::i64) {
03725             Emit_51(Result, N, Alpha::CMOVLTi, MVT::i64, N0, N00, N01, N02, N1, N2);
03726             return;
03727           }
03728         }
03729 
03730         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETEQ:Other), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03731         // Emits: (CMOVNEi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03732         // Pattern complexity = 10  cost = 1
03733         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETEQ) {
03734           N1 = N.getOperand(1);
03735           N2 = N.getOperand(2);
03736           if (N2.getOpcode() == ISD::Constant &&
03737               Predicate_immUExt8(N2.Val) &&
03738               N00.Val->getValueType(0) == MVT::i64) {
03739             Emit_51(Result, N, Alpha::CMOVNEi, MVT::i64, N0, N00, N01, N02, N1, N2);
03740             return;
03741           }
03742         }
03743       }
03744     }
03745   }
03746 
03747   // Pattern: (select:i64 (and:i64 GPRC:i64:$RCOND, 1:i64), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03748   // Emits: (CMOVLBCi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03749   // Pattern complexity = 10  cost = 1  size = 0
03750   if (N0.getOpcode() == ISD::AND) {
03751     N00 = N0.getOperand(0);
03752     N01 = N0.getOperand(1);
03753     if (isa<ConstantSDNode>(N01)) {
03754       int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
03755       if (CN0 == 1) {
03756         N1 = N.getOperand(1);
03757         N2 = N.getOperand(2);
03758         if (N2.getOpcode() == ISD::Constant &&
03759             Predicate_immUExt8(N2.Val)) {
03760           Emit_52(Result, N, Alpha::CMOVLBCi, MVT::i64, N0, N00, N01, N1, N2);
03761           return;
03762         }
03763       }
03764     }
03765   }
03766 
03767   // Pattern: (select:i64 (xor:i64 GPRC:i64:$RCOND, 1:i64), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03768   // Emits: (CMOVLBSi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03769   // Pattern complexity = 10  cost = 1  size = 0
03770   if (N0.getOpcode() == ISD::XOR) {
03771     N00 = N0.getOperand(0);
03772     N01 = N0.getOperand(1);
03773     if (isa<ConstantSDNode>(N01)) {
03774       int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
03775       if (CN0 == 1) {
03776         N1 = N.getOperand(1);
03777         N2 = N.getOperand(2);
03778         if (N2.getOpcode() == ISD::Constant &&
03779             Predicate_immUExt8(N2.Val)) {
03780           Emit_52(Result, N, Alpha::CMOVLBSi, MVT::i64, N0, N00, N01, N1, N2);
03781           return;
03782         }
03783       }
03784     }
03785   }
03786 
03787   // Pattern: (select:i64 (and:i64 1:i64, GPRC:i64:$RCOND), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03788   // Emits: (CMOVLBCi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03789   // Pattern complexity = 10  cost = 1  size = 0
03790   if (N0.getOpcode() == ISD::AND) {
03791     N00 = N0.getOperand(0);
03792     if (isa<ConstantSDNode>(N00)) {
03793       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
03794       if (CN0 == 1) {
03795         N01 = N0.getOperand(1);
03796         N1 = N.getOperand(1);
03797         N2 = N.getOperand(2);
03798         if (N2.getOpcode() == ISD::Constant &&
03799             Predicate_immUExt8(N2.Val)) {
03800           Emit_53(Result, N, Alpha::CMOVLBCi, MVT::i64, N0, N00, N01, N1, N2);
03801           return;
03802         }
03803       }
03804     }
03805   }
03806   if (N0.getOpcode() == ISD::XOR) {
03807     N00 = N0.getOperand(0);
03808 
03809     // Pattern: (select:i64 (xor:i64 1:i64, GPRC:i64:$RCOND), GPRC:i64:$RFALSE, (imm:i64)<<P:Predicate_immUExt8>>:$RTRUE)
03810     // Emits: (CMOVLBSi:i64 GPRC:i64:$RFALSE, (imm:i64):$RTRUE, GPRC:i64:$RCOND)
03811     // Pattern complexity = 10  cost = 1  size = 0
03812     if (isa<ConstantSDNode>(N00)) {
03813       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
03814       if (CN0 == 1) {
03815         N01 = N0.getOperand(1);
03816         N1 = N.getOperand(1);
03817         N2 = N.getOperand(2);
03818         if (N2.getOpcode() == ISD::Constant &&
03819             Predicate_immUExt8(N2.Val)) {
03820           Emit_53(Result, N, Alpha::CMOVLBSi, MVT::i64, N0, N00, N01, N1, N2);
03821           return;
03822         }
03823       }
03824     }
03825 
03826     // Pattern: (select:i64 (xor:i64 GPRC:i64:$RCOND, 1:i64), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03827     // Emits: (CMOVLBC:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03828     // Pattern complexity = 7  cost = 1
03829     N01 = N0.getOperand(1);
03830     if (isa<ConstantSDNode>(N01)) {
03831       int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
03832       if (CN0 == 1) {
03833         N1 = N.getOperand(1);
03834         N2 = N.getOperand(2);
03835         if (N.Val->getValueType(0) == MVT::i64) {
03836           Emit_54(Result, N, Alpha::CMOVLBC, MVT::i64, N0, N00, N01, N1, N2);
03837           return;
03838         }
03839       }
03840     }
03841   }
03842 
03843   // Pattern: (select:i64 (and:i64 GPRC:i64:$RCOND, 1:i64), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03844   // Emits: (CMOVLBS:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03845   // Pattern complexity = 7  cost = 1  size = 0
03846   if (N0.getOpcode() == ISD::AND) {
03847     N00 = N0.getOperand(0);
03848     N01 = N0.getOperand(1);
03849     if (isa<ConstantSDNode>(N01)) {
03850       int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
03851       if (CN0 == 1) {
03852         N1 = N.getOperand(1);
03853         N2 = N.getOperand(2);
03854         if (N.Val->getValueType(0) == MVT::i64) {
03855           Emit_54(Result, N, Alpha::CMOVLBS, MVT::i64, N0, N00, N01, N1, N2);
03856           return;
03857         }
03858       }
03859     }
03860   }
03861   if (N0.getOpcode() == ISD::SETCC) {
03862     N00 = N0.getOperand(0);
03863     N01 = N0.getOperand(1);
03864     if (isa<ConstantSDNode>(N01)) {
03865       int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
03866       if (CN0 == 0) {
03867         N02 = N0.getOperand(2);
03868 
03869         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETEQ:Other), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03870         // Emits: (CMOVEQ:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03871         // Pattern complexity = 7  cost = 1  size = 0
03872         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETEQ) {
03873           N1 = N.getOperand(1);
03874           N2 = N.getOperand(2);
03875           if (N.Val->getValueType(0) == MVT::i64 &&
03876               N00.Val->getValueType(0) == MVT::i64) {
03877             Emit_55(Result, N, Alpha::CMOVEQ, MVT::i64, N0, N00, N01, N02, N1, N2);
03878             return;
03879           }
03880         }
03881 
03882         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETGE:Other), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03883         // Emits: (CMOVGE:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03884         // Pattern complexity = 7  cost = 1  size = 0
03885         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGE) {
03886           N1 = N.getOperand(1);
03887           N2 = N.getOperand(2);
03888           if (N.Val->getValueType(0) == MVT::i64 &&
03889               N00.Val->getValueType(0) == MVT::i64) {
03890             Emit_55(Result, N, Alpha::CMOVGE, MVT::i64, N0, N00, N01, N02, N1, N2);
03891             return;
03892           }
03893         }
03894 
03895         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETGT:Other), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03896         // Emits: (CMOVGT:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03897         // Pattern complexity = 7  cost = 1  size = 0
03898         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGT) {
03899           N1 = N.getOperand(1);
03900           N2 = N.getOperand(2);
03901           if (N.Val->getValueType(0) == MVT::i64 &&
03902               N00.Val->getValueType(0) == MVT::i64) {
03903             Emit_55(Result, N, Alpha::CMOVGT, MVT::i64, N0, N00, N01, N02, N1, N2);
03904             return;
03905           }
03906         }
03907 
03908         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETLE:Other), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03909         // Emits: (CMOVLE:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03910         // Pattern complexity = 7  cost = 1  size = 0
03911         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLE) {
03912           N1 = N.getOperand(1);
03913           N2 = N.getOperand(2);
03914           if (N.Val->getValueType(0) == MVT::i64 &&
03915               N00.Val->getValueType(0) == MVT::i64) {
03916             Emit_55(Result, N, Alpha::CMOVLE, MVT::i64, N0, N00, N01, N02, N1, N2);
03917             return;
03918           }
03919         }
03920 
03921         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETLT:Other), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03922         // Emits: (CMOVLT:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03923         // Pattern complexity = 7  cost = 1  size = 0
03924         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLT) {
03925           N1 = N.getOperand(1);
03926           N2 = N.getOperand(2);
03927           if (N.Val->getValueType(0) == MVT::i64 &&
03928               N00.Val->getValueType(0) == MVT::i64) {
03929             Emit_55(Result, N, Alpha::CMOVLT, MVT::i64, N0, N00, N01, N02, N1, N2);
03930             return;
03931           }
03932         }
03933 
03934         // Pattern: (select:i64 (setcc:i64 GPRC:i64:$RCOND, 0:i64, SETNE:Other), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03935         // Emits: (CMOVNE:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03936         // Pattern complexity = 7  cost = 1
03937         if (cast<CondCodeSDNode>(N02)->get() == ISD::SETNE) {
03938           N1 = N.getOperand(1);
03939           N2 = N.getOperand(2);
03940           if (N.Val->getValueType(0) == MVT::i64 &&
03941               N00.Val->getValueType(0) == MVT::i64) {
03942             Emit_55(Result, N, Alpha::CMOVNE, MVT::i64, N0, N00, N01, N02, N1, N2);
03943             return;
03944           }
03945         }
03946       }
03947     }
03948   }
03949 
03950   // Pattern: (select:i64 (xor:i64 1:i64, GPRC:i64:$RCOND), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03951   // Emits: (CMOVLBC:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03952   // Pattern complexity = 7  cost = 1  size = 0
03953   if (N0.getOpcode() == ISD::XOR) {
03954     N00 = N0.getOperand(0);
03955     if (isa<ConstantSDNode>(N00)) {
03956       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
03957       if (CN0 == 1) {
03958         N01 = N0.getOperand(1);
03959         N1 = N.getOperand(1);
03960         N2 = N.getOperand(2);
03961         if (N.Val->getValueType(0) == MVT::i64) {
03962           Emit_56(Result, N, Alpha::CMOVLBC, MVT::i64, N0, N00, N01, N1, N2);
03963           return;
03964         }
03965       }
03966     }
03967   }
03968 
03969   // Pattern: (select:i64 (and:i64 1:i64, GPRC:i64:$RCOND), GPRC:i64:$RTRUE, GPRC:i64:$RFALSE)
03970   // Emits: (CMOVLBS:i64 GPRC:i64:$RFALSE, GPRC:i64:$RTRUE, GPRC:i64:$RCOND)
03971   // Pattern complexity = 7  cost = 1  size = 0
03972   if (N0.getOpcode() == ISD::AND) {
03973     N00 = N0.getOperand(0);
03974     if (isa<ConstantSDNode>(N00)) {
03975       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
03976       if (CN0 == 1) {
03977         N01 = N0.getOperand(1);
03978         N1 = N.getOperand(1);
03979         N2 = N.getOperand(2);
03980         if (N.Val->getValueType(0) == MVT::i64) {
03981           Emit_56(Result, N, Alpha::CMOVLBS, MVT::i64, N0, N00, N01, N1, N2);
03982           return;
03983         }
03984       }
03985     }
03986   }
03987 
03988   // Pattern: (select:i64 GPRC:i64:$which, GPRC:i64:$src1, (imm:i64)<<P:Predicate_immUExt8>>:$src2)
03989   // Emits: (CMOVEQi:i64 GPRC:i64:$src1, (imm:i64)<<P:Predicate_immUExt8>>:$src2, GPRC:i64:$which)
03990   // Pattern complexity = 5  cost = 1  size = 0
03991   {
03992     N1 = N.getOperand(1);
03993     N2 = N.getOperand(2);
03994     if (N2.getOpcode() == ISD::Constant &&
03995         Predicate_immUExt8(N2.Val)) {
03996       Emit_57(Result, N, Alpha::CMOVEQi, MVT::i64, N0, N1, N2);
03997       return;
03998     }
03999   }
04000   if (N0.getOpcode() == ISD::SETCC) {
04001     N00 = N0.getOperand(0);
04002     N01 = N0.getOperand(1);
04003     N02 = N0.getOperand(2);
04004 
04005     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETEQ:Other), F8RC:f64:$st, F8RC:f64:$sf)
04006     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04007     // Pattern complexity = 4  cost = 2  size = 0
04008     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETEQ) {
04009       N1 = N.getOperand(1);
04010       N2 = N.getOperand(2);
04011       if (N.Val->getValueType(0) == MVT::f64 &&
04012           N00.Val->getValueType(0) == MVT::f64) {
04013         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04014         return;
04015       }
04016     }
04017 
04018     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOEQ:Other), F8RC:f64:$st, F8RC:f64:$sf)
04019     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04020     // Pattern complexity = 4  cost = 2  size = 0
04021     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOEQ) {
04022       N1 = N.getOperand(1);
04023       N2 = N.getOperand(2);
04024       if (N.Val->getValueType(0) == MVT::f64 &&
04025           N00.Val->getValueType(0) == MVT::f64) {
04026         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04027         return;
04028       }
04029     }
04030 
04031     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUEQ:Other), F8RC:f64:$st, F8RC:f64:$sf)
04032     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04033     // Pattern complexity = 4  cost = 2  size = 0
04034     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUEQ) {
04035       N1 = N.getOperand(1);
04036       N2 = N.getOperand(2);
04037       if (N.Val->getValueType(0) == MVT::f64 &&
04038           N00.Val->getValueType(0) == MVT::f64) {
04039         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04040         return;
04041       }
04042     }
04043 
04044     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETNE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04045     // Emits: (FCMOVEQT:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04046     // Pattern complexity = 4  cost = 2  size = 0
04047     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETNE) {
04048       N1 = N.getOperand(1);
04049       N2 = N.getOperand(2);
04050       if (N.Val->getValueType(0) == MVT::f64 &&
04051           N00.Val->getValueType(0) == MVT::f64) {
04052         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVEQT, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04053         return;
04054       }
04055     }
04056 
04057     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETONE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04058     // Emits: (FCMOVEQT:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04059     // Pattern complexity = 4  cost = 2  size = 0
04060     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETONE) {
04061       N1 = N.getOperand(1);
04062       N2 = N.getOperand(2);
04063       if (N.Val->getValueType(0) == MVT::f64 &&
04064           N00.Val->getValueType(0) == MVT::f64) {
04065         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVEQT, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04066         return;
04067       }
04068     }
04069 
04070     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUNE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04071     // Emits: (FCMOVEQT:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04072     // Pattern complexity = 4  cost = 2  size = 0
04073     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUNE) {
04074       N1 = N.getOperand(1);
04075       N2 = N.getOperand(2);
04076       if (N.Val->getValueType(0) == MVT::f64 &&
04077           N00.Val->getValueType(0) == MVT::f64) {
04078         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVEQT, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04079         return;
04080       }
04081     }
04082 
04083     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETGT:Other), F8RC:f64:$st, F8RC:f64:$sf)
04084     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04085     // Pattern complexity = 4  cost = 2  size = 0
04086     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGT) {
04087       N1 = N.getOperand(1);
04088       N2 = N.getOperand(2);
04089       if (N.Val->getValueType(0) == MVT::f64 &&
04090           N00.Val->getValueType(0) == MVT::f64) {
04091         Emit_59(Result, N, Alpha::CMPTLT, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04092         return;
04093       }
04094     }
04095 
04096     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOGT:Other), F8RC:f64:$st, F8RC:f64:$sf)
04097     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04098     // Pattern complexity = 4  cost = 2  size = 0
04099     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOGT) {
04100       N1 = N.getOperand(1);
04101       N2 = N.getOperand(2);
04102       if (N.Val->getValueType(0) == MVT::f64 &&
04103           N00.Val->getValueType(0) == MVT::f64) {
04104         Emit_59(Result, N, Alpha::CMPTLT, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04105         return;
04106       }
04107     }
04108 
04109     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUGT:Other), F8RC:f64:$st, F8RC:f64:$sf)
04110     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04111     // Pattern complexity = 4  cost = 2  size = 0
04112     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUGT) {
04113       N1 = N.getOperand(1);
04114       N2 = N.getOperand(2);
04115       if (N.Val->getValueType(0) == MVT::f64 &&
04116           N00.Val->getValueType(0) == MVT::f64) {
04117         Emit_59(Result, N, Alpha::CMPTLT, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04118         return;
04119       }
04120     }
04121 
04122     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETGE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04123     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04124     // Pattern complexity = 4  cost = 2  size = 0
04125     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGE) {
04126       N1 = N.getOperand(1);
04127       N2 = N.getOperand(2);
04128       if (N.Val->getValueType(0) == MVT::f64 &&
04129           N00.Val->getValueType(0) == MVT::f64) {
04130         Emit_59(Result, N, Alpha::CMPTLE, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04131         return;
04132       }
04133     }
04134 
04135     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOGE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04136     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04137     // Pattern complexity = 4  cost = 2  size = 0
04138     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOGE) {
04139       N1 = N.getOperand(1);
04140       N2 = N.getOperand(2);
04141       if (N.Val->getValueType(0) == MVT::f64 &&
04142           N00.Val->getValueType(0) == MVT::f64) {
04143         Emit_59(Result, N, Alpha::CMPTLE, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04144         return;
04145       }
04146     }
04147 
04148     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUGE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04149     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04150     // Pattern complexity = 4  cost = 2  size = 0
04151     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUGE) {
04152       N1 = N.getOperand(1);
04153       N2 = N.getOperand(2);
04154       if (N.Val->getValueType(0) == MVT::f64 &&
04155           N00.Val->getValueType(0) == MVT::f64) {
04156         Emit_59(Result, N, Alpha::CMPTLE, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04157         return;
04158       }
04159     }
04160 
04161     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETLT:Other), F8RC:f64:$st, F8RC:f64:$sf)
04162     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04163     // Pattern complexity = 4  cost = 2  size = 0
04164     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLT) {
04165       N1 = N.getOperand(1);
04166       N2 = N.getOperand(2);
04167       if (N.Val->getValueType(0) == MVT::f64 &&
04168           N00.Val->getValueType(0) == MVT::f64) {
04169         Emit_58(Result, N, Alpha::CMPTLT, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04170         return;
04171       }
04172     }
04173 
04174     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOLT:Other), F8RC:f64:$st, F8RC:f64:$sf)
04175     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04176     // Pattern complexity = 4  cost = 2  size = 0
04177     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOLT) {
04178       N1 = N.getOperand(1);
04179       N2 = N.getOperand(2);
04180       if (N.Val->getValueType(0) == MVT::f64 &&
04181           N00.Val->getValueType(0) == MVT::f64) {
04182         Emit_58(Result, N, Alpha::CMPTLT, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04183         return;
04184       }
04185     }
04186 
04187     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETULT:Other), F8RC:f64:$st, F8RC:f64:$sf)
04188     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04189     // Pattern complexity = 4  cost = 2  size = 0
04190     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETULT) {
04191       N1 = N.getOperand(1);
04192       N2 = N.getOperand(2);
04193       if (N.Val->getValueType(0) == MVT::f64 &&
04194           N00.Val->getValueType(0) == MVT::f64) {
04195         Emit_58(Result, N, Alpha::CMPTLT, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04196         return;
04197       }
04198     }
04199 
04200     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETLE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04201     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04202     // Pattern complexity = 4  cost = 2  size = 0
04203     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLE) {
04204       N1 = N.getOperand(1);
04205       N2 = N.getOperand(2);
04206       if (N.Val->getValueType(0) == MVT::f64 &&
04207           N00.Val->getValueType(0) == MVT::f64) {
04208         Emit_58(Result, N, Alpha::CMPTLE, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04209         return;
04210       }
04211     }
04212 
04213     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOLE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04214     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04215     // Pattern complexity = 4  cost = 2  size = 0
04216     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOLE) {
04217       N1 = N.getOperand(1);
04218       N2 = N.getOperand(2);
04219       if (N.Val->getValueType(0) == MVT::f64 &&
04220           N00.Val->getValueType(0) == MVT::f64) {
04221         Emit_58(Result, N, Alpha::CMPTLE, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04222         return;
04223       }
04224     }
04225 
04226     // Pattern: (select:f64 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETULE:Other), F8RC:f64:$st, F8RC:f64:$sf)
04227     // Emits: (FCMOVNET:f64 F8RC:f64:$sf, F8RC:f64:$st, (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04228     // Pattern complexity = 4  cost = 2  size = 0
04229     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETULE) {
04230       N1 = N.getOperand(1);
04231       N2 = N.getOperand(2);
04232       if (N.Val->getValueType(0) == MVT::f64 &&
04233           N00.Val->getValueType(0) == MVT::f64) {
04234         Emit_58(Result, N, Alpha::CMPTLE, Alpha::FCMOVNET, MVT::f64, MVT::f64, N0, N00, N01, N02, N1, N2);
04235         return;
04236       }
04237     }
04238 
04239     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETEQ:Other), F4RC:f32:$st, F4RC:f32:$sf)
04240     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04241     // Pattern complexity = 4  cost = 2  size = 0
04242     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETEQ) {
04243       N1 = N.getOperand(1);
04244       N2 = N.getOperand(2);
04245       if (N.Val->getValueType(0) == MVT::f32 &&
04246           N00.Val->getValueType(0) == MVT::f64) {
04247         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04248         return;
04249       }
04250     }
04251 
04252     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOEQ:Other), F4RC:f32:$st, F4RC:f32:$sf)
04253     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04254     // Pattern complexity = 4  cost = 2  size = 0
04255     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOEQ) {
04256       N1 = N.getOperand(1);
04257       N2 = N.getOperand(2);
04258       if (N.Val->getValueType(0) == MVT::f32 &&
04259           N00.Val->getValueType(0) == MVT::f64) {
04260         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04261         return;
04262       }
04263     }
04264 
04265     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUEQ:Other), F4RC:f32:$st, F4RC:f32:$sf)
04266     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04267     // Pattern complexity = 4  cost = 2  size = 0
04268     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUEQ) {
04269       N1 = N.getOperand(1);
04270       N2 = N.getOperand(2);
04271       if (N.Val->getValueType(0) == MVT::f32 &&
04272           N00.Val->getValueType(0) == MVT::f64) {
04273         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04274         return;
04275       }
04276     }
04277 
04278     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETNE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04279     // Emits: (FCMOVEQS:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04280     // Pattern complexity = 4  cost = 2  size = 0
04281     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETNE) {
04282       N1 = N.getOperand(1);
04283       N2 = N.getOperand(2);
04284       if (N.Val->getValueType(0) == MVT::f32 &&
04285           N00.Val->getValueType(0) == MVT::f64) {
04286         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVEQS, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04287         return;
04288       }
04289     }
04290 
04291     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETONE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04292     // Emits: (FCMOVEQS:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04293     // Pattern complexity = 4  cost = 2  size = 0
04294     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETONE) {
04295       N1 = N.getOperand(1);
04296       N2 = N.getOperand(2);
04297       if (N.Val->getValueType(0) == MVT::f32 &&
04298           N00.Val->getValueType(0) == MVT::f64) {
04299         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVEQS, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04300         return;
04301       }
04302     }
04303 
04304     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUNE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04305     // Emits: (FCMOVEQS:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTEQ:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04306     // Pattern complexity = 4  cost = 2  size = 0
04307     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUNE) {
04308       N1 = N.getOperand(1);
04309       N2 = N.getOperand(2);
04310       if (N.Val->getValueType(0) == MVT::f32 &&
04311           N00.Val->getValueType(0) == MVT::f64) {
04312         Emit_58(Result, N, Alpha::CMPTEQ, Alpha::FCMOVEQS, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04313         return;
04314       }
04315     }
04316 
04317     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETGT:Other), F4RC:f32:$st, F4RC:f32:$sf)
04318     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04319     // Pattern complexity = 4  cost = 2  size = 0
04320     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGT) {
04321       N1 = N.getOperand(1);
04322       N2 = N.getOperand(2);
04323       if (N.Val->getValueType(0) == MVT::f32 &&
04324           N00.Val->getValueType(0) == MVT::f64) {
04325         Emit_59(Result, N, Alpha::CMPTLT, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04326         return;
04327       }
04328     }
04329 
04330     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOGT:Other), F4RC:f32:$st, F4RC:f32:$sf)
04331     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04332     // Pattern complexity = 4  cost = 2  size = 0
04333     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOGT) {
04334       N1 = N.getOperand(1);
04335       N2 = N.getOperand(2);
04336       if (N.Val->getValueType(0) == MVT::f32 &&
04337           N00.Val->getValueType(0) == MVT::f64) {
04338         Emit_59(Result, N, Alpha::CMPTLT, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04339         return;
04340       }
04341     }
04342 
04343     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUGT:Other), F4RC:f32:$st, F4RC:f32:$sf)
04344     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLT:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04345     // Pattern complexity = 4  cost = 2  size = 0
04346     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUGT) {
04347       N1 = N.getOperand(1);
04348       N2 = N.getOperand(2);
04349       if (N.Val->getValueType(0) == MVT::f32 &&
04350           N00.Val->getValueType(0) == MVT::f64) {
04351         Emit_59(Result, N, Alpha::CMPTLT, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04352         return;
04353       }
04354     }
04355 
04356     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETGE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04357     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04358     // Pattern complexity = 4  cost = 2  size = 0
04359     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETGE) {
04360       N1 = N.getOperand(1);
04361       N2 = N.getOperand(2);
04362       if (N.Val->getValueType(0) == MVT::f32 &&
04363           N00.Val->getValueType(0) == MVT::f64) {
04364         Emit_59(Result, N, Alpha::CMPTLE, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04365         return;
04366       }
04367     }
04368 
04369     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOGE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04370     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04371     // Pattern complexity = 4  cost = 2  size = 0
04372     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOGE) {
04373       N1 = N.getOperand(1);
04374       N2 = N.getOperand(2);
04375       if (N.Val->getValueType(0) == MVT::f32 &&
04376           N00.Val->getValueType(0) == MVT::f64) {
04377         Emit_59(Result, N, Alpha::CMPTLE, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04378         return;
04379       }
04380     }
04381 
04382     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETUGE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04383     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLE:f64 F8RC:f64:$RB, F8RC:f64:$RA))
04384     // Pattern complexity = 4  cost = 2  size = 0
04385     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETUGE) {
04386       N1 = N.getOperand(1);
04387       N2 = N.getOperand(2);
04388       if (N.Val->getValueType(0) == MVT::f32 &&
04389           N00.Val->getValueType(0) == MVT::f64) {
04390         Emit_59(Result, N, Alpha::CMPTLE, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04391         return;
04392       }
04393     }
04394 
04395     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETLT:Other), F4RC:f32:$st, F4RC:f32:$sf)
04396     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04397     // Pattern complexity = 4  cost = 2  size = 0
04398     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLT) {
04399       N1 = N.getOperand(1);
04400       N2 = N.getOperand(2);
04401       if (N.Val->getValueType(0) == MVT::f32 &&
04402           N00.Val->getValueType(0) == MVT::f64) {
04403         Emit_58(Result, N, Alpha::CMPTLT, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04404         return;
04405       }
04406     }
04407 
04408     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOLT:Other), F4RC:f32:$st, F4RC:f32:$sf)
04409     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04410     // Pattern complexity = 4  cost = 2  size = 0
04411     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOLT) {
04412       N1 = N.getOperand(1);
04413       N2 = N.getOperand(2);
04414       if (N.Val->getValueType(0) == MVT::f32 &&
04415           N00.Val->getValueType(0) == MVT::f64) {
04416         Emit_58(Result, N, Alpha::CMPTLT, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04417         return;
04418       }
04419     }
04420 
04421     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETULT:Other), F4RC:f32:$st, F4RC:f32:$sf)
04422     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLT:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04423     // Pattern complexity = 4  cost = 2  size = 0
04424     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETULT) {
04425       N1 = N.getOperand(1);
04426       N2 = N.getOperand(2);
04427       if (N.Val->getValueType(0) == MVT::f32 &&
04428           N00.Val->getValueType(0) == MVT::f64) {
04429         Emit_58(Result, N, Alpha::CMPTLT, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04430         return;
04431       }
04432     }
04433 
04434     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETLE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04435     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04436     // Pattern complexity = 4  cost = 2  size = 0
04437     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETLE) {
04438       N1 = N.getOperand(1);
04439       N2 = N.getOperand(2);
04440       if (N.Val->getValueType(0) == MVT::f32 &&
04441           N00.Val->getValueType(0) == MVT::f64) {
04442         Emit_58(Result, N, Alpha::CMPTLE, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04443         return;
04444       }
04445     }
04446 
04447     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETOLE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04448     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04449     // Pattern complexity = 4  cost = 2  size = 0
04450     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETOLE) {
04451       N1 = N.getOperand(1);
04452       N2 = N.getOperand(2);
04453       if (N.Val->getValueType(0) == MVT::f32 &&
04454           N00.Val->getValueType(0) == MVT::f64) {
04455         Emit_58(Result, N, Alpha::CMPTLE, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04456         return;
04457       }
04458     }
04459 
04460     // Pattern: (select:f32 (setcc:i64 F8RC:f64:$RA, F8RC:f64:$RB, SETULE:Other), F4RC:f32:$st, F4RC:f32:$sf)
04461     // Emits: (FCMOVNES:f32 F4RC:f32:$sf, F4RC:f32:$st, (CMPTLE:f64 F8RC:f64:$RA, F8RC:f64:$RB))
04462     // Pattern complexity = 4  cost = 2
04463     if (cast<CondCodeSDNode>(N02)->get() == ISD::SETULE) {
04464       N1 = N.getOperand(1);
04465       N2 = N.getOperand(2);
04466       if (N.Val->getValueType(0) == MVT::f32 &&
04467           N00.Val->getValueType(0) == MVT::f64) {
04468         Emit_58(Result, N, Alpha::CMPTLE, Alpha::FCMOVNES, MVT::f64, MVT::f32, N0, N00, N01, N02, N1, N2);
04469         return;
04470       }
04471     }
04472   }
04473   N1 = N.getOperand(1);
04474   N2 = N.getOperand(2);
04475   if (N.Val->getValueType(0) == MVT::i64) {
04476 
04477     // Pattern: (select:i64 GPRC:i64:$which, GPRC:i64:$src1, GPRC:i64:$src2)
04478     // Emits: (CMOVNE:i64 GPRC:i64:$src2, GPRC:i64:$src1, GPRC:i64:$which)
04479     // Pattern complexity = 2  cost = 1  size = 0
04480     {
04481       Emit_60(Result, N, Alpha::CMOVNE, MVT::i64, N0, N1, N2);
04482       return;
04483     }
04484 
04485     // Pattern: (select:i64 GPRC:i64:$which, GPRC:i64:$src1, GPRC:i64:$src2)
04486     // Emits: (CMOVEQ:i64 GPRC:i64:$src1, GPRC:i64:$src2, GPRC:i64:$which)
04487     // Pattern complexity = 2  cost = 1
04488     Emit_61(Result, N, Alpha::CMOVEQ, MVT::i64, N0, N1, N2);
04489     return;
04490   }
04491   std::cerr << "Cannot yet select: ";
04492   N.Val->dump(CurDAG);
04493   std::cerr << '\n';
04494   abort();
04495 }
04496 
04497 void Emit_62(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2) NOINLINE {
04498   SDOperand Tmp2(0, 0);
04499   SDOperand Tmp3(0, 0);
04500   SDNode *ResNode = NULL;
04501   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
04502   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
04503   Select(Tmp2, N00);
04504   Select(Tmp3, N10);
04505   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
04506   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
04507   if (N.Val->hasOneUse()) {
04508     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp2, Tmp3);
04509   } else {
04510     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3);
04511     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04512     Result = SDOperand(ResNode, 0);
04513   }
04514   return;
04515 }
04516 void Emit_63(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2) NOINLINE {
04517   SDOperand Tmp2(0, 0);
04518   SDOperand Tmp3(0, 0);
04519   SDNode *ResNode = NULL;
04520   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
04521   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N10.Val);
04522   Select(Tmp2, N01);
04523   Select(Tmp3, N10);
04524   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
04525   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N10.Val);
04526   if (N.Val->hasOneUse()) {
04527     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp2, Tmp3);
04528   } else {
04529     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3);
04530     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04531     Result = SDOperand(ResNode, 0);
04532   }
04533   return;
04534 }
04535 void Emit_64(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2) NOINLINE {
04536   SDOperand Tmp2(0, 0);
04537   SDOperand Tmp3(0, 0);
04538   SDNode *ResNode = NULL;
04539   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
04540   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N11.Val);
04541   Select(Tmp2, N00);
04542   Select(Tmp3, N11);
04543   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
04544   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N11.Val);
04545   if (N.Val->hasOneUse()) {
04546     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp2, Tmp3);
04547   } else {
04548     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3);
04549     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04550     Result = SDOperand(ResNode, 0);
04551   }
04552   return;
04553 }
04554 void Emit_65(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2) NOINLINE {
04555   SDOperand Tmp2(0, 0);
04556   SDOperand Tmp3(0, 0);
04557   SDNode *ResNode = NULL;
04558   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
04559   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N11.Val);
04560   Select(Tmp2, N01);
04561   Select(Tmp3, N11);
04562   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
04563   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N11.Val);
04564   if (N.Val->hasOneUse()) {
04565     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp2, Tmp3);
04566   } else {
04567     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp2, Tmp3);
04568     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04569     Result = SDOperand(ResNode, 0);
04570   }
04571   return;
04572 }
04573 void Emit_66(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N2) NOINLINE {
04574   SDOperand Tmp1(0, 0);
04575   SDOperand Tmp2(0, 0);
04576   SDNode *ResNode = NULL;
04577   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
04578   Select(Tmp1, N00);
04579   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
04580   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
04581   if (N.Val->hasOneUse()) {
04582     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
04583   } else {
04584     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
04585     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04586     Result = SDOperand(ResNode, 0);
04587   }
04588   return;
04589 }
04590 void Emit_67(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1, SDOperand &N2) NOINLINE {
04591   SDOperand Tmp1(0, 0);
04592   SDOperand Tmp2(0, 0);
04593   SDNode *ResNode = NULL;
04594   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
04595   Select(Tmp1, N01);
04596   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
04597   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
04598   if (N.Val->hasOneUse()) {
04599     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
04600   } else {
04601     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
04602     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04603     Result = SDOperand(ResNode, 0);
04604   }
04605   return;
04606 }
04607 void Emit_68(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
04608   SDOperand Tmp0(0, 0);
04609   SDOperand Tmp1(0, 0);
04610   SDNode *ResNode = NULL;
04611   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
04612   Select(Tmp0, N0);
04613   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
04614   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
04615   if (N.Val->hasOneUse()) {
04616     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
04617   } else {
04618     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
04619     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04620     Result = SDOperand(ResNode, 0);
04621   }
04622   return;
04623 }
04624 void Emit_69(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
04625   SDOperand Tmp0(0, 0);
04626   SDOperand Tmp1(0, 0);
04627   SDNode *ResNode = NULL;
04628   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
04629   Select(Tmp0, N1);
04630   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N0)->getValue()), MVT::i64);
04631   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
04632   if (N.Val->hasOneUse()) {
04633     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
04634   } else {
04635     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
04636     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04637     Result = SDOperand(ResNode, 0);
04638   }
04639   return;
04640 }
04641 void Emit_70(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
04642   SDOperand Tmp0(0, 0);
04643   SDOperand Tmp1(0, 0);
04644   SDOperand Tmp2(0, 0);
04645   SDOperand Tmp3(0, 0);
04646   SDNode *ResNode = NULL;
04647   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
04648   Select(Tmp0, N0);
04649   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N1)->getValue()), MVT::i64);
04650   Tmp2 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1), 0);
04651   Tmp3 = CurDAG->getTargetConstant(0, MVT::i64);
04652   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
04653   if (N.Val->hasOneUse()) {
04654     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp2, Tmp3);
04655   } else {
04656     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp2, Tmp3);
04657     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04658     Result = SDOperand(ResNode, 0);
04659   }
04660   return;
04661 }
04662 void Emit_71(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
04663   SDOperand Tmp0(0, 0);
04664   SDOperand Tmp1(0, 0);
04665   SDNode *ResNode = NULL;
04666   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
04667   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
04668   Select(Tmp0, N0);
04669   Select(Tmp1, N1);
04670   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
04671   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
04672   if (N.Val->hasOneUse()) {
04673     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
04674   } else {
04675     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
04676     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04677     Result = SDOperand(ResNode, 0);
04678   }
04679   return;
04680 }
04681 void Emit_72(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
04682   SDOperand Tmp0(0, 0);
04683   SDOperand Tmp1(0, 0);
04684   SDNode *ResNode = NULL;
04685   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
04686   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
04687   Select(Tmp0, N1);
04688   Select(Tmp1, N0);
04689   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
04690   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
04691   if (N.Val->hasOneUse()) {
04692     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
04693   } else {
04694     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
04695     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04696     Result = SDOperand(ResNode, 0);
04697   }
04698   return;
04699 }
04700 void Emit_73(SDOperand &Result, SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1, SDOperand &N0, SDOperand &N1, SDOperand &N2) NOINLINE {
04701   SDOperand Tmp0(0, 0);
04702   SDOperand Tmp1(0, 0);
04703   SDOperand Tmp2(0, 0);
04704   SDOperand Tmp3(0, 0);
04705   SDNode *ResNode = NULL;
04706   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
04707   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
04708   Select(Tmp0, N0);
04709   Select(Tmp1, N1);
04710   Tmp2 = SDOperand(CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1), 0);
04711   Tmp3 = CurDAG->getTargetConstant(0, MVT::i64);
04712   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
04713   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
04714   if (N.Val->hasOneUse()) {
04715     Result = CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp2, Tmp3);
04716   } else {
04717     ResNode = CurDAG->getTargetNode(Opc1, VT1, Tmp2, Tmp3);
04718     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
04719     Result = SDOperand(ResNode, 0);
04720   }
04721   return;
04722 }
04723 void Select_setcc(SDOperand &Result, SDOperand N) {
04724   SDOperand N0(0, 0);
04725   SDOperand N00(0, 0);
04726   SDOperand N01(0, 0);
04727   SDOperand N1(0, 0);
04728   SDOperand N10(0, 0);
04729   SDOperand N11(0, 0);
04730   SDOperand N2(0, 0);
04731   SDOperand Tmp0(0, 0);
04732   SDOperand Tmp1(0, 0);
04733   SDOperand Tmp2(0, 0);
04734   SDOperand Tmp3(0, 0);
04735   SDNode *ResNode = NULL;
04736   N0 = N.getOperand(0);
04737   if (N0.getOpcode() == ISD::AND) {
04738     N00 = N0.getOperand(0);
04739 
04740     // Pattern: (setcc:i64 (and:i64 GPRC:i64:$RA, 255:i64), (and:i64 GPRC:i64:$RB, 255:i64), SETUGE:Other)
04741     // Emits: (CMPBGE:i64 GPRC:i64:$RA, GPRC:i64:$RB)
04742     // Pattern complexity = 12  cost = 1  size = 0
04743     {
04744       N01 = N0.getOperand(1);
04745       if (isa<ConstantSDNode>(N01)) {
04746         int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
04747         if (CN0 == 255) {
04748           N1 = N.getOperand(1);
04749           if (N1.getOpcode() == ISD::AND) {
04750             N10 = N1.getOperand(0);
04751             N11 = N1.getOperand(1);
04752             if (isa<ConstantSDNode>(N11)) {
04753               int64_t CN1 = cast<ConstantSDNode>(N11)->getSignExtended();
04754               if (CN1 == 255) {
04755                 N2 = N.getOperand(2);
04756                 if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE) {
04757                   Emit_62(Result, N, Alpha::CMPBGE, MVT::i64, N0, N00, N01, N1, N10, N11, N2);
04758                   return;
04759                 }
04760               }
04761             }
04762           }
04763         }
04764       }
04765     }
04766 
04767     // Pattern: (setcc:i64 (and:i64 255:i64, GPRC:i64:$RA), (and:i64 GPRC:i64:$RB, 255:i64), SETUGE:Other)
04768     // Emits: (CMPBGE:i64 GPRC:i64:$RA, GPRC:i64:$RB)
04769     // Pattern complexity = 12  cost = 1  size = 0
04770     if (isa<ConstantSDNode>(N00)) {
04771       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
04772       if (CN0 == 255) {
04773         N01 = N0.getOperand(1);
04774         N1 = N.getOperand(1);
04775         if (N1.getOpcode() == ISD::AND) {
04776           N10 = N1.getOperand(0);
04777           N11 = N1.getOperand(1);
04778           if (isa<ConstantSDNode>(N11)) {
04779             int64_t CN1 = cast<ConstantSDNode>(N11)->getSignExtended();
04780             if (CN1 == 255) {
04781               N2 = N.getOperand(2);
04782               if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE) {
04783                 Emit_63(Result, N, Alpha::CMPBGE, MVT::i64, N0, N00, N01, N1, N10, N11, N2);
04784                 return;
04785               }
04786             }
04787           }
04788         }
04789       }
04790     }
04791 
04792     // Pattern: (setcc:i64 (and:i64 GPRC:i64:$RA, 255:i64), (and:i64 255:i64, GPRC:i64:$RB), SETUGE:Other)
04793     // Emits: (CMPBGE:i64 GPRC:i64:$RA, GPRC:i64:$RB)
04794     // Pattern complexity = 12  cost = 1  size = 0
04795     {
04796       N01 = N0.getOperand(1);
04797       if (isa<ConstantSDNode>(N01)) {
04798         int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
04799         if (CN0 == 255) {
04800           N1 = N.getOperand(1);
04801           if (N1.getOpcode() == ISD::AND) {
04802             N10 = N1.getOperand(0);
04803             if (isa<ConstantSDNode>(N10)) {
04804               int64_t CN1 = cast<ConstantSDNode>(N10)->getSignExtended();
04805               if (CN1 == 255) {
04806                 N11 = N1.getOperand(1);
04807                 N2 = N.getOperand(2);
04808                 if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE) {
04809                   Emit_64(Result, N, Alpha::CMPBGE, MVT::i64, N0, N00, N01, N1, N10, N11, N2);
04810                   return;
04811                 }
04812               }
04813             }
04814           }
04815         }
04816       }
04817     }
04818 
04819     // Pattern: (setcc:i64 (and:i64 255:i64, GPRC:i64:$RA), (and:i64 255:i64, GPRC:i64:$RB), SETUGE:Other)
04820     // Emits: (CMPBGE:i64 GPRC:i64:$RA, GPRC:i64:$RB)
04821     // Pattern complexity = 12  cost = 1  size = 0
04822     if (isa<ConstantSDNode>(N00)) {
04823       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
04824       if (CN0 == 255) {
04825         N01 = N0.getOperand(1);
04826         N1 = N.getOperand(1);
04827         if (N1.getOpcode() == ISD::AND) {
04828           N10 = N1.getOperand(0);
04829           if (isa<ConstantSDNode>(N10)) {
04830             int64_t CN1 = cast<ConstantSDNode>(N10)->getSignExtended();
04831             if (CN1 == 255) {
04832               N11 = N1.getOperand(1);
04833               N2 = N.getOperand(2);
04834               if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE) {
04835                 Emit_65(Result, N, Alpha::CMPBGE, MVT::i64, N0, N00, N01, N1, N10, N11, N2);
04836                 return;
04837               }
04838             }
04839           }
04840         }
04841       }
04842     }
04843 
04844     // Pattern: (setcc:i64 (and:i64 GPRC:i64:$RA, 255:i64), (imm:i64)<<P:Predicate_immUExt8>>:$L, SETUGE:Other)
04845     // Emits: (CMPBGEi:i64 GPRC:i64:$RA, (imm:i64):$L)
04846     // Pattern complexity = 10  cost = 1  size = 0
04847     {
04848       N01 = N0.getOperand(1);
04849       if (isa<ConstantSDNode>(N01)) {
04850         int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
04851         if (CN0 == 255) {
04852           N1 = N.getOperand(1);
04853           if (N1.getOpcode() == ISD::Constant &&
04854               Predicate_immUExt8(N1.Val)) {
04855             N2 = N.getOperand(2);
04856             if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE) {
04857               Emit_66(Result, N, Alpha::CMPBGEi, MVT::i64, N0, N00, N01, N1, N2);
04858               return;
04859             }
04860           }
04861         }
04862       }
04863     }
04864 
04865     // Pattern: (setcc:i64 (and:i64 255:i64, GPRC:i64:$RA), (imm:i64)<<P:Predicate_immUExt8>>:$L, SETUGE:Other)
04866     // Emits: (CMPBGEi:i64 GPRC:i64:$RA, (imm:i64):$L)
04867     // Pattern complexity = 10  cost = 1
04868     if (isa<ConstantSDNode>(N00)) {
04869       int64_t CN0 = cast<ConstantSDNode>(N00)->getSignExtended();
04870       if (CN0 == 255) {
04871         N01 = N0.getOperand(1);
04872         N1 = N.getOperand(1);
04873         if (N1.getOpcode() == ISD::Constant &&
04874             Predicate_immUExt8(N1.Val)) {
04875           N2 = N.getOperand(2);
04876           if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE) {
04877             Emit_67(Result, N, Alpha::CMPBGEi, MVT::i64, N0, N00, N01, N1, N2);
04878             return;
04879           }
04880         }
04881       }
04882     }
04883   }
04884   {
04885     N1 = N.getOperand(1);
04886     if (N1.getOpcode() == ISD::Constant &&
04887         Predicate_immUExt8(N1.Val)) {
04888       N2 = N.getOperand(2);
04889 
04890       // Pattern: (setcc:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L, SETEQ:Other)
04891       // Emits: (CMPEQi:i64 GPRC:i64:$RA, (imm:i64):$L)
04892       // Pattern complexity = 5  cost = 1  size = 0
04893       if (cast<CondCodeSDNode>(N2)->get() == ISD::SETEQ) {
04894         Emit_68(Result, N, Alpha::CMPEQi, MVT::i64, N0, N1, N2);
04895         return;
04896       }
04897 
04898       // Pattern: (setcc:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L, SETLE:Other)
04899       // Emits: (CMPLEi:i64 GPRC:i64:$RA, (imm:i64):$L)
04900       // Pattern complexity = 5  cost = 1  size = 0
04901       if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLE) {
04902         Emit_68(Result, N, Alpha::CMPLEi, MVT::i64, N0, N1, N2);
04903         return;
04904       }
04905 
04906       // Pattern: (setcc:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L, SETLT:Other)
04907       // Emits: (CMPLTi:i64 GPRC:i64:$RA, (imm:i64):$L)
04908       // Pattern complexity = 5  cost = 1  size = 0
04909       if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLT) {
04910         Emit_68(Result, N, Alpha::CMPLTi, MVT::i64, N0, N1, N2);
04911         return;
04912       }
04913 
04914       // Pattern: (setcc:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L, SETULE:Other)
04915       // Emits: (CMPULEi:i64 GPRC:i64:$RA, (imm:i64):$L)
04916       // Pattern complexity = 5  cost = 1  size = 0
04917       if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULE) {
04918         Emit_68(Result, N, Alpha::CMPULEi, MVT::i64, N0, N1, N2);
04919         return;
04920       }
04921 
04922       // Pattern: (setcc:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L, SETULT:Other)
04923       // Emits: (CMPULTi:i64 GPRC:i64:$RA, (imm:i64):$L)
04924       // Pattern complexity = 5  cost = 1
04925       if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULT) {
04926         Emit_68(Result, N, Alpha::CMPULTi, MVT::i64, N0, N1, N2);
04927         return;
04928       }
04929     }
04930   }
04931 
04932   // Pattern: (setcc:i64 (imm:i64)<<P:Predicate_immUExt8>>:$X, GPRC:i64:$Y, SETGE:Other)
04933   // Emits: (CMPLEi:i64 GPRC:i64:$Y, (imm:i64)<<P:Predicate_immUExt8>>:$X)
04934   // Pattern complexity = 5  cost = 1  size = 0
04935   if (N0.getOpcode() == ISD::Constant &&
04936       Predicate_immUExt8(N0.Val)) {
04937     N1 = N.getOperand(1);
04938     N2 = N.getOperand(2);
04939     if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGE) {
04940       Emit_69(Result, N, Alpha::CMPLEi, MVT::i64, N0, N1, N2);
04941       return;
04942     }
04943   }
04944 
04945   // Pattern: (setcc:i64 GPRC:i64:$X, (imm:i64)<<P:Predicate_immUExt8>>:$Y, SETUEQ:Other)
04946   // Emits: (CMPEQi:i64 GPRC:i64:$X, (imm:i64)<<P:Predicate_immUExt8>>:$Y)
04947   // Pattern complexity = 5  cost = 1  size = 0
04948   {
04949     N1 = N.getOperand(1);
04950     if (N1.getOpcode() == ISD::Constant &&
04951         Predicate_immUExt8(N1.Val)) {
04952       N2 = N.getOperand(2);
04953       if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUEQ) {
04954         Emit_68(Result, N, Alpha::CMPEQi, MVT::i64, N0, N1, N2);
04955         return;
04956       }
04957     }
04958   }
04959   if (N0.getOpcode() == ISD::Constant &&
04960       Predicate_immUExt8(N0.Val)) {
04961     N1 = N.getOperand(1);
04962     N2 = N.getOperand(2);
04963 
04964     // Pattern: (setcc:i64 (imm:i64)<<P:Predicate_immUExt8>>:$X, GPRC:i64:$Y, SETUGT:Other)
04965     // Emits: (CMPULTi:i64 GPRC:i64:$Y, (imm:i64)<<P:Predicate_immUExt8>>:$X)
04966     // Pattern complexity = 5  cost = 1  size = 0
04967     if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGT) {
04968       Emit_69(Result, N, Alpha::CMPULTi, MVT::i64, N0, N1, N2);
04969       return;
04970     }
04971 
04972     // Pattern: (setcc:i64 (imm:i64)<<P:Predicate_immUExt8>>:$X, GPRC:i64:$Y, SETUGE:Other)
04973     // Emits: (CMPULEi:i64 GPRC:i64:$Y, (imm:i64)<<P:Predicate_immUExt8>>:$X)
04974     // Pattern complexity = 5  cost = 1  size = 0
04975     if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE) {
04976       Emit_69(Result, N, Alpha::CMPULEi, MVT::i64, N0, N1, N2);
04977       return;
04978     }
04979 
04980     // Pattern: (setcc:i64 (imm:i64)<<P:Predicate_immUExt8>>:$X, GPRC:i64:$Y, SETGT:Other)
04981     // Emits: (CMPLTi:i64 GPRC:i64:$Y, (imm:i64)<<P:Predicate_immUExt8>>:$X)
04982     // Pattern complexity = 5  cost = 1
04983     if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGT) {
04984       Emit_69(Result, N, Alpha::CMPLTi, MVT::i64, N0, N1, N2);
04985       return;
04986     }
04987   }
04988   N1 = N.getOperand(1);
04989   if (N1.getOpcode() == ISD::Constant &&
04990       Predicate_immUExt8(N1.Val)) {
04991     N2 = N.getOperand(2);
04992 
04993     // Pattern: (setcc:i64 GPRC:i64:$X, (imm:i64)<<P:Predicate_immUExt8>>:$Y, SETNE:Other)
04994     // Emits: (CMPEQi:i64 (CMPEQi:i64 GPRC:i64:$X, (imm:i64)<<P:Predicate_immUExt8>>:$Y), 0:i64)
04995     // Pattern complexity = 5  cost = 2  size = 0
04996     if (cast<CondCodeSDNode>(N2)->get() == ISD::SETNE) {
04997       Emit_70(Result, N, Alpha::CMPEQi, Alpha::CMPEQi, MVT::i64, MVT::i64, N0, N1, N2);
04998       return;
04999     }
05000 
05001     // Pattern: (setcc:i64 GPRC:i64:$X, (imm:i64)<<P:Predicate_immUExt8>>:$Y, SETUNE:Other)
05002     // Emits: (CMPEQi:i64 (CMPEQ:i64 GPRC:i64:$X, (imm:i64)<<P:Predicate_immUExt8>>:$Y), 0:i64)
05003     // Pattern complexity = 5  cost = 2
05004     if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUNE) {
05005       Emit_70(Result, N, Alpha::CMPEQ, Alpha::CMPEQi, MVT::i64, MVT::i64, N0, N1, N2);
05006       return;
05007     }
05008   }
05009   N2 = N.getOperand(2);
05010 
05011   // Pattern: (setcc:i64 GPRC:i64:$RA, GPRC:i64:$RB, SETEQ:Other)
05012   // Emits: (CMPEQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05013   // Pattern complexity = 2  cost = 1  size = 0
05014   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETEQ &&
05015       N0.Val->getValueType(0) == MVT::i64) {
05016     Emit_71(Result, N, Alpha::CMPEQ, MVT::i64, N0, N1, N2);
05017     return;
05018   }
05019 
05020   // Pattern: (setcc:i64 GPRC:i64:$RA, GPRC:i64:$RB, SETLE:Other)
05021   // Emits: (CMPLE:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05022   // Pattern complexity = 2  cost = 1  size = 0
05023   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLE &&
05024       N0.Val->getValueType(0) == MVT::i64) {
05025     Emit_71(Result, N, Alpha::CMPLE, MVT::i64, N0, N1, N2);
05026     return;
05027   }
05028 
05029   // Pattern: (setcc:i64 GPRC:i64:$RA, GPRC:i64:$RB, SETLT:Other)
05030   // Emits: (CMPLT:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05031   // Pattern complexity = 2  cost = 1  size = 0
05032   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETLT &&
05033       N0.Val->getValueType(0) == MVT::i64) {
05034     Emit_71(Result, N, Alpha::CMPLT, MVT::i64, N0, N1, N2);
05035     return;
05036   }
05037 
05038   // Pattern: (setcc:i64 GPRC:i64:$RA, GPRC:i64:$RB, SETULE:Other)
05039   // Emits: (CMPULE:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05040   // Pattern complexity = 2  cost = 1  size = 0
05041   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULE &&
05042       N0.Val->getValueType(0) == MVT::i64) {
05043     Emit_71(Result, N, Alpha::CMPULE, MVT::i64, N0, N1, N2);
05044     return;
05045   }
05046 
05047   // Pattern: (setcc:i64 GPRC:i64:$RA, GPRC:i64:$RB, SETULT:Other)
05048   // Emits: (CMPULT:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05049   // Pattern complexity = 2  cost = 1  size = 0
05050   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETULT &&
05051       N0.Val->getValueType(0) == MVT::i64) {
05052     Emit_71(Result, N, Alpha::CMPULT, MVT::i64, N0, N1, N2);
05053     return;
05054   }
05055 
05056   // Pattern: (setcc:i64 GPRC:i64:$X, GPRC:i64:$Y, SETGE:Other)
05057   // Emits: (CMPLE:i64 GPRC:i64:$Y, GPRC:i64:$X)
05058   // Pattern complexity = 2  cost = 1  size = 0
05059   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGE &&
05060       N0.Val->getValueType(0) == MVT::i64) {
05061     Emit_72(Result, N, Alpha::CMPLE, MVT::i64, N0, N1, N2);
05062     return;
05063   }
05064 
05065   // Pattern: (setcc:i64 GPRC:i64:$X, GPRC:i64:$Y, SETUEQ:Other)
05066   // Emits: (CMPEQ:i64 GPRC:i64:$X, GPRC:i64:$Y)
05067   // Pattern complexity = 2  cost = 1  size = 0
05068   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUEQ &&
05069       N0.Val->getValueType(0) == MVT::i64) {
05070     Emit_71(Result, N, Alpha::CMPEQ, MVT::i64, N0, N1, N2);
05071     return;
05072   }
05073 
05074   // Pattern: (setcc:i64 GPRC:i64:$X, GPRC:i64:$Y, SETUGT:Other)
05075   // Emits: (CMPULT:i64 GPRC:i64:$Y, GPRC:i64:$X)
05076   // Pattern complexity = 2  cost = 1  size = 0
05077   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGT &&
05078       N0.Val->getValueType(0) == MVT::i64) {
05079     Emit_72(Result, N, Alpha::CMPULT, MVT::i64, N0, N1, N2);
05080     return;
05081   }
05082 
05083   // Pattern: (setcc:i64 GPRC:i64:$X, GPRC:i64:$Y, SETUGE:Other)
05084   // Emits: (CMPULE:i64 GPRC:i64:$Y, GPRC:i64:$X)
05085   // Pattern complexity = 2  cost = 1  size = 0
05086   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUGE &&
05087       N0.Val->getValueType(0) == MVT::i64) {
05088     Emit_72(Result, N, Alpha::CMPULE, MVT::i64, N0, N1, N2);
05089     return;
05090   }
05091 
05092   // Pattern: (setcc:i64 GPRC:i64:$X, GPRC:i64:$Y, SETGT:Other)
05093   // Emits: (CMPLT:i64 GPRC:i64:$Y, GPRC:i64:$X)
05094   // Pattern complexity = 2  cost = 1  size = 0
05095   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETGT &&
05096       N0.Val->getValueType(0) == MVT::i64) {
05097     Emit_72(Result, N, Alpha::CMPLT, MVT::i64, N0, N1, N2);
05098     return;
05099   }
05100 
05101   // Pattern: (setcc:i64 GPRC:i64:$X, GPRC:i64:$Y, SETNE:Other)
05102   // Emits: (CMPEQi:i64 (CMPEQ:i64 GPRC:i64:$X, GPRC:i64:$Y), 0:i64)
05103   // Pattern complexity = 2  cost = 2  size = 0
05104   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETNE &&
05105       N0.Val->getValueType(0) == MVT::i64) {
05106     Emit_73(Result, N, Alpha::CMPEQ, Alpha::CMPEQi, MVT::i64, MVT::i64, N0, N1, N2);
05107     return;
05108   }
05109 
05110   // Pattern: (setcc:i64 GPRC:i64:$X, GPRC:i64:$Y, SETUNE:Other)
05111   // Emits: (CMPEQi:i64 (CMPEQ:i64 GPRC:i64:$X, GPRC:i64:$Y), 0:i64)
05112   // Pattern complexity = 2  cost = 2
05113   if (cast<CondCodeSDNode>(N2)->get() == ISD::SETUNE &&
05114       N0.Val->getValueType(0) == MVT::i64) {
05115     Emit_73(Result, N, Alpha::CMPEQ, Alpha::CMPEQi, MVT::i64, MVT::i64, N0, N1, N2);
05116     return;
05117   }
05118   std::cerr << "Cannot yet select: ";
05119   N.Val->dump(CurDAG);
05120   std::cerr << '\n';
05121   abort();
05122 }
05123 
05124 void Emit_74(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N000, SDOperand &N001, SDOperand &N01, SDOperand &N1) NOINLINE {
05125   SDOperand Tmp1(0, 0);
05126   SDOperand Tmp2(0, 0);
05127   SDNode *ResNode = NULL;
05128   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N000.Val);
05129   Select(Tmp1, N000);
05130   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N01)->getValue()), MVT::i64);
05131   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N000.Val);
05132   if (N.Val->hasOneUse()) {
05133     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
05134   } else {
05135     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
05136     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05137     Result = SDOperand(ResNode, 0);
05138   }
05139   return;
05140 }
05141 void Emit_75(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N000, SDOperand &N001, SDOperand &N01, SDOperand &N1) NOINLINE {
05142   SDOperand Tmp1(0, 0);
05143   SDOperand Tmp2(0, 0);
05144   SDOperand Tmp3(0, 0);
05145   SDNode *ResNode = NULL;
05146   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N000.Val);
05147   Select(Tmp1, N000);
05148   Tmp2 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N01)->getValue()), MVT::i64);
05149   Tmp3 = Transform_negX(Tmp2.Val);
05150   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N000.Val);
05151   if (N.Val->hasOneUse()) {
05152     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp3);
05153   } else {
05154     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp3);
05155     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05156     Result = SDOperand(ResNode, 0);
05157   }
05158   return;
05159 }
05160 void Emit_76(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N000, SDOperand &N001, SDOperand &N01, SDOperand &N1) NOINLINE {
05161   SDOperand Tmp1(0, 0);
05162   SDOperand Tmp2(0, 0);
05163   SDNode *ResNode = NULL;
05164   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N000.Val);
05165   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
05166   Select(Tmp1, N000);
05167   Select(Tmp2, N01);
05168   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N000.Val);
05169   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
05170   if (N.Val->hasOneUse()) {
05171     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
05172   } else {
05173     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
05174     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05175     Result = SDOperand(ResNode, 0);
05176   }
05177   return;
05178 }
05179 void Emit_77(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N010, SDOperand &N011, SDOperand &N1) NOINLINE {
05180   SDOperand Tmp1(0, 0);
05181   SDOperand Tmp2(0, 0);
05182   SDNode *ResNode = NULL;
05183   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N010.Val);
05184   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
05185   Select(Tmp1, N010);
05186   Select(Tmp2, N00);
05187   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N010.Val);
05188   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
05189   if (N.Val->hasOneUse()) {
05190     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp1, Tmp2);
05191   } else {
05192     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp1, Tmp2);
05193     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05194     Result = SDOperand(ResNode, 0);
05195   }
05196   return;
05197 }
05198 void Emit_78(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
05199   SDOperand Tmp0(0, 0);
05200   SDOperand Tmp1(0, 0);
05201   SDNode *ResNode = NULL;
05202   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
05203   Select(Tmp0, N00);
05204   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N01)->getValue()), MVT::i64);
05205   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
05206   if (N.Val->hasOneUse()) {
05207     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
05208   } else {
05209     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
05210     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05211     Result = SDOperand(ResNode, 0);
05212   }
05213   return;
05214 }
05215 void Emit_79(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
05216   SDOperand Tmp0(0, 0);
05217   SDOperand Tmp1(0, 0);
05218   SDOperand Tmp2(0, 0);
05219   SDNode *ResNode = NULL;
05220   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
05221   Select(Tmp0, N00);
05222   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N01)->getValue()), MVT::i64);
05223   Tmp2 = Transform_negX(Tmp1.Val);
05224   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
05225   if (N.Val->hasOneUse()) {
05226     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp2);
05227   } else {
05228     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp2);
05229     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05230     Result = SDOperand(ResNode, 0);
05231   }
05232   return;
05233 }
05234 void Emit_80(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
05235   SDOperand Tmp0(0, 0);
05236   SDOperand Tmp1(0, 0);
05237   SDNode *ResNode = NULL;
05238   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
05239   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N01.Val);
05240   Select(Tmp0, N00);
05241   Select(Tmp1, N01);
05242   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
05243   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N01.Val);
05244   if (N.Val->hasOneUse()) {
05245     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
05246   } else {
05247     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
05248     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05249     Result = SDOperand(ResNode, 0);
05250   }
05251   return;
05252 }
05253 void Emit_81(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
05254   SDOperand Tmp0(0, 0);
05255   SDNode *ResNode = NULL;
05256   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
05257   Select(Tmp0, N0);
05258   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
05259   if (N.Val->hasOneUse()) {
05260     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0);
05261   } else {
05262     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0);
05263     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05264     Result = SDOperand(ResNode, 0);
05265   }
05266   return;
05267 }
05268 void Emit_82(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N1) NOINLINE {
05269   SDOperand Tmp0(0, 0);
05270   SDOperand Tmp1(0, 0);
05271   SDNode *ResNode = NULL;
05272   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N0.Val);
05273   Select(Tmp0, N0);
05274   Tmp1 = CurDAG->getTargetConstant(0, MVT::i64);
05275   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N0.Val);
05276   if (N.Val->hasOneUse()) {
05277     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
05278   } else {
05279     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
05280     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
05281     Result = SDOperand(ResNode, 0);
05282   }
05283   return;
05284 }
05285 void Select_sext_inreg(SDOperand &Result, SDOperand N) {
05286   SDOperand N0(0, 0);
05287   SDOperand N00(0, 0);
05288   SDOperand N000(0, 0);
05289   SDOperand N001(0, 0);
05290   SDOperand N01(0, 0);
05291   SDOperand N010(0, 0);
05292   SDOperand N011(0, 0);
05293   SDOperand N1(0, 0);
05294   SDOperand Tmp0(0, 0);
05295   SDOperand Tmp1(0, 0);
05296   SDOperand Tmp2(0, 0);
05297   SDOperand Tmp3(0, 0);
05298   SDNode *ResNode = NULL;
05299   N0 = N.getOperand(0);
05300 
05301   // Pattern: (sext_inreg:i64 (add:i64 (shl:i64 GPRC:i64:$RA, 2:i64), (imm:i64)<<P:Predicate_immUExt8>>:$L), i32:Other)
05302   // Emits: (S4ADDLi:i64 GPRC:i64:$RA, (imm:i64):$L)
05303   // Pattern complexity = 12  cost = 1  size = 0
05304   if (N0.getOpcode() == ISD::ADD) {
05305     N00 = N0.getOperand(0);
05306     if (N00.getOpcode() == ISD::SHL) {
05307       N000 = N00.getOperand(0);
05308       N001 = N00.getOperand(1);
05309       if (isa<ConstantSDNode>(N001)) {
05310         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
05311         if (CN0 == 2) {
05312           N01 = N0.getOperand(1);
05313           if (N01.getOpcode() == ISD::Constant &&
05314               Predicate_immUExt8(N01.Val)) {
05315             N1 = N.getOperand(1);
05316             if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05317               Emit_74(Result, N, Alpha::S4ADDLi, MVT::i64, N0, N00, N000, N001, N01, N1);
05318               return;
05319             }
05320           }
05321         }
05322       }
05323     }
05324   }
05325 
05326   // Pattern: (sext_inreg:i64 (sub:i64 (shl:i64 GPRC:i64:$RA, 2:i64), (imm:i64)<<P:Predicate_immUExt8>>:$L), i32:Other)
05327   // Emits: (S4SUBLi:i64 GPRC:i64:$RA, (imm:i64):$L)
05328   // Pattern complexity = 12  cost = 1  size = 0
05329   if (N0.getOpcode() == ISD::SUB) {
05330     N00 = N0.getOperand(0);
05331     if (N00.getOpcode() == ISD::SHL) {
05332       N000 = N00.getOperand(0);
05333       N001 = N00.getOperand(1);
05334       if (isa<ConstantSDNode>(N001)) {
05335         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
05336         if (CN0 == 2) {
05337           N01 = N0.getOperand(1);
05338           if (N01.getOpcode() == ISD::Constant &&
05339               Predicate_immUExt8(N01.Val)) {
05340             N1 = N.getOperand(1);
05341             if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05342               Emit_74(Result, N, Alpha::S4SUBLi, MVT::i64, N0, N00, N000, N001, N01, N1);
05343               return;
05344             }
05345           }
05346         }
05347       }
05348     }
05349   }
05350   if (N0.getOpcode() == ISD::ADD) {
05351     N00 = N0.getOperand(0);
05352     if (N00.getOpcode() == ISD::SHL) {
05353       N000 = N00.getOperand(0);
05354       N001 = N00.getOperand(1);
05355       if (isa<ConstantSDNode>(N001)) {
05356         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
05357         if (CN0 == 3) {
05358           N01 = N0.getOperand(1);
05359           if (N01.getOpcode() == ISD::Constant) {
05360 
05361             // Pattern: (sext_inreg:i64 (add:i64 (shl:i64 GPRC:i64:$RA, 3:i64), (imm:i64)<<P:Predicate_immUExt8>>:$L), i32:Other)
05362             // Emits: (S8ADDLi:i64 GPRC:i64:$RA, (imm:i64):$L)
05363             // Pattern complexity = 12  cost = 1  size = 0
05364             if (Predicate_immUExt8(N01.Val)) {
05365               N1 = N.getOperand(1);
05366               if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05367                 Emit_74(Result, N, Alpha::S8ADDLi, MVT::i64, N0, N00, N000, N001, N01, N1);
05368                 return;
05369               }
05370             }
05371 
05372             // Pattern: (sext_inreg:i64 (add:i64 (shl:i64 GPRC:i64:$RA, 3:i64), (imm:i64)<<P:Predicate_immUExt8neg>><<X:negX>>:$L), i32:Other)
05373             // Emits: (S8SUBLi:i64 GPRC:i64:$RA, (negX:i64 (imm:i64):$L))
05374             // Pattern complexity = 12  cost = 1
05375             if (Predicate_immUExt8neg(N01.Val)) {
05376               N1 = N.getOperand(1);
05377               if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05378                 Emit_75(Result, N, Alpha::S8SUBLi, MVT::i64, N0, N00, N000, N001, N01, N1);
05379                 return;
05380               }
05381             }
05382           }
05383         }
05384 
05385         // Pattern: (sext_inreg:i64 (add:i64 (shl:i64 GPRC:i64:$RA, 2:i64), GPRC:i64:$RB), i32:Other)
05386         // Emits: (S4ADDL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05387         // Pattern complexity = 9  cost = 1
05388         if (CN0 == 2) {
05389           N01 = N0.getOperand(1);
05390           N1 = N.getOperand(1);
05391           if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05392             Emit_76(Result, N, Alpha::S4ADDL, MVT::i64, N0, N00, N000, N001, N01, N1);
05393             return;
05394           }
05395         }
05396       }
05397     }
05398   }
05399 
05400   // Pattern: (sext_inreg:i64 (sub:i64 (shl:i64 GPRC:i64:$RA, 2:i64), GPRC:i64:$RB), i32:Other)
05401   // Emits: (S4SUBL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05402   // Pattern complexity = 9  cost = 1  size = 0
05403   if (N0.getOpcode() == ISD::SUB) {
05404     N00 = N0.getOperand(0);
05405     if (N00.getOpcode() == ISD::SHL) {
05406       N000 = N00.getOperand(0);
05407       N001 = N00.getOperand(1);
05408       if (isa<ConstantSDNode>(N001)) {
05409         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
05410         if (CN0 == 2) {
05411           N01 = N0.getOperand(1);
05412           N1 = N.getOperand(1);
05413           if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05414             Emit_76(Result, N, Alpha::S4SUBL, MVT::i64, N0, N00, N000, N001, N01, N1);
05415             return;
05416           }
05417         }
05418       }
05419     }
05420   }
05421 
05422   // Pattern: (sext_inreg:i64 (add:i64 (shl:i64 GPRC:i64:$RA, 3:i64), GPRC:i64:$RB), i32:Other)
05423   // Emits: (S8ADDL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05424   // Pattern complexity = 9  cost = 1  size = 0
05425   if (N0.getOpcode() == ISD::ADD) {
05426     N00 = N0.getOperand(0);
05427     if (N00.getOpcode() == ISD::SHL) {
05428       N000 = N00.getOperand(0);
05429       N001 = N00.getOperand(1);
05430       if (isa<ConstantSDNode>(N001)) {
05431         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
05432         if (CN0 == 3) {
05433           N01 = N0.getOperand(1);
05434           N1 = N.getOperand(1);
05435           if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05436             Emit_76(Result, N, Alpha::S8ADDL, MVT::i64, N0, N00, N000, N001, N01, N1);
05437             return;
05438           }
05439         }
05440       }
05441     }
05442   }
05443 
05444   // Pattern: (sext_inreg:i64 (sub:i64 (shl:i64 GPRC:i64:$RA, 3:i64), GPRC:i64:$RB), i32:Other)
05445   // Emits: (S8SUBL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05446   // Pattern complexity = 9  cost = 1  size = 0
05447   if (N0.getOpcode() == ISD::SUB) {
05448     N00 = N0.getOperand(0);
05449     if (N00.getOpcode() == ISD::SHL) {
05450       N000 = N00.getOperand(0);
05451       N001 = N00.getOperand(1);
05452       if (isa<ConstantSDNode>(N001)) {
05453         int64_t CN0 = cast<ConstantSDNode>(N001)->getSignExtended();
05454         if (CN0 == 3) {
05455           N01 = N0.getOperand(1);
05456           N1 = N.getOperand(1);
05457           if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05458             Emit_76(Result, N, Alpha::S8SUBL, MVT::i64, N0, N00, N000, N001, N01, N1);
05459             return;
05460           }
05461         }
05462       }
05463     }
05464   }
05465   if (N0.getOpcode() == ISD::ADD) {
05466     N00 = N0.getOperand(0);
05467     N01 = N0.getOperand(1);
05468     if (N01.getOpcode() == ISD::SHL) {
05469       N010 = N01.getOperand(0);
05470       N011 = N01.getOperand(1);
05471       if (isa<ConstantSDNode>(N011)) {
05472         int64_t CN0 = cast<ConstantSDNode>(N011)->getSignExtended();
05473 
05474         // Pattern: (sext_inreg:i64 (add:i64 GPRC:i64:$RB, (shl:i64 GPRC:i64:$RA, 2:i64)), i32:Other)
05475         // Emits: (S4ADDL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05476         // Pattern complexity = 9  cost = 1  size = 0
05477         if (CN0 == 2) {
05478           N1 = N.getOperand(1);
05479           if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05480             Emit_77(Result, N, Alpha::S4ADDL, MVT::i64, N0, N00, N01, N010, N011, N1);
05481             return;
05482           }
05483         }
05484 
05485         // Pattern: (sext_inreg:i64 (add:i64 GPRC:i64:$RB, (shl:i64 GPRC:i64:$RA, 3:i64)), i32:Other)
05486         // Emits: (S8ADDL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05487         // Pattern complexity = 9  cost = 1
05488         if (CN0 == 3) {
05489           N1 = N.getOperand(1);
05490           if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05491             Emit_77(Result, N, Alpha::S8ADDL, MVT::i64, N0, N00, N01, N010, N011, N1);
05492             return;
05493           }
05494         }
05495       }
05496     }
05497 
05498     // Pattern: (sext_inreg:i64 (add:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L), i32:Other)
05499     // Emits: (ADDLi:i64 GPRC:i64:$RA, (imm:i64):$L)
05500     // Pattern complexity = 7  cost = 1
05501     if (N01.getOpcode() == ISD::Constant &&
05502         Predicate_immUExt8(N01.Val)) {
05503       N1 = N.getOperand(1);
05504       if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05505         Emit_78(Result, N, Alpha::ADDLi, MVT::i64, N0, N00, N01, N1);
05506         return;
05507       }
05508     }
05509   }
05510 
05511   // Pattern: (sext_inreg:i64 (mul:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L), i32:Other)
05512   // Emits: (MULLi:i64 GPRC:i64:$RA, (imm:i64):$L)
05513   // Pattern complexity = 7  cost = 1  size = 0
05514   if (N0.getOpcode() == ISD::MUL) {
05515     N00 = N0.getOperand(0);
05516     N01 = N0.getOperand(1);
05517     if (N01.getOpcode() == ISD::Constant &&
05518         Predicate_immUExt8(N01.Val)) {
05519       N1 = N.getOperand(1);
05520       if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05521         Emit_78(Result, N, Alpha::MULLi, MVT::i64, N0, N00, N01, N1);
05522         return;
05523       }
05524     }
05525   }
05526   if (N0.getOpcode() == ISD::ADD) {
05527     N00 = N0.getOperand(0);
05528     N01 = N0.getOperand(1);
05529 
05530     // Pattern: (sext_inreg:i64 (add:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8neg>><<X:negX>>:$L), i32:Other)
05531     // Emits: (SUBLi:i64 GPRC:i64:$RA, (negX:i64 (imm:i64):$L))
05532     // Pattern complexity = 7  cost = 1  size = 0
05533     if (N01.getOpcode() == ISD::Constant &&
05534         Predicate_immUExt8neg(N01.Val)) {
05535       N1 = N.getOperand(1);
05536       if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05537         Emit_79(Result, N, Alpha::SUBLi, MVT::i64, N0, N00, N01, N1);
05538         return;
05539       }
05540     }
05541 
05542     // Pattern: (sext_inreg:i64 (add:i64 GPRC:i64:$RA, GPRC:i64:$RB), i32:Other)
05543     // Emits: (ADDL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05544     // Pattern complexity = 4  cost = 1
05545     N1 = N.getOperand(1);
05546     if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05547       Emit_80(Result, N, Alpha::ADDL, MVT::i64, N0, N00, N01, N1);
05548       return;
05549     }
05550   }
05551 
05552   // Pattern: (sext_inreg:i64 (mul:i64 GPRC:i64:$RA, GPRC:i64:$RB), i32:Other)
05553   // Emits: (MULL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05554   // Pattern complexity = 4  cost = 1  size = 0
05555   if (N0.getOpcode() == ISD::MUL) {
05556     N00 = N0.getOperand(0);
05557     N01 = N0.getOperand(1);
05558     N1 = N.getOperand(1);
05559     if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05560       Emit_80(Result, N, Alpha::MULL, MVT::i64, N0, N00, N01, N1);
05561       return;
05562     }
05563   }
05564 
05565   // Pattern: (sext_inreg:i64 (sub:i64 GPRC:i64:$RA, GPRC:i64:$RB), i32:Other)
05566   // Emits: (SUBL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05567   // Pattern complexity = 4  cost = 1  size = 0
05568   if (N0.getOpcode() == ISD::SUB) {
05569     N00 = N0.getOperand(0);
05570     N01 = N0.getOperand(1);
05571     N1 = N.getOperand(1);
05572     if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05573       Emit_80(Result, N, Alpha::SUBL, MVT::i64, N0, N00, N01, N1);
05574       return;
05575     }
05576   }
05577   N1 = N.getOperand(1);
05578 
05579   // Pattern: (sext_inreg:i64 GPRC:i64:$RB, i8:Other)
05580   // Emits: (SEXTB:i64 GPRC:i64:$RB)
05581   // Pattern complexity = 2  cost = 1  size = 0
05582   if (cast<VTSDNode>(N1)->getVT() == MVT::i8) {
05583     Emit_81(Result, N, Alpha::SEXTB, MVT::i64, N0, N1);
05584     return;
05585   }
05586 
05587   // Pattern: (sext_inreg:i64 GPRC:i64:$RB, i16:Other)
05588   // Emits: (SEXTW:i64 GPRC:i64:$RB)
05589   // Pattern complexity = 2  cost = 1  size = 0
05590   if (cast<VTSDNode>(N1)->getVT() == MVT::i16) {
05591     Emit_81(Result, N, Alpha::SEXTW, MVT::i64, N0, N1);
05592     return;
05593   }
05594 
05595   // Pattern: (sext_inreg:i64 GPRC:i64:$RB, i32:Other)
05596   // Emits: (ADDLi:i64 GPRC:i64:$RB, 0:i64)
05597   // Pattern complexity = 2  cost = 1
05598   if (cast<VTSDNode>(N1)->getVT() == MVT::i32) {
05599     Emit_82(Result, N, Alpha::ADDLi, MVT::i64, N0, N1);
05600     return;
05601   }
05602   std::cerr << "Cannot yet select: ";
05603   N.Val->dump(CurDAG);
05604   std::cerr << '\n';
05605   abort();
05606 }
05607 
05608 void Emit_83(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &Chain, SDOperand &N1, SDOperand &N10, SDOperand &N11, SDOperand &N2, SDOperand &N3) NOINLINE {
05609   SDOperand Tmp0(0, 0);
05610   SDOperand Tmp1(0, 0);
05611   SDNode *ResNode = NULL;
05612   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N11.Val);
05613   Tmp0 = N10;
05614   Select(Tmp1, N11);
05615   Select(Chain, Chain);
05616   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N11.Val);
05617   ResNode = CurDAG->getTargetNode(Opc0, VT0, MVT::Other, Tmp0, Tmp1, Chain);
05618   Chain = SDOperand(ResNode, 1);
05619   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, ResNode, 0);
05620   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Chain.Val, Chain.ResNo);
05621   if (N.ResNo == 0) AddHandleReplacement(N.Val, 1, Chain.Val, Chain.ResNo);
05622   Result = SDOperand(ResNode, N.ResNo);
05623   return;
05624 }
05625 void Select_sextld(SDOperand &Result, SDOperand N) {
05626   if (N.ResNo == 1 && N.getValue(0).hasOneUse()) {
05627     SDOperand Dummy = CurDAG->getNode(ISD::HANDLENODE, MVT::Other, N);
05628     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Dummy.Val, 0);
05629     SelectionDAG::InsertISelMapEntry(HandleMap, N.Val, 1, Dummy.Val, 0);
05630     Result = Dummy;
05631     return;
05632   }
05633   SDOperand Chain(0, 0);
05634   SDOperand N1(0, 0);
05635   SDOperand N10(0, 0);
05636   SDOperand N11(0, 0);
05637   SDOperand N2(0, 0);
05638   SDOperand N3(0, 0);
05639   SDOperand Tmp0(0, 0);
05640   SDOperand Tmp1(0, 0);
05641   SDNode *ResNode = NULL;
05642   Chain = N.getOperand(0);
05643   N1 = N.getOperand(1);
05644 
05645   // Pattern: (sextld:i64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i32:Other)
05646   // Emits: (LDL:i64 (imm:i64):$DISP, GPRC:i64:$RB)
05647   // Pattern complexity = 7  cost = 1  size = 0
05648   if (N1.getOpcode() == ISD::ADD) {
05649     N10 = N1.getOperand(0);
05650     N11 = N1.getOperand(1);
05651     if (N11.getOpcode() == ISD::Constant &&
05652         Predicate_immSExt16(N11.Val)) {
05653       N2 = N.getOperand(2);
05654       N3 = N.getOperand(3);
05655       if (cast<VTSDNode>(N3)->getVT() == MVT::i32) {
05656         Emit_27(Result, N, Alpha::LDL, MVT::i64, Chain, N1, N10, N11, N2, N3);
05657         return;
05658       }
05659     }
05660   }
05661   if (N1.getOpcode() == AlphaISD::GPRelLo) {
05662     N10 = N1.getOperand(0);
05663 
05664     // Pattern: (sextld:i64 (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i32:Other)
05665     // Emits: (LDLr:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
05666     // Pattern complexity = 6  cost = 1  size = 0
05667     if (N10.getOpcode() == ISD::TargetGlobalAddress) {
05668       N11 = N1.getOperand(1);
05669       N2 = N.getOperand(2);
05670       N3 = N.getOperand(3);
05671       if (cast<VTSDNode>(N3)->getVT() == MVT::i32) {
05672         Emit_83(Result, N, Alpha::LDLr, MVT::i64, Chain, N1, N10, N11, N2, N3);
05673         return;
05674       }
05675     }
05676 
05677     // Pattern: (sextld:i64 (Alpha_gprello:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i32:Other)
05678     // Emits: (LDLr:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
05679     // Pattern complexity = 6  cost = 1
05680     if (N10.getOpcode() == ISD::TargetConstantPool) {
05681       N11 = N1.getOperand(1);
05682       N2 = N.getOperand(2);
05683       N3 = N.getOperand(3);
05684       if (cast<VTSDNode>(N3)->getVT() == MVT::i32) {
05685         Emit_83(Result, N, Alpha::LDLr, MVT::i64, Chain, N1, N10, N11, N2, N3);
05686         return;
05687       }
05688     }
05689   }
05690 
05691   // Pattern: (sextld:i64 GPRC:i64:$addr, srcvalue:Other:$dummy, i32:Other)
05692   // Emits: (LDL:i64 0:i64, GPRC:i64:$addr)
05693   // Pattern complexity = 2  cost = 1
05694   N2 = N.getOperand(2);
05695   N3 = N.getOperand(3);
05696   if (cast<VTSDNode>(N3)->getVT() == MVT::i32 &&
05697       N1.Val->getValueType(0) == MVT::i64) {
05698     Emit_28(Result, N, Alpha::LDL, MVT::i64, Chain, N1, N2, N3);
05699     return;
05700   }
05701   std::cerr << "Cannot yet select: ";
05702   N.Val->dump(CurDAG);
05703   std::cerr << '\n';
05704   abort();
05705 }
05706 
05707 void Select_shl(SDOperand &Result, SDOperand N) {
05708   SDOperand N0(0, 0);
05709   SDOperand N1(0, 0);
05710   SDOperand Tmp0(0, 0);
05711   SDOperand Tmp1(0, 0);
05712   SDNode *ResNode = NULL;
05713 
05714   // Pattern: (shl:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
05715   // Emits: (SLi:i64 GPRC:i64:$RA, (imm:i64):$L)
05716   // Pattern complexity = 5  cost = 1  size = 0
05717   {
05718     N0 = N.getOperand(0);
05719     N1 = N.getOperand(1);
05720     if (N1.getOpcode() == ISD::Constant &&
05721         Predicate_immUExt8(N1.Val)) {
05722       Emit_6(Result, N, Alpha::SLi, MVT::i64, N0, N1);
05723       return;
05724     }
05725   }
05726 
05727   // Pattern: (shl:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05728   // Emits: (SL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05729   // Pattern complexity = 2  cost = 1
05730   Emit_9(Result, N, Alpha::SL, MVT::i64, N0, N1);
05731   return;
05732 }
05733 
05734 void Select_sra(SDOperand &Result, SDOperand N) {
05735   SDOperand N0(0, 0);
05736   SDOperand N1(0, 0);
05737   SDOperand Tmp0(0, 0);
05738   SDOperand Tmp1(0, 0);
05739   SDNode *ResNode = NULL;
05740 
05741   // Pattern: (sra:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
05742   // Emits: (SRAi:i64 GPRC:i64:$RA, (imm:i64):$L)
05743   // Pattern complexity = 5  cost = 1  size = 0
05744   {
05745     N0 = N.getOperand(0);
05746     N1 = N.getOperand(1);
05747     if (N1.getOpcode() == ISD::Constant &&
05748         Predicate_immUExt8(N1.Val)) {
05749       Emit_6(Result, N, Alpha::SRAi, MVT::i64, N0, N1);
05750       return;
05751     }
05752   }
05753 
05754   // Pattern: (sra:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05755   // Emits: (SRA:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05756   // Pattern complexity = 2  cost = 1
05757   Emit_9(Result, N, Alpha::SRA, MVT::i64, N0, N1);
05758   return;
05759 }
05760 
05761 void Select_srl(SDOperand &Result, SDOperand N) {
05762   SDOperand N0(0, 0);
05763   SDOperand N1(0, 0);
05764   SDOperand Tmp0(0, 0);
05765   SDOperand Tmp1(0, 0);
05766   SDNode *ResNode = NULL;
05767 
05768   // Pattern: (srl:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
05769   // Emits: (SRLi:i64 GPRC:i64:$RA, (imm:i64):$L)
05770   // Pattern complexity = 5  cost = 1  size = 0
05771   {
05772     N0 = N.getOperand(0);
05773     N1 = N.getOperand(1);
05774     if (N1.getOpcode() == ISD::Constant &&
05775         Predicate_immUExt8(N1.Val)) {
05776       Emit_6(Result, N, Alpha::SRLi, MVT::i64, N0, N1);
05777       return;
05778     }
05779   }
05780 
05781   // Pattern: (srl:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05782   // Emits: (SRL:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05783   // Pattern complexity = 2  cost = 1
05784   Emit_9(Result, N, Alpha::SRL, MVT::i64, N0, N1);
05785   return;
05786 }
05787 
05788 void Emit_84(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N2, SDOperand &N20, SDOperand &N21) NOINLINE {
05789   SDOperand Tmp0(0, 0);
05790   SDOperand Tmp1(0, 0);
05791   SDOperand Tmp2(0, 0);
05792   SDNode *ResNode = NULL;
05793   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
05794   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N20.Val);
05795   Select(Tmp0, N1);
05796   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N21)->getValue()), MVT::i64);
05797   Select(Tmp2, N20);
05798   Select(Chain, Chain);
05799   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
05800   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N20.Val);
05801   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Tmp2, Chain);
05802   Chain = SDOperand(ResNode, 0);
05803   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
05804   Result = SDOperand(ResNode, N.ResNo);
05805   return;
05806 }
05807 void Emit_85(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N2, SDOperand &N20, SDOperand &N21) NOINLINE {
05808   SDOperand Tmp0(0, 0);
05809   SDOperand Tmp1(0, 0);
05810   SDOperand Tmp2(0, 0);
05811   SDNode *ResNode = NULL;
05812   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
05813   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N21.Val);
05814   Select(Tmp0, N1);
05815   Tmp1 = N20;
05816   Select(Tmp2, N21);
05817   Select(Chain, Chain);
05818   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
05819   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N21.Val);
05820   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Tmp2, Chain);
05821   Chain = SDOperand(ResNode, 0);
05822   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
05823   Result = SDOperand(ResNode, N.ResNo);
05824   return;
05825 }
05826 void Emit_86(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N2) NOINLINE {
05827   SDOperand Tmp0(0, 0);
05828   SDOperand Tmp1(0, 0);
05829   SDOperand Tmp2(0, 0);
05830   SDNode *ResNode = NULL;
05831   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
05832   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
05833   Select(Tmp0, N1);
05834   Tmp1 = CurDAG->getTargetConstant(0, MVT::i64);
05835   Select(Tmp2, N2);
05836   Select(Chain, Chain);
05837   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
05838   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
05839   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Tmp2, Chain);
05840   Chain = SDOperand(ResNode, 0);
05841   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
05842   Result = SDOperand(ResNode, N.ResNo);
05843   return;
05844 }
05845 void Select_store(SDOperand &Result, SDOperand N) {
05846   SDOperand Chain(0, 0);
05847   SDOperand N1(0, 0);
05848   SDOperand N2(0, 0);
05849   SDOperand N20(0, 0);
05850   SDOperand N21(0, 0);
05851   SDOperand Tmp0(0, 0);
05852   SDOperand Tmp1(0, 0);
05853   SDOperand Tmp2(0, 0);
05854   SDNode *ResNode = NULL;
05855   Chain = N.getOperand(0);
05856   N1 = N.getOperand(1);
05857   N2 = N.getOperand(2);
05858   if (N2.getOpcode() == ISD::ADD) {
05859     N20 = N2.getOperand(0);
05860     N21 = N2.getOperand(1);
05861     if (N21.getOpcode() == ISD::Constant &&
05862         Predicate_immSExt16(N21.Val)) {
05863 
05864       // Pattern: (store:void GPRC:i64:$RA, (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP))
05865       // Emits: (STQ:void GPRC:i64:$RA, (imm:i64):$DISP, GPRC:i64:$RB)
05866       // Pattern complexity = 7  cost = 1  size = 0
05867       if (N1.Val->getValueType(0) == MVT::i64) {
05868         Emit_84(Result, N, Alpha::STQ, Chain, N1, N2, N20, N21);
05869         return;
05870       }
05871 
05872       // Pattern: (store:void F4RC:f32:$RA, (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP))
05873       // Emits: (STS:void F4RC:f32:$RA, (imm:i64):$DISP, GPRC:i64:$RB)
05874       // Pattern complexity = 7  cost = 1  size = 0
05875       if (N1.Val->getValueType(0) == MVT::f32) {
05876         Emit_84(Result, N, Alpha::STS, Chain, N1, N2, N20, N21);
05877         return;
05878       }
05879 
05880       // Pattern: (store:void F8RC:f64:$RA, (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP))
05881       // Emits: (STT:void F8RC:f64:$RA, (imm:i64):$DISP, GPRC:i64:$RB)
05882       // Pattern complexity = 7  cost = 1
05883       if (N1.Val->getValueType(0) == MVT::f64) {
05884         Emit_84(Result, N, Alpha::STT, Chain, N1, N2, N20, N21);
05885         return;
05886       }
05887     }
05888   }
05889   if (N2.getOpcode() == AlphaISD::GPRelLo) {
05890     N20 = N2.getOperand(0);
05891     if (N20.getOpcode() == ISD::TargetGlobalAddress) {
05892       N21 = N2.getOperand(1);
05893 
05894       // Pattern: (store:void GPRC:i64:$RA, (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB))
05895       // Emits: (STQr:void GPRC:i64:$RA, (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
05896       // Pattern complexity = 6  cost = 1  size = 0
05897       if (N1.Val->getValueType(0) == MVT::i64) {
05898         Emit_85(Result, N, Alpha::STQr, Chain, N1, N2, N20, N21);
05899         return;
05900       }
05901 
05902       // Pattern: (store:void F4RC:f32:$RA, (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB))
05903       // Emits: (STSr:void F4RC:f32:$RA, (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
05904       // Pattern complexity = 6  cost = 1  size = 0
05905       if (N1.Val->getValueType(0) == MVT::f32) {
05906         Emit_85(Result, N, Alpha::STSr, Chain, N1, N2, N20, N21);
05907         return;
05908       }
05909 
05910       // Pattern: (store:void F8RC:f64:$RA, (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB))
05911       // Emits: (STTr:void F8RC:f64:$RA, (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
05912       // Pattern complexity = 6  cost = 1
05913       if (N1.Val->getValueType(0) == MVT::f64) {
05914         Emit_85(Result, N, Alpha::STTr, Chain, N1, N2, N20, N21);
05915         return;
05916       }
05917     }
05918   }
05919 
05920   // Pattern: (store:void GPRC:i64:$DATA, GPRC:i64:$addr)
05921   // Emits: (STQ:void GPRC:i64:$DATA, 0:i64, GPRC:i64:$addr)
05922   // Pattern complexity = 2  cost = 1  size = 0
05923   if (N1.Val->getValueType(0) == MVT::i64 &&
05924       N2.Val->getValueType(0) == MVT::i64) {
05925     Emit_86(Result, N, Alpha::STQ, Chain, N1, N2);
05926     return;
05927   }
05928 
05929   // Pattern: (store:void F8RC:f64:$DATA, GPRC:i64:$addr)
05930   // Emits: (STT:void F8RC:f64:$DATA, 0:i64, GPRC:i64:$addr)
05931   // Pattern complexity = 2  cost = 1  size = 0
05932   if (N1.Val->getValueType(0) == MVT::f64 &&
05933       N2.Val->getValueType(0) == MVT::i64) {
05934     Emit_86(Result, N, Alpha::STT, Chain, N1, N2);
05935     return;
05936   }
05937 
05938   // Pattern: (store:void F4RC:f32:$DATA, GPRC:i64:$addr)
05939   // Emits: (STS:void F4RC:f32:$DATA, 0:i64, GPRC:i64:$addr)
05940   // Pattern complexity = 2  cost = 1
05941   if (N1.Val->getValueType(0) == MVT::f32 &&
05942       N2.Val->getValueType(0) == MVT::i64) {
05943     Emit_86(Result, N, Alpha::STS, Chain, N1, N2);
05944     return;
05945   }
05946   std::cerr << "Cannot yet select: ";
05947   N.Val->dump(CurDAG);
05948   std::cerr << '\n';
05949   abort();
05950 }
05951 
05952 void Select_sub(SDOperand &Result, SDOperand N) {
05953   SDOperand N0(0, 0);
05954   SDOperand N00(0, 0);
05955   SDOperand N01(0, 0);
05956   SDOperand N1(0, 0);
05957   SDOperand Tmp0(0, 0);
05958   SDOperand Tmp1(0, 0);
05959   SDOperand Tmp2(0, 0);
05960   SDNode *ResNode = NULL;
05961   {
05962     N0 = N.getOperand(0);
05963     if (N0.getOpcode() == ISD::SHL) {
05964       N00 = N0.getOperand(0);
05965       N01 = N0.getOperand(1);
05966       if (isa<ConstantSDNode>(N01)) {
05967         int64_t CN0 = cast<ConstantSDNode>(N01)->getSignExtended();
05968         if (CN0 == 2) {
05969 
05970           // Pattern: (sub:i64 (shl:i64 GPRC:i64:$RA, 2:i64), (imm:i64)<<P:Predicate_immUExt8>>:$L)
05971           // Emits: (S4SUBQi:i64 GPRC:i64:$RA, (imm:i64):$L)
05972           // Pattern complexity = 10  cost = 1  size = 0
05973           {
05974             N1 = N.getOperand(1);
05975             if (N1.getOpcode() == ISD::Constant &&
05976                 Predicate_immUExt8(N1.Val)) {
05977               Emit_2(Result, N, Alpha::S4SUBQi, MVT::i64, N0, N00, N01, N1);
05978               return;
05979             }
05980           }
05981 
05982           // Pattern: (sub:i64 (shl:i64 GPRC:i64:$RA, 2:i64), GPRC:i64:$RB)
05983           // Emits: (S4SUBQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05984           // Pattern complexity = 7  cost = 1
05985           Emit_4(Result, N, Alpha::S4SUBQ, MVT::i64, N0, N00, N01, N1);
05986           return;
05987         }
05988 
05989         // Pattern: (sub:i64 (shl:i64 GPRC:i64:$RA, 3:i64), GPRC:i64:$RB)
05990         // Emits: (S8SUBQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
05991         // Pattern complexity = 7  cost = 1
05992         if (CN0 == 3) {
05993           Emit_4(Result, N, Alpha::S8SUBQ, MVT::i64, N0, N00, N01, N1);
05994           return;
05995         }
05996       }
05997     }
05998   }
05999 
06000   // Pattern: (sub:i64 GPRC:i64:$RA, GPRC:i64:$RB)
06001   // Emits: (SUBQ:i64 GPRC:i64:$RA, GPRC:i64:$RB)
06002   // Pattern complexity = 2  cost = 1
06003   Emit_9(Result, N, Alpha::SUBQ, MVT::i64, N0, N1);
06004   return;
06005 }
06006 
06007 void Emit_87(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N2, SDOperand &N20, SDOperand &N21, SDOperand &N3, SDOperand &N4) NOINLINE {
06008   SDOperand Tmp0(0, 0);
06009   SDOperand Tmp1(0, 0);
06010   SDOperand Tmp2(0, 0);
06011   SDNode *ResNode = NULL;
06012   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
06013   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N20.Val);
06014   Select(Tmp0, N1);
06015   Tmp1 = CurDAG->getTargetConstant(((uint64_t) cast<ConstantSDNode>(N21)->getValue()), MVT::i64);
06016   Select(Tmp2, N20);
06017   Select(Chain, Chain);
06018   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
06019   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N20.Val);
06020   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Tmp2, Chain);
06021   Chain = SDOperand(ResNode, 0);
06022   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
06023   Result = SDOperand(ResNode, N.ResNo);
06024   return;
06025 }
06026 void Emit_88(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N2, SDOperand &N20, SDOperand &N21, SDOperand &N3, SDOperand &N4) NOINLINE {
06027   SDOperand Tmp0(0, 0);
06028   SDOperand Tmp1(0, 0);
06029   SDOperand Tmp2(0, 0);
06030   SDNode *ResNode = NULL;
06031   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
06032   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N21.Val);
06033   Select(Tmp0, N1);
06034   Tmp1 = N20;
06035   Select(Tmp2, N21);
06036   Select(Chain, Chain);
06037   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
06038   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N21.Val);
06039   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Tmp2, Chain);
06040   Chain = SDOperand(ResNode, 0);
06041   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
06042   Result = SDOperand(ResNode, N.ResNo);
06043   return;
06044 }
06045 void Emit_89(SDOperand &Result, SDOperand &N, unsigned Opc0, SDOperand &Chain, SDOperand &N1, SDOperand &N2, SDOperand &N3, SDOperand &N4) NOINLINE {
06046   SDOperand Tmp0(0, 0);
06047   SDOperand Tmp1(0, 0);
06048   SDOperand Tmp2(0, 0);
06049   SDNode *ResNode = NULL;
06050   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
06051   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N2.Val);
06052   Select(Tmp0, N1);
06053   Tmp1 = CurDAG->getTargetConstant(0, MVT::i64);
06054   Select(Tmp2, N2);
06055   Select(Chain, Chain);
06056   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
06057   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N2.Val);
06058   ResNode = CurDAG->getTargetNode(Opc0, MVT::Other, Tmp0, Tmp1, Tmp2, Chain);
06059   Chain = SDOperand(ResNode, 0);
06060   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Chain.Val, Chain.ResNo);
06061   Result = SDOperand(ResNode, N.ResNo);
06062   return;
06063 }
06064 void Select_truncst(SDOperand &Result, SDOperand N) {
06065   SDOperand Chain(0, 0);
06066   SDOperand N1(0, 0);
06067   SDOperand N2(0, 0);
06068   SDOperand N20(0, 0);
06069   SDOperand N21(0, 0);
06070   SDOperand N3(0, 0);
06071   SDOperand N4(0, 0);
06072   SDOperand Tmp0(0, 0);
06073   SDOperand Tmp1(0, 0);
06074   SDOperand Tmp2(0, 0);
06075   SDNode *ResNode = NULL;
06076   Chain = N.getOperand(0);
06077   N1 = N.getOperand(1);
06078   N2 = N.getOperand(2);
06079   if (N2.getOpcode() == ISD::ADD) {
06080     N20 = N2.getOperand(0);
06081     N21 = N2.getOperand(1);
06082     if (N21.getOpcode() == ISD::Constant &&
06083         Predicate_immSExt16(N21.Val)) {
06084       N3 = N.getOperand(3);
06085       N4 = N.getOperand(4);
06086 
06087       // Pattern: (truncst:void GPRC:i64:$RA, (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i8:Other)
06088       // Emits: (STB:void GPRC:i64:$RA, (imm:i64):$DISP, GPRC:i64:$RB)
06089       // Pattern complexity = 7  cost = 1  size = 0
06090       if (cast<VTSDNode>(N4)->getVT() == MVT::i8 &&
06091           N1.Val->getValueType(0) == MVT::i64) {
06092         Emit_87(Result, N, Alpha::STB, Chain, N1, N2, N20, N21, N3, N4);
06093         return;
06094       }
06095 
06096       // Pattern: (truncst:void GPRC:i64:$RA, (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i16:Other)
06097       // Emits: (STW:void GPRC:i64:$RA, (imm:i64):$DISP, GPRC:i64:$RB)
06098       // Pattern complexity = 7  cost = 1  size = 0
06099       if (cast<VTSDNode>(N4)->getVT() == MVT::i16 &&
06100           N1.Val->getValueType(0) == MVT::i64) {
06101         Emit_87(Result, N, Alpha::STW, Chain, N1, N2, N20, N21, N3, N4);
06102         return;
06103       }
06104 
06105       // Pattern: (truncst:void GPRC:i64:$RA, (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i32:Other)
06106       // Emits: (STL:void GPRC:i64:$RA, (imm:i64):$DISP, GPRC:i64:$RB)
06107       // Pattern complexity = 7  cost = 1
06108       if (cast<VTSDNode>(N4)->getVT() == MVT::i32 &&
06109           N1.Val->getValueType(0) == MVT::i64) {
06110         Emit_87(Result, N, Alpha::STL, Chain, N1, N2, N20, N21, N3, N4);
06111         return;
06112       }
06113     }
06114   }
06115   if (N2.getOpcode() == AlphaISD::GPRelLo) {
06116     N20 = N2.getOperand(0);
06117     if (N20.getOpcode() == ISD::TargetGlobalAddress) {
06118       N21 = N2.getOperand(1);
06119       N3 = N.getOperand(3);
06120       N4 = N.getOperand(4);
06121 
06122       // Pattern: (truncst:void GPRC:i64:$RA, (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i8:Other)
06123       // Emits: (STBr:void GPRC:i64:$RA, (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
06124       // Pattern complexity = 6  cost = 1  size = 0
06125       if (cast<VTSDNode>(N4)->getVT() == MVT::i8 &&
06126           N1.Val->getValueType(0) == MVT::i64) {
06127         Emit_88(Result, N, Alpha::STBr, Chain, N1, N2, N20, N21, N3, N4);
06128         return;
06129       }
06130 
06131       // Pattern: (truncst:void GPRC:i64:$RA, (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i16:Other)
06132       // Emits: (STWr:void GPRC:i64:$RA, (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
06133       // Pattern complexity = 6  cost = 1  size = 0
06134       if (cast<VTSDNode>(N4)->getVT() == MVT::i16 &&
06135           N1.Val->getValueType(0) == MVT::i64) {
06136         Emit_88(Result, N, Alpha::STWr, Chain, N1, N2, N20, N21, N3, N4);
06137         return;
06138       }
06139 
06140       // Pattern: (truncst:void GPRC:i64:$RA, (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i32:Other)
06141       // Emits: (STLr:void GPRC:i64:$RA, (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
06142       // Pattern complexity = 6  cost = 1
06143       if (cast<VTSDNode>(N4)->getVT() == MVT::i32 &&
06144           N1.Val->getValueType(0) == MVT::i64) {
06145         Emit_88(Result, N, Alpha::STLr, Chain, N1, N2, N20, N21, N3, N4);
06146         return;
06147       }
06148     }
06149   }
06150   N3 = N.getOperand(3);
06151   N4 = N.getOperand(4);
06152 
06153   // Pattern: (truncst:void GPRC:i64:$DATA, GPRC:i64:$addr, srcvalue:Other:$dummy, i32:Other)
06154   // Emits: (STL:void GPRC:i64:$DATA, 0:i64, GPRC:i64:$addr)
06155   // Pattern complexity = 2  cost = 1  size = 0
06156   if (cast<VTSDNode>(N4)->getVT() == MVT::i32 &&
06157       N1.Val->getValueType(0) == MVT::i64 &&
06158       N2.Val->getValueType(0) == MVT::i64) {
06159     Emit_89(Result, N, Alpha::STL, Chain, N1, N2, N3, N4);
06160     return;
06161   }
06162 
06163   // Pattern: (truncst:void GPRC:i64:$DATA, GPRC:i64:$addr, srcvalue:Other:$dummy, i16:Other)
06164   // Emits: (STW:void GPRC:i64:$DATA, 0:i64, GPRC:i64:$addr)
06165   // Pattern complexity = 2  cost = 1  size = 0
06166   if (cast<VTSDNode>(N4)->getVT() == MVT::i16 &&
06167       N1.Val->getValueType(0) == MVT::i64 &&
06168       N2.Val->getValueType(0) == MVT::i64) {
06169     Emit_89(Result, N, Alpha::STW, Chain, N1, N2, N3, N4);
06170     return;
06171   }
06172 
06173   // Pattern: (truncst:void GPRC:i64:$DATA, GPRC:i64:$addr, srcvalue:Other:$dummy, i8:Other)
06174   // Emits: (STB:void GPRC:i64:$DATA, 0:i64, GPRC:i64:$addr)
06175   // Pattern complexity = 2  cost = 1
06176   if (cast<VTSDNode>(N4)->getVT() == MVT::i8 &&
06177       N1.Val->getValueType(0) == MVT::i64 &&
06178       N2.Val->getValueType(0) == MVT::i64) {
06179     Emit_89(Result, N, Alpha::STB, Chain, N1, N2, N3, N4);
06180     return;
06181   }
06182   std::cerr << "Cannot yet select: ";
06183   N.Val->dump(CurDAG);
06184   std::cerr << '\n';
06185   abort();
06186 }
06187 
06188 void Emit_90(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0) NOINLINE {
06189   SDNode *ResNode = NULL;
06190   if (N.Val->hasOneUse()) {
06191     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0);
06192   } else {
06193     ResNode = CurDAG->getTargetNode(Opc0, VT0);
06194     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
06195     Result = SDOperand(ResNode, 0);
06196   }
06197   return;
06198 }
06199 void Select_undef(SDOperand &Result, SDOperand N) {
06200   SDNode *ResNode = NULL;
06201 
06202   // Pattern: (undef:i64)
06203   // Emits: (IDEF_I:i64)
06204   // Pattern complexity = 2  cost = 1  size = 0
06205   if (N.Val->getValueType(0) == MVT::i64) {
06206     Emit_90(Result, N, Alpha::IDEF_I, MVT::i64);
06207     return;
06208   }
06209 
06210   // Pattern: (undef:f32)
06211   // Emits: (IDEF_F32:f32)
06212   // Pattern complexity = 2  cost = 1  size = 0
06213   if (N.Val->getValueType(0) == MVT::f32) {
06214     Emit_90(Result, N, Alpha::IDEF_F32, MVT::f32);
06215     return;
06216   }
06217 
06218   // Pattern: (undef:f64)
06219   // Emits: (IDEF_F64:f64)
06220   // Pattern complexity = 2  cost = 1
06221   if (N.Val->getValueType(0) == MVT::f64) {
06222     Emit_90(Result, N, Alpha::IDEF_F64, MVT::f64);
06223     return;
06224   }
06225   std::cerr << "Cannot yet select: ";
06226   N.Val->dump(CurDAG);
06227   std::cerr << '\n';
06228   abort();
06229 }
06230 
06231 void Emit_91(SDOperand &Result, SDOperand &N, unsigned Opc0, MVT::ValueType VT0, SDOperand &N0, SDOperand &N00, SDOperand &N01, SDOperand &N1) NOINLINE {
06232   SDOperand Tmp0(0, 0);
06233   SDOperand Tmp1(0, 0);
06234   SDNode *ResNode = NULL;
06235   N1 = N.getOperand(1);
06236   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N00.Val);
06237   SelectionDAG::InsertInFlightSetEntry(InFlightSet, N1.Val);
06238   Select(Tmp0, N00);
06239   Select(Tmp1, N1);
06240   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N00.Val);
06241   SelectionDAG::RemoveInFlightSetEntry(InFlightSet, N1.Val);
06242   if (N.Val->hasOneUse()) {
06243     Result = CurDAG->SelectNodeTo(N.Val, Opc0, VT0, Tmp0, Tmp1);
06244   } else {
06245     ResNode = CurDAG->getTargetNode(Opc0, VT0, Tmp0, Tmp1);
06246     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, ResNode, 0);
06247     Result = SDOperand(ResNode, 0);
06248   }
06249   return;
06250 }
06251 void Select_xor(SDOperand &Result, SDOperand N) {
06252   SDOperand N0(0, 0);
06253   SDOperand N00(0, 0);
06254   SDOperand N01(0, 0);
06255   SDOperand N1(0, 0);
06256   SDOperand N10(0, 0);
06257   SDOperand N11(0, 0);
06258   SDOperand Tmp0(0, 0);
06259   SDOperand Tmp1(0, 0);
06260   SDOperand Tmp2(0, 0);
06261   SDNode *ResNode = NULL;
06262   {
06263     N0 = N.getOperand(0);
06264 
06265     // Pattern: (xor:i64 GPRC:i64:$RA, (xor:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immAllOnes>>))
06266     // Emits: (EQV:i64 GPRC:i64:$RA, GPRC:i64:$RB)
06267     // Pattern complexity = 7  cost = 1  size = 0
06268     {
06269       N1 = N.getOperand(1);
06270       if (N1.getOpcode() == ISD::XOR) {
06271         N10 = N1.getOperand(0);
06272         N11 = N1.getOperand(1);
06273         if (N11.getOpcode() == ISD::Constant &&
06274             Predicate_immAllOnes(N11.Val)) {
06275           Emit_12(Result, N, Alpha::EQV, MVT::i64, N0, N1, N10, N11);
06276           return;
06277         }
06278       }
06279     }
06280 
06281     // Pattern: (xor:i64 (xor:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immAllOnes>>), GPRC:i64:$RB)
06282     // Emits: (EQV:i64 GPRC:i64:$RA, GPRC:i64:$RB)
06283     // Pattern complexity = 7  cost = 1  size = 0
06284     if (N0.getOpcode() == ISD::XOR) {
06285       N00 = N0.getOperand(0);
06286       N01 = N0.getOperand(1);
06287       if (N01.getOpcode() == ISD::Constant &&
06288           Predicate_immAllOnes(N01.Val)) {
06289         Emit_91(Result, N, Alpha::EQV, MVT::i64, N0, N00, N01, N1);
06290         return;
06291       }
06292     }
06293     N1 = N.getOperand(1);
06294     if (N1.getOpcode() == ISD::Constant) {
06295 
06296       // Pattern: (xor:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8inv>><<X:invX>>:$L)
06297       // Emits: (EQVi:i64 GPRC:i64:$RA, (invX:i64 (imm:i64):$L))
06298       // Pattern complexity = 5  cost = 1  size = 0
06299       if (Predicate_immUExt8inv(N1.Val)) {
06300         Emit_14(Result, N, Alpha::EQVi, MVT::i64, N0, N1);
06301         return;
06302       }
06303 
06304       // Pattern: (xor:i64 GPRC:i64:$RA, (imm:i64)<<P:Predicate_immUExt8>>:$L)
06305       // Emits: (XORi:i64 GPRC:i64:$RA, (imm:i64):$L)
06306       // Pattern complexity = 5  cost = 1
06307       if (Predicate_immUExt8(N1.Val)) {
06308         Emit_6(Result, N, Alpha::XORi, MVT::i64, N0, N1);
06309         return;
06310       }
06311     }
06312   }
06313 
06314   // Pattern: (xor:i64 GPRC:i64:$RA, GPRC:i64:$RB)
06315   // Emits: (XOR:i64 GPRC:i64:$RA, GPRC:i64:$RB)
06316   // Pattern complexity = 2  cost = 1
06317   Emit_9(Result, N, Alpha::XOR, MVT::i64, N0, N1);
06318   return;
06319 }
06320 
06321 void Select_zextld(SDOperand &Result, SDOperand N) {
06322   if (N.ResNo == 1 && N.getValue(0).hasOneUse()) {
06323     SDOperand Dummy = CurDAG->getNode(ISD::HANDLENODE, MVT::Other, N);
06324     SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Dummy.Val, 0);
06325     SelectionDAG::InsertISelMapEntry(HandleMap, N.Val, 1, Dummy.Val, 0);
06326     Result = Dummy;
06327     return;
06328   }
06329   SDOperand Chain(0, 0);
06330   SDOperand N1(0, 0);
06331   SDOperand N10(0, 0);
06332   SDOperand N11(0, 0);
06333   SDOperand N2(0, 0);
06334   SDOperand N3(0, 0);
06335   SDOperand Tmp0(0, 0);
06336   SDOperand Tmp1(0, 0);
06337   SDNode *ResNode = NULL;
06338   Chain = N.getOperand(0);
06339   N1 = N.getOperand(1);
06340   if (N1.getOpcode() == ISD::ADD) {
06341     N10 = N1.getOperand(0);
06342     N11 = N1.getOperand(1);
06343     if (N11.getOpcode() == ISD::Constant &&
06344         Predicate_immSExt16(N11.Val)) {
06345       N2 = N.getOperand(2);
06346       N3 = N.getOperand(3);
06347 
06348       // Pattern: (zextld:i64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i8:Other)
06349       // Emits: (LDBU:i64 (imm:i64):$DISP, GPRC:i64:$RB)
06350       // Pattern complexity = 7  cost = 1  size = 0
06351       if (cast<VTSDNode>(N3)->getVT() == MVT::i8) {
06352         Emit_27(Result, N, Alpha::LDBU, MVT::i64, Chain, N1, N10, N11, N2, N3);
06353         return;
06354       }
06355 
06356       // Pattern: (zextld:i64 (add:i64 GPRC:i64:$RB, (imm:i64)<<P:Predicate_immSExt16>>:$DISP), srcvalue:Other:$dummy, i16:Other)
06357       // Emits: (LDWU:i64 (imm:i64):$DISP, GPRC:i64:$RB)
06358       // Pattern complexity = 7  cost = 1
06359       if (cast<VTSDNode>(N3)->getVT() == MVT::i16) {
06360         Emit_27(Result, N, Alpha::LDWU, MVT::i64, Chain, N1, N10, N11, N2, N3);
06361         return;
06362       }
06363     }
06364   }
06365   if (N1.getOpcode() == AlphaISD::GPRelLo) {
06366     N10 = N1.getOperand(0);
06367     if (N10.getOpcode() == ISD::TargetGlobalAddress) {
06368       N11 = N1.getOperand(1);
06369       N2 = N.getOperand(2);
06370       N3 = N.getOperand(3);
06371 
06372       // Pattern: (zextld:i64 (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i8:Other)
06373       // Emits: (LDBUr:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
06374       // Pattern complexity = 6  cost = 1  size = 0
06375       if (cast<VTSDNode>(N3)->getVT() == MVT::i8) {
06376         Emit_83(Result, N, Alpha::LDBUr, MVT::i64, Chain, N1, N10, N11, N2, N3);
06377         return;
06378       }
06379 
06380       // Pattern: (zextld:i64 (Alpha_gprello:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i16:Other)
06381       // Emits: (LDWUr:i64 (tglobaladdr:i64):$DISP, GPRC:i64:$RB)
06382       // Pattern complexity = 6  cost = 1
06383       if (cast<VTSDNode>(N3)->getVT() == MVT::i16) {
06384         Emit_83(Result, N, Alpha::LDWUr, MVT::i64, Chain, N1, N10, N11, N2, N3);
06385         return;
06386       }
06387     }
06388     if (N10.getOpcode() == ISD::TargetConstantPool) {
06389       N11 = N1.getOperand(1);
06390       N2 = N.getOperand(2);
06391       N3 = N.getOperand(3);
06392 
06393       // Pattern: (zextld:i64 (Alpha_gprello:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i8:Other)
06394       // Emits: (LDBUr:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
06395       // Pattern complexity = 6  cost = 1  size = 0
06396       if (cast<VTSDNode>(N3)->getVT() == MVT::i8) {
06397         Emit_83(Result, N, Alpha::LDBUr, MVT::i64, Chain, N1, N10, N11, N2, N3);
06398         return;
06399       }
06400 
06401       // Pattern: (zextld:i64 (Alpha_gprello:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB), srcvalue:Other:$dummy, i16:Other)
06402       // Emits: (LDWUr:i64 (tconstpool:i64):$DISP, GPRC:i64:$RB)
06403       // Pattern complexity = 6  cost = 1
06404       if (cast<VTSDNode>(N3)->getVT() == MVT::i16) {
06405         Emit_83(Result, N, Alpha::LDWUr, MVT::i64, Chain, N1, N10, N11, N2, N3);
06406         return;
06407       }
06408     }
06409   }
06410   N2 = N.getOperand(2);
06411   N3 = N.getOperand(3);
06412 
06413   // Pattern: (zextld:i64 GPRC:i64:$addr, srcvalue:Other:$dummy, i16:Other)
06414   // Emits: (LDWU:i64 0:i64, GPRC:i64:$addr)
06415   // Pattern complexity = 2  cost = 1  size = 0
06416   if (cast<VTSDNode>(N3)->getVT() == MVT::i16 &&
06417       N1.Val->getValueType(0) == MVT::i64) {
06418     Emit_28(Result, N, Alpha::LDWU, MVT::i64, Chain, N1, N2, N3);
06419     return;
06420   }
06421 
06422   // Pattern: (zextld:i64 GPRC:i64:$addr, srcvalue:Other:$dummy, i8:Other)
06423   // Emits: (LDBU:i64 0:i64, GPRC:i64:$addr)
06424   // Pattern complexity = 2  cost = 1
06425   if (cast<VTSDNode>(N3)->getVT() == MVT::i8 &&
06426       N1.Val->getValueType(0) == MVT::i64) {
06427     Emit_28(Result, N, Alpha::LDBU, MVT::i64, Chain, N1, N2, N3);
06428     return;
06429   }
06430   std::cerr << "Cannot yet select: ";
06431   N.Val->dump(CurDAG);
06432   std::cerr << '\n';
06433   abort();
06434 }
06435 
06436 void Select_INLINEASM(SDOperand& Result, SDOperand N) {
06437   std::vector<SDOperand> Ops(N.Val->op_begin(), N.Val->op_end());
06438   Select(Ops[0], N.getOperand(0)); // Select the chain.
06439 
06440   // Select the flag operand.
06441   if (Ops.back().getValueType() == MVT::Flag)
06442     Select(Ops.back(), Ops.back());
06443   SelectInlineAsmMemoryOperands(Ops, *CurDAG);
06444   std::vector<MVT::ValueType> VTs;
06445   VTs.push_back(MVT::Other);
06446   VTs.push_back(MVT::Flag);
06447   SDOperand New = CurDAG->getNode(ISD::INLINEASM, VTs, Ops);
06448   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, New.Val, 0);
06449   SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, New.Val, 1);
06450   Result = New.getValue(N.ResNo);
06451   return;
06452 }
06453 
06454 // The main instruction selector code.
06455 void SelectCode(SDOperand &Result, SDOperand N) {
06456   if (N.getOpcode() >= ISD::BUILTIN_OP_END &&
06457       N.getOpcode() < (ISD::BUILTIN_OP_END+Alpha::INSTRUCTION_LIST_END)) {
06458     Result = N;
06459     return;   // Already selected.
06460   }
06461 
06462   std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);
06463   if (CGMI != CodeGenMap.end()) {
06464     Result = CGMI->second;
06465     return;
06466   }
06467 
06468   switch (N.getOpcode()) {
06469   default: break;
06470   case ISD::EntryToken:       // These leaves remain the same.
06471   case ISD::BasicBlock:
06472   case ISD::Register:
06473   case ISD::HANDLENODE:
06474   case ISD::TargetConstant:
06475   case ISD::TargetConstantPool:
06476   case ISD::TargetFrameIndex:
06477   case ISD::TargetJumpTable:
06478   case ISD::TargetGlobalAddress: {
06479     Result = N;
06480     return;
06481   }
06482   case ISD::AssertSext:
06483   case ISD::AssertZext: {
06484     SDOperand Tmp0;
06485     Select(Tmp0, N.getOperand(0));
06486     if (!N.Val->hasOneUse())
06487       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, Tmp0.Val, Tmp0.ResNo);
06488     Result = Tmp0;
06489     return;
06490   }
06491   case ISD::TokenFactor:
06492     if (N.getNumOperands() == 2) {
06493       SDOperand Op0, Op1;
06494       Select(Op0, N.getOperand(0));
06495       Select(Op1, N.getOperand(1));
06496       Result = 
06497           CurDAG->getNode(ISD::TokenFactor, MVT::Other, Op0, Op1);
06498       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, Result.Val, Result.ResNo);
06499     } else {
06500       std::vector<SDOperand> Ops;
06501       for (unsigned i = 0, e = N.getNumOperands(); i != e; ++i) {
06502         SDOperand Val;
06503         Select(Val, N.getOperand(i));
06504         Ops.push_back(Val);
06505       }
06506       Result = 
06507           CurDAG->getNode(ISD::TokenFactor, MVT::Other, Ops);
06508       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, N.ResNo, Result.Val, Result.ResNo);
06509     }
06510     return;
06511   case ISD::CopyFromReg: {
06512     SDOperand Chain;
06513     Select(Chain, N.getOperand(0));
06514     unsigned Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();
06515     MVT::ValueType VT = N.Val->getValueType(0);
06516     if (N.Val->getNumValues() == 2) {
06517       if (Chain == N.getOperand(0)) {
06518         Result = N; // No change
06519         return;
06520       }
06521       SDOperand New = CurDAG->getCopyFromReg(Chain, Reg, VT);
06522       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, New.Val, 0);
06523       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, New.Val, 1);
06524       Result = New.getValue(N.ResNo);
06525       return;
06526     } else {
06527       SDOperand Flag;
06528       if (N.getNumOperands() == 3) Select(Flag, N.getOperand(2));
06529       if (Chain == N.getOperand(0) &&
06530           (N.getNumOperands() == 2 || Flag == N.getOperand(2))) {
06531         Result = N; // No change
06532         return;
06533       }
06534       SDOperand New = CurDAG->getCopyFromReg(Chain, Reg, VT, Flag);
06535       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, New.Val, 0);
06536       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, New.Val, 1);
06537       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 2, New.Val, 2);
06538       Result = New.getValue(N.ResNo);
06539       return;
06540     }
06541   }
06542   case ISD::CopyToReg: {
06543     SDOperand Chain;
06544     Select(Chain, N.getOperand(0));
06545     unsigned Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();
06546     SDOperand Val;
06547     Select(Val, N.getOperand(2));
06548     Result = N;
06549     if (N.Val->getNumValues() == 1) {
06550       if (Chain != N.getOperand(0) || Val != N.getOperand(2))
06551         Result = CurDAG->getCopyToReg(Chain, Reg, Val);
06552       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Result.Val, 0);
06553     } else {
06554       SDOperand Flag(0, 0);
06555       if (N.getNumOperands() == 4) Select(Flag, N.getOperand(3));
06556       if (Chain != N.getOperand(0) || Val != N.getOperand(2) ||
06557           (N.getNumOperands() == 4 && Flag != N.getOperand(3)))
06558         Result = CurDAG->getCopyToReg(Chain, Reg, Val, Flag);
06559       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 0, Result.Val, 0);
06560       SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, 1, Result.Val, 1);
06561       Result = Result.getValue(N.ResNo);
06562     }
06563     return;
06564   }
06565   case ISD::INLINEASM:  Select_INLINEASM(Result, N); return;
06566   case AlphaISD::CVTQS_:         Select_Alpha_cvtqs(Result, N); return;
06567   case AlphaISD::CVTQT_:         Select_Alpha_cvtqt(Result, N); return;
06568   case AlphaISD::CVTTQ_:         Select_Alpha_cvttq(Result, N); return;
06569   case AlphaISD::FTOIT_:         Select_Alpha_ftoit(Result, N); return;
06570   case AlphaISD::GPRelHi:        Select_Alpha_gprelhi(Result, N); return;
06571   case AlphaISD::GPRelLo:        Select_Alpha_gprello(Result, N); return;
06572   case AlphaISD::ITOFT_:         Select_Alpha_itoft(Result, N); return;
06573   case AlphaISD::RelLit:         Select_Alpha_rellit(Result, N); return;
06574   case ISD::ADD:                 Select_add(Result, N); return;
06575   case ISD::AND:                 Select_and(Result, N); return;
06576   case ISD::BR:                  Select_br(Result, N); return;
06577   case ISD::BRCOND:              Select_brcond(Result, N); return;
06578   case ISD::CALLSEQ_END:         Select_callseq_end(Result, N); return;
06579   case ISD::CALLSEQ_START:       Select_callseq_start(Result, N); return;
06580   case ISD::CTLZ:                Select_ctlz(Result, N); return;
06581   case ISD::CTPOP:               Select_ctpop(Result, N); return;
06582   case ISD::CTTZ:                Select_cttz(Result, N); return;
06583   case ISD::EXTLOAD:             Select_extld(Result, N); return;
06584   case ISD::FABS:                Select_fabs(Result, N); return;
06585   case ISD::FADD:                Select_fadd(Result, N); return;
06586   case ISD::FCOPYSIGN:           Select_fcopysign(Result, N); return;
06587   case ISD::FDIV:                Select_fdiv(Result, N); return;
06588   case ISD::FP_EXTEND:           Select_fextend(Result, N); return;
06589   case ISD::FMUL:                Select_fmul(Result, N); return;
06590   case ISD::FNEG:                Select_fneg(Result, N); return;
06591   case ISD::FP_ROUND:            Select_fround(Result, N); return;
06592   case ISD::FSQRT:               Select_fsqrt(Result, N); return;
06593   case ISD::FSUB:                Select_fsub(Result, N); return;
06594   case ISD::Constant:            Select_imm(Result, N); return;
06595   case ISD::LOAD:                Select_load(Result, N); return;
06596   case ISD::MUL:                 Select_mul(Result, N); return;
06597   case ISD::MULHS:               Select_mulhs(Result, N); return;
06598   case ISD::MULHU:               Select_mulhu(Result, N); return;
06599   case ISD::OR:                  Select_or(Result, N); return;
06600   case AlphaISD::RET_FLAG:       Select_retflag(Result, N); return;
06601   case ISD::SELECT:              Select_select(Result, N); return;
06602   case ISD::SETCC:               Select_setcc(Result, N); return;
06603   case ISD::SIGN_EXTEND_INREG:   Select_sext_inreg(Result, N); return;
06604   case ISD::SEXTLOAD:            Select_sextld(Result, N); return;
06605   case ISD::SHL:                 Select_shl(Result, N); return;
06606   case ISD::SRA:                 Select_sra(Result, N); return;
06607   case ISD::SRL:                 Select_srl(Result, N); return;
06608   case ISD::STORE:               Select_store(Result, N); return;
06609   case ISD::SUB:                 Select_sub(Result, N); return;
06610   case ISD::TRUNCSTORE:          Select_truncst(Result, N); return;
06611   case ISD::UNDEF:               Select_undef(Result, N); return;
06612   case ISD::XOR:                 Select_xor(Result, N); return;
06613   case ISD::ZEXTLOAD:            Select_zextld(Result, N); return;
06614   } // end of big switch.
06615 
06616   std::cerr << "Cannot yet select: ";
06617   if (N.getOpcode() != ISD::INTRINSIC_W_CHAIN &&
06618       N.getOpcode() != ISD::INTRINSIC_WO_CHAIN &&
06619       N.getOpcode() != ISD::INTRINSIC_VOID) {
06620     N.Val->dump(CurDAG);
06621   } else {
06622     unsigned iid = cast<ConstantSDNode>(N.getOperand(N.getOperand(0).getValueType() == MVT::Other))->getValue();
06623     std::cerr << "intrinsic %"<< Intrinsic::getName((Intrinsic::ID)iid);
06624   }
06625   std::cerr << '\n';
06626   abort();
06627 }