[Bug gcov-profile/55734] [4.8 Regression] gcov-io.c uses builtins not available in non-GCC compilers

tejohnson at google dot com gcc-bugzilla@gcc.gnu.org
Wed Dec 19 17:35:00 GMT 2012


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

--- Comment #21 from Teresa Johnson <tejohnson at google dot com> 2012-12-19 17:35:08 UTC ---
On Wed, Dec 19, 2012 at 8:48 AM, jakub at gcc dot gnu.org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55734
>
> --- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-19 16:48:00 UTC ---
> Perhaps
>   if (v > 0)
>     {
> #if IN_LIBGCOV
>       r = 63 - __builtin_clzll (v);
> #else
>       if (sizeof (v) <= sizeof (HOST_WIDE_INT))
>         r = floor_log2 (v);
>       else if (sizeof (v) == 2 * sizeof (HOST_WIDE_INT))
>         {
>           r = v >> HOST_BITS_PER_WIDE_INT;
>           if (r)
>             r = floor_log2 (r) + HOST_BITS_PER_WIDE_INT;
>           else
>             r = floor_log2 (v);
>         }
>       else
>         gcc_unreachable ();
> #endif
>     }

Also, I have changed the runtime size checks into preprocessor checks,
both to increase the speed and also to avoid compile-time errors about
shifting by the size of the variable (on v >> HOST_BITS_PER_WIDE_INT).

Thanks,
Teresa

>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.



--
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413



More information about the Gcc-bugs mailing list