annotate fft/fftw/fftw-3.3.4/m4/ax_cc_maxopt.m4 @ 40:223f770b5341 kissfft-double tip

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