This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [3.1.1] Re: GCC performance regression - its memset!
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: Michel LESPINASSE <walken at zoy dot org>, Roger Sayle <roger at eyesopen dot com>, gcc at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org, mark at codesourcery dot org
- Date: Mon, 20 May 2002 18:58:35 +0200
- Subject: Re: [3.1.1] Re: GCC performance regression - its memset!
- References: <Pine.LNX.4.33.0204222307450.2893-100000@www.eyesopen.com> <20020423060709.GA21922@zoy.org> <20020423095145.GD27274@atrey.karlin.mff.cuni.cz> <20020520144839.GY29339@atrey.karlin.mff.cuni.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, May 20, 2002 at 04:48:39PM +0200, Jan Hubicka wrote:
> >
> > Hmm, an pasto.
> > In memcpy case I got it right, while in memset I broke it. I am attaching patch
> > I am testing currently. OK for mainline/branch assuming it passes?
> >
> > COncerning the inlining, gcc inlines all memcpys with size smaller than 64 bytes.
> > Perhaps this should be extended to 128 bytes in case we are still about 2 times as bad.
> > This is partly due to lame implementation of memset in glibc too :(
>
> Mark,
> Would this patch be OK for 3.1.1 branch? It fixes serious misscompilation.
> Not really regression, since extra switch is needed, but that switch seems
> to be popular.
Do you consider -O or -O2 a special switch?
Anyway, could the testcase be commited with the patch too (the bug shows
up in C too BTW)?
--- gcc/testsuite/gcc.c-torture/execute/20020520-1.c.jj Thu Aug 30 22:30:55 2001
+++ gcc/testsuite/gcc.c-torture/execute/20020520-1.c Mon May 20 19:00:41 2002
@@ -0,0 +1,20 @@
+/* PR optimization/6703 */
+extern void abort (void);
+extern void exit (int);
+
+void foo (void **x, int y)
+{
+ __builtin_memset (x, 0, y);
+}
+
+int main ()
+{
+ unsigned char x[8] __attribute__ ((aligned (4)));
+ int i;
+
+ __builtin_memset (x, 0x5a, sizeof (x));
+ foo ((void **) (x + 3), 1);
+ for (i = 0; i < 8; i++)
+ if (x[i] != (i != 3 ? 0x5a : 0))
+ abort ();
+ exit (0);
+}
> >
> >
> > Tue Apr 23 11:48:53 CEST 2002 Jan HUbicka <jh@suse.cz>
> > * i386.c (ix86_expand_clrstr): Fix pasto.
Jakub