[PowerPC] Support time base instructions
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 8 Jul 2013 15:20:38 +0000 (15:20 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 8 Jul 2013 15:20:38 +0000 (15:20 +0000)
This adds support for the old-style time base instructions;
while new programs are supposed to use mfspr, the mftb instructions
are still supported and in use by existing assembler files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185829 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCInstrInfo.td
test/MC/PowerPC/ppc64-encoding-bookII.s

index 3aafb5c9638675526f2d59614a9df15f355d656b..d4969f688ed504c2da0d1bd2cac1aad1719032d9 100644 (file)
@@ -1853,6 +1853,9 @@ def MFSPR : XFXForm_1<31, 339, (outs gprc:$RT), (ins i32imm:$SPR),
 def MTSPR : XFXForm_1<31, 467, (outs), (ins i32imm:$SPR, gprc:$RT),
                       "mtspr $SPR, $RT", SprMTSPR>;
 
+def MFTB : XFXForm_1<31, 371, (outs gprc:$RT), (ins i32imm:$SPR),
+                     "mftb $RT, $SPR", SprMFTB>;
+
 let Uses = [CTR] in {
 def MFCTR : XFXForm_1_ext<31, 339, 9, (outs gprc:$rT), (ins),
                           "mfctr $rT", SprMFSPR>,
@@ -2335,6 +2338,9 @@ def : InstAlias<"crnot $bx, $by", (CRNOR crbitrc:$bx, crbitrc:$by, crbitrc:$by)>
 def : InstAlias<"mtxer $Rx", (MTSPR 1, gprc:$Rx)>;
 def : InstAlias<"mfxer $Rx", (MFSPR gprc:$Rx, 1)>;
 
+def : InstAlias<"mftb $Rx", (MFTB gprc:$Rx, 268)>;
+def : InstAlias<"mftbu $Rx", (MFTB gprc:$Rx, 269)>;
+
 def : InstAlias<"xnop", (XORI R0, R0, 0)>;
 
 def : InstAlias<"mr $rA, $rB", (OR8 g8rc:$rA, g8rc:$rB, g8rc:$rB)>;
index 34ed77aa7f688fe74f078cf920a43b2c895f2634..9e68a4b3c2540019ca7ea66504d6ed0bdaa2d230 100644 (file)
 # CHECK: wait 2                          # encoding: [0x7c,0x40,0x00,0x7c]
          waitimpl
 
+# Time base instructions
+
+# CHECK: mftb 2, 123                     # encoding: [0x7c,0x5b,0x1a,0xe6]
+         mftb 2, 123
+# CHECK: mftb 2, 268                     # encoding: [0x7c,0x4c,0x42,0xe6]
+         mftb 2
+# CHECK: mftb 2, 269                     # encoding: [0x7c,0x4d,0x42,0xe6]
+         mftbu 2
+