]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not use floating point registers when compiling with -msoft-float for SPARC
authorDaniel Cederman <cederman@gaisler.com>
Mon, 28 Sep 2015 05:43:53 +0000 (05:43 +0000)
committerDaniel Hellstrom <danielh@gcc.gnu.org>
Mon, 28 Sep 2015 05:43:53 +0000 (07:43 +0200)
2015-09-28  Daniel Cederman  <cederman@gaisler.com>

Do not use floating point registers when compiling with -msoft-float for SPARC

__builtin_apply* and __builtin_return accesses the floating point registers on
SPARC even when compiling with -msoft-float.

gcc/
        * config/sparc/sparc.c (sparc_function_value_regno_p): Do not return
        true on %f0 for a target without FPU.
        * config/sparc/sparc.md (untyped_call): Do not save %f0 for a target
        without FPU.
        (untyped_return): Do not load %f0 for a target without FPU.

From-SVN: r228186

gcc/ChangeLog
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.md

index 71eac58c748651d8f43b2af922f1d13264a4cc93..0a6302c91e1d3013921adf04f1984cb067c45b6d 100644 (file)
@@ -1,3 +1,11 @@
+2015-09-28  Daniel Cederman  <cederman@gaisler.com>
+
+       * config/sparc/sparc.c (sparc_function_value_regno_p): Do not return
+       true on %f0 for a target without FPU.
+       * config/sparc/sparc.md (untyped_call): Do not save %f0 for a target
+       without FPU.
+       (untyped_return): Do not load %f0 for a target without FPU.
+
 2015-09-25  Tobias Burnus  <burnus@net-b.de>
 
        * doc/invoke.texi (-fsanitize): Update URLs.
index e020c5be9b75b65cfcf0268824ef011441974972..d6449445caf2dc01552424f452bf50db50e377b1 100644 (file)
@@ -7427,7 +7427,7 @@ sparc_libcall_value (enum machine_mode mode,
 static bool
 sparc_function_value_regno_p (const unsigned int regno)
 {
-  return (regno == 8 || regno == 32);
+  return (regno == 8 || (TARGET_FPU && regno == 32));
 }
 
 /* Do what is necessary for `va_start'.  We look at the current function
index 0715d83e21a68636106c0c5a584413beb57b4e76..731cd9722023bd8b8a0b9d8ccd3d6eed38403db6 100644 (file)
   ""
 {
   rtx valreg1 = gen_rtx_REG (DImode, 8);
-  rtx valreg2 = gen_rtx_REG (TARGET_ARCH64 ? TFmode : DFmode, 32);
   rtx result = operands[1];
 
   /* Pass constm1 to indicate that it may expect a structure value, but
 
   /* Save the function value registers.  */
   emit_move_insn (adjust_address (result, DImode, 0), valreg1);
-  emit_move_insn (adjust_address (result, TARGET_ARCH64 ? TFmode : DFmode, 8),
-                                 valreg2);
+  if (TARGET_FPU)
+    {
+      rtx valreg2 = gen_rtx_REG (TARGET_ARCH64 ? TFmode : DFmode, 32);
+      emit_move_insn (adjust_address (result, TARGET_ARCH64 ? TFmode : DFmode, 8),
+                     valreg2);
+    }
 
   /* The optimizer does not know that the call sets the function value
      registers we stored in the result block.  We avoid problems by
   ""
 {
   rtx valreg1 = gen_rtx_REG (DImode, 24);
-  rtx valreg2 = gen_rtx_REG (TARGET_ARCH64 ? TFmode : DFmode, 32);
   rtx result = operands[0];
 
   if (! TARGET_ARCH64)
       emit_insn (gen_update_return (rtnreg, value));
     }
 
-  /* Reload the function value registers.  */
+  /* Reload the function value registers.
+     Put USE insns before the return.  */
   emit_move_insn (valreg1, adjust_address (result, DImode, 0));
-  emit_move_insn (valreg2,
-                 adjust_address (result, TARGET_ARCH64 ? TFmode : DFmode, 8));
-
-  /* Put USE insns before the return.  */
   emit_use (valreg1);
-  emit_use (valreg2);
+
+  if (TARGET_FPU)
+    {
+      rtx valreg2 = gen_rtx_REG (TARGET_ARCH64 ? TFmode : DFmode, 32);
+      emit_move_insn (valreg2,
+                     adjust_address (result, TARGET_ARCH64 ? TFmode : DFmode, 8));
+      emit_use (valreg2);
+    }
 
   /* Construct the return.  */
   expand_naked_return ();