[PATCH, libgcc/libatomic]: Emit SSE instructions when __SSE_MATH__ is defined

Uros Bizjak ubizjak@gmail.com
Mon Dec 9 17:40:00 GMT 2013


Hello!

This is also how glibc generates exceptions.

libgcc/ChangeLog:

2013-12-09  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/sfp-exceptions.c (__sfp_handle_exceptions): Emit SSE
    instructions when __SSE_MATH__ is defined.

libatomic/ChangeLog:

2013-12-09  Uros Bizjak  <ubizjak@gmail.com>

    * config/x86/fenv.c (__atomic_feraiseexcept): Emit SSE
    instructions when __SSE_MATH__ is defined.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Uros.
-------------- next part --------------
Index: libatomic/config/x86/fenv.c
===================================================================
--- libatomic/config/x86/fenv.c	(revision 205798)
+++ libatomic/config/x86/fenv.c	(working copy)
@@ -56,7 +56,7 @@ __atomic_feraiseexcept (int excepts)
   if (excepts & FE_INVALID)
     {
       float f = 0.0f;
-#ifdef __x86_64__
+#ifdef __SSE_MATH__
       volatile float r __attribute__ ((unused));
       asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
       r = f; /* Needed to trigger exception.   */
@@ -76,7 +76,7 @@ __atomic_feraiseexcept (int excepts)
   if (excepts & FE_DIVBYZERO)
     {
       float f = 1.0f, g = 0.0f;
-#ifdef __x86_64__
+#ifdef __SSE_MATH__
       volatile float r __attribute__ ((unused));
       asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
       r = f; /* Needed to trigger exception.   */
@@ -104,7 +104,7 @@ __atomic_feraiseexcept (int excepts)
   if (excepts & FE_INEXACT)
     {
       float f = 1.0f, g = 3.0f;
-#ifdef __x86_64__
+#ifdef __SSE_MATH__
       volatile float r __attribute__ ((unused));
       asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
       r = f; /* Needed to trigger exception.   */
Index: libgcc/config/i386/sfp-exceptions.c
===================================================================
--- libgcc/config/i386/sfp-exceptions.c	(revision 205798)
+++ libgcc/config/i386/sfp-exceptions.c	(working copy)
@@ -47,7 +47,7 @@ __sfp_handle_exceptions (int _fex)
   if (_fex & FP_EX_INVALID)
     {
       float f = 0.0f;
-#ifdef __x86_64__
+#ifdef __SSE_MATH__
       volatile float r __attribute__ ((unused));
       asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
       r = f; /* Needed to trigger exception.   */
@@ -67,7 +67,7 @@ __sfp_handle_exceptions (int _fex)
   if (_fex & FP_EX_DIVZERO)
     {
       float f = 1.0f, g = 0.0f;
-#ifdef __x86_64__
+#ifdef __SSE_MATH__
       volatile float r __attribute__ ((unused));
       asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
       r = f; /* Needed to trigger exception.   */
@@ -95,7 +95,7 @@ __sfp_handle_exceptions (int _fex)
   if (_fex & FP_EX_INEXACT)
     {
       float f = 1.0f, g = 3.0f;
-#ifdef __x86_64__
+#ifdef __SSE_MATH__
       volatile float r __attribute__ ((unused));
       asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
       r = f; /* Needed to trigger exception.   */


More information about the Gcc-patches mailing list