This is the mail archive of the gcc-patches@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: [PATCH] fix ix86 prefetch support with -Os


On Tue, Jan 22, 2002 at 02:23:31PM -0800, Richard Henderson wrote:
> On Tue, Jan 22, 2002 at 02:21:21PM -0800, Janis Johnson wrote:
> > 	* toplev.c (process_options): Disable -fprefetch-loop-arrays with
> > 	-Os and issue a warning.
> > 
> > 	* gcc.dg/20020122-3.c: New test.
> 
> Ok.
> 
> 
> r~

I've been having a lot of trouble lately with IBM mail servers delaying
or eating my outbound mail.  The patch that Richard approved made it to
him directly but hasn't yet reached the list.  Here it is; it's now been
bootstrapped and tested on i686-pc-linux-gnu and I'll be checking it in
shortly.


Here's another approach to keeping gcc from aborting for the use of -Os
with -fprefetch-loop-arrays.  It's been built and minimally tested; I'll
do a full bootstrap and test run if you agree that this approach is
valid.

2002-01-22  Janis Johnson  <janis187@us.ibm.com>

	* toplev.c (process_options): Disable -fprefetch-loop-arrays with
	-Os and issue a warning.

testsuite:

	* gcc.dg/20020122-3.c: New test.

Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.571
diff -u -p -r1.571 toplev.c
--- toplev.c	2002/01/14 19:21:21	1.571
+++ toplev.c	2002/01/22 22:10:48
@@ -4988,6 +4988,14 @@ process_options ()
     }
 #endif
 
+  /* This combination of options isn't handled for i386 targets and doesn't
+     make much sense anyway, so don't allow it.  */
+  if (flag_prefetch_loop_arrays && optimize_size)
+    {
+      warning ("-fprefetch-loop-arrays is not supported with -Os");
+      flag_prefetch_loop_arrays = 0;
+    }
+
 #ifndef OBJECT_FORMAT_ELF
   if (flag_function_sections && write_symbols != NO_DEBUG)
     warning ("-ffunction-sections may affect debugging on some targets");
--- /dev/null	Tue May 23 09:27:54 2000
+++ gcc.dg/200201xx-2.c	Tue Jan 22 14:11:26 2002
@@ -0,0 +1,15 @@
+/* Check that the combination of -Os and -fprefetch-loop-arrays does not
+   cause the compiler to crash, which it originally did on i?86.
+   Warnings are turned off because not all targets support prefetch.  */
+
+/* { dg-do compile } */
+/* { dg-options "-Os -fprefetch-loop-arrays -w" } */
+/* { dg-options "-Os -fprefetch-loop-arrays -mcpu=pentium3 -w" { target i?86-*-* } } */
+
+int foo (int *p, int n)
+{
+  int i, r;
+  for (i = 0; i < n; i++)
+    r += p[i];
+  return r;
+}


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