reload1.c (choose_reload_regs): Use mode sizes to check whether an old reload registe...
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 7 Jul 2011 15:05:42 +0000 (15:05 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 7 Jul 2011 15:05:42 +0000 (15:05 +0000)
gcc/
* reload1.c (choose_reload_regs): Use mode sizes to check whether
an old reload register completely defines the required value.

gcc/testsuite/
* gcc.target/arm/neon-modes-3.c: New test.

From-SVN: r175980

gcc/ChangeLog
gcc/reload1.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/neon-modes-3.c [new file with mode: 0644]

index 7a7c0ecdd535cce14c506447212e90776d1df25b..ea7c24b94b7a01323c9cefae69da6f4d199c3fd2 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-07  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * reload1.c (choose_reload_regs): Use mode sizes to check whether
+       an old reload register completely defines the required value.
+
 2011-07-07  Richard Guenther  <rguenther@suse.de>
 
        * fold-const.c (fold_unary_loc): Do not strip sign-changes
index 7f84fc81416a033ea9c50b92c306b12fd5ad2d8a..499412c0ba418068c60f539c5d7e9e4fe41e6523 100644 (file)
@@ -6481,6 +6481,8 @@ choose_reload_regs (struct insn_chain *chain)
 
              if (regno >= 0
                  && reg_last_reload_reg[regno] != 0
+                 && (GET_MODE_SIZE (GET_MODE (reg_last_reload_reg[regno]))
+                     >= GET_MODE_SIZE (mode) + byte)
 #ifdef CANNOT_CHANGE_MODE_CLASS
                  /* Verify that the register it's in can be used in
                     mode MODE.  */
@@ -6492,24 +6494,12 @@ choose_reload_regs (struct insn_chain *chain)
                {
                  enum reg_class rclass = rld[r].rclass, last_class;
                  rtx last_reg = reg_last_reload_reg[regno];
-                 enum machine_mode need_mode;
 
                  i = REGNO (last_reg);
                  i += subreg_regno_offset (i, GET_MODE (last_reg), byte, mode);
                  last_class = REGNO_REG_CLASS (i);
 
-                 if (byte == 0)
-                   need_mode = mode;
-                 else
-                   need_mode
-                     = smallest_mode_for_size
-                       (GET_MODE_BITSIZE (mode) + byte * BITS_PER_UNIT,
-                        GET_MODE_CLASS (mode) == MODE_PARTIAL_INT
-                        ? MODE_INT : GET_MODE_CLASS (mode));
-
-                 if ((GET_MODE_SIZE (GET_MODE (last_reg))
-                      >= GET_MODE_SIZE (need_mode))
-                     && reg_reloaded_contents[i] == regno
+                 if (reg_reloaded_contents[i] == regno
                      && TEST_HARD_REG_BIT (reg_reloaded_valid, i)
                      && HARD_REGNO_MODE_OK (i, rld[r].mode)
                      && (TEST_HARD_REG_BIT (reg_class_contents[(int) rclass], i)
index abf696c82601c51d5ddf7dc626b3bf48a797e233..9c5f80a31b59c38445c7bc91bf5880c5ea32db31 100644 (file)
@@ -1,3 +1,7 @@
+2011-07-07  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * gcc.target/arm/neon-modes-3.c: New test.
+
 2011-07-07  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/graphite/pr37485.c (dg-options): Add -fno-loop-strip-mine
diff --git a/gcc/testsuite/gcc.target/arm/neon-modes-3.c b/gcc/testsuite/gcc.target/arm/neon-modes-3.c
new file mode 100644 (file)
index 0000000..fe81875
--- /dev/null
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O" } */
+/* { dg-add-options arm_neon } */
+
+#include <arm_neon.h>
+
+void f1 (volatile float32x4_t *dest, volatile float32x4x4_t *src, int n)
+{
+  float32x4x4_t a5, a6, a7, a8, a9;
+  int i;
+
+  a5 = *src;
+  a6 = *src;
+  a7 = *src;
+  a8 = *src;
+  a9 = *src;
+  while (n--)
+    {
+      for (i = 0; i < 8; i++)
+       {
+         float32x4x4_t a0, a1, a2, a3, a4;
+
+         a0 = *src;
+         a1 = *src;
+         a2 = *src;
+         a3 = *src;
+         a4 = *src;
+         *src = a0;
+         *dest = a0.val[0];
+         *dest = a0.val[3];
+         *src = a1;
+         *dest = a1.val[0];
+         *dest = a1.val[3];
+         *src = a2;
+         *dest = a2.val[0];
+         *dest = a2.val[3];
+         *src = a3;
+         *dest = a3.val[0];
+         *dest = a3.val[3];
+         *src = a4;
+         *dest = a4.val[0];
+         *dest = a4.val[3];
+       }
+      *src = a5;
+      *dest = a5.val[0];
+      *dest = a5.val[3];
+      *src = a6;
+      *dest = a6.val[0];
+      *dest = a6.val[3];
+      *src = a7;
+      *dest = a7.val[0];
+      *dest = a7.val[3];
+      *src = a8;
+      *dest = a8.val[0];
+      *dest = a8.val[3];
+      *src = a9;
+      *dest = a9.val[0];
+      *dest = a9.val[3];
+    }
+}