[llvm-commits] VPBLENDD match in AVX2 - please review
Nadav Rotem
nrotem at apple.com
Tue Dec 4 08:54:03 PST 2012
LGTM. Please commit. I have two small comments:
+ //There are 2 lanes if (NumElems > 8), and 1 lane otherwise.
+ unsigned NumLanes = (NumElems-1)/8 + 1;
+ unsigned NumElemsInLane = NumElems / NumLanes;
Space before the "There".
+ // Convert i32 vectors to floating point if it is not AVX2.
+ // AVX2 introduced VPBLENDD instruction for 128 and 256-bit vectors.
+ EVT BlendVT = VT;
+ if (!Subtarget->hasInt256() && (EltVT == MVT::i32 || EltVT == MVT::i64)) {
+ BlendVT = EVT::getVectorVT(*DAG.getContext(),
+ EVT::getFloatingPointVT(EltVT.getSizeInBits()),
+ NumElems);
+ V1 = DAG.getNode(ISD::BITCAST, dl, VT, V1);
+ V2 = DAG.getNode(ISD::BITCAST, dl, VT, V2);
+ }
+
+ SDValue Ret = DAG.getNode(X86ISD::BLENDI, dl, BlendVT, V1, V2,
+ DAG.getConstant(MaskValue, MVT::i32));
I think that this code is redundant. Why not convert the blend operands to floats in all cases ? If they are already floats then the SelectionDAG getNode method will not create an extra bit cast.
On Dec 4, 2012, at 2:05 AM, "Demikhovsky, Elena" <elena.demikhovsky at intel.com> wrote:
> <blend.diff>
More information about the llvm-commits
mailing list