From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 2F0BB3858407; Fri, 9 Feb 2024 17:33:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F0BB3858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707500028; bh=3zS8GuFFVxkJo6OHFwdxXo1XE4UfX1o+qzMAvZPn1Qw=; h=From:To:Subject:Date:From; b=rdcBtCqZB+yJeErk6IqfhZ4oy2+f4tEOzcDroANQcqG3pOGCEb/s4GKp2xpz7g1P6 6gncnyNG+hsnncWj1ezGbtFGm44gtBj7T0k5Mm+aIFPkGY+hGYzAwpx/EIfCPCRTwZ FYdP2oyWpc+0ETFURW2Z4eXSJF4yH0m2zYzjylAg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] x86: Use -mfpmath=387 iff compiler supports it X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 4da4759d3c2ebbf1caed96da65649f9c684f56d7 X-Git-Newrev: d118f4928a3b119c57ca3eee222a7d3636d9ff22 Message-Id: <20240209173348.2F0BB3858407@sourceware.org> Date: Fri, 9 Feb 2024 17:33:48 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d118f4928a3b119c57ca3eee222a7d3636d9ff22 commit d118f4928a3b119c57ca3eee222a7d3636d9ff22 Author: Adhemerval Zanella Date: Thu Mar 24 15:02:05 2022 -0300 x86: Use -mfpmath=387 iff compiler supports it Diff: --- sysdeps/x86/configure | 24 ++++++++++++++++++++++++ sysdeps/x86/configure.ac | 10 ++++++++++ sysdeps/x86/fpu/Makefile | 5 ++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure index 1f4c2d67fd..cedf1d9174 100644 --- a/sysdeps/x86/configure +++ b/sysdeps/x86/configure @@ -125,6 +125,30 @@ fi config_vars="$config_vars enable-x86-isa-level = $libc_cv_include_x86_isa_level" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports -mpfmath=387" >&5 +printf %s "checking if compiler supports -mpfmath=387... " >&6; } +if test ${libc_cv_cc_mfpmath_387+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if { ac_try='${CC-cc} -Werror -mfpmath=387 -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + libc_cv_cc_mfpmath_387="-mfpmath=387" +else $as_nop + libc_cv_cc_mfpmath_387= +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_mfpmath_387" >&5 +printf "%s\n" "$libc_cv_cc_mfpmath_387" >&6; } +config_vars="$config_vars +config-cflags-mfpath-387 = $libc_cv_cc_mfpmath_387" + printf "%s\n" "#define SUPPORT_STATIC_PIE 1" >>confdefs.h diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac index 437a50623b..25738e53e9 100644 --- a/sysdeps/x86/configure.ac +++ b/sysdeps/x86/configure.ac @@ -85,5 +85,15 @@ if test $libc_cv_include_x86_isa_level = yes; then fi LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level]) +dnl Determine if compiler supports -mfpmath=387 +AC_CACHE_CHECK([if compiler supports -mpfmath=387], + libc_cv_cc_mfpmath_387, [dnl +LIBC_TRY_CC_OPTION([-Werror -mfpmath=387], + [libc_cv_cc_mfpmath_387="-mfpmath=387"], + [libc_cv_cc_mfpmath_387=]) +]) +LIBC_CONFIG_VAR([config-cflags-mfpath-387], + [$libc_cv_cc_mfpmath_387]) + dnl Static PIE is supported. AC_DEFINE(SUPPORT_STATIC_PIE) diff --git a/sysdeps/x86/fpu/Makefile b/sysdeps/x86/fpu/Makefile index 68bd42cdd3..2d584dbfeb 100644 --- a/sysdeps/x86/fpu/Makefile +++ b/sysdeps/x86/fpu/Makefile @@ -4,7 +4,10 @@ CPPFLAGS += -I../soft-fp libm-support += powl_helper tests += test-fenv-sse test-fenv-clear-sse test-fenv-x87 test-fenv-sse-2 \ - test-flt-eval-method-387 test-flt-eval-method-sse + test-flt-eval-method-sse +ifneq ($(config-cflags-mfpath-387),) +tests += test-flt-eval-method-387 +endif CFLAGS-test-fenv-sse.c += -msse2 -mfpmath=sse CFLAGS-test-fenv-clear-sse.c += -msse2 -mfpmath=sse CFLAGS-test-fenv-sse-2.c += -msse2 -mfpmath=sse