forked from OSchip/llvm-project
ARM Refactor VLD/VST spaced pair instructions.
Use the new composite physical registers. llvm-svn: 152063
This commit is contained in:
parent
6290557872
commit
e5307f9019
|
@ -116,13 +116,13 @@ def VecListFourD : RegisterOperand<DPR, "printVectorListFour"> {
|
||||||
let ParserMatchClass = VecListFourDAsmOperand;
|
let ParserMatchClass = VecListFourDAsmOperand;
|
||||||
}
|
}
|
||||||
// Register list of two D registers spaced by 2 (two sequential Q registers).
|
// Register list of two D registers spaced by 2 (two sequential Q registers).
|
||||||
def VecListTwoQAsmOperand : AsmOperandClass {
|
def VecListDPairSpacedAsmOperand : AsmOperandClass {
|
||||||
let Name = "VecListTwoQ";
|
let Name = "VecListDPairSpaced";
|
||||||
let ParserMethod = "parseVectorList";
|
let ParserMethod = "parseVectorList";
|
||||||
let RenderMethod = "addVecListOperands";
|
let RenderMethod = "addVecListOperands";
|
||||||
}
|
}
|
||||||
def VecListTwoQ : RegisterOperand<DPR, "printVectorListTwoSpaced"> {
|
def VecListDPairSpaced : RegisterOperand<DPair, "printVectorListDPairSpaced"> {
|
||||||
let ParserMatchClass = VecListTwoQAsmOperand;
|
let ParserMatchClass = VecListDPairSpacedAsmOperand;
|
||||||
}
|
}
|
||||||
// Register list of three D registers spaced by 2 (three Q registers).
|
// Register list of three D registers spaced by 2 (three Q registers).
|
||||||
def VecListThreeQAsmOperand : AsmOperandClass {
|
def VecListThreeQAsmOperand : AsmOperandClass {
|
||||||
|
@ -803,12 +803,12 @@ def VLD2q16PseudoWB_register : VLDQQWBregisterPseudo<IIC_VLD2x2u>;
|
||||||
def VLD2q32PseudoWB_register : VLDQQWBregisterPseudo<IIC_VLD2x2u>;
|
def VLD2q32PseudoWB_register : VLDQQWBregisterPseudo<IIC_VLD2x2u>;
|
||||||
|
|
||||||
// ...with double-spaced registers
|
// ...with double-spaced registers
|
||||||
def VLD2b8 : VLD2<0b1001, {0,0,?,?}, "8", VecListTwoQ, IIC_VLD2>;
|
def VLD2b8 : VLD2<0b1001, {0,0,?,?}, "8", VecListDPairSpaced, IIC_VLD2>;
|
||||||
def VLD2b16 : VLD2<0b1001, {0,1,?,?}, "16", VecListTwoQ, IIC_VLD2>;
|
def VLD2b16 : VLD2<0b1001, {0,1,?,?}, "16", VecListDPairSpaced, IIC_VLD2>;
|
||||||
def VLD2b32 : VLD2<0b1001, {1,0,?,?}, "32", VecListTwoQ, IIC_VLD2>;
|
def VLD2b32 : VLD2<0b1001, {1,0,?,?}, "32", VecListDPairSpaced, IIC_VLD2>;
|
||||||
defm VLD2b8wb : VLD2WB<0b1001, {0,0,?,?}, "8", VecListTwoQ, IIC_VLD2u>;
|
defm VLD2b8wb : VLD2WB<0b1001, {0,0,?,?}, "8", VecListDPairSpaced, IIC_VLD2u>;
|
||||||
defm VLD2b16wb : VLD2WB<0b1001, {0,1,?,?}, "16", VecListTwoQ, IIC_VLD2u>;
|
defm VLD2b16wb : VLD2WB<0b1001, {0,1,?,?}, "16", VecListDPairSpaced, IIC_VLD2u>;
|
||||||
defm VLD2b32wb : VLD2WB<0b1001, {1,0,?,?}, "32", VecListTwoQ, IIC_VLD2u>;
|
defm VLD2b32wb : VLD2WB<0b1001, {1,0,?,?}, "32", VecListDPairSpaced, IIC_VLD2u>;
|
||||||
|
|
||||||
// VLD3 : Vector Load (multiple 3-element structures)
|
// VLD3 : Vector Load (multiple 3-element structures)
|
||||||
class VLD3D<bits<4> op11_8, bits<4> op7_4, string Dt>
|
class VLD3D<bits<4> op11_8, bits<4> op7_4, string Dt>
|
||||||
|
@ -1810,12 +1810,12 @@ def VST2q16PseudoWB_register : VSTQQWBregisterPseudo<IIC_VST2x2u>;
|
||||||
def VST2q32PseudoWB_register : VSTQQWBregisterPseudo<IIC_VST2x2u>;
|
def VST2q32PseudoWB_register : VSTQQWBregisterPseudo<IIC_VST2x2u>;
|
||||||
|
|
||||||
// ...with double-spaced registers
|
// ...with double-spaced registers
|
||||||
def VST2b8 : VST2<0b1001, {0,0,?,?}, "8", VecListTwoQ, IIC_VST2>;
|
def VST2b8 : VST2<0b1001, {0,0,?,?}, "8", VecListDPairSpaced, IIC_VST2>;
|
||||||
def VST2b16 : VST2<0b1001, {0,1,?,?}, "16", VecListTwoQ, IIC_VST2>;
|
def VST2b16 : VST2<0b1001, {0,1,?,?}, "16", VecListDPairSpaced, IIC_VST2>;
|
||||||
def VST2b32 : VST2<0b1001, {1,0,?,?}, "32", VecListTwoQ, IIC_VST2>;
|
def VST2b32 : VST2<0b1001, {1,0,?,?}, "32", VecListDPairSpaced, IIC_VST2>;
|
||||||
defm VST2b8wb : VST2DWB<0b1001, {0,0,?,?}, "8", VecListTwoQ>;
|
defm VST2b8wb : VST2DWB<0b1001, {0,0,?,?}, "8", VecListDPairSpaced>;
|
||||||
defm VST2b16wb : VST2DWB<0b1001, {0,1,?,?}, "16", VecListTwoQ>;
|
defm VST2b16wb : VST2DWB<0b1001, {0,1,?,?}, "16", VecListDPairSpaced>;
|
||||||
defm VST2b32wb : VST2DWB<0b1001, {1,0,?,?}, "32", VecListTwoQ>;
|
defm VST2b32wb : VST2DWB<0b1001, {1,0,?,?}, "32", VecListDPairSpaced>;
|
||||||
|
|
||||||
// VST3 : Vector Store (multiple 3-element structures)
|
// VST3 : Vector Store (multiple 3-element structures)
|
||||||
class VST3D<bits<4> op11_8, bits<4> op7_4, string Dt>
|
class VST3D<bits<4> op11_8, bits<4> op7_4, string Dt>
|
||||||
|
|
|
@ -1106,6 +1106,12 @@ public:
|
||||||
return VectorList.Count == 2;
|
return VectorList.Count == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isVecListDPairSpaced() const {
|
||||||
|
if (!isSingleSpacedVectorList()) return false;
|
||||||
|
return (ARMMCRegisterClasses[ARM::DPairSpcRegClassID]
|
||||||
|
.contains(VectorList.RegNum));
|
||||||
|
}
|
||||||
|
|
||||||
bool isVecListThreeQ() const {
|
bool isVecListThreeQ() const {
|
||||||
if (!isDoubleSpacedVectorList()) return false;
|
if (!isDoubleSpacedVectorList()) return false;
|
||||||
return VectorList.Count == 3;
|
return VectorList.Count == 3;
|
||||||
|
@ -2974,9 +2980,6 @@ parseVectorList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||||
switch (LaneKind) {
|
switch (LaneKind) {
|
||||||
case NoLanes:
|
case NoLanes:
|
||||||
E = Parser.getTok().getLoc();
|
E = Parser.getTok().getLoc();
|
||||||
// VLD1 wants a DPair register.
|
|
||||||
// FIXME: Make the rest of the two-reg instructions want the same
|
|
||||||
// thing.
|
|
||||||
Reg = MRI->getMatchingSuperReg(Reg, ARM::dsub_0,
|
Reg = MRI->getMatchingSuperReg(Reg, ARM::dsub_0,
|
||||||
&ARMMCRegisterClasses[ARM::DPairRegClassID]);
|
&ARMMCRegisterClasses[ARM::DPairRegClassID]);
|
||||||
|
|
||||||
|
@ -3149,13 +3152,14 @@ parseVectorList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||||
|
|
||||||
switch (LaneKind) {
|
switch (LaneKind) {
|
||||||
case NoLanes:
|
case NoLanes:
|
||||||
if (Count == 2 && Spacing == 1)
|
// Non-lane two-register operands have been converted to the
|
||||||
// VLD1 wants a DPair register.
|
// composite register classes.
|
||||||
// FIXME: Make the rest of the two-reg instructions want the same
|
if (Count == 2) {
|
||||||
// thing.
|
const MCRegisterClass *RC = (Spacing == 1) ?
|
||||||
FirstReg = MRI->getMatchingSuperReg(FirstReg, ARM::dsub_0,
|
&ARMMCRegisterClasses[ARM::DPairRegClassID] :
|
||||||
&ARMMCRegisterClasses[ARM::DPairRegClassID]);
|
&ARMMCRegisterClasses[ARM::DPairSpcRegClassID];
|
||||||
|
FirstReg = MRI->getMatchingSuperReg(FirstReg, ARM::dsub_0, RC);
|
||||||
|
}
|
||||||
|
|
||||||
Operands.push_back(ARMOperand::CreateVectorList(FirstReg, Count,
|
Operands.push_back(ARMOperand::CreateVectorList(FirstReg, Count,
|
||||||
(Spacing == 2), S, E));
|
(Spacing == 2), S, E));
|
||||||
|
|
|
@ -128,6 +128,9 @@ static DecodeStatus DecodeQPRRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||||
uint64_t Address, const void *Decoder);
|
uint64_t Address, const void *Decoder);
|
||||||
static DecodeStatus DecodeDPairRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
static DecodeStatus DecodeDPairRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||||
uint64_t Address, const void *Decoder);
|
uint64_t Address, const void *Decoder);
|
||||||
|
static DecodeStatus DecodeDPairSpacedRegisterClass(llvm::MCInst &Inst,
|
||||||
|
unsigned RegNo, uint64_t Address,
|
||||||
|
const void *Decoder);
|
||||||
|
|
||||||
static DecodeStatus DecodePredicateOperand(llvm::MCInst &Inst, unsigned Val,
|
static DecodeStatus DecodePredicateOperand(llvm::MCInst &Inst, unsigned Val,
|
||||||
uint64_t Address, const void *Decoder);
|
uint64_t Address, const void *Decoder);
|
||||||
|
@ -1008,6 +1011,29 @@ static DecodeStatus DecodeDPairRegisterClass(llvm::MCInst &Inst, unsigned RegNo,
|
||||||
return MCDisassembler::Success;
|
return MCDisassembler::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const unsigned DPairSpacedDecoderTable[] = {
|
||||||
|
ARM::D0_D2, ARM::D1_D3, ARM::D2_D4, ARM::D3_D5,
|
||||||
|
ARM::D4_D6, ARM::D5_D7, ARM::D6_D8, ARM::D7_D9,
|
||||||
|
ARM::D8_D10, ARM::D9_D11, ARM::D10_D12, ARM::D11_D13,
|
||||||
|
ARM::D12_D14, ARM::D13_D15, ARM::D14_D16, ARM::D15_D17,
|
||||||
|
ARM::D16_D18, ARM::D17_D19, ARM::D18_D20, ARM::D19_D21,
|
||||||
|
ARM::D20_D22, ARM::D21_D23, ARM::D22_D24, ARM::D23_D25,
|
||||||
|
ARM::D24_D26, ARM::D25_D27, ARM::D26_D28, ARM::D27_D29,
|
||||||
|
ARM::D28_D30, ARM::D29_D31
|
||||||
|
};
|
||||||
|
|
||||||
|
static DecodeStatus DecodeDPairSpacedRegisterClass(llvm::MCInst &Inst,
|
||||||
|
unsigned RegNo,
|
||||||
|
uint64_t Address,
|
||||||
|
const void *Decoder) {
|
||||||
|
if (RegNo > 29)
|
||||||
|
return MCDisassembler::Fail;
|
||||||
|
|
||||||
|
unsigned Register = DPairSpacedDecoderTable[RegNo];
|
||||||
|
Inst.addOperand(MCOperand::CreateReg(Register));
|
||||||
|
return MCDisassembler::Success;
|
||||||
|
}
|
||||||
|
|
||||||
static DecodeStatus DecodePredicateOperand(llvm::MCInst &Inst, unsigned Val,
|
static DecodeStatus DecodePredicateOperand(llvm::MCInst &Inst, unsigned Val,
|
||||||
uint64_t Address, const void *Decoder) {
|
uint64_t Address, const void *Decoder) {
|
||||||
if (Val == 0xF) return MCDisassembler::Fail;
|
if (Val == 0xF) return MCDisassembler::Fail;
|
||||||
|
@ -1999,6 +2025,18 @@ static DecodeStatus DecodeVLDInstruction(llvm::MCInst &Inst, unsigned Insn,
|
||||||
if (!Check(S, DecodeDPairRegisterClass(Inst, Rd, Address, Decoder)))
|
if (!Check(S, DecodeDPairRegisterClass(Inst, Rd, Address, Decoder)))
|
||||||
return MCDisassembler::Fail;
|
return MCDisassembler::Fail;
|
||||||
break;
|
break;
|
||||||
|
case ARM::VLD2b16:
|
||||||
|
case ARM::VLD2b32:
|
||||||
|
case ARM::VLD2b8:
|
||||||
|
case ARM::VLD2b16wb_fixed:
|
||||||
|
case ARM::VLD2b16wb_register:
|
||||||
|
case ARM::VLD2b32wb_fixed:
|
||||||
|
case ARM::VLD2b32wb_register:
|
||||||
|
case ARM::VLD2b8wb_fixed:
|
||||||
|
case ARM::VLD2b8wb_register:
|
||||||
|
if (!Check(S, DecodeDPairSpacedRegisterClass(Inst, Rd, Address, Decoder)))
|
||||||
|
return MCDisassembler::Fail;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (!Check(S, DecodeDPRRegisterClass(Inst, Rd, Address, Decoder)))
|
if (!Check(S, DecodeDPRRegisterClass(Inst, Rd, Address, Decoder)))
|
||||||
return MCDisassembler::Fail;
|
return MCDisassembler::Fail;
|
||||||
|
@ -2358,6 +2396,18 @@ static DecodeStatus DecodeVSTInstruction(llvm::MCInst &Inst, unsigned Insn,
|
||||||
if (!Check(S, DecodeDPairRegisterClass(Inst, Rd, Address, Decoder)))
|
if (!Check(S, DecodeDPairRegisterClass(Inst, Rd, Address, Decoder)))
|
||||||
return MCDisassembler::Fail;
|
return MCDisassembler::Fail;
|
||||||
break;
|
break;
|
||||||
|
case ARM::VST2b16:
|
||||||
|
case ARM::VST2b32:
|
||||||
|
case ARM::VST2b8:
|
||||||
|
case ARM::VST2b16wb_fixed:
|
||||||
|
case ARM::VST2b16wb_register:
|
||||||
|
case ARM::VST2b32wb_fixed:
|
||||||
|
case ARM::VST2b32wb_register:
|
||||||
|
case ARM::VST2b8wb_fixed:
|
||||||
|
case ARM::VST2b8wb_register:
|
||||||
|
if (!Check(S, DecodeDPairSpacedRegisterClass(Inst, Rd, Address, Decoder)))
|
||||||
|
return MCDisassembler::Fail;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (!Check(S, DecodeDPRRegisterClass(Inst, Rd, Address, Decoder)))
|
if (!Check(S, DecodeDPRRegisterClass(Inst, Rd, Address, Decoder)))
|
||||||
return MCDisassembler::Fail;
|
return MCDisassembler::Fail;
|
||||||
|
|
|
@ -1042,6 +1042,15 @@ void ARMInstPrinter::printVectorListDPair(const MCInst *MI, unsigned OpNum,
|
||||||
O << "{" << getRegisterName(Reg0) << ", " << getRegisterName(Reg1) << "}";
|
O << "{" << getRegisterName(Reg0) << ", " << getRegisterName(Reg1) << "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ARMInstPrinter::printVectorListDPairSpaced(const MCInst *MI,
|
||||||
|
unsigned OpNum,
|
||||||
|
raw_ostream &O) {
|
||||||
|
unsigned Reg = MI->getOperand(OpNum).getReg();
|
||||||
|
unsigned Reg0 = MRI.getSubReg(Reg, ARM::dsub_0);
|
||||||
|
unsigned Reg1 = MRI.getSubReg(Reg, ARM::dsub_2);
|
||||||
|
O << "{" << getRegisterName(Reg0) << ", " << getRegisterName(Reg1) << "}";
|
||||||
|
}
|
||||||
|
|
||||||
void ARMInstPrinter::printVectorListThree(const MCInst *MI, unsigned OpNum,
|
void ARMInstPrinter::printVectorListThree(const MCInst *MI, unsigned OpNum,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
// Normally, it's not safe to use register enum values directly with
|
// Normally, it's not safe to use register enum values directly with
|
||||||
|
|
|
@ -135,6 +135,8 @@ public:
|
||||||
void printVectorListOne(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printVectorListOne(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
||||||
void printVectorListTwo(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printVectorListTwo(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
||||||
void printVectorListDPair(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printVectorListDPair(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
||||||
|
void printVectorListDPairSpaced(const MCInst *MI, unsigned OpNum,
|
||||||
|
raw_ostream &O);
|
||||||
void printVectorListThree(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printVectorListThree(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
||||||
void printVectorListFour(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printVectorListFour(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
||||||
void printVectorListOneAllLanes(const MCInst *MI, unsigned OpNum,
|
void printVectorListOneAllLanes(const MCInst *MI, unsigned OpNum,
|
||||||
|
|
|
@ -574,11 +574,10 @@ static int ARMFlagFromOpName(LiteralConstantEmitter *type,
|
||||||
REG("QQPR");
|
REG("QQPR");
|
||||||
REG("QQQQPR");
|
REG("QQQQPR");
|
||||||
REG("VecListOneD");
|
REG("VecListOneD");
|
||||||
REG("VecListTwoD");
|
|
||||||
REG("VecListDPair");
|
REG("VecListDPair");
|
||||||
|
REG("VecListDPairSpaced");
|
||||||
REG("VecListThreeD");
|
REG("VecListThreeD");
|
||||||
REG("VecListFourD");
|
REG("VecListFourD");
|
||||||
REG("VecListTwoQ");
|
|
||||||
REG("VecListOneDAllLanes");
|
REG("VecListOneDAllLanes");
|
||||||
REG("VecListTwoDAllLanes");
|
REG("VecListTwoDAllLanes");
|
||||||
REG("VecListTwoQAllLanes");
|
REG("VecListTwoQAllLanes");
|
||||||
|
|
Loading…
Reference in New Issue