This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Define __NO_MATH_INLINES and __NO_STRING_INLINES


Hello,

this patch adds two new builtin defines on linux systems: __NO_MATH_INLINES and
__NO_STRING_INLINES. These defines disable the inline assembly version of
standard library functions in glibc, which conflict with the GCC builtins for
the same functions.

This is known to positively affect speed on many testcases: see for instance
http://gcc.gnu.org/ml/gcc/2004-04/msg00840.html. On the other hand, it might
well be that we are still missing optimized builtins for some functions for
which we are going to lose a fast assembly optimized version.

Given that:

* We are still in Stage 1, there is tons of time to test the mainline, spot
testcases which are affected negatively by this change, and fix them properly
by implementing the missing builtins.
* The correct way to operate for the present and the future is to use GCC
builtins for anything for which it would make sense to provide an inline
version in glibc.
* In the worst scenario, the patch could even be pretty easily reverted on the
branch a few days before release without many troubles, if critical
show-stopper regressions were found that nobody had time to fix properly.

I'm positive that this patch is an absolute step forward.

This has been bootstrapped and tested (all languages) on i686-pc-linux-gnu with
no new regressions. OK for mainline?

Giovanni Bajo


gcc/
        * config/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): Add built-in
        defines for __NO_MATH_INLINES and __NO_STRING_INLINES.
        * system.h (__NO_STRING_INLINES): Avoid conflicting with the
        built-in define.

libmudflap/
        * mf-runtime.h.in (__NO_STRING_INLINES): Avoid conflicting with the
        built-in define.

libstdc++-v3/
        * config/os/gnu-linux/os_defines.h (__NO_STRING_INLINES): Avoid
        conflicting with the built-in define.
        * config/os/tpf/os_defines.h (__NO_STRING_INLINES): Likewise.


Index: gcc/system.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/system.h,v
retrieving revision 1.210
diff -c -3 -p -r1.210 system.h
*** gcc/system.h 13 May 2004 06:39:45 -0000 1.210
--- gcc/system.h 25 May 2004 02:04:55 -0000
*************** extern int errno;
*** 116,122 ****

  /* Some of glibc's string inlines cause warnings.  Plus we'd rather
     rely on (and therefore test) GCC's string builtins.  */
! #define __NO_STRING_INLINES

  #ifdef STRING_WITH_STRINGS
  # include <string.h>
--- 116,122 ----

  /* Some of glibc's string inlines cause warnings.  Plus we'd rather
     rely on (and therefore test) GCC's string builtins.  */
! #define __NO_STRING_INLINES 1

  #ifdef STRING_WITH_STRINGS
  # include <string.h>
Index: gcc/config/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/linux.h,v
retrieving revision 1.28
diff -c -3 -p -r1.28 linux.h
*** gcc/config/linux.h 23 Apr 2004 02:16:22 -0000 1.28
--- gcc/config/linux.h 25 May 2004 02:04:55 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 105,110 ****
--- 105,112 ----
   builtin_assert ("system=linux");   \
   builtin_assert ("system=unix");    \
   builtin_assert ("system=posix");   \
+  builtin_define ("__NO_MATH_INLINES");   \
+  builtin_define ("__NO_STRING_INLINES");   \
      } while (0)

  #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
Index: libmudflap/mf-runtime.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/mf-runtime.h.in,v
retrieving revision 1.2
diff -c -3 -p -r1.2 mf-runtime.h.in
*** libmudflap/mf-runtime.h.in 13 May 2004 06:41:03 -0000 1.2
--- libmudflap/mf-runtime.h.in 25 May 2004 02:06:49 -0000
*************** extern int __mf_set_options (const char
*** 179,185 ****
  #pragma redefine_extname shmdt __mfwrap_shmdt

  /* Disable glibc macros.  */
! #define __NO_STRING_INLINES

  #endif /* _MUDFLAP */

--- 179,185 ----
  #pragma redefine_extname shmdt __mfwrap_shmdt

  /* Disable glibc macros.  */
! #define __NO_STRING_INLINES 1

  #endif /* _MUDFLAP */

Index: libstdc++-v3/config/os/gnu-linux/os_defines.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/gnu-linux/os_defines.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 os_defines.h
*** libstdc++-v3/config/os/gnu-linux/os_defines.h 5 Jul 2003 04:05:31 -0000 1.4
--- libstdc++-v3/config/os/gnu-linux/os_defines.h 25 May 2004 02:06:49 -0000
***************
*** 40,46 ****

  // We must not see the optimized string functions GNU libc defines.
  #if defined __GLIBC__ && __GLIBC__ >= 2
! #define __NO_STRING_INLINES
  #endif

  #endif
--- 40,46 ----

  // We must not see the optimized string functions GNU libc defines.
  #if defined __GLIBC__ && __GLIBC__ >= 2
! #define __NO_STRING_INLINES 1
  #endif

  #endif
Index: libstdc++-v3/config/os/tpf/os_defines.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/tpf/os_defines.h,v
retrieving revision 1.1
diff -c -3 -p -r1.1 os_defines.h
*** libstdc++-v3/config/os/tpf/os_defines.h 27 Jan 2004 15:36:22 -0000 1.1
--- libstdc++-v3/config/os/tpf/os_defines.h 25 May 2004 02:06:49 -0000
***************
*** 40,45 ****
  #define __NO_CTYPE 1

  // We must not see the optimized string functions GNU libc defines.
! #define __NO_STRING_INLINES

  #endif
--- 40,45 ----
  #define __NO_CTYPE 1

  // We must not see the optimized string functions GNU libc defines.
! #define __NO_STRING_INLINES 1

  #endif



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]