Patchwork [cilkplus] misc cleanups for <#pragma simd> implementation

login
register
mail settings
Submitter Iyer, Balaji V
Date April 8, 2013, 1:59 p.m.
Message ID <BF230D13CA30DD48930C31D40993300016D82016@FMSMSX102.amr.corp.intel.com>
Download mbox | patch
Permalink /patch/234784/
State New
Headers show

Comments

Iyer, Balaji V - April 8, 2013, 1:59 p.m.
Hi Aldy,
	Here are the things I  found with the patch. All my comments have "BVI:" in front of them.

Thanks,

Balaji V. Iyer.

commit 2e7512b89697723cae25685a9b50ba7070da998d
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Apr 3 15:09:28 2013 -0500

    Minor cleanups and refactoring of pragma simd code.
    
    Add location information to pragma simd table entries.
    
    Rename compile.exp, errors.exp, and execute.exp for the cilk_keywords
    test directory.  Getting rid of the naming redundancy makes it
    possible to test on set at a time:
    
       make check-gcc RUNTESTFLAGS=cilkplus_keywords_c_compile.exp

 
@@ -3113,15 +3125,13 @@ struct GTY(()) tree_field_decl {
 #define EH_LANDING_PAD_NR(NODE) \
   (LABEL_DECL_CHECK (NODE)->label_decl.eh_landing_pad_nr)
 
-
+/* In a LABEL_DECL, the index into the pragma simd table.  */
 #define PRAGMA_SIMD_INDEX(NODE)					\
-  (LABEL_DECL_CHECK(NODE)->label_decl.pragma_simd_index)
+  (LABEL_DECL_CHECK (NODE)->label_decl.pragma_simd_index)
 
+/* As above, but for a LABEL_EXPR.  */
 #define LABEL_EXPR_PRAGMA_SIMD_INDEX(NODE)			\
-  (PRAGMA_SIMD_INDEX(TREE_OPERAND(LABEL_EXPR_CHECK(NODE), 0)))
-
-
-
+  (PRAGMA_SIMD_INDEX (TREE_OPERAND (LABEL_EXPR_CHECK (NODE), 0)))
 
 /* In LABEL_DECL nodes, nonzero means that an error message about
    jumping into such a binding contour has been printed for this label.  */
@@ -6623,14 +6633,9 @@ extern bool block_may_fallthru (const_tree);
 #define FOR_EXPR(NODE)		TREE_OPERAND (FOR_STMT_CHECK2 (NODE), 2)
 #define FOR_BODY(NODE)		TREE_OPERAND (FOR_STMT_CHECK2 (NODE), 3)
 
-/* Some cilk #defines */
-#define CILK_FOR_VAR(NODE)      TREE_OPERAND (CILK_FOR_STMT_CHECK (NODE), 5)
-#define CILK_FOR_INIT(NODE)     TREE_OPERAND (CILK_FOR_STMT_CHECK (NODE), 0)
-#define CILK_FOR_GRAIN(NODE)    TREE_OPERAND (CILK_FOR_STMT_CHECK (NODE), 6)
-
-/* Here are the pragma simd specific files used by the parser and vectorizer 
-   available in pragma_simd.c.  */
+/* Cilk Plus supporting functions in pragma_simd.c.  */
 
+extern void pragma_simd_verify_clauses (int);
 extern struct pragma_simd_values *psv_find_node (int psv_index);
 extern int psv_head_insert (struct pragma_simd_values local_simd_values);
 extern bool pragma_simd_acceptable_vlength_p (int ps_index, 
@@ -6651,6 +6656,10 @@ extern void set_OK_for_certain_clause (enum pragma_simd_kind clause_type,
 				       int pragma_simd_index);
 extern HOST_WIDE_INT find_linear_step_size (int pragma_simd_index, tree var);
 
+#define CILK_FOR_VAR(NODE)      TREE_OPERAND (CILK_FOR_STMT_CHECK (NODE), 5)
+#define CILK_FOR_INIT(NODE)     TREE_OPERAND (CILK_FOR_STMT_CHECK (NODE), 0)
+#define CILK_FOR_GRAIN(NODE)    TREE_OPERAND (CILK_FOR_STMT_CHECK (NODE), 6)
+
BVI: This is OK too.

 tree build_call_list (tree return_type, tree fn, tree arglist);
 bool is_elem_fn (tree);
 void elem_fn_create_fn (tree);


Thanks,

Balaji V. Iyer.

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Aldy Hernandez
> Sent: Thursday, April 04, 2013 7:18 PM
> To: Iyer, Balaji V; gcc-patches
> Subject: [cilkplus] misc cleanups for <#pragma simd> implementation
> 
> Hi Balaji.
> 
> This is a patch against, the [cilkplus] branch (not the [cilkplus-merge] branch).  I
> have taken the liberty to start cleaning up the <#pragma
> simd> stuff on your development branch, while the array notation
> patchset is being reviewed by Joseph.
> 
> Herein lies a potpourri of fixes, refactoring, and cleanups.  They
> should all be pretty obvious.
> 
> There are two main functional changes:
> 
> 1. I removed setting of flag_vectorize in the front-end.  This is
> certainly not going to fly.  Instead, I am issuing an error when
> <#pragma simd> is used without -ftree-vectorize.  For testing I have
> added the appropriate flag when tests are running at lower optimization
> levels.
> 
> 2. I noticed some of the errors wrt <#pragma simd> were pointing to the
> wrong place.  I have saved the location_t of the original #pragma and
> saved this in the global pragma simd table.  This makes errors more
> meaningful.
> 
> I have added various FIXME notes throughout for things I plan to tackle
> next.  If you prefer me not adding such notes, I can remove them, but
> rest assured, I'll work on them shortly.
> 
> I have renamed the {compile,errors,execute}.exp files to something less
> ambiguous.  As explained before, this makes it easier to test individual
> components, ala "make check-gcc RUNTESTFLAGS=foo.exp".
> 
> There are no regressions with this patch, but I noticed all the tests in
> gcc.dg/cilk-plus/pragma_simd_tests/execute/ were failing before my patch:
> 
> 	/usr/bin/ld: cannot find -lcilkrts
> 	collect2: error: ld returned 1 exit status
> 	compiler exited with status 1
> 
> I don't see a -L in the command line, but I didn't bother to look into
> it.  It was broken before ;-).
> 
> Finally, building the toolchain seems to automagically regenerate the
> following files:
> 
> 	#       modified:   ../../../libcilkrts/Makefile.in
> 	#       modified:   ../../../libcilkrts/aclocal.m4
> 	#       modified:   ../../../libcilkrts/configure
> 
> Is this on purpose?  Should I check in the modified files?  FWIW, I am
> *not* including these modified files into this patch.
> 
> Oh, one more thing... assuming you are keeping a merged set of ChangeLog
> entries for eventual merging, I am only including changelog entries for
> new code I am touching.  I assume, there are already entries for code
> you have already touched.
> 
> OK to commit to cilkplus branch?

Patch

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index f00d28d..98265ba 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -117,26 +117,11 @@  c_parse_init (void)
       ridpointers [(int) c_common_reswords[i].rid] = id;
     }
 
