Commit 9d465faf by Ian Lance Taylor

math: Compile with -mfancy-math-387 -funsafe-optimizations on x86.

From-SVN: r184015
parent 82b37806
...@@ -10027,7 +10027,8 @@ Call_expression::do_get_tree(Translate_context* context) ...@@ -10027,7 +10027,8 @@ Call_expression::do_get_tree(Translate_context* context)
// This is to support builtin math functions when using 80387 math. // This is to support builtin math functions when using 80387 math.
tree excess_type = NULL_TREE; tree excess_type = NULL_TREE;
if (TREE_CODE(fndecl) == FUNCTION_DECL if (optimize
&& TREE_CODE(fndecl) == FUNCTION_DECL
&& DECL_IS_BUILTIN(fndecl) && DECL_IS_BUILTIN(fndecl)
&& DECL_BUILT_IN_CLASS(fndecl) == BUILT_IN_NORMAL && DECL_BUILT_IN_CLASS(fndecl) == BUILT_IN_NORMAL
&& nargs > 0 && nargs > 0
......
...@@ -1959,7 +1959,9 @@ log/check: $(CHECK_DEPS) ...@@ -1959,7 +1959,9 @@ log/check: $(CHECK_DEPS)
math/math.lo.dep: $(go_math_files) math/math.lo.dep: $(go_math_files)
$(BUILDDEPS) $(BUILDDEPS)
math/math.lo: $(go_math_files) math/math.lo: $(go_math_files)
$(BUILDPACKAGE) $(MKDIR_P) $(@D)
files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \
$(LTGOCOMPILE) $(MATH_FLAG) -I . -c -fgo-prefix="libgo_$(@D)" -o $@ $$files
math/check: $(CHECK_DEPS) math/check: $(CHECK_DEPS)
@$(CHECK) @$(CHECK)
.PHONY: math/check .PHONY: math/check
......
...@@ -390,6 +390,7 @@ LN_S = @LN_S@ ...@@ -390,6 +390,7 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MATH_FLAG = @MATH_FLAG@
MATH_LIBS = @MATH_LIBS@ MATH_LIBS = @MATH_LIBS@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NET_LIBS = @NET_LIBS@ NET_LIBS = @NET_LIBS@
...@@ -4512,7 +4513,9 @@ log/check: $(CHECK_DEPS) ...@@ -4512,7 +4513,9 @@ log/check: $(CHECK_DEPS)
math/math.lo.dep: $(go_math_files) math/math.lo.dep: $(go_math_files)
$(BUILDDEPS) $(BUILDDEPS)
math/math.lo: $(go_math_files) math/math.lo: $(go_math_files)
$(BUILDPACKAGE) $(MKDIR_P) $(@D)
files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \
$(LTGOCOMPILE) $(MATH_FLAG) -I . -c -fgo-prefix="libgo_$(@D)" -o $@ $$files
math/check: $(CHECK_DEPS) math/check: $(CHECK_DEPS)
@$(CHECK) @$(CHECK)
.PHONY: math/check .PHONY: math/check
......
...@@ -604,6 +604,7 @@ LTLIBOBJS ...@@ -604,6 +604,7 @@ LTLIBOBJS
LIBOBJS LIBOBJS
STRUCT_EPOLL_EVENT_FD_OFFSET STRUCT_EPOLL_EVENT_FD_OFFSET
SIZEOF_STRUCT_EPOLL_EVENT SIZEOF_STRUCT_EPOLL_EVENT
MATH_FLAG
STRINGOPS_FLAG STRINGOPS_FLAG
HAVE_WAIT4_FALSE HAVE_WAIT4_FALSE
HAVE_WAIT4_TRUE HAVE_WAIT4_TRUE
...@@ -11101,7 +11102,7 @@ else ...@@ -11101,7 +11102,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11104 "configure" #line 11105 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -11207,7 +11208,7 @@ else ...@@ -11207,7 +11208,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11210 "configure" #line 11211 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -14707,6 +14708,33 @@ if test "$libgo_cv_c_stringops" = yes; then ...@@ -14707,6 +14708,33 @@ if test "$libgo_cv_c_stringops" = yes; then
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -mfancy-math-387" >&5
$as_echo_n "checking whether compiler supports -mfancy-math-387... " >&6; }
if test "${libgo_cv_c_fancymath+set}" = set; then :
$as_echo_n "(cached) " >&6
else
CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -mfancy-math-387"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int i;
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
libgo_cv_c_fancymath=yes
else
libgo_cv_c_fancymath=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$CFLAGS_hold
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_fancymath" >&5
$as_echo "$libgo_cv_c_fancymath" >&6; }
MATH_FLAG=
if test "$libgo_cv_c_fancymath" = yes; then
MATH_FLAG="-mfancy-math-387 -funsafe-math-optimizations"
fi
CFLAGS_hold=$CFLAGS CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
ac_fn_c_check_type "$LINENO" "off64_t" "ac_cv_type_off64_t" "$ac_includes_default" ac_fn_c_check_type "$LINENO" "off64_t" "ac_cv_type_off64_t" "$ac_includes_default"
......
...@@ -522,6 +522,23 @@ if test "$libgo_cv_c_stringops" = yes; then ...@@ -522,6 +522,23 @@ if test "$libgo_cv_c_stringops" = yes; then
fi fi
AC_SUBST(STRINGOPS_FLAG) AC_SUBST(STRINGOPS_FLAG)
dnl For x86 we want to compile the math library with -mfancy-math-387
dnl -funsafe-math-optimizations so that we can use the builtin
dnl instructions directly.
AC_CACHE_CHECK([whether compiler supports -mfancy-math-387],
[libgo_cv_c_fancymath],
[CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -mfancy-math-387"
AC_COMPILE_IFELSE([int i;],
[libgo_cv_c_fancymath=yes],
[libgo_cv_c_fancymath=no])
CFLAGS=$CFLAGS_hold])
MATH_FLAG=
if test "$libgo_cv_c_fancymath" = yes; then
MATH_FLAG="-mfancy-math-387 -funsafe-math-optimizations"
fi
AC_SUBST(MATH_FLAG)
CFLAGS_hold=$CFLAGS CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
AC_CHECK_TYPES([off64_t]) AC_CHECK_TYPES([off64_t])
......
...@@ -108,6 +108,7 @@ LN_S = @LN_S@ ...@@ -108,6 +108,7 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MATH_FLAG = @MATH_FLAG@
MATH_LIBS = @MATH_LIBS@ MATH_LIBS = @MATH_LIBS@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NET_LIBS = @NET_LIBS@ NET_LIBS = @NET_LIBS@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment