diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-07 19:45:28 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-07 19:45:28 +0000 |
commit | b4ad80db650d96a395f3b3957522824c3bd88cd9 (patch) | |
tree | 237bfbe00dde7132e0b5b649205713d48f4d7b94 /libgcc/config/i386 | |
parent | a009b433fc07ea9f7d5b07fd283fcbe054d5df5f (diff) | |
download | gcc-b4ad80db650d96a395f3b3957522824c3bd88cd9.tar.gz |
* config/i386/sfp-exceptions.c (__sfp_handle_exceptions): Handle
FP_EX_DENORM. Store result to volatile location after SSE division
to close interrupt window. Remove unneeded fwait after x87
division since interrupt window will be closed by emitted fstp.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204540 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc/config/i386')
-rw-r--r-- | libgcc/config/i386/sfp-exceptions.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libgcc/config/i386/sfp-exceptions.c b/libgcc/config/i386/sfp-exceptions.c index fbaaab22f50..6d449ec6093 100644 --- a/libgcc/config/i386/sfp-exceptions.c +++ b/libgcc/config/i386/sfp-exceptions.c @@ -48,20 +48,32 @@ __sfp_handle_exceptions (int _fex) { float f = 0.0f; #ifdef __x86_64__ + volatile float r; 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)); - asm volatile ("fwait"); + /* No need for fwait, exception is triggered by emitted fstp. */ #endif } + if (_fex & FP_EX_DENORM) + { + struct fenv temp; + asm volatile ("fnstenv\t%0" : "=m" (temp)); + temp.__status_word |= FP_EX_DENORM; + asm volatile ("fldenv\t%0" : : "m" (temp)); + asm volatile ("fwait"); + } if (_fex & FP_EX_DIVZERO) { float f = 1.0f, g = 0.0f; #ifdef __x86_64__ + volatile float r; 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)); - asm volatile ("fwait"); + /* No need for fwait, exception is triggered by emitted fstp. */ #endif } if (_fex & FP_EX_OVERFLOW) |