public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, driver] Ignore -ftree-parallelize-loops={0,1}
@ 2015-07-07  7:54 Tom de Vries
  2015-07-13 10:58 ` Tom de Vries
  0 siblings, 1 reply; 9+ messages in thread
From: Tom de Vries @ 2015-07-07  7:54 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]

Hi,

currently, we have these spec strings in gcc/gcc.c involving 
ftree-parallelize-loops:
...
%{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
%{fopenacc|fopenmp|ftree-parallelize-loops=*:-pthread}"
...

Actually, ftree-parallelize-loops={0,1} means that no parallelization is 
done, but these spec strings still get activated for these values.


Attached patch fixes that, by introducing a spec function gt (short for 
greather than), and using it in the spec lines.

[ I've also tried this approach using the already existing spec function 
version-compare:
...
%{fopenacc|fopenmp:%:include(libgomp.spec)%(link_gomp)}
%:version-compare(>=  2 ftree-parallelize-loops=
                   %:include(libgomp.spec)%(link_gomp))
...
But that didn't work out. The function evaluation mechanism evaluates 
the arguments before testing the function, so we evaluate 
'%:include(libgomp.spec)' unconditionally. The gcc build breaks on the 
first xgcc invocation with linking due to a missing libgomp.spec. ]


Bootstrapped and reg-tested on x86_64.

OK for trunk?

Thanks,
- Tom

[-- Attachment #2: 0001-Ignore-ftree-parallelize-loops-0-1-using-gt.patch --]
[-- Type: text/x-patch, Size: 3141 bytes --]

Ignore -ftree-parallelize-loops={0,1} using gt

---
 gcc/gcc.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 0f29b78..34fb437 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -274,6 +274,7 @@ static const char *compare_debug_self_opt_spec_function (int, const char **);
 static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
 static const char *pass_through_libs_spec_func (int, const char **);
 static const char *replace_extension_spec_func (int, const char **);
+static const char *greater_than_spec_func (int, const char **);
 static char *convert_white_space (char *);
 \f
 /* The Specs Language
@@ -881,7 +882,7 @@ proper position among the other output files.  */
     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
     %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
     " CHKP_SPEC " \
-    %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1):%:include(libgomp.spec)%(link_gomp)} \
     %{fcilkplus:%:include(libcilkrts.spec)%(link_cilkrts)}\
     %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
     %(mflib) " STACK_SPLIT_SPEC "\
@@ -1042,7 +1043,8 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
 /* Linking to libgomp implies pthreads.  This is particularly important
    for targets that use different start files and suchlike.  */
 #ifndef GOMP_SELF_SPECS
-#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
+#define GOMP_SELF_SPECS \
+  "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1): " \
   "-pthread}"
 #endif
 
@@ -1482,6 +1484,7 @@ static const struct spec_function static_spec_functions[] =
   { "compare-debug-auxbase-opt", compare_debug_auxbase_opt_spec_function },
   { "pass-through-libs",	pass_through_libs_spec_func },
   { "replace-extension",	replace_extension_spec_func },
+  { "gt",			greater_than_spec_func },
 #ifdef EXTRA_SPEC_FUNCTIONS
   EXTRA_SPEC_FUNCTIONS
 #endif
@@ -9428,6 +9431,47 @@ replace_extension_spec_func (int argc, const char **argv)
   return result;
 }
 
+/* Returns "" if the n in ARGV[1] == -opt=<n> is greater than ARGV[2].
+   Otherwise, return NULL.  */
+
+static const char *
+greater_than_spec_func (int argc, const char **argv)
+{
+  char *converted;
+
+  if (argc == 1)
+    return NULL;
+
+  gcc_assert (argc == 3);
+  gcc_assert (argv[0][0] == '-');
+  gcc_assert (argv[0][1] == '\0');
+
+  /* Point p to <n> in in -opt=<n>.  */
+  const char *p = argv[1];
+  while (true)
+    {
+      char c = *p;
+      if (c == '\0')
+	gcc_unreachable ();
+
+      ++p;
+
+      if (c == '=')
+	break;
+    }
+
+  long arg = strtol (p, &converted, 10);
+  gcc_assert (converted != p);
+
+  long lim = strtol (argv[2], &converted, 10);
+  gcc_assert (converted != argv[2]);
+
+  if (arg > lim)
+    return "";
+
+  return NULL;
+}
+
 /* Insert backslash before spaces in ORIG (usually a file path), to 
    avoid being broken by spec parser.
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2015-07-07  7:54 [patch, driver] Ignore -ftree-parallelize-loops={0,1} Tom de Vries
@ 2015-07-13 10:58 ` Tom de Vries
  2015-07-14  4:55   ` Jeff Law
  0 siblings, 1 reply; 9+ messages in thread
From: Tom de Vries @ 2015-07-13 10:58 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

On 07/07/15 09:53, Tom de Vries wrote:
> Hi,
>
> currently, we have these spec strings in gcc/gcc.c involving
> ftree-parallelize-loops:
> ...
> %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
>
> %{fopenacc|fopenmp|ftree-parallelize-loops=*:-pthread}"
> ...
>
> Actually, ftree-parallelize-loops={0,1} means that no parallelization is
> done, but these spec strings still get activated for these values.
>
>
> Attached patch fixes that, by introducing a spec function gt (short for
> greather than), and using it in the spec lines.
>

Attached (untested) patch manages the same, without introducing the spec 
function 'gt'. But the solution is a bit convoluted, so I prefer the one 
with the gt function.

Thanks,
- Tom


[-- Attachment #2: 0001-Ignore-ftree-parallelize-loops-0-1.patch --]
[-- Type: text/x-patch, Size: 2375 bytes --]

Ignore -ftree-parallelize-loops={0,1}

2015-07-13  Tom de Vries  <tom@codesourcery.com>

	* gcc.c (LINK_COMMAND_SPEC_GOMP_STRING, GOMP_SELF_SPEC_STRING): Define.
	(LINK_COMMAND_SPEC_GOMP_STRING, GOMP_SELF_SPECS): Ignore
	ftree-parallelize-loops={0,1}.
---
 gcc/gcc.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 858ff37..c5694c7 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -860,6 +860,8 @@ proper position among the other output files.  */
 #define CHKP_SPEC ""
 #endif
 
+#define LINK_COMMAND_SPEC_GOMP_STRING "%:include(libgomp.spec)%(link_gomp)"
+
 /* -u* was put back because both BSD and SysV seem to support it.  */
 /* %{static:} simply prevents an error message if the target machine
    doesn't handle -static.  */
@@ -881,7 +883,12 @@ proper position among the other output files.  */
     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
     %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
     " CHKP_SPEC " \
-    %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+    %{!ftree-parallelize-loops=0:%{!ftree-parallelize-loops=1:\
+      %{fopenacc|fopenmp|ftree-parallelize-loops=*:" \
+	LINK_COMMAND_SPEC_GOMP_STRING "}}}\
+    %{ftree-parallelize-loops=0|ftree-parallelize-loops=1: \
+      %{fopenacc|fopenmp:" \
+	LINK_COMMAND_SPEC_GOMP_STRING "}} \
     %{fcilkplus:%:include(libcilkrts.spec)%(link_cilkrts)}\
     %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
     %(mflib) " STACK_SPLIT_SPEC "\
@@ -1039,11 +1046,18 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
 #define DRIVER_SELF_SPECS ""
 #endif
 
+#define GOMP_SELF_SPEC_STRING "-pthread"
+
 /* Linking to libgomp implies pthreads.  This is particularly important
    for targets that use different start files and suchlike.  */
 #ifndef GOMP_SELF_SPECS
-#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
-  "-pthread}"
+#define GOMP_SELF_SPECS \
+  "%{!ftree-parallelize-loops=0:%{!ftree-parallelize-loops=1:\
+     %{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
+       GOMP_SELF_SPEC_STRING "}}}\
+   %{ftree-parallelize-loops=0|ftree-parallelize-loops=1:\
+     %{fopenacc|fopenmp: " \
+       GOMP_SELF_SPEC_STRING "}}"
 #endif
 
 /* Likewise for -fgnu-tm.  */
-- 
1.9.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2015-07-13 10:58 ` Tom de Vries
@ 2015-07-14  4:55   ` Jeff Law
  2015-07-14  8:36     ` Tom de Vries
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Law @ 2015-07-14  4:55 UTC (permalink / raw)
  To: Tom de Vries, gcc-patches

