This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: builtin standard functions
- To: egcs at egcs dot cygnus dot com
- Subject: Re: builtin standard functions
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sat, 29 May 1999 13:01:07 +0200
> I guess that is the reason why Linux has its own variants. The inline
> asm functions in asm/string.h use rep mov.. even for non constant sizes.
> Can it be fixed?
I'm not sure it is buggy. For non-constant size, what is the advantage
of the inline version over the function call? The implementation of
memcpy would, of course, use the x86 string operations. This trades a
slight overhead for the function call with a measurable reduction in
code size.
In Linux, you can do one without ignoring the other. This whole
discussion started because Linux' __constant_memcpy is not ANSI C.
Looking at 2.2.6, you can easily define
#define memcpy(t, f, n) \
(__builtin_constant_p(n) ? \
__builtin_memcpy((t),(f),(n)) : \
__memcpy((t),(f),(n)))
If *that* ends up calling memcpy in a specific case, then something
needs to be fixed.
Regards,
Martin