//==== SPUInstrFormats.td - Cell SPU Instruction Formats ---*- tablegen -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // // Cell SPU instruction formats. Note that these are notationally similar to // PowerPC, like "A-Form". But the sizes of operands and fields differ. // This was kiped from the PPC instruction formats (seemed like a good idea...) class SPUInstr : Instruction { field bits<32> Inst; let Namespace = "SPU"; let OutOperandList = OOL; let InOperandList = IOL; let AsmString = asmstr; let Itinerary = itin; } // RR Format class RRForm opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : SPUInstr { bits<7> RA; bits<7> RB; bits<7> RT; let Pattern = pattern; let Inst{0-10} = opcode; let Inst{11-17} = RB; let Inst{18-24} = RA; let Inst{25-31} = RT; } let RB = 0 in { // RR Format, where RB is zeroed (dont care): class RRForm_1 opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : RRForm { } let RA = 0 in { // RR Format, where RA and RB are zeroed (dont care): // Used for reads from status control registers (see FPSCRRr32) class RRForm_2 opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : RRForm { } } } let RT = 0 in { // RR Format, where RT is zeroed (don't care), or as the instruction handbook // says, "RT is a false target." Used in "Halt if" instructions class RRForm_3 opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : RRForm { } } // RRR Format class RRRForm opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : SPUInstr { bits<7> RA; bits<7> RB; bits<7> RC; bits<7> RT; let Pattern = pattern; let Inst{0-3} = opcode; let Inst{4-10} = RT; let Inst{11-17} = RB; let Inst{18-24} = RA; let Inst{25-31} = RC; } // RI7 Format class RI7Form opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : SPUInstr { bits<7> i7; bits<7> RA; bits<7> RT; let Pattern = pattern; let Inst{0-10} = opcode; let Inst{11-17} = i7; let Inst{18-24} = RA; let Inst{25-31} = RT; } // CVTIntFp Format class CVTIntFPForm opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : SPUInstr { bits<7> RA; bits<7> RT; let Pattern = pattern; let Inst{0-9} = opcode; let Inst{10-17} = 0; let Inst{18-24} = RA; let Inst{25-31} = RT; } let RA = 0 in { class BICondForm opcode, dag OOL, dag IOL, string asmstr, list pattern> : RRForm { } let RT = 0 in { // Branch instruction format (without D/E flag settings) class BRForm opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : RRForm { } class BIForm opcode, string asmstr, list pattern> : RRForm { } let RB = 0 in { // Return instruction (bi, branch indirect), RA is zero (LR): class RETForm pattern> : BRForm<0b00010101100, (outs), (ins), asmstr, BranchResolv, pattern> { } } } } // Branch indirect external data forms: class BISLEDForm DE_flag, string asmstr, list pattern> : SPUInstr<(outs), (ins indcalltarget:$func), asmstr, BranchResolv> { bits<7> Rcalldest; let Pattern = pattern; let Inst{0-10} = 0b11010101100; let Inst{11} = 0; let Inst{12-13} = DE_flag; let Inst{14-17} = 0b0000; let Inst{18-24} = Rcalldest; let Inst{25-31} = 0b0000000; } // RI10 Format class RI10Form opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : SPUInstr { bits<10> i10; bits<7> RA; bits<7> RT; let Pattern = pattern; let Inst{0-7} = opcode; let Inst{8-17} = i10; let Inst{18-24} = RA; let Inst{25-31} = RT; } // RI10 Format, where the constant is zero (or effectively ignored by the // SPU) let i10 = 0 in { class RI10Form_1 opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : RI10Form { } } // RI10 Format, where RT is ignored. // This format is used primarily by the Halt If ... Immediate set of // instructions let RT = 0 in { class RI10Form_2 opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : RI10Form { } } // RI16 Format class RI16Form opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : SPUInstr { bits<16> i16; bits<7> RT; let Pattern = pattern; let Inst{0-8} = opcode; let Inst{9-24} = i16; let Inst{25-31} = RT; } // Specialized version of the RI16 Format for unconditional branch relative and // branch absolute, branch and set link. Note that for branch and set link, the // link register doesn't have to be $lr, but this is actually hard coded into // the instruction pattern. let RT = 0 in { class UncondBranch opcode, dag OOL, dag IOL, string asmstr, list pattern> : RI16Form { } class BranchSetLink opcode, dag OOL, dag IOL, string asmstr, list pattern> : RI16Form { } } //===----------------------------------------------------------------------===// // Specialized versions of RI16: //===----------------------------------------------------------------------===// // RI18 Format class RI18Form opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : SPUInstr { bits<18> i18; bits<7> RT; let Pattern = pattern; let Inst{0-6} = opcode; let Inst{7-24} = i18; let Inst{25-31} = RT; } //===----------------------------------------------------------------------===// // Instruction formats for intrinsics: //===----------------------------------------------------------------------===// // RI10 Format for v8i16 intrinsics class RI10_Int_v8i16 opcode, string opc, InstrItinClass itin, Intrinsic IntID> : RI10Form; class RI10_Int_v4i32 opcode, string opc, InstrItinClass itin, Intrinsic IntID> : RI10Form; // RR Format for v8i16 intrinsics class RR_Int_v8i16 opcode, string opc, InstrItinClass itin, Intrinsic IntID> : RRForm; // RR Format for v4i32 intrinsics class RR_Int_v4i32 opcode, string opc, InstrItinClass itin, Intrinsic IntID> : RRForm; //===----------------------------------------------------------------------===// // Pseudo instructions, like call frames: //===----------------------------------------------------------------------===// class Pseudo pattern> : SPUInstr { let OutOperandList = OOL; let InOperandList = IOL; let AsmString = asmstr; let Pattern = pattern; let Inst{31-0} = 0; } //===----------------------------------------------------------------------===// // Branch hint formats //===----------------------------------------------------------------------===// // For hbrr and hbra class HBI16Form opcode, dag IOL, string asmstr> : Instruction { field bits<32> Inst; bits<16>i16; bits<9>RO; let Namespace = "SPU"; let InOperandList = IOL; let OutOperandList = (outs); //no output let AsmString = asmstr; let Itinerary = BranchHints; let Inst{0-6} = opcode; let Inst{7-8} = RO{8-7}; let Inst{9-24} = i16; let Inst{25-31} = RO{6-0}; }