-  /* Here we initialize the simd_values structure. We only need it 
-     initialized the first time, after each consumptions, for-loop will 
-     automatically consume the values and delete the information.  */
-  cilkplus_local_simd_values.index              = 0;
-  cilkplus_local_simd_values.pragma_encountered = false;
-  cilkplus_local_simd_values.types              = P_SIMD_NOASSERT;
-  cilkplus_local_simd_values.vectorlength       = NULL_TREE;
-  cilkplus_local_simd_values.vec_length_list    = NULL;
-  cilkplus_local_simd_values.vec_length_size    = 0;
-  cilkplus_local_simd_values.private_vars       = NULL_TREE;
-  cilkplus_local_simd_values.priv_var_list      = NULL;
-  cilkplus_local_simd_values.priv_var_size      = 0;
-  cilkplus_local_simd_values.linear_vars        = NULL_TREE;
-  cilkplus_local_simd_values.linear_var_size    = 0;
-  cilkplus_local_simd_values.linear_var_list    = NULL;
-  cilkplus_local_simd_values.linear_steps       = NULL_TREE;
-  cilkplus_local_simd_values.linear_steps_list  = NULL;
-  cilkplus_local_simd_values.linear_steps_size  = 0;
-  cilkplus_local_simd_values.reduction_vals     = NULL;
-  cilkplus_local_simd_values.ptr_next           = NULL;
+  /* Only initialize the first time.  After each consumption, the
+     for-loop handling code (c_finish_loop) will automatically consume
+     the values and delete the information.  */
+  memset (&cilkplus_local_simd_values, 0,
+	  sizeof (cilkplus_local_simd_values));

BVI: This is OK! 

   clear_pragma_simd_list ();
 }
@@ -1251,12 +1236,16 @@  static void c_parser_objc_at_synthesize_declaration (c_parser *);
 static void c_parser_objc_at_dynamic_declaration (c_parser *);
 static bool c_parser_objc_diagnose_bad_element_prefix
   (c_parser *, struct c_declspecs *);
+
+// FIXME: Re-work this so there are only prototypes for mutually
+// recursive functions.
+/* Cilk Plus supporting routines.  */
 static void c_parser_cilk_for_statement (c_parser *, tree);
-void c_parser_simd_linear (c_parser *);
-void c_parser_simd_private (c_parser *);
-void c_parser_simd_assert (c_parser *, bool);
-void c_parser_simd_vectorlength (c_parser *);
-void c_parser_simd_reduction (c_parser *);
+static void c_parser_simd_linear (c_parser *);
+static void c_parser_simd_private (c_parser *);
+static void c_parser_simd_assert (c_parser *, bool);
+static void c_parser_simd_vectorlength (c_parser *);
+static void c_parser_simd_reduction (c_parser *);

BVI: This (and the subseqent changes in the function) is OK!

 static tree c_parser_array_notation (location_t, c_parser *, tree, tree);
 /* Parse a translation unit (C90 6.7, C99 6.9).
 
@@ -8799,7 +8788,7 @@  c_parser_objc_at_dynamic_declaration (c_parser *parser)
       #pragma simd assert
       #pragma simd noassert
  */
-void
+static void
 c_parser_simd_assert (c_parser *parser, bool is_assert)
 {
   c_token *token;
@@ -8856,7 +8845,7 @@  c_parser_simd_assert (c_parser *parser, bool is_assert)
       #pragma simd linear (<variable>:[<steps>], ...)
  */
 
-void
+static void
 c_parser_simd_linear (c_parser *parser)
 {
   tree linear_var_list = NULL_TREE, linear_steps_list = NULL_TREE;
@@ -8967,14 +8956,13 @@  c_parser_simd_linear (c_parser *parser)
 	}
     }
   cilkplus_local_simd_values.pragma_encountered = true;
-  return;
 }
 
 /* This function will parse the pragma simd private in the Cilkplus 
    language extension. The correct syntax is: 
 	#pragma simd private (<variable> [, <variable>])
  */
-void
+static void
 c_parser_simd_private (c_parser *parser)
 {
   tree private_var = NULL_TREE;
@@ -9068,15 +9056,13 @@  c_parser_simd_private (c_parser *parser)
 	  c_parser_for_statement (parser);
 	}
     }
-  
-  return;
 }
 
 /* This function will parse the pragma simd vectorlength in the Cilkplus 
    language extension. The correct syntax is: 
 	#pragma simd vectorlength (<INTEGER> [, <INTEGER>]*)
  */
-void
+static void
 c_parser_simd_vectorlength (c_parser *parser)
 {
   tree vec_length_list = NULL_TREE, v_length_value = NULL_TREE;
@@ -9168,8 +9154,6 @@  c_parser_simd_vectorlength (c_parser *parser)
 	  c_parser_for_statement (parser);
 	}
     }
