tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Disabling gcc's __builtin_foo() functions



On Mon, Jul 13, 2009 at 12:31:25PM +0200, Joerg Sonnenberger wrote:
> On Mon, Jul 13, 2009 at 07:51:53AM +0100, David Laight wrote:
> > For non-freestanding builds (aka userspace) gcc will automatically
> > convert calls to some string functions into __builtin_foo() forms
> > which it then inlines (certainly on i386 and amd64).
> 
> The attached patch prevents the unrolling on AMD64. It will still
> replace constant arguments.
> 
> Joerg

>    /* The generic case of strlen expander is long.  Avoid it's
>       expanding unless TARGET_INLINE_ALL_STRINGOPS.  */
>  
> -  if (TARGET_UNROLL_STRLEN && eoschar == const0_rtx && optimize > 1
> +  if ((TARGET_UNROLL_STRLEN || TARGET_64BIT) && eoschar == const0_rtx && 
> optimize > 1
>        && !TARGET_INLINE_ALL_STRINGOPS
>        && !optimize_size
>        && (GET_CODE (align) != CONST_INT || INTVAL (align) < 4))

I'm not sure that is correct.
The default netbsd build use 'rep scasb' on amd64, but call strlen() on i386.
Also half that test is repeated a few lines lower down.

Not to mention a more gross expansion that gets used soemtimes!

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index