re PR target/80286 (AVX2 _mm_cvtsi128_si32 doesn't return a proper 32bits int)
authorUros Bizjak <ubizjak@gmail.com>
Thu, 6 Apr 2017 19:22:02 +0000 (21:22 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 6 Apr 2017 19:22:02 +0000 (21:22 +0200)
PR target/80286
* config/i386/sse.md (*vec_extractv4si_0_zext_sse4): New pattern.
* config/i386/i386.md (*zero_extendsidi2):
Add (?*x,*x) and (?*v,*v) alternatives.

From-SVN: r246741

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

index 31b7a8d4c0a6c3a9b415904eb5b8825fc23de200..b4bfd2e853a2fc6efa71e8c8d9fb9378afac5ba4 100644 (file)
@@ -1,3 +1,10 @@
+2017-04-06  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/80286
+       * config/i386/sse.md (*vec_extractv4si_0_zext_sse4): New pattern.
+       * config/i386/i386.md (*zero_extendsidi2):
+       Add (?*x,*x) and (?*v,*v) alternatives.
+
 2017-04-06  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/79733
index 6ed2390703292ae89caa99caf6446892f961d34c..d1c3c163fd02211efc428621d21b7d98893bdb41 100644 (file)
 
 (define_insn "*zero_extendsidi2"
   [(set (match_operand:DI 0 "nonimmediate_operand"
-                       "=r,?r,?o,r   ,o,?*Ym,?!*y,?r ,?r,?*Yi,?*x,*r")
+               "=r,?r,?o,r   ,o,?*Ym,?!*y,?r ,?r,?*Yi,?*x,?*x,?*v,*r")
        (zero_extend:DI
         (match_operand:SI 1 "x86_64_zext_operand"
-                       "0 ,rm,r ,rmWz,0,r   ,m   ,*Yj,*x,r   ,m  ,*k")))]
+               "0 ,rm,r ,rmWz,0,r   ,m   ,*Yj,*x,r   ,m  , *x, *v,*k")))]
   ""
 {
   switch (get_attr_type (insn))
       return "%vpextrd\t{$0, %1, %k0|%k0, %1, 0}";
 
     case TYPE_SSEMOV:
+      if (SSE_REG_P (operands[0]) && SSE_REG_P (operands[1]))
+       {
+         if (EXT_REX_SSE_REG_P (operands[0])
+             || EXT_REX_SSE_REG_P (operands[1]))
+           return "vpmovzxdq\t{%t1, %g0|%g0, %t1}";
+         else
+           return "%vpmovzxdq\t{%1, %0|%0, %1}";
+       }
+
       if (GENERAL_REG_P (operands[0]))
        return "%vmovd\t{%1, %k0|%k0, %1}";
 
            (eq_attr "alternative" "10")
              (const_string "sse2")
            (eq_attr "alternative" "11")
+             (const_string "sse4")
+           (eq_attr "alternative" "12")
+             (const_string "avx512f")
+           (eq_attr "alternative" "13")
              (const_string "x64_avx512bw")
           ]
           (const_string "*")))
              (const_string "multi")
            (eq_attr "alternative" "5,6")
              (const_string "mmxmov")
-           (eq_attr "alternative" "7,9,10")
+           (eq_attr "alternative" "7,9,10,11,12")
              (const_string "ssemov")
            (eq_attr "alternative" "8")
              (const_string "sselog1")
-           (eq_attr "alternative" "11")
+           (eq_attr "alternative" "13")
              (const_string "mskmov")
           ]
           (const_string "imovx")))
    (set (attr "prefix_extra")
-     (if_then_else (eq_attr "alternative" "8")
+     (if_then_else (eq_attr "alternative" "8,11,12")
        (const_string "1")
        (const_string "*")))
    (set (attr "length_immediate")
    (set (attr "mode")
      (cond [(eq_attr "alternative" "5,6")
              (const_string "DI")
-           (eq_attr "alternative" "7,8,9")
+           (eq_attr "alternative" "7,8,9,11,12")
              (const_string "TI")
           ]
           (const_string "SI")))])
index 15ced880504b5fce94e6d8b17eec8b0e68332211..094404bc91378f77fda12840097cc55af9c45821 100644 (file)
   "#"
   [(set_attr "isa" "*,sse4,*,*")])
 
-(define_insn_and_split "*vec_extractv4si_0_zext"
-  [(set (match_operand:DI 0 "register_operand" "=r")
-       (zero_extend:DI
-         (vec_select:SI
-           (match_operand:V4SI 1 "register_operand" "v")
-           (parallel [(const_int 0)]))))]
-  "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
-  "#"
-  "&& reload_completed"
-  [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
-  "operands[1] = gen_lowpart (SImode, operands[1]);")
-
 (define_insn "*vec_extractv2di_0_sse"
   [(set (match_operand:DI 0 "nonimmediate_operand"     "=v,m")
        (vec_select:DI
   [(set (match_dup 0) (match_dup 1))]
   "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
 
+(define_insn "*vec_extractv4si_0_zext_sse4"
+  [(set (match_operand:DI 0 "register_operand" "=r,x,v")
+       (zero_extend:DI
+         (vec_select:SI
+           (match_operand:V4SI 1 "register_operand" "Yj,x,v")
+           (parallel [(const_int 0)]))))]
+  "TARGET_SSE4_1"
+  "#"
+  [(set_attr "isa" "x64,*,avx512f")])
+
+(define_insn "*vec_extractv4si_0_zext"
+  [(set (match_operand:DI 0 "register_operand" "=r")
+       (zero_extend:DI
+         (vec_select:SI
+           (match_operand:V4SI 1 "register_operand" "x")
+           (parallel [(const_int 0)]))))]
+  "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
+  "#")
+
+(define_split
+  [(set (match_operand:DI 0 "register_operand")
+       (zero_extend:DI
+         (vec_select:SI
+           (match_operand:V4SI 1 "register_operand")
+           (parallel [(const_int 0)]))))]
+  "TARGET_SSE2 && reload_completed"
+  [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
+  "operands[1] = gen_lowpart (SImode, operands[1]);")
+
 (define_insn "*vec_extractv4si"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
        (vec_select:SI