On 07/13/2015 04:58 AM, Tom de Vries wrote:
> On 07/07/15 09:53, Tom de Vries wrote:
>> Hi,
>>
>> currently, we have these spec strings in gcc/gcc.c involving
>> ftree-parallelize-loops:
>> ...
>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
>>
>>
>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:-pthread}"
>> ...
>>
>> Actually, ftree-parallelize-loops={0,1} means that no parallelization is
>> done, but these spec strings still get activated for these values.
>>
>>
>> Attached patch fixes that, by introducing a spec function gt (short for
>> greather than), and using it in the spec lines.
>>
>
> Attached (untested) patch manages the same, without introducing the spec
> function 'gt'. But the solution is a bit convoluted, so I prefer the one
> with the gt function.
I prefer the one with the gt function :-)

jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2015-07-14  4:55   ` Jeff Law
@ 2015-07-14  8:36     ` Tom de Vries
  2016-03-17 16:28       ` Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Tom de Vries @ 2015-07-14  8:36 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1037 bytes --]

On 14/07/15 06:54, Jeff Law wrote:
> On 07/13/2015 04:58 AM, Tom de Vries wrote:
>> On 07/07/15 09:53, Tom de Vries wrote:
>>> Hi,
>>>
>>> currently, we have these spec strings in gcc/gcc.c involving
>>> ftree-parallelize-loops:
>>> ...
>>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
>>>
>>>
>>>
>>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:-pthread}"
>>> ...
>>>
>>> Actually, ftree-parallelize-loops={0,1} means that no parallelization is
>>> done, but these spec strings still get activated for these values.
>>>
>>>
>>> Attached patch fixes that, by introducing a spec function gt (short for
>>> greather than), and using it in the spec lines.
>>>
>>
>> Attached (untested) patch manages the same, without introducing the spec
>> function 'gt'. But the solution is a bit convoluted, so I prefer the one
>> with the gt function.
> I prefer the one with the gt function :-)
>

Committed the patch using the gt function, as attached (formatting 
fixed, ChangeLog entry added).

Thanks,
- Tom


[-- Attachment #2: 0001-Ignore-ftree-parallelize-loops-0-1-using-gt.patch --]
[-- Type: text/x-patch, Size: 3456 bytes --]

Ignore -ftree-parallelize-loops={0,1} using gt

2015-07-14  Tom de Vries  <tom@codesourcery.com>

	* gcc.c (greater_than_spec_func): Declare forward.
	(LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use gt to ignore
	-ftree-parallelize-loops={0,1}.
	(static_spec_functions): Add greater_than_spec_func function with name
	"gt".
	(greater_than_spec_func): New function.
---
 gcc/gcc.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 47 insertions(+), 2 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 0f29b78..92d0909 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -274,6 +274,7 @@ static const char *compare_debug_self_opt_spec_function (int, const char **);
 static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
 static const char *pass_through_libs_spec_func (int, const char **);
 static const char *replace_extension_spec_func (int, const char **);
+static const char *greater_than_spec_func (int, const char **);
 static char *convert_white_space (char *);
 \f
 /* The Specs Language
@@ -881,7 +882,8 @@ proper position among the other output files.  */
     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
     %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
     " CHKP_SPEC " \
-    %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1):\
+	%:include(libgomp.spec)%(link_gomp)}\
     %{fcilkplus:%:include(libcilkrts.spec)%(link_cilkrts)}\
     %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
     %(mflib) " STACK_SPLIT_SPEC "\
@@ -1042,7 +1044,8 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
 /* Linking to libgomp implies pthreads.  This is particularly important
    for targets that use different start files and suchlike.  */
 #ifndef GOMP_SELF_SPECS
-#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
+#define GOMP_SELF_SPECS \
+  "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1): " \
   "-pthread}"
 #endif
 
@@ -1482,6 +1485,7 @@ static const struct spec_function static_spec_functions[] =
   { "compare-debug-auxbase-opt", compare_debug_auxbase_opt_spec_function },
   { "pass-through-libs",	pass_through_libs_spec_func },
   { "replace-extension",	replace_extension_spec_func },
+  { "gt",			greater_than_spec_func },
 #ifdef EXTRA_SPEC_FUNCTIONS
   EXTRA_SPEC_FUNCTIONS
 #endif
@@ -9428,6 +9432,47 @@ replace_extension_spec_func (int argc, const char **argv)
   return result;
 }
 
+/* Returns "" if the n in ARGV[1] == -opt=<n> is greater than ARGV[2].
+   Otherwise, return NULL.  */
+
+static const char *
+greater_than_spec_func (int argc, const char **argv)
+{
+  char *converted;
+
+  if (argc == 1)
+    return NULL;
+
+  gcc_assert (argc == 3);
+  gcc_assert (argv[0][0] == '-');
+  gcc_assert (argv[0][1] == '\0');
+
+  /* Point p to <n> in in -opt=<n>.  */
+  const char *p = argv[1];
+  while (true)
+    {
+      char c = *p;
+      if (c == '\0')
+	gcc_unreachable ();
+
+      ++p;
+
+      if (c == '=')
+	break;
+    }
+
+  long arg = strtol (p, &converted, 10);
+  gcc_assert (converted != p);
+
+  long lim = strtol (argv[2], &converted, 10);
+  gcc_assert (converted != argv[2]);
+
+  if (arg > lim)
+    return "";
+
+  return NULL;
+}
+
 /* Insert backslash before spaces in ORIG (usually a file path), to 
    avoid being broken by spec parser.
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2015-07-14  8:36     ` Tom de Vries
@ 2016-03-17 16:28       ` Thomas Schwinge
  2016-04-08 10:36         ` Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2016-03-17 16:28 UTC (permalink / raw)
  To: Tom de Vries, gcc-patches, Jakub Jelinek; +Cc: Jeff Law

