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] Add support on powerpc to change CASE_VALUES_THRESHOLD


On Thu, Jun 30, 2011 at 12:31:44PM +0200, Richard Guenther wrote:
> On Thu, Jun 30, 2011 at 12:34 AM, Michael Meissner
> <meissner@linux.vnet.ibm.com> wrote:
> > On the powerpc, switch statements can be expensive, and we would like to be
> > able to tune the threshold of when the compiler generates if statements
> > vs. using a table jump operation (and different processors within the powerpc
> > have different limits). ?This patch adds a powerpc tuning option to control
> > this.
> >
> > I've done bootstraps and make checks with no regressions. ?Is this ok to apply
> > to the trunk? ?At this time, I am not changing the default value (4). ?With the
> > option, I've seen a few spec 2006 benchmarks run faster, and a few run slower.
> 
> Hmm.  This hook looks like it could be turned into a --param.  In fact
> it doesn't get whatever context information, so I wonder if any target
> does something fancy.

I've done it also as a --param.  I tend to think it is better as a param, and
then other people can tune their code.  One slight problem is the default for
CASE_VALUES_THRESHOLD depends on whether you have a named casesi pattern that
is active (HAVE_casesi ? 4 : 5).  Either we need two separate parameters, or we
have just one parameter, and if that is 0, fall back to the 4 or 5 value.

This patch swtiches to use --param to set the value.  Is it acceptable to check
in?  I've done a bootstrap and I'm about to do a make check.

[gcc]
2011-06-30  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* params.def (PARAM_CASE_VALUES_THRESHOLD): New parameter to
	override CASE_VALUES_THRESHOLD.

	* stmt.c (toplevel): Include params.h.
	(case_values_threshold): Use the --param case-values-threshold
	value if non-zero, otherwise use machine dependent value.
	(expand_case): Use case_values_threshold.

	* Makefile.in (stmt.o): Add $(PARAMS_H) dependency.

	* doc/invoke.texi (--param case-values-threshold): Document.

[gcc/testsuite]
2011-06-30  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* gcc.target/powerpc/ppc-switch-1.c: New test for
	-mcase-values-threshold.
	* gcc.target/powerpc/ppc-switch-2.c: Ditto.

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meissner@linux.vnet.ibm.com	fax +1 (978) 399-6899

Attachment: gcc-power7.patch249b
Description: Text document


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