1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

X86: avoid vector-scalar shifts if splat amount is directly a vector ADD/SUB/AND op.

Prefer vector-vector shifts if available (AVX2+).
Improves code generated for rotate and funnel shifts.
Otherwise it would generate a shuffle + slower vector-scalar shift.
This commit is contained in:
Nekotekina 2019-04-21 12:32:17 +03:00
parent d5bc359dfd
commit 548daf04b5

View File

@ -28298,6 +28298,16 @@ static SDValue LowerScalarVariableShift(SDValue Op, SelectionDAG &DAG,
if (SDValue BaseShAmt = DAG.getSplatValue(Amt)) {
if (SupportedVectorShiftWithBaseAmnt(VT, Subtarget, Opcode)) {
if (SupportedVectorVarShift(VT, Subtarget, Opcode)) {
// Avoid vector-scalar shift in some cases (TODO).
unsigned AmtOp = Amt.getOpcode();
switch (AmtOp) {
case ISD::ADD:
case ISD::SUB:
case ISD::AND:
return SDValue();
}
}
MVT EltVT = VT.getVectorElementType();
assert(EltVT.bitsLE(MVT::i64) && "Unexpected element type!");
if (EltVT != MVT::i64 && EltVT.bitsGT(MVT::i32))