// This is to support builtin math functions when using 80387 math.
tree excess_type = NULL_TREE;
- if (TREE_CODE(fndecl) == FUNCTION_DECL
+ if (optimize
+ && TREE_CODE(fndecl) == FUNCTION_DECL
&& DECL_IS_BUILTIN(fndecl)
&& DECL_BUILT_IN_CLASS(fndecl) == BUILT_IN_NORMAL
&& nargs > 0
math/math.lo.dep: $(go_math_files)
$(BUILDDEPS)
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)
@$(CHECK)
.PHONY: math/check
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
+MATH_FLAG = @MATH_FLAG@
MATH_LIBS = @MATH_LIBS@
MKDIR_P = @MKDIR_P@
NET_LIBS = @NET_LIBS@
math/math.lo.dep: $(go_math_files)
$(BUILDDEPS)
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)
@$(CHECK)
.PHONY: math/check
LIBOBJS
STRUCT_EPOLL_EVENT_FD_OFFSET
SIZEOF_STRUCT_EPOLL_EVENT
+MATH_FLAG
STRINGOPS_FLAG
HAVE_WAIT4_FALSE
HAVE_WAIT4_TRUE
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11104 "configure"
+#line 11105 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11210 "configure"
+#line 11211 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
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="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
ac_fn_c_check_type "$LINENO" "off64_t" "ac_cv_type_off64_t" "$ac_includes_default"
fi
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="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
AC_CHECK_TYPES([off64_t])
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
+MATH_FLAG = @MATH_FLAG@
MATH_LIBS = @MATH_LIBS@
MKDIR_P = @MKDIR_P@
NET_LIBS = @NET_LIBS@