"Enable the ldbrx instruction">;
def FeatureBookE : SubtargetFeature<"booke", "IsBookE", "true",
"Enable Book E instructions">;
+def FeatureE500 : SubtargetFeature<"E500", "IsE500", "true",
+ "Enable E500/E500mc instructions">;
+def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
+ "Enable PPC 4xx instructions">;
def FeatureQPX : SubtargetFeature<"qpx","HasQPX", "true",
"Enable QPX instructions">;
def FeatureVSX : SubtargetFeature<"vsx","HasVSX", "true",
def In64BitMode : Predicate<"PPCSubTarget->isPPC64()">;
def IsBookE : Predicate<"PPCSubTarget->isBookE()">;
def IsNotBookE : Predicate<"!PPCSubTarget->isBookE()">;
+def IsPPC4xx : Predicate<"PPCSubTarget->isPPC4xx()">;
+def IsE500 : Predicate<"PPCSubTarget->isE500()">;
//===----------------------------------------------------------------------===//
// PowerPC Multiclass Definitions.
def RFCI : XForm_0<19, 51, (outs), (ins), "rfci", IIC_BrB, []>,
Requires<[IsBookE]>;
-def RFDI : XForm_0<19, 39, (outs), (ins), "rfdi", IIC_BrB, []>;
-def RFMCI : XForm_0<19, 38, (outs), (ins), "rfmci", IIC_BrB, []>;
+def RFDI : XForm_0<19, 39, (outs), (ins), "rfdi", IIC_BrB, []>,
+ Requires<[IsE500]>;
+def RFMCI : XForm_0<19, 38, (outs), (ins), "rfmci", IIC_BrB, []>,
+ Requires<[IsE500]>;
def MFDCR : XFXForm_1<31, 323, (outs gprc:$RT), (ins i32imm:$SPR),
- "mfdcr $RT, $SPR", IIC_SprMFSPR>;
+ "mfdcr $RT, $SPR", IIC_SprMFSPR>, Requires<[IsPPC4xx]>;
def MTDCR : XFXForm_1<31, 451, (outs), (ins gprc:$RT, i32imm:$SPR),
- "mtdcr $SPR, $RT", IIC_SprMTSPR>;
+ "mtdcr $SPR, $RT", IIC_SprMTSPR>, Requires<[IsPPC4xx]>;
//===----------------------------------------------------------------------===//
// PowerPC Assembler Instruction Aliases
HasPOPCNTD = false;
HasLDBRX = false;
IsBookE = false;
+ IsPPC4xx = false;
+ IsE500 = false;
DeprecatedMFTB = false;
DeprecatedDST = false;
HasLazyResolverStubs = false;
bool HasPOPCNTD;
bool HasLDBRX;
bool IsBookE;
+ bool IsE500;
+ bool IsPPC4xx;
bool DeprecatedMFTB;
bool DeprecatedDST;
bool HasLazyResolverStubs;
bool hasPOPCNTD() const { return HasPOPCNTD; }
bool hasLDBRX() const { return HasLDBRX; }
bool isBookE() const { return IsBookE; }
+ bool isPPC4xx() const { return IsPPC4xx; }
+ bool isE500() const { return IsE500; }
bool isDeprecatedMFTB() const { return DeprecatedMFTB; }
bool isDeprecatedDST() const { return DeprecatedDST; }
--- /dev/null
+# RUN: llvm-mc --disassemble %s -triple powerpc64-unknown-unknown -mcpu=pwr7 | FileCheck %s
+
+# CHECK: mfdcr 3, 178
+0x7c 0x72 0x2a 0x86
+# CHECK: mtdcr 178, 3
+0x7c 0x72 0x2b 0x86
--- /dev/null
+# RUN: llvm-mc --disassemble %s -triple powerpc64-unknown-unknown -mcpu=pwr7 | FileCheck %s
+
+# CHECK: rfdi
+0x4c 0x00 0x00 0x4e
+# CHECK: rfmci
+0x4c 0x00 0x00 0x4c
+
# CHECK: mtcrf 255, 2
0x7c 0x4f 0xf1 0x20
-# CHECK: rfdi
-0x4c 0x00 0x00 0x4e
-# CHECK: rfmci
-0x4c 0x00 0x00 0x4c
-
# CHECK: dss 3
0x7c 0x60 0x06 0x6c
# CHECK: dssall
# CHECK: dststt 12, 11, 3
0x7e 0x6c 0x5a 0xec
-# CHECK: mfdcr 3, 178
-0x7c 0x72 0x2a 0x86
-# CHECK: mtdcr 178, 3
-0x7c 0x72 0x2b 0x86
-
# CHECK: tlbia
0x7c 0x00 0x02 0xe4
--- /dev/null
+# RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-BE %s
+# RUN: llvm-mc -triple powerpc64le-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-LE %s
+
+# Instructions specific to the PowerPC 4xx embedded controllers:
+
+# CHECK-BE: mfdcr 3, 178 # encoding: [0x7c,0x72,0x2a,0x86]
+# CHECK-LE: mfdcr 3, 178 # encoding: [0x86,0x2a,0x72,0x7c]
+ mfdcr 3,178
+# CHECK-BE: mtdcr 178, 3 # encoding: [0x7c,0x72,0x2b,0x86]
+# CHECK-LE: mtdcr 178, 3 # encoding: [0x86,0x2b,0x72,0x7c]
+ mtdcr 178,3
--- /dev/null
+# RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-BE %s
+# RUN: llvm-mc -triple powerpc64le-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-LE %s
+
+# Instructions specific to the e500 / e500mc cores:
+
+# CHECK-BE: rfdi # encoding: [0x4c,0x00,0x00,0x4e]
+# CHECK-LE: rfdi # encoding: [0x4e,0x00,0x00,0x4c]
+ rfdi
+# CHECK-BE: rfmci # encoding: [0x4c,0x00,0x00,0x4c]
+# CHECK-LE: rfmci # encoding: [0x4c,0x00,0x00,0x4c]
+ rfmci
# CHECK-LE: mtspr 275, 4 # encoding: [0xa6,0x43,0x93,0x7c]
mtsprg3 %r4
-# e500/e500mc instructions:
-# CHECK-BE: rfdi # encoding: [0x4c,0x00,0x00,0x4e]
-# CHECK-LE: rfdi # encoding: [0x4e,0x00,0x00,0x4c]
- rfdi
-# CHECK-BE: rfmci # encoding: [0x4c,0x00,0x00,0x4c]
-# CHECK-LE: rfmci # encoding: [0x4c,0x00,0x00,0x4c]
- rfmci
-
# Altivec Data Stream instruction:
# CHECK-BE: dss 3 # encoding: [0x7c,0x60,0x06,0x6c]
# CHECK-LE: dss 3 # encoding: [0x6c,0x06,0x60,0x7c]
# CHECK-LE: dststt 12, 11, 3 # encoding: [0xec,0x5a,0x6c,0x7e]
dststt %r12, %r11, 3
-# PPC 403 support
-# CHECK-BE: mfdcr 3, 178 # encoding: [0x7c,0x72,0x2a,0x86]
-# CHECK-LE: mfdcr 3, 178 # encoding: [0x86,0x2a,0x72,0x7c]
- mfdcr 3,178
-# CHECK-BE: mtdcr 178, 3 # encoding: [0x7c,0x72,0x2b,0x86]
-# CHECK-LE: mtdcr 178, 3 # encoding: [0x86,0x2b,0x72,0x7c]
- mtdcr 178,3
-
# CHECK-BE: tlbia # encoding: [0x7c,0x00,0x02,0xe4]
# CHECK-LE: tlbia # encoding: [0xe4,0x02,0x00,0x7c]
tlbia