sse.md (vec_unpacks_lo_<mode>, [...]): Change VI124_128 mode to VI124_AVX2.
authorJakub Jelinek <jakub@redhat.com>
Wed, 12 Oct 2011 22:07:24 +0000 (00:07 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 12 Oct 2011 22:07:24 +0000 (00:07 +0200)
* config/i386/sse.md (vec_unpacks_lo_<mode>,
vec_unpacks_hi_<mode>, vec_unpacku_lo_<mode>,
vec_unpacku_hi_<mode>): Change VI124_128 mode to
VI124_AVX2.
* config/i386/i386.c (ix86_expand_sse_unpack): Handle
V32QImode, V16HImode and V8SImode for TARGET_AVX2.

From-SVN: r179872

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/sse.md

index 753677a5a1562e34ff94e24f62054f4d07a6b340..cdc939122d005dbb81efbb233bdd655ab981b9d8 100644 (file)
@@ -1,5 +1,12 @@
 2011-10-12  Jakub Jelinek  <jakub@redhat.com>
 
+       * config/i386/sse.md (vec_unpacks_lo_<mode>,
+       vec_unpacks_hi_<mode>, vec_unpacku_lo_<mode>,
+       vec_unpacku_hi_<mode>): Change VI124_128 mode to
+       VI124_AVX2.
+       * config/i386/i386.c (ix86_expand_sse_unpack): Handle
+       V32QImode, V16HImode and V8SImode for TARGET_AVX2.
+
        * config/i386/sse.md (vec_avx2): New mode_attr.
        (mulv16qi3): Macroize to cover also mulv32qi3 for
        TARGET_AVX2 into ...
index 26a49241619253954f5485bc3a42f1cea5fc6a95..3a5382964dac34ead3f9f7c6e80c4ea955d2deeb 100644 (file)
@@ -19683,9 +19683,38 @@ ix86_expand_sse_unpack (rtx operands[2], bool unsigned_p, bool high_p)
   if (TARGET_SSE4_1)
     {
       rtx (*unpack)(rtx, rtx);
+      rtx (*extract)(rtx, rtx) = NULL;
+      enum machine_mode halfmode = BLKmode;
 
       switch (imode)
        {
+       case V32QImode:
+         if (unsigned_p)
+           unpack = gen_avx2_zero_extendv16qiv16hi2;
+         else
+           unpack = gen_avx2_sign_extendv16qiv16hi2;
+         halfmode = V16QImode;
+         extract
+           = high_p ? gen_vec_extract_hi_v32qi : gen_vec_extract_lo_v32qi;
+         break;
+       case V16HImode:
+         if (unsigned_p)
+           unpack = gen_avx2_zero_extendv8hiv8si2;
+         else
+           unpack = gen_avx2_sign_extendv8hiv8si2;
+         halfmode = V8HImode;
+         extract
+           = high_p ? gen_vec_extract_hi_v16hi : gen_vec_extract_lo_v16hi;
+         break;
+       case V8SImode:
+         if (unsigned_p)
+           unpack = gen_avx2_zero_extendv4siv4di2;
+         else
+           unpack = gen_avx2_sign_extendv4siv4di2;
+         halfmode = V4SImode;
+         extract
+           = high_p ? gen_vec_extract_hi_v8si : gen_vec_extract_lo_v8si;
+         break;
        case V16QImode:
          if (unsigned_p)
            unpack = gen_sse4_1_zero_extendv8qiv8hi2;
@@ -19708,7 +19737,12 @@ ix86_expand_sse_unpack (rtx operands[2], bool unsigned_p, bool high_p)
          gcc_unreachable ();
        }
 
-      if (high_p)
+      if (GET_MODE_SIZE (imode) == 32)
+       {
+         tmp = gen_reg_rtx (halfmode);
+         emit_insn (extract (tmp, operands[1]));
+       }
+      else if (high_p)
        {
          /* Shift higher 8 bytes to lower 8 bytes.  */
          tmp = gen_reg_rtx (imode);
index e649b30fec645eca6e5d2060589185ef0940b803..3073ab247c70d5fff4d83ffda2b8284cb6df1fde 100644 (file)
 
 (define_expand "vec_unpacks_lo_<mode>"
   [(match_operand:<sseunpackmode> 0 "register_operand" "")
-   (match_operand:VI124_128 1 "register_operand" "")]
+   (match_operand:VI124_AVX2 1 "register_operand" "")]
   "TARGET_SSE2"
   "ix86_expand_sse_unpack (operands, false, false); DONE;")
 
 (define_expand "vec_unpacks_hi_<mode>"
   [(match_operand:<sseunpackmode> 0 "register_operand" "")
-   (match_operand:VI124_128 1 "register_operand" "")]
+   (match_operand:VI124_AVX2 1 "register_operand" "")]
   "TARGET_SSE2"
   "ix86_expand_sse_unpack (operands, false, true); DONE;")
 
 (define_expand "vec_unpacku_lo_<mode>"
   [(match_operand:<sseunpackmode> 0 "register_operand" "")
-   (match_operand:VI124_128 1 "register_operand" "")]
+   (match_operand:VI124_AVX2 1 "register_operand" "")]
   "TARGET_SSE2"
   "ix86_expand_sse_unpack (operands, true, false); DONE;")
 
 (define_expand "vec_unpacku_hi_<mode>"
   [(match_operand:<sseunpackmode> 0 "register_operand" "")
-   (match_operand:VI124_128 1 "register_operand" "")]
+   (match_operand:VI124_AVX2 1 "register_operand" "")]
   "TARGET_SSE2"
   "ix86_expand_sse_unpack (operands, true, true); DONE;")