comparison configure.ac @ 19965:d20dd211cc89

Enable float truncation by default for octave builds. * NEWS: Announce change. * configure.ac: Change configure option to --disable-float-truncate, and enable float truncation by default.
author Rik <rik@octave.org>
date Thu, 19 Mar 2015 07:00:11 -0700
parents 23c0f89700a4
children 28a9e59d0714
comparison
equal deleted inserted replaced
19964:23c0f89700a4 19965:d20dd211cc89
463 ### When compiling math for x87, problems may arise in some code comparing 463 ### When compiling math for x87, problems may arise in some code comparing
464 ### floating-point intermediate results. The root cause is the extra precision 464 ### floating-point intermediate results. The root cause is the extra precision
465 ### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits. 465 ### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
466 ### Generally, storing the result in a local volatile variable forces a 466 ### Generally, storing the result in a local volatile variable forces a
467 ### truncation back to 64 bits, but it also degrades performance. 467 ### truncation back to 64 bits, but it also degrades performance.
468 ### Thus, we provide a FLOAT_TRUNCATE macro that may be defined to "volatile" 468 ### However, this performance degradation is very minimal, if indeed measurable.
469 ### when compiling for x87 target, or left empty for modern SSE math, that 469 ### Therefore, it has been enabled for all platforms and compilers.
470 ### doesn't suffer from this problem at all. 470 ### Reported bugs indicate that --enable-float-truncate is required for MinGW
471 ### FIXME: If no option value is given, configure uses a default heuristic 471 ### and Cygwin platforms and for GCC compilers >= 5.0. It should not be
472 ### which assumes that truncation should occur for MinGW and Cygwin 472 ### necessary for non-x87 targets or when using modern SSE math.
473 ### systems and not for any others. It would be marginally nicer 473 ac_float_truncate=volatile
474 ### to replace this with a test that checks whether the problem arises
475 ### and only sets the flag if necessary. However, the principal
476 ### scenario for those two systems is a cross-build where we can't
477 ### run an executable so the test wouldn't be too useful most of the
478 ### time (only native builds on MinGW and Cygwin *might* benefit).
479 ### Maybe, one could generate assembly code with -S option and inspect
480 ### it without having to run an executable, but this sounds pretty dicey.
481 AC_ARG_ENABLE([float-truncate], 474 AC_ARG_ENABLE([float-truncate],
482 [AS_HELP_STRING([--enable-float-truncate], 475 [AS_HELP_STRING([--disable-float-truncate],
483 [truncate intermediate FP results])], 476 [truncate intermediate FP results])],
484 [if test "$enableval" = yes; then 477 [if test "$enableval" = no; then
485 ac_float_truncate=volatile
486 else
487 ac_float_truncate= 478 ac_float_truncate=
488 fi], 479 fi],
489 [case $host_os in 480 [])
490 mingw* | cygwin*)
491 ac_float_truncate=volatile
492 ;;
493 *)
494 ac_float_truncate=
495 ;;
496 esac])
497 481
498 AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, [$ac_float_truncate], 482 AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, [$ac_float_truncate],
499 [Define to volatile if you need to truncate intermediate FP results.]) 483 [Define to volatile if you need to truncate intermediate FP results.])
500 484
501 ### Determine extra CFLAGS that may be necessary for Octave. 485 ### Determine extra CFLAGS that may be necessary for Octave.