[llvm] r326064 - [X86] Simplify the ReplaceNodeResults code for X86ISD::AVG.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 25 18:16:33 PST 2018
Author: ctopper
Date: Sun Feb 25 18:16:33 2018
New Revision: 326064
URL: http://llvm.org/viewvc/llvm-project?rev=326064&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=326064&r1=326063&r2=326064&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Feb 25 18:16:33 2018
@@ -24828,19 +24828,13 @@ void X86TargetLowering::ReplaceNodeResul
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);
More information about the llvm-commits
mailing list