]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Force TImode values into even registers
authorRichard Henderson <richard.henderson@linaro.org>
Wed, 31 Oct 2018 10:00:45 +0000 (10:00 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 31 Oct 2018 10:00:45 +0000 (03:00 -0700)
The LSE CASP instruction requires values to be placed in even
register pairs.  A solution involving two additional register
classes was rejected in favor of the much simpler solution of
simply requiring all TImode values to be aligned.

* config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Force
16-byte modes held in GP registers to use an even regno.

From-SVN: r265661

gcc/ChangeLog
gcc/config/aarch64/aarch64.c

index bec71246a8c4962f92da11e0573081d751491a7a..1587a51b4b69e3b1a0ddb1862757db0f1e3f3d98 100644 (file)
@@ -1,5 +1,8 @@
 2018-10-31  Richard Henderson  <richard.henderson@linaro.org>
 
+       * config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Force
+       16-byte modes held in GP registers to use an even regno.
+
        * config/aarch64/aarch64.c (aarch64_emit_bic): Remove.
        (aarch64_atomic_ldop_supported_p): Remove.
        (aarch64_gen_atomic_ldop): Remove.
index e646cced7d2eb030b8dd4318c17265c91bc4b42b..9813a9ded8f66e06d2da48bb064d4ad85d6bf6ce 100644 (file)
@@ -1452,10 +1452,14 @@ aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode)
   if (regno == FRAME_POINTER_REGNUM || regno == ARG_POINTER_REGNUM)
     return mode == Pmode;
 
-  if (GP_REGNUM_P (regno) && known_le (GET_MODE_SIZE (mode), 16))
-    return true;
-
-  if (FP_REGNUM_P (regno))
+  if (GP_REGNUM_P (regno))
+    {
+      if (known_le (GET_MODE_SIZE (mode), 8))
+       return true;
+      else if (known_le (GET_MODE_SIZE (mode), 16))
+       return (regno & 1) == 0;
+    }
+  else if (FP_REGNUM_P (regno))
     {
       if (vec_flags & VEC_STRUCT)
        return end_hard_regno (mode, regno) - 1 <= V31_REGNUM;