From patchwork Tue Jan 3 19:42:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cesar Philippidis X-Patchwork-Id: 89726 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8166779qgi; Tue, 3 Jan 2017 11:43:10 -0800 (PST) X-Received: by 10.99.119.200 with SMTP id s191mr114097131pgc.172.1483472590324; Tue, 03 Jan 2017 11:43:10 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 33si70012177pli.217.2017.01.03.11.43.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2017 11:43:10 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445272-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445272-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445272-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=HsKcAb+cbW5RaMGP20lK+ua3e6PYwnXKE0NJX2uZTo+BAKRyy61t1 mNMT2ELYov2bbP6DYdCshzOmwtDT4fDr82DS90MaMYl3p+KjCLeBrqlTIXuWSs+e I26GQJ2le7L0UtmtipQ+A0z8PxOQ8L7dZnt57pQbqyTXAN6Uuq8tjE= 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:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=Ak4lKiPe4Syi0acHcWhODUfKB7M=; b=MJ/V8oXTaN/ORcSGqd66 72w9MDOxfttsSW9+iA1Wui954dldQ+BjQAzb5ite1FI3Ex+B6IJEczTHpgwxwkCu /DiJKV0uDTfLYDleozwDAZkVeWZwCa3fBKHyqeJGNMIXyFIeDYdM1OppadS8FZbV NMy98vrIyVMfmDxmGdcVjYY= Received: (qmail 90739 invoked by alias); 3 Jan 2017 19:42:49 -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 90711 invoked by uid 89); 3 Jan 2017 19:42:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=4.5, openmp.c, UD:openmp.c, openmpc X-Spam-User: qpsmtpd, 2 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Jan 2017 19:42:38 +0000 Received: from svr-orw-mbx-02.mgc.mentorg.com ([147.34.90.202]) by relay1.mentorg.com with esmtp id 1cOUyg-0002YL-8w from Cesar_Philippidis@mentor.com ; Tue, 03 Jan 2017 11:42:34 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 3 Jan 2017 11:42:31 -0800 From: Cesar Philippidis Subject: [gomp4] backport an acc directive matching cleanup for fortran To: "gcc-patches@gcc.gnu.org" , Fortran List Message-ID: Date: Tue, 3 Jan 2017 11:42:30 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 X-ClientProxiedBy: svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) To svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) This patch contains a backport of the fortran OpenACC directive matching changes I made to trunk here . It's not a clean backport because gomp4 has some support for the device_type clause which is missing in trunk. Next I plan to backport Jakub's OpenMP 4.5 fortran changes to gomp4. Cesar 2017-01-03 Cesar Philippidis gcc/fortran/ * openmp.c (match_acc): New function. (gfc_match_oacc_parallel_loop): Simplify by calling match_acc. (gfc_match_oacc_parallel): Likewise. (gfc_match_oacc_kernels_loop): Likewise. (gfc_match_oacc_kernels): Likewise. (gfc_match_oacc_data): Likewise. (gfc_match_oacc_host_data): Likewise. (gfc_match_oacc_loop): Likewise. (gfc_match_oacc_enter_data): likewise. (gfc_match_oacc_exit_data): Likewise. diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 0a9d137..61940d7 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1565,112 +1565,72 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask, #define OACC_UPDATE_CLAUSE_DEVICE_TYPE_MASK \ (OMP_CLAUSE_ASYNC | OMP_CLAUSE_WAIT | OMP_CLAUSE_DEVICE_TYPE) - -match -gfc_match_oacc_parallel_loop (void) +static match +match_acc (gfc_exec_op op, uint64_t mask, uint64_t dmask) { gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_PARALLEL_LOOP_CLAUSES, - OACC_PARALLEL_CLAUSE_DEVICE_TYPE_MASK - | OACC_LOOP_CLAUSE_DEVICE_TYPE_MASK, false, - false, true) != MATCH_YES) + + if (gfc_match_omp_clauses (&c, mask, dmask, false, false, true) != MATCH_YES) return MATCH_ERROR; - new_st.op = EXEC_OACC_PARALLEL_LOOP; + new_st.op = op; new_st.ext.omp_clauses = c; return MATCH_YES; } +match +gfc_match_oacc_parallel_loop (void) +{ + return match_acc (EXEC_OACC_PARALLEL_LOOP, OACC_PARALLEL_LOOP_CLAUSES, + OACC_PARALLEL_CLAUSE_DEVICE_TYPE_MASK + | OACC_LOOP_CLAUSE_DEVICE_TYPE_MASK); +} + match gfc_match_oacc_parallel (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_PARALLEL_CLAUSES, - OACC_PARALLEL_CLAUSE_DEVICE_TYPE_MASK, false, - false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_PARALLEL; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_PARALLEL, OACC_PARALLEL_CLAUSES, + OACC_PARALLEL_CLAUSE_DEVICE_TYPE_MASK); } match gfc_match_oacc_kernels_loop (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_KERNELS_LOOP_CLAUSES, - OACC_KERNELS_CLAUSE_DEVICE_TYPE_MASK - | OACC_LOOP_CLAUSE_DEVICE_TYPE_MASK, false, - false, true) != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_KERNELS_LOOP; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_KERNELS_LOOP, OACC_KERNELS_LOOP_CLAUSES, + OACC_KERNELS_CLAUSE_DEVICE_TYPE_MASK + | OACC_LOOP_CLAUSE_DEVICE_TYPE_MASK); } match gfc_match_oacc_kernels (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_KERNELS_CLAUSES, - OACC_KERNELS_CLAUSE_DEVICE_TYPE_MASK, false, - false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_KERNELS; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_KERNELS, OACC_KERNELS_CLAUSES, + OACC_KERNELS_CLAUSE_DEVICE_TYPE_MASK); } match gfc_match_oacc_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_DATA_CLAUSES, 0, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_DATA, OACC_DATA_CLAUSES, 0); } match gfc_match_oacc_host_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_HOST_DATA_CLAUSES, 0, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_HOST_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_HOST_DATA, OACC_HOST_DATA_CLAUSES, 0); } match gfc_match_oacc_loop (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_LOOP_CLAUSES, - OACC_LOOP_CLAUSE_DEVICE_TYPE_MASK, false, false, - true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_LOOP; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_LOOP, OACC_LOOP_CLAUSES, + OACC_LOOP_CLAUSE_DEVICE_TYPE_MASK); } @@ -1791,28 +1751,14 @@ gfc_match_oacc_update (void) match gfc_match_oacc_enter_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_ENTER_DATA_CLAUSES, 0, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_ENTER_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_ENTER_DATA, OACC_ENTER_DATA_CLAUSES, 0); } match gfc_match_oacc_exit_data (void) { - gfc_omp_clauses *c; - if (gfc_match_omp_clauses (&c, OACC_EXIT_DATA_CLAUSES, 0, false, false, true) - != MATCH_YES) - return MATCH_ERROR; - - new_st.op = EXEC_OACC_EXIT_DATA; - new_st.ext.omp_clauses = c; - return MATCH_YES; + return match_acc (EXEC_OACC_EXIT_DATA, OACC_EXIT_DATA_CLAUSES, 0); }