AVX-512. Add convert ps2pd and ps2dq.
authorAlexander Ivchenko <alexander.ivchenko@intel.com>
Thu, 25 Sep 2014 08:18:14 +0000 (08:18 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Thu, 25 Sep 2014 08:18:14 +0000 (08:18 +0000)
gcc/
* config/i386/sse.md
(define_insn
"<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"):
New.
(define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"): Ditto.
(define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"): Ditto.
(define_insn "sse2_cvtss2sd<round_saeonly_name>"): Change
"nonimmediate_operand" to "<round_saeonly_nimm_predicate>".
(define_insn "avx_cvtpd2ps256<mask_name>"): Add masking.
(define_expand "sse2_cvtpd2ps_mask): New.
(define_insn "*sse2_cvtpd2ps<mask_name>"): Add masking.
(define_insn "sse2_cvtps2pd<mask_name>"): Add masking.

Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
Co-Authored-By: Anna Tikhonova <anna.tikhonova@intel.com>
Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com>
Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com>
Co-Authored-By: Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>
From-SVN: r215586

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

index e7a932f274bd6d080551e436fd684d3a6276f89f..68090de6f5ce9c7735ce5b461d7d697efb2c81b5 100644 (file)
@@ -1,3 +1,25 @@
+2014-09-25  Alexander Ivchenko  <alexander.ivchenko@intel.com>
+           Maxim Kuznetsov  <maxim.kuznetsov@intel.com>
+           Anna Tikhonova  <anna.tikhonova@intel.com>
+           Ilya Tocar  <ilya.tocar@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Kirill Yukhin  <kirill.yukhin@intel.com>
+           Michael Zolotukhin  <michael.v.zolotukhin@intel.com>
+
+       * config/i386/sse.md
+       (define_insn
+       "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"):
+       New.
+       (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"): Ditto.
+       (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"): Ditto.
+       (define_insn "sse2_cvtss2sd<round_saeonly_name>"): Change
+       "nonimmediate_operand" to "<round_saeonly_nimm_predicate>".
+       (define_insn "avx_cvtpd2ps256<mask_name>"): Add masking.
+       (define_expand "sse2_cvtpd2ps_mask): New.
+       (define_insn "*sse2_cvtpd2ps<mask_name>"): Add masking.
+       (define_insn "sse2_cvtps2pd<mask_name>"): Add masking.
+
 2014-09-25  Alexander Ivchenko  <alexander.ivchenko@intel.com>
            Maxim Kuznetsov  <maxim.kuznetsov@intel.com>
            Anna Tikhonova  <anna.tikhonova@intel.com>
index b2e1d4fa6db094162efe7ab4ebb73bb89c3be091..ac7b51b2517ed33e638924ea510582c6d2cc7dc0 100644 (file)
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseintvecmode2>")])
 
+(define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
+  [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
+       (any_fix:<sselongvecmode>
+         (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
+  "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
+  "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
+  [(set_attr "type" "ssecvt")
+   (set_attr "prefix" "evex")
+   (set_attr "mode" "<sseintvecmode3>")])
+
+(define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
+  [(set (match_operand:V2DI 0 "register_operand" "=v")
+       (any_fix:V2DI
+         (vec_select:V2SF
+           (match_operand:V4SF 1 "nonimmediate_operand" "vm")
+           (parallel [(const_int 0) (const_int 1)]))))]
+  "TARGET_AVX512DQ && TARGET_AVX512VL"
+  "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
+  [(set_attr "type" "ssecvt")
+   (set_attr "prefix" "evex")
+   (set_attr "mode" "TI")])
+
+(define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
+  [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
+       (unsigned_fix:<sseintvecmode>
+         (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
+  "TARGET_AVX512VL"
+  "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
+  [(set_attr "type" "ssecvt")
+   (set_attr "prefix" "evex")
+   (set_attr "mode" "<sseintvecmode2>")])
+
 (define_expand "avx_cvttpd2dq256_2"
   [(set (match_operand:V8SI 0 "register_operand")
        (vec_concat:V8SI
        (vec_merge:V2DF
          (float_extend:V2DF
            (vec_select:V2SF
-             (match_operand:V4SF 2 "nonimmediate_operand" "x,m,<round_saeonly_constraint>")
+             (match_operand:V4SF 2 "<round_saeonly_nimm_predicate>" "x,m,<round_saeonly_constraint>")
              (parallel [(const_int 0) (const_int 1)])))
          (match_operand:V2DF 1 "register_operand" "0,0,v")
          (const_int 1)))]
    (set_attr "prefix" "evex")
    (set_attr "mode" "V8SF")])
 
-(define_insn "avx_cvtpd2ps256"
-  [(set (match_operand:V4SF 0 "register_operand" "=x")
+(define_insn "avx_cvtpd2ps256<mask_name>"
+  [(set (match_operand:V4SF 0 "register_operand" "=v")
        (float_truncate:V4SF
-         (match_operand:V4DF 1 "nonimmediate_operand" "xm")))]
-  "TARGET_AVX"
-  "vcvtpd2ps{y}\t{%1, %0|%0, %1}"
+         (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
+  "TARGET_AVX && <mask_avx512vl_condition>"
+  "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssecvt")
-   (set_attr "prefix" "vex")
+   (set_attr "prefix" "maybe_evex")
    (set_attr "btver2_decode" "vector")
    (set_attr "mode" "V4SF")])
 
   "TARGET_SSE2"
   "operands[2] = CONST0_RTX (V2SFmode);")
 
-(define_insn "*sse2_cvtpd2ps"
-  [(set (match_operand:V4SF 0 "register_operand" "=x")
+(define_expand "sse2_cvtpd2ps_mask"
+  [(set (match_operand:V4SF 0 "register_operand")
+       (vec_merge:V4SF
+         (vec_concat:V4SF
+           (float_truncate:V2SF
+             (match_operand:V2DF 1 "nonimmediate_operand"))
+           (match_dup 4))
+         (match_operand:V4SF 2 "register_operand")
+         (match_operand:QI 3 "register_operand")))]
+  "TARGET_SSE2"
+  "operands[4] = CONST0_RTX (V2SFmode);")
+
+(define_insn "*sse2_cvtpd2ps<mask_name>"
+  [(set (match_operand:V4SF 0 "register_operand" "=v")
        (vec_concat:V4SF
          (float_truncate:V2SF
-           (match_operand:V2DF 1 "nonimmediate_operand" "xm"))
+           (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
          (match_operand:V2SF 2 "const0_operand")))]
-  "TARGET_SSE2"
+  "TARGET_SSE2 && <mask_avx512vl_condition>"
 {
   if (TARGET_AVX)
-    return "vcvtpd2ps{x}\t{%1, %0|%0, %1}";
+    return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
   else
     return "cvtpd2ps\t{%1, %0|%0, %1}";
 }
    (set_attr "prefix" "evex")
    (set_attr "mode" "V8DF")])
 
-(define_insn "sse2_cvtps2pd"
-  [(set (match_operand:V2DF 0 "register_operand" "=x")
+(define_insn "sse2_cvtps2pd<mask_name>"
+  [(set (match_operand:V2DF 0 "register_operand" "=v")
        (float_extend:V2DF
          (vec_select:V2SF
-           (match_operand:V4SF 1 "nonimmediate_operand" "xm")
+           (match_operand:V4SF 1 "nonimmediate_operand" "vm")
            (parallel [(const_int 0) (const_int 1)]))))]
-  "TARGET_SSE2"
-  "%vcvtps2pd\t{%1, %0|%0, %q1}"
+  "TARGET_SSE2 && <mask_avx512vl_condition>"
+  "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
   [(set_attr "type" "ssecvt")
    (set_attr "amdfam10_decode" "direct")
    (set_attr "athlon_decode" "double")