Skip to content

Commit b6c8feb

Browse files
committed
[NFC] [PowerPC] Remove dead code in BUILD_VECTOR peephole
The piece of code tries to use splat+shift to lower build_vector with repeating bit pattern. And immediate field of vector splat is only 5 bits (-16~15). It iterates over them one by one to find which shifts/rotates to number in build_vector. This patch removes code to try matching constant with algebraic right-shift because that's meaningless - any negative number's algebraic right-shift won't produce result smaller than itself. Besides, code (int)((unsigned)i >> j) means logical shift-right in C. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D93937
1 parent 48340fb commit b6c8feb

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9555,17 +9555,6 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
95559555
return DAG.getNode(ISD::BITCAST, dl, Op.getValueType(), Res);
95569556
}
95579557

9558-
// vsplti + sra self.
9559-
if (SextVal == (int)((unsigned)i >> TypeShiftAmt)) {
9560-
SDValue Res = getCanonicalConstSplat(i, SplatSize, MVT::Other, DAG, dl);
9561-
static const unsigned IIDs[] = { // Intrinsic to use for each size.
9562-
Intrinsic::ppc_altivec_vsrab, Intrinsic::ppc_altivec_vsrah, 0,
9563-
Intrinsic::ppc_altivec_vsraw
9564-
};
9565-
Res = BuildIntrinsicOp(IIDs[SplatSize-1], Res, Res, DAG, dl);
9566-
return DAG.getNode(ISD::BITCAST, dl, Op.getValueType(), Res);
9567-
}
9568-
95699558
// vsplti + rol self.
95709559
if (SextVal == (int)(((unsigned)i << TypeShiftAmt) |
95719560
((unsigned)i >> (SplatBitSize-TypeShiftAmt)))) {

0 commit comments

Comments
 (0)