[-- Attachment #1: Type: text/plain, Size: 8835 bytes --]

Hi!

On Tue, 14 Jul 2015 10:36:25 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
> On 14/07/15 06:54, Jeff Law wrote:
> > On 07/13/2015 04:58 AM, Tom de Vries wrote:
> >> On 07/07/15 09:53, Tom de Vries wrote:
> >>> currently, we have these spec strings in gcc/gcc.c involving
> >>> ftree-parallelize-loops:
> >>> ...
> >>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
> >>>
> >>>
> >>>
> >>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:-pthread}"
> >>> ...
> >>>
> >>> Actually, ftree-parallelize-loops={0,1} means that no parallelization is
> >>> done, but these spec strings still get activated for these values.
> >>>
> >>>
> >>> Attached patch fixes that, by introducing a spec function gt (short for
> >>> greather than), and using it in the spec lines.

> Committed the patch using the gt function, as attached (formatting 
> fixed, ChangeLog entry added).

> Ignore -ftree-parallelize-loops={0,1} using gt
> 
> 2015-07-14  Tom de Vries  <tom@codesourcery.com>
> 
> 	* gcc.c (greater_than_spec_func): Declare forward.
> 	(LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use gt to ignore
> 	-ftree-parallelize-loops={0,1}.
> 	(static_spec_functions): Add greater_than_spec_func function with name
> 	"gt".
> 	(greater_than_spec_func): New function.

I recently noticed that this change failed to update the instances of
ftree-parallelize-loops in other spec strings.  I can't easily test my
proposed changes, but I just mechanically changed
"ftree-parallelize-loops=*" to "%:gt(%{ftree-parallelize-loops=*:%*} 1)"
(which is the spelling to use after Jakub's "[PATCH] Fix driver handling
of multiple -ftree-parallelize-loops=<n> options (PR driver/69805)",
<http://news.gmane.org/find-root.php?message_id=%3C20160216152439.GT3017%40tucnak.redhat.com%3E>).
OK to commit?

commit df7d7943ae64f6df74d360e71f7c495c78647fda
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Mar 17 17:17:36 2016 +0100

    Complete changes to "Ignore -ftree-parallelize-loops={0,1} using gt"
    
    Apply the r225764 and r233573 changes to all relevant spec strings.
    
    	gcc/
    	* config/arc/arc.h (LINK_COMMAND_SPEC): Use gt to ignore
    	-ftree-parallelize-loops={0,1}.
    	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
    	* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
    	* config/ia64/hpux.h (LIB_SPEC): Likewise.
    	* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
    	* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
---
 gcc/config/arc/arc.h      |  3 ++-
 gcc/config/darwin.h       |  2 +-
 gcc/config/i386/mingw32.h |  2 +-
 gcc/config/ia64/hpux.h    |  2 +-
 gcc/config/pa/pa-hpux11.h |  2 +-
 gcc/config/pa/pa64-hpux.h | 12 ++++++------
 6 files changed, 12 insertions(+), 11 deletions(-)

diff --git gcc/config/arc/arc.h gcc/config/arc/arc.h
index 21c049f..1c2a38d 100644
--- gcc/config/arc/arc.h
+++ gcc/config/arc/arc.h
@@ -188,7 +188,8 @@ along with GCC; see the file COPYING3.  If not see
     %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
     %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
-    %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
+	%:include(libgomp.spec)%(link_gomp)}\
     %(mflib)\
     %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
diff --git gcc/config/darwin.h gcc/config/darwin.h
index 9f686d3..c9981b8 100644
--- gcc/config/darwin.h
+++ gcc/config/darwin.h
@@ -177,7 +177,7 @@ extern GTY(()) int darwin_ms_struct;
     %{o*}%{!o:-o a.out} \
     %{!nostdlib:%{!nostartfiles:%S}} \
     %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
-    %{fopenacc|fopenmp|ftree-parallelize-loops=*: \
+    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
     %{fgnu-tm: \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
diff --git gcc/config/i386/mingw32.h gcc/config/i386/mingw32.h
index 4ac5f68..e048189 100644
--- gcc/config/i386/mingw32.h
+++ gcc/config/i386/mingw32.h
@@ -207,7 +207,7 @@ do {						         \
 
 /* mingw32 uses the  -mthreads option to enable thread support.  */
 #undef GOMP_SELF_SPECS
-#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
+#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \
 			"-mthreads -pthread}"
 #undef GTM_SELF_SPECS
 #define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}"
diff --git gcc/config/ia64/hpux.h gcc/config/ia64/hpux.h
index 8b90c99..008c4f6 100644
--- gcc/config/ia64/hpux.h
+++ gcc/config/ia64/hpux.h
@@ -92,7 +92,7 @@ do {							\
 #undef  LIB_SPEC
 #define LIB_SPEC \
   "%{!shared: \
-     %{mt|pthread:%{fopenacc|fopenmp|ftree-parallelize-loops=*:-lrt} -lpthread} \
+     %{mt|pthread:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):-lrt} -lpthread} \
      %{p:%{!mlp64:-L/usr/lib/hpux32/libp} \
 	 %{mlp64:-L/usr/lib/hpux64/libp} -lprof} \
      %{pg:%{!mlp64:-L/usr/lib/hpux32/libp} \
diff --git gcc/config/pa/pa-hpux11.h gcc/config/pa/pa-hpux11.h
index 3e5207a..600b677 100644
--- gcc/config/pa/pa-hpux11.h
+++ gcc/config/pa/pa-hpux11.h
@@ -147,7 +147,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef LIB_SPEC
 #define LIB_SPEC \
   "%{!shared:\
-     %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+     %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
        %{static:-a archive_shared} -lrt %{static:-a archive}}\
      %{mt|pthread:-lpthread} -lc\
      %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\
diff --git gcc/config/pa/pa64-hpux.h gcc/config/pa/pa64-hpux.h
index a5ccb4a..279406a 100644
--- gcc/config/pa/pa64-hpux.h
+++ gcc/config/pa/pa64-hpux.h
@@ -58,21 +58,21 @@ along with GCC; see the file COPYING3.  If not see
 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
 #define LIB_SPEC \
   "%{!shared:\
-     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
                   %{static:-a shared} -lrt %{static:-a archive}}\
 	    %{mt|pthread:-lpthread} -lc\
 	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
 	   -lprof %{static:-a archive}\
-	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
              %{static:-a shared} -lrt %{static:-a archive}}\
 	   %{mt|pthread:-lpthread} -lc\
 	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
        -lgprof %{static:-a archive}\
-       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
          %{static:-a shared} -lrt %{static:-a archive}}\
        %{mt|pthread:-lpthread} -lc\
        %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
@@ -81,21 +81,21 @@ along with GCC; see the file COPYING3.  If not see
 #else
 #define LIB_SPEC \
   "%{!shared:\
-     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
                   %{static:-a shared} -lrt %{static:-a archive}}\
 	    %{mt|pthread:-lpthread} -lc\
 	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
 	   -lprof %{static:-a archive}\
