]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
config.gcc (mips*-*-*): Add --with-fpu support.
authorJürgen Urban <JuergenUrban@gmx.de>
Mon, 22 Jul 2013 18:48:32 +0000 (18:48 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 22 Jul 2013 18:48:32 +0000 (18:48 +0000)
gcc/
2013-07-26  Jürgen Urban  <JuergenUrban@gmx.de>

* config.gcc (mips*-*-*): Add --with-fpu support.  Make single the
default for R5900 targets.
* config/mips/mips.h (OPTION_DEFAULT_SPECS): Handle --with-fpu.
(ISA_HAS_LDC1_SDC1): Set to false for TARGET_MIPS5900.
* config/mips/mips.c (mips_option_override): Report an error for
-march=r5900 -mhard-float -mdouble-float.  Use spu_single_format
for -march=r5900 -mhard-float.

From-SVN: r201143

gcc/ChangeLog
gcc/config.gcc
gcc/config/mips/mips.c
gcc/config/mips/mips.h

index 4bb747fdec96573be193d0ce94f5e49941d538ee..efc9ac7e51de34a1182986aa90384026c7abefbe 100644 (file)
@@ -1,3 +1,13 @@
+2013-07-22  Jürgen Urban  <JuergenUrban@gmx.de>
+
+       * config.gcc (mips*-*-*): Add --with-fpu support.  Make single the
+       default for R5900 targets.
+       * config/mips/mips.h (OPTION_DEFAULT_SPECS): Handle --with-fpu.
+       (ISA_HAS_LDC1_SDC1): Set to false for TARGET_MIPS5900.
+       * config/mips/mips.c (mips_option_override): Report an error for
+       -march=r5900 -mhard-float -mdouble-float.  Use spu_single_format
+       for -march=r5900 -mhard-float.
+
 2013-07-22  Chang  <pchang9@cs.wisc.edu>
 
        * df-problems.c (can_move_insns_across): Exit loop once we
index e1b688fd43488323eab9a7b5135a5ef42be7c744..1a398a7232fc9b4d78c5889b38a9071a591fcc5a 100644 (file)
@@ -3091,6 +3091,16 @@ if test x$with_float = x; then
   esac
 fi
 
+# Infer a default setting for --with-fpu.
+if test x$with_fpu = x; then
+  case ${target} in
+    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
+      # The R5900 FPU only supports single precision.
+      with_fpu=single
+      ;;
+  esac
+fi
+
 # Support --with-fpmath.
 if test x$with_fpmath != x; then
   case ${target} in
@@ -3469,7 +3479,7 @@ case "${target}" in
                ;;
 
        mips*-*-*)
-               supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64 divide llsc mips-plt synci"
+               supported_defaults="abi arch arch_32 arch_64 float fpu tune tune_32 tune_64 divide llsc mips-plt synci"
 
                case ${with_float} in
                "" | soft | hard)
@@ -3481,6 +3491,16 @@ case "${target}" in
                        ;;
                esac
 
+               case ${with_fpu} in
+               "" | single | double)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown fpu type used in --with-fpu=$with_fpu" 1>&2
+                       exit 1
+                       ;;
+               esac
+
                case ${with_abi} in
                "" | 32 | o64 | n32 | 64 | eabi)
                        # OK
index e95bdd88d4a07e6217aab793f403c25b87f74734..a3735dc598d4c1d99203ed972f0cfc9a0c8b7eb6 100644 (file)
@@ -16832,6 +16832,11 @@ mips_option_override (void)
 
   /* End of code shared with GAS.  */
 
+  /* The R5900 FPU only supports single precision.  */
+  if (TARGET_MIPS5900 && TARGET_HARD_FLOAT_ABI && TARGET_DOUBLE_FLOAT)
+    error ("unsupported combination: %s",
+          "-march=r5900 -mhard-float -mdouble-float");
+
   /* If a -mlong* option was given, check that it matches the ABI,
      otherwise infer the -mlong* setting from the other options.  */
   if ((target_flags_explicit & MASK_LONG64) != 0)
@@ -17139,6 +17144,9 @@ mips_option_override (void)
      filling.  Registering the pass must be done at start up.  It's
      convenient to do it here.  */
   register_pass (&insert_pass_mips_machine_reorg2);
+
+  if (TARGET_HARD_FLOAT_ABI && TARGET_MIPS5900)
+    REAL_MODE_FORMAT (SFmode) = &spu_single_format;
 }
 
 /* Swap the register information for registers I and I + 1, which
index 007f598c658f2426ffe1e73e985c0444c2a0549c..2dcccd48b8fd42f4f59c21fffac0c9322bc05065 100644 (file)
@@ -754,6 +754,7 @@ struct mips_cpu_info {
   {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:-mtune=%(VALUE)}}" }, \
   {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \
   {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, \
+  {"fpu", "%{!msingle-float:%{!mdouble-float:-m%(VALUE)-float}}" }, \
   {"divide", "%{!mdivide-traps:%{!mdivide-breaks:-mdivide-%(VALUE)}}" }, \
   {"llsc", "%{!mllsc:%{!mno-llsc:-m%(VALUE)}}" }, \
   {"mips-plt", "%{!mplt:%{!mno-plt:-m%(VALUE)}}" }, \
@@ -859,7 +860,9 @@ struct mips_cpu_info {
                                 || TARGET_LOONGSON_2EF)
 
 /* ISA has LDC1 and SDC1.  */
-#define ISA_HAS_LDC1_SDC1      (!ISA_MIPS1 && !TARGET_MIPS16)
+#define ISA_HAS_LDC1_SDC1      (!ISA_MIPS1                             \
+                                && !TARGET_MIPS5900                    \
+                                && !TARGET_MIPS16)
 
 /* ISA has the mips4 FP condition code instructions: FP-compare to CC,
    branch on CC, and move (both FP and non-FP) on CC.  */