From patchwork Mon Jul 13 10:58:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 494508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0885314016A for ; Mon, 13 Jul 2015 20:58:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ljtYGvr5; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=GuhfgO+1X9aI6IhYB whGr1k7a2lSRjPS3P8/BY9oQf2ZcUKPSFUm3XNfnPxnL4EqF0NGjEDxerh5ClGm+ 97VjsxvdEweermRpLBUC3QVBleGZUBGUTK6DWNKjty33KOodxbCekRvRfbujcLnI 6VGcVe0iaKWHjKzPLhg+kCc+9k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=t5YVi0ZW+z/BqRih33gC2vd n3Sc=; b=ljtYGvr5hb9l15mgYfmCIccvv67LY1mqAOzKgZQeEnTqe1/NP/KTvLz 5ObsV/MEuzcf2wWOX+PpkZAESDIAWao5N60BQSPoso8YF1Q4ia0RB5eKQoSuFNkh EYd6GKx/Nq/y6muCFz5k+KvYY2DO3yRxxo9gdwrqQoIPdcd1EKIk= Received: (qmail 122246 invoked by alias); 13 Jul 2015 10:58:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 122231 invoked by uid 89); 13 Jul 2015 10:58:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 13 Jul 2015 10:58:49 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51435) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZEbRe-0000nH-T0 for gcc-patches@gnu.org; Mon, 13 Jul 2015 06:58:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEbRa-0003qS-D3 for gcc-patches@gnu.org; Mon, 13 Jul 2015 06:58:46 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:35643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEbRa-0003qI-7K for gcc-patches@gnu.org; Mon, 13 Jul 2015 06:58:42 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZEbRY-00031O-AD from Tom_deVries@mentor.com for gcc-patches@gnu.org; Mon, 13 Jul 2015 03:58:40 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 13 Jul 2015 11:58:38 +0100 Message-ID: <55A399D8.60300@mentor.com> Date: Mon, 13 Jul 2015 12:58:32 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "gcc-patches@gnu.org" Subject: Re: [patch, driver] Ignore -ftree-parallelize-loops={0,1} References: <559B8565.6030806@mentor.com> In-Reply-To: <559B8565.6030806@mentor.com> X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 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 Ignore -ftree-parallelize-loops={0,1} 2015-07-13 Tom de Vries * 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