-	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
              %{static:-a shared} -lrt %{static:-a archive}}\
 	   %{mt|pthread:-lpthread} -lc\
 	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
        -lgprof %{static:-a archive}\
-       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
          %{static:-a shared} -lrt %{static:-a archive}}\
        %{mt|pthread:-lpthread} -lc\
        %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2016-03-17 16:28       ` Thomas Schwinge
@ 2016-04-08 10:36         ` Thomas Schwinge
  2016-04-08 11:39           ` Tom de Vries
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2016-04-08 10:36 UTC (permalink / raw)
  To: Tom de Vries, gcc-patches, Jakub Jelinek; +Cc: Jeff Law

[-- Attachment #1: Type: text/plain, Size: 9268 bytes --]

Hi!

Ping.

On Thu, 17 Mar 2016 17:24:48 +0100, I wrote:
> On Tue, 14 Jul 2015 10:36:25 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
> > On 14/07/15 06:54, Jeff Law wrote:
> > > On 07/13/2015 04:58 AM, Tom de Vries wrote:
> > >> On 07/07/15 09:53, Tom de Vries wrote:
> > >>> currently, we have these spec strings in gcc/gcc.c involving
> > >>> ftree-parallelize-loops:
> > >>> ...
> > >>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
> > >>>
> > >>>
> > >>>
> > >>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:-pthread}"
> > >>> ...
> > >>>
> > >>> Actually, ftree-parallelize-loops={0,1} means that no parallelization is
> > >>> done, but these spec strings still get activated for these values.
> > >>>
> > >>>
> > >>> Attached patch fixes that, by introducing a spec function gt (short for
> > >>> greather than), and using it in the spec lines.
> 
> > Committed the patch using the gt function, as attached (formatting 
> > fixed, ChangeLog entry added).
> 
> > Ignore -ftree-parallelize-loops={0,1} using gt
> > 
> > 2015-07-14  Tom de Vries  <tom@codesourcery.com>
> > 
> > 	* gcc.c (greater_than_spec_func): Declare forward.
> > 	(LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use gt to ignore
> > 	-ftree-parallelize-loops={0,1}.
> > 	(static_spec_functions): Add greater_than_spec_func function with name
> > 	"gt".
> > 	(greater_than_spec_func): New function.
> 
> I recently noticed that this change failed to update the instances of
> ftree-parallelize-loops in other spec strings.  I can't easily test my
> proposed changes, but I just mechanically changed
> "ftree-parallelize-loops=*" to "%:gt(%{ftree-parallelize-loops=*:%*} 1)"
> (which is the spelling to use after Jakub's "[PATCH] Fix driver handling
> of multiple -ftree-parallelize-loops=<n> options (PR driver/69805)",
> <http://news.gmane.org/find-root.php?message_id=%3C20160216152439.GT3017%40tucnak.redhat.com%3E>).
> OK to commit?
> 
> commit df7d7943ae64f6df74d360e71f7c495c78647fda
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Thu Mar 17 17:17:36 2016 +0100
> 
>     Complete changes to "Ignore -ftree-parallelize-loops={0,1} using gt"
>     
>     Apply the r225764 and r233573 changes to all relevant spec strings.
>     
>     	gcc/
>     	* config/arc/arc.h (LINK_COMMAND_SPEC): Use gt to ignore
>     	-ftree-parallelize-loops={0,1}.
>     	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
>     	* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
>     	* config/ia64/hpux.h (LIB_SPEC): Likewise.
>     	* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
>     	* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
> ---
>  gcc/config/arc/arc.h      |  3 ++-
>  gcc/config/darwin.h       |  2 +-
>  gcc/config/i386/mingw32.h |  2 +-
>  gcc/config/ia64/hpux.h    |  2 +-
>  gcc/config/pa/pa-hpux11.h |  2 +-
>  gcc/config/pa/pa64-hpux.h | 12 ++++++------
>  6 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git gcc/config/arc/arc.h gcc/config/arc/arc.h
> index 21c049f..1c2a38d 100644
> --- gcc/config/arc/arc.h
> +++ gcc/config/arc/arc.h
> @@ -188,7 +188,8 @@ along with GCC; see the file COPYING3.  If not see
>      %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
>      %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
>      %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
> -    %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
> +    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
> +	%:include(libgomp.spec)%(link_gomp)}\
>      %(mflib)\
>      %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
> diff --git gcc/config/darwin.h gcc/config/darwin.h
> index 9f686d3..c9981b8 100644
> --- gcc/config/darwin.h
> +++ gcc/config/darwin.h
> @@ -177,7 +177,7 @@ extern GTY(()) int darwin_ms_struct;
>      %{o*}%{!o:-o a.out} \
>      %{!nostdlib:%{!nostartfiles:%S}} \
>      %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
> -    %{fopenacc|fopenmp|ftree-parallelize-loops=*: \
> +    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
>        %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
>      %{fgnu-tm: \
>        %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
> diff --git gcc/config/i386/mingw32.h gcc/config/i386/mingw32.h
> index 4ac5f68..e048189 100644
> --- gcc/config/i386/mingw32.h
> +++ gcc/config/i386/mingw32.h
> @@ -207,7 +207,7 @@ do {						         \
>  
>  /* mingw32 uses the  -mthreads option to enable thread support.  */
>  #undef GOMP_SELF_SPECS
> -#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
> +#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \
>  			"-mthreads -pthread}"
>  #undef GTM_SELF_SPECS
>  #define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}"
> diff --git gcc/config/ia64/hpux.h gcc/config/ia64/hpux.h
> index 8b90c99..008c4f6 100644
> --- gcc/config/ia64/hpux.h
> +++ gcc/config/ia64/hpux.h
> @@ -92,7 +92,7 @@ do {							\
>  #undef  LIB_SPEC
>  #define LIB_SPEC \
>    "%{!shared: \
> -     %{mt|pthread:%{fopenacc|fopenmp|ftree-parallelize-loops=*:-lrt} -lpthread} \
> +     %{mt|pthread:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):-lrt} -lpthread} \
>       %{p:%{!mlp64:-L/usr/lib/hpux32/libp} \
>  	 %{mlp64:-L/usr/lib/hpux64/libp} -lprof} \
>       %{pg:%{!mlp64:-L/usr/lib/hpux32/libp} \
> diff --git gcc/config/pa/pa-hpux11.h gcc/config/pa/pa-hpux11.h
> index 3e5207a..600b677 100644
> --- gcc/config/pa/pa-hpux11.h
> +++ gcc/config/pa/pa-hpux11.h
> @@ -147,7 +147,7 @@ along with GCC; see the file COPYING3.  If not see
>  #undef LIB_SPEC
>  #define LIB_SPEC \
>    "%{!shared:\
> -     %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
> +     %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>         %{static:-a archive_shared} -lrt %{static:-a archive}}\
>       %{mt|pthread:-lpthread} -lc\
>       %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\
> diff --git gcc/config/pa/pa64-hpux.h gcc/config/pa/pa64-hpux.h
> index a5ccb4a..279406a 100644
> --- gcc/config/pa/pa64-hpux.h
> +++ gcc/config/pa/pa64-hpux.h
> @@ -58,21 +58,21 @@ along with GCC; see the file COPYING3.  If not see
>  #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
>  #define LIB_SPEC \
>    "%{!shared:\
> -     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
> +     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>                    %{static:-a shared} -lrt %{static:-a archive}}\
>  	    %{mt|pthread:-lpthread} -lc\
>  	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>  		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>       %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
>  	   -lprof %{static:-a archive}\
> -	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
> +	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>               %{static:-a shared} -lrt %{static:-a archive}}\
>  	   %{mt|pthread:-lpthread} -lc\
>  	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>  		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>       %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
>         -lgprof %{static:-a archive}\
> -       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
> +       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>           %{static:-a shared} -lrt %{static:-a archive}}\
>         %{mt|pthread:-lpthread} -lc\
>         %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
> @@ -81,21 +81,21 @@ along with GCC; see the file COPYING3.  If not see
>  #else
>  #define LIB_SPEC \
>    "%{!shared:\
> -     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
> +     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>                    %{static:-a shared} -lrt %{static:-a archive}}\
>  	    %{mt|pthread:-lpthread} -lc\
>  	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>  		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>       %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
>  	   -lprof %{static:-a archive}\
> -	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
> +	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>               %{static:-a shared} -lrt %{static:-a archive}}\
>  	   %{mt|pthread:-lpthread} -lc\
>  	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>  		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>       %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
>         -lgprof %{static:-a archive}\
> -       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
> +       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>           %{static:-a shared} -lrt %{static:-a archive}}\
>         %{mt|pthread:-lpthread} -lc\
>         %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2016-04-08 10:36         ` Thomas Schwinge
@ 2016-04-08 11:39           ` Tom de Vries
  2016-04-08 11:44             ` Jakub Jelinek
  0 siblings, 1 reply; 9+ messages in thread