-  
-  return;
 }
 
 /* This function will parser the Pragma SIMD Reduction in the Cilkplus language 
@@ -9177,7 +9161,7 @@  c_parser_simd_vectorlength (c_parser *parser)
 	  #pragma simd reduction (<operator>:<variable> [, <variable>]*)
  */
 
-void
+static void
 c_parser_simd_reduction (c_parser *parser)
 {
   c_token *token;
@@ -9299,7 +9283,6 @@  c_parser_simd_reduction (c_parser *parser)
 	   values given in the local_pragma_simd variable.  */ 
 	c_parser_for_statement (parser);
     }
-  return;
 }
 
 /* This function helps parse the grainsize pragma available in the Cilkplus 
@@ -9353,9 +9336,35 @@  c_parser_cilk_grainsize (c_parser *parser)
     }
   else
     c_parser_skip_to_pragma_eol (parser);
-  return;

BVI: I am OK with removing this return, but the reason why I put it there is because it gets easier for me to set the break point there.

 }
-	    
+
+/* Helper function for c_parser_pragma.  Perform some sanity checking
+   for <#pragma simd> constructs.  Returns FALSE if there was a
+   problem.  */
+
+static bool
+c_parser_pragma_simd_ok_p (c_parser *parser, enum pragma_context context)
+{
+  if (!flag_enable_cilk)
+    {
+      warning (0, "pragma simd ignored because -fcilkplus is not enabled");
+      c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
+      return false;
+    }
+  if (!flag_tree_vectorize)
+    {
+      warning (0, "pragma simd is useless without -ftree-vectorize");
+      c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
+      return false;
+    }
+  if (context == pragma_external)
+    {
+      c_parser_error (parser,"pragma simd must be inside a function");
+      return false;
+    }
+  return true;
+}

BVI: This function is OK!

+
 /* Handle pragmas.  Some OpenMP pragmas are associated with, and therefore
    should be considered, statements.  ALLOW_STMT is true if we're within
    the context of a function and such pragmas are to be allowed.  Returns
@@ -9364,6 +9373,7 @@  c_parser_cilk_grainsize (c_parser *parser)
 static bool
 c_parser_pragma (c_parser *parser, enum pragma_context context)
 {
+  location_t loc = c_parser_peek_token (parser)->location;
   unsigned int id;
 
   id = c_parser_peek_token (parser)->pragma_kind;
@@ -9420,7 +9430,7 @@  c_parser_pragma (c_parser *parser, enum pragma_context context)
       return false;
 
     case PRAGMA_OMP_SECTION:
-      error_at (c_parser_peek_token (parser)->location,
+      error_at (loc,
 		"%<#pragma omp section%> may only be used in "
 		"%<#pragma omp sections%> construct");
       c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);

BVI: This is OK!

@@ -9432,165 +9442,66 @@  c_parser_pragma (c_parser *parser, enum pragma_context context)
       return false;
       
     case PRAGMA_CILK_GRAINSIZE:
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser,"pragma grainsize must be inside a function");
-	  return false;
-	}
-      if (flag_enable_cilk) 
-	c_parser_cilk_grainsize (parser);
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}
+      if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+      cilkplus_local_simd_values.loc = loc;
+      c_parser_cilk_grainsize (parser);

BVI: This is incorrect. #pragma grainsize is part of cilk keywords. It has no relation to the pragma simd and it will work wthout vectorization support.

       return false;
-      break;
 
     case PRAGMA_SIMD_ASSERT:
-      flag_tree_vectorize = 1;
-    
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser,
-			  "pragma simd assert must be inside a function");
-	  return false;
-	}
-      if (flag_enable_cilk)
-	{
-	  c_parser_consume_pragma (parser);
-	  c_parser_simd_assert (parser, true);
-	}
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}
+      if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+      cilkplus_local_simd_values.loc = loc;
+      c_parser_consume_pragma (parser);
+      c_parser_simd_assert (parser, true);
       return false;
 
     case PRAGMA_SIMD_NOASSERT:
-      flag_tree_vectorize = 1;
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser,
-			  "pragma simd assert should be inside a function");
-	  return false;
-	}
-      if (flag_enable_cilk)
-	{
-	  c_parser_consume_pragma (parser);
-	  c_parser_simd_assert (parser, false);
-	}
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}
+      if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+      cilkplus_local_simd_values.loc = loc;
+      c_parser_consume_pragma (parser);
+      c_parser_simd_assert (parser, false);
       return false;
 
     case PRAGMA_SIMD_VECTORLENGTH:
-      flag_tree_vectorize = 1;
-    
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser,
-			  "pragma simd assert should be inside a function");
-	  return false;
-	} 
-      if (flag_enable_cilk)
-	{
-	  c_parser_consume_pragma (parser);
-	  c_parser_simd_vectorlength (parser);
-	}
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}    
+      if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+      cilkplus_local_simd_values.loc = loc;
+      c_parser_consume_pragma (parser);
+      c_parser_simd_vectorlength (parser);
       return false;
 
     case PRAGMA_SIMD_PRIVATE:
-      flag_tree_vectorize = 1;
-    
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser,
-			  "pragma simd assert should be inside a function");
-	  return false;
-	}
-      if (flag_enable_cilk)
-	{
-	  c_parser_consume_pragma (parser);
-	  c_parser_simd_private (parser);
-	}
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}    
-
-      return false;
+       if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+       cilkplus_local_simd_values.loc = loc;
+       c_parser_consume_pragma (parser);
+       c_parser_simd_private (parser);
+       return false;
 
     case PRAGMA_SIMD_LINEAR:
-
-      flag_tree_vectorize = 1;
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser,
-			  "pragma simd assert should be inside a function");
-	  return false;
-	}
-      if (flag_enable_cilk)
-	{
-	  c_parser_consume_pragma (parser);
-	  c_parser_simd_linear (parser);
-	}
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}          
+      if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+      cilkplus_local_simd_values.loc = loc;
+      c_parser_consume_pragma (parser);
+      c_parser_simd_linear (parser);
       return false;
 
     case PRAGMA_SIMD_REDUCTION:
-
-      flag_tree_vectorize = 1;
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser,
-			  "pragma simd assert should be inside a function");
-	  return false;
-	}
-      if (flag_enable_cilk)
-	{
-	  c_parser_consume_pragma (parser);
-	  c_parser_simd_reduction (parser);
-	}
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}                
+      if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+      cilkplus_local_simd_values.loc = loc;
+      c_parser_consume_pragma (parser);
+      c_parser_simd_reduction (parser);
       return false;
 
     case PRAGMA_SIMD_EMPTY:
-      flag_tree_vectorize = 1;
-      optimize = 2;
-      if (context == pragma_external)
-	{
-	  c_parser_error (parser, "pragma simd should be inside a function");
-	  return false;
-	}
-      if (flag_enable_cilk)
-	{
-	  c_parser_consume_pragma (parser);
-	  c_parser_simd_assert (parser, false);
-	}
-      else
-	{
-	  warning (0, "pragma grainsize ignored");
-	  c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
-	}                      
+      if (!c_parser_pragma_simd_ok_p (parser, context))
+	return false;
+      c_parser_consume_pragma (parser);
+      c_parser_simd_assert (parser, false);
+      cilkplus_local_simd_values.loc = loc;
       return false;

BVI: All the changes from PRAGMA_SIMD_ASSERT to PRAGMA_SIMD_EMPTY seems OK!   
    
     default:
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 5c7e6cc..e74fd29 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -9115,15 +9115,7 @@  c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
 	      psv_head_insert (*cilkplus_ps_values);
 	  else
 	    LABEL_EXPR_PRAGMA_SIMD_INDEX (top) = INVALID_PRAGMA_SIMD_SLOT;
-	    
-	  /* Now we initialize them all to zeros.  */
-	  cilkplus_ps_values->pragma_encountered = false;
-	  cilkplus_ps_values->types              = P_SIMD_NOASSERT;
-	  cilkplus_ps_values->vectorlength       = NULL_TREE;
-	  cilkplus_ps_values->private_vars       = NULL_TREE;
-	  cilkplus_ps_values->linear_vars        = NULL_TREE;
-	  cilkplus_ps_values->linear_steps       = NULL_TREE;
-	  cilkplus_ps_values->reduction_vals     = NULL;
+	  memset (&cilkplus_ps_values, 0, sizeof (cilkplus_ps_values));

