mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
ARM sched model: Add divsion, loads, branches, vfp cvt
Add some generic SchedWrites and assign resources for Swift and Cortex A9. Reapply of r183257. (Removed empty InstRW for division on swift) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183319 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d87bd5627e
commit
c82157378e
@ -870,7 +870,8 @@ let Constraints = "$a = $dst" in {
|
||||
class AVConv1XInsS_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
|
||||
bit op5, dag oops, dag iops, InstrItinClass itin,
|
||||
string opc, string asm, list<dag> pattern>
|
||||
: AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern> {
|
||||
: AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern>,
|
||||
Sched<[WriteCvtFP]> {
|
||||
bits<5> dst;
|
||||
// if dp_operation then UInt(D:Vd) else UInt(Vd:D);
|
||||
let Inst{22} = dst{0};
|
||||
@ -881,7 +882,8 @@ class AVConv1XInsS_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
|
||||
class AVConv1XInsD_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
|
||||
bit op5, dag oops, dag iops, InstrItinClass itin,
|
||||
string opc, string asm, list<dag> pattern>
|
||||
: AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern> {
|
||||
: AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern>,
|
||||
Sched<[WriteCvtFP]> {
|
||||
bits<5> dst;
|
||||
// if dp_operation then UInt(D:Vd) else UInt(Vd:D);
|
||||
let Inst{22} = dst{4};
|
||||
|
@ -69,6 +69,21 @@ def WriteCMP : SchedWrite;
|
||||
def WriteCMPsi : SchedWrite;
|
||||
def WriteCMPsr : SchedWrite;
|
||||
|
||||
// Division.
|
||||
def WriteDiv : SchedWrite;
|
||||
|
||||
// Loads.
|
||||
def WriteLd : SchedWrite;
|
||||
def WritePreLd : SchedWrite;
|
||||
|
||||
// Branches.
|
||||
def WriteBr : SchedWrite;
|
||||
def WriteBrL : SchedWrite;
|
||||
def WriteBrTbl : SchedWrite;
|
||||
|
||||
// Fixpoint conversions.
|
||||
def WriteCvtFP : SchedWrite;
|
||||
|
||||
// Define TII for use in SchedVariant Predicates.
|
||||
def : PredicateProlog<[{
|
||||
const ARMBaseInstrInfo *TII =
|
||||
|
@ -2493,4 +2493,11 @@ def : SchedAlias<ReadALUsr, A9ReadALU>;
|
||||
def : SchedAlias<WriteCMP, A9WriteALU>;
|
||||
def : SchedAlias<WriteCMPsi, A9WriteALU>;
|
||||
def : SchedAlias<WriteCMPsr, A9WriteALU>;
|
||||
def : WriteRes<WriteDiv, []> { let Latency = 0; }
|
||||
|
||||
def : WriteRes<WriteBr, [A9UnitB]>;
|
||||
def : WriteRes<WriteBrL, [A9UnitB]>;
|
||||
def : WriteRes<WriteBrTbl, [A9UnitB]>;
|
||||
def : WriteRes<WritePreLd, []>;
|
||||
def : SchedAlias<WriteCvtFP, A9WriteF>;
|
||||
} // SchedModel = CortexA9Model
|
||||
|
@ -1096,9 +1096,27 @@ let SchedModel = SwiftModel in {
|
||||
def SwiftUnitDiv : ProcResource<1>;
|
||||
|
||||
// Generic resource requirements.
|
||||
def SwiftWriteP0OneCycle : SchedWriteRes<[SwiftUnitP0]>;
|
||||
def SwiftWriteP0TwoCycle : SchedWriteRes<[SwiftUnitP0]> { let Latency = 2; }
|
||||
def SwiftWriteP0FourCycle : SchedWriteRes<[SwiftUnitP0]> { let Latency = 4; }
|
||||
def SwiftWriteP0SixCycle : SchedWriteRes<[SwiftUnitP0]> { let Latency = 6; }
|
||||
def SwiftWriteP0P1FourCycle : SchedWriteRes<[SwiftUnitP0, SwiftUnitP1]> {
|
||||
let Latency = 4;
|
||||
}
|
||||
def SwiftWriteP0P1SixCycle : SchedWriteRes<[SwiftUnitP0, SwiftUnitP1]> {
|
||||
let Latency = 6;
|
||||
}
|
||||
def SwiftWriteP01OneCycle : SchedWriteRes<[SwiftUnitP01]>;
|
||||
def SwiftWriteP1TwoCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 2; }
|
||||
def SwiftWriteP1FourCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 4; }
|
||||
def SwiftWriteP1SixCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 6; }
|
||||
def SwiftWriteP1EightCycle : SchedWriteRes<[SwiftUnitP1]> { let Latency = 8; }
|
||||
def SwiftWriteP1TwelveCyc : SchedWriteRes<[SwiftUnitP1]> { let Latency = 12; }
|
||||
def SwiftWriteP01OneCycle2x : WriteSequence<[SwiftWriteP01OneCycle], 2>;
|
||||
def SwiftWriteP01OneCycle3x : WriteSequence<[SwiftWriteP01OneCycle], 3>;
|
||||
def SwiftWriteP01TwoCycle : SchedWriteRes<[SwiftUnitP01]> { let Latency = 2; }
|
||||
def SwiftWriteP01ThreeCycleTwoUops :
|
||||
SchedWriteRes<[SwiftUnitP01, SwiftUnitP01]> {
|
||||
def SwiftWriteP01ThreeCycleTwoUops : SchedWriteRes<[SwiftUnitP01,
|
||||
SwiftUnitP01]> {
|
||||
let Latency = 3;
|
||||
let NumMicroOps = 2;
|
||||
}
|
||||
@ -1107,7 +1125,23 @@ let SchedModel = SwiftModel in {
|
||||
let NumMicroOps = 3;
|
||||
let ResourceCycles = [3];
|
||||
}
|
||||
|
||||
// Plain load without writeback.
|
||||
def SwiftWriteP2ThreeCycle : SchedWriteRes<[SwiftUnitP2]> {
|
||||
let Latency = 3;
|
||||
}
|
||||
def SwiftWriteP2FourCycle : SchedWriteRes<[SwiftUnitP2]> {
|
||||
let Latency = 4;
|
||||
}
|
||||
// A store does not write to a register.
|
||||
def SwiftWriteP2 : SchedWriteRes<[SwiftUnitP2]> {
|
||||
let Latency = 0;
|
||||
}
|
||||
foreach Num = 1-4 in {
|
||||
def SwiftWrite#Num#xP2 : WriteSequence<[SwiftWriteP2], Num>;
|
||||
}
|
||||
def SwiftWriteP01OneCycle2x_load : WriteSequence<[SwiftWriteP01OneCycle,
|
||||
SwiftWriteP01OneCycle,
|
||||
SwiftWriteP2ThreeCycle]>;
|
||||
// 4.2.4 Arithmetic and Logical.
|
||||
// ALU operation register shifted by immediate variant.
|
||||
def SwiftWriteALUsi : SchedWriteVariant<[
|
||||
@ -1137,8 +1171,32 @@ let SchedModel = SwiftModel in {
|
||||
def : ReadAdvance<ReadALU, 0>;
|
||||
def : SchedAlias<ReadALUsr, SwiftReadAdvanceALUsr>;
|
||||
|
||||
|
||||
def SwiftChooseShiftKindP01OneOrTwoCycle : SchedWriteVariant<[
|
||||
SchedVar<IsFastImmShiftSwiftPred, [SwiftWriteP01OneCycle]>,
|
||||
SchedVar<NoSchedPred, [SwiftWriteP01TwoCycle]>
|
||||
]>;
|
||||
|
||||
// 4.2.5 Integer comparison
|
||||
def : WriteRes<WriteCMP, [SwiftUnitP01]>;
|
||||
def : WriteRes<WriteCMPsi, [SwiftUnitP01]>;
|
||||
def : WriteRes<WriteCMPsr, [SwiftUnitP01]>;
|
||||
def : SchedAlias<WriteCMPsi, SwiftChooseShiftKindP01OneOrTwoCycle>;
|
||||
def : SchedAlias<WriteCMPsr, SwiftWriteP01TwoCycle>;
|
||||
// 4.2.18 Integer Divide
|
||||
def : WriteRes<WriteDiv, [SwiftUnitDiv]>; // Workaround.
|
||||
def : InstRW < [WriteDiv],
|
||||
(instregex "SDIV", "UDIV", "t2SDIV", "t2UDIV")>;
|
||||
// 4.2.26 Branch
|
||||
def : WriteRes<WriteBr, [SwiftUnitP1]> { let Latency = 0; }
|
||||
def : WriteRes<WriteBrL, [SwiftUnitP1]> { let Latency = 2; }
|
||||
def : WriteRes<WriteBrTbl, [SwiftUnitP1, SwiftUnitP2]> { let Latency = 0; }
|
||||
|
||||
// 4.2.36 Advanced SIMD and VFP, Convert
|
||||
def : InstRW<[SwiftWriteP1FourCycle], (instregex "VCVT", "V(S|U)IT", "VTO(S|U)")>;
|
||||
// Fixpoint conversions.
|
||||
def : WriteRes<WriteCvtFP, [SwiftUnitP1]> { let Latency = 4; }
|
||||
// Preload.
|
||||
def : WriteRes<WritePreLd, [SwiftUnitP2]> { let Latency = 0;
|
||||
let ResourceCycles = [0];
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user