Improve handling of constants destined for FP_REGS on AArch64
authoribolton <ibolton@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Sep 2013 13:53:18 +0000 (13:53 +0000)
committeribolton <ibolton@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Sep 2013 13:53:18 +0000 (13:53 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202403 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/movdi_1.c [new file with mode: 0644]

index 9a94ff4..2a4b5bc 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-09  Ian Bolton  <ian.bolton@arm.com>
+
+       * config/aarch64/aarch64.c (aarch64_preferred_reload_class): Return
+       NO_REGS for immediate that can't be moved directly into FP_REGS.
+
 2013-09-09  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/aarch64/aarch64.c (aarch64_select_cc_mode): Return CC_SWP for
index d0bd38e..e8ae20a 100644 (file)
@@ -4237,10 +4237,18 @@ aarch64_class_max_nregs (reg_class_t regclass, enum machine_mode mode)
 }
 
 static reg_class_t
-aarch64_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t regclass)
+aarch64_preferred_reload_class (rtx x, reg_class_t regclass)
 {
-  return ((regclass == POINTER_REGS || regclass == STACK_REG)
-         ? GENERAL_REGS : regclass);
+  if (regclass == POINTER_REGS || regclass == STACK_REG)
+    return GENERAL_REGS;
+
+  /* If it's an integer immediate that MOVI can't handle, then
+     FP_REGS is not an option, so we return NO_REGS instead.  */
+  if (CONST_INT_P (x) && reg_class_subset_p (regclass, FP_REGS)
+      && !aarch64_simd_imm_scalar_p (x, GET_MODE (x)))
+    return NO_REGS;
+
+  return regclass;
 }
 
 void
index 5cc02a7..05100e6 100644 (file)
@@ -1,3 +1,7 @@
+2013-09-09  Ian Bolton  <ian.bolton@arm.com>
+
+       * gcc.target/aarch64/movdi_1.c: New test.
+
 2013-09-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58362
diff --git a/gcc/testsuite/gcc.target/aarch64/movdi_1.c b/gcc/testsuite/gcc.target/aarch64/movdi_1.c
new file mode 100644 (file)
index 0000000..a22378d
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-inline" } */
+
+#include <arm_neon.h>
+
+void
+foo1 (uint64_t *a)
+{
+  uint64x1_t val18;
+  uint32x2_t val19;
+  uint64x1_t val20;
+  val19 = vcreate_u32 (0x800000004cf3dffbUL);
+  val20 = vrsra_n_u64 (val18, vreinterpret_u64_u32 (val19), 34);
+  vst1_u64 (a, val20);
+}
+
+void
+foo2 (uint64_t *a)
+{
+  uint64x1_t val18;
+  uint32x2_t val19;
+  uint64x1_t val20;
+  val19 = vcreate_u32 (0xdffbUL);
+  val20 = vrsra_n_u64 (val18, vreinterpret_u64_u32 (val19), 34);
+  vst1_u64 (a, val20);
+}