Use MVN for ~t2_so_imm immediates.
[oota-llvm.git] / lib / Target / Alpha / AlphaInstrInfo.td
index c4e6edc2e10bcc23c85d3875616b2718b7600f08..e73bdf9f6e9156b8142bc5498265f52537e4de5a 100644 (file)
@@ -69,7 +69,7 @@ def nearP2X : SDNodeXForm<imm, [{
 }]>;
 def nearP2RemX : SDNodeXForm<imm, [{
   uint64_t x =
-    abs(N->getZExtValue() - getNearPower2((uint64_t)N->getZExtValue()));
+    abs64(N->getZExtValue() - getNearPower2((uint64_t)N->getZExtValue()));
   return getI64Imm(Log2_64(x));
 }]>;
 
@@ -124,7 +124,7 @@ def immRemP2 : PatLeaf<(imm), [{
                          getNearPower2((uint64_t)N->getZExtValue()));
 }]>;
 def immUExt8ME : PatLeaf<(imm), [{ //use this imm for mulqi
-  int64_t d =  abs((int64_t)N->getZExtValue() -
+  int64_t d =  abs64((int64_t)N->getZExtValue() -
                (int64_t)getNearPower2((uint64_t)N->getZExtValue()));
   if (isPowerOf2_64(d)) return false;
   switch (d) {
@@ -337,7 +337,7 @@ def SEXTW    : OForm2<0x1C, 0x01, "sextw $RB,$RC",
 def ZAPNOTi  : OFormL<0x12, 0x31, "zapnot $RA,$L,$RC", [], s_ishf>;
 
 // Define the pattern that produces ZAPNOTi.
-def : Pat<(i64 (zappat GPRC:$RA):$imm),
+def : Pat<(zappat:$imm GPRC:$RA),
           (ZAPNOTi GPRC:$RA, (iZAPX GPRC:$imm))>;
 
 
@@ -570,7 +570,9 @@ def : Pat<(truncstorei8 GPRC:$DATA, GPRC:$addr),
 
 
 //load address, rellocated gpdist form
-let OutOperandList = (ops GPRC:$RA), InOperandList = (ops s16imm:$DISP, GPRC:$RB, s16imm:$NUM) in {
+let OutOperandList = (ops GPRC:$RA),
+    InOperandList = (ops s16imm:$DISP, GPRC:$RB, s16imm:$NUM),
+    mayLoad = 1 in {
 def LDAg  : MForm<0x08, 1, "lda $RA,0($RB)\t\t!gpdisp!$NUM", [], s_lda>;  //Load address
 def LDAHg : MForm<0x09, 1, "ldah $RA,0($RB)\t\t!gpdisp!$NUM", [], s_lda>;  //Load address
 }
@@ -589,7 +591,9 @@ let OutOperandList = (outs GPRC:$RR),
 def STQ_C : MForm<0x2F, 0, "stq_l $RA,$DISP($RB)", [], s_ist>;
 def STL_C : MForm<0x2E, 0, "stl_l $RA,$DISP($RB)", [], s_ist>;
 }
-let OutOperandList = (ops GPRC:$RA), InOperandList = (ops s64imm:$DISP, GPRC:$RB) in {
+let OutOperandList = (ops GPRC:$RA),
+    InOperandList = (ops s64imm:$DISP, GPRC:$RB),
+    mayLoad = 1 in {
 def LDQ_L : MForm<0x2B, 1, "ldq_l $RA,$DISP($RB)", [], s_ild>;
 def LDL_L : MForm<0x2A, 1, "ldl_l $RA,$DISP($RB)", [], s_ild>;
 }
@@ -857,6 +861,7 @@ def FBNE : br_fcc<0x36, "fbne">;
 //An ugly trick to get the opcode as an imm I can use
 def immBRCond : SDNodeXForm<imm, [{
   switch((uint64_t)N->getZExtValue()) {
+    default: assert(0 && "Unknown branch type");
     case 0:  return getI64Imm(Alpha::BEQ);
     case 1:  return getI64Imm(Alpha::BNE);
     case 2:  return getI64Imm(Alpha::BGE);
@@ -871,7 +876,6 @@ def immBRCond : SDNodeXForm<imm, [{
     case 23: return getI64Imm(Alpha::FBGT);
     case 24: return getI64Imm(Alpha::FBLE);
     case 25: return getI64Imm(Alpha::FBLT);
-    default: assert(0 && "Unknown branch type");
   }
 }]>;