AVX-512. 89/n. Improve mask move insn generation.
authorAlexander Ivchenko <alexander.ivchenko@intel.com>
Wed, 29 Oct 2014 07:16:03 +0000 (07:16 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Wed, 29 Oct 2014 07:16:03 +0000 (07:16 +0000)
gcc/
* config/i386/i386.md
(movhi_internal): Always detect maskmov.
(movqi_internal): Fix target check.
gcc/testsuite/
* gcc.target/i386/avx512dq-kmovb-1.c: New.

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: r216820

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx512dq-kmovb-1.c [new file with mode: 0644]

index e28043f2225031c41f768aa55df9068a4d24896a..514cdd549900df7f52393565dedd2668513805bb 100644 (file)
@@ -1,3 +1,16 @@
+2014-10-29  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/i386.md
+       (movhi_internal): Always detect maskmov.
+       (movqi_internal): Fix target check.
+
 2014-10-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
            Maxim Kuznetsov  <maxim.kuznetsov@intel.com>
            Anna Tikhonova  <anna.tikhonova@intel.com>
index 7ba07c3ae7cbb7838c53ee976aa5b12b2c227385..23ef131981e07a78b4f5f8c19e0aa46d260d3a71 100644 (file)
     }
 }
   [(set (attr "type")
-     (cond [(match_test "optimize_function_for_size_p (cfun)")
+     (cond [(eq_attr "alternative" "4,5,6")
+             (const_string "mskmov")
+           (match_test "optimize_function_for_size_p (cfun)")
              (const_string "imov")
            (and (eq_attr "alternative" "0")
                 (ior (not (match_test "TARGET_PARTIAL_REG_STALL"))
            (and (eq_attr "alternative" "1,2")
                 (match_operand:HI 1 "aligned_operand"))
              (const_string "imov")
-           (eq_attr "alternative" "4,5,6")
-             (const_string "mskmov")
            (and (match_test "TARGET_MOVX")
                 (eq_attr "alternative" "0,2"))
              (const_string "imovx")
 
 (define_insn "*movqi_internal"
   [(set (match_operand:QI 0 "nonimmediate_operand"
-                       "=q,q ,q ,r,r ,?r,m ,k,k,r")
+                       "=q,q ,q ,r,r ,?r,m ,k,k,r ,m,k")
        (match_operand:QI 1 "general_operand"
-                       "q ,qn,qm,q,rn,qm,qn,r ,k,k"))]
+                       "q ,qn,qm,q,rn,qm,qn,r ,k,k,k,m"))]
   "!(MEM_P (operands[0]) && MEM_P (operands[1]))"
 {
   switch (get_attr_type (insn))
     case TYPE_MSKMOV:
       switch (which_alternative)
         {
-       case 7: return TARGET_AVX512BW ? "kmovb\t{%k1, %0|%0, %k1}"
+       case 7: return TARGET_AVX512DQ ? "kmovb\t{%k1, %0|%0, %k1}"
                                       : "kmovw\t{%k1, %0|%0, %k1}";
-       case 8: return TARGET_AVX512BW ? "kmovb\t{%1, %0|%0, %1}"
+       case 8: return TARGET_AVX512DQ ? "kmovb\t{%1, %0|%0, %1}"
                                       : "kmovw\t{%1, %0|%0, %1}";
-       case 9: return TARGET_AVX512BW ? "kmovb\t{%1, %k0|%k0, %1}"
+       case 9: return TARGET_AVX512DQ ? "kmovb\t{%1, %k0|%k0, %1}"
                                       : "kmovw\t{%1, %k0|%k0, %1}";
+       case 10:
+       case 11:
+         gcc_assert (TARGET_AVX512DQ);
+         return "kmovb\t{%1, %0|%0, %1}";
        default: gcc_unreachable ();
        }
 
         return "mov{b}\t{%1, %0|%0, %1}";
     }
 }
-  [(set (attr "type")
-     (cond [(and (eq_attr "alternative" "5")
+  [(set_attr "isa" "*,*,*,*,*,*,*,*,*,*,avx512dq,avx512dq")
+   (set (attr "type")
+     (cond [(eq_attr "alternative" "3,5")
+             (const_string "imovx")
+           (eq_attr "alternative" "7,8,9,10,11")
+             (const_string "mskmov")
+           (and (eq_attr "alternative" "5")
                 (not (match_operand:QI 1 "aligned_operand")))
              (const_string "imovx")
            (match_test "optimize_function_for_size_p (cfun)")
                 (ior (not (match_test "TARGET_PARTIAL_REG_STALL"))
                      (not (match_test "TARGET_QIMODE_MATH"))))
              (const_string "imov")
-           (eq_attr "alternative" "3,5")
-             (const_string "imovx")
-           (eq_attr "alternative" "7,8,9")
-             (const_string "mskmov")
            (and (match_test "TARGET_MOVX")
                 (eq_attr "alternative" "2"))
              (const_string "imovx")
index 1a4f1865aec6d6bfcbb8b8fb0dd52fc3533d7c2b..e8ec94a97d7b0a9b992f08ed10963477de1e204d 100644 (file)
@@ -7,6 +7,17 @@
            Kirill Yukhin  <kirill.yukhin@intel.com>
            Michael Zolotukhin  <michael.v.zolotukhin@intel.com>
 
+       * gcc.target/i386/avx512dq-kmovb-1.c: New.
+
+2014-10-29  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>
+
        * gcc.target/i386/avx512bw-vpcmpequb-1.c: New.
        * gcc.target/i386/avx512bw-vpcmpequb-2.c: Ditto.
        * gcc.target/i386/avx512bw-vpcmpequw-1.c: Ditto.
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-kmovb-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-kmovb-1.c
new file mode 100644 (file)
index 0000000..c886b5f
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512dq -O2" } */
+/* { dg-final { scan-assembler "kmovb\[ \\t\]+\[^\n\]*%k\[1-7\]" } } */
+
+#include <immintrin.h>
+
+volatile __m512d x;
+volatile __mmask8 m;
+
+void extern
+avx512dq_test (void)
+{
+  x = _mm512_mask_add_pd (x, m, x, x);
+}