diff mbox

[lra] relax the restriction on subreg reload for wide mode

Message ID 5734B6EC.6000301@foss.arm.com
State New
Headers show

Commit Message

Jiong Wang May 12, 2016, 5:01 p.m. UTC
For PR70904 is caused by inproper reload for wide mode.

For mode with size bigger than ptr_mode, there unlikely to be "mov"
between two registers with different classes, but there normally will be
"mov" which transfers element of vector register into the general
register, and this normally will be a subreg which should be reloaded as
a whole.  This is particularly likely to be triggered when
-fno-split-wide-types specified.

x86-64/aarch64 bootstrap OK and no regression on check-gcc/g++ on both.

Committed as r236181. It's reviewed and approved in the PR.
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70904)

2016-05-12  Jiong Wang  <jiong.wang@arm.com>
gcc/
   PR target/70904
   * lra-constraint.c (process_addr_reg): Relax the restriction on
   subreg reload for wide mode.
diff mbox

Patch

Index: gcc/lra-constraints.c
===================================================================
--- gcc/lra-constraints.c	(revision 236171)
+++ gcc/lra-constraints.c	(working copy)
@@ -1307,7 +1307,21 @@ 
  
    subreg_p = GET_CODE (*loc) == SUBREG;
    if (subreg_p)
-    loc = &SUBREG_REG (*loc);
+    {
+      reg = SUBREG_REG (*loc);
+      mode = GET_MODE (reg);
+
+      /* For mode with size bigger than ptr_mode, there unlikely to be "mov"
+	 between two registers with different classes, but there normally will
+	 be "mov" which transfers element of vector register into the general
+	 register, and this normally will be a subreg which should be reloaded
+	 as a whole.  This is particularly likely to be triggered when
+	 -fno-split-wide-types specified.  */
+      if (in_class_p (reg, cl, &new_class)
+	  || GET_MODE_SIZE (mode) <= GET_MODE_SIZE (ptr_mode))
+       loc = &SUBREG_REG (*loc);
+    }
+
    reg = *loc;
    mode = GET_MODE (reg);
    if (! REG_P (reg))