This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?

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:

	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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]