mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +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:
parent
9c0f762155
commit
ec657b923d
@ -27131,6 +27131,16 @@ static SDValue LowerScalarVariableShift(SDValue Op, SelectionDAG &DAG,
|
|||||||
|
|
||||||
if (SDValue BaseShAmt = DAG.getSplatValue(Amt)) {
|
if (SDValue BaseShAmt = DAG.getSplatValue(Amt)) {
|
||||||
if (SupportedVectorShiftWithBaseAmnt(VT, Subtarget, Opcode)) {
|
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();
|
MVT EltVT = VT.getVectorElementType();
|
||||||
assert(EltVT.bitsLE(MVT::i64) && "Unexpected element type!");
|
assert(EltVT.bitsLE(MVT::i64) && "Unexpected element type!");
|
||||||
if (EltVT != MVT::i64 && EltVT.bitsGT(MVT::i32))
|
if (EltVT != MVT::i64 && EltVT.bitsGT(MVT::i32))
|
||||||
|
Loading…
Reference in New Issue
Block a user