BVI: This is OK!

 	}  
       
       add_stmt (top);
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 7516b46..83288df 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -574,7 +574,8 @@  gimple
 gimple_build_label (tree label)
 {
   gimple p = gimple_build_with_ops (GIMPLE_LABEL, ERROR_MARK, 1);
-  GIMPLE_PRAGMA_SIMD_INDEX (p) = PRAGMA_SIMD_INDEX (label);
+  if (flag_enable_cilk)
+    GIMPLE_PRAGMA_SIMD_INDEX (p) = PRAGMA_SIMD_INDEX (label);

BVI: This is OK. Thanks for catching this!

   gimple_label_set_label (p, label);
   return p;
 }
@@ -2028,7 +2029,8 @@  gimple_set_bb (gimple stmt, basic_block bb)
 {
   stmt->gsbase.bb = bb;
 
-  if ( (bb != NULL) && (gimple_code (stmt) == GIMPLE_LABEL))
+  if (flag_enable_cilk
+      && bb && (gimple_code (stmt) == GIMPLE_LABEL))
     bb->pragma_simd_index = GIMPLE_PRAGMA_SIMD_INDEX (stmt);

BVI: This is OK too. Thanks again!


   /* If the statement is a label, add the label to block-to-labels map
diff --git a/gcc/pragma_simd.c b/gcc/pragma_simd.c
index c39fd62..7381060 100644
--- a/gcc/pragma_simd.c
+++ b/gcc/pragma_simd.c
@@ -42,12 +42,65 @@  along with GCC; see the file COPYING3.  If not see
 
 struct pragma_simd_values *psv_head;
 
-/* This function Empties the pragma simd data structure.  */
+/* Verify that the <#pragma simd> clauses have been properly resolved.
+   INDEX is the pragma_simd_index into the global table.  */
+
+void
+pragma_simd_verify_clauses (int index)
+{
+  struct pragma_simd_values *vals = psv_find_node (index);
+  location_t loc = vals ? vals->loc : UNKNOWN_LOCATION;
+
+  if ((!clause_resolved_p (P_SIMD_VECTORLENGTH, index)))
+    {
+      if (pragma_simd_assert_requested_p (index))
+	{
+	  error_at (loc, "vectorlength in pragma simd not picked from list");
+	  exit (ICE_EXIT_CODE);
+	}
+      else 
+	warning_at (0, loc,
+		    "vectorlength in pragma simd not picked from list");
+    }
+  if (!clause_resolved_p (P_SIMD_PRIVATE, index))
+    { 
+      if (pragma_simd_assert_requested_p (index))
+	{ 
+	  error_at (loc, "unable to make all variables private");
+	  exit (ICE_EXIT_CODE);
+	} 
+      else
+	warning_at (0, loc,
+		    "unable to make all variables private in pragma simd");
+    }     
+  if (!clause_resolved_p (P_SIMD_LINEAR, index))
+    {
+      if (pragma_simd_assert_requested_p (index))
+	{
+	  error_at (loc, "unable to pick requested step-size in pragma simd");
+	  exit (ICE_EXIT_CODE);
+	}
+      else
+	warning (loc, "unable to pick requested step-size in pragma simd");
+    }
+  if (!clause_resolved_p (P_SIMD_REDUCTION, index))
+    {
+      if (pragma_simd_assert_requested_p (index))
+	{
+	  error_at (loc, "unable to satisfy all reductions in pragma simd");
+	  exit (ICE_EXIT_CODE);
+	}
+      else
+	warning_at (0, loc, "unable to satisfy all reductions in pragma simd");
+    }
+}
+
+/* Clear the pragma simd data structure.  */
+

BVI: This is OK!

 void
 clear_pragma_simd_list (void)
 {
   psv_head = NULL;
-  return;

BVI: This is OK too!
 }
 
 /* this function will check and see if a certain clause is resolved
@@ -104,6 +157,7 @@  set_OK_for_certain_clause (enum pragma_simd_kind clause_type, bool set_value,
   if (!psv_head)
     return;
 
+  // FIXME: Why not use psv_find_node?
   for (ps_iter = psv_head; ps_iter != NULL; ps_iter = ps_iter->ptr_next)
     {
       if (ps_iter->pragma_encountered && (ps_iter->index == pragma_simd_index))
@@ -155,9 +209,10 @@  all_reductions_satisfied_p (int pragma_simd_index)
     }
   return true;
 }
-  
-/* This function will search the pragma simd list to see if a node for a 
-   certain loop exist (based on an index).  */
+
+// FIXME: We should really rewrite all this psv* business to use vectors.
+/* Given an index into the pragma simd list (PSV_INDEX), find its
+   entry and return it.  */

BVI: I am in the process of doing so. I will send out that patch as soon as I get some free time. 

 struct pragma_simd_values *
 psv_find_node (int psv_index)
@@ -171,17 +226,15 @@  psv_find_node (int psv_index)
     return NULL;
   
   for (ps_iter = psv_head; ps_iter != NULL; ps_iter = ps_iter->ptr_next)
-    {
-      if ((ps_iter->index == psv_index) && ps_iter->pragma_encountered)
-	return ps_iter;
-    }
+    if ((ps_iter->index == psv_index) && ps_iter->pragma_encountered)
+      return ps_iter;
 
-  /* We should not get here.  */
+  gcc_unreachable ();
   return NULL;
 }
 
