+2020-05-01 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/x86/fenv.c (__math_force_eval): New define.
+ (__atomic_feraiseexcept): Use __math_force_eval to evaluete
+ generic division to generate INVALID and DIVZERO exceptions.
+
2020-04-19 Uroš Bizjak <ubizjak@gmail.com>
* config/x86/fenv.c (__atomic_feraiseexcept) [__SSE_MATH__]:
unsigned short int __unused5;
};
+#ifdef __SSE_MATH__
+# define __math_force_eval(x) asm volatile ("" : : "x" (x));
+#else
+# define __math_force_eval(x) asm volatile ("" : : "f" (x));
+#endif
+
/* Raise the supported floating-point exceptions from EXCEPTS. Other
bits in EXCEPTS are ignored. */
if (excepts & FE_INVALID)
{
float f = 0.0f;
-#ifdef __SSE_MATH__
- asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
-#else
- asm volatile ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f));
- /* No need for fwait, exception is triggered by emitted fstp. */
-#endif
+ __math_force_eval (f / f);
}
if (excepts & FE_DENORM)
{
if (excepts & FE_DIVBYZERO)
{
float f = 1.0f, g = 0.0f;
-#ifdef __SSE_MATH__
- asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
-#else
- asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
- /* No need for fwait, exception is triggered by emitted fstp. */
-#endif
+ __math_force_eval (f / g);
}
if (excepts & FE_OVERFLOW)
{
+2020-05-01 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/i386/sfp-exceptions.c (__math_force_eval): New define.
+ (__sfp_handle_exceptions): Use __math_force_eval to evaluete
+ generic division to generate INVALID and DIVZERO exceptions.
+
2020-04-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
* config/rs6000/crtresfpr.S: Use .machine ppc.
unsigned short int __unused5;
};
+#ifdef __SSE_MATH__
+# define __math_force_eval(x) asm volatile ("" : : "x" (x));
+#else
+# define __math_force_eval(x) asm volatile ("" : : "f" (x));
+#endif
+
void
__sfp_handle_exceptions (int _fex)
{
if (_fex & FP_EX_INVALID)
{
float f = 0.0f;
-#ifdef __SSE_MATH__
- asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
-#else
- asm volatile ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f));
- /* No need for fwait, exception is triggered by emitted fstp. */
-#endif
+ __math_force_eval (f / f);
}
if (_fex & FP_EX_DENORM)
{
if (_fex & FP_EX_DIVZERO)
{
float f = 1.0f, g = 0.0f;
-#ifdef __SSE_MATH__
- asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
-#else
- asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
- /* No need for fwait, exception is triggered by emitted fstp. */
-#endif
+ __math_force_eval (f / g);
}
if (_fex & FP_EX_OVERFLOW)
{
+2020-05-01 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/fpu-387.h (__math_force_eval): New define.
+ (local_feraiseexcept): Use __math_force_eval to evaluete
+ generic division to generate INVALID and DIVZERO exceptions.
+
2020-04-22 Fritz Reese <foreese@gcc.gnu.org>
* intrinsics/trigd.c, intrinsics/trigd_lib.inc, intrinsics/trigd.inc:
_Static_assert (sizeof(my_fenv_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE,
"GFC_FPE_STATE_BUFFER_SIZE is too small");
+#ifdef __SSE_MATH__
+# define __math_force_eval(x) __asm__ __volatile__ ("" : : "x" (x));
+#else
+# define __math_force_eval(x) __asm__ __volatile__ ("" : : "f" (x));
+#endif
/* Raise the supported floating-point exceptions from EXCEPTS. Other
bits in EXCEPTS are ignored. Code originally borrowed from
if (excepts & _FPU_MASK_IM)
{
float f = 0.0f;
-#ifdef __SSE_MATH__
- __asm__ __volatile__ ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
-#else
- __asm__ __volatile__ ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f));
- /* No need for fwait, exception is triggered by emitted fstp. */
-#endif
+ __math_force_eval (f / f);
}
if (excepts & _FPU_MASK_DM)
{
if (excepts & _FPU_MASK_ZM)
{
float f = 1.0f, g = 0.0f;
-#ifdef __SSE_MATH__
- __asm__ __volatile__ ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
-#else
- __asm__ __volatile__ ("fdivs\t%1" : "+t" (f) : "m" (g));
- /* No need for fwait, exception is triggered by emitted fstp. */
-#endif
+ __math_force_eval (f / g);
}
if (excepts & _FPU_MASK_OM)
{