[PATCH] [gomp4] Initial support of OpenACC loop directive in C front-end.

Thomas Schwinge thomas@codesourcery.com
Tue Mar 18 13:52:00 GMT 2014


Hi!

On Tue, 18 Mar 2014 16:37:24 +0400, Ilmir Usmanov <i.usmanov@samsung.com> wrote:
> This patch introduces support of OpenACC loop directive (and combined 
> directives) in C front-end up to GENERIC. Currently no clause is allowed.

Thanks!  I had worked on a simpler patch, not yet dealing with combined
clauses.  Also, I have some work for the GIMPLE level, namely building on
GIMPLE_OMP_FOR, adding a new GF_OMP_FOR_KIND_OACC_LOOP.  I'll post this
soon.

> This patch is necessary to finish implementation of OpenACC 1.0 in 
> fortran front-end. As you know, OpenACC fortran implementation does 
> parsing and resolving of loop directive but doesn't transformation to 
> GENERIC.
> 
> Bootstraped and tested with no new regressions on x86_64-unknown-linux-gnu.
> 
> OK for gomp4 branch?

Yes, with minor changes:

> --- a/gcc/c/c-parser.c
> +++ b/gcc/c/c-parser.c

> +#define OACC_LOOP_CLAUSE_MASK	PRAGMA_OMP_CLAUSE_NONE

Change to:

    #define OACC_LOOP_CLAUSE_MASK						\
    	(OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NONE)

;-) I had made the same error before:
<http://news.gmane.org/find-root.php?message_id=%3C20131106195501.GH27813%40tucnak.zalov.cz%3E>.

T> --- /dev/null
T> +++ b/gcc/testsuite/c-c++-common/goacc/loop-1.c

T> +  #pragma acc loop
T> +  for (d = 1; d < 30; d+= 6)  /* { dg-error "invalid type for iteration variable" } */
T> +    {
T> +      i = d;
T> +      a[i] = 1;
T> +    }
T> +  #pragma acc loop
T> +  for (d = 1; d < 30; d+= 5)  /* { dg-error "invalid type for iteration variable" } */
T> +    {
T> +      i = d;
T> +      a[i] = 2;
T> +    }

These two look very similar -- was one of them meant to check for
something else?

T> +  #pragma acc loop
T> +  for(i = 1; i < 30; i++)
T> +    {
T> +      for(j = 5; j < 10; j++)
T> +        {
T> +          /* TODO: there must be error.  */
T> +          if (i == 6 && j == 7) goto outer; 
T> +        }
T> +    }
T> +outer:

Most likely will be detected by gcc/omp-low.c's diagnose_omp_blocks pass
-- which you're not yet reaching because of not yet gimplifying the loop.
I'll deal with this in context of my loop gimplification patch.


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140318/d6c18c64/attachment.sig>


More information about the Gcc-patches mailing list