From patchwork Fri Dec 15 09:06:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 849058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-469300-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Uk6oZHJw"; dkim-atps=neutral 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 3yyl2F1WRGz9t2W for ; Fri, 15 Dec 2017 20:07:48 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=ibLfZmGCI5PmoyzyY emJE9JVkpEmFi9cEPhhVZHVYzqmZljvK6iNcEIKOxyXNddqbabWDdaJiGoXZgQyW 2gYD4UdtaHMefAsaDwx689yvC0Y5kZRk91Wz+1VbgvZqYk225tRbaieHoMoumytd 7lr0HALEoodQD6jdbUHrgrnMgc= 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 :subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=Ng0oyG0p02iYqHphgk6IHPC vAUE=; b=Uk6oZHJw0y4UvwKV4YVy4JfShhuct46BwaA3HCZV//Qnsyv7U+vKpHH LT2eGeLZ/0sSTmdRPS01WLjF4jwJygD2TYUSZ2wso4f+gJ+GgFh/RvxytL0Z43S7 KhSiuVEkUyfM/GpeOKRs5lHUJoysmL04tiRzmHCziItANUN0rYiY= Received: (qmail 117715 invoked by alias); 15 Dec 2017 09:07:02 -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 117661 invoked by uid 89); 15 Dec 2017 09:07:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=ut, tt, sb, *C 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; Fri, 15 Dec 2017 09:06:31 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1ePlwo-0003pW-NC from Tom_deVries@mentor.com ; Fri, 15 Dec 2017 01:06:28 -0800 Received: from [172.30.72.115] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 15 Dec 2017 09:06:21 +0000 Subject: [PATCH, libgomp, testsuite] Move tests to libgomp.c-c++-common To: Jakub Jelinek CC: GCC Patches , "Schwinge, Thomas" References: <8d91b179-6873-2988-529b-705e123010cf@mentor.com> <20170914105503.GH1701@tucnak> <1505417653837.14909@mentor.com> <20170914193841.GL1701@tucnak> From: Tom de Vries Message-ID: Date: Fri, 15 Dec 2017 10:06:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20170914193841.GL1701@tucnak> X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) [ was: Re: [PATCH, PR81844] Fix condition folding in c_parser_omp_for_loop ] On 09/14/2017 09:38 PM, Jakub Jelinek wrote: > On Thu, Sep 14, 2017 at 07:34:14PM +0000, de Vries, Tom wrote: > >> --- a/libgomp/testsuite/libgomp.c++/c++.exp >> +++ b/libgomp/testsuite/libgomp.c++/c++.exp >> @@ -22,6 +22,11 @@ dg-init >> # Turn on OpenMP. >> lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" >> >> +# Switch into C++ mode. Otherwise, the libgomp.c-c++-common/*.c >> +# files would be compiled as C files. >> +set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST" >> +set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++" >> + >> set blddir [lookfor_file [get_multilibs] libgomp] >> >> >> @@ -47,7 +52,9 @@ if { $blddir != "" } { >> >> if { $lang_test_file_found } { >> # Gather a list of all tests. >> - set tests [lsort [find $srcdir/$subdir *.C]] >> + set tests [lsort [concat \ >> + [find $srcdir/$subdir *.C] \ >> + [find $srcdir/$subdir/../libgomp.c-c++-common *.c]]] >> >> if { $blddir != "" } { >> set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" > > I don't see SAVE_GCC_UNDER_TEST being used anywhere after it is set. > Did you mean to set GCC_UNDER_TEST back to SAVE_GCC_UNDER_TEST at the end of > c++.exp? > libgomp.oacc-c++/c++.exp has: > # See above. > set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST" > > Otherwise LGTM, thanks. Hi, now that we have libgomp.c-c++-common, this patch moves tests from libgomp.c to libgomp.c-c++-common and removes the corresponding libgomp.c++ tests that have been made redundant. Tested on x86_64, no issues found. OK for trunk? Thanks, - Tom [ For reference, the git commit output related to renaming: rename {libgomp.c => libgomp.c-c++-common}/atomic-18.c (100%) rename {libgomp.c => libgomp.c-c++-common}/cancel-taskgroup-2.c (100%) rename {libgomp.c => libgomp.c-c++-common}/for-1.c (82%) rename {libgomp.c => libgomp.c-c++-common}/for-1.h (100%) rename {libgomp.c => libgomp.c-c++-common}/for-2.c (87%) rename {libgomp.c => libgomp.c-c++-common}/for-2.h (100%) rename {libgomp.c => libgomp.c-c++-common}/for-3.c (95%) rename {libgomp.c => libgomp.c-c++-common}/for-4.c (84%) rename {libgomp.c => libgomp.c-c++-common}/for-5.c (96%) rename {libgomp.c => libgomp.c-c++-common}/for-6.c (95%) rename {libgomp.c => libgomp.c-c++-common}/loop-13.c (100%) rename {libgomp.c => libgomp.c-c++-common}/loop-14.c (100%) rename {libgomp.c => libgomp.c-c++-common}/loop-15.c (100%) rename {libgomp.c => libgomp.c-c++-common}/monotonic-1.c (100%) rename {libgomp.c => libgomp.c-c++-common}/monotonic-2.c (100%) rename {libgomp.c => libgomp.c-c++-common}/nonmonotonic-1.c (100%) rename {libgomp.c => libgomp.c-c++-common}/nonmonotonic-2.c (100%) rename {libgomp.c => libgomp.c-c++-common}/ordered-4.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr45784.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr64824.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr64868.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-1.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-2.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-3.c (96%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-4.c (97%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-5.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-6.c (96%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-7.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-8.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr66199-9.c (100%) rename {libgomp.c => libgomp.c-c++-common}/pr69389.c (100%) rename {libgomp.c => libgomp.c-c++-common}/simd-14.c (100%) rename {libgomp.c => libgomp.c-c++-common}/simd-15.c (100%) rename {libgomp.c => libgomp.c-c++-common}/simd-16.c (96%) rename {libgomp.c => libgomp.c-c++-common}/simd-17.c (96%) rename {libgomp.c => libgomp.c-c++-common}/target-1.c (100%) rename {libgomp.c => libgomp.c-c++-common}/target-10.c (100%) rename {libgomp.c => libgomp.c-c++-common}/target-13.c (100%) rename {libgomp.c => libgomp.c-c++-common}/target-2.c (100%) rename {libgomp.c => libgomp.c-c++-common}/taskgroup-1.c (100%) rename {libgomp.c => libgomp.c-c++-common}/taskloop-1.c (89%) rename {libgomp.c => libgomp.c-c++-common}/taskloop-2.c (97%) rename {libgomp.c => libgomp.c-c++-common}/taskloop-3.c (95%) rename {libgomp.c => libgomp.c-c++-common}/taskloop-4.c (100%) rename {libgomp.c => libgomp.c-c++-common}/udr-1.c (100%) ] Move tests to libgomp.c-c++-common 2017-12-14 Tom de Vries * testsuite/libgomp.c++/udr-9.C: Update. * testsuite/libgomp.c++/atomic-16.C: Remove. * testsuite/libgomp.c++/cancel-taskgroup-2.C: Remove. * testsuite/libgomp.c++/loop-13.C: Remove. * testsuite/libgomp.c++/loop-14.C: Remove. * testsuite/libgomp.c++/loop-15.C: Remove. * testsuite/libgomp.c++/monotonic-1.C: Remove. * testsuite/libgomp.c++/monotonic-2.C: Remove. * testsuite/libgomp.c++/nonmonotonic-1.C: Remove. * testsuite/libgomp.c++/nonmonotonic-2.C: Remove. * testsuite/libgomp.c++/ordered-1.C: Remove. * testsuite/libgomp.c++/pr45784.C: Remove. * testsuite/libgomp.c++/pr64824.C: Remove. * testsuite/libgomp.c++/pr64868.C: Remove. * testsuite/libgomp.c++/pr66199-1.C: Remove. * testsuite/libgomp.c++/pr66199-2.C: Remove. * testsuite/libgomp.c++/pr66199-3.C: Remove. * testsuite/libgomp.c++/pr66199-4.C: Remove. * testsuite/libgomp.c++/pr66199-5.C: Remove. * testsuite/libgomp.c++/pr66199-6.C: Remove. * testsuite/libgomp.c++/pr66199-7.C: Remove. * testsuite/libgomp.c++/pr66199-8.C: Remove. * testsuite/libgomp.c++/pr66199-9.C: Remove. * testsuite/libgomp.c++/pr69389.C: Remove. * testsuite/libgomp.c++/simd10.C: Remove. * testsuite/libgomp.c++/simd11.C: Remove. * testsuite/libgomp.c++/simd12.C: Remove. * testsuite/libgomp.c++/simd13.C: Remove. * testsuite/libgomp.c++/target-1.C: Remove. * testsuite/libgomp.c++/target-3.C: Remove. * testsuite/libgomp.c++/target-4.C: Remove. * testsuite/libgomp.c++/target-5.C: Remove. * testsuite/libgomp.c++/taskgroup-1.C: Remove. * testsuite/libgomp.c++/taskloop-1.C: Remove. * testsuite/libgomp.c++/taskloop-2.C: Remove. * testsuite/libgomp.c++/taskloop-3.C: Remove. * testsuite/libgomp.c++/taskloop-4.C: Remove. * testsuite/libgomp.c++/udr-9.C: Remove. * testsuite/libgomp.c++/for-10.C: Remove. * testsuite/libgomp.c++/for-11.C: Remove. * testsuite/libgomp.c++/for-12.C: Remove. * testsuite/libgomp.c++/for-13.C: Remove. * testsuite/libgomp.c++/for-14.C: Remove. * testsuite/libgomp.c++/for-9.C: Remove. * testsuite/libgomp.c/atomic-18.c: Move ... * testsuite/libgomp.c-c++-common/atomic-18.c: ... here. * testsuite/libgomp.c/cancel-taskgroup-2.c: Move ... * testsuite/libgomp.c-c++-common/cancel-taskgroup-2.c: here. * testsuite/libgomp.c/loop-13.c: Move ... * testsuite/libgomp.c-c++-common/loop-13.c: ... here. * testsuite/libgomp.c/loop-14.c: Move ... * testsuite/libgomp.c-c++-common/loop-14.c: ... here. * testsuite/libgomp.c/loop-15.c: Remove. * testsuite/libgomp.c-c++-common/loop-15.c: New test. * testsuite/libgomp.c/monotonic-1.c: Move ... * testsuite/libgomp.c-c++-common/monotonic-1.c: ... here. * testsuite/libgomp.c/monotonic-2.c: Move ... * testsuite/libgomp.c-c++-common/monotonic-2.c: ... here. * testsuite/libgomp.c/nonmonotonic-1.c: Move ... * testsuite/libgomp.c-c++-common/nonmonotonic-1.c: ... here. * testsuite/libgomp.c/nonmonotonic-2.c: Move ... * testsuite/libgomp.c-c++-common/nonmonotonic-2.c: ... here. * testsuite/libgomp.c/ordered-4.c: Move ... * testsuite/libgomp.c-c++-common/ordered-4.c: ... here. * testsuite/libgomp.c/pr45784.c: Move ... * testsuite/libgomp.c-c++-common/pr45784.c: ... here. * testsuite/libgomp.c/pr64824.c: Move ... * testsuite/libgomp.c-c++-common/pr64824.c: ... here. * testsuite/libgomp.c/pr64868.c: Move ... * testsuite/libgomp.c-c++-common/pr64868.c: ... here. * testsuite/libgomp.c/pr66199-1.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-1.c: ... here. * testsuite/libgomp.c/pr66199-2.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-2.c: ... here. * testsuite/libgomp.c/pr66199-3.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-3.c: ... here. * testsuite/libgomp.c/pr66199-4.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-4.c: ... here. * testsuite/libgomp.c/pr66199-5.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-5.c: ... here. * testsuite/libgomp.c/pr66199-6.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-6.c: ... here. * testsuite/libgomp.c/pr66199-7.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-7.c: ... here. * testsuite/libgomp.c/pr66199-8.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-8.c: ... here. * testsuite/libgomp.c/pr66199-9.c: Move ... * testsuite/libgomp.c-c++-common/pr66199-9.c: ... here. * testsuite/libgomp.c/pr69389.c: Move ... * testsuite/libgomp.c-c++-common/pr69389.c: ... here. * testsuite/libgomp.c/simd-14.c: Move ... * testsuite/libgomp.c-c++-common/simd-14.c: ... here. * testsuite/libgomp.c/simd-15.c: Move ... * testsuite/libgomp.c-c++-common/simd-15.c: ... here. * testsuite/libgomp.c/simd-16.c: Move ... * testsuite/libgomp.c-c++-common/simd-16.c: ... here. * testsuite/libgomp.c/simd-17.c: Move ... * testsuite/libgomp.c-c++-common/simd-17.c: ... here. * testsuite/libgomp.c/target-1.c: Move ... * testsuite/libgomp.c-c++-common/target-1.c: ... here. * testsuite/libgomp.c/target-10.c: Move ... * testsuite/libgomp.c-c++-common/target-10.c: ... here. * testsuite/libgomp.c/target-13.c: Move ... * testsuite/libgomp.c-c++-common/target-13.c: ... here. * testsuite/libgomp.c/target-2.c: Move ... * testsuite/libgomp.c-c++-common/target-2.c: ... here. * testsuite/libgomp.c/taskgroup-1.c: Move ... * testsuite/libgomp.c-c++-common/taskgroup-1.c: ... here. * testsuite/libgomp.c/taskloop-1.c: Move ... * testsuite/libgomp.c-c++-common/taskloop-1.c: ... here. * testsuite/libgomp.c/taskloop-2.c: Move ... * testsuite/libgomp.c-c++-common/taskloop-2.c: ... here. * testsuite/libgomp.c/taskloop-3.c: Move ... * testsuite/libgomp.c-c++-common/taskloop-3.c: ... here. * testsuite/libgomp.c/taskloop-4.c: Move ... * testsuite/libgomp.c-c++-common/taskloop-4.c: ... here. * testsuite/libgomp.c/udr-1.c: Move ... * testsuite/libgomp.c-c++-common/udr-1.c: ... here. * testsuite/libgomp.c/for-1.c: Move ... * testsuite/libgomp.c-c++-common/for-1.c: ... here. * testsuite/libgomp.c/for-1.h: Move ... * testsuite/libgomp.c-c++-common/for-1.h: ... here. * testsuite/libgomp.c/for-2.c: Move ... * testsuite/libgomp.c-c++-common/for-2.c: ... here. * testsuite/libgomp.c/for-2.h: Move ... * testsuite/libgomp.c-c++-common/for-2.h: ... here. * testsuite/libgomp.c/for-3.c: Move ... * testsuite/libgomp.c-c++-common/for-3.c: ... here. * testsuite/libgomp.c/for-4.c: Move ... * testsuite/libgomp.c-c++-common/for-4.c: ... here. * testsuite/libgomp.c/for-5.c: Move ... * testsuite/libgomp.c-c++-common/for-5.c: ... here. * testsuite/libgomp.c/for-6.c: Move ... * testsuite/libgomp.c-c++-common/for-6.c: ... here. --- libgomp/testsuite/libgomp.c++/atomic-16.C | 4 - libgomp/testsuite/libgomp.c++/cancel-taskgroup-2.C | 4 - libgomp/testsuite/libgomp.c++/for-10.C | 47 ---- libgomp/testsuite/libgomp.c++/for-11.C | 108 ------- libgomp/testsuite/libgomp.c++/for-12.C | 40 --- libgomp/testsuite/libgomp.c++/for-13.C | 151 ---------- libgomp/testsuite/libgomp.c++/for-14.C | 120 -------- libgomp/testsuite/libgomp.c++/for-9.C | 33 --- libgomp/testsuite/libgomp.c++/loop-13.C | 3 - libgomp/testsuite/libgomp.c++/loop-14.C | 3 - libgomp/testsuite/libgomp.c++/loop-15.C | 3 - libgomp/testsuite/libgomp.c++/monotonic-1.C | 3 - libgomp/testsuite/libgomp.c++/monotonic-2.C | 3 - libgomp/testsuite/libgomp.c++/nonmonotonic-1.C | 3 - libgomp/testsuite/libgomp.c++/nonmonotonic-2.C | 3 - libgomp/testsuite/libgomp.c++/ordered-1.C | 1 - libgomp/testsuite/libgomp.c++/pr45784.C | 5 - libgomp/testsuite/libgomp.c++/pr64824.C | 4 - libgomp/testsuite/libgomp.c++/pr64868.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-1.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-2.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-3.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-4.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-5.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-6.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-7.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-8.C | 4 - libgomp/testsuite/libgomp.c++/pr66199-9.C | 4 - libgomp/testsuite/libgomp.c++/pr69389.C | 3 - libgomp/testsuite/libgomp.c++/simd10.C | 5 - libgomp/testsuite/libgomp.c++/simd11.C | 5 - libgomp/testsuite/libgomp.c++/simd12.C | 5 - libgomp/testsuite/libgomp.c++/simd13.C | 5 - libgomp/testsuite/libgomp.c++/target-1.C | 1 - libgomp/testsuite/libgomp.c++/target-3.C | 1 - libgomp/testsuite/libgomp.c++/target-4.C | 3 - libgomp/testsuite/libgomp.c++/target-5.C | 1 - libgomp/testsuite/libgomp.c++/taskgroup-1.C | 1 - libgomp/testsuite/libgomp.c++/taskloop-1.C | 4 - libgomp/testsuite/libgomp.c++/taskloop-2.C | 6 - libgomp/testsuite/libgomp.c++/taskloop-3.C | 4 - libgomp/testsuite/libgomp.c++/taskloop-4.C | 4 - libgomp/testsuite/libgomp.c++/udr-19.C | 2 +- libgomp/testsuite/libgomp.c++/udr-9.C | 3 - libgomp/testsuite/libgomp.c-c++-common/atomic-18.c | 60 ++++ .../libgomp.c-c++-common/cancel-taskgroup-2.c | 37 +++ libgomp/testsuite/libgomp.c-c++-common/for-1.c | 39 +++ libgomp/testsuite/libgomp.c-c++-common/for-1.h | 25 ++ libgomp/testsuite/libgomp.c-c++-common/for-2.c | 53 ++++ libgomp/testsuite/libgomp.c-c++-common/for-2.h | 313 +++++++++++++++++++++ libgomp/testsuite/libgomp.c-c++-common/for-3.c | 114 ++++++++ libgomp/testsuite/libgomp.c-c++-common/for-4.c | 46 +++ libgomp/testsuite/libgomp.c-c++-common/for-5.c | 158 +++++++++++ libgomp/testsuite/libgomp.c-c++-common/for-6.c | 127 +++++++++ libgomp/testsuite/libgomp.c-c++-common/loop-13.c | 253 +++++++++++++++++ libgomp/testsuite/libgomp.c-c++-common/loop-14.c | 253 +++++++++++++++++ libgomp/testsuite/libgomp.c-c++-common/loop-15.c | 253 +++++++++++++++++ .../testsuite/libgomp.c-c++-common/monotonic-1.c | 303 ++++++++++++++++++++ .../testsuite/libgomp.c-c++-common/monotonic-2.c | 11 + .../libgomp.c-c++-common/nonmonotonic-1.c | 53 ++++ .../libgomp.c-c++-common/nonmonotonic-2.c | 10 + libgomp/testsuite/libgomp.c-c++-common/ordered-4.c | 83 ++++++ libgomp/testsuite/libgomp.c-c++-common/pr45784.c | 41 +++ libgomp/testsuite/libgomp.c-c++-common/pr64824.c | 15 + libgomp/testsuite/libgomp.c-c++-common/pr64868.c | 86 ++++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-1.c | 61 ++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-2.c | 57 ++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-3.c | 50 ++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-4.c | 58 ++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-5.c | 66 +++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-6.c | 42 +++ libgomp/testsuite/libgomp.c-c++-common/pr66199-7.c | 66 +++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-8.c | 70 +++++ libgomp/testsuite/libgomp.c-c++-common/pr66199-9.c | 43 +++ libgomp/testsuite/libgomp.c-c++-common/pr69389.c | 124 ++++++++ libgomp/testsuite/libgomp.c-c++-common/simd-14.c | 122 ++++++++ libgomp/testsuite/libgomp.c-c++-common/simd-15.c | 128 +++++++++ libgomp/testsuite/libgomp.c-c++-common/simd-16.c | 67 +++++ libgomp/testsuite/libgomp.c-c++-common/simd-17.c | 73 +++++ libgomp/testsuite/libgomp.c-c++-common/target-1.c | 91 ++++++ libgomp/testsuite/libgomp.c-c++-common/target-10.c | 14 + libgomp/testsuite/libgomp.c-c++-common/target-13.c | 45 +++ libgomp/testsuite/libgomp.c-c++-common/target-2.c | 88 ++++++ .../testsuite/libgomp.c-c++-common/taskgroup-1.c | 83 ++++++ .../testsuite/libgomp.c-c++-common/taskloop-1.c | 47 ++++ .../testsuite/libgomp.c-c++-common/taskloop-2.c | 148 ++++++++++ .../testsuite/libgomp.c-c++-common/taskloop-3.c | 85 ++++++ .../testsuite/libgomp.c-c++-common/taskloop-4.c | 97 +++++++ libgomp/testsuite/libgomp.c-c++-common/udr-1.c | 81 ++++++ libgomp/testsuite/libgomp.c/atomic-18.c | 60 ---- libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c | 37 --- libgomp/testsuite/libgomp.c/for-1.c | 35 --- libgomp/testsuite/libgomp.c/for-1.h | 25 -- libgomp/testsuite/libgomp.c/for-2.c | 49 ---- libgomp/testsuite/libgomp.c/for-2.h | 313 --------------------- libgomp/testsuite/libgomp.c/for-3.c | 110 -------- libgomp/testsuite/libgomp.c/for-4.c | 42 --- libgomp/testsuite/libgomp.c/for-5.c | 154 ---------- libgomp/testsuite/libgomp.c/for-6.c | 123 -------- libgomp/testsuite/libgomp.c/loop-13.c | 253 ----------------- libgomp/testsuite/libgomp.c/loop-14.c | 253 ----------------- libgomp/testsuite/libgomp.c/loop-15.c | 253 ----------------- libgomp/testsuite/libgomp.c/monotonic-1.c | 303 -------------------- libgomp/testsuite/libgomp.c/monotonic-2.c | 11 - libgomp/testsuite/libgomp.c/nonmonotonic-1.c | 53 ---- libgomp/testsuite/libgomp.c/nonmonotonic-2.c | 10 - libgomp/testsuite/libgomp.c/ordered-4.c | 83 ------ libgomp/testsuite/libgomp.c/pr45784.c | 41 --- libgomp/testsuite/libgomp.c/pr64824.c | 15 - libgomp/testsuite/libgomp.c/pr64868.c | 86 ------ libgomp/testsuite/libgomp.c/pr66199-1.c | 61 ---- libgomp/testsuite/libgomp.c/pr66199-2.c | 57 ---- libgomp/testsuite/libgomp.c/pr66199-3.c | 50 ---- libgomp/testsuite/libgomp.c/pr66199-4.c | 58 ---- libgomp/testsuite/libgomp.c/pr66199-5.c | 66 ----- libgomp/testsuite/libgomp.c/pr66199-6.c | 42 --- libgomp/testsuite/libgomp.c/pr66199-7.c | 66 ----- libgomp/testsuite/libgomp.c/pr66199-8.c | 70 ----- libgomp/testsuite/libgomp.c/pr66199-9.c | 43 --- libgomp/testsuite/libgomp.c/pr69389.c | 124 -------- libgomp/testsuite/libgomp.c/simd-14.c | 122 -------- libgomp/testsuite/libgomp.c/simd-15.c | 128 --------- libgomp/testsuite/libgomp.c/simd-16.c | 67 ----- libgomp/testsuite/libgomp.c/simd-17.c | 73 ----- libgomp/testsuite/libgomp.c/target-1.c | 91 ------ libgomp/testsuite/libgomp.c/target-10.c | 14 - libgomp/testsuite/libgomp.c/target-13.c | 45 --- libgomp/testsuite/libgomp.c/target-2.c | 88 ------ libgomp/testsuite/libgomp.c/taskgroup-1.c | 83 ------ libgomp/testsuite/libgomp.c/taskloop-1.c | 46 --- libgomp/testsuite/libgomp.c/taskloop-2.c | 147 ---------- libgomp/testsuite/libgomp.c/taskloop-3.c | 84 ------ libgomp/testsuite/libgomp.c/taskloop-4.c | 97 ------- libgomp/testsuite/libgomp.c/udr-1.c | 81 ------ 134 files changed, 4140 insertions(+), 4742 deletions(-) diff --git a/libgomp/testsuite/libgomp.c++/atomic-16.C b/libgomp/testsuite/libgomp.c++/atomic-16.C deleted file mode 100644 index 432d36d..0000000 --- a/libgomp/testsuite/libgomp.c++/atomic-16.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR c/64824 -// { dg-do run } - -#include "../libgomp.c/atomic-18.c" diff --git a/libgomp/testsuite/libgomp.c++/cancel-taskgroup-2.C b/libgomp/testsuite/libgomp.c++/cancel-taskgroup-2.C deleted file mode 100644 index d4a02e9..0000000 --- a/libgomp/testsuite/libgomp.c++/cancel-taskgroup-2.C +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-do run } -// { dg-set-target-env-var OMP_CANCELLATION "true" } - -#include "../libgomp.c/cancel-taskgroup-2.c" diff --git a/libgomp/testsuite/libgomp.c++/for-10.C b/libgomp/testsuite/libgomp.c++/for-10.C deleted file mode 100644 index c67096a..0000000 --- a/libgomp/testsuite/libgomp.c++/for-10.C +++ /dev/null @@ -1,47 +0,0 @@ -extern "C" void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#define F simd -#define G simd -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F parallel for simd -#define G pf_simd -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#undef SC -#define SC static -#define F for simd -#define G f_simd -#include "../libgomp.c/for-1.h" -#undef F -#undef G -#undef SC - -int -main () -{ - if (test_simd_normal () - || test_pf_simd_static () - || test_pf_simd_static32 () - || test_pf_simd_auto () - || test_pf_simd_guided32 () - || test_pf_simd_runtime () - || test_f_simd_static () - || test_f_simd_static32 () - || test_f_simd_auto () - || test_f_simd_guided32 () - || test_f_simd_runtime ()) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c++/for-11.C b/libgomp/testsuite/libgomp.c++/for-11.C deleted file mode 100644 index 0244e4d..0000000 --- a/libgomp/testsuite/libgomp.c++/for-11.C +++ /dev/null @@ -1,108 +0,0 @@ -extern "C" void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#pragma omp declare target - -#define F distribute -#define G d -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute -#define G d_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute simd -#define G ds -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute simd -#define G ds_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute parallel for -#define G dpf -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F distribute parallel for dist_schedule(static, 128) -#define G dpf_ds128 -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F distribute parallel for simd -#define G dpfs -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F distribute parallel for simd dist_schedule(static, 128) -#define G dpfs_ds128 -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#pragma omp end declare target - -int -main () -{ - int err = 0; - #pragma omp target teams reduction(|:err) - { - err |= test_d_normal (); - err |= test_d_ds128_normal (); - err |= test_ds_normal (); - err |= test_ds_ds128_normal (); - err |= test_dpf_static (); - err |= test_dpf_static32 (); - err |= test_dpf_auto (); - err |= test_dpf_guided32 (); - err |= test_dpf_runtime (); - err |= test_dpf_ds128_static (); - err |= test_dpf_ds128_static32 (); - err |= test_dpf_ds128_auto (); - err |= test_dpf_ds128_guided32 (); - err |= test_dpf_ds128_runtime (); - err |= test_dpfs_static (); - err |= test_dpfs_static32 (); - err |= test_dpfs_auto (); - err |= test_dpfs_guided32 (); - err |= test_dpfs_runtime (); - err |= test_dpfs_ds128_static (); - err |= test_dpfs_ds128_static32 (); - err |= test_dpfs_ds128_auto (); - err |= test_dpfs_ds128_guided32 (); - err |= test_dpfs_ds128_runtime (); - } - if (err) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c++/for-12.C b/libgomp/testsuite/libgomp.c++/for-12.C deleted file mode 100644 index 295b12f..0000000 --- a/libgomp/testsuite/libgomp.c++/for-12.C +++ /dev/null @@ -1,40 +0,0 @@ -extern "C" void abort (void); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#define F taskloop -#define G taskloop -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F taskloop simd -#define G taskloop_simd -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -int -main () -{ - int err = 0; - #pragma omp parallel reduction(|:err) - #pragma omp single - { - if (test_taskloop_normal () - || test_taskloop_simd_normal ()) - err = 1; - } - if (err) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c++/for-13.C b/libgomp/testsuite/libgomp.c++/for-13.C deleted file mode 100644 index ac1601a..0000000 --- a/libgomp/testsuite/libgomp.c++/for-13.C +++ /dev/null @@ -1,151 +0,0 @@ -extern "C" void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#pragma omp declare target - -#define F for -#define G f -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#pragma omp end declare target - -#undef OMPFROM -#undef OMPTO -#define DO_PRAGMA(x) _Pragma (#x) -#define OMPFROM(v) DO_PRAGMA (omp target update from(v)) -#define OMPTO(v) DO_PRAGMA (omp target update to(v)) - -#define F target parallel for -#define G tpf -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F target simd -#define G t_simd -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target parallel for simd -#define G tpf_simd -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F target teams distribute -#define G ttd -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute -#define G ttd_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute simd -#define G ttds -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute simd -#define G ttds_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute parallel for -#define G ttdpf -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F target teams distribute parallel for dist_schedule(static, 128) -#define G ttdpf_ds128 -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F target teams distribute parallel for simd -#define G ttdpfs -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F target teams distribute parallel for simd dist_schedule(static, 128) -#define G ttdpfs_ds128 -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -int -main () -{ - if (test_tpf_static () - || test_tpf_static32 () - || test_tpf_auto () - || test_tpf_guided32 () - || test_tpf_runtime () - || test_t_simd_normal () - || test_tpf_simd_static () - || test_tpf_simd_static32 () - || test_tpf_simd_auto () - || test_tpf_simd_guided32 () - || test_tpf_simd_runtime () - || test_ttd_normal () - || test_ttd_ds128_normal () - || test_ttds_normal () - || test_ttds_ds128_normal () - || test_ttdpf_static () - || test_ttdpf_static32 () - || test_ttdpf_auto () - || test_ttdpf_guided32 () - || test_ttdpf_runtime () - || test_ttdpf_ds128_static () - || test_ttdpf_ds128_static32 () - || test_ttdpf_ds128_auto () - || test_ttdpf_ds128_guided32 () - || test_ttdpf_ds128_runtime () - || test_ttdpfs_static () - || test_ttdpfs_static32 () - || test_ttdpfs_auto () - || test_ttdpfs_guided32 () - || test_ttdpfs_runtime () - || test_ttdpfs_ds128_static () - || test_ttdpfs_ds128_static32 () - || test_ttdpfs_ds128_auto () - || test_ttdpfs_ds128_guided32 () - || test_ttdpfs_ds128_runtime ()) - abort (); -} diff --git a/libgomp/testsuite/libgomp.c++/for-14.C b/libgomp/testsuite/libgomp.c++/for-14.C deleted file mode 100644 index 7738473..0000000 --- a/libgomp/testsuite/libgomp.c++/for-14.C +++ /dev/null @@ -1,120 +0,0 @@ -extern "C" void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#pragma omp declare target - -#define F for -#define G f -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#pragma omp end declare target - -#undef OMPTGT -#undef OMPFROM -#undef OMPTO -#define DO_PRAGMA(x) _Pragma (#x) -#define OMPTGT DO_PRAGMA (omp target) -#define OMPFROM(v) DO_PRAGMA (omp target update from(v)) -#define OMPTO(v) DO_PRAGMA (omp target update to(v)) - -#define F teams distribute -#define G td -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute -#define G td_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute simd -#define G tds -#define S -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute simd -#define G tds_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "../libgomp.c/for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute parallel for -#define G tdpf -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F teams distribute parallel for dist_schedule(static, 128) -#define G tdpf_ds128 -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F teams distribute parallel for simd -#define G tdpfs -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F teams distribute parallel for simd dist_schedule(static, 128) -#define G tdpfs_ds128 -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -int -main () -{ - if (test_td_normal () - || test_td_ds128_normal () - || test_tds_normal () - || test_tds_ds128_normal () - || test_tdpf_static () - || test_tdpf_static32 () - || test_tdpf_auto () - || test_tdpf_guided32 () - || test_tdpf_runtime () - || test_tdpf_ds128_static () - || test_tdpf_ds128_static32 () - || test_tdpf_ds128_auto () - || test_tdpf_ds128_guided32 () - || test_tdpf_ds128_runtime () - || test_tdpfs_static () - || test_tdpfs_static32 () - || test_tdpfs_auto () - || test_tdpfs_guided32 () - || test_tdpfs_runtime () - || test_tdpfs_ds128_static () - || test_tdpfs_ds128_static32 () - || test_tdpfs_ds128_auto () - || test_tdpfs_ds128_guided32 () - || test_tdpfs_ds128_runtime ()) - abort (); -} diff --git a/libgomp/testsuite/libgomp.c++/for-9.C b/libgomp/testsuite/libgomp.c++/for-9.C deleted file mode 100644 index 86b9d93..0000000 --- a/libgomp/testsuite/libgomp.c++/for-9.C +++ /dev/null @@ -1,33 +0,0 @@ -extern "C" void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#define F parallel for -#define G pf -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -#define F for -#define G f -#include "../libgomp.c/for-1.h" -#undef F -#undef G - -int -main () -{ - if (test_pf_static () - || test_pf_static32 () - || test_pf_auto () - || test_pf_guided32 () - || test_pf_runtime () - || test_f_static () - || test_f_static32 () - || test_f_auto () - || test_f_guided32 () - || test_f_runtime ()) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c++/loop-13.C b/libgomp/testsuite/libgomp.c++/loop-13.C deleted file mode 100644 index 31572be..0000000 --- a/libgomp/testsuite/libgomp.c++/loop-13.C +++ /dev/null @@ -1,3 +0,0 @@ -/* { dg-do run } */ - -#include "../libgomp.c/loop-13.c" diff --git a/libgomp/testsuite/libgomp.c++/loop-14.C b/libgomp/testsuite/libgomp.c++/loop-14.C deleted file mode 100644 index ba2856a..0000000 --- a/libgomp/testsuite/libgomp.c++/loop-14.C +++ /dev/null @@ -1,3 +0,0 @@ -/* { dg-do run } */ - -#include "../libgomp.c/loop-14.c" diff --git a/libgomp/testsuite/libgomp.c++/loop-15.C b/libgomp/testsuite/libgomp.c++/loop-15.C deleted file mode 100644 index 9bde48e..0000000 --- a/libgomp/testsuite/libgomp.c++/loop-15.C +++ /dev/null @@ -1,3 +0,0 @@ -/* { dg-do run } */ - -#include "../libgomp.c/loop-15.c" diff --git a/libgomp/testsuite/libgomp.c++/monotonic-1.C b/libgomp/testsuite/libgomp.c++/monotonic-1.C deleted file mode 100644 index 464bed6..0000000 --- a/libgomp/testsuite/libgomp.c++/monotonic-1.C +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-do run } - -#include "../libgomp.c/monotonic-1.c" diff --git a/libgomp/testsuite/libgomp.c++/monotonic-2.C b/libgomp/testsuite/libgomp.c++/monotonic-2.C deleted file mode 100644 index 41eef03..0000000 --- a/libgomp/testsuite/libgomp.c++/monotonic-2.C +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-do run } - -#include "../libgomp.c/monotonic-2.c" diff --git a/libgomp/testsuite/libgomp.c++/nonmonotonic-1.C b/libgomp/testsuite/libgomp.c++/nonmonotonic-1.C deleted file mode 100644 index 678e765..0000000 --- a/libgomp/testsuite/libgomp.c++/nonmonotonic-1.C +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-do run } - -#include "../libgomp.c/nonmonotonic-1.c" diff --git a/libgomp/testsuite/libgomp.c++/nonmonotonic-2.C b/libgomp/testsuite/libgomp.c++/nonmonotonic-2.C deleted file mode 100644 index e230875..0000000 --- a/libgomp/testsuite/libgomp.c++/nonmonotonic-2.C +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-do run } - -#include "../libgomp.c/nonmonotonic-2.c" diff --git a/libgomp/testsuite/libgomp.c++/ordered-1.C b/libgomp/testsuite/libgomp.c++/ordered-1.C deleted file mode 100644 index a1bedd8..0000000 --- a/libgomp/testsuite/libgomp.c++/ordered-1.C +++ /dev/null @@ -1 +0,0 @@ -#include "../libgomp.c/ordered-4.c" diff --git a/libgomp/testsuite/libgomp.c++/pr45784.C b/libgomp/testsuite/libgomp.c++/pr45784.C deleted file mode 100644 index 306246c..0000000 --- a/libgomp/testsuite/libgomp.c++/pr45784.C +++ /dev/null @@ -1,5 +0,0 @@ -// PR c/45784 -// { dg-do run } - -#include "../libgomp.c/pr45784.c" - diff --git a/libgomp/testsuite/libgomp.c++/pr64824.C b/libgomp/testsuite/libgomp.c++/pr64824.C deleted file mode 100644 index 00f23bb..0000000 --- a/libgomp/testsuite/libgomp.c++/pr64824.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR c/64824 -// { dg-do run } - -#include "../libgomp.c/pr64824.c" diff --git a/libgomp/testsuite/libgomp.c++/pr64868.C b/libgomp/testsuite/libgomp.c++/pr64868.C deleted file mode 100644 index 661ec23..0000000 --- a/libgomp/testsuite/libgomp.c++/pr64868.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR c/64868 -// { dg-do run } - -#include "../libgomp.c/pr64868.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-1.C b/libgomp/testsuite/libgomp.c++/pr66199-1.C deleted file mode 100644 index cb86a60..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-1.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-1.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-2.C b/libgomp/testsuite/libgomp.c++/pr66199-2.C deleted file mode 100644 index 1dbccb6..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-2.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-2.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-3.C b/libgomp/testsuite/libgomp.c++/pr66199-3.C deleted file mode 100644 index 871dd44..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-3.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-3.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-4.C b/libgomp/testsuite/libgomp.c++/pr66199-4.C deleted file mode 100644 index bc71a6d..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-4.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-4.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-5.C b/libgomp/testsuite/libgomp.c++/pr66199-5.C deleted file mode 100644 index c7549e8..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-5.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-5.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-6.C b/libgomp/testsuite/libgomp.c++/pr66199-6.C deleted file mode 100644 index 46adbd7..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-6.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-6.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-7.C b/libgomp/testsuite/libgomp.c++/pr66199-7.C deleted file mode 100644 index b03d284..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-7.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-7.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-8.C b/libgomp/testsuite/libgomp.c++/pr66199-8.C deleted file mode 100644 index b998ef6..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-8.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-8.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-9.C b/libgomp/testsuite/libgomp.c++/pr66199-9.C deleted file mode 100644 index 1f8dfa3..0000000 --- a/libgomp/testsuite/libgomp.c++/pr66199-9.C +++ /dev/null @@ -1,4 +0,0 @@ -// PR middle-end/66199 -// { dg-do run } - -#include "../libgomp.c/pr66199-9.c" diff --git a/libgomp/testsuite/libgomp.c++/pr69389.C b/libgomp/testsuite/libgomp.c++/pr69389.C deleted file mode 100644 index 9fcb0ff..0000000 --- a/libgomp/testsuite/libgomp.c++/pr69389.C +++ /dev/null @@ -1,3 +0,0 @@ -// PR c/69389 - -#include "../libgomp.c/pr69389.c" diff --git a/libgomp/testsuite/libgomp.c++/simd10.C b/libgomp/testsuite/libgomp.c++/simd10.C deleted file mode 100644 index 6fab688..0000000 --- a/libgomp/testsuite/libgomp.c++/simd10.C +++ /dev/null @@ -1,5 +0,0 @@ -// { dg-do run } -// { dg-additional-options "-msse2" { target sse2_runtime } } -// { dg-additional-options "-mavx" { target avx_runtime } } - -#include "../libgomp.c/simd-14.c" diff --git a/libgomp/testsuite/libgomp.c++/simd11.C b/libgomp/testsuite/libgomp.c++/simd11.C deleted file mode 100644 index fde2203..0000000 --- a/libgomp/testsuite/libgomp.c++/simd11.C +++ /dev/null @@ -1,5 +0,0 @@ -// { dg-do run } -// { dg-additional-options "-msse2" { target sse2_runtime } } -// { dg-additional-options "-mavx" { target avx_runtime } } - -#include "../libgomp.c/simd-15.c" diff --git a/libgomp/testsuite/libgomp.c++/simd12.C b/libgomp/testsuite/libgomp.c++/simd12.C deleted file mode 100644 index 7596cad..0000000 --- a/libgomp/testsuite/libgomp.c++/simd12.C +++ /dev/null @@ -1,5 +0,0 @@ -// { dg-do run } -// { dg-additional-options "-msse2" { target sse2_runtime } } -// { dg-additional-options "-mavx" { target avx_runtime } } - -#include "../libgomp.c/simd-16.c" diff --git a/libgomp/testsuite/libgomp.c++/simd13.C b/libgomp/testsuite/libgomp.c++/simd13.C deleted file mode 100644 index 67a0f70..0000000 --- a/libgomp/testsuite/libgomp.c++/simd13.C +++ /dev/null @@ -1,5 +0,0 @@ -// { dg-do run } -// { dg-additional-options "-msse2" { target sse2_runtime } } -// { dg-additional-options "-mavx" { target avx_runtime } } - -#include "../libgomp.c/simd-17.c" diff --git a/libgomp/testsuite/libgomp.c++/target-1.C b/libgomp/testsuite/libgomp.c++/target-1.C deleted file mode 100644 index 3cf01d9..0000000 --- a/libgomp/testsuite/libgomp.c++/target-1.C +++ /dev/null @@ -1 +0,0 @@ -#include "../libgomp.c/target-1.c" diff --git a/libgomp/testsuite/libgomp.c++/target-3.C b/libgomp/testsuite/libgomp.c++/target-3.C deleted file mode 100644 index 2e4586f..0000000 --- a/libgomp/testsuite/libgomp.c++/target-3.C +++ /dev/null @@ -1 +0,0 @@ -#include "../libgomp.c/target-2.c" diff --git a/libgomp/testsuite/libgomp.c++/target-4.C b/libgomp/testsuite/libgomp.c++/target-4.C deleted file mode 100644 index 9d1b576..0000000 --- a/libgomp/testsuite/libgomp.c++/target-4.C +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-do run } - -#include "../libgomp.c/target-10.c" diff --git a/libgomp/testsuite/libgomp.c++/target-5.C b/libgomp/testsuite/libgomp.c++/target-5.C deleted file mode 100644 index 6639be3..0000000 --- a/libgomp/testsuite/libgomp.c++/target-5.C +++ /dev/null @@ -1 +0,0 @@ -#include "../libgomp.c/target-13.c" diff --git a/libgomp/testsuite/libgomp.c++/taskgroup-1.C b/libgomp/testsuite/libgomp.c++/taskgroup-1.C deleted file mode 100644 index 5129896..0000000 --- a/libgomp/testsuite/libgomp.c++/taskgroup-1.C +++ /dev/null @@ -1 +0,0 @@ -#include "../libgomp.c/taskgroup-1.c" diff --git a/libgomp/testsuite/libgomp.c++/taskloop-1.C b/libgomp/testsuite/libgomp.c++/taskloop-1.C deleted file mode 100644 index 7fc6e46..0000000 --- a/libgomp/testsuite/libgomp.c++/taskloop-1.C +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-do run } -// { dg-options "-O2" } - -#include "../libgomp.c/taskloop-1.c" diff --git a/libgomp/testsuite/libgomp.c++/taskloop-2.C b/libgomp/testsuite/libgomp.c++/taskloop-2.C deleted file mode 100644 index 67a0e92..0000000 --- a/libgomp/testsuite/libgomp.c++/taskloop-2.C +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-do run } -// { dg-options "-O2" } -// { dg-additional-options "-msse2" { target sse2_runtime } } -// { dg-additional-options "-mavx" { target avx_runtime } } - -#include "../libgomp.c/taskloop-2.c" diff --git a/libgomp/testsuite/libgomp.c++/taskloop-3.C b/libgomp/testsuite/libgomp.c++/taskloop-3.C deleted file mode 100644 index c08a045..0000000 --- a/libgomp/testsuite/libgomp.c++/taskloop-3.C +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-do run } -// { dg-options "-O2" } - -#include "../libgomp.c/taskloop-3.c" diff --git a/libgomp/testsuite/libgomp.c++/taskloop-4.C b/libgomp/testsuite/libgomp.c++/taskloop-4.C deleted file mode 100644 index 3783717..0000000 --- a/libgomp/testsuite/libgomp.c++/taskloop-4.C +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-do run } -// { dg-options "-O2" } - -#include "../libgomp.c/taskloop-4.c" diff --git a/libgomp/testsuite/libgomp.c++/udr-19.C b/libgomp/testsuite/libgomp.c++/udr-19.C index 40d2eb9..14d2764 100644 --- a/libgomp/testsuite/libgomp.c++/udr-19.C +++ b/libgomp/testsuite/libgomp.c++/udr-19.C @@ -1,4 +1,4 @@ // { dg-do run } // { dg-additional-options "-std=c++11" } -#include "udr-9.C" +#include "../libgomp.c-c++-common/udr-1.c" diff --git a/libgomp/testsuite/libgomp.c++/udr-9.C b/libgomp/testsuite/libgomp.c++/udr-9.C deleted file mode 100644 index 58fea18..0000000 --- a/libgomp/testsuite/libgomp.c++/udr-9.C +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-do run } - -#include "../libgomp.c/udr-1.c" diff --git a/libgomp/testsuite/libgomp.c-c++-common/atomic-18.c b/libgomp/testsuite/libgomp.c-c++-common/atomic-18.c new file mode 100644 index 0000000..4f7361e --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/atomic-18.c @@ -0,0 +1,60 @@ +/* PR c/64824 */ +/* { dg-do run } */ + +void +f1 (void) +{ + short a; + short b = 1; + int c = 3; +#pragma omp atomic capture + a = b = c << b; + if (b != 6 || a != 6) + __builtin_abort (); +} + +void +f2 (void) +{ + short a; + short b = 1; + int c = 3; +#pragma omp atomic capture + a = b = c + b; + if (b != 4 || a != 4) + __builtin_abort (); +} + +void +f3 (void) +{ + short a; + short b = 1; + long long int c = 3; +#pragma omp atomic capture + a = b = c + b; + if (b != 4 || a != 4) + __builtin_abort (); +} + +void +f4 (void) +{ + char a; + char b = 1; + long long int c = 3LL; +#pragma omp atomic capture + a = b = c << b; + if (b != 6 || a != 6) + __builtin_abort (); +} + +int +main () +{ + f1 (); + f2 (); + f3 (); + f4 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-2.c b/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-2.c new file mode 100644 index 0000000..c7b8bf7 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-2.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_CANCELLATION "true" } */ + +#include +#include +#include + +int +main () +{ + #pragma omp parallel + #pragma omp taskgroup + #pragma omp task + { + #pragma omp cancel taskgroup + if (omp_get_cancellation ()) + abort (); + } + #pragma omp parallel + { + #pragma omp barrier + #pragma omp single + #pragma omp taskgroup + { + int i; + for (i = 0; i < 50; i++) + #pragma omp task + { + #pragma omp cancellation point taskgroup + usleep (30); + #pragma omp cancel taskgroup if (i > 5) + } + } + usleep (10); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-1.c b/libgomp/testsuite/libgomp.c-c++-common/for-1.c new file mode 100644 index 0000000..d1ebacb --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-1.c @@ -0,0 +1,39 @@ +/* { dg-additional-options "-std=gnu99" {target c } } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); + +#define M(x, y, z) O(x, y, z) +#define O(x, y, z) x ## _ ## y ## _ ## z + +#define F parallel for +#define G pf +#include "for-1.h" +#undef F +#undef G + +#define F for +#define G f +#include "for-1.h" +#undef F +#undef G + +int +main () +{ + if (test_pf_static () + || test_pf_static32 () + || test_pf_auto () + || test_pf_guided32 () + || test_pf_runtime () + || test_f_static () + || test_f_static32 () + || test_f_auto () + || test_f_guided32 () + || test_f_runtime ()) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-1.h b/libgomp/testsuite/libgomp.c-c++-common/for-1.h new file mode 100644 index 0000000..fa82c5b --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-1.h @@ -0,0 +1,25 @@ +#define S +#define N(x) M(x, G, static) +#include "for-2.h" +#undef S +#undef N +#define S schedule(static, 32) +#define N(x) M(x, G, static32) +#include "for-2.h" +#undef S +#undef N +#define S schedule(auto) +#define N(x) M(x, G, auto) +#include "for-2.h" +#undef S +#undef N +#define S schedule(guided, 32) +#define N(x) M(x, G, guided32) +#include "for-2.h" +#undef S +#undef N +#define S schedule(runtime) +#define N(x) M(x, G, runtime) +#include "for-2.h" +#undef S +#undef N diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-2.c b/libgomp/testsuite/libgomp.c-c++-common/for-2.c new file mode 100644 index 0000000..66bb233 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-2.c @@ -0,0 +1,53 @@ +/* { dg-additional-options "-std=gnu99" { target c } } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); + +#define M(x, y, z) O(x, y, z) +#define O(x, y, z) x ## _ ## y ## _ ## z + +#define F simd +#define G simd +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F parallel for simd +#define G pf_simd +#include "for-1.h" +#undef F +#undef G + +#undef SC +#define SC static +#define F for simd +#define G f_simd +#include "for-1.h" +#undef F +#undef G +#undef SC + +int +main () +{ + if (test_simd_normal () + || test_pf_simd_static () + || test_pf_simd_static32 () + || test_pf_simd_auto () + || test_pf_simd_guided32 () + || test_pf_simd_runtime () + || test_f_simd_static () + || test_f_simd_static32 () + || test_f_simd_auto () + || test_f_simd_guided32 () + || test_f_simd_runtime ()) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-2.h b/libgomp/testsuite/libgomp.c-c++-common/for-2.h new file mode 100644 index 0000000..0bd116c --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-2.h @@ -0,0 +1,313 @@ +#ifndef VARS +#define VARS +int a[1500]; +float b[10][15][10]; +__attribute__((noreturn)) void +noreturn (void) +{ + for (;;); +} +#endif +#ifndef SC +#define SC +#endif +#ifndef OMPTGT +#define OMPTGT +#endif +#ifndef OMPTO +#define OMPTO(v) do {} while (0) +#endif +#ifndef OMPFROM +#define OMPFROM(v) do {} while (0) +#endif + +__attribute__((noinline, noclone)) void +N(f0) (void) +{ + int i; + OMPTGT +#pragma omp F S + for (i = 0; i < 1500; i++) + a[i] += 2; +} + +__attribute__((noinline, noclone)) void +N(f1) (void) +{ + OMPTGT +#pragma omp F S + for (unsigned int i = __INT_MAX__; i < 3000U + __INT_MAX__; i += 2) + a[(i - __INT_MAX__) >> 1] -= 2; +} + +__attribute__((noinline, noclone)) void +N(f2) (void) +{ + unsigned long long i; + OMPTGT +#pragma omp F S + for (i = __LONG_LONG_MAX__ + 4500ULL - 27; + i > __LONG_LONG_MAX__ - 27ULL; i -= 3) + a[(i + 26LL - __LONG_LONG_MAX__) / 3] -= 4; +} + +__attribute__((noinline, noclone)) void +N(f3) (long long n1, long long n2, long long s3) +{ + OMPTGT +#pragma omp F S + for (long long i = n1 + 23; i > n2 - 25; i -= s3) + a[i + 48] += 7; +} + +__attribute__((noinline, noclone)) void +N(f4) (void) +{ + unsigned int i; + OMPTGT +#pragma omp F S + for (i = 30; i < 20; i += 2) + a[i] += 10; +} + +__attribute__((noinline, noclone)) void +N(f5) (int n11, int n12, int n21, int n22, int n31, int n32, + int s1, int s2, int s3) +{ + SC int v1, v2, v3; + OMPTGT +#pragma omp F S collapse(3) + for (v1 = n11; v1 < n12; v1 += s1) + for (v2 = n21; v2 < n22; v2 += s2) + for (v3 = n31; v3 < n32; v3 += s3) + b[v1][v2][v3] += 2.5; +} + +__attribute__((noinline, noclone)) void +N(f6) (int n11, int n12, int n21, int n22, long long n31, long long n32, + int s1, int s2, long long int s3) +{ + SC int v1, v2; + SC long long v3; + OMPTGT +#pragma omp F S collapse(3) + for (v1 = n11; v1 > n12; v1 += s1) + for (v2 = n21; v2 > n22; v2 += s2) + for (v3 = n31; v3 > n32; v3 += s3) + b[v1][v2 / 2][v3] -= 4.5; +} + +__attribute__((noinline, noclone)) void +N(f7) (void) +{ + SC unsigned int v1, v3; + SC unsigned long long v2; + OMPTGT +#pragma omp F S collapse(3) + for (v1 = 0; v1 < 20; v1 += 2) + for (v2 = __LONG_LONG_MAX__ + 16ULL; + v2 > __LONG_LONG_MAX__ - 29ULL; v2 -= 3) + for (v3 = 10; v3 > 0; v3--) + b[v1 >> 1][(v2 - __LONG_LONG_MAX__ + 64) / 3 - 12][v3 - 1] += 5.5; +} + +__attribute__((noinline, noclone)) void +N(f8) (void) +{ + SC long long v1, v2, v3; + OMPTGT +#pragma omp F S collapse(3) + for (v1 = 0; v1 < 20; v1 += 2) + for (v2 = 30; v2 < 20; v2++) + for (v3 = 10; v3 < 0; v3--) + b[v1][v2][v3] += 5.5; +} + +__attribute__((noinline, noclone)) void +N(f9) (void) +{ + int i; + OMPTGT +#pragma omp F S + for (i = 20; i < 10; i++) + { + a[i] += 2; + noreturn (); + a[i] -= 4; + } +} + +__attribute__((noinline, noclone)) void +N(f10) (void) +{ + SC int i; + OMPTGT +#pragma omp F S collapse(3) + for (i = 0; i < 10; i++) + for (int j = 10; j < 8; j++) + for (long k = -10; k < 10; k++) + { + b[i][j][k] += 4; + noreturn (); + b[i][j][k] -= 8; + } +} + +__attribute__((noinline, noclone)) void +N(f11) (int n) +{ + int i; + OMPTGT +#pragma omp F S + for (i = 20; i < n; i++) + { + a[i] += 8; + noreturn (); + a[i] -= 16; + } +} + +__attribute__((noinline, noclone)) void +N(f12) (int n) +{ + SC int i; + OMPTGT +#pragma omp F S collapse(3) + for (i = 0; i < 10; i++) + for (int j = n; j < 8; j++) + for (long k = -10; k < 10; k++) + { + b[i][j][k] += 16; + noreturn (); + b[i][j][k] -= 32; + } +} + +__attribute__((noinline, noclone)) void +N(f13) (void) +{ + int *i; + OMPTGT +#pragma omp F S + for (i = a; i < &a[1500]; i++) + i[0] += 2; +} + +__attribute__((noinline, noclone)) void +N(f14) (void) +{ + SC float *i; + OMPTGT +#pragma omp F S collapse(3) + for (i = &b[0][0][0]; i < &b[0][0][10]; i++) + for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10) + for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k) + b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1] + -= 3.5; +} + +__attribute__((noinline, noclone)) int +N(test) (void) +{ + int i, j, k; + for (i = 0; i < 1500; i++) + a[i] = i - 25; + OMPTO (a); + N(f0) (); + OMPFROM (a); + for (i = 0; i < 1500; i++) + if (a[i] != i - 23) + return 1; + N(f1) (); + OMPFROM (a); + for (i = 0; i < 1500; i++) + if (a[i] != i - 25) + return 1; + N(f2) (); + OMPFROM (a); + for (i = 0; i < 1500; i++) + if (a[i] != i - 29) + return 1; + N(f3) (1500LL - 1 - 23 - 48, -1LL + 25 - 48, 1LL); + OMPFROM (a); + for (i = 0; i < 1500; i++) + if (a[i] != i - 22) + return 1; + N(f3) (1500LL - 1 - 23 - 48, 1500LL - 1, 7LL); + OMPFROM (a); + for (i = 0; i < 1500; i++) + if (a[i] != i - 22) + return 1; + N(f4) (); + OMPFROM (a); + for (i = 0; i < 1500; i++) + if (a[i] != i - 22) + return 1; + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + b[i][j][k] = i - 2.5 + 1.5 * j - 1.5 * k; + OMPTO (b); + N(f5) (0, 10, 0, 15, 0, 10, 1, 1, 1); + OMPFROM (b); + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + if (b[i][j][k] != i + 1.5 * j - 1.5 * k) + return 1; + N(f5) (0, 10, 30, 15, 0, 10, 4, 5, 6); + OMPFROM (b); + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + if (b[i][j][k] != i + 1.5 * j - 1.5 * k) + return 1; + N(f6) (9, -1, 29, 0, 9, -1, -1, -2, -1); + OMPFROM (b); + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + if (b[i][j][k] != i - 4.5 + 1.5 * j - 1.5 * k) + return 1; + N(f7) (); + OMPFROM (b); + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k) + return 1; + N(f8) (); + OMPFROM (b); + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k) + return 1; + N(f9) (); + N(f10) (); + N(f11) (10); + N(f12) (12); + OMPFROM (a); + OMPFROM (b); + for (i = 0; i < 1500; i++) + if (a[i] != i - 22) + return 1; + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k) + return 1; + N(f13) (); + N(f14) (); + OMPFROM (a); + OMPFROM (b); + for (i = 0; i < 1500; i++) + if (a[i] != i - 20) + return 1; + for (i = 0; i < 10; i++) + for (j = 0; j < 15; j++) + for (k = 0; k < 10; k++) + if (b[i][j][k] != i - 2.5 + 1.5 * j - 1.5 * k) + return 1; + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-3.c b/libgomp/testsuite/libgomp.c-c++-common/for-3.c new file mode 100644 index 0000000..173ce8e --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-3.c @@ -0,0 +1,114 @@ +/* { dg-additional-options "-std=gnu99" { target c } } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (); + +#define M(x, y, z) O(x, y, z) +#define O(x, y, z) x ## _ ## y ## _ ## z + +#pragma omp declare target + +#define F distribute +#define G d +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F distribute +#define G d_ds128 +#define S dist_schedule(static, 128) +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F distribute simd +#define G ds +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F distribute simd +#define G ds_ds128 +#define S dist_schedule(static, 128) +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F distribute parallel for +#define G dpf +#include "for-1.h" +#undef F +#undef G + +#define F distribute parallel for dist_schedule(static, 128) +#define G dpf_ds128 +#include "for-1.h" +#undef F +#undef G + +#define F distribute parallel for simd +#define G dpfs +#include "for-1.h" +#undef F +#undef G + +#define F distribute parallel for simd dist_schedule(static, 128) +#define G dpfs_ds128 +#include "for-1.h" +#undef F +#undef G + +#pragma omp end declare target + +int +main () +{ + int err = 0; + #pragma omp target teams reduction(|:err) + { + err |= test_d_normal (); + err |= test_d_ds128_normal (); + err |= test_ds_normal (); + err |= test_ds_ds128_normal (); + err |= test_dpf_static (); + err |= test_dpf_static32 (); + err |= test_dpf_auto (); + err |= test_dpf_guided32 (); + err |= test_dpf_runtime (); + err |= test_dpf_ds128_static (); + err |= test_dpf_ds128_static32 (); + err |= test_dpf_ds128_auto (); + err |= test_dpf_ds128_guided32 (); + err |= test_dpf_ds128_runtime (); + err |= test_dpfs_static (); + err |= test_dpfs_static32 (); + err |= test_dpfs_auto (); + err |= test_dpfs_guided32 (); + err |= test_dpfs_runtime (); + err |= test_dpfs_ds128_static (); + err |= test_dpfs_ds128_static32 (); + err |= test_dpfs_ds128_auto (); + err |= test_dpfs_ds128_guided32 (); + err |= test_dpfs_ds128_runtime (); + } + if (err) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-4.c b/libgomp/testsuite/libgomp.c-c++-common/for-4.c new file mode 100644 index 0000000..f9c584e --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-4.c @@ -0,0 +1,46 @@ +/* { dg-options "-std=gnu99" { target c } } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); + +#define M(x, y, z) O(x, y, z) +#define O(x, y, z) x ## _ ## y ## _ ## z + +#define F taskloop +#define G taskloop +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F taskloop simd +#define G taskloop_simd +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +int +main () +{ + int err = 0; + #pragma omp parallel reduction(|:err) + #pragma omp single + { + if (test_taskloop_normal () + || test_taskloop_simd_normal ()) + err = 1; + } + if (err) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-5.c b/libgomp/testsuite/libgomp.c-c++-common/for-5.c new file mode 100644 index 0000000..edfbe13 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-5.c @@ -0,0 +1,158 @@ +/* { dg-additional-options "-std=gnu99" { target c } } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (); + +#define M(x, y, z) O(x, y, z) +#define O(x, y, z) x ## _ ## y ## _ ## z + +#pragma omp declare target + +#define F for +#define G f +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#pragma omp end declare target + +#undef OMPFROM +#undef OMPTO +#define DO_PRAGMA(x) _Pragma (#x) +#define OMPFROM(v) DO_PRAGMA (omp target update from(v)) +#define OMPTO(v) DO_PRAGMA (omp target update to(v)) + +#define F target parallel for +#define G tpf +#include "for-1.h" +#undef F +#undef G + +#define F target simd +#define G t_simd +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F target parallel for simd +#define G tpf_simd +#include "for-1.h" +#undef F +#undef G + +#define F target teams distribute +#define G ttd +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F target teams distribute +#define G ttd_ds128 +#define S dist_schedule(static, 128) +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F target teams distribute simd +#define G ttds +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F target teams distribute simd +#define G ttds_ds128 +#define S dist_schedule(static, 128) +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F target teams distribute parallel for +#define G ttdpf +#include "for-1.h" +#undef F +#undef G + +#define F target teams distribute parallel for dist_schedule(static, 128) +#define G ttdpf_ds128 +#include "for-1.h" +#undef F +#undef G + +#define F target teams distribute parallel for simd +#define G ttdpfs +#include "for-1.h" +#undef F +#undef G + +#define F target teams distribute parallel for simd dist_schedule(static, 128) +#define G ttdpfs_ds128 +#include "for-1.h" +#undef F +#undef G + +int +main () +{ + if (test_tpf_static () + || test_tpf_static32 () + || test_tpf_auto () + || test_tpf_guided32 () + || test_tpf_runtime () + || test_t_simd_normal () + || test_tpf_simd_static () + || test_tpf_simd_static32 () + || test_tpf_simd_auto () + || test_tpf_simd_guided32 () + || test_tpf_simd_runtime () + || test_ttd_normal () + || test_ttd_ds128_normal () + || test_ttds_normal () + || test_ttds_ds128_normal () + || test_ttdpf_static () + || test_ttdpf_static32 () + || test_ttdpf_auto () + || test_ttdpf_guided32 () + || test_ttdpf_runtime () + || test_ttdpf_ds128_static () + || test_ttdpf_ds128_static32 () + || test_ttdpf_ds128_auto () + || test_ttdpf_ds128_guided32 () + || test_ttdpf_ds128_runtime () + || test_ttdpfs_static () + || test_ttdpfs_static32 () + || test_ttdpfs_auto () + || test_ttdpfs_guided32 () + || test_ttdpfs_runtime () + || test_ttdpfs_ds128_static () + || test_ttdpfs_ds128_static32 () + || test_ttdpfs_ds128_auto () + || test_ttdpfs_ds128_guided32 () + || test_ttdpfs_ds128_runtime ()) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/for-6.c b/libgomp/testsuite/libgomp.c-c++-common/for-6.c new file mode 100644 index 0000000..64a754e --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/for-6.c @@ -0,0 +1,127 @@ +/* { dg-additional-options "-std=gnu99" { target c } } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (); + +#define M(x, y, z) O(x, y, z) +#define O(x, y, z) x ## _ ## y ## _ ## z + +#pragma omp declare target + +#define F for +#define G f +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#pragma omp end declare target + +#undef OMPTGT +#undef OMPFROM +#undef OMPTO +#define DO_PRAGMA(x) _Pragma (#x) +#define OMPTGT DO_PRAGMA (omp target) +#define OMPFROM(v) DO_PRAGMA (omp target update from(v)) +#define OMPTO(v) DO_PRAGMA (omp target update to(v)) + +#define F teams distribute +#define G td +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F teams distribute +#define G td_ds128 +#define S dist_schedule(static, 128) +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F teams distribute simd +#define G tds +#define S +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F teams distribute simd +#define G tds_ds128 +#define S dist_schedule(static, 128) +#define N(x) M(x, G, normal) +#include "for-2.h" +#undef S +#undef N +#undef F +#undef G + +#define F teams distribute parallel for +#define G tdpf +#include "for-1.h" +#undef F +#undef G + +#define F teams distribute parallel for dist_schedule(static, 128) +#define G tdpf_ds128 +#include "for-1.h" +#undef F +#undef G + +#define F teams distribute parallel for simd +#define G tdpfs +#include "for-1.h" +#undef F +#undef G + +#define F teams distribute parallel for simd dist_schedule(static, 128) +#define G tdpfs_ds128 +#include "for-1.h" +#undef F +#undef G + +int +main () +{ + if (test_td_normal () + || test_td_ds128_normal () + || test_tds_normal () + || test_tds_ds128_normal () + || test_tdpf_static () + || test_tdpf_static32 () + || test_tdpf_auto () + || test_tdpf_guided32 () + || test_tdpf_runtime () + || test_tdpf_ds128_static () + || test_tdpf_ds128_static32 () + || test_tdpf_ds128_auto () + || test_tdpf_ds128_guided32 () + || test_tdpf_ds128_runtime () + || test_tdpfs_static () + || test_tdpfs_static32 () + || test_tdpfs_auto () + || test_tdpfs_guided32 () + || test_tdpfs_runtime () + || test_tdpfs_ds128_static () + || test_tdpfs_ds128_static32 () + || test_tdpfs_ds128_auto () + || test_tdpfs_ds128_guided32 () + || test_tdpfs_ds128_runtime ()) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-13.c b/libgomp/testsuite/libgomp.c-c++-common/loop-13.c new file mode 100644 index 0000000..997c628 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/loop-13.c @@ -0,0 +1,253 @@ +/* { dg-do run } */ + +volatile int ji = 100, ki = 2; +volatile unsigned int ju = 100, ku = 2; +volatile long long int jll = 100, kll = 2; +volatile unsigned long long int jull = 100, kull = 2; +unsigned long long l; + +void +f0 (void) +{ + int i, j, k; + unsigned int j2, k2; + #pragma omp for reduction(+: l) + for (i = ji; i < ki; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) + for (i = ji; i < ki; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = ji; i < ki; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = ji; i < ki; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = ki + 10; k < ji - 10; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = ki + 10; j < ji - 10; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f1 (void) +{ + unsigned int i, j, k; + int j2, k2; + #pragma omp for reduction(+: l) + for (i = ju; i < ku; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) + for (i = ju; i < ku; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = ju; i < ku; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = ju; i < ku; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = ku; k < ju; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = ku; j < ju; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f2 (void) +{ + long long int i, j, k; + unsigned long long int j2, k2; + #pragma omp for reduction(+: l) + for (i = jll; i < kll; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) + for (i = jll; i < kll; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = jll; i < kll; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = jll; i < kll; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = kll; k < jll; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = kll; j < jll; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f3 (void) +{ + unsigned long long int i, j, k; + long long int j2, k2; + #pragma omp for reduction(+: l) + for (i = jull; i < kull; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) + for (i = jull; i < kull; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = jull; i < kull; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j2 = 0; j2 < 4; j2++) + for (i = jull; i < kull; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = kull; k < jull; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) + for (j = kull; j < jull; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +int +main () +{ + f0 (); + f1 (); + f2 (); + f3 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-14.c b/libgomp/testsuite/libgomp.c-c++-common/loop-14.c new file mode 100644 index 0000000..b8a163c --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/loop-14.c @@ -0,0 +1,253 @@ +/* { dg-do run } */ + +volatile int ji = 100, ki = 2; +volatile unsigned int ju = 100, ku = 2; +volatile long long int jll = 100, kll = 2; +volatile unsigned long long int jull = 100, kull = 2; +unsigned long long l; + +void +f0 (void) +{ + int i, j, k; + unsigned int j2, k2; + #pragma omp for reduction(+: l) schedule(static, 2) + for (i = ji; i < ki; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(static, 2) + for (i = ji; i < ki; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = ji; i < ki; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = ji; i < ki; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = ki + 10; k < ji - 10; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = ki + 10; j < ji - 10; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f1 (void) +{ + unsigned int i, j, k; + int j2, k2; + #pragma omp for reduction(+: l) schedule(static, 2) + for (i = ju; i < ku; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(static, 2) + for (i = ju; i < ku; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = ju; i < ku; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = ju; i < ku; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = ku; k < ju; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = ku; j < ju; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f2 (void) +{ + long long int i, j, k; + unsigned long long int j2, k2; + #pragma omp for reduction(+: l) schedule(static, 2) + for (i = jll; i < kll; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(static, 2) + for (i = jll; i < kll; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = jll; i < kll; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = jll; i < kll; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = kll; k < jll; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = kll; j < jll; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f3 (void) +{ + unsigned long long int i, j, k; + long long int j2, k2; + #pragma omp for reduction(+: l) schedule(static, 2) + for (i = jull; i < kull; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(static, 2) + for (i = jull; i < kull; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = jull; i < kull; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j2 = 0; j2 < 4; j2++) + for (i = jull; i < kull; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = kull; k < jull; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) + for (j = kull; j < jull; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +int +main () +{ + f0 (); + f1 (); + f2 (); + f3 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/loop-15.c b/libgomp/testsuite/libgomp.c-c++-common/loop-15.c new file mode 100644 index 0000000..e7cf3fc --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/loop-15.c @@ -0,0 +1,253 @@ +/* { dg-do run } */ + +volatile int ji = 100, ki = 2; +volatile unsigned int ju = 100, ku = 2; +volatile long long int jll = 100, kll = 2; +volatile unsigned long long int jull = 100, kull = 2; +unsigned long long l; + +void +f0 (void) +{ + int i, j, k; + unsigned int j2, k2; + #pragma omp for reduction(+: l) schedule(runtime) + for (i = ji; i < ki; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(runtime) + for (i = ji; i < ki; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = ji; i < ki; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = ji; i < ki; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = ji; i < ki; i++) + for (k = ki + 10; k < ji - 10; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = ki + 10; j < ji - 10; j++) + for (i = ji; i < ki; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f1 (void) +{ + unsigned int i, j, k; + int j2, k2; + #pragma omp for reduction(+: l) schedule(runtime) + for (i = ju; i < ku; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(runtime) + for (i = ju; i < ku; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = ju; i < ku; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = ju; i < ku; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = ju; i < ku; i++) + for (k = ku; k < ju; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = ku; j < ju; j++) + for (i = ju; i < ku; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f2 (void) +{ + long long int i, j, k; + unsigned long long int j2, k2; + #pragma omp for reduction(+: l) schedule(runtime) + for (i = jll; i < kll; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(runtime) + for (i = jll; i < kll; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = jll; i < kll; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = jll; i < kll; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = jll; i < kll; i++) + for (k = kll; k < jll; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = kll; j < jll; j++) + for (i = jll; i < kll; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +void +f3 (void) +{ + unsigned long long int i, j, k; + long long int j2, k2; + #pragma omp for reduction(+: l) schedule(runtime) + for (i = jull; i < kull; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) schedule(runtime) + for (i = jull; i < kull; i++) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = jull; i < kull; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j2 = 0; j2 < 4; j2++) + for (i = jull; i < kull; i++) + for (k2 = 0; k2 < 5; k2 += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = 0; j < 4; j++) + for (i = jull; i < kull; i++) + for (k = kull; k < jull; k += 2) + l++; + if (l != 0) + __builtin_abort (); + #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) + for (j = kull; j < jull; j++) + for (i = jull; i < kull; i++) + for (k = 0; k < 5; k += 2) + l++; + if (l != 0) + __builtin_abort (); +} + +int +main () +{ + f0 (); + f1 (); + f2 (); + f3 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/monotonic-1.c b/libgomp/testsuite/libgomp.c-c++-common/monotonic-1.c new file mode 100644 index 0000000..c3c0100 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/monotonic-1.c @@ -0,0 +1,303 @@ +/* { dg-do run } */ + +#ifndef MONOTONIC_TYPE +#include +#include +#define MONOTONIC_TYPE int +#define MONOTONIC_UNDEF -1 +#define MONOTONIC_END(n) n +#endif + +int +main () +{ + MONOTONIC_TYPE i; + #pragma omp parallel + { + int cnt = omp_get_num_threads (); + int thr = omp_get_thread_num (); + MONOTONIC_TYPE l = MONOTONIC_UNDEF; + int c = 0; + int n = 0; + #pragma omp for nowait schedule(static, 5) + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + { + if (l >= i) + abort (); + if (cnt == 1) + abort (); + if (n != 5) + abort (); + n = 1; + c++; + } + if (n == 1) + { + if ((i % 5) != 0) + abort (); + if ((i / 5) % cnt != thr) + abort (); + } + l = i; + } + if (cnt == 1) + { + if (n != 73 || l != 73 - 1 || c != 1) + abort (); + } + else if (thr > 73 / 5) + { + if (l != MONOTONIC_UNDEF || c != 0 || n != 0) + abort (); + } + else if (thr == 73 / 5) + { + if (l != 73 - 1 || c != 1 || n != 73 % 5) + abort (); + } + else if (c == 0) + abort (); + else if (l == 73 - 1) + { + if (thr != (73 / 5) % cnt || n != 73 % 5) + abort (); + } + else if ((n % 5) != 0) + abort (); + l = MONOTONIC_UNDEF; + c = 0; + n = 0; + #pragma omp for schedule( monotonic: static, 7) nowait + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + { + if (l >= i) + abort (); + if (cnt == 1) + abort (); + if (n != 7) + abort (); + n = 1; + c++; + } + if (n == 1) + { + if ((i % 7) != 0) + abort (); + if ((i / 7) % cnt != thr) + abort (); + } + l = i; + } + if (cnt == 1) + { + if (n != 73 || l != 73 - 1 || c != 1) + abort (); + } + else if (thr > 73 / 7) + { + if (l != MONOTONIC_UNDEF || c != 0 || n != 0) + abort (); + } + else if (thr == 73 / 7) + { + if (l != 73 - 1 || c != 1 || n != 73 % 7) + abort (); + } + else if (c == 0) + abort (); + else if (l == 73 - 1) + { + if (thr != (73 / 7) % cnt || n != 73 % 7) + abort (); + } + else if ((n % 7) != 0) + abort (); + l = MONOTONIC_UNDEF; + c = 0; + n = 0; + #pragma omp for nowait schedule(static) + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + abort (); + l = i; + } + if (c > 1) + abort (); + l = MONOTONIC_UNDEF; + c = 0; + n = 0; + #pragma omp for nowait schedule(monotonic,simd:static) + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + abort (); + l = i; + } + if (c > 1) + abort (); + l = MONOTONIC_UNDEF; + c = 0; + n = 0; + #pragma omp for schedule(monotonic : dynamic, 5) nowait + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + { + if (l >= i) + abort (); + if ((n % 5) != 0 || n == 0) + abort (); + n = 1; + c++; + } + l = i; + } + if (l == 73 - 1) + { + if (n % 5 != 73 % 5) + abort (); + } + else if (l == MONOTONIC_UNDEF) + { + if (n != 0 || c != 0) + abort (); + } + else if ((n % 5) != 0 || n == 0) + abort (); + l = MONOTONIC_UNDEF; + c = 0; + n = 0; + #pragma omp for nowait schedule(dynamic, 7) ordered(1) + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + { + if (l >= i) + abort (); + if ((n % 7) != 0 || n == 0) + abort (); + n = 1; + c++; + } + #pragma omp ordered depend(source) + if (MONOTONIC_UNDEF > 0) + { + #pragma omp ordered depend(sink: i) + } + else + { + #pragma omp ordered depend(sink: i - 1) + } + l = i; + } + if (l == 73 - 1) + { + if (n % 7 != 73 % 7) + abort (); + } + else if (l == MONOTONIC_UNDEF) + { + if (n != 0 || c != 0) + abort (); + } + else if ((n % 7) != 0 || n == 0) + abort (); + l = MONOTONIC_UNDEF; + c = 0; + n = 0; + #pragma omp for schedule (monotonic :guided , 7) nowait + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + { + if (l >= i) + abort (); + if (n < 7) + abort (); + n = 1; + c++; + } + l = i; + } + l = MONOTONIC_UNDEF; + c = 0; + n = 0; + #pragma omp for nowait schedule(guided, 7) ordered + for (i = 0; i < MONOTONIC_END (73); i++) + { + if (l == MONOTONIC_UNDEF) + { + n = 1; + c++; + } + else if (l == i - 1) + n++; + else + { + if (l >= i) + abort (); + if (n < 7) + abort (); + n = 1; + c++; + } + #pragma omp ordered + l = i; + } + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/monotonic-2.c b/libgomp/testsuite/libgomp.c-c++-common/monotonic-2.c new file mode 100644 index 0000000..b886a24 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/monotonic-2.c @@ -0,0 +1,11 @@ +/* { dg-do run } */ + +#include +#include +#define MONOTONIC_TYPE unsigned long long +#define MONOTONIC_UNDEF -1ULL +#define MONOTONIC_END(n) n + v + +volatile int v; + +#include "monotonic-1.c" diff --git a/libgomp/testsuite/libgomp.c-c++-common/nonmonotonic-1.c b/libgomp/testsuite/libgomp.c-c++-common/nonmonotonic-1.c new file mode 100644 index 0000000..fc5e93f --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/nonmonotonic-1.c @@ -0,0 +1,53 @@ +/* { dg-do run } */ + +#ifndef NONMONOTONIC_TYPE +#include +#include +#define NONMONOTONIC_TYPE int +#define NONMONOTONIC_END(n) n +#endif + +int a[73]; + +int +main () +{ + NONMONOTONIC_TYPE i; + #pragma omp parallel for schedule(nonmonotonic: dynamic) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp parallel for schedule(nonmonotonic: dynamic, 5) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp parallel for schedule(nonmonotonic: guided) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp parallel for schedule(nonmonotonic: guided, 7) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp parallel + { + int cnt = omp_get_num_threads (); + int thr = omp_get_thread_num (); + if (thr < 73) + a[thr]++; + #pragma omp barrier + #pragma omp for schedule(nonmonotonic: dynamic) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp for schedule(nonmonotonic: dynamic, 7) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp for schedule(nonmonotonic: guided) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp for schedule(nonmonotonic: guided, 5) + for (i = 0; i < NONMONOTONIC_END (73); i++) + a[i]++; + #pragma omp single private (i) + for (i = 0; i < 73; i++) + if (a[i] != 8 + (i < cnt)) + abort (); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/nonmonotonic-2.c b/libgomp/testsuite/libgomp.c-c++-common/nonmonotonic-2.c new file mode 100644 index 0000000..c56fa1d --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/nonmonotonic-2.c @@ -0,0 +1,10 @@ +/* { dg-do run } */ + +#include +#include +#define NONMONOTONIC_TYPE unsigned long long +#define NONMONOTONIC_END(n) n + v + +volatile int v; + +#include "nonmonotonic-1.c" diff --git a/libgomp/testsuite/libgomp.c-c++-common/ordered-4.c b/libgomp/testsuite/libgomp.c-c++-common/ordered-4.c new file mode 100644 index 0000000..8412d47 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/ordered-4.c @@ -0,0 +1,83 @@ +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); + +void +foo (int i, char *j) +{ + #pragma omp atomic + j[i]++; + #pragma omp ordered threads + { + int t; + #pragma omp atomic read + t = j[i]; + if (t != 3) + abort (); + if (i > 1) + { + #pragma omp atomic read + t = j[i - 1]; + if (t == 2) + abort (); + } + if (i < 127) + { + #pragma omp atomic read + t = j[i + 1]; + if (t == 4) + abort (); + } + } + #pragma omp atomic + j[i]++; +} + +int +main () +{ + int i; + char j[128]; + #pragma omp parallel + { + #pragma omp for + for (i = 0; i < 128; i++) + j[i] = 0; + #pragma omp for ordered schedule(dynamic, 1) + for (i = 0; i < 128; i++) + { + #pragma omp atomic + j[i]++; + #pragma omp ordered threads + { + int t; + #pragma omp atomic read + t = j[i]; + if (t != 1) + abort (); + if (i > 1) + { + #pragma omp atomic read + t = j[i - 1]; + if (t == 0) + abort (); + } + if (i < 127) + { + #pragma omp atomic read + t = j[i + 1]; + if (t == 2) + abort (); + } + } + #pragma omp atomic + j[i]++; + } + #pragma omp for ordered schedule(static, 1) + for (i = 0; i < 128; i++) + foo (i, j); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr45784.c b/libgomp/testsuite/libgomp.c-c++-common/pr45784.c new file mode 100644 index 0000000..7861210 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr45784.c @@ -0,0 +1,41 @@ +/* PR c/45784 */ +/* { dg-do run } */ + +void +foo (int n) +{ + char *p, vla[2 * n]; + int i; + #pragma omp parallel for + for (p = vla; p < vla + (sizeof (vla) / sizeof (vla[0])); p++) + *p = ' '; + #pragma omp parallel for + for (i = 0; i < 2 * n; i++) + if (vla[i] != ' ') + __builtin_abort (); +} + +void +bar (int n) +{ + char *p, vla1[n], vla2[n * 2], vla3[n * 3], vla4[n * 4]; + int i; + __builtin_memset (vla4, ' ', n * 4); + #pragma omp parallel for + for (p = vla4 + sizeof (vla1); p < vla4 + sizeof (vla3) - sizeof (vla2) + sizeof (vla1); p += sizeof (vla4) / sizeof (vla4)) + p[0] = '!'; + #pragma omp parallel for + for (i = 0; i < n * 4; i++) + if (vla4[i] != ((i >= n && i < 2 * n) ? '!' : ' ')) + __builtin_abort (); +} + +int +main () +{ + volatile int n; + n = 128; + foo (n); + bar (n); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr64824.c b/libgomp/testsuite/libgomp.c-c++-common/pr64824.c new file mode 100644 index 0000000..b39675b --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr64824.c @@ -0,0 +1,15 @@ +/* PR c/64824 */ +/* { dg-do run } */ + +int +main () +{ + long long a; + long long b = 1LL; + int c = 3; +#pragma omp atomic capture + a = b = c << b; + if (b != 6LL || a != 6LL) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr64868.c b/libgomp/testsuite/libgomp.c-c++-common/pr64868.c new file mode 100644 index 0000000..f93caf2 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr64868.c @@ -0,0 +1,86 @@ +/* PR c/64868 */ +/* { dg-do run } */ + +float f = 2.0f; +double d = 4.0; +long double ld = 8.0L; + +void +foo () +{ +#pragma omp atomic + f = 1.0f / f; +#pragma omp atomic + f = 1 / f; +#pragma omp atomic + f = f / 2.0f; +#pragma omp atomic + f = f / 2; +#pragma omp atomic + f /= 2.0f; +#pragma omp atomic + f /= 2; +#pragma omp atomic + d = 1.0 / d; +#pragma omp atomic + d = 1 / d; +#pragma omp atomic + d = d / 2.0; +#pragma omp atomic + d = d / 2; +#pragma omp atomic + d /= 2.0; +#pragma omp atomic + d /= 2; +#pragma omp atomic + ld = 1.0L / ld; +#pragma omp atomic + ld = 1 / ld; +#pragma omp atomic + ld = ld / 2.0L; +#pragma omp atomic + ld = ld / 2; +#pragma omp atomic + ld /= 2.0L; +#pragma omp atomic + ld /= 2; + if (f != 0.125f || d != 0.25 || ld != 0.5L) + __builtin_abort (); +} + +#ifdef __cplusplus +template +void +bar () +{ + T v = ::d; +#pragma omp atomic + v *= 16; +#pragma omp atomic + v = 1.0 / v; +#pragma omp atomic + v = N1 / v; +#pragma omp atomic + v = v / 2.0; +#pragma omp atomic + v = v / N2; +#pragma omp atomic + v /= 2.0; +#pragma omp atomic + v /= N2; + if (v != 0.25) + __builtin_abort (); +} +#endif + +int +main () +{ + foo (); +#ifdef __cplusplus + bar (); + bar (); + bar (); +#endif + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-1.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-1.c new file mode 100644 index 0000000..20482a4 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-1.c @@ -0,0 +1,61 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +int u[1024], v[1024], w[1024]; + +__attribute__((noinline, noclone)) long +f1 (long a, long b) +{ + long d; + #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; + return d; +} + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + c += 5; + e = c; + } + return d + c + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +__attribute__((noinline, noclone)) long +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f1 (0, 1024) != 1024 + || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024) + || f3 (0, 32, 0, 32) != 64 + || f4 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-2.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-2.c new file mode 100644 index 0000000..2fc9eec --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-2.c @@ -0,0 +1,57 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) void +f1 (long a, long b) +{ + long d; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; +} + +__attribute__((noinline, noclone)) void +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + e = c + d * 5; + } +} + +__attribute__((noinline, noclone)) void +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +__attribute__((noinline, noclone)) void +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +int +main () +{ + f1 (0, 1024); + f2 (0, 1024, 17); + f3 (0, 32, 0, 32); + f4 (0, 32, 0, 32); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-3.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-3.c new file mode 100644 index 0000000..cee82e5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-3.c @@ -0,0 +1,50 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ +/* { dg-options "-O2" { target c } } */ + +int u[1024], v[1024], w[1024]; + +__attribute__((noinline, noclone)) long +f1 (long a, long b) +{ + long d; + #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; + return d; +} + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) linear(c:5) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + c += 5; + e = c; + } + return d + c + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f1 (0, 1024) != 1024 + || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024) + || f3 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-4.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-4.c new file mode 100644 index 0000000..d6d1367 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-4.c @@ -0,0 +1,58 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ +/* { dg-options "-O2" { target c } } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) void +f1 (long a, long b) +{ + long d; + #pragma omp target teams distribute parallel for default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; +} + +__attribute__((noinline, noclone)) void +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + e = c + d * 5; + } +} + +__attribute__((noinline, noclone)) void +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +__attribute__((noinline, noclone)) void +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; +} + +int +main () +{ + f1 (0, 1024); + f2 (0, 1024, 17); + f3 (0, 32, 0, 32); + f4 (0, 32, 0, 32); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-5.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-5.c new file mode 100644 index 0000000..7ade43c --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-5.c @@ -0,0 +1,66 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) long +f1 (long a, long b) +{ + long d; + #pragma omp target map(from: d) + #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; + return d; +} + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target map(from: d, e) + #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + e = c + d * 5; + } + return d + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +__attribute__((noinline, noclone)) long +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f1 (0, 1024) != 1024 + || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) + || f3 (0, 32, 0, 32) != 64 + || f4 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-6.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-6.c new file mode 100644 index 0000000..86467d7 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-6.c @@ -0,0 +1,42 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ +/* { dg-options "-O2" { target c } } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target map(from: d, e) + #pragma omp teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + e = c + d * 5; + } + return d + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) + || f3 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-7.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-7.c new file mode 100644 index 0000000..752367e --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-7.c @@ -0,0 +1,66 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) long +f1 (long a, long b) +{ + long d; + #pragma omp target map(from: d) + #pragma omp teams distribute simd default(none) firstprivate (a, b) shared(u, v, w) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; + return d; +} + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target map(from: d, e) + #pragma omp teams distribute simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + e = c + d * 5; + } + return d + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +__attribute__((noinline, noclone)) long +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f1 (0, 1024) != 1024 + || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) + || f3 (0, 32, 0, 32) != 64 + || f4 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-8.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-8.c new file mode 100644 index 0000000..102af06 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-8.c @@ -0,0 +1,70 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) long +f1 (long a, long b) +{ + long d; + #pragma omp target map(from: d) + #pragma omp teams default(none) shared(a, b, d, u, v, w) + #pragma omp distribute simd firstprivate (a, b) + for (d = a; d < b; d++) + u[d] = v[d] + w[d]; + return d; +} + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target map(from: d, e) + #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w) + #pragma omp distribute simd linear(d) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + e = c + d * 5; + } + return d + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w) + #pragma omp distribute simd firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +__attribute__((noinline, noclone)) long +f4 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams default(none) firstprivate (a1, b1, a2, b2) shared(d1, d2, u, v, w) + #pragma omp distribute simd collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f1 (0, 1024) != 1024 + || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) + || f3 (0, 32, 0, 32) != 64 + || f4 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr66199-9.c b/libgomp/testsuite/libgomp.c-c++-common/pr66199-9.c new file mode 100644 index 0000000..554a476 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr66199-9.c @@ -0,0 +1,43 @@ +/* PR middle-end/66199 */ +/* { dg-do run } */ + +#pragma omp declare target +int u[1024], v[1024], w[1024]; +#pragma omp end declare target + +__attribute__((noinline, noclone)) long +f2 (long a, long b, long c) +{ + long d, e; + #pragma omp target map(from: d, e) + #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w) + #pragma omp distribute lastprivate(d, e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + e = c + d * 5; + } + return d + e; +} + +__attribute__((noinline, noclone)) long +f3 (long a1, long b1, long a2, long b2) +{ + long d1, d2; + #pragma omp target map(from: d1, d2) + #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w) + #pragma omp distribute firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2) + for (d1 = a1; d1 < b1; d1++) + for (d2 = a2; d2 < b2; d2++) + u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; + return d1 + d2; +} + +int +main () +{ + if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) + || f3 (0, 32, 0, 32) != 64) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr69389.c b/libgomp/testsuite/libgomp.c-c++-common/pr69389.c new file mode 100644 index 0000000..07faff4 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/pr69389.c @@ -0,0 +1,124 @@ +/* PR c/69389 */ + +struct S { unsigned int a : 10; unsigned int b : 4; unsigned int c : 18; } s = { 210, 11, 1235 }; + +unsigned int +f1 (void) +{ + unsigned int v; + #pragma omp atomic read + v = s.b; + return v; +} + +void +f2 (unsigned int v) +{ + #pragma omp atomic write + s.b = v; +} + +void +f3 (void) +{ + #pragma omp atomic + s.b |= 1; +} + +int +f4 (void) +{ + int v; + #pragma omp atomic capture + v = s.b += 8; + return v; +} + +int +f5 (void) +{ + int v; + #pragma omp atomic capture + { + v = s.b; + s.b -= 4; + } + return v; +} + +void +f6 (void) +{ + #pragma omp atomic + s.b = s.b & 7; +} + +void +f7 (void) +{ + #pragma omp atomic + s.b = ~7 & s.b; +} + +int +f8 (void) +{ + int v; + #pragma omp atomic capture + v = s.b = 8 + s.b; + return v; +} + +int +f9 (void) +{ + int v; + #pragma omp atomic capture + { + v = s.b; + s.b = s.b - 4; + } + return v; +} + +int +main () +{ + if (f1 () != 11) + __builtin_abort (); + f2 (4); + if (s.a != 210 || s.b != 4 || s.c != 1235) + __builtin_abort (); + s.a = 813; + s.c = 31532; + if (f1 () != 4) + __builtin_abort (); + f3 (); + if (f1 () != 5) + __builtin_abort (); + if (s.a != 813 || s.b != 5 || s.c != 31532) + __builtin_abort (); + if (f4 () != 13) + __builtin_abort (); + if (f1 () != 13) + __builtin_abort (); + f2 (14); + if (s.a != 813 || s.b != 14 || s.c != 31532) + __builtin_abort (); + if (f5 () != 14) + __builtin_abort (); + if (f1 () != 10 || s.a != 813 || s.b != 10 || s.c != 31532) + __builtin_abort (); + f6 (); + if (f1 () != 2) + __builtin_abort (); + f2 (15); + f7 (); + if (f1 () != 8) + __builtin_abort (); + if (f8 () != 0 || s.a != 813 || s.b != 0 || s.c != 31532) + __builtin_abort (); + if (f9 () != 0 || s.a != 813 || s.b != 12 || s.c != 31532) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/simd-14.c b/libgomp/testsuite/libgomp.c-c++-common/simd-14.c new file mode 100644 index 0000000..28bdc99 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/simd-14.c @@ -0,0 +1,122 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int +main () +{ + int i, j, b, c = 0; + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/simd-15.c b/libgomp/testsuite/libgomp.c-c++-common/simd-15.c new file mode 100644 index 0000000..e75538d --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/simd-15.c @@ -0,0 +1,128 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +static inline void +foo (int *b, int *i, int *j, int x) +{ + *b = *b + x + (*i - *i) + (*j - *j); +} + +int +main () +{ + int i, j, b, c = 0; + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/simd-16.c b/libgomp/testsuite/libgomp.c-c++-common/simd-16.c new file mode 100644 index 0000000..ea1ca31 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/simd-16.c @@ -0,0 +1,67 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ +/* { dg-additional-options "-std=c99" {target c } } */ + +int +main () +{ + int b, c = 0; + b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/simd-17.c b/libgomp/testsuite/libgomp.c-c++-common/simd-17.c new file mode 100644 index 0000000..5e54378 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/simd-17.c @@ -0,0 +1,73 @@ +/* { dg-do run } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ +/* { dg-additional-options "-std=c99" { target c } } */ + +static inline void +foo (int *b, int *i, int *j, int x) +{ + *b = *b + x + (*i - *i) + (*j - *j); +} + +int +main () +{ + int b, c = 0; + b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &i, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &i, 3); + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &i, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &i, 3); + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-1.c b/libgomp/testsuite/libgomp.c-c++-common/target-1.c new file mode 100644 index 0000000..c7abb00 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-1.c @@ -0,0 +1,91 @@ +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); + +void +fn1 (double *x, double *y, int z) +{ + int i; + for (i = 0; i < z; i++) + { + x[i] = i & 31; + y[i] = (i & 63) - 30; + } +} + +#pragma omp declare target +int tgtv = 6; +int +tgt (void) +{ + #pragma omp atomic update + tgtv++; + return 0; +} +#pragma omp end declare target + +double +fn2 (int x, int y, int z) +{ + double b[1024], c[1024], s = 0; + int i, j; + fn1 (b, c, x); + #pragma omp target data map(to: b) + { + #pragma omp target map(tofrom: c, s) + #pragma omp teams num_teams(y) thread_limit(z) reduction(+:s) firstprivate(x) + #pragma omp distribute dist_schedule(static, 4) collapse(1) + for (j=0; j < x; j += y) + #pragma omp parallel for reduction(+:s) + for (i = j; i < j + y; i++) + tgt (), s += b[i] * c[i]; + #pragma omp target update from(b, tgtv) + } + return s; +} + +double +fn3 (int x) +{ + double b[1024], c[1024], s = 0; + int i; + fn1 (b, c, x); + #pragma omp target map(to: b, c) map(tofrom:s) + #pragma omp parallel for reduction(+:s) + for (i = 0; i < x; i++) + tgt (), s += b[i] * c[i]; + return s; +} + +double +fn4 (int x, double *p) +{ + double b[1024], c[1024], d[1024], s = 0; + int i; + fn1 (b, c, x); + fn1 (d + x, p + x, x); + #pragma omp target map(to: b, c[0:x], d[x:x]) map(to:p[x:64 + (x & 31)]) \ + map(tofrom: s) + #pragma omp parallel for reduction(+:s) + for (i = 0; i < x; i++) + s += b[i] * c[i] + d[x + i] + p[x + i]; + return s; +} + +int +main () +{ + double a = fn2 (128, 4, 6); + int b = tgtv; + double c = fn3 (61); + #pragma omp target update from(tgtv) + int d = tgtv; + double e[1024]; + double f = fn4 (64, e); + if (a != 13888.0 || b != 6 + 128 || c != 4062.0 || d != 6 + 128 + 61 + || f != 8032.0) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-10.c b/libgomp/testsuite/libgomp.c-c++-common/target-10.c new file mode 100644 index 0000000..bc66880 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-10.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ + +#pragma omp declare target +extern int v; +#pragma omp end declare target + +int v; + +int +main () +{ + #pragma omp target update to(v) + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-13.c b/libgomp/testsuite/libgomp.c-c++-common/target-13.c new file mode 100644 index 0000000..168850b --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-13.c @@ -0,0 +1,45 @@ +#ifdef __cplusplus +extern "C" +#else +extern +#endif +void abort (void); +struct S { int s, t; }; + +void +foo () +{ + int x = 5, y = 6, err = 0; + struct S u = { 7, 8 }, v = { 9, 10 }; + double s = 11.5, t = 12.5; + #pragma omp target private (x, u, s) firstprivate (y, v, t) map(from:err) + { + x = y; + u = v; + s = t; + err = (x != 6 || y != 6 + || u.s != 9 || u.t != 10 || v.s != 9 || v.t != 10 + || s != 12.5 || t != 12.5); + x += 1; + y += 2; + u.s += 3; + v.t += 4; + s += 2.5; + t += 3.0; + if (x != 7 || y != 8 + || u.s != 12 || u.t != 10 || v.s != 9 || v.t != 14 + || s != 15.0 || t != 15.5) + err = 1; + } + if (err || x != 5 || y != 6 + || u.s != 7 || u.t != 8 || v.s != 9 || v.t != 10 + || s != 11.5 || t != 12.5) + abort (); +} + +int +main () +{ + foo (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-2.c b/libgomp/testsuite/libgomp.c-c++-common/target-2.c new file mode 100644 index 0000000..0ba766c --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-2.c @@ -0,0 +1,88 @@ +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); + +void +fn1 (double *x, double *y, int z) +{ + int i; + for (i = 0; i < z; i++) + { + x[i] = i & 31; + y[i] = (i & 63) - 30; + } +} + +double +fn2 (int x) +{ + double s = 0; + double b[3 * x], c[3 * x], d[3 * x], e[3 * x]; + int i; + fn1 (b, c, x); + fn1 (e, d + x, x); + #pragma omp target map(to: b, c[:x], d[x:x], e) map(tofrom: s) + #pragma omp parallel for reduction(+:s) + for (i = 0; i < x; i++) + s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c); + return s; +} + +double +fn3 (int x) +{ + double s = 0; + double b[3 * x], c[3 * x], d[3 * x], e[3 * x]; + int i; + fn1 (b, c, x); + fn1 (e, d, x); + #pragma omp target map(tofrom: s) + #pragma omp parallel for reduction(+:s) + for (i = 0; i < x; i++) + s += b[i] * c[i] + d[i]; + return s; +} + +double +fn4 (int x) +{ + double s = 0; + double b[3 * x], c[3 * x], d[3 * x], e[3 * x]; + int i; + fn1 (b, c, x); + fn1 (e, d + x, x); + #pragma omp target data map(from: b, c[:x], d[x:x], e) + { + #pragma omp target update to(b, c[:x], d[x:x], e) + #pragma omp target map(c[:x], d[x:x], s) + #pragma omp parallel for reduction(+:s) + for (i = 0; i < x; i++) + { + s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c); + b[i] = i + 0.5; + c[i] = 0.5 - i; + d[x + i] = 0.5 * i; + } + } + for (i = 0; i < x; i++) + if (b[i] != i + 0.5 || c[i] != 0.5 - i || d[x + i] != 0.5 * i) + abort (); + return s; +} + +int +main () +{ + double a = fn2 (128); + if (a != 14080.0) + abort (); + double b = fn3 (128); + if (a != b) + abort (); + double c = fn4 (256); + if (c != 28160.0) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/taskgroup-1.c b/libgomp/testsuite/libgomp.c-c++-common/taskgroup-1.c new file mode 100644 index 0000000..641a3bc --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/taskgroup-1.c @@ -0,0 +1,83 @@ +extern +#ifdef __cplusplus +"C" +#endif +void abort (void); +int v[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; + +int +main () +{ + #pragma omp parallel num_threads (4) + #pragma omp single + { + int i; + #pragma omp taskgroup + { + for (i = 0; i < 16; i += 2) + #pragma omp task + { + #pragma omp task + v[i]++; + #pragma omp task + v[i + 1]++; + } + } + for (i = 0; i < 16; i++) + if (v[i] != i + 2) + abort (); + #pragma omp taskgroup + { + for (i = 0; i < 16; i += 2) + #pragma omp task + { + #pragma omp task + v[i]++; + #pragma omp task + v[i + 1]++; + #pragma omp taskwait + } + } + for (i = 0; i < 16; i++) + if (v[i] != i + 3) + abort (); + #pragma omp taskgroup + { + for (i = 0; i < 16; i += 2) + #pragma omp task + { + #pragma omp task + v[i]++; + v[i + 1]++; + } + #pragma omp taskwait + for (i = 0; i < 16; i += 2) + #pragma omp task + v[i + 1]++; + } + for (i = 0; i < 16; i++) + if (v[i] != i + 4 + (i & 1)) + abort (); + #pragma omp taskgroup + { + for (i = 0; i < 16; i += 2) + { + #pragma omp taskgroup + { + #pragma omp task + v[i]++; + #pragma omp task + v[i + 1]++; + } + if (v[i] != i + 5 || v[i + 1] != i + 7) + abort (); + #pragma omp task + v[i]++; + } + } + for (i = 0; i < 16; i++) + if (v[i] != i + 6) + abort (); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/taskloop-1.c b/libgomp/testsuite/libgomp.c-c++-common/taskloop-1.c new file mode 100644 index 0000000..11de751 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/taskloop-1.c @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-std=c99" { target c } } */ + +int q, r, e; + +__attribute__((noinline, noclone)) void +foo (long a, long b) +{ + #pragma omp taskloop lastprivate (q) nogroup + for (long d = a; d < b; d += 2) + { + q = d; + if (d < 2 || d > 6 || (d & 1)) + #pragma omp atomic + e |= 1; + } +} + +__attribute__((noinline, noclone)) int +bar (int a, int b) +{ + int q = 7; + #pragma omp taskloop lastprivate (q) + for (int d = a; d < b; d++) + { + if (d < 12 || d > 17) + #pragma omp atomic + e |= 1; + q = d; + } + return q; +} + +int +main () +{ + #pragma omp parallel + #pragma omp single + { + foo (2, 7); + r = bar (12, 18); + } + if (q != 6 || r != 17 || e) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/taskloop-2.c b/libgomp/testsuite/libgomp.c-c++-common/taskloop-2.c new file mode 100644 index 0000000..8387cd3 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/taskloop-2.c @@ -0,0 +1,148 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-std=c99" { target c } } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int u[1024], v[1024], w[1024], m; + +__attribute__((noinline, noclone)) void +f1 (long a, long b) +{ + #pragma omp taskloop simd default(none) shared(u, v, w) nogroup + for (long d = a; d < b; d++) + u[d] = v[d] + w[d]; +} + +__attribute__((noinline, noclone)) int +f2 (long a, long b, long c) +{ + int d, e; + #pragma omp taskloop simd default(none) shared(u, v, w) linear(d:1) linear(c:5) lastprivate(e) + for (d = a; d < b; d++) + { + u[d] = v[d] + w[d]; + c = c + 5; + e = c + 9; + } + return d + c + e; +} + +__attribute__((noinline, noclone)) int +f3 (long a, long b) +{ + int d; + #pragma omp taskloop simd default(none) shared(u, v, w) + for (d = a; d < b; d++) + { + int *p = &d; + u[d] = v[d] + w[d]; + } + return d; +} + +__attribute__((noinline, noclone)) int +f4 (long a, long b, long c, long d) +{ + int e, f, g; + #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2) lastprivate(g) + for (e = a; e < b; e++) + for (f = c; f < d; f++) + { + int *p = &e; + int *q = &f; + int r = 32 * e + f; + u[r] = v[r] + w[r]; + g = r; + } + return e + f + g; +} + +__attribute__((noinline, noclone)) int +f5 (long a, long b, long c, long d) +{ + int e, f; + #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2) + for (e = a; e < b; e++) + for (f = c; f < d; f++) + { + int r = 32 * e + f; + u[r] = v[r] + w[r]; + } + return e + f; +} + +int +main () +{ + int i; + for (i = 0; i < 1024; i++) + { + v[i] = i; + w[i] = i + 1; + } + #pragma omp parallel + #pragma omp single + f1 (0, 1024); + for (i = 0; i < 1024; i++) + if (u[i] != 2 * i + 1) + __builtin_abort (); + else + { + v[i] = 1024 - i; + w[i] = 512 - i; + } + #pragma omp parallel + #pragma omp single + m = f2 (2, 1022, 17); + for (i = 0; i < 1024; i++) + if ((i < 2 || i >= 1022) ? u[i] != 2 * i + 1 : u[i] != 1536 - 2 * i) + __builtin_abort (); + else + { + v[i] = i; + w[i] = i + 1; + } + if (m != 1022 + 2 * (1020 * 5 + 17) + 9) + __builtin_abort (); + #pragma omp parallel + #pragma omp single + m = f3 (0, 1024); + for (i = 0; i < 1024; i++) + if (u[i] != 2 * i + 1) + __builtin_abort (); + else + { + v[i] = 1024 - i; + w[i] = 512 - i; + } + if (m != 1024) + __builtin_abort (); + #pragma omp parallel + #pragma omp single + m = f4 (0, 32, 0, 32); + for (i = 0; i < 1024; i++) + if (u[i] != 1536 - 2 * i) + __builtin_abort (); + else + { + v[i] = i; + w[i] = i + 1; + } + if (m != 32 + 32 + 1023) + __builtin_abort (); + #pragma omp parallel + #pragma omp single + m = f5 (0, 32, 0, 32); + for (i = 0; i < 1024; i++) + if (u[i] != 2 * i + 1) + __builtin_abort (); + else + { + v[i] = 1024 - i; + w[i] = 512 - i; + } + if (m != 32 + 32) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/taskloop-3.c b/libgomp/testsuite/libgomp.c-c++-common/taskloop-3.c new file mode 100644 index 0000000..9650bf1 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/taskloop-3.c @@ -0,0 +1,85 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-std=c99" { target c } } */ + +int g; +int a[1024]; + +__attribute__((noinline, noclone)) int +f1 (int x) +{ + #pragma omp taskloop firstprivate (x) lastprivate (x) + for (int i = 0; i < 64; i++) + { + if (x != 74) + __builtin_abort (); + if (i == 63) + x = i + 4; + } + return x; +} + +__attribute__((noinline, noclone)) void +f2 (void) +{ + #pragma omp taskloop firstprivate (g) lastprivate (g) nogroup + for (int i = 0; i < 64; i++) + { + if (g != 77) + __builtin_abort (); + if (i == 63) + g = i + 9; + } +} + +__attribute__((noinline, noclone)) long long +f3 (long long a, long long b, long long c) +{ + long long i; + int l; + #pragma omp taskloop default (none) lastprivate (i, l) + for (i = a; i < b; i += c) + l = i; + return l * 7 + i; +} + +__attribute__((noinline, noclone)) long long +f4 (long long a, long long b, long long c, long long d, + long long e, long long f, int k) +{ + long long i, j; + int l; + #pragma omp taskloop default (none) collapse(2) \ + firstprivate (k) lastprivate (i, j, k, l) + for (i = a; i < b; i += e) + for (j = c; j < d; j += f) + { + if (k != 73) + __builtin_abort (); + if (i == 31 && j == 46) + k = i; + l = j; + } + return i + 5 * j + 11 * k + 17 * l; +} + +int +main () +{ + #pragma omp parallel + #pragma omp single + { + if (f1 (74) != 63 + 4) + __builtin_abort (); + g = 77; + f2 (); + #pragma omp taskwait + if (g != 63 + 9) + __builtin_abort (); + if (f3 (7, 12, 2) != 11 * 7 + 13) + __builtin_abort (); + if (f4 (0, 32, 16, 48, 1, 2, 73) != 32 + 5 * 48 + 11 * 31 + 17 * 46) + __builtin_abort (); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/taskloop-4.c b/libgomp/testsuite/libgomp.c-c++-common/taskloop-4.c new file mode 100644 index 0000000..4ac1b5a --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/taskloop-4.c @@ -0,0 +1,97 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int u[64], v; + +__attribute__((noinline, noclone)) int +test (int a, int b, int c, int d, void (*fn) (int, int, int, int), + int *num_tasks, int *min_iters, int *max_iters) +{ + int i, t = 0; + __builtin_memset (u, 0, sizeof u); + v = 0; + fn (a, b, c, d); + *min_iters = 0; + *max_iters = 0; + *num_tasks = v; + if (v) + { + *min_iters = u[0]; + *max_iters = u[0]; + t = u[0]; + for (i = 1; i < v; i++) + { + if (*min_iters > u[i]) + *min_iters = u[i]; + if (*max_iters < u[i]) + *max_iters = u[i]; + t += u[i]; + } + } + return t; +} + +void +grainsize (int a, int b, int c, int d) +{ + int i, j = 0, k = 0; + #pragma omp taskloop firstprivate (j, k) grainsize(d) + for (i = a; i < b; i += c) + { + if (j == 0) + { + #pragma omp atomic capture + k = v++; + if (k >= 64) + __builtin_abort (); + } + u[k] = ++j; + } +} + +void +num_tasks (int a, int b, int c, int d) +{ + int i, j = 0, k = 0; + #pragma omp taskloop firstprivate (j, k) num_tasks(d) + for (i = a; i < b; i += c) + { + if (j == 0) + { + #pragma omp atomic capture + k = v++; + if (k >= 64) + __builtin_abort (); + } + u[k] = ++j; + } +} + +int +main () +{ + #pragma omp parallel + #pragma omp single + { + int min_iters, max_iters, ntasks; + /* If grainsize is present, # of task loop iters is >= grainsize && < 2 * grainsize, + unless # of loop iterations is smaller than grainsize. */ + if (test (0, 79, 1, 17, grainsize, &ntasks, &min_iters, &max_iters) != 79 + || min_iters < 17 || max_iters >= 17 * 2) + __builtin_abort (); + if (test (-49, 2541, 7, 28, grainsize, &ntasks, &min_iters, &max_iters) != 370 + || min_iters < 28 || max_iters >= 28 * 2) + __builtin_abort (); + if (test (7, 21, 2, 15, grainsize, &ntasks, &min_iters, &max_iters) != 7 + || ntasks != 1 || min_iters != 7 || max_iters != 7) + __builtin_abort (); + /* If num_tasks is present, # of task loop iters is min (# of loop iters, num_tasks). */ + if (test (-51, 2500, 48, 9, num_tasks, &ntasks, &min_iters, &max_iters) != 54 + || ntasks != 9) + __builtin_abort (); + if (test (0, 25, 2, 17, num_tasks, &ntasks, &min_iters, &max_iters) != 13 + || ntasks != 13) + __builtin_abort (); + } + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/udr-1.c b/libgomp/testsuite/libgomp.c-c++-common/udr-1.c new file mode 100644 index 0000000..ea9da72 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/udr-1.c @@ -0,0 +1,81 @@ +/* { dg-do run } */ + +extern +#ifdef __cplusplus +"C" +#endif +void abort (); + +struct S { int s; struct S *t; }; + +void +foo (struct S *out, struct S *in) +{ + out->s += in->s; +} + +void +bar (struct S *x) +{ + if (x->s != 6) abort (); + x->s = 15; +} + +void +baz (struct S *x, struct S *y) +{ + x->s = 6; + x->t = x; + (void) y; +} + +#pragma omp declare reduction (foo: struct S: foo (&omp_out, &omp_in)) \ + initializer (omp_priv = { 8, &omp_priv }) +#pragma omp declare reduction (foo: char, int, short: omp_out += omp_in - 4) \ + initializer (omp_priv = 4) +#pragma omp declare reduction (+: struct S: foo (&omp_out, &omp_in)) \ + initializer (baz (&omp_priv, &omp_orig)) + +void +test (struct S s, struct S t) +{ + int q = 0; + #pragma omp parallel num_threads (4) reduction (+: s, q) reduction (foo: t) + { + if (s.s != 6 || s.t != &s || t.s != 8 || t.t != &t) + abort (); + s.s = 2; + t.s = 3; + q = 1; + } + if (s.s != 12 + 2 * q || t.s != 14 + 3 * q) + abort (); +} + +int +main () +{ + struct S s, t; + s.s = 9; t.s = 10; + int h = 30, v = 2, q = 0; + #pragma omp declare reduction (foo: struct S: omp_out.s *= omp_in.s) \ + initializer (omp_priv = omp_orig) + { + #pragma omp declare reduction (foo: struct S: omp_out.s += omp_in.s) \ + initializer (omp_priv = omp_orig) + #pragma omp parallel num_threads (4) reduction (+: t, q) \ + reduction (min: h) reduction (foo: s, v) + { + if (s.s != 9 || t.s != 6 || v != 4 || h != __INT_MAX__) abort (); + asm volatile ("" : "+m" (s.s), "+m" (t.s)); + asm volatile ("" : "+r" (h), "+r" (v)); + h = t.s; s.s++; t.s++; v++; q++; + } + } + if (h != 6 || s.s != 9 + q * 10 || t.s != 10 + q * 7 || v != 2 + q) + abort (); + s.s = 12; + t.s = 14; + test (s, t); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/atomic-18.c b/libgomp/testsuite/libgomp.c/atomic-18.c deleted file mode 100644 index 4f7361e..0000000 --- a/libgomp/testsuite/libgomp.c/atomic-18.c +++ /dev/null @@ -1,60 +0,0 @@ -/* PR c/64824 */ -/* { dg-do run } */ - -void -f1 (void) -{ - short a; - short b = 1; - int c = 3; -#pragma omp atomic capture - a = b = c << b; - if (b != 6 || a != 6) - __builtin_abort (); -} - -void -f2 (void) -{ - short a; - short b = 1; - int c = 3; -#pragma omp atomic capture - a = b = c + b; - if (b != 4 || a != 4) - __builtin_abort (); -} - -void -f3 (void) -{ - short a; - short b = 1; - long long int c = 3; -#pragma omp atomic capture - a = b = c + b; - if (b != 4 || a != 4) - __builtin_abort (); -} - -void -f4 (void) -{ - char a; - char b = 1; - long long int c = 3LL; -#pragma omp atomic capture - a = b = c << b; - if (b != 6 || a != 6) - __builtin_abort (); -} - -int -main () -{ - f1 (); - f2 (); - f3 (); - f4 (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c b/libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c deleted file mode 100644 index c7b8bf7..0000000 --- a/libgomp/testsuite/libgomp.c/cancel-taskgroup-2.c +++ /dev/null @@ -1,37 +0,0 @@ -/* { dg-do run } */ -/* { dg-set-target-env-var OMP_CANCELLATION "true" } */ - -#include -#include -#include - -int -main () -{ - #pragma omp parallel - #pragma omp taskgroup - #pragma omp task - { - #pragma omp cancel taskgroup - if (omp_get_cancellation ()) - abort (); - } - #pragma omp parallel - { - #pragma omp barrier - #pragma omp single - #pragma omp taskgroup - { - int i; - for (i = 0; i < 50; i++) - #pragma omp task - { - #pragma omp cancellation point taskgroup - usleep (30); - #pragma omp cancel taskgroup if (i > 5) - } - } - usleep (10); - } - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/for-1.c b/libgomp/testsuite/libgomp.c/for-1.c deleted file mode 100644 index 942c8e7..0000000 --- a/libgomp/testsuite/libgomp.c/for-1.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-additional-options "-std=gnu99" } */ - -extern void abort (void); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#define F parallel for -#define G pf -#include "for-1.h" -#undef F -#undef G - -#define F for -#define G f -#include "for-1.h" -#undef F -#undef G - -int -main () -{ - if (test_pf_static () - || test_pf_static32 () - || test_pf_auto () - || test_pf_guided32 () - || test_pf_runtime () - || test_f_static () - || test_f_static32 () - || test_f_auto () - || test_f_guided32 () - || test_f_runtime ()) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/for-1.h b/libgomp/testsuite/libgomp.c/for-1.h deleted file mode 100644 index fa82c5b..0000000 --- a/libgomp/testsuite/libgomp.c/for-1.h +++ /dev/null @@ -1,25 +0,0 @@ -#define S -#define N(x) M(x, G, static) -#include "for-2.h" -#undef S -#undef N -#define S schedule(static, 32) -#define N(x) M(x, G, static32) -#include "for-2.h" -#undef S -#undef N -#define S schedule(auto) -#define N(x) M(x, G, auto) -#include "for-2.h" -#undef S -#undef N -#define S schedule(guided, 32) -#define N(x) M(x, G, guided32) -#include "for-2.h" -#undef S -#undef N -#define S schedule(runtime) -#define N(x) M(x, G, runtime) -#include "for-2.h" -#undef S -#undef N diff --git a/libgomp/testsuite/libgomp.c/for-2.c b/libgomp/testsuite/libgomp.c/for-2.c deleted file mode 100644 index e43fdb3..0000000 --- a/libgomp/testsuite/libgomp.c/for-2.c +++ /dev/null @@ -1,49 +0,0 @@ -/* { dg-additional-options "-std=gnu99" } */ - -extern void abort (void); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#define F simd -#define G simd -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F parallel for simd -#define G pf_simd -#include "for-1.h" -#undef F -#undef G - -#undef SC -#define SC static -#define F for simd -#define G f_simd -#include "for-1.h" -#undef F -#undef G -#undef SC - -int -main () -{ - if (test_simd_normal () - || test_pf_simd_static () - || test_pf_simd_static32 () - || test_pf_simd_auto () - || test_pf_simd_guided32 () - || test_pf_simd_runtime () - || test_f_simd_static () - || test_f_simd_static32 () - || test_f_simd_auto () - || test_f_simd_guided32 () - || test_f_simd_runtime ()) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/for-2.h b/libgomp/testsuite/libgomp.c/for-2.h deleted file mode 100644 index 0bd116c..0000000 --- a/libgomp/testsuite/libgomp.c/for-2.h +++ /dev/null @@ -1,313 +0,0 @@ -#ifndef VARS -#define VARS -int a[1500]; -float b[10][15][10]; -__attribute__((noreturn)) void -noreturn (void) -{ - for (;;); -} -#endif -#ifndef SC -#define SC -#endif -#ifndef OMPTGT -#define OMPTGT -#endif -#ifndef OMPTO -#define OMPTO(v) do {} while (0) -#endif -#ifndef OMPFROM -#define OMPFROM(v) do {} while (0) -#endif - -__attribute__((noinline, noclone)) void -N(f0) (void) -{ - int i; - OMPTGT -#pragma omp F S - for (i = 0; i < 1500; i++) - a[i] += 2; -} - -__attribute__((noinline, noclone)) void -N(f1) (void) -{ - OMPTGT -#pragma omp F S - for (unsigned int i = __INT_MAX__; i < 3000U + __INT_MAX__; i += 2) - a[(i - __INT_MAX__) >> 1] -= 2; -} - -__attribute__((noinline, noclone)) void -N(f2) (void) -{ - unsigned long long i; - OMPTGT -#pragma omp F S - for (i = __LONG_LONG_MAX__ + 4500ULL - 27; - i > __LONG_LONG_MAX__ - 27ULL; i -= 3) - a[(i + 26LL - __LONG_LONG_MAX__) / 3] -= 4; -} - -__attribute__((noinline, noclone)) void -N(f3) (long long n1, long long n2, long long s3) -{ - OMPTGT -#pragma omp F S - for (long long i = n1 + 23; i > n2 - 25; i -= s3) - a[i + 48] += 7; -} - -__attribute__((noinline, noclone)) void -N(f4) (void) -{ - unsigned int i; - OMPTGT -#pragma omp F S - for (i = 30; i < 20; i += 2) - a[i] += 10; -} - -__attribute__((noinline, noclone)) void -N(f5) (int n11, int n12, int n21, int n22, int n31, int n32, - int s1, int s2, int s3) -{ - SC int v1, v2, v3; - OMPTGT -#pragma omp F S collapse(3) - for (v1 = n11; v1 < n12; v1 += s1) - for (v2 = n21; v2 < n22; v2 += s2) - for (v3 = n31; v3 < n32; v3 += s3) - b[v1][v2][v3] += 2.5; -} - -__attribute__((noinline, noclone)) void -N(f6) (int n11, int n12, int n21, int n22, long long n31, long long n32, - int s1, int s2, long long int s3) -{ - SC int v1, v2; - SC long long v3; - OMPTGT -#pragma omp F S collapse(3) - for (v1 = n11; v1 > n12; v1 += s1) - for (v2 = n21; v2 > n22; v2 += s2) - for (v3 = n31; v3 > n32; v3 += s3) - b[v1][v2 / 2][v3] -= 4.5; -} - -__attribute__((noinline, noclone)) void -N(f7) (void) -{ - SC unsigned int v1, v3; - SC unsigned long long v2; - OMPTGT -#pragma omp F S collapse(3) - for (v1 = 0; v1 < 20; v1 += 2) - for (v2 = __LONG_LONG_MAX__ + 16ULL; - v2 > __LONG_LONG_MAX__ - 29ULL; v2 -= 3) - for (v3 = 10; v3 > 0; v3--) - b[v1 >> 1][(v2 - __LONG_LONG_MAX__ + 64) / 3 - 12][v3 - 1] += 5.5; -} - -__attribute__((noinline, noclone)) void -N(f8) (void) -{ - SC long long v1, v2, v3; - OMPTGT -#pragma omp F S collapse(3) - for (v1 = 0; v1 < 20; v1 += 2) - for (v2 = 30; v2 < 20; v2++) - for (v3 = 10; v3 < 0; v3--) - b[v1][v2][v3] += 5.5; -} - -__attribute__((noinline, noclone)) void -N(f9) (void) -{ - int i; - OMPTGT -#pragma omp F S - for (i = 20; i < 10; i++) - { - a[i] += 2; - noreturn (); - a[i] -= 4; - } -} - -__attribute__((noinline, noclone)) void -N(f10) (void) -{ - SC int i; - OMPTGT -#pragma omp F S collapse(3) - for (i = 0; i < 10; i++) - for (int j = 10; j < 8; j++) - for (long k = -10; k < 10; k++) - { - b[i][j][k] += 4; - noreturn (); - b[i][j][k] -= 8; - } -} - -__attribute__((noinline, noclone)) void -N(f11) (int n) -{ - int i; - OMPTGT -#pragma omp F S - for (i = 20; i < n; i++) - { - a[i] += 8; - noreturn (); - a[i] -= 16; - } -} - -__attribute__((noinline, noclone)) void -N(f12) (int n) -{ - SC int i; - OMPTGT -#pragma omp F S collapse(3) - for (i = 0; i < 10; i++) - for (int j = n; j < 8; j++) - for (long k = -10; k < 10; k++) - { - b[i][j][k] += 16; - noreturn (); - b[i][j][k] -= 32; - } -} - -__attribute__((noinline, noclone)) void -N(f13) (void) -{ - int *i; - OMPTGT -#pragma omp F S - for (i = a; i < &a[1500]; i++) - i[0] += 2; -} - -__attribute__((noinline, noclone)) void -N(f14) (void) -{ - SC float *i; - OMPTGT -#pragma omp F S collapse(3) - for (i = &b[0][0][0]; i < &b[0][0][10]; i++) - for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10) - for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k) - b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1] - -= 3.5; -} - -__attribute__((noinline, noclone)) int -N(test) (void) -{ - int i, j, k; - for (i = 0; i < 1500; i++) - a[i] = i - 25; - OMPTO (a); - N(f0) (); - OMPFROM (a); - for (i = 0; i < 1500; i++) - if (a[i] != i - 23) - return 1; - N(f1) (); - OMPFROM (a); - for (i = 0; i < 1500; i++) - if (a[i] != i - 25) - return 1; - N(f2) (); - OMPFROM (a); - for (i = 0; i < 1500; i++) - if (a[i] != i - 29) - return 1; - N(f3) (1500LL - 1 - 23 - 48, -1LL + 25 - 48, 1LL); - OMPFROM (a); - for (i = 0; i < 1500; i++) - if (a[i] != i - 22) - return 1; - N(f3) (1500LL - 1 - 23 - 48, 1500LL - 1, 7LL); - OMPFROM (a); - for (i = 0; i < 1500; i++) - if (a[i] != i - 22) - return 1; - N(f4) (); - OMPFROM (a); - for (i = 0; i < 1500; i++) - if (a[i] != i - 22) - return 1; - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - b[i][j][k] = i - 2.5 + 1.5 * j - 1.5 * k; - OMPTO (b); - N(f5) (0, 10, 0, 15, 0, 10, 1, 1, 1); - OMPFROM (b); - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - if (b[i][j][k] != i + 1.5 * j - 1.5 * k) - return 1; - N(f5) (0, 10, 30, 15, 0, 10, 4, 5, 6); - OMPFROM (b); - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - if (b[i][j][k] != i + 1.5 * j - 1.5 * k) - return 1; - N(f6) (9, -1, 29, 0, 9, -1, -1, -2, -1); - OMPFROM (b); - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - if (b[i][j][k] != i - 4.5 + 1.5 * j - 1.5 * k) - return 1; - N(f7) (); - OMPFROM (b); - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k) - return 1; - N(f8) (); - OMPFROM (b); - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k) - return 1; - N(f9) (); - N(f10) (); - N(f11) (10); - N(f12) (12); - OMPFROM (a); - OMPFROM (b); - for (i = 0; i < 1500; i++) - if (a[i] != i - 22) - return 1; - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - if (b[i][j][k] != i + 1.0 + 1.5 * j - 1.5 * k) - return 1; - N(f13) (); - N(f14) (); - OMPFROM (a); - OMPFROM (b); - for (i = 0; i < 1500; i++) - if (a[i] != i - 20) - return 1; - for (i = 0; i < 10; i++) - for (j = 0; j < 15; j++) - for (k = 0; k < 10; k++) - if (b[i][j][k] != i - 2.5 + 1.5 * j - 1.5 * k) - return 1; - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/for-3.c b/libgomp/testsuite/libgomp.c/for-3.c deleted file mode 100644 index f4cd115..0000000 --- a/libgomp/testsuite/libgomp.c/for-3.c +++ /dev/null @@ -1,110 +0,0 @@ -/* { dg-additional-options "-std=gnu99" } */ - -extern void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#pragma omp declare target - -#define F distribute -#define G d -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute -#define G d_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute simd -#define G ds -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute simd -#define G ds_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F distribute parallel for -#define G dpf -#include "for-1.h" -#undef F -#undef G - -#define F distribute parallel for dist_schedule(static, 128) -#define G dpf_ds128 -#include "for-1.h" -#undef F -#undef G - -#define F distribute parallel for simd -#define G dpfs -#include "for-1.h" -#undef F -#undef G - -#define F distribute parallel for simd dist_schedule(static, 128) -#define G dpfs_ds128 -#include "for-1.h" -#undef F -#undef G - -#pragma omp end declare target - -int -main () -{ - int err = 0; - #pragma omp target teams reduction(|:err) - { - err |= test_d_normal (); - err |= test_d_ds128_normal (); - err |= test_ds_normal (); - err |= test_ds_ds128_normal (); - err |= test_dpf_static (); - err |= test_dpf_static32 (); - err |= test_dpf_auto (); - err |= test_dpf_guided32 (); - err |= test_dpf_runtime (); - err |= test_dpf_ds128_static (); - err |= test_dpf_ds128_static32 (); - err |= test_dpf_ds128_auto (); - err |= test_dpf_ds128_guided32 (); - err |= test_dpf_ds128_runtime (); - err |= test_dpfs_static (); - err |= test_dpfs_static32 (); - err |= test_dpfs_auto (); - err |= test_dpfs_guided32 (); - err |= test_dpfs_runtime (); - err |= test_dpfs_ds128_static (); - err |= test_dpfs_ds128_static32 (); - err |= test_dpfs_ds128_auto (); - err |= test_dpfs_ds128_guided32 (); - err |= test_dpfs_ds128_runtime (); - } - if (err) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/for-4.c b/libgomp/testsuite/libgomp.c/for-4.c deleted file mode 100644 index 14f900b..0000000 --- a/libgomp/testsuite/libgomp.c/for-4.c +++ /dev/null @@ -1,42 +0,0 @@ -/* { dg-options "-std=gnu99" } */ - -extern void abort (void); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#define F taskloop -#define G taskloop -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F taskloop simd -#define G taskloop_simd -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -int -main () -{ - int err = 0; - #pragma omp parallel reduction(|:err) - #pragma omp single - { - if (test_taskloop_normal () - || test_taskloop_simd_normal ()) - err = 1; - } - if (err) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/for-5.c b/libgomp/testsuite/libgomp.c/for-5.c deleted file mode 100644 index 84e636a..0000000 --- a/libgomp/testsuite/libgomp.c/for-5.c +++ /dev/null @@ -1,154 +0,0 @@ -/* { dg-additional-options "-std=gnu99" } */ - -extern void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#pragma omp declare target - -#define F for -#define G f -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#pragma omp end declare target - -#undef OMPFROM -#undef OMPTO -#define DO_PRAGMA(x) _Pragma (#x) -#define OMPFROM(v) DO_PRAGMA (omp target update from(v)) -#define OMPTO(v) DO_PRAGMA (omp target update to(v)) - -#define F target parallel for -#define G tpf -#include "for-1.h" -#undef F -#undef G - -#define F target simd -#define G t_simd -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target parallel for simd -#define G tpf_simd -#include "for-1.h" -#undef F -#undef G - -#define F target teams distribute -#define G ttd -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute -#define G ttd_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute simd -#define G ttds -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute simd -#define G ttds_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F target teams distribute parallel for -#define G ttdpf -#include "for-1.h" -#undef F -#undef G - -#define F target teams distribute parallel for dist_schedule(static, 128) -#define G ttdpf_ds128 -#include "for-1.h" -#undef F -#undef G - -#define F target teams distribute parallel for simd -#define G ttdpfs -#include "for-1.h" -#undef F -#undef G - -#define F target teams distribute parallel for simd dist_schedule(static, 128) -#define G ttdpfs_ds128 -#include "for-1.h" -#undef F -#undef G - -int -main () -{ - if (test_tpf_static () - || test_tpf_static32 () - || test_tpf_auto () - || test_tpf_guided32 () - || test_tpf_runtime () - || test_t_simd_normal () - || test_tpf_simd_static () - || test_tpf_simd_static32 () - || test_tpf_simd_auto () - || test_tpf_simd_guided32 () - || test_tpf_simd_runtime () - || test_ttd_normal () - || test_ttd_ds128_normal () - || test_ttds_normal () - || test_ttds_ds128_normal () - || test_ttdpf_static () - || test_ttdpf_static32 () - || test_ttdpf_auto () - || test_ttdpf_guided32 () - || test_ttdpf_runtime () - || test_ttdpf_ds128_static () - || test_ttdpf_ds128_static32 () - || test_ttdpf_ds128_auto () - || test_ttdpf_ds128_guided32 () - || test_ttdpf_ds128_runtime () - || test_ttdpfs_static () - || test_ttdpfs_static32 () - || test_ttdpfs_auto () - || test_ttdpfs_guided32 () - || test_ttdpfs_runtime () - || test_ttdpfs_ds128_static () - || test_ttdpfs_ds128_static32 () - || test_ttdpfs_ds128_auto () - || test_ttdpfs_ds128_guided32 () - || test_ttdpfs_ds128_runtime ()) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/for-6.c b/libgomp/testsuite/libgomp.c/for-6.c deleted file mode 100644 index 7f3c65e..0000000 --- a/libgomp/testsuite/libgomp.c/for-6.c +++ /dev/null @@ -1,123 +0,0 @@ -/* { dg-additional-options "-std=gnu99" } */ - -extern void abort (); - -#define M(x, y, z) O(x, y, z) -#define O(x, y, z) x ## _ ## y ## _ ## z - -#pragma omp declare target - -#define F for -#define G f -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#pragma omp end declare target - -#undef OMPTGT -#undef OMPFROM -#undef OMPTO -#define DO_PRAGMA(x) _Pragma (#x) -#define OMPTGT DO_PRAGMA (omp target) -#define OMPFROM(v) DO_PRAGMA (omp target update from(v)) -#define OMPTO(v) DO_PRAGMA (omp target update to(v)) - -#define F teams distribute -#define G td -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute -#define G td_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute simd -#define G tds -#define S -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute simd -#define G tds_ds128 -#define S dist_schedule(static, 128) -#define N(x) M(x, G, normal) -#include "for-2.h" -#undef S -#undef N -#undef F -#undef G - -#define F teams distribute parallel for -#define G tdpf -#include "for-1.h" -#undef F -#undef G - -#define F teams distribute parallel for dist_schedule(static, 128) -#define G tdpf_ds128 -#include "for-1.h" -#undef F -#undef G - -#define F teams distribute parallel for simd -#define G tdpfs -#include "for-1.h" -#undef F -#undef G - -#define F teams distribute parallel for simd dist_schedule(static, 128) -#define G tdpfs_ds128 -#include "for-1.h" -#undef F -#undef G - -int -main () -{ - if (test_td_normal () - || test_td_ds128_normal () - || test_tds_normal () - || test_tds_ds128_normal () - || test_tdpf_static () - || test_tdpf_static32 () - || test_tdpf_auto () - || test_tdpf_guided32 () - || test_tdpf_runtime () - || test_tdpf_ds128_static () - || test_tdpf_ds128_static32 () - || test_tdpf_ds128_auto () - || test_tdpf_ds128_guided32 () - || test_tdpf_ds128_runtime () - || test_tdpfs_static () - || test_tdpfs_static32 () - || test_tdpfs_auto () - || test_tdpfs_guided32 () - || test_tdpfs_runtime () - || test_tdpfs_ds128_static () - || test_tdpfs_ds128_static32 () - || test_tdpfs_ds128_auto () - || test_tdpfs_ds128_guided32 () - || test_tdpfs_ds128_runtime ()) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/loop-13.c b/libgomp/testsuite/libgomp.c/loop-13.c deleted file mode 100644 index 997c628..0000000 --- a/libgomp/testsuite/libgomp.c/loop-13.c +++ /dev/null @@ -1,253 +0,0 @@ -/* { dg-do run } */ - -volatile int ji = 100, ki = 2; -volatile unsigned int ju = 100, ku = 2; -volatile long long int jll = 100, kll = 2; -volatile unsigned long long int jull = 100, kull = 2; -unsigned long long l; - -void -f0 (void) -{ - int i, j, k; - unsigned int j2, k2; - #pragma omp for reduction(+: l) - for (i = ji; i < ki; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) - for (i = ji; i < ki; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = ji; i < ki; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = ji; i < ki; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = ki + 10; k < ji - 10; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = ki + 10; j < ji - 10; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f1 (void) -{ - unsigned int i, j, k; - int j2, k2; - #pragma omp for reduction(+: l) - for (i = ju; i < ku; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) - for (i = ju; i < ku; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = ju; i < ku; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = ju; i < ku; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = ku; k < ju; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = ku; j < ju; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f2 (void) -{ - long long int i, j, k; - unsigned long long int j2, k2; - #pragma omp for reduction(+: l) - for (i = jll; i < kll; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) - for (i = jll; i < kll; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = jll; i < kll; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = jll; i < kll; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = kll; k < jll; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = kll; j < jll; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f3 (void) -{ - unsigned long long int i, j, k; - long long int j2, k2; - #pragma omp for reduction(+: l) - for (i = jull; i < kull; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) - for (i = jull; i < kull; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = jull; i < kull; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j2 = 0; j2 < 4; j2++) - for (i = jull; i < kull; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = kull; k < jull; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) - for (j = kull; j < jull; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -int -main () -{ - f0 (); - f1 (); - f2 (); - f3 (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/loop-14.c b/libgomp/testsuite/libgomp.c/loop-14.c deleted file mode 100644 index b8a163c..0000000 --- a/libgomp/testsuite/libgomp.c/loop-14.c +++ /dev/null @@ -1,253 +0,0 @@ -/* { dg-do run } */ - -volatile int ji = 100, ki = 2; -volatile unsigned int ju = 100, ku = 2; -volatile long long int jll = 100, kll = 2; -volatile unsigned long long int jull = 100, kull = 2; -unsigned long long l; - -void -f0 (void) -{ - int i, j, k; - unsigned int j2, k2; - #pragma omp for reduction(+: l) schedule(static, 2) - for (i = ji; i < ki; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(static, 2) - for (i = ji; i < ki; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = ji; i < ki; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = ji; i < ki; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = ki + 10; k < ji - 10; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = ki + 10; j < ji - 10; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f1 (void) -{ - unsigned int i, j, k; - int j2, k2; - #pragma omp for reduction(+: l) schedule(static, 2) - for (i = ju; i < ku; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(static, 2) - for (i = ju; i < ku; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = ju; i < ku; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = ju; i < ku; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = ku; k < ju; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = ku; j < ju; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f2 (void) -{ - long long int i, j, k; - unsigned long long int j2, k2; - #pragma omp for reduction(+: l) schedule(static, 2) - for (i = jll; i < kll; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(static, 2) - for (i = jll; i < kll; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = jll; i < kll; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = jll; i < kll; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = kll; k < jll; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = kll; j < jll; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f3 (void) -{ - unsigned long long int i, j, k; - long long int j2, k2; - #pragma omp for reduction(+: l) schedule(static, 2) - for (i = jull; i < kull; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(static, 2) - for (i = jull; i < kull; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = jull; i < kull; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j2 = 0; j2 < 4; j2++) - for (i = jull; i < kull; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = kull; k < jull; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(static, 2) - for (j = kull; j < jull; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -int -main () -{ - f0 (); - f1 (); - f2 (); - f3 (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/loop-15.c b/libgomp/testsuite/libgomp.c/loop-15.c deleted file mode 100644 index e7cf3fc..0000000 --- a/libgomp/testsuite/libgomp.c/loop-15.c +++ /dev/null @@ -1,253 +0,0 @@ -/* { dg-do run } */ - -volatile int ji = 100, ki = 2; -volatile unsigned int ju = 100, ku = 2; -volatile long long int jll = 100, kll = 2; -volatile unsigned long long int jull = 100, kull = 2; -unsigned long long l; - -void -f0 (void) -{ - int i, j, k; - unsigned int j2, k2; - #pragma omp for reduction(+: l) schedule(runtime) - for (i = ji; i < ki; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(runtime) - for (i = ji; i < ki; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = ji; i < ki; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = ji; i < ki; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = ji; i < ki; i++) - for (k = ki + 10; k < ji - 10; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = ki + 10; j < ji - 10; j++) - for (i = ji; i < ki; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f1 (void) -{ - unsigned int i, j, k; - int j2, k2; - #pragma omp for reduction(+: l) schedule(runtime) - for (i = ju; i < ku; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(runtime) - for (i = ju; i < ku; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = ju; i < ku; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = ju; i < ku; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = ju; i < ku; i++) - for (k = ku; k < ju; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = ku; j < ju; j++) - for (i = ju; i < ku; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f2 (void) -{ - long long int i, j, k; - unsigned long long int j2, k2; - #pragma omp for reduction(+: l) schedule(runtime) - for (i = jll; i < kll; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(runtime) - for (i = jll; i < kll; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = jll; i < kll; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = jll; i < kll; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = jll; i < kll; i++) - for (k = kll; k < jll; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = kll; j < jll; j++) - for (i = jll; i < kll; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -void -f3 (void) -{ - unsigned long long int i, j, k; - long long int j2, k2; - #pragma omp for reduction(+: l) schedule(runtime) - for (i = jull; i < kull; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) schedule(runtime) - for (i = jull; i < kull; i++) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = jull; i < kull; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j2 = 0; j2 < 4; j2++) - for (i = jull; i < kull; i++) - for (k2 = 0; k2 < 5; k2 += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = 0; j < 4; j++) - for (i = jull; i < kull; i++) - for (k = kull; k < jull; k += 2) - l++; - if (l != 0) - __builtin_abort (); - #pragma omp parallel for reduction(+: l) collapse(3) schedule(runtime) - for (j = kull; j < jull; j++) - for (i = jull; i < kull; i++) - for (k = 0; k < 5; k += 2) - l++; - if (l != 0) - __builtin_abort (); -} - -int -main () -{ - f0 (); - f1 (); - f2 (); - f3 (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/monotonic-1.c b/libgomp/testsuite/libgomp.c/monotonic-1.c deleted file mode 100644 index c3c0100..0000000 --- a/libgomp/testsuite/libgomp.c/monotonic-1.c +++ /dev/null @@ -1,303 +0,0 @@ -/* { dg-do run } */ - -#ifndef MONOTONIC_TYPE -#include -#include -#define MONOTONIC_TYPE int -#define MONOTONIC_UNDEF -1 -#define MONOTONIC_END(n) n -#endif - -int -main () -{ - MONOTONIC_TYPE i; - #pragma omp parallel - { - int cnt = omp_get_num_threads (); - int thr = omp_get_thread_num (); - MONOTONIC_TYPE l = MONOTONIC_UNDEF; - int c = 0; - int n = 0; - #pragma omp for nowait schedule(static, 5) - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - { - if (l >= i) - abort (); - if (cnt == 1) - abort (); - if (n != 5) - abort (); - n = 1; - c++; - } - if (n == 1) - { - if ((i % 5) != 0) - abort (); - if ((i / 5) % cnt != thr) - abort (); - } - l = i; - } - if (cnt == 1) - { - if (n != 73 || l != 73 - 1 || c != 1) - abort (); - } - else if (thr > 73 / 5) - { - if (l != MONOTONIC_UNDEF || c != 0 || n != 0) - abort (); - } - else if (thr == 73 / 5) - { - if (l != 73 - 1 || c != 1 || n != 73 % 5) - abort (); - } - else if (c == 0) - abort (); - else if (l == 73 - 1) - { - if (thr != (73 / 5) % cnt || n != 73 % 5) - abort (); - } - else if ((n % 5) != 0) - abort (); - l = MONOTONIC_UNDEF; - c = 0; - n = 0; - #pragma omp for schedule( monotonic: static, 7) nowait - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - { - if (l >= i) - abort (); - if (cnt == 1) - abort (); - if (n != 7) - abort (); - n = 1; - c++; - } - if (n == 1) - { - if ((i % 7) != 0) - abort (); - if ((i / 7) % cnt != thr) - abort (); - } - l = i; - } - if (cnt == 1) - { - if (n != 73 || l != 73 - 1 || c != 1) - abort (); - } - else if (thr > 73 / 7) - { - if (l != MONOTONIC_UNDEF || c != 0 || n != 0) - abort (); - } - else if (thr == 73 / 7) - { - if (l != 73 - 1 || c != 1 || n != 73 % 7) - abort (); - } - else if (c == 0) - abort (); - else if (l == 73 - 1) - { - if (thr != (73 / 7) % cnt || n != 73 % 7) - abort (); - } - else if ((n % 7) != 0) - abort (); - l = MONOTONIC_UNDEF; - c = 0; - n = 0; - #pragma omp for nowait schedule(static) - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - abort (); - l = i; - } - if (c > 1) - abort (); - l = MONOTONIC_UNDEF; - c = 0; - n = 0; - #pragma omp for nowait schedule(monotonic,simd:static) - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - abort (); - l = i; - } - if (c > 1) - abort (); - l = MONOTONIC_UNDEF; - c = 0; - n = 0; - #pragma omp for schedule(monotonic : dynamic, 5) nowait - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - { - if (l >= i) - abort (); - if ((n % 5) != 0 || n == 0) - abort (); - n = 1; - c++; - } - l = i; - } - if (l == 73 - 1) - { - if (n % 5 != 73 % 5) - abort (); - } - else if (l == MONOTONIC_UNDEF) - { - if (n != 0 || c != 0) - abort (); - } - else if ((n % 5) != 0 || n == 0) - abort (); - l = MONOTONIC_UNDEF; - c = 0; - n = 0; - #pragma omp for nowait schedule(dynamic, 7) ordered(1) - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - { - if (l >= i) - abort (); - if ((n % 7) != 0 || n == 0) - abort (); - n = 1; - c++; - } - #pragma omp ordered depend(source) - if (MONOTONIC_UNDEF > 0) - { - #pragma omp ordered depend(sink: i) - } - else - { - #pragma omp ordered depend(sink: i - 1) - } - l = i; - } - if (l == 73 - 1) - { - if (n % 7 != 73 % 7) - abort (); - } - else if (l == MONOTONIC_UNDEF) - { - if (n != 0 || c != 0) - abort (); - } - else if ((n % 7) != 0 || n == 0) - abort (); - l = MONOTONIC_UNDEF; - c = 0; - n = 0; - #pragma omp for schedule (monotonic :guided , 7) nowait - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - { - if (l >= i) - abort (); - if (n < 7) - abort (); - n = 1; - c++; - } - l = i; - } - l = MONOTONIC_UNDEF; - c = 0; - n = 0; - #pragma omp for nowait schedule(guided, 7) ordered - for (i = 0; i < MONOTONIC_END (73); i++) - { - if (l == MONOTONIC_UNDEF) - { - n = 1; - c++; - } - else if (l == i - 1) - n++; - else - { - if (l >= i) - abort (); - if (n < 7) - abort (); - n = 1; - c++; - } - #pragma omp ordered - l = i; - } - } - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/monotonic-2.c b/libgomp/testsuite/libgomp.c/monotonic-2.c deleted file mode 100644 index b886a24..0000000 --- a/libgomp/testsuite/libgomp.c/monotonic-2.c +++ /dev/null @@ -1,11 +0,0 @@ -/* { dg-do run } */ - -#include -#include -#define MONOTONIC_TYPE unsigned long long -#define MONOTONIC_UNDEF -1ULL -#define MONOTONIC_END(n) n + v - -volatile int v; - -#include "monotonic-1.c" diff --git a/libgomp/testsuite/libgomp.c/nonmonotonic-1.c b/libgomp/testsuite/libgomp.c/nonmonotonic-1.c deleted file mode 100644 index fc5e93f..0000000 --- a/libgomp/testsuite/libgomp.c/nonmonotonic-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* { dg-do run } */ - -#ifndef NONMONOTONIC_TYPE -#include -#include -#define NONMONOTONIC_TYPE int -#define NONMONOTONIC_END(n) n -#endif - -int a[73]; - -int -main () -{ - NONMONOTONIC_TYPE i; - #pragma omp parallel for schedule(nonmonotonic: dynamic) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp parallel for schedule(nonmonotonic: dynamic, 5) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp parallel for schedule(nonmonotonic: guided) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp parallel for schedule(nonmonotonic: guided, 7) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp parallel - { - int cnt = omp_get_num_threads (); - int thr = omp_get_thread_num (); - if (thr < 73) - a[thr]++; - #pragma omp barrier - #pragma omp for schedule(nonmonotonic: dynamic) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp for schedule(nonmonotonic: dynamic, 7) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp for schedule(nonmonotonic: guided) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp for schedule(nonmonotonic: guided, 5) - for (i = 0; i < NONMONOTONIC_END (73); i++) - a[i]++; - #pragma omp single private (i) - for (i = 0; i < 73; i++) - if (a[i] != 8 + (i < cnt)) - abort (); - } - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/nonmonotonic-2.c b/libgomp/testsuite/libgomp.c/nonmonotonic-2.c deleted file mode 100644 index c56fa1d..0000000 --- a/libgomp/testsuite/libgomp.c/nonmonotonic-2.c +++ /dev/null @@ -1,10 +0,0 @@ -/* { dg-do run } */ - -#include -#include -#define NONMONOTONIC_TYPE unsigned long long -#define NONMONOTONIC_END(n) n + v - -volatile int v; - -#include "nonmonotonic-1.c" diff --git a/libgomp/testsuite/libgomp.c/ordered-4.c b/libgomp/testsuite/libgomp.c/ordered-4.c deleted file mode 100644 index 8412d47..0000000 --- a/libgomp/testsuite/libgomp.c/ordered-4.c +++ /dev/null @@ -1,83 +0,0 @@ -extern -#ifdef __cplusplus -"C" -#endif -void abort (void); - -void -foo (int i, char *j) -{ - #pragma omp atomic - j[i]++; - #pragma omp ordered threads - { - int t; - #pragma omp atomic read - t = j[i]; - if (t != 3) - abort (); - if (i > 1) - { - #pragma omp atomic read - t = j[i - 1]; - if (t == 2) - abort (); - } - if (i < 127) - { - #pragma omp atomic read - t = j[i + 1]; - if (t == 4) - abort (); - } - } - #pragma omp atomic - j[i]++; -} - -int -main () -{ - int i; - char j[128]; - #pragma omp parallel - { - #pragma omp for - for (i = 0; i < 128; i++) - j[i] = 0; - #pragma omp for ordered schedule(dynamic, 1) - for (i = 0; i < 128; i++) - { - #pragma omp atomic - j[i]++; - #pragma omp ordered threads - { - int t; - #pragma omp atomic read - t = j[i]; - if (t != 1) - abort (); - if (i > 1) - { - #pragma omp atomic read - t = j[i - 1]; - if (t == 0) - abort (); - } - if (i < 127) - { - #pragma omp atomic read - t = j[i + 1]; - if (t == 2) - abort (); - } - } - #pragma omp atomic - j[i]++; - } - #pragma omp for ordered schedule(static, 1) - for (i = 0; i < 128; i++) - foo (i, j); - } - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr45784.c b/libgomp/testsuite/libgomp.c/pr45784.c deleted file mode 100644 index 7861210..0000000 --- a/libgomp/testsuite/libgomp.c/pr45784.c +++ /dev/null @@ -1,41 +0,0 @@ -/* PR c/45784 */ -/* { dg-do run } */ - -void -foo (int n) -{ - char *p, vla[2 * n]; - int i; - #pragma omp parallel for - for (p = vla; p < vla + (sizeof (vla) / sizeof (vla[0])); p++) - *p = ' '; - #pragma omp parallel for - for (i = 0; i < 2 * n; i++) - if (vla[i] != ' ') - __builtin_abort (); -} - -void -bar (int n) -{ - char *p, vla1[n], vla2[n * 2], vla3[n * 3], vla4[n * 4]; - int i; - __builtin_memset (vla4, ' ', n * 4); - #pragma omp parallel for - for (p = vla4 + sizeof (vla1); p < vla4 + sizeof (vla3) - sizeof (vla2) + sizeof (vla1); p += sizeof (vla4) / sizeof (vla4)) - p[0] = '!'; - #pragma omp parallel for - for (i = 0; i < n * 4; i++) - if (vla4[i] != ((i >= n && i < 2 * n) ? '!' : ' ')) - __builtin_abort (); -} - -int -main () -{ - volatile int n; - n = 128; - foo (n); - bar (n); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr64824.c b/libgomp/testsuite/libgomp.c/pr64824.c deleted file mode 100644 index b39675b..0000000 --- a/libgomp/testsuite/libgomp.c/pr64824.c +++ /dev/null @@ -1,15 +0,0 @@ -/* PR c/64824 */ -/* { dg-do run } */ - -int -main () -{ - long long a; - long long b = 1LL; - int c = 3; -#pragma omp atomic capture - a = b = c << b; - if (b != 6LL || a != 6LL) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr64868.c b/libgomp/testsuite/libgomp.c/pr64868.c deleted file mode 100644 index f93caf2..0000000 --- a/libgomp/testsuite/libgomp.c/pr64868.c +++ /dev/null @@ -1,86 +0,0 @@ -/* PR c/64868 */ -/* { dg-do run } */ - -float f = 2.0f; -double d = 4.0; -long double ld = 8.0L; - -void -foo () -{ -#pragma omp atomic - f = 1.0f / f; -#pragma omp atomic - f = 1 / f; -#pragma omp atomic - f = f / 2.0f; -#pragma omp atomic - f = f / 2; -#pragma omp atomic - f /= 2.0f; -#pragma omp atomic - f /= 2; -#pragma omp atomic - d = 1.0 / d; -#pragma omp atomic - d = 1 / d; -#pragma omp atomic - d = d / 2.0; -#pragma omp atomic - d = d / 2; -#pragma omp atomic - d /= 2.0; -#pragma omp atomic - d /= 2; -#pragma omp atomic - ld = 1.0L / ld; -#pragma omp atomic - ld = 1 / ld; -#pragma omp atomic - ld = ld / 2.0L; -#pragma omp atomic - ld = ld / 2; -#pragma omp atomic - ld /= 2.0L; -#pragma omp atomic - ld /= 2; - if (f != 0.125f || d != 0.25 || ld != 0.5L) - __builtin_abort (); -} - -#ifdef __cplusplus -template -void -bar () -{ - T v = ::d; -#pragma omp atomic - v *= 16; -#pragma omp atomic - v = 1.0 / v; -#pragma omp atomic - v = N1 / v; -#pragma omp atomic - v = v / 2.0; -#pragma omp atomic - v = v / N2; -#pragma omp atomic - v /= 2.0; -#pragma omp atomic - v /= N2; - if (v != 0.25) - __builtin_abort (); -} -#endif - -int -main () -{ - foo (); -#ifdef __cplusplus - bar (); - bar (); - bar (); -#endif - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-1.c b/libgomp/testsuite/libgomp.c/pr66199-1.c deleted file mode 100644 index 20482a4..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-1.c +++ /dev/null @@ -1,61 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ - -int u[1024], v[1024], w[1024]; - -__attribute__((noinline, noclone)) long -f1 (long a, long b) -{ - long d; - #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) - for (d = a; d < b; d++) - u[d] = v[d] + w[d]; - return d; -} - -__attribute__((noinline, noclone)) long -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v, w) linear(d) linear(c:5) lastprivate(e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - c += 5; - e = c; - } - return d + c + e; -} - -__attribute__((noinline, noclone)) long -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -__attribute__((noinline, noclone)) long -f4 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -int -main () -{ - if (f1 (0, 1024) != 1024 - || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024) - || f3 (0, 32, 0, 32) != 64 - || f4 (0, 32, 0, 32) != 64) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-2.c b/libgomp/testsuite/libgomp.c/pr66199-2.c deleted file mode 100644 index 2fc9eec..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ - -#pragma omp declare target -int u[1024], v[1024], w[1024]; -#pragma omp end declare target - -__attribute__((noinline, noclone)) void -f1 (long a, long b) -{ - long d; - #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) - for (d = a; d < b; d++) - u[d] = v[d] + w[d]; -} - -__attribute__((noinline, noclone)) void -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp target teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - e = c + d * 5; - } -} - -__attribute__((noinline, noclone)) void -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; -} - -__attribute__((noinline, noclone)) void -f4 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; -} - -int -main () -{ - f1 (0, 1024); - f2 (0, 1024, 17); - f3 (0, 32, 0, 32); - f4 (0, 32, 0, 32); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-3.c b/libgomp/testsuite/libgomp.c/pr66199-3.c deleted file mode 100644 index ffe2858..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-3.c +++ /dev/null @@ -1,50 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ -/* { dg-options "-O2" } */ - -int u[1024], v[1024], w[1024]; - -__attribute__((noinline, noclone)) long -f1 (long a, long b) -{ - long d; - #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) - for (d = a; d < b; d++) - u[d] = v[d] + w[d]; - return d; -} - -__attribute__((noinline, noclone)) long -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp parallel for lastprivate (d) default(none) firstprivate (a, b) shared(u, v, w) linear(c:5) lastprivate(e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - c += 5; - e = c; - } - return d + c + e; -} - -__attribute__((noinline, noclone)) long -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -int -main () -{ - if (f1 (0, 1024) != 1024 - || f2 (0, 1024, 17) != 1024 + 2 * (17 + 5 * 1024) - || f3 (0, 32, 0, 32) != 64) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-4.c b/libgomp/testsuite/libgomp.c/pr66199-4.c deleted file mode 100644 index 6ffa2e5..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-4.c +++ /dev/null @@ -1,58 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ -/* { dg-options "-O2" } */ - -#pragma omp declare target -int u[1024], v[1024], w[1024]; -#pragma omp end declare target - -__attribute__((noinline, noclone)) void -f1 (long a, long b) -{ - long d; - #pragma omp target teams distribute parallel for default(none) firstprivate (a, b) shared(u, v, w) - for (d = a; d < b; d++) - u[d] = v[d] + w[d]; -} - -__attribute__((noinline, noclone)) void -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp target teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - e = c + d * 5; - } -} - -__attribute__((noinline, noclone)) void -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; -} - -__attribute__((noinline, noclone)) void -f4 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; -} - -int -main () -{ - f1 (0, 1024); - f2 (0, 1024, 17); - f3 (0, 32, 0, 32); - f4 (0, 32, 0, 32); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-5.c b/libgomp/testsuite/libgomp.c/pr66199-5.c deleted file mode 100644 index 7ade43c..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-5.c +++ /dev/null @@ -1,66 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ - -#pragma omp declare target -int u[1024], v[1024], w[1024]; -#pragma omp end declare target - -__attribute__((noinline, noclone)) long -f1 (long a, long b) -{ - long d; - #pragma omp target map(from: d) - #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w) - for (d = a; d < b; d++) - u[d] = v[d] + w[d]; - return d; -} - -__attribute__((noinline, noclone)) long -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp target map(from: d, e) - #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - e = c + d * 5; - } - return d + e; -} - -__attribute__((noinline, noclone)) long -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -__attribute__((noinline, noclone)) long -f4 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -int -main () -{ - if (f1 (0, 1024) != 1024 - || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) - || f3 (0, 32, 0, 32) != 64 - || f4 (0, 32, 0, 32) != 64) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-6.c b/libgomp/testsuite/libgomp.c/pr66199-6.c deleted file mode 100644 index 14f8610..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-6.c +++ /dev/null @@ -1,42 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ -/* { dg-options "-O2" } */ - -#pragma omp declare target -int u[1024], v[1024], w[1024]; -#pragma omp end declare target - -__attribute__((noinline, noclone)) long -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp target map(from: d, e) - #pragma omp teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - e = c + d * 5; - } - return d + e; -} - -__attribute__((noinline, noclone)) long -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -int -main () -{ - if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) - || f3 (0, 32, 0, 32) != 64) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-7.c b/libgomp/testsuite/libgomp.c/pr66199-7.c deleted file mode 100644 index 752367e..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-7.c +++ /dev/null @@ -1,66 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ - -#pragma omp declare target -int u[1024], v[1024], w[1024]; -#pragma omp end declare target - -__attribute__((noinline, noclone)) long -f1 (long a, long b) -{ - long d; - #pragma omp target map(from: d) - #pragma omp teams distribute simd default(none) firstprivate (a, b) shared(u, v, w) - for (d = a; d < b; d++) - u[d] = v[d] + w[d]; - return d; -} - -__attribute__((noinline, noclone)) long -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp target map(from: d, e) - #pragma omp teams distribute simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - e = c + d * 5; - } - return d + e; -} - -__attribute__((noinline, noclone)) long -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -__attribute__((noinline, noclone)) long -f4 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -int -main () -{ - if (f1 (0, 1024) != 1024 - || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) - || f3 (0, 32, 0, 32) != 64 - || f4 (0, 32, 0, 32) != 64) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-8.c b/libgomp/testsuite/libgomp.c/pr66199-8.c deleted file mode 100644 index 102af06..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-8.c +++ /dev/null @@ -1,70 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ - -#pragma omp declare target -int u[1024], v[1024], w[1024]; -#pragma omp end declare target - -__attribute__((noinline, noclone)) long -f1 (long a, long b) -{ - long d; - #pragma omp target map(from: d) - #pragma omp teams default(none) shared(a, b, d, u, v, w) - #pragma omp distribute simd firstprivate (a, b) - for (d = a; d < b; d++) - u[d] = v[d] + w[d]; - return d; -} - -__attribute__((noinline, noclone)) long -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp target map(from: d, e) - #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w) - #pragma omp distribute simd linear(d) lastprivate(e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - e = c + d * 5; - } - return d + e; -} - -__attribute__((noinline, noclone)) long -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w) - #pragma omp distribute simd firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -__attribute__((noinline, noclone)) long -f4 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams default(none) firstprivate (a1, b1, a2, b2) shared(d1, d2, u, v, w) - #pragma omp distribute simd collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -int -main () -{ - if (f1 (0, 1024) != 1024 - || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) - || f3 (0, 32, 0, 32) != 64 - || f4 (0, 32, 0, 32) != 64) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr66199-9.c b/libgomp/testsuite/libgomp.c/pr66199-9.c deleted file mode 100644 index 554a476..0000000 --- a/libgomp/testsuite/libgomp.c/pr66199-9.c +++ /dev/null @@ -1,43 +0,0 @@ -/* PR middle-end/66199 */ -/* { dg-do run } */ - -#pragma omp declare target -int u[1024], v[1024], w[1024]; -#pragma omp end declare target - -__attribute__((noinline, noclone)) long -f2 (long a, long b, long c) -{ - long d, e; - #pragma omp target map(from: d, e) - #pragma omp teams default(none) firstprivate (a, b, c) shared(d, e, u, v, w) - #pragma omp distribute lastprivate(d, e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - e = c + d * 5; - } - return d + e; -} - -__attribute__((noinline, noclone)) long -f3 (long a1, long b1, long a2, long b2) -{ - long d1, d2; - #pragma omp target map(from: d1, d2) - #pragma omp teams default(none) shared(a1, b1, a2, b2, d1, d2, u, v, w) - #pragma omp distribute firstprivate (a1, b1, a2, b2) lastprivate(d1, d2) collapse(2) - for (d1 = a1; d1 < b1; d1++) - for (d2 = a2; d2 < b2; d2++) - u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2]; - return d1 + d2; -} - -int -main () -{ - if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023) - || f3 (0, 32, 0, 32) != 64) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/pr69389.c b/libgomp/testsuite/libgomp.c/pr69389.c deleted file mode 100644 index 07faff4..0000000 --- a/libgomp/testsuite/libgomp.c/pr69389.c +++ /dev/null @@ -1,124 +0,0 @@ -/* PR c/69389 */ - -struct S { unsigned int a : 10; unsigned int b : 4; unsigned int c : 18; } s = { 210, 11, 1235 }; - -unsigned int -f1 (void) -{ - unsigned int v; - #pragma omp atomic read - v = s.b; - return v; -} - -void -f2 (unsigned int v) -{ - #pragma omp atomic write - s.b = v; -} - -void -f3 (void) -{ - #pragma omp atomic - s.b |= 1; -} - -int -f4 (void) -{ - int v; - #pragma omp atomic capture - v = s.b += 8; - return v; -} - -int -f5 (void) -{ - int v; - #pragma omp atomic capture - { - v = s.b; - s.b -= 4; - } - return v; -} - -void -f6 (void) -{ - #pragma omp atomic - s.b = s.b & 7; -} - -void -f7 (void) -{ - #pragma omp atomic - s.b = ~7 & s.b; -} - -int -f8 (void) -{ - int v; - #pragma omp atomic capture - v = s.b = 8 + s.b; - return v; -} - -int -f9 (void) -{ - int v; - #pragma omp atomic capture - { - v = s.b; - s.b = s.b - 4; - } - return v; -} - -int -main () -{ - if (f1 () != 11) - __builtin_abort (); - f2 (4); - if (s.a != 210 || s.b != 4 || s.c != 1235) - __builtin_abort (); - s.a = 813; - s.c = 31532; - if (f1 () != 4) - __builtin_abort (); - f3 (); - if (f1 () != 5) - __builtin_abort (); - if (s.a != 813 || s.b != 5 || s.c != 31532) - __builtin_abort (); - if (f4 () != 13) - __builtin_abort (); - if (f1 () != 13) - __builtin_abort (); - f2 (14); - if (s.a != 813 || s.b != 14 || s.c != 31532) - __builtin_abort (); - if (f5 () != 14) - __builtin_abort (); - if (f1 () != 10 || s.a != 813 || s.b != 10 || s.c != 31532) - __builtin_abort (); - f6 (); - if (f1 () != 2) - __builtin_abort (); - f2 (15); - f7 (); - if (f1 () != 8) - __builtin_abort (); - if (f8 () != 0 || s.a != 813 || s.b != 0 || s.c != 31532) - __builtin_abort (); - if (f9 () != 0 || s.a != 813 || s.b != 12 || s.c != 31532) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/simd-14.c b/libgomp/testsuite/libgomp.c/simd-14.c deleted file mode 100644 index 28bdc99..0000000 --- a/libgomp/testsuite/libgomp.c/simd-14.c +++ /dev/null @@ -1,122 +0,0 @@ -/* { dg-do run } */ -/* { dg-additional-options "-msse2" { target sse2_runtime } } */ -/* { dg-additional-options "-mavx" { target avx_runtime } } */ - -int -main () -{ - int i, j, b, c = 0; - i = 4; j = 4; b = 7; - #pragma omp simd linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - b = b + 2; - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - b = b + 3; - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd linear(i) linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - b = b + 2; - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd linear(i:4) linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - b = b + 3; - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd collapse (2) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - b = b + 2; - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - b = b + 2; - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - b = b + 2; - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - b = b + 3; - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - b = b + 2; - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - b = b + 3; - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - b = b + 2; - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - b = b + 2; - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/simd-15.c b/libgomp/testsuite/libgomp.c/simd-15.c deleted file mode 100644 index e75538d..0000000 --- a/libgomp/testsuite/libgomp.c/simd-15.c +++ /dev/null @@ -1,128 +0,0 @@ -/* { dg-do run } */ -/* { dg-additional-options "-msse2" { target sse2_runtime } } */ -/* { dg-additional-options "-mavx" { target avx_runtime } } */ - -static inline void -foo (int *b, int *i, int *j, int x) -{ - *b = *b + x + (*i - *i) + (*j - *j); -} - -int -main () -{ - int i, j, b, c = 0; - i = 4; j = 4; b = 7; - #pragma omp simd linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - foo (&b, &i, &j, 3); - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd linear(i) linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd linear(i:4) linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - foo (&b, &i, &j, 3); - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd collapse (2) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - foo (&b, &i, &j, 3); - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c) - for (i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 64 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c) - for (i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - foo (&b, &i, &j, 3); - } - if (c || i != 64 || b != 7 + 16 * 3) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - i = 4; j = 4; b = 7; - #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - foo (&b, &i, &j, 2); - } - if (c || i != 8 || j != 8 || b != 7 + 64 * 2) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/simd-16.c b/libgomp/testsuite/libgomp.c/simd-16.c deleted file mode 100644 index e1998e3..0000000 --- a/libgomp/testsuite/libgomp.c/simd-16.c +++ /dev/null @@ -1,67 +0,0 @@ -/* { dg-do run } */ -/* { dg-additional-options "-msse2" { target sse2_runtime } } */ -/* { dg-additional-options "-mavx" { target avx_runtime } } */ -/* { dg-additional-options "-std=c99" } */ - -int -main () -{ - int b, c = 0; - b = 7; - #pragma omp simd linear(b:2) reduction(+:c) - for (int i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - b = b + 2; - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - b = 7; - #pragma omp simd linear(b:3) reduction(+:c) - for (int i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - b = b + 3; - } - if (c || b != 7 + 16 * 3) - __builtin_abort (); - b = 7; - #pragma omp simd collapse (2) linear(b:2) reduction(+:c) - for (int i = 0; i < 8; i++) - for (int j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - b = b + 2; - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) - for (int i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - b = b + 2; - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) - for (int i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - b = b + 3; - } - if (c || b != 7 + 16 * 3) - __builtin_abort (); - b = 7; - #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) - for (int i = 0; i < 8; i++) - for (int j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - b = b + 2; - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/simd-17.c b/libgomp/testsuite/libgomp.c/simd-17.c deleted file mode 100644 index b884340..0000000 --- a/libgomp/testsuite/libgomp.c/simd-17.c +++ /dev/null @@ -1,73 +0,0 @@ -/* { dg-do run } */ -/* { dg-additional-options "-msse2" { target sse2_runtime } } */ -/* { dg-additional-options "-mavx" { target avx_runtime } } */ -/* { dg-additional-options "-std=c99" } */ - -static inline void -foo (int *b, int *i, int *j, int x) -{ - *b = *b + x + (*i - *i) + (*j - *j); -} - -int -main () -{ - int b, c = 0; - b = 7; - #pragma omp simd linear(b:2) reduction(+:c) - for (int i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - foo (&b, &i, &i, 2); - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - b = 7; - #pragma omp simd linear(b:3) reduction(+:c) - for (int i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - foo (&b, &i, &i, 3); - } - if (c || b != 7 + 16 * 3) - __builtin_abort (); - b = 7; - #pragma omp simd collapse (2) linear(b:2) reduction(+:c) - for (int i = 0; i < 8; i++) - for (int j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - foo (&b, &i, &j, 2); - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) - for (int i = 0; i < 64; i++) - { - c = c + (b != 7 + 2 * i); - foo (&b, &i, &i, 2); - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - b = 7; - #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) - for (int i = 0; i < 64; i += 4) - { - c = c + (b != 7 + i / 4 * 3); - foo (&b, &i, &i, 3); - } - if (c || b != 7 + 16 * 3) - __builtin_abort (); - b = 7; - #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) - for (int i = 0; i < 8; i++) - for (int j = 0; j < 8; j++) - { - c = c + (b != 7 + 2 * j + 2 * 8 * i); - foo (&b, &i, &j, 2); - } - if (c || b != 7 + 64 * 2) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/target-1.c b/libgomp/testsuite/libgomp.c/target-1.c deleted file mode 100644 index c7abb00..0000000 --- a/libgomp/testsuite/libgomp.c/target-1.c +++ /dev/null @@ -1,91 +0,0 @@ -extern -#ifdef __cplusplus -"C" -#endif -void abort (void); - -void -fn1 (double *x, double *y, int z) -{ - int i; - for (i = 0; i < z; i++) - { - x[i] = i & 31; - y[i] = (i & 63) - 30; - } -} - -#pragma omp declare target -int tgtv = 6; -int -tgt (void) -{ - #pragma omp atomic update - tgtv++; - return 0; -} -#pragma omp end declare target - -double -fn2 (int x, int y, int z) -{ - double b[1024], c[1024], s = 0; - int i, j; - fn1 (b, c, x); - #pragma omp target data map(to: b) - { - #pragma omp target map(tofrom: c, s) - #pragma omp teams num_teams(y) thread_limit(z) reduction(+:s) firstprivate(x) - #pragma omp distribute dist_schedule(static, 4) collapse(1) - for (j=0; j < x; j += y) - #pragma omp parallel for reduction(+:s) - for (i = j; i < j + y; i++) - tgt (), s += b[i] * c[i]; - #pragma omp target update from(b, tgtv) - } - return s; -} - -double -fn3 (int x) -{ - double b[1024], c[1024], s = 0; - int i; - fn1 (b, c, x); - #pragma omp target map(to: b, c) map(tofrom:s) - #pragma omp parallel for reduction(+:s) - for (i = 0; i < x; i++) - tgt (), s += b[i] * c[i]; - return s; -} - -double -fn4 (int x, double *p) -{ - double b[1024], c[1024], d[1024], s = 0; - int i; - fn1 (b, c, x); - fn1 (d + x, p + x, x); - #pragma omp target map(to: b, c[0:x], d[x:x]) map(to:p[x:64 + (x & 31)]) \ - map(tofrom: s) - #pragma omp parallel for reduction(+:s) - for (i = 0; i < x; i++) - s += b[i] * c[i] + d[x + i] + p[x + i]; - return s; -} - -int -main () -{ - double a = fn2 (128, 4, 6); - int b = tgtv; - double c = fn3 (61); - #pragma omp target update from(tgtv) - int d = tgtv; - double e[1024]; - double f = fn4 (64, e); - if (a != 13888.0 || b != 6 + 128 || c != 4062.0 || d != 6 + 128 + 61 - || f != 8032.0) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/target-10.c b/libgomp/testsuite/libgomp.c/target-10.c deleted file mode 100644 index bc66880..0000000 --- a/libgomp/testsuite/libgomp.c/target-10.c +++ /dev/null @@ -1,14 +0,0 @@ -/* { dg-do run } */ - -#pragma omp declare target -extern int v; -#pragma omp end declare target - -int v; - -int -main () -{ - #pragma omp target update to(v) - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/target-13.c b/libgomp/testsuite/libgomp.c/target-13.c deleted file mode 100644 index 168850b..0000000 --- a/libgomp/testsuite/libgomp.c/target-13.c +++ /dev/null @@ -1,45 +0,0 @@ -#ifdef __cplusplus -extern "C" -#else -extern -#endif -void abort (void); -struct S { int s, t; }; - -void -foo () -{ - int x = 5, y = 6, err = 0; - struct S u = { 7, 8 }, v = { 9, 10 }; - double s = 11.5, t = 12.5; - #pragma omp target private (x, u, s) firstprivate (y, v, t) map(from:err) - { - x = y; - u = v; - s = t; - err = (x != 6 || y != 6 - || u.s != 9 || u.t != 10 || v.s != 9 || v.t != 10 - || s != 12.5 || t != 12.5); - x += 1; - y += 2; - u.s += 3; - v.t += 4; - s += 2.5; - t += 3.0; - if (x != 7 || y != 8 - || u.s != 12 || u.t != 10 || v.s != 9 || v.t != 14 - || s != 15.0 || t != 15.5) - err = 1; - } - if (err || x != 5 || y != 6 - || u.s != 7 || u.t != 8 || v.s != 9 || v.t != 10 - || s != 11.5 || t != 12.5) - abort (); -} - -int -main () -{ - foo (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/target-2.c b/libgomp/testsuite/libgomp.c/target-2.c deleted file mode 100644 index 0ba766c..0000000 --- a/libgomp/testsuite/libgomp.c/target-2.c +++ /dev/null @@ -1,88 +0,0 @@ -extern -#ifdef __cplusplus -"C" -#endif -void abort (void); - -void -fn1 (double *x, double *y, int z) -{ - int i; - for (i = 0; i < z; i++) - { - x[i] = i & 31; - y[i] = (i & 63) - 30; - } -} - -double -fn2 (int x) -{ - double s = 0; - double b[3 * x], c[3 * x], d[3 * x], e[3 * x]; - int i; - fn1 (b, c, x); - fn1 (e, d + x, x); - #pragma omp target map(to: b, c[:x], d[x:x], e) map(tofrom: s) - #pragma omp parallel for reduction(+:s) - for (i = 0; i < x; i++) - s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c); - return s; -} - -double -fn3 (int x) -{ - double s = 0; - double b[3 * x], c[3 * x], d[3 * x], e[3 * x]; - int i; - fn1 (b, c, x); - fn1 (e, d, x); - #pragma omp target map(tofrom: s) - #pragma omp parallel for reduction(+:s) - for (i = 0; i < x; i++) - s += b[i] * c[i] + d[i]; - return s; -} - -double -fn4 (int x) -{ - double s = 0; - double b[3 * x], c[3 * x], d[3 * x], e[3 * x]; - int i; - fn1 (b, c, x); - fn1 (e, d + x, x); - #pragma omp target data map(from: b, c[:x], d[x:x], e) - { - #pragma omp target update to(b, c[:x], d[x:x], e) - #pragma omp target map(c[:x], d[x:x], s) - #pragma omp parallel for reduction(+:s) - for (i = 0; i < x; i++) - { - s += b[i] * c[i] + d[x + i] + sizeof (b) - sizeof (c); - b[i] = i + 0.5; - c[i] = 0.5 - i; - d[x + i] = 0.5 * i; - } - } - for (i = 0; i < x; i++) - if (b[i] != i + 0.5 || c[i] != 0.5 - i || d[x + i] != 0.5 * i) - abort (); - return s; -} - -int -main () -{ - double a = fn2 (128); - if (a != 14080.0) - abort (); - double b = fn3 (128); - if (a != b) - abort (); - double c = fn4 (256); - if (c != 28160.0) - abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/taskgroup-1.c b/libgomp/testsuite/libgomp.c/taskgroup-1.c deleted file mode 100644 index 641a3bc..0000000 --- a/libgomp/testsuite/libgomp.c/taskgroup-1.c +++ /dev/null @@ -1,83 +0,0 @@ -extern -#ifdef __cplusplus -"C" -#endif -void abort (void); -int v[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; - -int -main () -{ - #pragma omp parallel num_threads (4) - #pragma omp single - { - int i; - #pragma omp taskgroup - { - for (i = 0; i < 16; i += 2) - #pragma omp task - { - #pragma omp task - v[i]++; - #pragma omp task - v[i + 1]++; - } - } - for (i = 0; i < 16; i++) - if (v[i] != i + 2) - abort (); - #pragma omp taskgroup - { - for (i = 0; i < 16; i += 2) - #pragma omp task - { - #pragma omp task - v[i]++; - #pragma omp task - v[i + 1]++; - #pragma omp taskwait - } - } - for (i = 0; i < 16; i++) - if (v[i] != i + 3) - abort (); - #pragma omp taskgroup - { - for (i = 0; i < 16; i += 2) - #pragma omp task - { - #pragma omp task - v[i]++; - v[i + 1]++; - } - #pragma omp taskwait - for (i = 0; i < 16; i += 2) - #pragma omp task - v[i + 1]++; - } - for (i = 0; i < 16; i++) - if (v[i] != i + 4 + (i & 1)) - abort (); - #pragma omp taskgroup - { - for (i = 0; i < 16; i += 2) - { - #pragma omp taskgroup - { - #pragma omp task - v[i]++; - #pragma omp task - v[i + 1]++; - } - if (v[i] != i + 5 || v[i + 1] != i + 7) - abort (); - #pragma omp task - v[i]++; - } - } - for (i = 0; i < 16; i++) - if (v[i] != i + 6) - abort (); - } - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/taskloop-1.c b/libgomp/testsuite/libgomp.c/taskloop-1.c deleted file mode 100644 index edc7058..0000000 --- a/libgomp/testsuite/libgomp.c/taskloop-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 -std=c99" } */ - -int q, r, e; - -__attribute__((noinline, noclone)) void -foo (long a, long b) -{ - #pragma omp taskloop lastprivate (q) nogroup - for (long d = a; d < b; d += 2) - { - q = d; - if (d < 2 || d > 6 || (d & 1)) - #pragma omp atomic - e |= 1; - } -} - -__attribute__((noinline, noclone)) int -bar (int a, int b) -{ - int q = 7; - #pragma omp taskloop lastprivate (q) - for (int d = a; d < b; d++) - { - if (d < 12 || d > 17) - #pragma omp atomic - e |= 1; - q = d; - } - return q; -} - -int -main () -{ - #pragma omp parallel - #pragma omp single - { - foo (2, 7); - r = bar (12, 18); - } - if (q != 6 || r != 17 || e) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/taskloop-2.c b/libgomp/testsuite/libgomp.c/taskloop-2.c deleted file mode 100644 index be893eb..0000000 --- a/libgomp/testsuite/libgomp.c/taskloop-2.c +++ /dev/null @@ -1,147 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 -std=c99" } */ -/* { dg-additional-options "-msse2" { target sse2_runtime } } */ -/* { dg-additional-options "-mavx" { target avx_runtime } } */ - -int u[1024], v[1024], w[1024], m; - -__attribute__((noinline, noclone)) void -f1 (long a, long b) -{ - #pragma omp taskloop simd default(none) shared(u, v, w) nogroup - for (long d = a; d < b; d++) - u[d] = v[d] + w[d]; -} - -__attribute__((noinline, noclone)) int -f2 (long a, long b, long c) -{ - int d, e; - #pragma omp taskloop simd default(none) shared(u, v, w) linear(d:1) linear(c:5) lastprivate(e) - for (d = a; d < b; d++) - { - u[d] = v[d] + w[d]; - c = c + 5; - e = c + 9; - } - return d + c + e; -} - -__attribute__((noinline, noclone)) int -f3 (long a, long b) -{ - int d; - #pragma omp taskloop simd default(none) shared(u, v, w) - for (d = a; d < b; d++) - { - int *p = &d; - u[d] = v[d] + w[d]; - } - return d; -} - -__attribute__((noinline, noclone)) int -f4 (long a, long b, long c, long d) -{ - int e, f, g; - #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2) lastprivate(g) - for (e = a; e < b; e++) - for (f = c; f < d; f++) - { - int *p = &e; - int *q = &f; - int r = 32 * e + f; - u[r] = v[r] + w[r]; - g = r; - } - return e + f + g; -} - -__attribute__((noinline, noclone)) int -f5 (long a, long b, long c, long d) -{ - int e, f; - #pragma omp taskloop simd default(none) shared(u, v, w) collapse(2) - for (e = a; e < b; e++) - for (f = c; f < d; f++) - { - int r = 32 * e + f; - u[r] = v[r] + w[r]; - } - return e + f; -} - -int -main () -{ - int i; - for (i = 0; i < 1024; i++) - { - v[i] = i; - w[i] = i + 1; - } - #pragma omp parallel - #pragma omp single - f1 (0, 1024); - for (i = 0; i < 1024; i++) - if (u[i] != 2 * i + 1) - __builtin_abort (); - else - { - v[i] = 1024 - i; - w[i] = 512 - i; - } - #pragma omp parallel - #pragma omp single - m = f2 (2, 1022, 17); - for (i = 0; i < 1024; i++) - if ((i < 2 || i >= 1022) ? u[i] != 2 * i + 1 : u[i] != 1536 - 2 * i) - __builtin_abort (); - else - { - v[i] = i; - w[i] = i + 1; - } - if (m != 1022 + 2 * (1020 * 5 + 17) + 9) - __builtin_abort (); - #pragma omp parallel - #pragma omp single - m = f3 (0, 1024); - for (i = 0; i < 1024; i++) - if (u[i] != 2 * i + 1) - __builtin_abort (); - else - { - v[i] = 1024 - i; - w[i] = 512 - i; - } - if (m != 1024) - __builtin_abort (); - #pragma omp parallel - #pragma omp single - m = f4 (0, 32, 0, 32); - for (i = 0; i < 1024; i++) - if (u[i] != 1536 - 2 * i) - __builtin_abort (); - else - { - v[i] = i; - w[i] = i + 1; - } - if (m != 32 + 32 + 1023) - __builtin_abort (); - #pragma omp parallel - #pragma omp single - m = f5 (0, 32, 0, 32); - for (i = 0; i < 1024; i++) - if (u[i] != 2 * i + 1) - __builtin_abort (); - else - { - v[i] = 1024 - i; - w[i] = 512 - i; - } - if (m != 32 + 32) - __builtin_abort (); - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/taskloop-3.c b/libgomp/testsuite/libgomp.c/taskloop-3.c deleted file mode 100644 index 9c8c49c..0000000 --- a/libgomp/testsuite/libgomp.c/taskloop-3.c +++ /dev/null @@ -1,84 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 -std=c99" } */ - -int g; -int a[1024]; - -__attribute__((noinline, noclone)) int -f1 (int x) -{ - #pragma omp taskloop firstprivate (x) lastprivate (x) - for (int i = 0; i < 64; i++) - { - if (x != 74) - __builtin_abort (); - if (i == 63) - x = i + 4; - } - return x; -} - -__attribute__((noinline, noclone)) void -f2 (void) -{ - #pragma omp taskloop firstprivate (g) lastprivate (g) nogroup - for (int i = 0; i < 64; i++) - { - if (g != 77) - __builtin_abort (); - if (i == 63) - g = i + 9; - } -} - -__attribute__((noinline, noclone)) long long -f3 (long long a, long long b, long long c) -{ - long long i; - int l; - #pragma omp taskloop default (none) lastprivate (i, l) - for (i = a; i < b; i += c) - l = i; - return l * 7 + i; -} - -__attribute__((noinline, noclone)) long long -f4 (long long a, long long b, long long c, long long d, - long long e, long long f, int k) -{ - long long i, j; - int l; - #pragma omp taskloop default (none) collapse(2) \ - firstprivate (k) lastprivate (i, j, k, l) - for (i = a; i < b; i += e) - for (j = c; j < d; j += f) - { - if (k != 73) - __builtin_abort (); - if (i == 31 && j == 46) - k = i; - l = j; - } - return i + 5 * j + 11 * k + 17 * l; -} - -int -main () -{ - #pragma omp parallel - #pragma omp single - { - if (f1 (74) != 63 + 4) - __builtin_abort (); - g = 77; - f2 (); - #pragma omp taskwait - if (g != 63 + 9) - __builtin_abort (); - if (f3 (7, 12, 2) != 11 * 7 + 13) - __builtin_abort (); - if (f4 (0, 32, 16, 48, 1, 2, 73) != 32 + 5 * 48 + 11 * 31 + 17 * 46) - __builtin_abort (); - } - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/taskloop-4.c b/libgomp/testsuite/libgomp.c/taskloop-4.c deleted file mode 100644 index 4ac1b5a..0000000 --- a/libgomp/testsuite/libgomp.c/taskloop-4.c +++ /dev/null @@ -1,97 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2" } */ - -int u[64], v; - -__attribute__((noinline, noclone)) int -test (int a, int b, int c, int d, void (*fn) (int, int, int, int), - int *num_tasks, int *min_iters, int *max_iters) -{ - int i, t = 0; - __builtin_memset (u, 0, sizeof u); - v = 0; - fn (a, b, c, d); - *min_iters = 0; - *max_iters = 0; - *num_tasks = v; - if (v) - { - *min_iters = u[0]; - *max_iters = u[0]; - t = u[0]; - for (i = 1; i < v; i++) - { - if (*min_iters > u[i]) - *min_iters = u[i]; - if (*max_iters < u[i]) - *max_iters = u[i]; - t += u[i]; - } - } - return t; -} - -void -grainsize (int a, int b, int c, int d) -{ - int i, j = 0, k = 0; - #pragma omp taskloop firstprivate (j, k) grainsize(d) - for (i = a; i < b; i += c) - { - if (j == 0) - { - #pragma omp atomic capture - k = v++; - if (k >= 64) - __builtin_abort (); - } - u[k] = ++j; - } -} - -void -num_tasks (int a, int b, int c, int d) -{ - int i, j = 0, k = 0; - #pragma omp taskloop firstprivate (j, k) num_tasks(d) - for (i = a; i < b; i += c) - { - if (j == 0) - { - #pragma omp atomic capture - k = v++; - if (k >= 64) - __builtin_abort (); - } - u[k] = ++j; - } -} - -int -main () -{ - #pragma omp parallel - #pragma omp single - { - int min_iters, max_iters, ntasks; - /* If grainsize is present, # of task loop iters is >= grainsize && < 2 * grainsize, - unless # of loop iterations is smaller than grainsize. */ - if (test (0, 79, 1, 17, grainsize, &ntasks, &min_iters, &max_iters) != 79 - || min_iters < 17 || max_iters >= 17 * 2) - __builtin_abort (); - if (test (-49, 2541, 7, 28, grainsize, &ntasks, &min_iters, &max_iters) != 370 - || min_iters < 28 || max_iters >= 28 * 2) - __builtin_abort (); - if (test (7, 21, 2, 15, grainsize, &ntasks, &min_iters, &max_iters) != 7 - || ntasks != 1 || min_iters != 7 || max_iters != 7) - __builtin_abort (); - /* If num_tasks is present, # of task loop iters is min (# of loop iters, num_tasks). */ - if (test (-51, 2500, 48, 9, num_tasks, &ntasks, &min_iters, &max_iters) != 54 - || ntasks != 9) - __builtin_abort (); - if (test (0, 25, 2, 17, num_tasks, &ntasks, &min_iters, &max_iters) != 13 - || ntasks != 13) - __builtin_abort (); - } - return 0; -} diff --git a/libgomp/testsuite/libgomp.c/udr-1.c b/libgomp/testsuite/libgomp.c/udr-1.c deleted file mode 100644 index ea9da72..0000000 --- a/libgomp/testsuite/libgomp.c/udr-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* { dg-do run } */ - -extern -#ifdef __cplusplus -"C" -#endif -void abort (); - -struct S { int s; struct S *t; }; - -void -foo (struct S *out, struct S *in) -{ - out->s += in->s; -} - -void -bar (struct S *x) -{ - if (x->s != 6) abort (); - x->s = 15; -} - -void -baz (struct S *x, struct S *y) -{ - x->s = 6; - x->t = x; - (void) y; -} - -#pragma omp declare reduction (foo: struct S: foo (&omp_out, &omp_in)) \ - initializer (omp_priv = { 8, &omp_priv }) -#pragma omp declare reduction (foo: char, int, short: omp_out += omp_in - 4) \ - initializer (omp_priv = 4) -#pragma omp declare reduction (+: struct S: foo (&omp_out, &omp_in)) \ - initializer (baz (&omp_priv, &omp_orig)) - -void -test (struct S s, struct S t) -{ - int q = 0; - #pragma omp parallel num_threads (4) reduction (+: s, q) reduction (foo: t) - { - if (s.s != 6 || s.t != &s || t.s != 8 || t.t != &t) - abort (); - s.s = 2; - t.s = 3; - q = 1; - } - if (s.s != 12 + 2 * q || t.s != 14 + 3 * q) - abort (); -} - -int -main () -{ - struct S s, t; - s.s = 9; t.s = 10; - int h = 30, v = 2, q = 0; - #pragma omp declare reduction (foo: struct S: omp_out.s *= omp_in.s) \ - initializer (omp_priv = omp_orig) - { - #pragma omp declare reduction (foo: struct S: omp_out.s += omp_in.s) \ - initializer (omp_priv = omp_orig) - #pragma omp parallel num_threads (4) reduction (+: t, q) \ - reduction (min: h) reduction (foo: s, v) - { - if (s.s != 9 || t.s != 6 || v != 4 || h != __INT_MAX__) abort (); - asm volatile ("" : "+m" (s.s), "+m" (t.s)); - asm volatile ("" : "+r" (h), "+r" (v)); - h = t.s; s.s++; t.s++; v++; q++; - } - } - if (h != 6 || s.s != 9 + q * 10 || t.s != 10 + q * 7 || v != 2 + q) - abort (); - s.s = 12; - t.s = 14; - test (s, t); - return 0; -}