Skip to content

Commit 29edda1

Browse files
committed
Address review comments
1 parent 95d0a17 commit 29edda1

File tree

5 files changed

+14
-35
lines changed

5 files changed

+14
-35
lines changed

clang/lib/Headers/amo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
\*===----------------------------------------------------------------------===*/
88

9-
/* This header provides compatibility wrappers for GCC's AMO functions.
9+
/* This header provides compatibility for GCC's AMO functions.
1010
* The functions here call Clang's underlying AMO builtins.
1111
*/
1212

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11634,29 +11634,6 @@ SDValue PPCTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
1163411634
return Flags;
1163511635
}
1163611636

11637-
SDValue PPCTargetLowering::LowerINTRINSIC_W_CHAIN(SDValue Op,
11638-
SelectionDAG &DAG) const {
11639-
unsigned IntrinsicID = Op.getConstantOperandVal(1);
11640-
11641-
SDLoc dl(Op);
11642-
switch (IntrinsicID) {
11643-
case Intrinsic::ppc_amo_lwat:
11644-
case Intrinsic::ppc_amo_ldat:
11645-
SDValue Ptr = Op.getOperand(2);
11646-
SDValue Val1 = Op.getOperand(3);
11647-
SDValue FC = Op.getOperand(4);
11648-
SDValue Ops[] = {Ptr, Val1, FC};
11649-
bool IsLwat = IntrinsicID == Intrinsic::ppc_amo_lwat;
11650-
unsigned Opcode = IsLwat ? PPC::LWAT_PSEUDO : PPC::LDAT_PSEUDO;
11651-
MachineSDNode *MNode = DAG.getMachineNode(
11652-
Opcode, dl, {IsLwat ? MVT::i32 : MVT::i64, MVT::Other}, Ops);
11653-
SDValue Result = SDValue(MNode, 0);
11654-
SDValue OutChain = SDValue(MNode, 1);
11655-
return DAG.getMergeValues({Result, OutChain}, dl);
11656-
}
11657-
return SDValue();
11658-
}
11659-
1166011637
SDValue PPCTargetLowering::LowerINTRINSIC_VOID(SDValue Op,
1166111638
SelectionDAG &DAG) const {
1166211639
// SelectionDAGBuilder::visitTargetIntrinsic may insert one extra chain to
@@ -12827,9 +12804,9 @@ SDValue PPCTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
1282712804
return LowerFP_ROUND(Op, DAG);
1282812805
case ISD::ROTL: return LowerROTL(Op, DAG);
1282912806

12830-
// For counter-based loop handling, and amo load.
12807+
// For counter-based loop handling.
1283112808
case ISD::INTRINSIC_W_CHAIN:
12832-
return LowerINTRINSIC_W_CHAIN(Op, DAG);
12809+
return SDValue();
1283312810

1283412811
case ISD::BITCAST: return LowerBITCAST(Op, DAG);
1283512812

@@ -14756,16 +14733,19 @@ PPCTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
1475614733
.addImm(PPC::sub_32);
1475714734
else
1475814735
Val64 = ValReg;
14759-
Register Pair = MRI.createVirtualRegister(&PPC::G8pRCRegClass);
14760-
BuildMI(*BB, MI, DL, TII->get(TargetOpcode::IMPLICIT_DEF), Pair);
14761-
Register PairWithVal = MRI.createVirtualRegister(&PPC::G8pRCRegClass);
14762-
BuildMI(*BB, MI, DL, TII->get(TargetOpcode::INSERT_SUBREG), PairWithVal)
14763-
.addReg(Pair)
14736+
14737+
Register G8rPair = MRI.createVirtualRegister(&PPC::G8pRCRegClass);
14738+
Register UndefG8r = MRI.createVirtualRegister(&PPC::G8RCRegClass);
14739+
BuildMI(*BB, MI, DL, TII->get(TargetOpcode::IMPLICIT_DEF), UndefG8r);
14740+
BuildMI(*BB, MI, DL, TII->get(PPC::REG_SEQUENCE), G8rPair)
14741+
.addReg(UndefG8r)
14742+
.addImm(PPC::sub_gp8_x0)
1476414743
.addReg(Val64)
1476514744
.addImm(PPC::sub_gp8_x1);
14745+
1476614746
Register PairResult = MRI.createVirtualRegister(&PPC::G8pRCRegClass);
1476714747
BuildMI(*BB, MI, DL, TII->get(IsLwat ? PPC::LWAT : PPC::LDAT), PairResult)
14768-
.addReg(PairWithVal)
14748+
.addReg(G8rPair)
1476914749
.addReg(PtrReg)
1477014750
.addImm(FC);
1477114751
Register Result64 = MRI.createVirtualRegister(&PPC::G8RCRegClass);

llvm/lib/Target/PowerPC/PPCISelLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,6 @@ namespace llvm {
13121312
EVT VT, SDValue V1, SDValue V2) const;
13131313
SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
13141314
SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
1315-
SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
13161315
SDValue LowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
13171316
SDValue LowerBSWAP(SDValue Op, SelectionDAG &DAG) const;
13181317
SDValue LowerATOMIC_CMP_SWAP(SDValue Op, SelectionDAG &DAG) const;

llvm/lib/Target/PowerPC/PPCInstr64Bit.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def LDAT_PSEUDO : PPCCustomInserterPseudo<
338338
(outs g8rc:$dst),
339339
(ins ptr_rc_nor0:$ptr, g8rc:$val, u5imm:$fc),
340340
"#LDAT_PSEUDO",
341-
[]>;
341+
[(set i64:$dst, (int_ppc_amo_ldat ptr_rc_nor0:$ptr, g8rc:$val, timm:$fc))]>;
342342

343343
let Defs = [CR0], mayStore = 1, mayLoad = 0, hasSideEffects = 0 in {
344344
def STDCX : XForm_1_memOp<31, 214, (outs), (ins g8rc:$RST, (memrr $RA, $RB):$addr),

llvm/lib/Target/PowerPC/PPCInstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ def LWAT_PSEUDO : PPCCustomInserterPseudo<
18771877
(outs gprc:$dst),
18781878
(ins ptr_rc_nor0:$ptr, gprc:$val, u5imm:$fc),
18791879
"#LWAT_PSEUDO",
1880-
[]>;
1880+
[(set i32:$dst, (int_ppc_amo_lwat ptr_rc_nor0:$ptr, gprc:$val, timm:$fc))]>;
18811881

18821882
let Defs = [CR0], mayStore = 1, mayLoad = 0, hasSideEffects = 0 in {
18831883
def STBCX : XForm_1_memOp<31, 694, (outs), (ins gprc:$RST, (memrr $RA, $RB):$addr),

0 commit comments

Comments
 (0)