This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: builtin standard functions


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]