]> sourceware.org Git - glibc.git/commitdiff
soft-fp: Add _FP_UNREACHABLE.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 11 Mar 2015 01:14:15 +0000 (01:14 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 11 Mar 2015 01:14:34 +0000 (01:14 +0000)
This patch makes soft-fp use a new macro _FP_UNREACHABLE in place of
calling abort in unreachable default cases of switch statements.
_FP_UNREACHABLE expands to call __builtin_unreachable for GCC 4.5 and
later; the fallback to abort is thus only for kernel use.

Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.  Also tested with the math/ tests for mips64
(in the case of fma there *was* previously an abort call generated,
unlike for the other operations - one switch only deals with a subset
of classes for one operand based on what could have been generated in
the earlier part of fma, whereas the other switches deal with all
combinations of two classes - and this is apparently too complicated
for the default case to have been optimized away).

* soft-fp/soft-fp.h (_FP_UNREACHABLE): New macro.
* soft-fp/op-common.h (_FP_MUL): Use _FP_UNREACHABLE instead of
abort.
(_FP_FMA): Likewise.
(_FP_DIV): Likewise.

ChangeLog
soft-fp/op-common.h
soft-fp/soft-fp.h

index da5c0ef24e7ca902d4262456ca8bef5f35384c66..cea5b0e3106cbee8b1949ce4a3c011b4cebc5700 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-03-11  Joseph Myers  <joseph@codesourcery.com>
+
+       * soft-fp/soft-fp.h (_FP_UNREACHABLE): New macro.
+       * soft-fp/op-common.h (_FP_MUL): Use _FP_UNREACHABLE instead of
+       abort.
+       (_FP_FMA): Likewise.
+       (_FP_DIV): Likewise.
+
 2015-03-10  Roland McGrath  <roland@hack.frob.com>
 
        * scripts/evaluate-test.sh: Grok exit code 77 as UNSUPPORTED and exit
index 0a2f86aad9cfb0e8370f267515bd0de647e4f5b3..83c2156954ac2fdcb00196922d6a7b1546c83593 100644 (file)
          break;                                                \
                                                                \
        default:                                                \
-         abort ();                                             \
+         _FP_UNREACHABLE;                                      \
        }                                                       \
     }                                                          \
   while (0)
          break;                                                        \
                                                                        \
        default:                                                        \
-         abort ();                                                     \
+         _FP_UNREACHABLE;                                              \
        }                                                               \
                                                                        \
       /* T = X * Y is zero, infinity or NaN.  */                       \
          break;                                                        \
                                                                        \
        default:                                                        \
-         abort ();                                                     \
+         _FP_UNREACHABLE;                                              \
        }                                                               \
     done_fma: ;                                                                \
     }                                                                  \
          break;                                                \
                                                                \
        default:                                                \
-         abort ();                                             \
+         _FP_UNREACHABLE;                                      \
        }                                                       \
     }                                                          \
   while (0)
index bb68df91606621810b2044a7db97cf98fb23b65c..b247125a39716f7aa026357dde1b0005701704a1 100644 (file)
 # endif
 #endif
 
+/* For unreachable default cases in switch statements over bitwise OR
+   of FP_CLS_* values.  */
+#if (defined __GNUC__                                                  \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)))
+# define _FP_UNREACHABLE       __builtin_unreachable ()
+#else
+# define _FP_UNREACHABLE       abort ()
+#endif
+
 /* In the Linux kernel, some architectures have a single function that
    uses different kinds of unpacking and packing depending on the
    instruction being emulated, meaning it is not readily visible to
This page took 2.803665 seconds and 5 git commands to generate.