Skip to content

Commit 73496b6

Browse files
committed
cleanup
1 parent 5d3ff20 commit 73496b6

File tree

2 files changed

+29
-48
lines changed

2 files changed

+29
-48
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -652,14 +652,16 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
652652
setOperationAction(ISD::EH_DWARF_CFA, MVT::i32, Custom);
653653
setOperationAction(ISD::EH_DWARF_CFA, MVT::i64, Custom);
654654

655-
setOperationAction(ISD::VP_STORE, MVT::v16i1, Custom);
656-
setOperationAction(ISD::VP_STORE, MVT::v8i1, Custom);
657-
setOperationAction(ISD::VP_STORE, MVT::v4i1, Custom);
658-
setOperationAction(ISD::VP_STORE, MVT::v2i1, Custom);
659-
setOperationAction(ISD::VP_LOAD, MVT::v16i1, Custom);
660-
setOperationAction(ISD::VP_LOAD, MVT::v8i1, Custom);
661-
setOperationAction(ISD::VP_LOAD, MVT::v4i1, Custom);
662-
setOperationAction(ISD::VP_LOAD, MVT::v2i1, Custom);
655+
if (Subtarget.isISA3_0() && isPPC64) {
656+
setOperationAction(ISD::VP_STORE, MVT::v16i1, Custom);
657+
setOperationAction(ISD::VP_STORE, MVT::v8i1, Custom);
658+
setOperationAction(ISD::VP_STORE, MVT::v4i1, Custom);
659+
setOperationAction(ISD::VP_STORE, MVT::v2i1, Custom);
660+
setOperationAction(ISD::VP_LOAD, MVT::v16i1, Custom);
661+
setOperationAction(ISD::VP_LOAD, MVT::v8i1, Custom);
662+
setOperationAction(ISD::VP_LOAD, MVT::v4i1, Custom);
663+
setOperationAction(ISD::VP_LOAD, MVT::v2i1, Custom);
664+
}
663665

664666
// We want to custom lower some of our intrinsics.
665667
setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom);
@@ -11924,73 +11926,51 @@ static SDValue AdjustLength(SDValue Val, unsigned Bits, bool Left,
1192411926
EVT VT = Val->getValueType(0);
1192511927
unsigned LeftAdj = Left ? VT.getSizeInBits() - 8 : 0;
1192611928
unsigned TypeAdj = llvm::countr_zero<uint32_t>(Bits / 8);
11927-
// unsigned Shift = llvm::countr_zero<uint64_t>(Imm);
11928-
// EVT ShiftAmountTy = getShiftAmountTy(VT, DAG.getDataLayout());
11929-
// if (Value > 0 && isPowerOf2_64(Value))
1193011929
SDValue SHLAmt = DAG.getConstant(LeftAdj + TypeAdj, dl, VT);
1193111930
return DAG.getNode(ISD::SHL, dl, VT, Val, SHLAmt);
1193211931
}
1193311932

1193411933
SDValue PPCTargetLowering::LowerVP_LOAD(SDValue Op, SelectionDAG &DAG) const {
11935-
dbgs() << "&&& Lower VP_LOAD\n";
11936-
Op.dump();
1193711934
auto VPLD = cast<VPLoadSDNode>(Op);
1193811935
bool Future = Subtarget.isISAFuture();
1193911936
SDLoc dl(Op);
1194011937
assert(ISD::isConstantSplatVectorAllOnes(Op->getOperand(3).getNode(), true) &&
1194111938
"Mask predication not supported");
1194211939
EVT PtrVT = getPointerTy(DAG.getDataLayout());
1194311940
SDValue Len = DAG.getNode(ISD::ANY_EXTEND, dl, PtrVT, VPLD->getOperand(4));
11944-
unsigned IID = Future ? Intrinsic::ppc_vsx_lxvrl : Intrinsic::ppc_vsx_lxvl;
11941+
unsigned IID = Future ? Intrinsic::ppc_vsx_lxvrl : Intrinsic::ppc_vsx_lxvl;
1194511942
unsigned EltBits = Op->getValueType(0).getScalarType().getSizeInBits();
1194611943
Len = AdjustLength(Len, EltBits, !Future, DAG);
11947-
SDValue Ops[] = {
11948-
VPLD->getChain(), // Chain
11949-
// DAG.getConstant(Intrinsic::ppc_vsx_lxvl, dl, MVT::i32),
11950-
DAG.getConstant(IID, dl, MVT::i32),
11951-
VPLD->getOperand(1),
11952-
// VPLD->getOperand(4),
11953-
// DAG.getNode(ISD::ANY_EXTEND, dl, PtrVT, VPLD->getOperand(4)),
11954-
Len
11955-
};
11944+
SDValue Ops[] = {VPLD->getChain(), DAG.getConstant(IID, dl, MVT::i32),
11945+
VPLD->getOperand(1), Len};
1195611946
SDVTList Tys = DAG.getVTList(Op->getValueType(0), MVT::Other);
11957-
SDValue VPL = DAG.getMemIntrinsicNode(ISD::INTRINSIC_W_CHAIN, dl, Tys,
11958-
Ops, VPLD->getMemoryVT(), VPLD->getMemOperand());
11959-
VPL.dump();
11947+
SDValue VPL =
11948+
DAG.getMemIntrinsicNode(ISD::INTRINSIC_W_CHAIN, dl, Tys, Ops,
11949+
VPLD->getMemoryVT(), VPLD->getMemOperand());
1196011950
return VPL;
11961-
// return SDValue();
1196211951
}
1196311952