From: Tom de Vries @ 2016-04-08 11:39 UTC (permalink / raw)
  To: Thomas Schwinge, gcc-patches, Jakub Jelinek; +Cc: Jeff Law

On 08/04/16 12:35, Thomas Schwinge wrote:
> Hi!
>
> Ping.
>
> On Thu, 17 Mar 2016 17:24:48 +0100, I wrote:
>> On Tue, 14 Jul 2015 10:36:25 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
>>> On 14/07/15 06:54, Jeff Law wrote:
>>>> On 07/13/2015 04:58 AM, Tom de Vries wrote:
>>>>> On 07/07/15 09:53, Tom de Vries wrote:
>>>>>> currently, we have these spec strings in gcc/gcc.c involving
>>>>>> ftree-parallelize-loops:
>>>>>> ...
>>>>>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
>>>>>>
>>>>>>
>>>>>>
>>>>>> %{fopenacc|fopenmp|ftree-parallelize-loops=*:-pthread}"
>>>>>> ...
>>>>>>
>>>>>> Actually, ftree-parallelize-loops={0,1} means that no parallelization is
>>>>>> done, but these spec strings still get activated for these values.
>>>>>>
>>>>>>
>>>>>> Attached patch fixes that, by introducing a spec function gt (short for
>>>>>> greather than), and using it in the spec lines.
>>
>>> Committed the patch using the gt function, as attached (formatting
>>> fixed, ChangeLog entry added).
>>
>>> Ignore -ftree-parallelize-loops={0,1} using gt
>>>
>>> 2015-07-14  Tom de Vries  <tom@codesourcery.com>
>>>
>>> 	* gcc.c (greater_than_spec_func): Declare forward.
>>> 	(LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use gt to ignore
>>> 	-ftree-parallelize-loops={0,1}.
>>> 	(static_spec_functions): Add greater_than_spec_func function with name
>>> 	"gt".
>>> 	(greater_than_spec_func): New function.
>>
>> I recently noticed that this change failed to update the instances of
>> ftree-parallelize-loops in other spec strings.  I can't easily test my
>> proposed changes, but I just mechanically changed
>> "ftree-parallelize-loops=*" to "%:gt(%{ftree-parallelize-loops=*:%*} 1)"
>> (which is the spelling to use after Jakub's "[PATCH] Fix driver handling
>> of multiple -ftree-parallelize-loops=<n> options (PR driver/69805)",
>> <http://news.gmane.org/find-root.php?message_id=%3C20160216152439.GT3017%40tucnak.redhat.com%3E>).
>> OK to commit?
>>

Hi Thomas,

I've looked at the patch, it looks good to me.

I think it can be committed as obvious.

Thanks,
- Tom

>> commit df7d7943ae64f6df74d360e71f7c495c78647fda
>> Author: Thomas Schwinge <thomas@codesourcery.com>
>> Date:   Thu Mar 17 17:17:36 2016 +0100
>>
>>      Complete changes to "Ignore -ftree-parallelize-loops={0,1} using gt"
>>
>>      Apply the r225764 and r233573 changes to all relevant spec strings.
>>
>>      	gcc/
>>      	* config/arc/arc.h (LINK_COMMAND_SPEC): Use gt to ignore
>>      	-ftree-parallelize-loops={0,1}.
>>      	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
>>      	* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
>>      	* config/ia64/hpux.h (LIB_SPEC): Likewise.
>>      	* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
>>      	* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
>> ---
>>   gcc/config/arc/arc.h      |  3 ++-
>>   gcc/config/darwin.h       |  2 +-
>>   gcc/config/i386/mingw32.h |  2 +-
>>   gcc/config/ia64/hpux.h    |  2 +-
>>   gcc/config/pa/pa-hpux11.h |  2 +-
>>   gcc/config/pa/pa64-hpux.h | 12 ++++++------
>>   6 files changed, 12 insertions(+), 11 deletions(-)
>>
>> diff --git gcc/config/arc/arc.h gcc/config/arc/arc.h
>> index 21c049f..1c2a38d 100644
>> --- gcc/config/arc/arc.h
>> +++ gcc/config/arc/arc.h
>> @@ -188,7 +188,8 @@ along with GCC; see the file COPYING3.  If not see
>>       %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
>>       %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
>>       %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
>> -    %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
>> +    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>> +	%:include(libgomp.spec)%(link_gomp)}\
>>       %(mflib)\
>>       %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
>>       %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
>> diff --git gcc/config/darwin.h gcc/config/darwin.h
>> index 9f686d3..c9981b8 100644
>> --- gcc/config/darwin.h
>> +++ gcc/config/darwin.h
>> @@ -177,7 +177,7 @@ extern GTY(()) int darwin_ms_struct;
>>       %{o*}%{!o:-o a.out} \
>>       %{!nostdlib:%{!nostartfiles:%S}} \
>>       %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
>> -    %{fopenacc|fopenmp|ftree-parallelize-loops=*: \
>> +    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
>>         %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
>>       %{fgnu-tm: \
>>         %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
>> diff --git gcc/config/i386/mingw32.h gcc/config/i386/mingw32.h
>> index 4ac5f68..e048189 100644
>> --- gcc/config/i386/mingw32.h
>> +++ gcc/config/i386/mingw32.h
>> @@ -207,7 +207,7 @@ do {						         \
>>
>>   /* mingw32 uses the  -mthreads option to enable thread support.  */
>>   #undef GOMP_SELF_SPECS
>> -#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
>> +#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \
>>   			"-mthreads -pthread}"
>>   #undef GTM_SELF_SPECS
>>   #define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}"
>> diff --git gcc/config/ia64/hpux.h gcc/config/ia64/hpux.h
>> index 8b90c99..008c4f6 100644
>> --- gcc/config/ia64/hpux.h
>> +++ gcc/config/ia64/hpux.h
>> @@ -92,7 +92,7 @@ do {							\
>>   #undef  LIB_SPEC
>>   #define LIB_SPEC \
>>     "%{!shared: \
>> -     %{mt|pthread:%{fopenacc|fopenmp|ftree-parallelize-loops=*:-lrt} -lpthread} \
>> +     %{mt|pthread:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):-lrt} -lpthread} \
>>        %{p:%{!mlp64:-L/usr/lib/hpux32/libp} \
>>   	 %{mlp64:-L/usr/lib/hpux64/libp} -lprof} \
>>        %{pg:%{!mlp64:-L/usr/lib/hpux32/libp} \
>> diff --git gcc/config/pa/pa-hpux11.h gcc/config/pa/pa-hpux11.h
>> index 3e5207a..600b677 100644
>> --- gcc/config/pa/pa-hpux11.h
>> +++ gcc/config/pa/pa-hpux11.h
>> @@ -147,7 +147,7 @@ along with GCC; see the file COPYING3.  If not see
>>   #undef LIB_SPEC
>>   #define LIB_SPEC \
>>     "%{!shared:\
>> -     %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
>> +     %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>>          %{static:-a archive_shared} -lrt %{static:-a archive}}\
>>        %{mt|pthread:-lpthread} -lc\
>>        %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\
>> diff --git gcc/config/pa/pa64-hpux.h gcc/config/pa/pa64-hpux.h
>> index a5ccb4a..279406a 100644
>> --- gcc/config/pa/pa64-hpux.h
>> +++ gcc/config/pa/pa64-hpux.h
>> @@ -58,21 +58,21 @@ along with GCC; see the file COPYING3.  If not see
>>   #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
>>   #define LIB_SPEC \
>>     "%{!shared:\
>> -     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
>> +     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>>                     %{static:-a shared} -lrt %{static:-a archive}}\
>>   	    %{mt|pthread:-lpthread} -lc\
>>   	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>>   		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>>        %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
>>   	   -lprof %{static:-a archive}\
>> -	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
>> +	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>>                %{static:-a shared} -lrt %{static:-a archive}}\
>>   	   %{mt|pthread:-lpthread} -lc\
>>   	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>>   		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>>        %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
>>          -lgprof %{static:-a archive}\
>> -       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
>> +       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>>            %{static:-a shared} -lrt %{static:-a archive}}\
>>          %{mt|pthread:-lpthread} -lc\
>>          %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>> @@ -81,21 +81,21 @@ along with GCC; see the file COPYING3.  If not see
>>   #else
>>   #define LIB_SPEC \
>>     "%{!shared:\
>> -     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
>> +     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>>                     %{static:-a shared} -lrt %{static:-a archive}}\
>>   	    %{mt|pthread:-lpthread} -lc\
>>   	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>>   		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>>        %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
>>   	   -lprof %{static:-a archive}\
>> -	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
>> +	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>>                %{static:-a shared} -lrt %{static:-a archive}}\
>>   	   %{mt|pthread:-lpthread} -lc\
>>   	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>>   		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
>>        %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
>>          -lgprof %{static:-a archive}\
>> -       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
>> +       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
>>            %{static:-a shared} -lrt %{static:-a archive}}\
>>          %{mt|pthread:-lpthread} -lc\
>>          %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
>
>
> Grüße
>   Thomas
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2016-04-08 11:39           ` Tom de Vries
@ 2016-04-08 11:44             ` Jakub Jelinek
  2016-04-08 13:48               ` Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2016-04-08 11:44 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Thomas Schwinge, gcc-patches, Jeff Law

On Fri, Apr 08, 2016 at 01:38:06PM +0200, Tom de Vries wrote:
> On 08/04/16 12:35, Thomas Schwinge wrote:
> I've looked at the patch, it looks good to me.
> 
> I think it can be committed as obvious.

The patch is ok for trunk.

> >>commit df7d7943ae64f6df74d360e71f7c495c78647fda
> >>Author: Thomas Schwinge <thomas@codesourcery.com>
> >>Date:   Thu Mar 17 17:17:36 2016 +0100
> >>
> >>     Complete changes to "Ignore -ftree-parallelize-loops={0,1} using gt"
> >>
> >>     Apply the r225764 and r233573 changes to all relevant spec strings.
> >>
> >>     	gcc/
> >>     	* config/arc/arc.h (LINK_COMMAND_SPEC): Use gt to ignore
> >>     	-ftree-parallelize-loops={0,1}.
> >>     	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
> >>     	* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
> >>     	* config/ia64/hpux.h (LIB_SPEC): Likewise.
> >>     	* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
> >>     	* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1}
  2016-04-08 11:44             ` Jakub Jelinek
