Hello!

Attached patch avoids triggering denormal exceptions when FP insns are
used to check for non-zero denormal values.

2014-09-23  Uros Bizjak  <ubiz...@gmail.com>

    PR target/58757
    * gcc.dg/c11-true_min-1.c (checkz): Add.
    (main): Call checkz to check value for zero.

Patch was tested on x86_64 {,-m32} and alphaev68-linux-gnu.

OK for mainline?

Uros.
Index: gcc.dg/c11-true_min-1.c
===================================================================
--- gcc.dg/c11-true_min-1.c     (revision 215476)
+++ gcc.dg/c11-true_min-1.c     (working copy)
@@ -7,11 +7,25 @@
 
 #include <float.h>
 
-int main(){
+int
+__attribute__((noinline, noclone))
+checkz (const char *ptr, int n)
+{
+  for ( ; n > 0; --n)
+    if (*(ptr++) != 0)
+      return 0;
+  return 1;
+}
+
+int main ()
+{
   volatile float f = FLT_TRUE_MIN;
   volatile double d = DBL_TRUE_MIN;
   volatile long double l = LDBL_TRUE_MIN;
-  if (f == 0 || d == 0 || l == 0)
+
+  if (checkz ((const char *) &f, sizeof(f))
+    || checkz ((const char *) &d, sizeof(d))
+    || checkz ((const char *) &l, sizeof (l)))
     __builtin_abort ();
   return 0;
 }

Reply via email to