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:
parent
d5bc359dfd
commit
548daf04b5
@ -28298,6 +28298,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