@ 2016-04-08 13:48               ` Thomas Schwinge
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Schwinge @ 2016-04-08 13:48 UTC (permalink / raw)
  To: gcc-patches, Jakub Jelinek, Tom de Vries; +Cc: Jeff Law

Hi!

On Fri, 8 Apr 2016 13:43:49 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Apr 08, 2016 at 01:38:06PM +0200, Tom de Vries wrote:
> > On 08/04/16 12:35, Thomas Schwinge wrote:
> > I've looked at the patch, it looks good to me.
> > 
> > I think it can be committed as obvious.
> 
> The patch is ok for trunk.

Committed (without changes) in r234831:

commit a5f0da96ac1554f56d064c5ae89a80833bd01888
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Apr 8 13:47:37 2016 +0000

    Complete changes to "Ignore -ftree-parallelize-loops={0,1} using gt"
    
    Apply the r225764 and r233573 changes to all relevant spec strings.
    
    	gcc/
    	* config/arc/arc.h (LINK_COMMAND_SPEC): Use gt to ignore
    	-ftree-parallelize-loops={0,1}.
    	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
    	* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
    	* config/ia64/hpux.h (LIB_SPEC): Likewise.
    	* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
    	* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234831 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog             | 10 ++++++++++
 gcc/config/arc/arc.h      |  3 ++-
 gcc/config/darwin.h       |  2 +-
 gcc/config/i386/mingw32.h |  2 +-
 gcc/config/ia64/hpux.h    |  2 +-
 gcc/config/pa/pa-hpux11.h |  2 +-
 gcc/config/pa/pa64-hpux.h | 12 ++++++------
 7 files changed, 22 insertions(+), 11 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index 8e2ddf1..15e3d22 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,13 @@
+2016-04-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* config/arc/arc.h (LINK_COMMAND_SPEC): Use gt to ignore
+	-ftree-parallelize-loops={0,1}.
+	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
+	* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
+	* config/ia64/hpux.h (LIB_SPEC): Likewise.
+	* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
+	* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
+
 2016-04-08  Maxim Ostapenko  <m.ostapenko@samsung.com>
 
 	PR sanitizer/70541
diff --git gcc/config/arc/arc.h gcc/config/arc/arc.h
index 21c049f..1c2a38d 100644
--- gcc/config/arc/arc.h
+++ gcc/config/arc/arc.h
@@ -188,7 +188,8 @@ along with GCC; see the file COPYING3.  If not see
     %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
     %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
-    %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
+    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
+	%:include(libgomp.spec)%(link_gomp)}\
     %(mflib)\
     %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
diff --git gcc/config/darwin.h gcc/config/darwin.h
index 9f686d3..c9981b8 100644
--- gcc/config/darwin.h
+++ gcc/config/darwin.h
@@ -177,7 +177,7 @@ extern GTY(()) int darwin_ms_struct;
     %{o*}%{!o:-o a.out} \
     %{!nostdlib:%{!nostartfiles:%S}} \
     %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
-    %{fopenacc|fopenmp|ftree-parallelize-loops=*: \
+    %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
     %{fgnu-tm: \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
diff --git gcc/config/i386/mingw32.h gcc/config/i386/mingw32.h
index 4ac5f68..e048189 100644
--- gcc/config/i386/mingw32.h
+++ gcc/config/i386/mingw32.h
@@ -207,7 +207,7 @@ do {						         \
 
 /* mingw32 uses the  -mthreads option to enable thread support.  */
 #undef GOMP_SELF_SPECS
-#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
+#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \
 			"-mthreads -pthread}"
 #undef GTM_SELF_SPECS
 #define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}"
diff --git gcc/config/ia64/hpux.h gcc/config/ia64/hpux.h
index 8b90c99..008c4f6 100644
--- gcc/config/ia64/hpux.h
+++ gcc/config/ia64/hpux.h
@@ -92,7 +92,7 @@ do {							\
 #undef  LIB_SPEC
 #define LIB_SPEC \
   "%{!shared: \
-     %{mt|pthread:%{fopenacc|fopenmp|ftree-parallelize-loops=*:-lrt} -lpthread} \
+     %{mt|pthread:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):-lrt} -lpthread} \
      %{p:%{!mlp64:-L/usr/lib/hpux32/libp} \
 	 %{mlp64:-L/usr/lib/hpux64/libp} -lprof} \
      %{pg:%{!mlp64:-L/usr/lib/hpux32/libp} \
diff --git gcc/config/pa/pa-hpux11.h gcc/config/pa/pa-hpux11.h
index 3e5207a..600b677 100644
--- gcc/config/pa/pa-hpux11.h
+++ gcc/config/pa/pa-hpux11.h
@@ -147,7 +147,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef LIB_SPEC
 #define LIB_SPEC \
   "%{!shared:\
-     %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+     %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
        %{static:-a archive_shared} -lrt %{static:-a archive}}\
      %{mt|pthread:-lpthread} -lc\
      %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\
diff --git gcc/config/pa/pa64-hpux.h gcc/config/pa/pa64-hpux.h
index a5ccb4a..279406a 100644
--- gcc/config/pa/pa64-hpux.h
+++ gcc/config/pa/pa64-hpux.h
@@ -58,21 +58,21 @@ along with GCC; see the file COPYING3.  If not see
 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
 #define LIB_SPEC \
   "%{!shared:\
-     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
                   %{static:-a shared} -lrt %{static:-a archive}}\
 	    %{mt|pthread:-lpthread} -lc\
 	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
 	   -lprof %{static:-a archive}\
-	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
              %{static:-a shared} -lrt %{static:-a archive}}\
 	   %{mt|pthread:-lpthread} -lc\
 	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
        -lgprof %{static:-a archive}\
-       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
          %{static:-a shared} -lrt %{static:-a archive}}\
        %{mt|pthread:-lpthread} -lc\
        %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
@@ -81,21 +81,21 @@ along with GCC; see the file COPYING3.  If not see
 #else
 #define LIB_SPEC \
   "%{!shared:\
-     %{!p:%{!pg:%{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+     %{!p:%{!pg:%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
                   %{static:-a shared} -lrt %{static:-a archive}}\
 	    %{mt|pthread:-lpthread} -lc\
 	    %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
 	   -lprof %{static:-a archive}\
-	   %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+	   %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
              %{static:-a shared} -lrt %{static:-a archive}}\
 	   %{mt|pthread:-lpthread} -lc\
 	   %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\
 		%{!mt:%{!pthread:-a shared -lc -a archive}}}}}\
      %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
        -lgprof %{static:-a archive}\
-       %{fopenacc|fopenmp|ftree-parallelize-loops=*:\
+       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
          %{static:-a shared} -lrt %{static:-a archive}}\
        %{mt|pthread:-lpthread} -lc\
        %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\


Grüße
 Thomas

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-04-08 13:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-07  7:54 [patch, driver] Ignore -ftree-parallelize-loops={0,1} Tom de Vries
2015-07-13 10:58 ` Tom de Vries
2015-07-14  4:55   ` Jeff Law
2015-07-14  8:36     ` Tom de Vries
2016-03-17 16:28       ` Thomas Schwinge
2016-04-08 10:36         ` Thomas Schwinge
2016-04-08 11:39           ` Tom de Vries
2016-04-08 11:44             ` Jakub Jelinek
2016-04-08 13:48               ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).