public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR67383][ARM][4.9]Backport of "Allow any register for DImode values in Thumb2"
@ 2015-10-15 14:01 Renlin Li
  2015-10-16 10:55 ` Ramana Radhakrishnan
  0 siblings, 1 reply; 6+ messages in thread
From: Renlin Li @ 2015-10-15 14:01 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ramana Radhakrishnan, vmakarov, Kyrill Tkachov

[-- Attachment #1: Type: text/plain, Size: 973 bytes --]

Hi all,

This is a backport patch to loosen restrictions on core registers for 
DImode values in Thumb2.

It fixes PR67383. In this particular case, reload tries to spill a hard 
register, and use next register together as a pair to reload a DImode 
pseudo register. However, the spilled register number is odd.This is 
rejected by arm_hard_regno_mode_ok(). There is no other register 
available, so the compiler throws an ICE.


The test case in PR67383 is too big, so I didn't include it as part of 
the patch.
arm-none-eabi regression test Okay without any new issues. Okay to 
backport to 4.9?

Regards,
Renlin Li

gcc/ChangeLog:

2015-10-15  Renlin Li  <renlin.li@arm.com>

         PR target/67383
         Backport from mainline.
         2014-04-22  Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>

         * config/arm/arm.c (arm_hard_regno_mode_ok): Loosen
         restrictions on core registers for DImode values in Thumb2.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: backport.diff --]
[-- Type: text/x-patch; name=backport.diff, Size: 1172 bytes --]

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 08b5255..88d957a 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -22646,12 +22646,19 @@ arm_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
     }
 
   /* We allow almost any value to be stored in the general registers.
-     Restrict doubleword quantities to even register pairs so that we can
-     use ldrd.  Do not allow very large Neon structure opaque modes in
-     general registers; they would use too many.  */
+     Restrict doubleword quantities to even register pairs in ARM state
+     so that we can use ldrd.  Do not allow very large Neon structure
+     opaque modes in general registers; they would use too many.  */
   if (regno <= LAST_ARM_REGNUM)
-    return !(TARGET_LDRD && GET_MODE_SIZE (mode) > 4 && (regno & 1) != 0)
-      && ARM_NUM_REGS (mode) <= 4;
+    {
+      if (ARM_NUM_REGS (mode) > 4)
+	  return FALSE;
+
+      if (TARGET_THUMB2)
+	return TRUE;
+
+      return !(TARGET_LDRD && GET_MODE_SIZE (mode) > 4 && (regno & 1) != 0);
+    }
 
   if (regno == FRAME_POINTER_REGNUM
       || regno == ARG_POINTER_REGNUM)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-03 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15 14:01 [PR67383][ARM][4.9]Backport of "Allow any register for DImode values in Thumb2" Renlin Li
2015-10-16 10:55 ` Ramana Radhakrishnan
2015-10-16 13:58   ` Renlin Li
2015-11-27  9:44     ` Renlin Li
2015-11-27 11:30       ` Ramana Radhakrishnan
2015-12-03 14:25         ` Christophe Lyon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).