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 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
Index: gcc/config/i386/i386.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/gnu/dist/gcc4/gcc/config/i386/i386.c,v
retrieving revision 1.1.1.7
diff -u -p -r1.1.1.7 i386.c
--- gcc/config/i386/i386.c      2 Feb 2008 22:49:14 -0000       1.1.1.7
+++ gcc/config/i386/i386.c      13 Jul 2009 10:13:24 -0000
@@ -12523,7 +12523,7 @@ ix86_expand_strlen (rtx out, rtx src, rt
   /* 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))


Home | Main Index | Thread Index | Old Index