This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 01/10] Check __SSE_MATH__ in feraiseexcept
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 4 Jun 2012 06:59:31 -0700
- Subject: [PATCH 01/10] Check __SSE_MATH__ in feraiseexcept
Hi,
I am resubmitting the remaining 10 patches for
http://sourceware.org/bugzilla/show_bug.cgi?id=14117
This patch checks __SSE_MATH__ in x86_64 feraiseexcept. OK to install?
Thanks.
H.J.
---
[BZ #14117]
* sysdeps/x86_64/fpu/bits/fenv.h (feraiseexcept): Check
__SSE_MATH__.
diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h
index bb790c9..b2c01c4 100644
--- a/sysdeps/x86_64/fpu/bits/fenv.h
+++ b/sysdeps/x86_64/fpu/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2001,2004,2011,2012 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -109,7 +109,12 @@ __NTH (feraiseexcept (int __excepts))
/* One example of a invalid operation is 0.0 / 0.0. */
float __f = 0.0;
+# ifdef __SSE_MATH__
__asm__ __volatile__ ("divss %0, %0 " : : "x" (__f));
+# else
+ __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait"
+ : "=t" (__f) : "0" (__f));
+# endif
(void) &__f;
}
if ((FE_DIVBYZERO & __excepts) != 0)
@@ -117,7 +122,12 @@ __NTH (feraiseexcept (int __excepts))
float __f = 1.0;
float __g = 0.0;
+# ifdef __SSE_MATH__
__asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+# else
+ __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait"
+ : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+# endif
(void) &__f;
}
--
1.7.6.5