mips-msa.md (msa_dotp_<su>_d, [...]): Fix MODE for vec_select.
authorPrachi Godbole <prachi.godbole@imgtec.com>
Mon, 6 Mar 2017 10:19:52 +0000 (10:19 +0000)
committerPrachi Godbole <prachigodbole@gcc.gnu.org>
Mon, 6 Mar 2017 10:19:52 +0000 (10:19 +0000)
gcc/
* config/mips/mips-msa.md (msa_dotp_<su>_d, msa_dpadd_<su>_d,
msa_dpsub_<su>_d): Fix MODE for vec_select.

gcc/testsuite/
* gcc.target/mips/msa-dotp.c: New tests.

From-SVN: r245911

gcc/ChangeLog
gcc/config/mips/mips-msa.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/msa-dotp.c [new file with mode: 0644]

index 5157670b995d703df833ddea1a331a2e2c6f807e..b588b47231b3f0bc5cb742e38ace0ba6ea6e372a 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-06  Prachi Godbole  <prachi.godbole@imgtec.com>
+
+       * config/mips/mips-msa.md (msa_dotp_<su>_d, msa_dpadd_<su>_d,
+       msa_dpsub_<su>_d): Fix MODE for vec_select.
+
 2017-03-06  Prachi Godbole  <prachi.godbole@imgtec.com>
 
        * config/mips/mips.c (mips_gen_const_int_vector): Change type of last
index a29c4f0b9758f142c1d7aabf2a7e9dc55c830ebb..521b09438efdaacd086751bb16c4b1c22593e423 100644 (file)
                (parallel [(const_int 0) (const_int 2)]))))
          (mult:V2DI
            (any_extend:V2DI
-             (vec_select:V4SI (match_dup 1)
+             (vec_select:V2SI (match_dup 1)
                (parallel [(const_int 1) (const_int 3)])))
            (any_extend:V2DI
-             (vec_select:V4SI (match_dup 2)
+             (vec_select:V2SI (match_dup 2)
                (parallel [(const_int 1) (const_int 3)]))))))]
   "ISA_HAS_MSA"
   "dotp_<su>.d\t%w0,%w1,%w2"
                  (parallel [(const_int 0) (const_int 2)]))))
            (mult:V2DI
              (any_extend:V2DI
-               (vec_select:V4SI (match_dup 2)
+               (vec_select:V2SI (match_dup 2)
                  (parallel [(const_int 1) (const_int 3)])))
              (any_extend:V2DI
-               (vec_select:V4SI (match_dup 3)
+               (vec_select:V2SI (match_dup 3)
                  (parallel [(const_int 1) (const_int 3)])))))
          (match_operand:V2DI 1 "register_operand" "0")))]
   "ISA_HAS_MSA"
                  (parallel [(const_int 0) (const_int 2)]))))
            (mult:V2DI
              (any_extend:V2DI
-               (vec_select:V4SI (match_dup 2)
+               (vec_select:V2SI (match_dup 2)
                  (parallel [(const_int 1) (const_int 3)])))
              (any_extend:V2DI
-               (vec_select:V4SI (match_dup 3)
+               (vec_select:V2SI (match_dup 3)
                  (parallel [(const_int 1) (const_int 3)])))))))]
   "ISA_HAS_MSA"
   "dpsub_<su>.d\t%w0,%w2,%w3"
index ed9bcb164669b60ef6e1a54dd00582dc8ae74697..9a44150b9313ec672974723fe53b79dec114efff 100644 (file)
@@ -1,3 +1,7 @@
+2017-03-06  Prachi Godbole  <prachi.godbole@imgtec.com>
+
+       * gcc.target/mips/msa-dotp.c: New tests.
+
 2017-03-06  Prachi Godbole  <prachi.godbole@imgtec.com>
 
        * gcc.target/mips/msa-bclri.c: New test.
diff --git a/gcc/testsuite/gcc.target/mips/msa-dotp.c b/gcc/testsuite/gcc.target/mips/msa-dotp.c
new file mode 100644 (file)
index 0000000..e45028f
--- /dev/null
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-mips16 -mfp64 -mhard-float -mmsa" } */
+
+typedef int v4i32 __attribute__ ((vector_size(16)));
+typedef long long v2i64 __attribute__ ((vector_size(16)));
+
+/* Test MSA dot product family for CSE optimization.  */
+
+static v4i32 g = {0, 92, 93, 94};
+static v4i32 h = {12, 24, 36, 48};
+static v2i64 l = {84, 98};
+
+void
+dotp_d_msa (v2i64 *c)
+{
+  l = __builtin_msa_dotp_s_d (g, h);
+}
+/* { dg-final { scan-assembler "dotp_s.d" } }  */
+
+void
+dpadd_d_msa (v2i64 *c)
+{
+  *c = __builtin_msa_dpadd_s_d (l, g, h);
+}
+/* { dg-final { scan-assembler "dpadd_s.d" } }  */
+
+void
+dpsub_d_msa (v2i64 *c)
+{
+  *c = __builtin_msa_dpsub_s_d (l, g, h);
+}
+/* { dg-final { scan-assembler "dpsub_s.d" } }  */