aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2020-04-19 14:23:47 +0200
committerUros Bizjak <ubizjak@gmail.com>2020-04-19 14:27:12 +0200
commitdf73e5842f25aea3bab81c328ed77f16ed261b33 (patch)
tree33968170cbb9e272b180adf1681270cd4e9b15d7
parent9382018b8b00f3482da0d1bff6012f583ff72f87 (diff)
downloadgcc-df73e5842f25aea3bab81c328ed77f16ed261b33.zip
gcc-df73e5842f25aea3bab81c328ed77f16ed261b33.tar.gz
gcc-df73e5842f25aea3bab81c328ed77f16ed261b33.tar.bz2
i386: Remove unneeded assignments when triggering SSE exceptions
According to "Intel 64 and IA32 Arch SDM, Vol. 3: "Because SIMD floating-point exceptions are precise and occur immediately, the situation does not arise where an x87 FPU instruction, a WAIT/FWAIT instruction, or another SSE/SSE2/SSE3 instruction will catch a pending unmasked SIMD floating-point exception." Remove unneeded assignments to volatile memory. libgcc/ChangeLog: * config/i386/sfp-exceptions.c (__sfp_handle_exceptions) [__SSE_MATH__]: Remove unneeded assignments to volatile memory. libatomic/ChangeLog: * config/x86/fenv.c (__atomic_feraiseexcept) [__SSE_MATH__]: Remove unneeded assignments to volatile memory. libgfortran/ChangeLog: * config/fpu-387.h (local_feraiseexcept) [__SSE_MATH__]: Remove unneeded assignments to volatile memory.
-rw-r--r--libatomic/ChangeLog5
-rw-r--r--libatomic/config/x86/fenv.c6
-rw-r--r--libgcc/ChangeLog5
-rw-r--r--libgcc/config/i386/sfp-exceptions.c6
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/config/fpu-387.h6
6 files changed, 15 insertions, 18 deletions
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 624162d..33527a7 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-19 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/x86/fenv.c (__atomic_feraiseexcept) [__SSE_MATH__]:
+ Remove unneeded assignments to volatile memory.
+
2020-04-06 Maciej W. Rozycki <macro@wdc.com>
* configure.ac: Add testsuite/libatomic-site-extra.exp to output
diff --git a/libatomic/config/x86/fenv.c b/libatomic/config/x86/fenv.c
index 7828162..d7b1bbe 100644
--- a/libatomic/config/x86/fenv.c
+++ b/libatomic/config/x86/fenv.c
@@ -57,9 +57,7 @@ __atomic_feraiseexcept (int excepts)
{
float f = 0.0f;
#ifdef __SSE_MATH__
- volatile float r __attribute__ ((unused));
asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
- r = f; /* Needed to trigger exception. */
#else
asm volatile ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f));
/* No need for fwait, exception is triggered by emitted fstp. */
@@ -77,9 +75,7 @@ __atomic_feraiseexcept (int excepts)
{
float f = 1.0f, g = 0.0f;
#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. */
#else
asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */
@@ -105,9 +101,7 @@ __atomic_feraiseexcept (int excepts)
{
float f = 1.0f, g = 3.0f;
#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. */
#else
asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 3426ff8..d66f76f 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-19 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/i386/sfp-exceptions.c (__sfp_handle_exceptions) [__SSE_MATH__]:
+ Remove unneeded assignments to volatile memory.
+
2020-04-15 Jakub Jelinek <jakub@redhat.com>
PR target/93053
diff --git a/libgcc/config/i386/sfp-exceptions.c b/libgcc/config/i386/sfp-exceptions.c
index c994491..31a24ce 100644
--- a/libgcc/config/i386/sfp-exceptions.c
+++ b/libgcc/config/i386/sfp-exceptions.c
@@ -48,9 +48,7 @@ __sfp_handle_exceptions (int _fex)
{
float f = 0.0f;
#ifdef __SSE_MATH__
- volatile float r __attribute__ ((unused));
asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
- r = f; /* Needed to trigger exception. */
#else
asm volatile ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f));
/* No need for fwait, exception is triggered by emitted fstp. */
@@ -68,9 +66,7 @@ __sfp_handle_exceptions (int _fex)
{
float f = 1.0f, g = 0.0f;
#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. */
#else
asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */
@@ -96,9 +92,7 @@ __sfp_handle_exceptions (int _fex)
{
float f = 1.0f, g = 3.0f;
#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. */
#else
asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index e33d349..2ca75f1 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-19 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/fpu-387.h (local_feraiseexcept) [__SSE_MATH__]:
+ Remove unneeded assignments to volatile memory.
+
2020-04-01 Fritz Reese <foreese@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
diff --git a/libgfortran/config/fpu-387.h b/libgfortran/config/fpu-387.h
index 623e878..13be204 100644
--- a/libgfortran/config/fpu-387.h
+++ b/libgfortran/config/fpu-387.h
@@ -103,9 +103,7 @@ local_feraiseexcept (int excepts)
{
float f = 0.0f;
#ifdef __SSE_MATH__
- volatile float r __attribute__ ((unused));
__asm__ __volatile__ ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
- r = f; /* Needed to trigger exception. */
#else
__asm__ __volatile__ ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f));
/* No need for fwait, exception is triggered by emitted fstp. */
@@ -123,9 +121,7 @@ local_feraiseexcept (int excepts)
{
float f = 1.0f, g = 0.0f;
#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. */
#else
__asm__ __volatile__ ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */
@@ -151,9 +147,7 @@ local_feraiseexcept (int excepts)
{
float f = 1.0f, g = 3.0f;
#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. */
#else
__asm__ __volatile__ ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */