mips-msa.md (msa_insert_<msaftm_f>): Add an alternative which covers the floating...
authorMihailo Stojanovic <mistojanovic@wavecomp.com>
Mon, 28 Oct 2019 19:03:38 +0000 (19:03 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 28 Oct 2019 19:03:38 +0000 (13:03 -0600)
        * config/mips/mips-msa.md (msa_insert_<msaftm_f>): Add an
        alternative which covers the floating-point input value. Also
        forbid the split of insert.d pattern for floating-point values.

        * gcc.target/mips/msa-insert-split.c: New test.

From-SVN: r277533

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

index b875cef..a3fbadf 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-28  Mihailo Stojanovic  <mistojanovic@wavecomp.com>
+
+       * config/mips/mips-msa.md (msa_insert_<msaftm_f>): Add an
+       alternative which covers the floating-point input value. Also
+       forbid the split of insert.d pattern for floating-point values.
+
 2019-10-28  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * config.gcc: Add riscv-sr.o to extra_objs for riscv.
index 929646d..628423d 100644 (file)
 })
 
 (define_insn "msa_insert_<msafmt_f>"
-  [(set (match_operand:MSA 0 "register_operand" "=f")
+  [(set (match_operand:MSA 0 "register_operand" "=f,f")
        (vec_merge:MSA
          (vec_duplicate:MSA
-           (match_operand:<UNITMODE> 1 "reg_or_0_operand" "dJ"))
-         (match_operand:MSA 2 "register_operand" "0")
+           (match_operand:<UNITMODE> 1 "reg_or_0_operand" "dJ,f"))
+         (match_operand:MSA 2 "register_operand" "0,0")
          (match_operand 3 "const_<bitmask>_operand" "")))]
   "ISA_HAS_MSA"
 {
+  if (which_alternative == 1)
+    return "insve.<msafmt>\t%w0[%y3],%w1[0]";
+
   if (!TARGET_64BIT && (<MODE>mode == V2DImode || <MODE>mode == V2DFmode))
     return "#";
   else
   "reload_completed && ISA_HAS_MSA && !TARGET_64BIT"
   [(const_int 0)]
 {
+  if (REG_P (operands[1]) && FP_REG_P (REGNO (operands[1])))
+    FAIL;
   mips_split_msa_insert_d (operands[0], operands[2], operands[3], operands[1]);
   DONE;
 })
index 14b3147..e5cecf4 100644 (file)
@@ -1,3 +1,7 @@
+2019-10-28  Mihailo Stojanovic  <mistojanovic@wavecomp.com>
+
+       * gcc.target/mips/msa-insert-split.c: New test.
+
 2019-10-28  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gcc.target/riscv/save-restore-2.c: New file.
diff --git a/gcc/testsuite/gcc.target/mips/msa-insert-split.c b/gcc/testsuite/gcc.target/mips/msa-insert-split.c
new file mode 100644 (file)
index 0000000..50f3b8a
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-mfp64 -mhard-float -mmsa" } */
+/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
+
+typedef double v2f64 __attribute__ ((vector_size (16)));
+
+void foo (double* arr, v2f64* vec)
+{
+  v2f64 v;
+  v[0] = arr[0];
+  v[1] = arr[1];
+  *vec = v;
+}
+
+/* { dg-final { scan-assembler-not "insert.w" } } */
+/* { dg-final { scan-assembler-times "insve.d" 2 } } */