rtlanal.c (subreg_get_info): Exit early for simple and common cases.
authorAlan Hayward <alan.hayward@arm.com>
Wed, 21 Jan 2015 17:53:04 +0000 (17:53 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 21 Jan 2015 17:53:04 +0000 (17:53 +0000)
gcc/
2015-01-25  Alan Hayward  <alan.hayward@arm.com>

* rtlanal.c (subreg_get_info): Exit early for simple and common
cases.

From-SVN: r219957

gcc/ChangeLog
gcc/rtlanal.c

index 3f1dda4188d891d8360753d71112a4bb06855fd1..40422a38d54511a7da6c047a55ba83008bbc06ad 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-21  Alan Hayward  <alan.hayward@arm.com>
+
+       * rtlanal.c (subreg_get_info): Exit early for simple and common
+       cases.
+
 2015-01-21  Richard Henderson  <rth@redhat.com>
 
        PR target/64669
index 513feeb577b77d804061157c800e95d262ef2603..743aad6705cad5c764b2ae60e9b93a153145808a 100644 (file)
@@ -3440,6 +3440,22 @@ subreg_get_info (unsigned int xregno, machine_mode xmode,
          info->offset = offset / regsize_xmode;
          return;
        }
+      /* Quick exit for the simple and common case of extracting whole
+        subregisters from a multiregister value.  */
+      /* ??? It would be better to integrate this into the code below,
+        if we can generalize the concept enough and figure out how
+        odd-sized modes can coexist with the other weird cases we support.  */
+      if (!rknown
+         && WORDS_BIG_ENDIAN == REG_WORDS_BIG_ENDIAN
+         && regsize_xmode == regsize_ymode
+         && (offset % regsize_ymode) == 0)
+       {
+         info->representable_p = true;
+         info->nregs = nregs_ymode;
+         info->offset = offset / regsize_ymode;
+         gcc_assert (info->offset + info->nregs <= nregs_xmode);
+         return;
+       }
     }
 
   /* Lowpart subregs are otherwise valid.  */