diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td index 70b61a5047ce..7c50a3b763e6 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -3262,6 +3262,18 @@ foreach BATR = 0-3 in { Requires<[IsPPC6xx]>; } +def : InstAlias<"mtdccr $Rx", (MTSPR 1018, gprc:$Rx)>, Requires<[IsPPC4xx]>; +def : InstAlias<"mfdccr $Rx", (MFSPR gprc:$Rx, 1018)>, Requires<[IsPPC4xx]>; + +def : InstAlias<"mticcr $Rx", (MTSPR 1019, gprc:$Rx)>, Requires<[IsPPC4xx]>; +def : InstAlias<"mficcr $Rx", (MFSPR gprc:$Rx, 1019)>, Requires<[IsPPC4xx]>; + +def : InstAlias<"mtdear $Rx", (MTSPR 981, gprc:$Rx)>, Requires<[IsPPC4xx]>; +def : InstAlias<"mfdear $Rx", (MFSPR gprc:$Rx, 981)>, Requires<[IsPPC4xx]>; + +def : InstAlias<"mtesr $Rx", (MTSPR 980, gprc:$Rx)>, Requires<[IsPPC4xx]>; +def : InstAlias<"mfesr $Rx", (MFSPR gprc:$Rx, 980)>, Requires<[IsPPC4xx]>; + def LAx : PPCAsmPseudo<"la $rA, $addr", (ins gprc:$rA, memri:$addr)>; def SUBI : PPCAsmPseudo<"subi $rA, $rB, $imm", diff --git a/llvm/test/MC/PowerPC/ppc64-encoding-4xx.s b/llvm/test/MC/PowerPC/ppc64-encoding-4xx.s index 3eb60e0e49d9..8e010e3dd132 100644 --- a/llvm/test/MC/PowerPC/ppc64-encoding-4xx.s +++ b/llvm/test/MC/PowerPC/ppc64-encoding-4xx.s @@ -42,3 +42,31 @@ # CHECK-BE: tlbsx. 2, 3, 1 # encoding: [0x7c,0x43,0x0f,0x25] # CHECK-LE: tlbsx. 2, 3, 1 # encoding: [0x25,0x0f,0x43,0x7c] tlbsx. %r2, %r3, %r1 + +# CHECK-BE: mfspr 2, 1018 # encoding: [0x7c,0x5a,0xfa,0xa6] +# CHECK-LE: mfspr 2, 1018 # encoding: [0xa6,0xfa,0x5a,0x7c] + mfdccr %r2 +# CHECK-BE: mtspr 1018, 2 # encoding: [0x7c,0x5a,0xfb,0xa6] +# CHECK-LE: mtspr 1018, 2 # encoding: [0xa6,0xfb,0x5a,0x7c] + mtdccr %r2 + +# CHECK-BE: mfspr 2, 1019 # encoding: [0x7c,0x5b,0xfa,0xa6] +# CHECK-LE: mfspr 2, 1019 # encoding: [0xa6,0xfa,0x5b,0x7c] + mficcr %r2 +# CHECK-BE: mtspr 1019, 2 # encoding: [0x7c,0x5b,0xfb,0xa6] +# CHECK-LE: mtspr 1019, 2 # encoding: [0xa6,0xfb,0x5b,0x7c] + mticcr %r2 + +# CHECK-BE: mfspr 2, 981 # encoding: [0x7c,0x55,0xf2,0xa6] +# CHECK-LE: mfspr 2, 981 # encoding: [0xa6,0xf2,0x55,0x7c] + mfdear %r2 +# CHECK-BE: mtspr 981, 2 # encoding: [0x7c,0x55,0xf3,0xa6] +# CHECK-LE: mtspr 981, 2 # encoding: [0xa6,0xf3,0x55,0x7c] + mtdear %r2 + +# CHECK-BE: mfspr 2, 980 # encoding: [0x7c,0x54,0xf2,0xa6] +# CHECK-LE: mfspr 2, 980 # encoding: [0xa6,0xf2,0x54,0x7c] + mfesr %r2 +# CHECK-BE: mtspr 980, 2 # encoding: [0x7c,0x54,0xf3,0xa6] +# CHECK-LE: mtspr 980, 2 # encoding: [0xa6,0xf3,0x54,0x7c] + mtesr %r2