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 for automatic parallelization


On Jan 17, 2008 4:12 AM, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> But, you missed one failing test-case, which I suggest you
> modify as I suggested; it was c++.  Please visit PR
> testsuite/34821 (relabelled), assigned to you.
>

Yes, sorry for this omission, I was thinking that the autopar
testcases were only in the gcc.dg/tree-ssa/ dir, so I moved only
those testcases that showed up in a grep for autopar flag.
I have fixed the c++ testcase in the attached patch.

> > Okay for trunk?
>
> You can't ask me for approval, but it looks obvious to me,
> except you should decorate the ChangeLog entry with the PR.
>

The question was addressed to someone who could approve
the patch, probably I should have CC-ed a maintainer of the
testsuite in my previous message.  Janis, is the attached
patch ok for trunk?  The patch was tested on i686-linux with:
make -k check RUNTESTFLAGS=tree-ssa.exp
make -k check RUNTESTFLAGS=autopar.exp

Thank you,
Sebastian
--
AMD - GNU Tools
	PR testsuite/34821

	* doc/invoke.texi: Document the dependence on pthread for fopenmp
	and ftree-parallelize-loops.

	* gcc.dg/autopar/autopar.exp: New.
	* g++.dg/tree-ssa/pr34355.C: Require pthread.
	* lib/target-supports.exp (check_effective_target_pthread): New.

	* gcc.dg/tree-ssa/parallelization-1.c: Moved to gcc.dg/autopar.
	* gcc.dg/tree-ssa/reduc-1short.c: Same.
	* gcc.dg/tree-ssa/reduc-1.c: Same.
	* gcc.dg/tree-ssa/reduc-2short.c: Same.
	* gcc.dg/tree-ssa/reduc-2.c: Same
	* gcc.dg/tree-ssa/reduc-3.c: Same.
	* gcc.dg/tree-ssa/reduc-1char.c: Same.
	* gcc.dg/tree-ssa/reduc-6.c: Same.
	* gcc.dg/tree-ssa/reduc-7.c: Same.
	* gcc.dg/tree-ssa/reduc-2char.c: Same.
	* gcc.dg/tree-ssa/reduc-8.c: Same.
	* gcc.dg/tree-ssa/reduc-9.c: Same.

Index: invoke.texi
===================================================================
--- invoke.texi	(revision 131577)
+++ invoke.texi	(working copy)
@@ -1519,7 +1519,9 @@ freestanding and hosted environments.
 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
 compiler generates parallel code according to the OpenMP Application
-Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
+Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.  This option
+implies @option{-pthread}, and thus is only supported on targets that
+have support for @option{-pthread}.
 
 @item -fms-extensions
 @opindex fms-extensions
@@ -5841,7 +5843,9 @@ Parallelize loops, i.e., split their ite
 This is only possible for loops whose iterations are independent
 and can be arbitrarily reordered.  The optimization is only
 profitable on multiprocessor machines, for loops that are CPU-intensive,
-rather than constrained e.g. by memory bandwidth.
+rather than constrained e.g. by memory bandwidth.  This option
+implies @option{-pthread}, and thus is only supported on targets
+that have support for @option{-pthread}.
 
 @item -ftree-sra
 @opindex ftree-sra
Index: gcc.dg/autopar/autopar.exp
===================================================================
--- gcc.dg/autopar/autopar.exp	(revision 0)
+++ gcc.dg/autopar/autopar.exp	(revision 0)
@@ -0,0 +1,40 @@
+#   Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+if ![check_effective_target_pthread] {
+  return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+	"" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
Index: g++.dg/tree-ssa/pr34355.C
===================================================================
--- g++.dg/tree-ssa/pr34355.C	(revision 131577)
+++ g++.dg/tree-ssa/pr34355.C	(working copy)
@@ -1,3 +1,4 @@
+// { dg-require-effective-target pthread } 
 // { dg-do compile }
 // { dg-options "-O3 -ftree-parallelize-loops=4" }
 
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 131577)
+++ lib/target-supports.exp	(working copy)
@@ -509,6 +509,15 @@ proc check_effective_target_fopenmp {} {
     } "-fopenmp"]
 }
 
+# Return 1 if compilation with -pthread is error-free for trivial
+# code, 0 otherwise.
+
+proc check_effective_target_pthread {} {
+    return [check_no_compiler_messages pthread object {
+	void foo (void) { }
+    } "-pthread"]
+}
+
 # Return 1 if the target supports -fstack-protector
 proc check_effective_target_fstack_protector {} {
     return [check_runtime fstack_protector {

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