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]
Other format: [Raw text]

Re: [3.1.1] Re: GCC performance regression - its memset!


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


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