-/* this function will insert a value at the head of the list that holds
-   pragma simd information for the loops.  */
+/* Insert LOCAL_SIMD_VALUES into the global pragma simd table.  Return
+   the index into the table for the new entry.  */
 
 int
 psv_head_insert (struct pragma_simd_values local_simd_values)
@@ -194,13 +247,9 @@  psv_head_insert (struct pragma_simd_values local_simd_values)
   if (psv_head == NULL)
     {
       psv_head = (struct pragma_simd_values *)
-	xmalloc (sizeof (struct pragma_simd_values));
-      gcc_assert (psv_head != NULL);
+	xcalloc (1, sizeof (struct pragma_simd_values));
+      psv_head->loc = local_simd_values.loc;

BVI: This is OK too.

       psv_head->pragma_encountered  = local_simd_values.pragma_encountered;
-      /* We keep the head pointer index to be invalid pragma simd slot + 1.
-       * This is done before fi we want to debug then we can set invalid pragma
-       * simd_slot value to some arbitary number and then see if we are
-       * catching the pragmas correctly.  */
       psv_head->index = INVALID_PRAGMA_SIMD_SLOT + 1;
       psv_head->types = local_simd_values.types;
       
@@ -244,15 +293,15 @@  psv_head_insert (struct pragma_simd_values local_simd_values)
   
   for (ps_iter = psv_head; ps_iter->ptr_next != NULL;
        ps_iter = ps_iter->ptr_next)
-    {
-      ;
-    }
+    ;

BVI: Are you sure the compiler let you get away this this? It gave me a warning once (in stage2 I believe).
 
   ps_iter->ptr_next = (struct pragma_simd_values *)
-    xmalloc (sizeof (struct pragma_simd_values));
-  gcc_assert (ps_iter->ptr_next != NULL);
- 
+    xcalloc (1, sizeof (struct pragma_simd_values));
+
+  // FIXME: There are a bunch of fields not initialized here:
+  // i.e. vlength_OK, pvars_OK, linear_steps_size

I am in the process of fixing those along with converting ps_* to vectors.

   ps_iter->ptr_next->pragma_encountered = local_simd_values.pragma_encountered;
+  ps_iter->ptr_next->loc = local_simd_values.loc;
   ps_iter->ptr_next->index = ps_iter->index + 1;
   ps_iter->ptr_next->types = local_simd_values.types;
   ps_iter->ptr_next->vectorlength = local_simd_values.vectorlength;
@@ -282,6 +331,7 @@  pragma_simd_assert_requested_p (int ps_index)
   if (ps_index == 0) 
     return 0;
 
+  // FIXME: Why not use psv_find_node.
   for (ps_iter = psv_head; ps_iter; ps_iter = ps_iter->ptr_next)
     {
       if ((ps_iter->pragma_encountered == true) && (ps_iter->index == ps_index))
@@ -322,7 +372,8 @@  pragma_simd_acceptable_vlength_p (int ps_index,
   possible_vector_length = possible_vectorization_factor;
 
   vl_tree = build_int_cst (integer_type_node, possible_vector_length);
-  
+
+  // FIXME: Why not use psv_find_node?
   for (ps_iter = psv_head; ps_iter != NULL; ps_iter = ps_iter->ptr_next)
     {
       if ((ps_iter->pragma_encountered == true) && (ps_iter->index == ps_index))
@@ -359,6 +410,7 @@  pragma_simd_vectorize_loop_p (int ps_index)
   if (ps_index <= INVALID_PRAGMA_SIMD_SLOT) 
     return false;
 
+  // FIXME: Why not use psv_find_node?
   for (ps_iter = psv_head; ps_iter != NULL; ps_iter = ps_iter->ptr_next) 
     if (ps_iter->index == ps_index) 
       return ps_iter->pragma_encountered;
@@ -564,6 +616,7 @@  check_off_reduction_var (gimple reduc_stmt, int pragma_simd_index)
     }
 
 
+  // FIXME: Why not use psv_find_node?

We can. It is on my list of things to fix.

   for (ps_iter = psv_head; ps_iter != NULL; ps_iter = ps_iter->ptr_next) 
     if (ps_iter->pragma_encountered && (ps_iter->index == pragma_simd_index)) 
       break;
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/compile/cilkplus_keywords_c_compile.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/compile/cilkplus_keywords_c_compile.exp
new file mode 100644
index 0000000..e666e8f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/compile/cilkplus_keywords_c_compile.exp

BVI: I have fixed these scripts already: the correct notation that I have used is "cilkplus_<type>_<language>_<compile/execute/errors>.exp

<type>:          CK  = cilk_keywords, AN = Array notation, PS = pragma simd, EF = elemental function.
<language>: c =C language, cpp = C++ language. 

@@ -0,0 +1,37 @@ 
+#   Copyright (C) 2011-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Written by Balaji V. Iyer <balaji.v.iyer@intel.com>
+
+if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
+      return
+}
+
+
+load_lib gcc-dg.exp
+
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O0" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O1" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O2" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O3" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O0 -g" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O1 -g" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O2 -g" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.c]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O3 -g" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/*.c]] " -O3 -ftree-vectorize -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/elem_fn_tests/*.c]] " -O3 -ftree-vectorize -fcilkplus" " "
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/compile/compile.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/compile/compile.exp
deleted file mode 100644
index 6302f76..0000000
--- a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/compile/compile.exp
+++ /dev/null
@@ -1,66 +0,0 @@ 
-#   Copyright (C) 2011-2013 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# Written by Balaji V. Iyer <balaji.v.iyer@intel.com>
-
-if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
-      return
-}
-
-
-load_lib gcc-dg.exp
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O0" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O1" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O2" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O3" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O0 -g" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O1 -g" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O2 -g" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cilk_keywords_test/compile/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O3 -g" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/*.c]] " -O3 -ftree-vectorize -fcilkplus" " "
-
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/elem_fn_tests/*.c]] " -O3 -ftree-vectorize -fcilkplus" " "
-
-dg-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/errors/cilkplus_keywords_c_errors.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/errors/cilkplus_keywords_c_errors.exp
new file mode 100644
index 0000000..23a1c0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/errors/cilkplus_keywords_c_errors.exp
@@ -0,0 +1,37 @@ 
+#   Copyright (C) 2012-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Written by Balaji V. Iyer <balaji.v.iyer@intel.com>
+
+if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
+      return
+}
+
+
+load_lib gcc-dg.exp
+
+set CILKPLUS_COMPILE_FLAGS "-ftree-vectorize -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus"
+
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O0" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O1" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O2" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O3" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O0 -g" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O1 -g" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O2 -g" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " $CILKPLUS_COMPILE_FLAGS -O3 -g" " "
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/errors/errors.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/errors/errors.exp
deleted file mode 100644
index 39cf1df..0000000
--- a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/errors/errors.exp
+++ /dev/null
@@ -1,59 +0,0 @@ 
-#   Copyright (C) 2012-2013 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# Written by Balaji V. Iyer <balaji.v.iyer@intel.com>
-
-if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
-      return
-}
-
-
-load_lib gcc-dg.exp
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O0" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O1" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O2" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O3" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O0 -g" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O1 -g" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O2 -g" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] " -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 -fcilkplus -O3 -g" " "
-dg-finish
-
-dg-finish
-
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/execute/cilkplus_keywords_c_execute.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/execute/cilkplus_keywords_c_execute.exp
new file mode 100644
index 0000000..c9f2f43
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/execute/cilkplus_keywords_c_execute.exp
@@ -0,0 +1,71 @@ 
+# Copyright (C) 2012-2013
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Balaji V. Iyer <balaji.v.iyer@intel.com>
+# Many thanks to the GCC C-torture contributors.
+
+if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
+      return
+}
+
+verbose "$tool $libdir" 1
+
+set library_var [get_multilibs]
+dg-init
+set ld_library_path "${library_var}/libcilkrts/.libs"
+set CILK_TORTURE_OPTIONS [list \
+			   { -O0 -fcilkplus -lcilkrts -std=c99} \
+			   { -O1 -fcilkplus -lcilkrts -std=c99} \
+			   { -O2 -fcilkplus -lcilkrts -std=c99} \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99} \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 } \
+			   { -O3 -g -fcilkplus -lcilkrts -std=c99} \
+			   { -Os -fcilkplus -lcilkrts -std=c99} \
+			   { -O0 -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -O1 -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -O2 -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99 -flto } \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 -flto} \
+			   { -O3 -g -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -Os -fcilkplus -lcilkrts -std=c99 -flto} ]
+
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+# load support procs
+load_lib torture-options.exp
+load_lib c-torture.exp
+
+torture-init
+set-torture-options $CILK_TORTURE_OPTIONS {{}} $CILK_TORTURE_OPTIONS
+
+#
+# main test loop
+#
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]]  {
+    # If we're only testing specific files and this isn't one of them, skip it.
+    if ![runtest_file_p $runtests $src] then {
+	continue
+    }
+
+    c-torture-execute $src
+}
+
+torture-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/execute/execute.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/execute/execute.exp
deleted file mode 100644
index c9f2f43..0000000
--- a/gcc/testsuite/gcc.dg/cilk-plus/cilk_keywords_test/execute/execute.exp
+++ /dev/null
@@ -1,71 +0,0 @@ 
-# Copyright (C) 2012-2013
-# Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# This file was written by Balaji V. Iyer <balaji.v.iyer@intel.com>
-# Many thanks to the GCC C-torture contributors.
-
-if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then {
-      return
-}
-
-verbose "$tool $libdir" 1
-
-set library_var [get_multilibs]
-dg-init
-set ld_library_path "${library_var}/libcilkrts/.libs"
-set CILK_TORTURE_OPTIONS [list \
-			   { -O0 -fcilkplus -lcilkrts -std=c99} \
-			   { -O1 -fcilkplus -lcilkrts -std=c99} \
-			   { -O2 -fcilkplus -lcilkrts -std=c99} \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99} \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 } \
-			   { -O3 -g -fcilkplus -lcilkrts -std=c99} \
-			   { -Os -fcilkplus -lcilkrts -std=c99} \
-			   { -O0 -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -O1 -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -O2 -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99 -flto } \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 -flto} \
-			   { -O3 -g -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -Os -fcilkplus -lcilkrts -std=c99 -flto} ]
-
-
-if $tracelevel then {
-    strace $tracelevel
-}
-
-# load support procs
-load_lib torture-options.exp
-load_lib c-torture.exp
-
-torture-init
-set-torture-options $CILK_TORTURE_OPTIONS {{}} $CILK_TORTURE_OPTIONS
-
-#
-# main test loop
-#
-
-foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]]  {
-    # If we're only testing specific files and this isn't one of them, skip it.
-    if ![runtest_file_p $runtests $src] then {
-	continue
-    }
-
-    c-torture-execute $src
-}
-
-torture-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/assert1.c b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/assert1.c
new file mode 100644
index 0000000..e1e011d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/assert1.c
@@ -0,0 +1,17 @@ 
+// { dg-do compile }
+// { dg-options "-O3" }
+
+struct stuff {
+ char asdf;
+ float f;
+};
+
+void add_floats(struct stuff *a, struct stuff *b, int n)
+{
+  int i;
+#pragma simd assert
+  for (i=0; i<n; i++) // { dg-error "loop not vectorized" }
+    {
+      a[i].f = a[i].f + b[i].f;
+    }
+}
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/assert2.c b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/assert2.c
new file mode 100644
index 0000000..e82308e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/assert2.c
@@ -0,0 +1,12 @@ 
+// { dg-do compile }
+// { dg-options "-O3" }
+
+void addf(float *a, float *b, float *c, int n)
+{
+    int i;
+#pragma simd assert vectorlength(1) /* { dg-error "vectorlength in pragma" } */
+    for (i=0; i<10; i++)
+    {
+      a[i] = b[i] + c[i];
+    }
+}
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/cilkplus_simd_c_compile.exp b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/cilkplus_simd_c_compile.exp
new file mode 100644
index 0000000..b6a149f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/cilkplus_simd_c_compile.exp
@@ -0,0 +1,34 @@ 
+#   Copyright (C) 2012-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Written by Balaji V. Iyer <balaji.v.iyer@intel.com>
+
+
+load_lib gcc-dg.exp
+
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O2 -ftree-vectorize -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O3 -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O0 -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O1 -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O2 -ftree-vectorize -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O3 -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/errors/*.c]] " -O3 -ftree-vectorize -fcilkplus -g" " "
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/compile.exp b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/compile.exp
deleted file mode 100644
index 400a033..0000000
--- a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/compile/compile.exp
+++ /dev/null
@@ -1,65 +0,0 @@ 
-#   Copyright (C) 2012-2013 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# Written by Balaji V. Iyer <balaji.v.iyer@intel.com>
-
-
-load_lib gcc-dg.exp
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O2 -ftree-vectorize -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O3 -fcilkplus" " "
-dg-finish
-
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O0 -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O1 -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O2 -ftree-vectorize -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O3 -fcilkplus" " "
-dg-finish
-
-dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/errors/*.c]] " -O3 -ftree-vectorize -fcilkplus -g" " "
-dg-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/addf.c b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/addf.c
new file mode 100644
index 0000000..7559401
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/addf.c
@@ -0,0 +1,24 @@ 
+float a[5];
+float b[5] = {1.0F, 2.0F, 3.0F, 4.0F, 5.0F };
+float c[5] = {2.0F, 2.0F, 2.0F, 2.0F, 2.0F };
+float result[5] = {3.0F, 4.0F, 5.0F, 6.0F, 7.0F };
+
+void addf(float *a, float *b, float *c, int n)
+{
+    int i;
+#pragma simd
+    for (i=0; i<n; i++)
+    {
+      a[i] = b[i] + c[i];
+    }
+}
+
+int main()
+{
+  int i;
+  addf(a, b, c, 5);
+  for (i=0; i < 5; ++i)
+    if (a[i] != result[i])
+      abort();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/cilkplus_simd_c_execute.exp b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/cilkplus_simd_c_execute.exp
new file mode 100644
index 0000000..dbf7a29
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/cilkplus_simd_c_execute.exp
@@ -0,0 +1,66 @@ 
+# Copyright (C) 2012-2013
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Balaji V. Iyer <balaji.v.iyer@intel.com>
+# Many thanks to the GCC C-torture contributors.
+
+verbose "$tool $libdir" 1
+
+set library_var [get_multilibs]
+#dg-init
+set CILK_TORTURE_OPTIONS [list \
+			   { -O0 -fcilkplus -lcilkrts -std=c99} \
+			   { -O1 -fcilkplus -lcilkrts -std=c99} \
+			   { -O2 -fcilkplus -lcilkrts -std=c99} \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99} \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 } \
+			   { -O3 -g -fcilkplus -lcilkrts -std=c99} \
+			   { -Os -fcilkplus -lcilkrts -std=c99} \
+			   { -O0 -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -O1 -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -O2 -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99 -flto } \
+			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 -flto} \
+			   { -O3 -g -fcilkplus -lcilkrts -std=c99 -flto} \
+			   { -Os -fcilkplus -lcilkrts -std=c99 -flto} ]
+
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+# load support procs
+load_lib torture-options.exp
+load_lib c-torture.exp
+
+torture-init
+set-torture-options $CILK_TORTURE_OPTIONS {{}} $CILK_TORTURE_OPTIONS
+
+#
+# main test loop
+#
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]]  {
+    # If we're only testing specific files and this isn't one of them, skip it.
+    if ![runtest_file_p $runtests $src] then {
+	continue
+    }
+
+    c-torture-execute $src
+}
+
+torture-finish
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/execute.exp b/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/execute.exp
deleted file mode 100644
index 99c5bc0..0000000
--- a/gcc/testsuite/gcc.dg/cilk-plus/pragma_simd_tests/execute/execute.exp
+++ /dev/null
@@ -1,66 +0,0 @@ 
-# Copyright (C) 2012-2013
-# Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# This file was written by Balaji V. Iyer <balaji.v.iyer@intel.com>
-# Many thanks to the GCC C-torture contributors.
-
-verbose "$tool $libdir" 1
-
-set library_var [get_multilibs]
-dg-init
-set CILK_TORTURE_OPTIONS [list \
-			   { -O0 -fcilkplus -lcilkrts -std=c99} \
-			   { -O1 -fcilkplus -lcilkrts -std=c99} \
-			   { -O2 -fcilkplus -lcilkrts -std=c99} \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99} \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 } \
-			   { -O3 -g -fcilkplus -lcilkrts -std=c99} \
-			   { -Os -fcilkplus -lcilkrts -std=c99} \
-			   { -O0 -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -O1 -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -O2 -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-loops -std=c99 -flto } \
-			   { -O3 -fcilkplus -lcilkrts -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 -flto} \
-			   { -O3 -g -fcilkplus -lcilkrts -std=c99 -flto} \
-			   { -Os -fcilkplus -lcilkrts -std=c99 -flto} ]
-
-
-if $tracelevel then {
-    strace $tracelevel
-}
-
-# load support procs
-load_lib torture-options.exp
-load_lib c-torture.exp
-
-torture-init
-set-torture-options $CILK_TORTURE_OPTIONS {{}} $CILK_TORTURE_OPTIONS
-
-#
-# main test loop
-#
-
-foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]]  {
-    # If we're only testing specific files and this isn't one of them, skip it.
-    if ![runtest_file_p $runtests $src] then {
-	continue
-    }
-
-    c-torture-execute $src
-}
-
-torture-finish
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 8fffffb..03f3e05 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -130,65 +130,12 @@  vectorize_loops (void)
 
   vect_location = UNKNOWN_LOC;
 
-  FOR_EACH_LOOP (li, loop, 0)
+  if (flag_enable_cilk)
     {
-      if (flag_enable_cilk)
-	{
-	  if ((!clause_resolved_p (P_SIMD_VECTORLENGTH, 
-				   loop->pragma_simd_index)))
-	    {
-	      if (pragma_simd_assert_requested_p (loop->pragma_simd_index))
-		{
-		  error ("Vectorlength not picked from the list."
-			 " ASSERT REQUESTED");
-		  exit (ICE_EXIT_CODE);
-		}
-	      else 
-		{
-		  warning (0, "Vectorlength not picked from list.");
-		}
-	    }
-	  if (!clause_resolved_p (P_SIMD_PRIVATE, loop->pragma_simd_index))
-	    { 
-	      if (pragma_simd_assert_requested_p (loop->pragma_simd_index))
-		{ 
-		  error ("Unable to make all variables private. "
-			  "ASSERT REQUESTED");
-		  exit(ICE_EXIT_CODE);
-		} 
-	      else
-		{
-		  warning (0, "Unable to make all variables private.");
-		} 
-	    }     
-	  if (!clause_resolved_p (P_SIMD_LINEAR, loop->pragma_simd_index))
-	    {
-	      if (pragma_simd_assert_requested_p (loop->pragma_simd_index))
-		{
-		  error ("Unable to pick requested step-size. "
-			 "ASSERT REQUESTED");
-		  exit(ICE_EXIT_CODE);
-		}
-	      else
-		{
-		  warning (0, "Unable to pick requested step-size.");
-		}
-	    }
-	  if (!clause_resolved_p (P_SIMD_REDUCTION, loop->pragma_simd_index))
-	    {
-	      if (pragma_simd_assert_requested_p (loop->pragma_simd_index))
-		{
-		  error ("Unable to satisfy all reductions.\nASSERT REQUESTED");
-		  exit(ICE_EXIT_CODE);
-		}
-	      else
-		{
-		  warning (0, "Unable to satisfy all reductions...continuing");
-		}
-	    }
-	}
+      FOR_EACH_LOOP (li, loop, 0)
+	pragma_simd_verify_clauses (loop->pragma_simd_index);
     }

BVI: This is OK!
-  
+	
BVI: Why did you replace a space with a tab?

   statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops);
   if (dump_enabled_p ()
       || (num_vectorized_loops > 0 && dump_enabled_p ()))
diff --git a/gcc/tree.h b/gcc/tree.h
index cf6a135..dd4de3e 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -65,12 +65,22 @@  struct reduction_values
   struct reduction_values *ptr_next;
 };
 
-/* Since we can have multiple pragma simd, this will hold the values of 
-   each of the pragma simd and then as soon as it finds a for loop 
-   it will transfer those values into the loop tree structure.  */
+/* Since we can have multiple pragma simds, this holds the values of
+   each of the pragma simds as we are parsing them.  An index into
+   this table gets propagated to the tree structure for LABEL_DECL's
+   (as for loops are being parsed), then to the gimple structure for
+   GIMPLE_LABEL's, then to the BB structure, and finally to the loop
+   structure.  */
 struct pragma_simd_values
 {
   int index;
+
+  /* Location of the #pragma itself.  Ideally, we should keep the
+     location for each clause so we can give more detailed
+     diagnostics, but this will work for now.  */
+  location_t loc;
+
+  // FIXME: All these need to be commented.
   bool pragma_encountered;
   unsigned int types;
   tree vectorlength;
@@ -93,6 +103,8 @@  struct pragma_simd_values
   struct pragma_simd_values *ptr_next;
 };
 
+// FIXME: This should not be globally visible.  Instead we should have
+// accessor functions, with a more meaningful name.
 extern struct pragma_simd_values *psv_head;
 
BVI: OK!