Skip to content

Commit c0121bf

Browse files
committed
[mips] Add missing schedinfo for atomic instructions
llvm-svn: 364756
1 parent 3a10810 commit c0121bf

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

llvm/lib/Target/Mips/MipsInstrInfo.td

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,9 @@ class InsBase<string opstr, RegisterOperand RO, Operand PosOpnd,
18511851
// Atomic instructions with 2 source operands (ATOMIC_SWAP & ATOMIC_LOAD_*).
18521852
class Atomic2Ops<PatFrag Op, RegisterClass DRC> :
18531853
PseudoSE<(outs DRC:$dst), (ins PtrRC:$ptr, DRC:$incr),
1854-
[(set DRC:$dst, (Op iPTR:$ptr, DRC:$incr))]>;
1854+
[(set DRC:$dst, (Op iPTR:$ptr, DRC:$incr))]> {
1855+
let hasNoSchedulingInfo = 1;
1856+
}
18551857

18561858
class Atomic2OpsPostRA<RegisterClass RC> :
18571859
PseudoSE<(outs RC:$dst), (ins PtrRC:$ptr, RC:$incr), []> {
@@ -1868,7 +1870,9 @@ class Atomic2OpsSubwordPostRA<RegisterClass RC> :
18681870
// during ISelLowering, which produces the PostRA version of this instruction.
18691871
class AtomicCmpSwap<PatFrag Op, RegisterClass DRC> :
18701872
PseudoSE<(outs DRC:$dst), (ins PtrRC:$ptr, DRC:$cmp, DRC:$swap),
1871-
[(set DRC:$dst, (Op iPTR:$ptr, DRC:$cmp, DRC:$swap))]>;
1873+
[(set DRC:$dst, (Op iPTR:$ptr, DRC:$cmp, DRC:$swap))]> {
1874+
let hasNoSchedulingInfo = 1;
1875+
}
18721876

18731877
class AtomicCmpSwapPostRA<RegisterClass RC> :
18741878
PseudoSE<(outs RC:$dst), (ins PtrRC:$ptr, RC:$cmp, RC:$swap), []> {
@@ -1883,7 +1887,6 @@ class AtomicCmpSwapSubwordPostRA<RegisterClass RC> :
18831887
let mayStore = 1;
18841888
}
18851889

1886-
18871890
class LLBase<string opstr, RegisterOperand RO, DAGOperand MO = mem> :
18881891
InstSE<(outs RO:$rt), (ins MO:$addr), !strconcat(opstr, "\t$rt, $addr"),
18891892
[], II_LL, FrmI, opstr> {

llvm/lib/Target/Mips/MipsScheduleP5600.td

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,4 +593,20 @@ def : InstRW<[P5600WriteFPUL], (instregex "^ROUND_(L|W)_(S|D32|D64)$")>;
593593
// Reason behind guess: rotr is in the same category and the two register forms
594594
// generally follow the immediate forms in this category
595595
def : InstRW<[P5600WriteEitherALU], (instrs ROTRV)>;
596+
597+
// Atomic instructions
598+
599+
// FIXME: Define `WriteAtomic` in the MipsSchedule.td and
600+
// attach it to the Atomic2OpsPostRA, AtomicCmpSwapPostRA, ...
601+
// classes. Then just define resources for the `WriteAtomic` in each
602+
// machine models.
603+
def P5600Atomic : ProcResource<1> { let BufferSize = 1; }
604+
def P5600WriteAtomic : SchedWriteRes<[P5600Atomic]> { let Latency = 2; }
605+
606+
def : InstRW<[P5600WriteAtomic],
607+
(instregex "^ATOMIC_SWAP_I(8|16|32|64)_POSTRA$")>;
608+
def : InstRW<[P5600WriteAtomic],
609+
(instregex "^ATOMIC_CMP_SWAP_I(8|16|32|64)_POSTRA$")>;
610+
def : InstRW<[P5600WriteAtomic],
611+
(instregex "^ATOMIC_LOAD_(ADD|SUB|AND|OR|XOR|NAND)_I(8|16|32|64)_POSTRA$")>;
596612
}

0 commit comments

Comments
 (0)