Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-04-02 Thread Denis Vlasenko
On Saturday 02 April 2005 15:18, Denis Vlasenko wrote: > -O2 compile does inline copying, however, suboptimally. > Pushing/popping esi/edi on the stack is not needed. > Also "mov $1,ecx; rep; movsl" is rather silly. I think I am wrong about push/pop. Sorry. However, other observation is still val

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-04-02 Thread Denis Vlasenko
> > childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) > > p->thread_info)) - 1; > > *childregs = *regs; > > ^^^ > > childregs->eax = 0; > > childregs->esp = esp; > > > > # make arch/i386/kernel/process.s > > > > copy_thread: >

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-04-01 Thread Jan Hubicka
> On Wednesday 30 March 2005 05:27, Gerold Jury wrote: > > > > >> On Tue, Mar 29, 2005 at 05:37:06PM +0300, Denis Vlasenko wrote: > > >> > /* > > >> > * This looks horribly ugly, but the compiler can optimize it totally, > > >> > * as the count is constant. > > >> > */ > > >> > static inline vo

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-03-29 Thread Denis Vlasenko
On Wednesday 30 March 2005 05:27, Gerold Jury wrote: > > >> On Tue, Mar 29, 2005 at 05:37:06PM +0300, Denis Vlasenko wrote: > >> > /* > >> > * This looks horribly ugly, but the compiler can optimize it totally, > >> > * as the count is constant. > >> > */ > >> > static inline void * __constant_

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-03-29 Thread Andrew Pinski
> > On Tue, Mar 29, 2005 at 05:37:06PM +0300, Denis Vlasenko wrote: > > /* > > * This looks horribly ugly, but the compiler can optimize it totally, > > * as the count is constant. > > */ > > static inline void * __constant_memcpy(void * to, const void * from, size_t > > n) > > { > > i

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-03-29 Thread Jakub Jelinek
On Tue, Mar 29, 2005 at 05:37:06PM +0300, Denis Vlasenko wrote: > typedef unsigned int size_t; > > static inline void * __memcpy(void * to, const void * from, size_t n) > { > int d0, d1, d2; > __asm__ __volatile__( > "rep ; movsl\n\t" > "testb $2,%b4\n\t" > "je 1f\n\t" >

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-03-29 Thread Nathan Sidwell
Denis Vlasenko wrote: Disassembly of section .text: e: e8 fc ff ff ff call f f: R_386_PC32 memcpy #define memcpy(t, f, n) \ (__builtin_constant_p(n) ? \ __constant_memcpy((t),(f),(n)) : \ __memcpy((t),(f),(n))) given this #define, how can 'memcpy' appe

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-03-29 Thread Richard Guenther
On Tue, 29 Mar 2005 17:37:06 +0300, Denis Vlasenko <[EMAIL PROTECTED]> wrote: > Try testcase below the sig. > > This causes nearly one thousand calls to memcpy in my kernel > (not an allyesconfig one): > static inline void * __memcpy(void * to, const void * from, size_t n) > { > int d0, d1, d2; >

memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-03-29 Thread Denis Vlasenko
Try testcase below the sig. This causes nearly one thousand calls to memcpy in my kernel (not an allyesconfig one): # objdump -d vmlinux | grep -F '' | wc -l 959 # gcc -O2 -c t.c # objdump -r -d t.o t.o: file format elf32-i386 Disassembly of section .text: : 0: 55