This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: PING: Fwd: Re: [patch] implement Cilk Plus simd loops on trunk
- From: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>, Jason Merrill <jason at redhat dot com>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 16 Oct 2013 18:34:39 +0000
- Subject: RE: PING: Fwd: Re: [patch] implement Cilk Plus simd loops on trunk
- Authentication-results: sourceware.org; auth=none
- References: <51F299D3 dot 5020907 at redhat dot com> <521269E0 dot 1020104 at redhat dot com> <521B8ECA dot 70806 at redhat dot com> <521D060E dot 9030601 at redhat dot com> <524C95F2 dot 1010802 at redhat dot com> <525ED177 dot 5050006 at redhat dot com>
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Aldy Hernandez
> Sent: Wednesday, October 16, 2013 1:49 PM
> To: Jason Merrill
> Cc: Richard Henderson; gcc-patches; Iyer, Balaji V
> Subject: Re: PING: Fwd: Re: [patch] implement Cilk Plus simd loops on trunk
>
> On 10/02/13 16:53, Jason Merrill wrote:
> > On 08/27/2013 04:03 PM, Aldy Hernandez wrote:
>
> >
> >> + else if (!TREE_TYPE (e) || !TREE_CONSTANT (e)
> >> + || !INTEGRAL_TYPE_P (TREE_TYPE (e)))
> >> + cp_parser_error (parser,
> >> + "step size must be an integer constant");
> >
> > Can't the step size be a value-dependent expression like a template
> > non-type parameter?
>
> [Balaji, this is for the linear clause that is either linear(var) or linear(var : step)].
>
> Jason, I'm not sure. The standard says:
>
> "The conditional-expression in a simd-linear-step shall either
> satisfy the requirements of an integer constant expression, or
> be a reference to a variable with integer type."
>
> I take this to mean, an integral expression or a plain old variable. Is this the
> case, Balaji?
>
Yup.
> Jason, are you asking about the validity of something like this:
>
> int *p;
>
> template <int argoop>
> void foobar(int a)
> {
> int j = 123;
> #pragma simd linear(j : argoop)
> for (int i=0; i < a; ++i)
> p[i] = argoop;
> }
>
> void funky()
> {
> foobar <69> (1000);
> }
>
> If this is what you're asking, and the above standardeese allows it, then we have
> a problem, because the code parsing the "j" in the linear clause uses
> cp_parser_id_expression() which gets horrendously confused with the colon,
> expecting a '::'. For that matter, even doing this causes problems:
>
In parser structure, there is a variable that called colon_corrects_to_scope_p. Set that to false right before searching for a colon. That should fix this looking for :: issue.
> int j = 123, k = 456;
> #pragma simd linear (j : k)
> ...
>
> Is this what you were asking about? If so, then perhaps something besides
> cp_parser_id_expression is in order, for the sake of the template argument or
> just a plain variable.
>
Thanks,
Balaji V. Iyer.
> Aldy