[llvm-commits] VPBLENDD match in AVX2 - please review

Demikhovsky, Elena elena.demikhovsky at intel.com
Wed Dec 5 00:34:57 PST 2012


> Why not convert the blend operands to floats in all cases ?  

1. Because I want to generate VPBLENDD for integers instead of VBLENDPS (I don't gain performance in this case, just in respect for somebody who invented VPBLENDD in AVX2)
2. I can't convert i16 vectors to fp

But the condition should be corrected:
if (EltVT == MVT::i64 || (EltVT == MVT::i32 && !Subtarget->hasInt256()))
Because this "somebody" did not invent VPBLENDQ.

I added an additional test case that checks i64 blend.

Thank you for the review.

- Elena

-----Original Message-----
From: Nadav Rotem [mailto:nrotem at apple.com] 
Sent: Tuesday, December 04, 2012 18:54
To: Demikhovsky, Elena
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] VPBLENDD match in AVX2 - please review

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>

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-commits mailing list