On Wed, Apr 10, 2013 at 05:16:17PM -0700, Andrew Pinski wrote: > On Wed, Apr 10, 2013 at 3:24 PM, Aldy Hernandez <al...@redhat.com> wrote: > > Hi Tom. Hi folks. > > > > We've asked Balaji to rewrite the <#pragma simd> handling for cilkplus as we > > currently do for OMP, etc, in init_pragma(). > > > > The cilkplus branch currently has something like: > > > > cpp_register_deferred_pragma (parse_in, "simd", "", > > PRAGMA_SIMD_EMPTY, true, false); > > cpp_register_deferred_pragma (parse_in, "simd", "assert", > > PRAGMA_SIMD_ASSERT, true, false); > > cpp_register_deferred_pragma (parse_in, "simd", "noassert", > > PRAGMA_SIMD_NOASSERT, true, false); > > cpp_register_deferred_pragma (parse_in, "simd", "vectorlength", > > PRAGMA_SIMD_VECTORLENGTH, true, false); > > What about just registering simd as the pragma and then look for the > right keyword after that? Like diagnostic is handled?
Yeah, the above is definitely wrong. Just if (flag_cilkplus) cpp_register_deferred_pragma (parse_in, NULL, "simd", PRAGMA_SIMD, true, false); and parse the clauses in c/c-parser.c and cp/parser.c, look at how OpenMP pragmas are parsed (those have the "omp" space, you just use NULL, otherwise it is not any different). Also check the standard whether cpp expansion is allowed or not and on what exactly. Like: #define S simd #define V vectorlength #pragma simd vectorlength(8) for (i = 0; i < 16; i++) ; vs. #pragma simd V(8) for (i = 0; i < 16; i++) ; vs. #pragma S V(8) for (i = 0; i < 16; i++) ; (that's the two last arguments to cpp_register_deferred_pragma). Jakub