Branch: Tag:

2014-12-04

2014-12-04 19:25:24 by Per Hedbor <ph@opera.com>

Added some more warnings by default, and test for some more builtins.

The __builtin_expect is now tested for together with the other
builtins, which makes it available when compiling with clang.

This helps the index_shared_string function be significantly faster
when indexing narrow shared strings (which is assumed to be most
common).

Of course, if you generally speaking index more wide strings than
shared strings it's slower.

Then again, it you have "medium" wide strings (2 bytes per character)
the performance is identical (both gcc and clang had the tests in
2,1,0 order).

1796:    AC_SYS_COMPILER_FLAG(-Wformat-security,Wformat_security,WARN)    AC_SYS_COMPILER_FLAG(-Wimplicit-function-declaration,Wimplicit_function_declaration,WARN)    AC_SYS_COMPILER_FLAG(-Wmultichar,Wmultichar,WARN) +  AC_SYS_COMPILER_FLAG(-Wunused-function,Wunused_function,WARN)    AC_SYS_COMPILER_FLAG(-Wswitch,Wswitch,WARN)       if test "x$with_copt" != xno; then
2457:    )   ])    - # GCC builtins +  + define(TEST_BUILTIN_VOID, [ +  AC_MSG_CHECKING(for $1) +  AC_TRY_LINK([ + $3 + ],[ + unsigned long lint; + $1($2); + return 0; + ], +  AC_MSG_RESULT(yes) +  AC_DEFINE(translit([HAS_$1], [a-z], [A-Z]), 1, [Whether $1 is available]) +  , +  AC_MSG_RESULT(no) +  ) + ]) +  + # RDRND hardware random support + AC_SYS_COMPILER_FLAG(-mrdrnd, opt_rdrnd, OPTIMIZE) + TEST_BUILTIN(__builtin_ia32_rdrand32_step,[&foo]) +  + TEST_BUILTIN_VOID(__builtin_unreachable,[]) + TEST_BUILTIN_VOID(__builtin_expect,[1,1])   TEST_BUILTIN(__builtin_clz, 23)   TEST_BUILTIN(__builtin_clzl, 23)   TEST_BUILTIN(__builtin_clzll, 23)