[PATCH] Enabling Software Prefetching by Default at -O3

Christian Borntraeger borntraeger@de.ibm.com
Wed Jun 23 12:30:00 GMT 2010


Am Mittwoch 23 Juni 2010, 10:50:35 schrieb Richard Guenther:
> > > What I want is something like:
> > >  if  (!OPTION_SET_P (flag_prefetch_loop_arrays))
> > >    flag_prefetch_loop_arrays = 1;
> > 
> > I think having an OPTION_SET_P  (or maybe name that FLAG_SET_P) makes a lot of sense and
> > would match the PARAM_SET_P way of doing things.
> 
> We use tri-states for this elsewhere in the compiler.

So something like the following unfinished patch 
would be the (current) way to go?

Christian

Index: gcc/common.opt
===================================================================
*** gcc/common.opt.orig
--- gcc/common.opt
*************** Common Report Var(flag_predictive_common
*** 945,951 ****
  Run predictive commoning optimization.
  
  fprefetch-loop-arrays
! Common Report Var(flag_prefetch_loop_arrays) Optimization
  Generate prefetch instructions, if available, for arrays in loops
  
  fprofile
--- 945,951 ----
  Run predictive commoning optimization.
  
  fprefetch-loop-arrays
! Common Report Var(flag_prefetch_loop_arrays) Init(2) Optimization
  Generate prefetch instructions, if available, for arrays in loops
  
  fprofile
Index: gcc/config/s390/s390.c
===================================================================
*** gcc/config/s390/s390.c.orig
--- gcc/config/s390/s390.c
*************** override_options (void)
*** 1676,1682 ****
  
    /* This cannot reside in optimization_options since HAVE_prefetch
       requires the arch flags to be evaluated already.  */
!   if (HAVE_prefetch && optimize >= 3)
      flag_prefetch_loop_arrays = 1;
  }
  
--- 1676,1682 ----
  
    /* This cannot reside in optimization_options since HAVE_prefetch
       requires the arch flags to be evaluated already.  */
!   if (HAVE_prefetch && optimize >= 3 && flag_prefetch_loop_arrays == 2)
      flag_prefetch_loop_arrays = 1;
  }
  
Index: gcc/toplev.c
===================================================================
*** gcc/toplev.c.orig
--- gcc/toplev.c
*************** process_options (void)
*** 2048,2053 ****
--- 2048,2056 ----
      }
  
  #ifndef HAVE_prefetch
+   if (flag_prefetch_loop_arrays == 2)
+     flag_prefetch_loop_arrays = 0;
+ 
    if (flag_prefetch_loop_arrays)
      {
        warning (0, "-fprefetch-loop-arrays not supported for this target");



More information about the Gcc-patches mailing list