From 1e6d07234fc0edcf0e88d75cf48f0b0dbbea3f39 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Thu, 28 Sep 2017 19:20:33 +0100 Subject: Simplify C99 isgreater macros Simplify the C99 isgreater macros. Although some support was added in GCC 2.97, not all targets added support until GCC 3.1. Therefore only use the builtins in math.h from GCC 3.1 onwards, and defer to generic macros otherwise. Improve the generic isunordered macro to use compares rather than call fpclassify twice - this is not only faster but also correct for signaling NaNs. * math/math.h: Improve handling of C99 isgreater macros. * sysdeps/alpha/fpu/bits/mathinline.h: Remove isgreater macros. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Likewise. * sysdeps/powerpc/bits/mathinline.h: Likewise. * sysdeps/sparc/fpu/bits/mathinline.h: Likewise. * sysdeps/x86/fpu/bits/mathinline.h: Likewise. --- sysdeps/powerpc/bits/mathinline.h | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'sysdeps/powerpc') diff --git a/sysdeps/powerpc/bits/mathinline.h b/sysdeps/powerpc/bits/mathinline.h index e5f0cd3..406465f 100644 --- a/sysdeps/powerpc/bits/mathinline.h +++ b/sysdeps/powerpc/bits/mathinline.h @@ -29,31 +29,6 @@ #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ #ifdef __USE_ISOC99 -# if !__GNUC_PREREQ (2,97) -# define __unordered_cmp(x, y) \ - (__extension__ \ - ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ - unsigned __r; \ - __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y) \ - : "cr7"); \ - __r; })) - -# undef isgreater -# undef isgreaterequal -# undef isless -# undef islessequal -# undef islessgreater -# undef isunordered - -# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1) -# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0) -# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1) -# define islessequal(x, y) ((__unordered_cmp (x, y) & 0xA) != 0) -# define islessgreater(x, y) ((__unordered_cmp (x, y) & 0xC) != 0) -# define isunordered(x, y) (__unordered_cmp (x, y) & 1) - -# endif /* __GNUC_PREREQ (2,97) */ - /* The gcc, version 2.7 or below, has problems with all this inlining code. So disable it for this version of the compiler. */ # if __GNUC_PREREQ (2, 8) -- cgit v1.1