[Sparc] Added V9's extra floating point registers and their aliases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189195 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Venkatraman Govindaraju 2013-08-25 17:03:02 +00:00
parent 41f7baf181
commit 5ec8afa7cf
3 changed files with 81 additions and 1 deletions

View File

@ -69,6 +69,15 @@ BitVector SparcRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
Reserved.set(SP::G0);
Reserved.set(SP::G6);
Reserved.set(SP::G7);
// Unaliased double registers are not available in non-V9 targets.
if (!Subtarget.isV9()) {
for (unsigned n = 0; n != 16; ++n) {
for (MCRegAliasIterator AI(SP::D16 + n, this, true); AI.isValid(); ++AI)
Reserved.set(*AI);
}
}
return Reserved;
}

View File

@ -23,6 +23,8 @@ class SparcCtrlReg<string n>: Register<n> {
let Namespace = "SP" in {
def sub_even : SubRegIndex<32>;
def sub_odd : SubRegIndex<32, 32>;
def sub_even64 : SubRegIndex<64>;
def sub_odd64 : SubRegIndex<64, 64>;
}
// Registers are identified with 5-bit ID numbers.
@ -39,6 +41,13 @@ class Rd<bits<16> Enc, string n, list<Register> subregs> : SparcReg<Enc, n> {
let CoveredBySubRegs = 1;
}
// Rq - Slots in the FP register file for 128-bit floating-point values.
class Rq<bits<16> Enc, string n, list<Register> subregs> : SparcReg<Enc, n> {
let SubRegs = subregs;
let SubRegIndices = [sub_even64, sub_odd64];
let CoveredBySubRegs = 1;
}
// Control Registers
def ICC : SparcCtrlReg<"ICC">; // This represents icc and xcc in 64-bit code.
def FCC : SparcCtrlReg<"FCC">;
@ -132,6 +141,43 @@ def D13 : Rd<26, "F26", [F26, F27]>, DwarfRegNum<[85]>;
def D14 : Rd<28, "F28", [F28, F29]>, DwarfRegNum<[86]>;
def D15 : Rd<30, "F30", [F30, F31]>, DwarfRegNum<[87]>;
// Unaliased double precision floating point registers.
// FIXME: Define DwarfRegNum for these registers.
def D16 : SparcReg< 1, "F32">;
def D17 : SparcReg< 3, "F34">;
def D18 : SparcReg< 5, "F36">;
def D19 : SparcReg< 7, "F38">;
def D20 : SparcReg< 9, "F40">;
def D21 : SparcReg<11, "F42">;
def D22 : SparcReg<13, "F44">;
def D23 : SparcReg<15, "F46">;
def D24 : SparcReg<17, "F48">;
def D25 : SparcReg<19, "F50">;
def D26 : SparcReg<21, "F52">;
def D27 : SparcReg<23, "F54">;
def D28 : SparcReg<25, "F56">;
def D29 : SparcReg<27, "F58">;
def D30 : SparcReg<29, "F60">;
def D31 : SparcReg<31, "F62">;
// Aliases of the F* registers used to hold 128-bit for values (long doubles).
def Q0 : Rq< 0, "F0", [D0, D1]>;
def Q1 : Rq< 4, "F4", [D2, D3]>;
def Q2 : Rq< 8, "F8", [D4, D5]>;
def Q3 : Rq<12, "F12", [D6, D7]>;
def Q4 : Rq<16, "F16", [D8, D9]>;
def Q5 : Rq<20, "F20", [D10, D11]>;
def Q6 : Rq<24, "F24", [D12, D13]>;
def Q7 : Rq<28, "F28", [D14, D15]>;
def Q8 : Rq< 1, "F32", [D16, D17]>;
def Q9 : Rq< 5, "F36", [D18, D19]>;
def Q10 : Rq< 9, "F40", [D20, D21]>;
def Q11 : Rq<13, "F44", [D22, D23]>;
def Q12 : Rq<17, "F48", [D24, D25]>;
def Q13 : Rq<21, "F52", [D26, D27]>;
def Q14 : Rq<25, "F56", [D28, D29]>;
def Q15 : Rq<29, "F60", [D30, D31]>;
// Register classes.
//
// FIXME: the register order should be defined in terms of the preferred
@ -155,4 +201,6 @@ def I64Regs : RegisterClass<"SP", [i64], 64, (add IntRegs)>;
// Floating point register classes.
def FPRegs : RegisterClass<"SP", [f32], 32, (sequence "F%u", 0, 31)>;
def DFPRegs : RegisterClass<"SP", [f64], 64, (sequence "D%u", 0, 15)>;
def DFPRegs : RegisterClass<"SP", [f64], 64, (sequence "D%u", 0, 31)>;
def QFPRegs : RegisterClass<"SP", [f128], 128, (sequence "Q%u", 0, 15)>;

View File

@ -45,3 +45,26 @@ entry:
declare double @get_double()
declare double @llvm.fabs.f64(double) nounwind readonly
; V8-LABEL: test_v9_floatreg:
; V8: fsubd {{.+}}, {{.+}}, {{.+}}
; V8: faddd {{.+}}, {{.+}}, [[R:%f(((1|2)?(0|2|4|6|8))|30)]]
; V8: std [[R]], [%{{.+}}]
; V8: ldd [%{{.+}}], %f0
; V9-LABEL: test_v9_floatreg:
; V9: fsubd {{.+}}, {{.+}}, {{.+}}
; V9: faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
; V9: fmovd [[R]], %f0
define double @test_v9_floatreg() {
entry:
%0 = tail call double @get_double()
%1 = tail call double @get_double()
%2 = fsub double %0, %1
tail call void asm sideeffect "", "~{f0},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f8},~{f9},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f18},~{f19},~{f20},~{f21},~{f22},~{f23},~{f24},~{f25},~{f26},~{f27},~{f28},~{f29},~{f30},~{f31}"()
%3 = fadd double %2, %2
ret double %3
}