1196411953
SDValue PPCTargetLowering::LowerVP_STORE(SDValue Op, SelectionDAG &DAG) const {
11965-
dbgs() << "&&& Lower VP_STORE\n";
11966-
Op.dump();
1196711954
auto VPST = cast<VPStoreSDNode>(Op);
1196811955
assert(ISD::isConstantSplatVectorAllOnes(Op->getOperand(4).getNode(), true) &&
1196911956
"Mask predication not supported");
1197011957
EVT PtrVT = getPointerTy(DAG.getDataLayout());
1197111958
SDLoc dl(Op);
1197211959
SDValue Len = DAG.getNode(ISD::ANY_EXTEND, dl, PtrVT, VPST->getOperand(5));
11973-
unsigned EltBits = Op->getOperand(1).getValueType().getScalarType().getSizeInBits();
11960+
unsigned EltBits =
11961+
Op->getOperand(1).getValueType().getScalarType().getSizeInBits();
1197411962
bool Future = Subtarget.isISAFuture();
11975-
unsigned IID = Future ? Intrinsic::ppc_vsx_stxvrl : Intrinsic::ppc_vsx_stxvl;
11963+
unsigned IID = Future ? Intrinsic::ppc_vsx_stxvrl : Intrinsic::ppc_vsx_stxvl;
1197611964
Len = AdjustLength(Len, EltBits, !Future, DAG);
1197711965
SDValue Ops[] = {
11978-
VPST->getChain(), // Chain
11979-
// DAG.getConstant(Intrinsic::ppc_vsx_stxvl, dl, MVT::i32),
11980-
DAG.getConstant(IID, dl, MVT::i32),
11981-
// DAG.getTargetConstant(Intrinsic::ppc_vsx_stxvl, dl, MVT::i64),
11982-
DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, VPST->getOperand(1)),
11983-
VPST->getOperand(2),
11984-
// DAG.getNode(ISD::ANY_EXTEND, dl, PtrVT, VPST->getOperand(5)),
11985-
Len
11986-
};
11966+
VPST->getChain(), DAG.getConstant(IID, dl, MVT::i32),
11967+
DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, VPST->getOperand(1)),
11968+
VPST->getOperand(2), Len};
1198711969
SDVTList Tys = DAG.getVTList(MVT::Other);
11988-
// SDValue VPS = DAG.getMemIntrinsicNode(ISD::INTRINSIC_W_CHAIN, dl, Tys,
11989-
SDValue VPS = DAG.getMemIntrinsicNode(ISD::INTRINSIC_VOID, dl, Tys,
11990-
Ops, VPST->getMemoryVT(), VPST->getMemOperand());
11991-
VPS.dump();
11970+
SDValue VPS =
11971+
DAG.getMemIntrinsicNode(ISD::INTRINSIC_VOID, dl, Tys, Ops,
11972+
VPST->getMemoryVT(), VPST->getMemOperand());
1199211973
return VPS;
11993-
// return SDValue();
1199411974
}
1199511975

1199611976
SDValue PPCTargetLowering::LowerSCALAR_TO_VECTOR(SDValue Op,

llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,14 +1044,16 @@ PPCTTIImpl::getVPLegalizationStrategy(const VPIntrinsic &PI) const {
10441044
(!Pwr9EVL || Directive != PPC::DIR_PWR9))
10451045
return DefaultLegalization;
10461046

1047+
if (!ST->isPPC64())
1048+
return DefaultLegalization;
1049+
10471050
unsigned IID = PI.getIntrinsicID();
10481051
if (IID != Intrinsic::vp_load && IID != Intrinsic::vp_store)
10491052
return DefaultLegalization;
10501053

10511054
bool IsLoad = IID == Intrinsic::vp_load;
1052-
Type* VecTy = IsLoad ? PI.getType() : PI.getOperand(0)->getType();
1055+
Type *VecTy = IsLoad ? PI.getType() : PI.getOperand(0)->getType();
10531056
EVT VT = TLI->getValueType(DL, VecTy, true);
1054-
// dbgs() << "&&& Typecheck " << VT << "\n";
10551057
if (VT != MVT::v2i64 && VT != MVT::v4i32 && VT != MVT::v8i16 &&
10561058
VT != MVT::v16i8)
10571059
return DefaultLegalization;
@@ -1068,4 +1070,3 @@ PPCTTIImpl::getVPLegalizationStrategy(const VPIntrinsic &PI) const {
10681070

10691071
return VPLegalization(VPLegalization::Legal, VPLegalization::Legal);
10701072
}
1071-

0 commit comments

Comments
 (0)