]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mode-switching.c (create_pre_exit): Force late switching if __builtin_{apply,return...
authorUros Bizjak <ubizjak@gmail.com>
Mon, 5 Nov 2012 19:46:31 +0000 (20:46 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 5 Nov 2012 19:46:31 +0000 (20:46 +0100)
* mode-switching.c (create_pre_exit): Force late switching if
__builtin_{apply,return} emitted a load that require mode,
other than MODE_EXIT.

Co-Authored-By: Vladimir Yakovlev <vladimir.b.yakovlev@intel.com>
From-SVN: r193182

gcc/ChangeLog
gcc/mode-switching.c

index b0c4fd1fa260eb14e655b2790ca22a7b3421b521..0d20017906e3a0f2f91c28292718c8560c5bbba1 100644 (file)
@@ -1,3 +1,10 @@
+2012-11-05  Uros Bizjak  <ubizjak@gmail.com>
+           Vladimir Yakovlev  <vladimir.b.yakovlev@intel.com>
+
+       * mode-switching.c (create_pre_exit): Force late switching if
+       __builtin_{apply,return} emitted a load that require mode,
+       other than MODE_EXIT.
+
 2012-11-05  Richard Sandiford  <rdsandiford@googlemail.com>
 
        PR target/55204
index d9f83ca2a3b772362e536eb7d5d85e5e70dfb7fa..2f7455a033ca492f01e06662d8b16ba5d7d5c6be 100644 (file)
@@ -1,6 +1,6 @@
 /* CPU mode switching
    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
-   2009, 2010 Free Software Foundation, Inc.
+   2009, 2010, 2012  Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -342,6 +342,16 @@ create_pre_exit (int n_entities, int *entity_map, const int *num_modes)
                      }
                    if (j >= 0)
                      {
+                       /* __builtin_return emits a sequence of loads to all
+                          return registers.  One of them might require
+                          another mode than MODE_EXIT, even if it is
+                          unrelated to the return value, so we want to put
+                          the final mode switch after it.  */
+                       if (maybe_builtin_apply
+                           && targetm.calls.function_value_regno_p
+                               (copy_start))
+                         forced_late_switch = 1;
+
                        /* For the SH4, floating point loads depend on fpscr,
                           thus we might need to put the final mode switch
                           after the return value copy.  That is still OK,