]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[AArch64] Relax CANNOT_CHANGE_MODE_CLASS
authorTejas Belagod <tejas.belagod@arm.com>
Mon, 20 Jan 2014 12:34:13 +0000 (12:34 +0000)
committerTejas Belagod <belagod@gcc.gnu.org>
Mon, 20 Jan 2014 12:34:13 +0000 (12:34 +0000)
gcc/
* config/aarch64/aarch64-protos.h
(aarch64_cannot_change_mode_class_ptr): Declare.
* config/aarch64/aarch64.c (aarch64_cannot_change_mode_class,
aarch64_cannot_change_mode_class_ptr): New.
* config/aarch64/aarch64.h (CANNOT_CHANGE_MODE_CLASS): Change to call
backend hook aarch64_cannot_change_mode_class.

From-SVN: r206804

gcc/ChangeLog
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h

index f3e09e8d820198bce4e5ebcc49147e9c8a57f3e2..de8322b31ea3e9b847b65a1187f92c04be78ba21 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-20  Tejas Belagod  <tejas.belagod@arm.com>
+
+       * config/aarch64/aarch64-protos.h
+       (aarch64_cannot_change_mode_class_ptr): Declare.
+       * config/aarch64/aarch64.c (aarch64_cannot_change_mode_class,
+       aarch64_cannot_change_mode_class_ptr): New.
+       * config/aarch64/aarch64.h (CANNOT_CHANGE_MODE_CLASS): Change to call
+       backend hook aarch64_cannot_change_mode_class.
+
 2014-01-20  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * common/config/aarch64/aarch64-common.c
index c5ac48b8cb1a7bdf58fd140e3f50e340545b20ed..5542f023b33d9467daa63d33185d414e89e57d2e 100644 (file)
@@ -161,6 +161,9 @@ struct tune_params
 
 HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned);
 bool aarch64_bitmask_imm (HOST_WIDE_INT val, enum machine_mode);
+bool aarch64_cannot_change_mode_class (enum machine_mode,
+                                      enum machine_mode,
+                                      enum reg_class);
 enum aarch64_symbol_type
 aarch64_classify_symbolic_expression (rtx, enum aarch64_symbol_context);
 bool aarch64_constant_address_p (rtx);
index 7091d3ec63143bf544944b8fc0022078b9ca0e65..57b66455dc3424a517706c93453256353d94a4e6 100644 (file)
@@ -8259,6 +8259,42 @@ aarch64_vectorize_vec_perm_const_ok (enum machine_mode vmode,
   return ret;
 }
 
+/* Implement target hook CANNOT_CHANGE_MODE_CLASS.  */
+bool
+aarch64_cannot_change_mode_class (enum machine_mode from,
+                                 enum machine_mode to,
+                                 enum reg_class rclass)
+{
+  /* Full-reg subregs are allowed on general regs or any class if they are
+     the same size.  */
+  if (GET_MODE_SIZE (from) == GET_MODE_SIZE (to)
+      || !reg_classes_intersect_p (FP_REGS, rclass))
+    return false;
+
+  /* Limited combinations of subregs are safe on FPREGs.  Particularly,
+     1. Vector Mode to Scalar mode where 1 unit of the vector is accessed.
+     2. Scalar to Scalar for integer modes or same size float modes.
+     3. Vector to Vector modes.  */
+  if (GET_MODE_SIZE (from) > GET_MODE_SIZE (to))
+    {
+      if (aarch64_vector_mode_supported_p (from)
+         && GET_MODE_SIZE (GET_MODE_INNER (from)) == GET_MODE_SIZE (to))
+       return false;
+
+      if (GET_MODE_NUNITS (from) == 1
+         && GET_MODE_NUNITS (to) == 1
+         && (GET_MODE_CLASS (from) == MODE_INT
+             || from == to))
+       return false;
+
+      if (aarch64_vector_mode_supported_p (from)
+         && aarch64_vector_mode_supported_p (to))
+       return false;
+    }
+
+  return true;
+}
+
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST aarch64_address_cost
 
index 4aa1bfd80ec526340a3ad25e1cb0ae1f2e4f00fa..a08dee0532f656e13196812853385fa1dea18d8b 100644 (file)
@@ -822,13 +822,8 @@ do {                                                                            \
   extern void  __aarch64_sync_cache_range (void *, void *);    \
   __aarch64_sync_cache_range (beg, end)
 
-/*  VFP registers may only be accessed in the mode they
-   were set.  */
 #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)      \
-  (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)          \
-   ? reg_classes_intersect_p (FP_REGS, (CLASS))                \
-   : 0)
-
+  aarch64_cannot_change_mode_class (FROM, TO, CLASS)
 
 #define SHIFT_COUNT_TRUNCATED !TARGET_SIMD