From patchwork Tue Oct 8 12:04:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1173276 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-510465-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mentor.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vDi5mKV0"; 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 46nbck09prz9sPk for ; Tue, 8 Oct 2019 23:04:37 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=mpnej2tF2ico3uTuFaHQS7j0++LDGzn5SKNvcFSNn/YG3ETgsL 5xzKgDwUn0VtmCSUjrh37WtJqQy5Xe72lsd0BpdNpepucJGQI23S6ck3a5qsMbp3 nj7GaW4MqEVHZ+07LA5ahBRVo8T3+JSeOlghM86qxYWBuykb93GWcFH10= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=GLBdHTgs3qa8k3MEzc5/ejI/bdQ=; b=vDi5mKV0IzixbSOtFjrZ MHUEDuGHwNChAyAKxtsfd77Ioa+96kQtylPgH+qcQr/x4K5lYtEMSbMuTgjLgltg pjibGKigxPPVBRJQRc9xO4454osMoZYm3rNcVO1LOMShx7adJf0LclmUcwH1wg3Q w7txQU2dqA1vHmBpQWk8y3c= Received: (qmail 12209 invoked by alias); 8 Oct 2019 12:04:27 -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 12189 invoked by uid 89); 8 Oct 2019 12:04:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: esa1.mentor.iphmx.com Received: from esa1.mentor.iphmx.com (HELO esa1.mentor.iphmx.com) (68.232.129.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 12:04:26 +0000 IronPort-SDR: pqXK9nryULDzigQqLWsBJL3I/5Cax6Fgm46OidE9zSmhoX3KpisJManDxVWU7IQmQvsp/2FkQq 0eyr4Nq87iOuxzOeis5xaSjkuCLeKpahqXejhgNsmqJi5sf7jP1rNcJ0zNpdVVPhpqKISrWFQ/ Gx4gVQJ7QkLbHjXquCOqGjmdJ1VOfWimKgNoTffq3/vg8p0qJcUrCsf9LJ8PljS1OgdGLCl4C+ qk7eDxs1OSUqwQvSD3jDaQj9YXvYOd6ehVD0OaN8W/O5cl9FMFfq/PDQa2JGpUy6+mmI15+89G Kys= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 08 Oct 2019 04:04:23 -0800 IronPort-SDR: xhAKW6oaR/jHVt3KJjGvMvqm89OYrYX2o9kHSNcdpS7MpSdv/sPtinDhL3a9Yh7iyUxLVb5JpU sQul7/ACdiJ2c1jXQYlHtTeEr93lspjRP7a5zG1uEc2kDKOHyir9ODthkTaPr1zMQUvrjQi/X+ LwcZrYsf2tX5+/jnXFbfJMttFg3navt+83YvenHT1OxEHvnu6zgaaRM7te33LEvb6W/PALjVgF TKkkdfnI6yBFOszVMM4YfotC12TA1NYVayHy1u56Dk45lKUX+BiWyUB0WuGx9xL/kIFF8Uob6x uBk= To: gcc-patches , fortran , Jakub Jelinek From: Tobias Burnus Subject: [patch][Fortran] Actually permit OpenMP's 'target simd' Message-ID: Date: Tue, 8 Oct 2019 14:04:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 Seemingly, 'target simd' was forgotten – which yielded the error: "Unexpected !$OMP TARGET SIMD statement" OK for the trunk? Tobias PS: The test case should also work as 'dg-do run' test, if it makes more sense. (Only tested on a system w/o offloading, but I would test it with nvptx before committing it.) fortran/ * parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD. testsuite/ * gfortran.dg/gomp/target-simd.f90: New. diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 03fc716dbf5..15f6bf2937c 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -5534,6 +5534,7 @@ parse_executable (gfc_statement st) case ST_OMP_SIMD: case ST_OMP_TARGET_PARALLEL_DO: case ST_OMP_TARGET_PARALLEL_DO_SIMD: + case ST_OMP_TARGET_SIMD: case ST_OMP_TARGET_TEAMS_DISTRIBUTE: case ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO: case ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD: diff --git a/gcc/testsuite/gfortran.dg/gomp/target-simd.f90 b/gcc/testsuite/gfortran.dg/gomp/target-simd.f90 new file mode 100644 index 00000000000..733420f4cc7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/target-simd.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } + +program test + implicit none + real, allocatable :: a(:), b(:) + integer :: i + + a = [(i, i = 1, 100)] + allocate(b, mold=a) + b = 0 + + !$omp target simd map(to:a) map(from:b) + do i = 0, size(a) + b(i) = 5.0 * a(i) + end do + + if (any (b - 5.0 *a > 10.0*epsilon(a))) call abort() + + !$omp target simd map(to:a) map(from:b) + do i = 0, size(a) + b(i) = 2.0 * a(i) + end do + !$omp end target simd + + if (any (b - 2.0 *a > 10.0*epsilon(a))) call abort() +end program test