summaryrefslogtreecommitdiff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-06-06 10:11:14 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-06-06 10:11:14 -0700
commita728a38fb658f8b2f0acbea8a586db8bd054f3fe (patch)
tree1ded79da9b33f46cdb0b4b7c32dbf4088b7c52fd /sysdeps/x86_64
parent6e230d11837f3ae7b375ea69d7905f0d18eb79e5 (diff)
downloadglibc-a728a38fb658f8b2f0acbea8a586db8bd054f3fe.tar.gz
Check __SSE_MATH__ in x86_64 feraiseexcept
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/fpu/bits/fenv.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h
index bb790c936a..b2c01c403f 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;
}