about summary refs log tree commit diff
path: root/sysdeps/x86/fpu/test-flt-eval-method-sse.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-11-23 17:56:31 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-11-23 17:56:31 +0000
commit56ede9ed59684a5802cc88733055453901f1c2f0 (patch)
treeed43ab94a24b3bfcd988feea8c031f47d013b27e /sysdeps/x86/fpu/test-flt-eval-method-sse.c
parentc650aa612ff622d843c6b6e5eeb183aae1a17eaa (diff)
downloadglibc-56ede9ed59684a5802cc88733055453901f1c2f0.tar.gz
glibc-56ede9ed59684a5802cc88733055453901f1c2f0.tar.xz
glibc-56ede9ed59684a5802cc88733055453901f1c2f0.zip
Fix x86_64 -mfpmath=387 float_t, double_t (bug 20787).
Bug 20787 reports that, while float_t and double_t for 32-bit x86
properly respect -mfpmath=sse, for x86_64 they fail to reflect
-mfpmath=387, which is valid if unusual and results in FLT_EVAL_METHOD
being 2.  This patch fixes the definitions to respect
__FLT_EVAL_METHOD__ in that case, arranging for the test that the
types correspond with FLT_EVAL_METHOD to be run with both -mfpmath=387
and -mfpmath=sse.

Note: this patch will also have the effect of making float_t and
double_t be long double for x86_64 with -mfpmath=sse+387, when
FLT_EVAL_METHOD is -1.  It seems reasonable for x86_64 to be
consistent with 32-bit x86 in this case (and that definition is
conservatively safe, in that it makes the types correspond to the
widest evaluation format that might be used).

Tested for x86-64 and x86.

	[BZ #20787]
	* sysdeps/x86/bits/mathdef.h (float_t): Do not define to float if
	[__x86_64__] when __FLT_EVAL_METHOD__ is nonzero.
	(double_t): Do not define to double if [__x86_64__] when
	__FLT_EVAL_METHOD__ is nonzero.
	* sysdeps/x86/fpu/test-flt-eval-method-387.c: New file.
	* sysdeps/x86/fpu/test-flt-eval-method-sse.c: Likewise.
	* sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add
	test-flt-eval-method-387 and test-flt-eval-method-sse.
	[$(subdir) = math] (CFLAGS-test-flt-eval-method-387.c): New
	variable.
	[$(subdir) = math] (CFLAGS-test-flt-eval-method-sse.c): Likewise.
Diffstat (limited to 'sysdeps/x86/fpu/test-flt-eval-method-sse.c')
-rw-r--r--sysdeps/x86/fpu/test-flt-eval-method-sse.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/x86/fpu/test-flt-eval-method-sse.c b/sysdeps/x86/fpu/test-flt-eval-method-sse.c
new file mode 100644
index 0000000000..2fb7acfb76
--- /dev/null
+++ b/sysdeps/x86/fpu/test-flt-eval-method-sse.c
@@ -0,0 +1 @@
+#include <test-flt-eval-method.c>