diff options
| author | Ulrich Drepper <[email protected]> | 2008-01-02 17:44:39 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2008-01-02 17:44:39 +0000 |
| commit | 3cbdd387c752999255aea91600b5cfdefbeac7d0 (patch) | |
| tree | 50c18bd26f8cd31f4c1aa3ce1d78bb98548659ba /configure.ac | |
| parent | ad024afc93dcd0f4797b3e80bfb6b80c34da5c12 (diff) | |
propagate from branch 'com.redhat.elfutils.disasm' (head d15b4eb794e81e477f9896fe82a74cb5ecf4514c)
to branch 'com.redhat.elfutils' (head eaacbf01f8cc89d043ec6eca9b5e35cb5c4cde06)
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index b89f9a42..0b943ccb 100644 --- a/configure.ac +++ b/configure.ac @@ -134,7 +134,15 @@ if test "$use_mudflap" = fail; then fi AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes) -# Enable gprof suport. +dnl enable debugging of branch prediction. +use_debugpred=0 +AC_ARG_ENABLE([debugpred], +AC_HELP_STRING([--enable-debugpred], +[build binaries with support to debug branch prediction]), +[use_debugpred=1], [use_debugpred=0]) +AC_SUBST([DEBUGPRED], $use_debugpred) + +dnl Enable gprof suport. AC_ARG_ENABLE([gprof], AC_HELP_STRING([--enable-gprof], [build binaries with gprof support]), [use_gprof=yes], [use_gprof=no]) @@ -267,8 +275,47 @@ AH_BOTTOM([ # define ALLOW_UNALIGNED 0 #endif -#define unlikely(expr) __builtin_expect (expr, 0) -#define likely(expr) __builtin_expect (expr, 1) +#if DEBUGPRED +# ifdef __x86_64__ +asm (".section predict_data, \"aw\"; .previous\n" + ".section predict_line, \"a\"; .previous\n" + ".section predict_file, \"a\"; .previous"); +# ifndef PIC +# define debugpred__(e, E) \ + ({ long int _e = !!(e); \ + asm volatile (".pushsection predict_data; ..predictcnt%=: .quad 0; .quad 0\n" \ + ".section predict_line; .quad %c1\n" \ + ".section predict_file; .quad %c2; .popsection\n" \ + "addq $1,..predictcnt%=(,%0,8)" \ + : : "r" (_e == E), "i" (__LINE__), "i" (__FILE__)); \ + __builtin_expect (_e, E); \ + }) +# endif +# elif defined __i386__ +asm (".section predict_data, \"aw\"; .previous\n" + ".section predict_line, \"a\"; .previous\n" + ".section predict_file, \"a\"; .previous"); +# ifndef PIC +# define debugpred__(e, E) \ + ({ long int _e = !!(e); \ + asm volatile (".pushsection predict_data; ..predictcnt%=: .long 0; .long 0\n" \ + ".section predict_line; .long %c1\n" \ + ".section predict_file; .long %c2; .popsection\n" \ + "incl ..predictcnt%=(,%0,8)" \ + : : "r" (_e == E), "i" (__LINE__), "i" (__FILE__)); \ + __builtin_expect (_e, E); \ + }) +# endif +# endif +# ifdef debugpred__ +# define unlikely(e) debugpred__ (e,0) +# define likely(e) debugpred__ (e,1) +# endif +#endif +#ifndef likely +# define unlikely(expr) __builtin_expect (!!(expr), 0) +# define likely(expr) __builtin_expect (!!(expr), 1) +#endif #define obstack_calloc(ob, size) \ ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); }) |
