forked from OSchip/llvm-project
[X86] Simplify the ReplaceNodeResults code for X86ISD::AVG.
This code seemed to try to widen to 128, 256, or 512 bit vectors, but we only create X86ISD::AVG with a power of 2 number of elements. This means the only nodes that need to be legalized are less than 128-bits and need to be widened up to 128 bits. llvm-svn: 326064
This commit is contained in:
parent
79d189f597
commit
2bf8e3e0e1
|
@ -24828,19 +24828,13 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
|
|||
assert(Subtarget.hasSSE2() && "Requires at least SSE2!");
|
||||
|
||||
auto InVT = N->getValueType(0);
|
||||
auto InVTSize = InVT.getSizeInBits();
|
||||
const unsigned RegSize =
|
||||
(InVTSize > 128) ? ((InVTSize > 256) ? 512 : 256) : 128;
|
||||
assert((Subtarget.hasBWI() || RegSize < 512) &&
|
||||
"512-bit vector requires AVX512BW");
|
||||
assert((Subtarget.hasAVX2() || RegSize < 256) &&
|
||||
"256-bit vector requires AVX2");
|
||||
assert(InVT.getSizeInBits() < 128);
|
||||
assert(128 % InVT.getSizeInBits() == 0);
|
||||
unsigned NumConcat = 128 / InVT.getSizeInBits();
|
||||
|
||||
auto ElemVT = InVT.getVectorElementType();
|
||||
auto RegVT = EVT::getVectorVT(*DAG.getContext(), ElemVT,
|
||||
RegSize / ElemVT.getSizeInBits());
|
||||
assert(RegSize % InVT.getSizeInBits() == 0);
|
||||
unsigned NumConcat = RegSize / InVT.getSizeInBits();
|
||||
EVT RegVT = EVT::getVectorVT(*DAG.getContext(),
|
||||
InVT.getVectorElementType(),
|
||||
NumConcat * InVT.getVectorNumElements());
|
||||
|
||||
SmallVector<SDValue, 16> Ops(NumConcat, DAG.getUNDEF(InVT));
|
||||
Ops[0] = N->getOperand(0);
|
||||
|
|
Loading…
Reference in New Issue