Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808646/?format=api
{ "id": 808646, "url": "http://patchwork.ozlabs.org/api/patches/808646/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20170901113627.GG2323@tucnak/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170901113627.GG2323@tucnak>", "list_archive_url": null, "date": "2017-09-01T11:36:27", "name": "[committed] Recognize #pragma omp ordered simd with -fopenmp-simd (PR c/81887)", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "aad17c506bf54378519cc5cc73d4204710b16d18", "submitter": { "id": 671, "url": "http://patchwork.ozlabs.org/api/people/671/?format=api", "name": "Jakub Jelinek", "email": "jakub@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20170901113627.GG2323@tucnak/mbox/", "series": [ { "id": 1007, "url": "http://patchwork.ozlabs.org/api/series/1007/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=1007", "date": "2017-09-01T11:36:27", "name": "[committed] Recognize #pragma omp ordered simd with -fopenmp-simd (PR c/81887)", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1007/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808646/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808646/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461265-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461265-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"LAQXZbsl\"; dkim-atps=neutral", "sourceware.org; auth=none", "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkHJX1HSKz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 1 Sep 2017 21:36:42 +1000 (AEST)", "(qmail 6336 invoked by alias); 1 Sep 2017 11:36:34 -0000", "(qmail 6322 invoked by uid 89); 1 Sep 2017 11:36:33 -0000", "from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 11:36:31 +0000", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.15])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id AA92EC0467C4\tfor\n\t<gcc-patches@gcc.gnu.org>; Fri, 1 Sep 2017 11:36:30 +0000 (UTC)", "from tucnak.zalov.cz (ovpn-116-33.ams2.redhat.com\n\t[10.36.116.33])\tby smtp.corp.redhat.com (Postfix) with ESMTPS\n\tid 521B996149\tfor <gcc-patches@gcc.gnu.org>;\n\tFri, 1 Sep 2017 11:36:30 +0000 (UTC)", "from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v81BaSqa007415\tfor\n\t<gcc-patches@gcc.gnu.org>; Fri, 1 Sep 2017 13:36:28 +0200", "(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v81BaRoI007414\tfor gcc-patches@gcc.gnu.org;\n\tFri, 1 Sep 2017 13:36:27 +0200" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:reply-to:mime-version:content-type;\n\tq=dns; s=default; b=taoA8iUcgFbKxA4poLe35DMf936qQxFZl/owrbwMRdQ\n\twExhCCPvLtz2eVhd0CzcFVowTZAx94VqBHgsTNRTn/zPiUxwOBMqhIzdTYJ0aoFT\n\tcs4C8Hg/H3VrsT3DK0jGfLli16GgnyoL/nUy6VvE13Kz45jrv+HWkLBOz15bQl1I\n\t=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:reply-to:mime-version:content-type;\n\ts=default; bh=l0/MbjZjq6TAXmz3EGzl/x0HntM=; b=LAQXZbslKz1o1TrZj\n\tdv0Yc8SzwtXAueav+XaRP0OHndUPs6nH24pdHCMqQonLET3/Kfi552DsIvjlE18e\n\tlOxPpgRLzPgzj8Nht2hX8Kmr5UKCrKsykWQ4FuBuupQjqXBxNeWsiogsv0D2tVe3\n\tyhx0XC9LRj0y3ZPOxnX8yRts/w=", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "mx1.redhat.com", "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com AA92EC0467C4", "Date": "Fri, 1 Sep 2017 13:36:27 +0200", "From": "Jakub Jelinek <jakub@redhat.com>", "To": "gcc-patches@gcc.gnu.org", "Subject": "[committed] Recognize #pragma omp ordered simd with -fopenmp-simd\n\t(PR c/81887)", "Message-ID": "<20170901113627.GG2323@tucnak>", "Reply-To": "Jakub Jelinek <jakub@redhat.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "User-Agent": "Mutt/1.7.1 (2016-10-04)", "X-IsSubscribed": "yes" }, "content": "Hi!\n\n#pragma omp ordered simd is significant even for -fopenmp-simd mode,\nif it is ignored, then some valid code might be miscompiled,\ntherefore this patch parses it with that option too.\n#pragma omp ordered threads simd\nor\n#pragma omp ordered simd threads\nis treated like #pragma omp ordered simd, while\n#pragma omp ordered\n#pragma omp ordered threads\nor\n#pragma omp ordered depend(...)\nis ignored. Bootstrapped/regtested on x86_64-linux and i686-linux,\ncommitted to trunk so far.\n\n2017-09-01 Jakub Jelinek <jakub@redhat.com>\n\n\tPR c/81887\nc-family/\n\t* c-pragma.c (omp_pragmas): Move \"ordered\" entry from here to ...\n\t(omp_pragmas_simd): ... here.\n\t* c-omp.c (c_finish_omp_ordered): If clauses isn't simd clause alone,\n\tcreate new clauses list containing just simd clause.\nc/\n\t* c-parser.c (c_parser_omp_ordered): Handle -fopenmp-simd.\ncp/\n\t* parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.\nfortran/\n\t* parse.c (decode_omp_directive): Use matchs instead of matcho for\n\tend ordered and ordered directives, except for ordered depend. For\n\t-fopenmp-simd and ordered depend, reject the stmt.\n\t* trans-openmp.c (gfc_trans_omp_ordered): For -fopenmp-simd ignore\n\tthreads clause and if simd clause isn't present, just translate the\n\tbody.\ntestsuite/\n\t* c-c++-common/gomp/pr81887.c: New test.\n\t* gfortran.dg/gomp/pr81887.f90: New test.\n\n\n\tJakub", "diff": "--- gcc/c-family/c-pragma.c.jj\t2017-08-29 19:03:08.000000000 +0200\n+++ gcc/c-family/c-pragma.c\t2017-08-29 21:04:22.140967018 +0200\n@@ -1277,7 +1277,6 @@ static const struct omp_pragma_def omp_p\n { \"end\", PRAGMA_OMP_END_DECLARE_TARGET },\n { \"flush\", PRAGMA_OMP_FLUSH },\n { \"master\", PRAGMA_OMP_MASTER },\n- { \"ordered\", PRAGMA_OMP_ORDERED },\n { \"section\", PRAGMA_OMP_SECTION },\n { \"sections\", PRAGMA_OMP_SECTIONS },\n { \"single\", PRAGMA_OMP_SINGLE },\n@@ -1291,6 +1290,7 @@ static const struct omp_pragma_def omp_p\n { \"declare\", PRAGMA_OMP_DECLARE },\n { \"distribute\", PRAGMA_OMP_DISTRIBUTE },\n { \"for\", PRAGMA_OMP_FOR },\n+ { \"ordered\", PRAGMA_OMP_ORDERED },\n { \"parallel\", PRAGMA_OMP_PARALLEL },\n { \"simd\", PRAGMA_OMP_SIMD },\n { \"target\", PRAGMA_OMP_TARGET },\n--- gcc/c-family/c-omp.c.jj\t2017-08-10 02:31:19.000000000 +0200\n+++ gcc/c-family/c-omp.c\t2017-08-29 21:28:34.030112023 +0200\n@@ -116,6 +116,10 @@ c_finish_omp_ordered (location_t loc, tr\n tree t = make_node (OMP_ORDERED);\n TREE_TYPE (t) = void_type_node;\n OMP_ORDERED_BODY (t) = stmt;\n+ if (!flag_openmp\t/* flag_openmp_simd */\n+ && (OMP_CLAUSE_CODE (clauses) != OMP_CLAUSE_SIMD\n+\t || OMP_CLAUSE_CHAIN (clauses)))\n+ clauses = build_omp_clause (loc, OMP_CLAUSE_SIMD);\n OMP_ORDERED_CLAUSES (t) = clauses;\n SET_EXPR_LOCATION (t, loc);\n return add_stmt (t);\n--- gcc/c/c-parser.c.jj\t2017-08-29 19:03:08.000000000 +0200\n+++ gcc/c/c-parser.c\t2017-08-29 21:08:48.749059955 +0200\n@@ -15647,6 +15647,11 @@ c_parser_omp_ordered (c_parser *parser,\n \n if (!strcmp (\"depend\", p))\n \t{\n+\t if (!flag_openmp)\t/* flag_openmp_simd */\n+\t {\n+\t c_parser_skip_to_pragma_eol (parser, false);\n+\t return false;\n+\t }\n \t if (context == pragma_stmt)\n \t {\n \t error_at (loc,\n@@ -15667,6 +15672,11 @@ c_parser_omp_ordered (c_parser *parser,\n \n tree clauses = c_parser_omp_all_clauses (parser, OMP_ORDERED_CLAUSE_MASK,\n \t\t\t\t\t \"#pragma omp ordered\");\n+\n+ if (!flag_openmp\t/* flag_openmp_simd */\n+ && omp_find_clause (clauses, OMP_CLAUSE_SIMD) == NULL_TREE)\n+ return false;\n+\n c_finish_omp_ordered (loc, clauses,\n \t\t\tc_parser_omp_structured_block (parser, if_p));\n return true;\n--- gcc/cp/parser.c.jj\t2017-08-29 19:03:09.000000000 +0200\n+++ gcc/cp/parser.c\t2017-08-29 21:19:36.816368363 +0200\n@@ -35406,6 +35406,11 @@ cp_parser_omp_ordered (cp_parser *parser\n \n if (strcmp (p, \"depend\") == 0)\n \t{\n+\t if (!flag_openmp)\t/* flag_openmp_simd */\n+\t {\n+\t cp_parser_skip_to_pragma_eol (parser, pragma_tok);\n+\t return false;\n+\t }\n \t if (context == pragma_stmt)\n \t {\n \t error_at (pragma_tok->location, \"%<#pragma omp ordered%> with \"\n@@ -35426,6 +35431,11 @@ cp_parser_omp_ordered (cp_parser *parser\n tree clauses\n = cp_parser_omp_all_clauses (parser, OMP_ORDERED_CLAUSE_MASK,\n \t\t\t\t \"#pragma omp ordered\", pragma_tok);\n+\n+ if (!flag_openmp /* flag_openmp_simd */\n+ && omp_find_clause (clauses, OMP_CLAUSE_SIMD) == NULL_TREE)\n+ return false;\n+\n c_finish_omp_ordered (loc, clauses,\n \t\t\tcp_parser_omp_structured_block (parser, if_p));\n return true;\n--- gcc/fortran/parse.c.jj\t2017-08-07 18:50:09.000000000 +0200\n+++ gcc/fortran/parse.c\t2017-08-30 00:29:00.795203626 +0200\n@@ -875,7 +875,7 @@ decode_omp_directive (void)\n matcho (\"end do\", gfc_match_omp_end_nowait, ST_OMP_END_DO);\n matchs (\"end simd\", gfc_match_omp_eos, ST_OMP_END_SIMD);\n matcho (\"end master\", gfc_match_omp_eos, ST_OMP_END_MASTER);\n- matcho (\"end ordered\", gfc_match_omp_eos, ST_OMP_END_ORDERED);\n+ matchs (\"end ordered\", gfc_match_omp_eos, ST_OMP_END_ORDERED);\n matchs (\"end parallel do simd\", gfc_match_omp_eos,\n \t ST_OMP_END_PARALLEL_DO_SIMD);\n matcho (\"end parallel do\", gfc_match_omp_eos, ST_OMP_END_PARALLEL_DO);\n@@ -929,14 +929,16 @@ decode_omp_directive (void)\n matcho (\"master\", gfc_match_omp_master, ST_OMP_MASTER);\n break;\n case 'o':\n- if (flag_openmp && gfc_match (\"ordered depend (\") == MATCH_YES)\n+ if (gfc_match (\"ordered depend (\") == MATCH_YES)\n \t{\n \t gfc_current_locus = old_locus;\n+\t if (!flag_openmp)\n+\t break;\n \t matcho (\"ordered\", gfc_match_omp_ordered_depend,\n \t\t ST_OMP_ORDERED_DEPEND);\n \t}\n else\n-\tmatcho (\"ordered\", gfc_match_omp_ordered, ST_OMP_ORDERED);\n+\tmatchs (\"ordered\", gfc_match_omp_ordered, ST_OMP_ORDERED);\n break;\n case 'p':\n matchs (\"parallel do simd\", gfc_match_omp_parallel_do_simd,\n--- gcc/fortran/trans-openmp.c.jj\t2017-06-12 09:49:51.000000000 +0200\n+++ gcc/fortran/trans-openmp.c\t2017-08-29 21:59:09.733541297 +0200\n@@ -3925,6 +3925,12 @@ gfc_trans_omp_master (gfc_code *code)\n static tree\n gfc_trans_omp_ordered (gfc_code *code)\n {\n+ if (!flag_openmp)\n+ {\n+ if (!code->ext.omp_clauses->simd)\n+\treturn gfc_trans_code (code->block ? code->block->next : NULL);\n+ code->ext.omp_clauses->threads = 0;\n+ }\n tree omp_clauses = gfc_trans_omp_clauses (NULL, code->ext.omp_clauses,\n \t\t\t\t\t code->loc);\n return build2_loc (input_location, OMP_ORDERED, void_type_node,\n--- gcc/testsuite/c-c++-common/gomp/pr81887.c.jj\t2017-08-29 23:53:28.738961489 +0200\n+++ gcc/testsuite/c-c++-common/gomp/pr81887.c\t2017-08-29 23:56:26.040142148 +0200\n@@ -0,0 +1,61 @@\n+/* PR c/81887 */\n+/* { dg-do compile } */\n+/* { dg-options \"-fno-openmp -fopenmp-simd -fdump-tree-gimple\" } */\n+/* { dg-final { scan-tree-dump-times \"#pragma omp simd\" 2 \"gimple\" } } */\n+/* { dg-final { scan-tree-dump-times \"#pragma omp ordered simd\\[ \\t]*\\[\\n\\r]\" 2 \"gimple\" } } */\n+/* { dg-final { scan-tree-dump-times \"#pragma omp\" 4 \"gimple\" } } */\n+\n+void\n+f1 (int *x)\n+{\n+ int i;\n+#pragma omp simd\n+ for (i = 0; i < 100; i++)\n+ #pragma omp ordered simd\n+ x[i / 2] = i;\n+}\n+\n+void\n+f2 (int *x)\n+{\n+ int i;\n+#pragma omp parallel for simd ordered\n+ for (i = 0; i < 100; i++)\n+ #pragma omp ordered threads simd\n+ x[i / 2] = i;\n+}\n+\n+void\n+f3 (int *x)\n+{\n+ int i;\n+#pragma omp parallel for ordered\n+ for (i = 0; i < 100; i++)\n+ #pragma omp ordered\n+ x[i / 2] = i;\n+}\n+\n+void\n+f4 (int *x)\n+{\n+ int i;\n+#pragma omp parallel for ordered\n+ for (i = 0; i < 100; i++)\n+ #pragma omp ordered threads\n+ x[i / 2] = i;\n+}\n+\n+void\n+f5 (int n, int ***x)\n+{\n+ int i, j, k;\n+#pragma omp parallel for ordered(3)\n+ for (i=0; i < n; i++)\n+ for (j=0; j < n; ++j)\n+ for (k=0; k < n; ++k)\n+\t{\n+#pragma omp ordered depend(sink:i-8,j-2,k+2) depend(sink:i, j-1,k) depend(sink:i-4,j-3,k+6) depend(sink:i-6,j-4,k-6)\n+\t x[i][j][k] = i + j + k;\n+#pragma omp ordered depend(source)\n+\t}\n+}\n--- gcc/testsuite/gfortran.dg/gomp/pr81887.f90.jj\t2017-08-30 00:29:21.213994159 +0200\n+++ gcc/testsuite/gfortran.dg/gomp/pr81887.f90\t2017-08-30 00:25:31.000000000 +0200\n@@ -0,0 +1,61 @@\n+! PR c/81887\n+! { dg-do compile }\n+! { dg-options \"-fno-openmp -fopenmp-simd -fdump-tree-gimple\" }\n+! { dg-final { scan-tree-dump-times \"#pragma omp simd\" 2 \"gimple\" } }\n+! { dg-final { scan-tree-dump-times \"#pragma omp ordered simd\\[ \\t]*\\[\\n\\r]\" 2 \"gimple\" } }\n+! { dg-final { scan-tree-dump-times \"#pragma omp\" 4 \"gimple\" } }\n+\n+subroutine f1 (x)\n+ integer :: i, x(100)\n+ !$omp simd\n+ do i = 2, 101\n+ !$omp ordered simd\n+ x(i / 2) = i\n+ !$omp end ordered\n+ end do\n+end subroutine\n+\n+subroutine f2 (x)\n+ integer :: i, x(100)\n+ !$omp parallel do simd ordered\n+ do i = 2, 101\n+ !$omp ordered threads simd\n+ x(i / 2) = i\n+ !$omp end ordered\n+ end do\n+end subroutine\n+\n+subroutine f3 (x)\n+ integer :: i, x(100)\n+ !$omp parallel do ordered\n+ do i = 2, 101\n+ !$omp ordered\n+ x(i / 2) = i\n+ !$omp end ordered\n+ end do\n+end subroutine\n+\n+subroutine f4 (x)\n+ integer :: i, x(100)\n+ !$omp parallel do ordered\n+ do i = 2, 101\n+ !$omp ordered threads\n+ x(i / 2) = i\n+ !$omp end ordered\n+ end do\n+end subroutine\n+\n+subroutine f5(x, n)\n+ integer :: i, j, k, n, x(100,100,100)\n+ !$omp parallel do ordered(3)\n+ do i = 1, n\n+ do j = 1, n\n+ do k = 1, n\n+\t!$omp ordered depend(sink:i-8,j-2,k+2) depend(sink:i, j-1,k) depend(sink:i-4,j-3,k+6) depend(sink:i-6,j-4,k-6)\n+\tx(i, j, k) = i + j + k\n+\t!$omp ordered depend(source)\n+ end do\n+ end do\n+ end do\n+ !$omp end parallel do\n+end subroutine\n", "prefixes": [ "committed" ] }