------- Comment #19 from ubizjak at gmail dot com  2008-02-08 14:21 -------
The core of the problem is, that for profiled bootstrap, the call to
normalize() from do_multiply() is simply gone. Gone in the sense, that
normalize() is neither inlined at the call site, neither is called in
do_multiply(). This leads to various observed strange effects when real numbers
are processed.

          for (k = j; k < SIGSZ * 2; k += 2)
            {
              unsigned long bi = b->sig[k / 2];
              if (k & 1)
                bi >>= HOST_BITS_PER_LONG / 2;
              else
                bi &= ((unsigned long)1 << (HOST_BITS_PER_LONG / 2)) - 1;

              u.sig[k / 2] = ai * bi;
            }

>>>>>     normalize (&u);
          inexact |= do_add (rr, rr, &u, 0);
        }
    }

Adding __attirbute__((noinline)) to protptype of normalize() is enough to fix
profiled bootstrap:

Index: real.c
===================================================================
--- real.c      (revision 132182)
+++ real.c      (working copy)
@@ -98,7 +98,7 @@
 static void clear_significand_below (REAL_VALUE_TYPE *, unsigned int);
 static bool div_significands (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *,
                              const REAL_VALUE_TYPE *);
-static void normalize (REAL_VALUE_TYPE *);
+static void normalize (REAL_VALUE_TYPE *) __attribute__((noinline));

 static bool do_add (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *,
                    const REAL_VALUE_TYPE *, int);


So, what upsets gcc's inliner/profiler/whatever to drop the call?


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33992

Reply via email to