sparc.h ({MASK,TARGET}_FPU_SET): Define.
authorDoug Evans <dje@gnu.org>
Mon, 9 Sep 1996 21:57:25 +0000 (21:57 +0000)
committerDoug Evans <dje@gnu.org>
Mon, 9 Sep 1996 21:57:25 +0000 (21:57 +0000)
* sparc/sparc.h ({MASK,TARGET}_FPU_SET): Define.
(TARGET_SWITCHES): Record if -m{,no-}fpu passed.
* sparc/sparc.c (sparc_override_options): Don't clobber explicit
-m{,no-}fpu setting with cpu default.

From-SVN: r12693

gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h

index 5b80dcb43c26952417290711e9b82cd3aba89e19..566d41a06e7672df3ad2a0d3dc95d796ce1a2e5f 100644 (file)
@@ -179,6 +179,8 @@ sparc_override_options ()
   struct cpu_table *cpu;
   struct sparc_cpu_select *sel;
 
+  int fpu = TARGET_FPU; /* save current -mfpu status */
+
   /* Set the default.  */
   for (def = &cpu_default[0]; def->name; ++def)
     if (def->cpu == TARGET_CPU_DEFAULT)
@@ -210,6 +212,11 @@ sparc_override_options ()
        }
     }
 
+  /* If -mfpu or -mno-fpu was explicitly used, don't override with
+     the processor default.  */
+  if (TARGET_FPU_SET)
+    target_flags = (target_flags & ~MASK_FPU) | fpu;
+
   /* Use the deprecated v8 insns for sparc64 in 32 bit mode.  */
   if (TARGET_V9 && TARGET_ARCH32)
     target_flags |= MASK_DEPRECATED_V8_INSNS;
index 7157100ce880052ed04de341fd64b99600206277..d3e18c289b756632f063f87f95c1ee0fe3d4ba28 100644 (file)
@@ -394,6 +394,10 @@ extern int target_flags;
 #define MASK_BROKEN_SAVERESTORE 0x200000
 #define TARGET_BROKEN_SAVERESTORE (target_flags & MASK_BROKEN_SAVERESTORE)
 
+/* Non-zero means -m{,no-}fpu was passed on the command line.  */
+#define MASK_FPU_SET 0x400000
+#define TARGET_FPU_SET (target_flags & MASK_FPU_SET)
+
 /* Macro to define tables used to set the flags.
    This is a list in braces of pairs in braces,
    each pair being { "NAME", VALUE }
@@ -401,10 +405,12 @@ extern int target_flags;
    An empty string NAME is used to identify the default VALUE.  */
 
 #define TARGET_SWITCHES  \
-  { {"fpu", MASK_FPU},                 \
+  { {"fpu", MASK_FPU | MASK_FPU_SET},  \
     {"no-fpu", -MASK_FPU},             \
-    {"hard-float", MASK_FPU},          \
+    {"no-fpu", MASK_FPU_SET},          \
+    {"hard-float", MASK_FPU | MASK_FPU_SET}, \
     {"soft-float", -MASK_FPU},         \
+    {"soft-float", MASK_FPU_SET},      \
     {"epilogue", MASK_EPILOGUE},       \
     {"no-epilogue", -MASK_EPILOGUE},   \
     {"unaligned-doubles", MASK_UNALIGNED_DOUBLES}, \