[llvm-commits] Please Review: ZERO_EXTEND/SIGN_EXTEND/TRUNCATE optimization for AVX2

Chad Rosier mcrosier at apple.com
Thu Apr 19 10:29:11 PDT 2012


Mostly stylistic comments:

+      SmallVector<SDValue,32> pshufbMask;
+      for (unsigned i=0; i<2; i++) {

Spacing: for (unsigned i = 0; i < 2; i++)

+        for (unsigned j=0; j<8; ++j)
+          pshufbMask.push_back(DAG.getConstant(0x80, MVT::i8));

Ditto.

-  // Optimize vectors in AVX mode
-  // Sign extend  v8i16 to v8i32 and
-  //              v4i32 to v4i64
-  //
-  // Divide input vector into two parts
-  // for v4i32 the shuffle mask will be { 0, 1, -1, -1} {2, 3, -1, -1}
-  // use vpmovsx instruction to extend v4i32 -> v2i64; v8i16 -> v4i32
-  // concat the vectors to original VT

Why was the comment moved?

+      if (Subtarget->hasAVX2()) {
+        return DAG.getNode(X86ISD::VZEXT_MOVL, dl, VT, N0);
+      }
 
Extraneous braces.

+let Predicates = [HasAVX2] in {
+  let AddedComplexity = 15 in {
+    def : Pat<(v4i64 (X86vzmovly (v4i32 VR128:$src))), (VPMOVZXDQYrr VR128:$src)>;
+    def : Pat<(v8i32 (X86vzmovly (v8i16 VR128:$src))), (VPMOVZXWDYrr VR128:$src)>;
+  }
+}
+
+let Predicates = [HasAVX2] in {
+def : Pat<(v4i64 (X86vsmovl (v4i32 VR128:$src))), (VPMOVSXDQYrr VR128:$src)>;
+def : Pat<(v8i32 (X86vsmovl (v8i16 VR128:$src))), (VPMOVSXWDYrr VR128:$src)>;
+}
+

Why not remove inner brace and Predicates?

let Predicates = [HasAVX2] in {
  let AddedComplexity = 15 in {
    def : Pat<(v4i64 (X86vzmovly (v4i32 VR128:$src))), (VPMOVZXDQYrr VR128:$src)>;
    def : Pat<(v8i32 (X86vzmovly (v8i16 VR128:$src))), (VPMOVZXWDYrr VR128:$src)>;
  }
def : Pat<(v4i64 (X86vsmovl (v4i32 VR128:$src))), (VPMOVSXDQYrr VR128:$src)>;
def : Pat<(v8i32 (X86vsmovl (v8i16 VR128:$src))), (VPMOVSXWDYrr VR128:$src)>;
}

Maybe Craig or someone else can give you more feedback on the correctness of the patch, but it looks good as far as I can tell.

 Chad

On Apr 19, 2012, at 6:03 AM, Demikhovsky, Elena wrote:

> 
> I did not received any review.
> May I submit this patch?
> 
> Thanks
> 
> - Elena
> 
> _____________________________________________
> From: Demikhovsky, Elena
> Sent: Monday, April 16, 2012 09:37
> To: llvm-commits at cs.uiuc.edu
> Subject: Please Review: ZERO_EXTEND/SIGN_EXTEND/TRUNCATE optimization for AVX2
> 
> 
> 
> I use VPMOVZX/VPMOVSX instructions to optimize extensions.
> And AVX2 shuffle instructions allow to optimize TRUNCATE.
> 
> - Elena
> 
> 
> ---------------------------------------------------------------------
> 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.
> <conv.diff>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list