Gcc builtin functions used by glibc not available on mips

Joe Buck jbuck@synopsys.COM
Thu Feb 7 11:59:00 GMT 2002


"H . J . Lu" <hjl@lucon.org> writes:
> 
> > In glibc, there are codes
> > 
> >   /* Partly clean the `bootstrap_map' structure up.  Don't use
> >      `memset' since it might not be built in or inlined and we cannot
> >      make function calls at this point.  Use '__builtin_memset' if we
> >      know it is available.  */
> > #if __GNUC_PREREQ (2, 96) 
> >   __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
> > #else
> >   for (cnt = 0;
> >        cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
> >        ++cnt)
> >     bootstrap_map.l_info[cnt] = 0;
> > #endif

Geoffry Keating writes:
> GCC does not promise that __builtin_memset will be inlined.  Whether
> it calls memset() can depend on details such as which CPU was selected
> to tune for (eg. Pentium III vs. Pentium 4).

Is builtin_memset really enough of a win over the for loop in this context
that it's even worth messing with this stuff?

Why not just get rid of the ifdef and use the else part always?



More information about the Libc-alpha mailing list