< prev index next >

make/autoconf/flags-cflags.m4

Print this page
@  rev 51624 : 8210416: [linux] Poor StrictMath performance due to non-optimized compilation
|  Summary: Compile fdlibm with -O2 -ffp-contract=off gcc/clang arches.
~  Reviewed-by: aph, erikj, dholmes, darcy


 356   FLAGS_CPU=$OPENJDK_TARGET_CPU
 357   FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH
 358   FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS
 359   FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN
 360   FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
 361   FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
 362 
 363   FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
 364 
 365   FLAGS_OS=$OPENJDK_BUILD_OS
 366   FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
 367   FLAGS_CPU=$OPENJDK_BUILD_CPU
 368   FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH
 369   FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS
 370   FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN
 371   FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
 372   FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
 373 
 374   FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 375 












 376   # Tests are only ever compiled for TARGET
 377   CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
 378   CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
 379   CFLAGS_TESTEXE="$CFLAGS_JDKEXE"
 380   CXXFLAGS_TESTEXE="$CXXFLAGS_JDKEXE"
 381 
 382   AC_SUBST(CFLAGS_TESTLIB)
 383   AC_SUBST(CFLAGS_TESTEXE)
 384   AC_SUBST(CXXFLAGS_TESTLIB)
 385   AC_SUBST(CXXFLAGS_TESTEXE)
 386 ])
 387 
 388 ################################################################################
 389 # platform independent
 390 AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
 391 [
 392   #### OS DEFINES, these should be independent on toolchain
 393   if test "x$OPENJDK_TARGET_OS" = xlinux; then
 394     CFLAGS_OS_DEF_JVM="-DLINUX"
 395     CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"




 356   FLAGS_CPU=$OPENJDK_TARGET_CPU
 357   FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH
 358   FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS
 359   FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN
 360   FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
 361   FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
 362 
 363   FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
 364 
 365   FLAGS_OS=$OPENJDK_BUILD_OS
 366   FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
 367   FLAGS_CPU=$OPENJDK_BUILD_CPU
 368   FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH
 369   FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS
 370   FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN
 371   FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
 372   FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
 373 
 374   FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 375 
 376   COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off"
 377   # Check that the compiler supports -ffp-contract=off flag
 378   # Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty
 379   # otherwise.
 380   # These flags are required for GCC-based builds of
 381   # fdlibm with optimization without losing precision.
 382   # Notably, -ffp-contract=off needs to be added for GCC >= 4.6.
 383   FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}],
 384       IF_TRUE: [FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}],
 385       IF_FALSE: [FDLIBM_CFLAGS=""])
 386   AC_SUBST(FDLIBM_CFLAGS)
 387 
 388   # Tests are only ever compiled for TARGET
 389   CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
 390   CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
 391   CFLAGS_TESTEXE="$CFLAGS_JDKEXE"
 392   CXXFLAGS_TESTEXE="$CXXFLAGS_JDKEXE"
 393 
 394   AC_SUBST(CFLAGS_TESTLIB)
 395   AC_SUBST(CFLAGS_TESTEXE)
 396   AC_SUBST(CXXFLAGS_TESTLIB)
 397   AC_SUBST(CXXFLAGS_TESTEXE)
 398 ])
 399 
 400 ################################################################################
 401 # platform independent
 402 AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
 403 [
 404   #### OS DEFINES, these should be independent on toolchain
 405   if test "x$OPENJDK_TARGET_OS" = xlinux; then
 406     CFLAGS_OS_DEF_JVM="-DLINUX"
 407     CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"


< prev index next >