Implement 64-bit undef, sub, shl/shr, srem/urem
authorChris Lattner <sabre@nondot.org>
Tue, 27 Jun 2006 18:18:41 +0000 (18:18 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 27 Jun 2006 18:18:41 +0000 (18:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28929 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCBranchSelector.cpp
lib/Target/PowerPC/PPCCodeEmitter.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCInstr64Bit.td
lib/Target/PowerPC/PPCInstrInfo.td

index 657ff6ce633e0a09072a8bd4d01d490c5f8b0bd4..36f68058f8f153906a0c9835607f931d8387a643 100644 (file)
@@ -52,7 +52,8 @@ static unsigned getNumBytesForInstruction(MachineInstr *MI) {
     // minor pessimization that saves us from having to worry about
     // keeping the offsets up to date later when we emit long branch glue.
     return 8;
-  case PPC::IMPLICIT_DEF_GPR: // no asm emitted
+  case PPC::IMPLICIT_DEF_GPRC: // no asm emitted
+  case PPC::IMPLICIT_DEF_G8RC: // no asm emitted
   case PPC::IMPLICIT_DEF_F4: // no asm emitted
   case PPC::IMPLICIT_DEF_F8: // no asm emitted
     return 0;
index a530b1e32f219d9311fe012daa33ac784a87d3a2..f1c0e07a048560c3b3ef8264c7a9045607540a59 100644 (file)
@@ -125,7 +125,8 @@ void PPCCodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) {
     default:
       MCE.emitWordBE(getBinaryCodeForInstr(*I));
       break;
-    case PPC::IMPLICIT_DEF_GPR:
+    case PPC::IMPLICIT_DEF_GPRC:
+    case PPC::IMPLICIT_DEF_G8RC:
     case PPC::IMPLICIT_DEF_F8:
     case PPC::IMPLICIT_DEF_F4:
     case PPC::IMPLICIT_DEF_VRRC:
index a417a2d544e88f2daa5b448e1073ba99aabfa15b..5122b5671b6c4a5f31cc7a8f099009e1a9303bc6 100644 (file)
@@ -58,6 +58,8 @@ PPCTargetLowering::PPCTargetLowering(TargetMachine &TM)
   // PowerPC has no SREM/UREM instructions
   setOperationAction(ISD::SREM, MVT::i32, Expand);
   setOperationAction(ISD::UREM, MVT::i32, Expand);
+  setOperationAction(ISD::SREM, MVT::i64, Expand);
+  setOperationAction(ISD::UREM, MVT::i64, Expand);
   
   // We don't support sin/cos/sqrt/fmod
   setOperationAction(ISD::FSIN , MVT::f64, Expand);
index 0f6c69310cbc6927d097004d3552fac7ef378a5c..99294c5a5cceb6e290dcafcedbee6753357f6bef 100644 (file)
@@ -53,6 +53,14 @@ def HI48_64 : SDNodeXForm<imm, [{
 }]>;
 
 
+//===----------------------------------------------------------------------===//
+// Pseudo instructions.
+//
+
+def IMPLICIT_DEF_G8RC : Pseudo<(ops G8RC:$rD), "; $rD = IMPLICIT_DEF_G8RC",
+                              [(set G8RC:$rD, (undef))]>;
+
+
 //===----------------------------------------------------------------------===//
 // Fixed point instructions.
 //
@@ -134,7 +142,12 @@ def ADDIS8 : DForm_2<15, (ops G8RC:$rD, G8RC:$rA, symbolHi64:$imm),
                      "addis $rD, $rA, $imm", IntGeneral,
                      [(set G8RC:$rD, (add G8RC:$rA, imm16ShiftedSExt:$imm))]>;
 
-
+def SUBFIC8: DForm_2< 8, (ops G8RC:$rD, G8RC:$rA, s16imm64:$imm),
+                     "subfic $rD, $rA, $imm", IntGeneral,
+                     [(set G8RC:$rD, (subc immSExt16:$imm, G8RC:$rA))]>;
+def SUBF8 : XOForm_1<31, 40, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
+                     "subf $rT, $rA, $rB", IntGeneral,
+                     [(set G8RC:$rT, (sub G8RC:$rB, G8RC:$rA))]>;
 
 
 def MULHD : XOForm_1<31, 73, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
@@ -326,9 +339,9 @@ def : Pat<(i32 (trunc G8RC:$in)),
           (OR8To4 G8RC:$in, G8RC:$in)>;
 
 // SHL/SRL
-def : Pat<(shl G8RC:$in, (i64 imm:$imm)),
+def : Pat<(shl G8RC:$in, (i32 imm:$imm)),
           (RLDICR G8RC:$in, imm:$imm, (SHL64 imm:$imm))>;
-def : Pat<(srl G8RC:$in, (i64 imm:$imm)),
+def : Pat<(srl G8RC:$in, (i32 imm:$imm)),
           (RLDICL G8RC:$in, (SRL64 imm:$imm), imm:$imm)>;
 
 // Hi and Lo for Darwin Global Addresses.
index 900ca1a613f8500b0072c954ca02355919734bb4..4fd4533b2b91c1652181996c12443e6b12a0754b 100644 (file)
@@ -252,7 +252,7 @@ def ADJCALLSTACKUP   : Pseudo<(ops u16imm:$amt),
 def UPDATE_VRSAVE    : Pseudo<(ops GPRC:$rD, GPRC:$rS),
                               "UPDATE_VRSAVE $rD, $rS", []>;
 }
-def IMPLICIT_DEF_GPR : Pseudo<(ops GPRC:$rD), "; $rD = IMPLICIT_DEF_GPRC",
+def IMPLICIT_DEF_GPRC: Pseudo<(ops GPRC:$rD), "; $rD = IMPLICIT_DEF_GPRC",
                               [(set GPRC:$rD, (undef))]>;
 def IMPLICIT_DEF_F8  : Pseudo<(ops F8RC:$rD), "; $rD = IMPLICIT_DEF_F8",
                               [(set F8RC:$rD, (undef))]>;