mips.c (mips_cannot_force_const_mem): Reject vector constants.
authorMihailo Stojanovic <mistojanovic@wavecomp.com>
Mon, 14 Oct 2019 21:07:56 +0000 (21:07 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 14 Oct 2019 21:07:56 +0000 (15:07 -0600)
* config/mips/mips.c (mips_cannot_force_const_mem): Reject
vector constants.

* gcc.target/mips/constant-spill.c: New test.

From-SVN: r276969

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/constant-spill.c [new file with mode: 0644]

index adc3550fc39a6ac8d916591c22f4eb6cd7e67085..516e9c181387c9b973ff8a63d2522364857b2b48 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-14  Mihailo Stojanovic  <mistojanovic@wavecomp.com>
+
+       * config/mips/mips.c (mips_cannot_force_const_mem): Reject
+       vector constants.
+
 2019-10-14  Iain Sandoe  <iain@sandoe.co.uk>
 
        * config/darwin.c: Use unsigned ints for the picbase label
index e7c22123ed52e73d819180d20706bf9a0fa8c605..7f6a0db46fd31a7f05e5c08f71cef60383bf6860 100644 (file)
@@ -2409,7 +2409,8 @@ mips_cannot_force_const_mem (machine_mode mode, rtx x)
      references, reload will consider forcing C into memory and using
      one of the instruction's memory alternatives.  Returning false
      here will force it to use an input reload instead.  */
-  if (CONST_INT_P (x) && mips_legitimate_constant_p (mode, x))
+  if ((CONST_INT_P (x) || GET_CODE (x) == CONST_VECTOR)
+      && mips_legitimate_constant_p (mode, x))
     return true;
 
   split_const (x, &base, &offset);
index 281da7ff85e24a761da144a59b133ec1dda1754c..08d4a79867d5c48fef7f8a1aaa8774b40edf86ee 100644 (file)
@@ -1,3 +1,7 @@
+2019-10-14  Mihailo Stojanovic  <mistojanovic@wavecomp.com>
+
+       * gcc.target/mips/constant-spill.c: New test.
+
 2019-10-14  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92069
diff --git a/gcc/testsuite/gcc.target/mips/constant-spill.c b/gcc/testsuite/gcc.target/mips/constant-spill.c
new file mode 100644 (file)
index 0000000..1494705
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-mfp64 -mhard-float -mmsa" } */
+/* { dg-skip-if "code quality test" { *-*-* } { "-Os" "-O0" "-O1" "-O2" } { "" } } */
+
+void foo (void);
+
+void bar (void)
+{
+  int x[4];
+  int y[4];
+  int i;
+
+  while (1)
+    {
+      foo ();
+
+      for (i = 0; i < 4; i++)
+        {
+          x[i] = 0;
+          y[i] = 0;
+        }
+
+      asm volatile (""
+                    :
+                    :"m"(x), "m"(y)
+                    :"memory");
+    }
+}
+
+/* { dg-final { scan-assembler-not "ld.w" } } */
+/* { dg-final { scan-assembler-times "st.w" 2 } } */