From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74151 invoked by alias); 26 Oct 2015 12:54:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 74140 invoked by uid 89); 26 Oct 2015 12:54:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f42.google.com Received: from mail-qg0-f42.google.com (HELO mail-qg0-f42.google.com) (209.85.192.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 26 Oct 2015 12:54:31 +0000 Received: by qgad10 with SMTP id d10so117855720qga.3 for ; Mon, 26 Oct 2015 05:54:29 -0700 (PDT) X-Received: by 10.141.4.135 with SMTP id g129mr18251764qhd.45.1445864068982; Mon, 26 Oct 2015 05:54:28 -0700 (PDT) Received: from msticlxl57.ims.intel.com (jfdmzpr01-ext.jf.intel.com. [134.134.139.70]) by smtp.gmail.com with ESMTPSA id s48sm13010019qgs.4.2015.10.26.05.54.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Oct 2015 05:54:28 -0700 (PDT) Date: Mon, 26 Oct 2015 13:04:00 -0000 From: Ilya Verbin To: Jakub Jelinek Cc: Thomas Schwinge , gcc-patches@gcc.gnu.org, Kirill Yukhin Subject: Re: [gomp4.1] map clause parsing improvements Message-ID: <20151026125357.GA35077@msticlxl57.ims.intel.com> References: <20150429111406.GE1751@tucnak.redhat.com> <874mnzrw1z.fsf@schwinge.name> <20150429120644.GG1751@tucnak.redhat.com> <20150609183608.GA47936@msticlxl57.ims.intel.com> <20150611121420.GY10247@tucnak.redhat.com> <87zizf9n2w.fsf@kepler.schwinge.homeip.net> <20151019103408.GP478@tucnak.redhat.com> <87vba29a3y.fsf@schwinge.name> <20151020100340.GX478@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151020100340.GX478@tucnak.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg02734.txt.bz2 On Tue, Oct 20, 2015 at 12:03:40 +0200, Jakub Jelinek wrote: > On Mon, Oct 19, 2015 at 05:00:33PM +0200, Thomas Schwinge wrote: > > n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); > > if ((ctx->region_type & ORT_TARGET) != 0 > > && !(n->value & GOVD_SEEN) > > && ((OMP_CLAUSE_MAP_KIND (c) & GOMP_MAP_FLAG_ALWAYS) == 0 > > || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_STRUCT)) > > { > > remove = true; > > > > I'd suggest turning GOMP_MAP_FLAG_ALWAYS into GOMP_MAP_FLAG_SPECIAL_2, > > and then provide a GOMP_MAP_ALWAYS_P that evaluates to true just for the > > three "always,to", "always,from", and "always,tofrom" cases. > > Yeah, that can be done, I'll add it to my todo list. Is this what you planned? I've replaced all 3 uses of GOMP_MAP_FLAG_ALWAYS with GOMP_MAP_ALWAYS_P. make check and check-target-libgomp passed, however these 2 changes in gimplify_scan_omp_clauses are not covered by the testsuite, so I'm not entirely sure that they are correct. OK for gomp-4_5-branch? gcc/ * gimplify.c (gimplify_scan_omp_clauses): Use GOMP_MAP_ALWAYS_P. (gimplify_adjust_omp_clauses): Likewise. include/ * gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_2): Define. (GOMP_MAP_FLAG_ALWAYS): Remove. (enum gomp_map_kind): Use GOMP_MAP_FLAG_SPECIAL_2 instead of GOMP_MAP_FLAG_ALWAYS for GOMP_MAP_ALWAYS_TO, GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT, GOMP_MAP_RELEASE. (GOMP_MAP_ALWAYS_P): Define. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index ee5cb95..57ab6c6 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6613,7 +6613,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, struct_map_to_clause->put (decl, *list_p); list_p = &OMP_CLAUSE_CHAIN (*list_p); flags = GOVD_MAP | GOVD_EXPLICIT; - if (OMP_CLAUSE_MAP_KIND (c) & GOMP_MAP_FLAG_ALWAYS) + if (GOMP_MAP_ALWAYS_P (OMP_CLAUSE_MAP_KIND (c))) flags |= GOVD_SEEN; goto do_add_decl; } @@ -6623,7 +6623,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, tree *sc = NULL, *pt = NULL; if (!ptr && TREE_CODE (*osc) == TREE_LIST) osc = &TREE_PURPOSE (*osc); - if (OMP_CLAUSE_MAP_KIND (c) & GOMP_MAP_FLAG_ALWAYS) + if (GOMP_MAP_ALWAYS_P (OMP_CLAUSE_MAP_KIND (c))) n->value |= GOVD_SEEN; offset_int o1, o2; if (offset) @@ -7363,7 +7363,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p, n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); if ((ctx->region_type & ORT_TARGET) != 0 && !(n->value & GOVD_SEEN) - && ((OMP_CLAUSE_MAP_KIND (c) & GOMP_MAP_FLAG_ALWAYS) == 0 + && (GOMP_MAP_ALWAYS_P (OMP_CLAUSE_MAP_KIND (c)) == 0 || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_STRUCT)) { remove = true; diff --git a/include/gomp-constants.h b/include/gomp-constants.h index f834dec..2c6f011 100644 --- a/include/gomp-constants.h +++ b/include/gomp-constants.h @@ -39,10 +39,9 @@ /* Special map kinds, enumerated starting here. */ #define GOMP_MAP_FLAG_SPECIAL_0 (1 << 2) #define GOMP_MAP_FLAG_SPECIAL_1 (1 << 3) +#define GOMP_MAP_FLAG_SPECIAL_2 (1 << 4) #define GOMP_MAP_FLAG_SPECIAL (GOMP_MAP_FLAG_SPECIAL_1 \ | GOMP_MAP_FLAG_SPECIAL_0) -/* OpenMP always flag. */ -#define GOMP_MAP_FLAG_ALWAYS (1 << 6) /* Flag to force a specific behavior (or else, trigger a run-time error). */ #define GOMP_MAP_FLAG_FORCE (1 << 7) @@ -95,29 +94,31 @@ enum gomp_map_kind GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM), /* If not already present, allocate. And unconditionally copy to device. */ - GOMP_MAP_ALWAYS_TO = (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_TO), + GOMP_MAP_ALWAYS_TO = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_TO), /* If not already present, allocate. And unconditionally copy from device. */ - GOMP_MAP_ALWAYS_FROM = (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_FROM), + GOMP_MAP_ALWAYS_FROM = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_FROM), /* If not already present, allocate. And unconditionally copy to and from device. */ - GOMP_MAP_ALWAYS_TOFROM = (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_TOFROM), + GOMP_MAP_ALWAYS_TOFROM = (GOMP_MAP_FLAG_SPECIAL_2 + | GOMP_MAP_TOFROM), /* Map a sparse struct; the address is the base of the structure, alignment it's required alignment, and size is the number of adjacent entries that belong to the struct. The adjacent entries should be sorted by increasing address, so it is easy to determine lowest needed address (address of the first adjacent entry) and highest needed address (address of the last adjacent entry plus its size). */ - GOMP_MAP_STRUCT = (GOMP_MAP_FLAG_ALWAYS + GOMP_MAP_STRUCT = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_FLAG_SPECIAL | 0), /* Forced deallocation of zero length array section. */ GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION - = (GOMP_MAP_FLAG_ALWAYS + = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_FLAG_SPECIAL | 3), - /* OpenMP 4.1 alias for forced deallocation. */ + /* OpenMP 4.5 alias for forced deallocation. */ GOMP_MAP_DELETE = GOMP_MAP_FORCE_DEALLOC, /* Decrement usage count and deallocate if zero. */ - GOMP_MAP_RELEASE = (GOMP_MAP_FLAG_ALWAYS + GOMP_MAP_RELEASE = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_FORCE_DEALLOC), /* Internal to GCC, not used in libgomp. */ @@ -142,6 +143,10 @@ enum gomp_map_kind #define GOMP_MAP_ALWAYS_FROM_P(X) \ (((X) == GOMP_MAP_ALWAYS_FROM) || ((X) == GOMP_MAP_ALWAYS_TOFROM)) +#define GOMP_MAP_ALWAYS_P(X) \ + (((X) == GOMP_MAP_ALWAYS_TO) || ((X) == GOMP_MAP_ALWAYS_FROM) \ + || ((X) == GOMP_MAP_ALWAYS_TOFROM)) + /* Asynchronous behavior. Keep in sync with libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */ -- Ilya