annotate src/fftw-3.3.8/m4/ax_cc_maxopt.m4 @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents bd3cc4d1df30
children
rev   line source
cannam@167 1 dnl @synopsis AX_CC_MAXOPT
cannam@167 2 dnl @summary turn on optimization flags for the C compiler
cannam@167 3 dnl @category C
cannam@167 4 dnl
cannam@167 5 dnl Try to turn on "good" C optimization flags for various compilers
cannam@167 6 dnl and architectures, for some definition of "good". (In our case,
cannam@167 7 dnl good for FFTW and hopefully for other scientific codes. Modify
cannam@167 8 dnl as needed.)
cannam@167 9 dnl
cannam@167 10 dnl The user can override the flags by setting the CFLAGS environment
cannam@167 11 dnl variable.
cannam@167 12 dnl
cannam@167 13 dnl Note also that the flags assume that ANSI C aliasing rules are
cannam@167 14 dnl followed by the code (e.g. for gcc's -fstrict-aliasing), and that
cannam@167 15 dnl floating-point computations can be re-ordered as needed.
cannam@167 16 dnl
cannam@167 17 dnl Requires macros: AX_CHECK_COMPILER_FLAGS, AX_COMPILER_VENDOR,
cannam@167 18 dnl
cannam@167 19 dnl @version 2011-06-22
cannam@167 20 dnl @license GPLWithACException
cannam@167 21 dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Matteo Frigo.
cannam@167 22 AC_DEFUN([AX_CC_MAXOPT],
cannam@167 23 [
cannam@167 24 AC_REQUIRE([AC_PROG_CC])
cannam@167 25 AC_REQUIRE([AX_COMPILER_VENDOR])
cannam@167 26 AC_REQUIRE([AC_CANONICAL_HOST])
cannam@167 27
cannam@167 28 # Try to determine "good" native compiler flags if none specified via CFLAGS
cannam@167 29 if test "$ac_test_CFLAGS" != "set"; then
cannam@167 30 CFLAGS=""
cannam@167 31 case $ax_cv_c_compiler_vendor in
cannam@167 32 dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host"
cannam@167 33 ;;
cannam@167 34
cannam@167 35 sun) CFLAGS="-native -fast -xO5 -dalign"
cannam@167 36 ;;
cannam@167 37
cannam@167 38 hp) CFLAGS="+Oall +Optrs_ansi +DSnative"
cannam@167 39 ;;
cannam@167 40
cannam@167 41 ibm) xlc_opt="-qarch=auto -qtune=auto"
cannam@167 42 AX_CHECK_COMPILER_FLAGS($xlc_opt,
cannam@167 43 CFLAGS="-O3 -qalias=ansi -w $xlc_opt",
cannam@167 44 [CFLAGS="-O3 -qalias=ansi -w"])
cannam@167 45 ;;
cannam@167 46
cannam@167 47 intel) CFLAGS="-O3"
cannam@167 48 # Intel seems to have changed the spelling of this flag recently
cannam@167 49 icc_ansi_alias="unknown"
cannam@167 50 for flag in -ansi-alias -ansi_alias; do
cannam@167 51 AX_CHECK_COMPILER_FLAGS($flag, [icc_ansi_alias=$flag; break])
cannam@167 52 done
cannam@167 53 if test "x$icc_ansi_alias" != xunknown; then
cannam@167 54 CFLAGS="$CFLAGS $icc_ansi_alias"
cannam@167 55 fi
cannam@167 56 AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double")
cannam@167 57 # We used to check for architecture flags here, e.g. -xHost etc.,
cannam@167 58 # but these flags are problematic. On icc-12.0.0, "-mavx -xHost"
cannam@167 59 # overrides -mavx with -xHost, generating SSE2 code instead of AVX
cannam@167 60 # code. ICC does not seem to support -mtune=host or equivalent
cannam@167 61 # non-ABI changing flag.
cannam@167 62 ;;
cannam@167 63
cannam@167 64 clang)
cannam@167 65 CFLAGS="-O3 -fomit-frame-pointer"
cannam@167 66 AX_CHECK_COMPILER_FLAGS(-mtune=native, CFLAGS="$CFLAGS -mtune=native")
cannam@167 67 AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing,CFLAGS="$CFLAGS -fstrict-aliasing")
cannam@167 68 ;;
cannam@167 69
cannam@167 70 gnu)
cannam@167 71 # Default optimization flags for gcc on all systems.
cannam@167 72 # Somehow -O3 does not imply -fomit-frame-pointer on ia32
cannam@167 73 CFLAGS="-O3 -fomit-frame-pointer"
cannam@167 74
cannam@167 75 # tune for the host by default
cannam@167 76 AX_CHECK_COMPILER_FLAGS(-mtune=native, CFLAGS="$CFLAGS -mtune=native")
cannam@167 77
cannam@167 78 # -malign-double for x86 systems
cannam@167 79 AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double")
cannam@167 80
cannam@167 81 # -fstrict-aliasing for gcc-2.95+
cannam@167 82 AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing,
cannam@167 83 CFLAGS="$CFLAGS -fstrict-aliasing")
cannam@167 84
cannam@167 85 # -fno-schedule-insns is pretty much required on all risc
cannam@167 86 # processors.
cannam@167 87 #
cannam@167 88 # gcc performs one pass of instruction scheduling, then a pass of
cannam@167 89 # register allocation, then another pass of instruction
cannam@167 90 # scheduling. The first pass reorders instructions in a way that
cannam@167 91 # is pretty much the worst possible for the purposes of register
cannam@167 92 # allocation. We disable the first pass.
cannam@167 93 AX_CHECK_COMPILER_FLAGS(-fno-schedule-insns, CFLAGS="$CFLAGS -fno-schedule-insns")
cannam@167 94
cannam@167 95 # flags to enable power ISA 2.07 instructions with gcc (always true with vsx)
cannam@167 96 if test "$have_vsx" = "yes"; then
cannam@167 97 AX_CHECK_COMPILER_FLAGS(-mcpu=power8, CFLAGS="$CFLAGS -mcpu=power8")
cannam@167 98 AX_CHECK_COMPILER_FLAGS(-mpower8-fusion, CFLAGS="$CFLAGS -mpower8-fusion")
cannam@167 99 AX_CHECK_COMPILER_FLAGS(-mpower8-vector, CFLAGS="$CFLAGS -mpower8-vector")
cannam@167 100 AX_CHECK_COMPILER_FLAGS(-mdirect-move, CFLAGS="$CFLAGS -mdirect-move")
cannam@167 101 fi
cannam@167 102 ;;
cannam@167 103 esac
cannam@167 104
cannam@167 105 if test -z "$CFLAGS"; then
cannam@167 106 echo ""
cannam@167 107 echo "********************************************************"
cannam@167 108 echo "* WARNING: Don't know the best CFLAGS for this system *"
cannam@167 109 echo "* Use ./configure CFLAGS=... to specify your own flags *"
cannam@167 110 echo "* (otherwise, a default of CFLAGS=-O3 will be used) *"
cannam@167 111 echo "********************************************************"
cannam@167 112 echo ""
cannam@167 113 CFLAGS="-O3"
cannam@167 114 fi
cannam@167 115
cannam@167 116 AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [
cannam@167 117 echo ""
cannam@167 118 echo "********************************************************"
cannam@167 119 echo "* WARNING: The guessed CFLAGS don't seem to work with *"
cannam@167 120 echo "* your compiler. *"
cannam@167 121 echo "* Use ./configure CFLAGS=... to specify your own flags *"
cannam@167 122 echo "********************************************************"
cannam@167 123 echo ""
cannam@167 124 CFLAGS=""
cannam@167 125 ])
cannam@167 126
cannam@167 127 fi
cannam@167 128 ])