mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Attempt to appease the arm-linux buildbot by fixing the JIT encodings for new
base register updating load/store-multiple instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98427 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
206d61e62f
commit
bffb5b39be
@ -58,12 +58,13 @@ namespace ARMII {
|
|||||||
Size4Bytes = 3,
|
Size4Bytes = 3,
|
||||||
Size2Bytes = 4,
|
Size2Bytes = 4,
|
||||||
|
|
||||||
// IndexMode - Unindex, pre-indexed, or post-indexed. Only valid for load
|
// IndexMode - Unindex, pre-indexed, or post-indexed are valid for load
|
||||||
// and store ops
|
// and store ops only. Generic "updating" flag is used for ld/st multiple.
|
||||||
IndexModeShift = 7,
|
IndexModeShift = 7,
|
||||||
IndexModeMask = 3 << IndexModeShift,
|
IndexModeMask = 3 << IndexModeShift,
|
||||||
IndexModePre = 1,
|
IndexModePre = 1,
|
||||||
IndexModePost = 2,
|
IndexModePost = 2,
|
||||||
|
IndexModeUpd = 3,
|
||||||
|
|
||||||
//===------------------------------------------------------------------===//
|
//===------------------------------------------------------------------===//
|
||||||
// Instruction encoding formats.
|
// Instruction encoding formats.
|
||||||
|
@ -925,19 +925,26 @@ static unsigned getAddrModeUPBits(unsigned Mode) {
|
|||||||
return Binary;
|
return Binary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMCodeEmitter::emitLoadStoreMultipleInstruction(
|
void ARMCodeEmitter::emitLoadStoreMultipleInstruction(const MachineInstr &MI) {
|
||||||
const MachineInstr &MI) {
|
const TargetInstrDesc &TID = MI.getDesc();
|
||||||
|
bool IsUpdating = (TID.TSFlags & ARMII::IndexModeMask) != 0;
|
||||||
|
|
||||||
// Part of binary is determined by TableGn.
|
// Part of binary is determined by TableGn.
|
||||||
unsigned Binary = getBinaryCodeForInstr(MI);
|
unsigned Binary = getBinaryCodeForInstr(MI);
|
||||||
|
|
||||||
// Set the conditional execution predicate
|
// Set the conditional execution predicate
|
||||||
Binary |= II->getPredicate(&MI) << ARMII::CondShift;
|
Binary |= II->getPredicate(&MI) << ARMII::CondShift;
|
||||||
|
|
||||||
|
// Skip operand 0 of an instruction with base register update.
|
||||||
|
unsigned OpIdx = 0;
|
||||||
|
if (IsUpdating)
|
||||||
|
++OpIdx;
|
||||||
|
|
||||||
// Set base address operand
|
// Set base address operand
|
||||||
Binary |= getMachineOpValue(MI, 0) << ARMII::RegRnShift;
|
Binary |= getMachineOpValue(MI, OpIdx++) << ARMII::RegRnShift;
|
||||||
|
|
||||||
// Set addressing mode by modifying bits U(23) and P(24)
|
// Set addressing mode by modifying bits U(23) and P(24)
|
||||||
const MachineOperand &MO = MI.getOperand(1);
|
const MachineOperand &MO = MI.getOperand(OpIdx++);
|
||||||
Binary |= getAddrModeUPBits(ARM_AM::getAM4SubMode(MO.getImm()));
|
Binary |= getAddrModeUPBits(ARM_AM::getAM4SubMode(MO.getImm()));
|
||||||
|
|
||||||
// Set bit W(21)
|
// Set bit W(21)
|
||||||
@ -945,7 +952,7 @@ void ARMCodeEmitter::emitLoadStoreMultipleInstruction(
|
|||||||
Binary |= 0x1 << ARMII::W_BitShift;
|
Binary |= 0x1 << ARMII::W_BitShift;
|
||||||
|
|
||||||
// Set registers
|
// Set registers
|
||||||
for (unsigned i = 5, e = MI.getNumOperands(); i != e; ++i) {
|
for (unsigned i = OpIdx+2, e = MI.getNumOperands(); i != e; ++i) {
|
||||||
const MachineOperand &MO = MI.getOperand(i);
|
const MachineOperand &MO = MI.getOperand(i);
|
||||||
if (!MO.isReg() || MO.isImplicit())
|
if (!MO.isReg() || MO.isImplicit())
|
||||||
break;
|
break;
|
||||||
@ -1322,17 +1329,25 @@ void ARMCodeEmitter::emitVFPLoadStoreInstruction(const MachineInstr &MI) {
|
|||||||
|
|
||||||
void ARMCodeEmitter::emitVFPLoadStoreMultipleInstruction(
|
void ARMCodeEmitter::emitVFPLoadStoreMultipleInstruction(
|
||||||
const MachineInstr &MI) {
|
const MachineInstr &MI) {
|
||||||
|
const TargetInstrDesc &TID = MI.getDesc();
|
||||||
|
bool IsUpdating = (TID.TSFlags & ARMII::IndexModeMask) != 0;
|
||||||
|
|
||||||
// Part of binary is determined by TableGn.
|
// Part of binary is determined by TableGn.
|
||||||
unsigned Binary = getBinaryCodeForInstr(MI);
|
unsigned Binary = getBinaryCodeForInstr(MI);
|
||||||
|
|
||||||
// Set the conditional execution predicate
|
// Set the conditional execution predicate
|
||||||
Binary |= II->getPredicate(&MI) << ARMII::CondShift;
|
Binary |= II->getPredicate(&MI) << ARMII::CondShift;
|
||||||
|
|
||||||
|
// Skip operand 0 of an instruction with base register update.
|
||||||
|
unsigned OpIdx = 0;
|
||||||
|
if (IsUpdating)
|
||||||
|
++OpIdx;
|
||||||
|
|
||||||
// Set base address operand
|
// Set base address operand
|
||||||
Binary |= getMachineOpValue(MI, 0) << ARMII::RegRnShift;
|
Binary |= getMachineOpValue(MI, OpIdx++) << ARMII::RegRnShift;
|
||||||
|
|
||||||
// Set addressing mode by modifying bits U(23) and P(24)
|
// Set addressing mode by modifying bits U(23) and P(24)
|
||||||
const MachineOperand &MO = MI.getOperand(1);
|
const MachineOperand &MO = MI.getOperand(OpIdx++);
|
||||||
Binary |= getAddrModeUPBits(ARM_AM::getAM5SubMode(MO.getImm()));
|
Binary |= getAddrModeUPBits(ARM_AM::getAM5SubMode(MO.getImm()));
|
||||||
|
|
||||||
// Set bit W(21)
|
// Set bit W(21)
|
||||||
@ -1340,11 +1355,11 @@ void ARMCodeEmitter::emitVFPLoadStoreMultipleInstruction(
|
|||||||
Binary |= 0x1 << ARMII::W_BitShift;
|
Binary |= 0x1 << ARMII::W_BitShift;
|
||||||
|
|
||||||
// First register is encoded in Dd.
|
// First register is encoded in Dd.
|
||||||
Binary |= encodeVFPRd(MI, 5);
|
Binary |= encodeVFPRd(MI, OpIdx+2);
|
||||||
|
|
||||||
// Number of registers are encoded in offset field.
|
// Number of registers are encoded in offset field.
|
||||||
unsigned NumRegs = 1;
|
unsigned NumRegs = 1;
|
||||||
for (unsigned i = 6, e = MI.getNumOperands(); i != e; ++i) {
|
for (unsigned i = OpIdx+3, e = MI.getNumOperands(); i != e; ++i) {
|
||||||
const MachineOperand &MO = MI.getOperand(i);
|
const MachineOperand &MO = MI.getOperand(i);
|
||||||
if (!MO.isReg() || MO.isImplicit())
|
if (!MO.isReg() || MO.isImplicit())
|
||||||
break;
|
break;
|
||||||
|
@ -112,6 +112,7 @@ class IndexMode<bits<2> val> {
|
|||||||
def IndexModeNone : IndexMode<0>;
|
def IndexModeNone : IndexMode<0>;
|
||||||
def IndexModePre : IndexMode<1>;
|
def IndexModePre : IndexMode<1>;
|
||||||
def IndexModePost : IndexMode<2>;
|
def IndexModePost : IndexMode<2>;
|
||||||
|
def IndexModeUpd : IndexMode<3>;
|
||||||
|
|
||||||
// Instruction execution domain.
|
// Instruction execution domain.
|
||||||
class Domain<bits<2> val> {
|
class Domain<bits<2> val> {
|
||||||
@ -852,17 +853,17 @@ class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
|
|||||||
|
|
||||||
|
|
||||||
// addrmode4 instructions
|
// addrmode4 instructions
|
||||||
class AXI4ld<dag oops, dag iops, Format f, InstrItinClass itin,
|
class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
|
||||||
string asm, string cstr, list<dag> pattern>
|
string asm, string cstr, list<dag> pattern>
|
||||||
: XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
|
: XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
|
||||||
asm, cstr, pattern> {
|
asm, cstr, pattern> {
|
||||||
let Inst{20} = 1; // L bit
|
let Inst{20} = 1; // L bit
|
||||||
let Inst{22} = 0; // S bit
|
let Inst{22} = 0; // S bit
|
||||||
let Inst{27-25} = 0b100;
|
let Inst{27-25} = 0b100;
|
||||||
}
|
}
|
||||||
class AXI4st<dag oops, dag iops, Format f, InstrItinClass itin,
|
class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
|
||||||
string asm, string cstr, list<dag> pattern>
|
string asm, string cstr, list<dag> pattern>
|
||||||
: XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
|
: XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
|
||||||
asm, cstr, pattern> {
|
asm, cstr, pattern> {
|
||||||
let Inst{20} = 0; // L bit
|
let Inst{20} = 0; // L bit
|
||||||
let Inst{22} = 0; // S bit
|
let Inst{22} = 0; // S bit
|
||||||
@ -1314,9 +1315,9 @@ class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load / store multiple
|
// Load / store multiple
|
||||||
class AXDI5<dag oops, dag iops, InstrItinClass itin,
|
class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
|
||||||
string asm, string cstr, list<dag> pattern>
|
string asm, string cstr, list<dag> pattern>
|
||||||
: VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
|
: VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
|
||||||
VFPLdStMulFrm, itin, asm, cstr, pattern> {
|
VFPLdStMulFrm, itin, asm, cstr, pattern> {
|
||||||
// TODO: Mark the instructions with the appropriate subtarget info.
|
// TODO: Mark the instructions with the appropriate subtarget info.
|
||||||
let Inst{27-25} = 0b110;
|
let Inst{27-25} = 0b110;
|
||||||
@ -1326,9 +1327,9 @@ class AXDI5<dag oops, dag iops, InstrItinClass itin,
|
|||||||
let Dom = VFPNeonDomain.Value;
|
let Dom = VFPNeonDomain.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AXSI5<dag oops, dag iops, InstrItinClass itin,
|
class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
|
||||||
string asm, string cstr, list<dag> pattern>
|
string asm, string cstr, list<dag> pattern>
|
||||||
: VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
|
: VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
|
||||||
VFPLdStMulFrm, itin, asm, cstr, pattern> {
|
VFPLdStMulFrm, itin, asm, cstr, pattern> {
|
||||||
// TODO: Mark the instructions with the appropriate subtarget info.
|
// TODO: Mark the instructions with the appropriate subtarget info.
|
||||||
let Inst{27-25} = 0b110;
|
let Inst{27-25} = 0b110;
|
||||||
|
@ -908,7 +908,7 @@ let isReturn = 1, isTerminator = 1, isBarrier = 1, mayLoad = 1,
|
|||||||
hasExtraDefRegAllocReq = 1 in
|
hasExtraDefRegAllocReq = 1 in
|
||||||
def LDM_RET : AXI4ld<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
def LDM_RET : AXI4ld<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
||||||
reglist:$dsts, variable_ops),
|
reglist:$dsts, variable_ops),
|
||||||
LdStMulFrm, IIC_Br,
|
IndexModeUpd, LdStMulFrm, IIC_Br,
|
||||||
"ldm${addr:submode}${p}\t$addr, $dsts",
|
"ldm${addr:submode}${p}\t$addr, $dsts",
|
||||||
"$addr.addr = $wb", []>;
|
"$addr.addr = $wb", []>;
|
||||||
|
|
||||||
@ -1347,24 +1347,26 @@ def STRHT: AI3sthpo<(outs GPR:$base_wb),
|
|||||||
|
|
||||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||||
def LDM : AXI4ld<(outs), (ins addrmode4:$addr, pred:$p,
|
def LDM : AXI4ld<(outs), (ins addrmode4:$addr, pred:$p,
|
||||||
reglist:$dsts, variable_ops), LdStMulFrm, IIC_iLoadm,
|
reglist:$dsts, variable_ops),
|
||||||
|
IndexModeNone, LdStMulFrm, IIC_iLoadm,
|
||||||
"ldm${addr:submode}${p}\t$addr, $dsts", "", []>;
|
"ldm${addr:submode}${p}\t$addr, $dsts", "", []>;
|
||||||
|
|
||||||
def LDM_UPD : AXI4ld<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
def LDM_UPD : AXI4ld<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
||||||
reglist:$dsts, variable_ops),
|
reglist:$dsts, variable_ops),
|
||||||
LdStMulFrm, IIC_iLoadm,
|
IndexModeUpd, LdStMulFrm, IIC_iLoadm,
|
||||||
"ldm${addr:submode}${p}\t$addr, $dsts",
|
"ldm${addr:submode}${p}\t$addr, $dsts",
|
||||||
"$addr.addr = $wb", []>;
|
"$addr.addr = $wb", []>;
|
||||||
} // mayLoad, hasExtraDefRegAllocReq
|
} // mayLoad, hasExtraDefRegAllocReq
|
||||||
|
|
||||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||||
def STM : AXI4st<(outs), (ins addrmode4:$addr, pred:$p,
|
def STM : AXI4st<(outs), (ins addrmode4:$addr, pred:$p,
|
||||||
reglist:$srcs, variable_ops), LdStMulFrm, IIC_iStorem,
|
reglist:$srcs, variable_ops),
|
||||||
|
IndexModeNone, LdStMulFrm, IIC_iStorem,
|
||||||
"stm${addr:submode}${p}\t$addr, $srcs", "", []>;
|
"stm${addr:submode}${p}\t$addr, $srcs", "", []>;
|
||||||
|
|
||||||
def STM_UPD : AXI4st<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
def STM_UPD : AXI4st<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p,
|
||||||
reglist:$srcs, variable_ops),
|
reglist:$srcs, variable_ops),
|
||||||
LdStMulFrm, IIC_iStorem,
|
IndexModeUpd, LdStMulFrm, IIC_iStorem,
|
||||||
"stm${addr:submode}${p}\t$addr, $srcs",
|
"stm${addr:submode}${p}\t$addr, $srcs",
|
||||||
"$addr.addr = $wb", []>;
|
"$addr.addr = $wb", []>;
|
||||||
} // mayStore, hasExtraSrcRegAllocReq
|
} // mayStore, hasExtraSrcRegAllocReq
|
||||||
|
@ -78,20 +78,20 @@ def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$src, addrmode5:$addr),
|
|||||||
|
|
||||||
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
|
||||||
def VLDMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts,
|
def VLDMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts,
|
||||||
variable_ops), IIC_fpLoadm,
|
variable_ops), IndexModeNone, IIC_fpLoadm,
|
||||||
"vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> {
|
"vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> {
|
||||||
let Inst{20} = 1;
|
let Inst{20} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
def VLDMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts,
|
def VLDMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts,
|
||||||
variable_ops), IIC_fpLoadm,
|
variable_ops), IndexModeNone, IIC_fpLoadm,
|
||||||
"vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> {
|
"vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> {
|
||||||
let Inst{20} = 1;
|
let Inst{20} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
def VLDMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
def VLDMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
||||||
reglist:$dsts, variable_ops),
|
reglist:$dsts, variable_ops),
|
||||||
IIC_fpLoadm,
|
IndexModeUpd, IIC_fpLoadm,
|
||||||
"vldm${addr:submode}${p}\t${addr:base}, $dsts",
|
"vldm${addr:submode}${p}\t${addr:base}, $dsts",
|
||||||
"$addr.base = $wb", []> {
|
"$addr.base = $wb", []> {
|
||||||
let Inst{20} = 1;
|
let Inst{20} = 1;
|
||||||
@ -99,7 +99,7 @@ def VLDMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
|||||||
|
|
||||||
def VLDMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
def VLDMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
||||||
reglist:$dsts, variable_ops),
|
reglist:$dsts, variable_ops),
|
||||||
IIC_fpLoadm,
|
IndexModeUpd, IIC_fpLoadm,
|
||||||
"vldm${addr:submode}${p}\t${addr:base}, $dsts",
|
"vldm${addr:submode}${p}\t${addr:base}, $dsts",
|
||||||
"$addr.base = $wb", []> {
|
"$addr.base = $wb", []> {
|
||||||
let Inst{20} = 1;
|
let Inst{20} = 1;
|
||||||
@ -108,20 +108,20 @@ def VLDMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
|||||||
|
|
||||||
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
|
||||||
def VSTMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs,
|
def VSTMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs,
|
||||||
variable_ops), IIC_fpStorem,
|
variable_ops), IndexModeNone, IIC_fpStorem,
|
||||||
"vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> {
|
"vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> {
|
||||||
let Inst{20} = 0;
|
let Inst{20} = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
def VSTMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs,
|
def VSTMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs,
|
||||||
variable_ops), IIC_fpStorem,
|
variable_ops), IndexModeNone, IIC_fpStorem,
|
||||||
"vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> {
|
"vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> {
|
||||||
let Inst{20} = 0;
|
let Inst{20} = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
def VSTMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
def VSTMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
||||||
reglist:$srcs, variable_ops),
|
reglist:$srcs, variable_ops),
|
||||||
IIC_fpStorem,
|
IndexModeUpd, IIC_fpStorem,
|
||||||
"vstm${addr:submode}${p}\t${addr:base}, $srcs",
|
"vstm${addr:submode}${p}\t${addr:base}, $srcs",
|
||||||
"$addr.base = $wb", []> {
|
"$addr.base = $wb", []> {
|
||||||
let Inst{20} = 0;
|
let Inst{20} = 0;
|
||||||
@ -129,7 +129,7 @@ def VSTMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
|||||||
|
|
||||||
def VSTMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
def VSTMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
|
||||||
reglist:$srcs, variable_ops),
|
reglist:$srcs, variable_ops),
|
||||||
IIC_fpStorem,
|
IndexModeUpd, IIC_fpStorem,
|
||||||
"vstm${addr:submode}${p}\t${addr:base}, $srcs",
|
"vstm${addr:submode}${p}\t${addr:base}, $srcs",
|
||||||
"$addr.base = $wb", []> {
|
"$addr.base = $wb", []> {
|
||||||
let Inst{20} = 0;
|
let Inst{20} = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user