<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.gcc.patches">
    <title>gmane.comp.gcc.patches</title>
    <link>http://blog.gmane.org/gmane.comp.gcc.patches</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263679"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263678"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263677"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263676"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263675"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263673"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263672"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263671"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263670"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263669"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263668"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263667"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263666"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263665"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263664"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263663"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263662"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263661"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263659"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.gcc.patches/263658"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263679">
    <title>Re: fix cross build</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263679</link>
    <description>&lt;pre&gt;
Looks ok to me.  Though I wonder how we got away with that for so long time ...

What do others prefer?  Keep CONSTRUCTORs "broken" and paper over in
gimplify.c instead?

If you don't hear from somebody else in 24h the patch is ok as-is
(can you do some grepping whether there are callers of build_constructor
that set TREE_SIDE_EFFECTS on it afterwards?)

Thanks,
Richard.


&lt;/pre&gt;</description>
    <dc:creator>Richard Guenther</dc:creator>
    <dc:date>2012-05-24T08:03:15</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263678">
    <title>Re: [PATCH][4/n] referenced-vars TLC</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263678</link>
    <description>&lt;pre&gt;

I am testing the following (or it will reproduce hopefully, with
--with-build-config=bootstrap-debug).  Why can't compare-debug ignore
comment sections?

Thanks,
Richard.

2012-05-24  Richard Guenther  &amp;lt;rguenther&amp;lt; at &amp;gt;suse.de&amp;gt;

PR bootstrap/53466
* tree-ssa-live.c (remove_unused_scope_block_p): Properly
handle globals.
(remove_unused_locals): Pass global_unused_vars to
remove_unused_scope_block_p.

Index: gcc/tree-ssa-live.c
===================================================================
--- gcc/tree-ssa-live.c(revision 187800)
+++ gcc/tree-ssa-live.c(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -429,7 +429,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; mark_scope_block_unused (tree scope)
    done by the inliner.  */
 
 static bool
-remove_unused_scope_block_p (tree scope)
+remove_unused_scope_block_p (tree scope, bitmap global_unused_vars)
 {
   tree *t, *next;
   bool unused = !TREE_USED (scope);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -472,7 +472,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; remove_unused_scope_block_p (tree scope)
  info about optimized-out variables in the scope blocks.
  Exception are the scope blocks not containing any instructions
  at all so user can't get into the scopes at first place.  */
-      else if (var_ann (*t) != NULL &amp;amp;&amp;amp; is_used_p (*t))
+      else if ((is_global_var (*t)
+&amp;amp;&amp;amp; !bitmap_bit_p (global_unused_vars, DECL_UID (*t)))
+       || (var_ann (*t) != NULL &amp;amp;&amp;amp; is_used_p (*t)))
 unused = false;
       else if (TREE_CODE (*t) == LABEL_DECL &amp;amp;&amp;amp; TREE_USED (*t))
 /* For labels that are still used in the IL, the decision to
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -517,7 +519,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; remove_unused_scope_block_p (tree scope)
     }
 
   for (t = &amp;amp;BLOCK_SUBBLOCKS (scope); *t ;)
-    if (remove_unused_scope_block_p (*t))
+    if (remove_unused_scope_block_p (*t, global_unused_vars))
       {
 if (BLOCK_SUBBLOCKS (*t))
   {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -847,9 +849,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; remove_unused_locals (void)
     }
   if (dstidx != num)
     VEC_truncate (tree, cfun-&amp;gt;local_decls, dstidx);
+
+  remove_unused_scope_block_p (DECL_INITIAL (current_function_decl),
+       global_unused_vars);
+
   BITMAP_FREE (global_unused_vars);
 
-  remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
   if (dump_file &amp;amp;&amp;amp; (dump_flags &amp;amp; TDF_DETAILS))
     {
       fprintf (dump_file, "Scope blocks after cleanups:\n");&lt;/pre&gt;</description>
    <dc:creator>Richard Guenther</dc:creator>
    <dc:date>2012-05-24T07:33:39</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263677">
    <title>Re: [PATCH][4/n] referenced-vars TLC</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263677</link>
    <description>&lt;pre&gt;

Well, I can't.  Why is debug compare so fragile?  Now trying to find
a way to reproduce (I can't see why it should cause this ...)

Richard.&lt;/pre&gt;</description>
    <dc:creator>Richard Guenther</dc:creator>
    <dc:date>2012-05-24T07:12:24</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263676">
    <title>Re: fix install-no-fixedincludes mishaps</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263676</link>
    <description>&lt;pre&gt;

This has a fairly annoying side effect.  The all rule in libgcc runs a
make install installing everything back in the gcc directory.  This now
installs unwind.h.  The effect is that every time libgcc is built, unwind.h
changes.  And the effect of that is that every library file that depends on
unwind.h gets rebuilt every time.  This affects libgo and libitm.

Please fix this one way or another so that the copy of unwind.h installed
in the gcc object directory does not have its timestamp change if the
file contents are unchanged, as it used to be.

Thanks.

Ian

&lt;/pre&gt;</description>
    <dc:creator>Ian Lance Taylor</dc:creator>
    <dc:date>2012-05-24T04:18:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263675">
    <title>Re: [PATCH] Hoist adjacent pointer loads</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263675</link>
    <description>&lt;pre&gt;
Hm, I think really what we want is to just look within the block size
established by param_align...something like:

      offset1 = TREE_INT_CST_LOW (tree_offset1);
      offset2 = TREE_INT_CST_LOW (tree_offset2);
      size2 = TREE_INT_CST_LOW (tree_size2);
      align1 = DECL_ALIGN (field1) % (param_align * BITS_PER_UNIT);

      if (offset1 % BITS_PER_UNIT != 0)
continue;

      /* The two field references must fit within a block of memory that
 is guaranteed to be on the same page.  */
      if (align1 + offset2 - offset1 + size2 &amp;gt; param_align * BITS_PER_UNIT)
continue;

I.e., use the DECL_ALIGN to find where within the block we are probably
starting, then make sure the extent of the two objects doesn't run past
the end of the block.  Sound right?



&lt;/pre&gt;</description>
    <dc:creator>William J. Schmidt</dc:creator>
    <dc:date>2012-05-24T04:12:54</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263673">
    <title>Re: [PATCH] Fix VRP handling of undefined state</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263673</link>
    <description>&lt;pre&gt;
This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53465


&lt;/pre&gt;</description>
    <dc:creator>H.J. Lu</dc:creator>
    <dc:date>2012-05-24T02:50:48</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263672">
    <title>Re: [PATCH][4/n] referenced-vars TLC</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263672</link>
    <description>&lt;pre&gt;
I opened:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53466


&lt;/pre&gt;</description>
    <dc:creator>H.J. Lu</dc:creator>
    <dc:date>2012-05-24T02:39:33</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263671">
    <title>Re: [PATCH 2/2] Better system header location detection for built-in macro tokens</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263671</link>
    <description>&lt;pre&gt;
That makes sense.  Though really the relevant location would be the '='.


Regresses how?  In this case the locus of the conversion is again the 
'='.  So the line number of the warning might change, but that doesn't 
seem like a significant regression.


I'm not sure I agree.  We don't want to warn about a conversion that's 
all within a macro from a system header, even if it is expanded within 
an expression in user code.  We just need to get the location right for 
our diagnostics, which is an ongoing process, but we've been making a 
lot of progress just recently.

Jason

&lt;/pre&gt;</description>
    <dc:creator>Jason Merrill</dc:creator>
    <dc:date>2012-05-24T02:03:26</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263670">
    <title>Re: Turn check macros into functions. (issue6188088)</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263670</link>
    <description>&lt;pre&gt;
Also trivial...  Just one has to generate the context correctly.  One has to save off the registers and then in the context generator, synthesize them back up.  So, take a context in which a is in register 5, one can generate something like:

void eval() {
    register int a = __gdb_registers[5];

    &amp;lt;snippet&amp;gt;

   __gdb_registers[5] = a;
  }

This preserves the value in register 5 from the gdb context at that point, and even allows the user to write to such variables, and have that reflected in the register file.


Yes, setting the value of a variable that has, for example, been removed due to dce, is annoying.  But I'll note it is annoying in gdb currently.  I'd be happy to introduce declarations that if used, lead to compile time errors.  Darwin for example has an unavailable attribute one can attach to a decl to ensure an error is produced.  gcc has deprecated, though, it is just a warning.

Now, for variables that can be computed from variables that are present, I'd rather the optimizer explain how to produce the value given the state and for gdb to producea context with that value into a read only variable.  This preserves for read access such variables that are gone.  This is something that gcc and gdb should be doing anyway...  but don't.


:-)  Not yet...  Maybe never.


Yeah, I kinda think the gdb people are wimping out by not just implementing __extension__ and ({}), which, I think get us most of the way there.  Shh, don't tell them I said that.

&lt;/pre&gt;</description>
    <dc:creator>Mike Stump</dc:creator>
    <dc:date>2012-05-24T00:24:41</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263669">
    <title>Re: [PATCH] Add powerpc64-linux configuration options</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263669</link>
    <description>&lt;pre&gt;

I support deleting the soft-float multilib; it can't be used as-is because 
it requires its own libc, in its own sysroot, and the configuration 
doesn't use a separate sysroot for it.  As for -mstrict-align, again if 
someone wants -mstrict-align libraries I think they should set up a 
multilib using that option (or a CPU option that implies it) rather than 
trying to make the libraries from a compiler configured for some CPU 
compatible with another CPU they wouldn't normally be compatible with.

&lt;/pre&gt;</description>
    <dc:creator>Joseph S. Myers</dc:creator>
    <dc:date>2012-05-23T22:59:10</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263668">
    <title>[PATCH] Add powerpc64-linux configuration options</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263668</link>
    <description>&lt;pre&gt;On powerpc64-linux systems that run on IBM servers, the 32-bit software
emulation library is not built with the Red Hat and SUSE distributions, but the
FSF sources still list it as a multilib.  This patch adds a configuration
option (--disable-ppc64-swfloat) to disable building this library.

We've also seen some performance issues where building the multilibs with the
-mstrict-align option causes slow downs.  I vaguelly recall adding this option
in the 1995 time frame, because the 603, 604 systems of the day did not handle
unaligned accesses in little endian mode, and maybe some of the other embedded
chips did not handle unaligned accesses at all.  This patch also adds an option
(--disable-ppc64-strict-align) to disable building the multilibs with
-mstrict-align.

I have bootstrapped the compiler with and without the changes, and there are no
differences.  Is it ok to apply?

An alternative would be for the powerpc64-linux case, should we just delete the
software floating emulation multilib and stop using the -mstrict-align, since
Linux only runs in big endian mode.  The software emulation multilib would be
built for other powerpc varients and -mstrict-align would be used there as
well.

2012-05-23  Michael Meissner  &amp;lt;meissner&amp;lt; at &amp;gt;linux.vnet.ibm.com&amp;gt;

* configure.ac (--disable-ppc64-swfloat): New configure switches
for powerpc64-linux to disable building multlibs for 32-bit
software floating point emulation, and to remove the
-mstrict-align option from the multilib options.
(--disable-ppc64-strict-align): Likewise.
* config.gcc (powerpc64-linux): Likewise.
* configure: Regenerate.

* config/rs6000/t-linux64-noalign: New configuration files for
enabling and disabling building the libraries with
-mstrict-align.
* config/rs6000/t-linux64-align: Likewise.
* config/rs6000/t-linux64-noswflt: New configuration file to
disable building the 32-bit software floating point emulation
library.
* config/rs6000/t-linux64 (MULTILIB_EXTRA_OPTS): Move to
t-linux64-align and t-linux64-noalign.

* doc/install.texi (--disable-ppc64-swfloat): Document.
(--dsiable-ppc64-strict-align): Likewise.

&lt;/pre&gt;</description>
    <dc:creator>Michael Meissner</dc:creator>
    <dc:date>2012-05-23T22:36:15</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263667">
    <title>Re: Turn check macros into functions. (issue6188088)</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263667</link>
    <description>&lt;pre&gt;
Should I add that to my patch to gdbinit.in?

&lt;/pre&gt;</description>
    <dc:creator>Lawrence Crowl</dc:creator>
    <dc:date>2012-05-23T22:36:39</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263666">
    <title>Re: Turn check macros into functions. (issue6188088)</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263666</link>
    <description>&lt;pre&gt;
For variables that are not optimized out of memory, I think this
can work.  But if you need to go for registers, or undo a variable
elimination, the effort gets harder.


Agreed.


Yes, you essentially need to come close to sending the compiler's
symbol tables through the debug information.  I don't know of any
compiler/debugger pair that is close to that capability.  That said,
I don't know all such pairs either.


Agreed.


I'm not saying that the task is impossible, only that there is a
lot of work to do before we get there.

&lt;/pre&gt;</description>
    <dc:creator>Lawrence Crowl</dc:creator>
    <dc:date>2012-05-23T22:36:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263665">
    <title>Re: [cxx-conversion] Convert vec.[ch] to C++ [3/3] (issue6236044)</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263665</link>
    <description>&lt;pre&gt;
LGTM.

&lt;/pre&gt;</description>
    <dc:creator>Lawrence Crowl</dc:creator>
    <dc:date>2012-05-23T21:59:17</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263664">
    <title>Re: [cxx-conversion] Convert vec.[ch] to C++ [2/3] (issue6236043)</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263664</link>
    <description>&lt;pre&gt;
LGTM.

&lt;/pre&gt;</description>
    <dc:creator>Lawrence Crowl</dc:creator>
    <dc:date>2012-05-23T21:57:27</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263663">
    <title>Re: [cxx-conversion] Convert vec.[ch] to C++ [1/3] (issue6233044)</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263663</link>
    <description>&lt;pre&gt;
LGTM.

&lt;/pre&gt;</description>
    <dc:creator>Lawrence Crowl</dc:creator>
    <dc:date>2012-05-23T21:56:15</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263662">
    <title>Re: [PATCH, 4.6] Fix PR53170: missing target c++11 selector</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263662</link>
    <description>&lt;pre&gt;
Done as per http://gcc.gnu.org/ml/gcc-cvs/2012-05/msg00810.html and
the typo fix in http://gcc.gnu.org/ml/gcc-cvs/2012-05/msg00813.html.

&lt;/pre&gt;</description>
    <dc:creator>Michael Hope</dc:creator>
    <dc:date>2012-05-23T21:37:47</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263661">
    <title>[PATCH][Cilkplus] Implementation of the Mask Clause in elemental function</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263661</link>
    <description>&lt;pre&gt; Hello Everyone,
     This patch is for the Cilkplus branch affecting both C and C++ compilers.This patch will implement the mask clause of elemental functions.

Thanking You,

Yours Sincerely,

Balaji V. Iyer.Index: cgraph.h
===================================================================
--- cgraph.h(revision 187789)
+++ cgraph.h(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -630,7 +630,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*,
        bool, bitmap, bool, bitmap, basic_block);
 void tree_elem_fn_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*,
-      bool, bitmap, bool, bitmap, basic_block, int);
+      bool, bitmap, bool, bitmap, basic_block, int,
+      bool);
 bool cgraph_process_new_functions (void);
 void cgraph_process_same_body_aliases (void);
 void fixup_same_cpp_alias_visibility (symtab_node node, symtab_node target, tree alias);
Index: tree.h
===================================================================
--- tree.h(revision 187789)
+++ tree.h(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -6234,6 +6234,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 tree build_call_list (tree return_type, tree fn, tree arglist);
 tree build_function_linkage_variant (tree ttype,
      enum function_linkage linkage);
+bool is_elem_fn (tree);
+enum elem_fn_parm_type find_elem_fn_parm_type (gimple, tree, tree*);
+void elem_fn_create_fn (tree) __attribute__((weak));
 
 /* Functional interface to the builtin functions.  */
 
Index: cgraphunit.c
===================================================================
--- cgraphunit.c(revision 187789)
+++ cgraphunit.c(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -226,15 +226,23 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 static bool
 cgraph_decide_is_function_needed (struct cgraph_node *node, tree decl)
 {
+  bool is_cloned_elem_func = false;
   /* If the user told us it is used, then it must be so.  */
   if (node-&amp;gt;symbol.force_output)
     return true;
 
+  /* When an elemental function is cloned, we set the elem_fn_already_cloned,
+     will be set to true, for all other functions, it is initalized to zero.
+     So, if it is an elemental function, we output it without questioning */
+  if (DECL_STRUCT_FUNCTION (decl))
+    is_cloned_elem_func = DECL_STRUCT_FUNCTION (decl)-&amp;gt;elem_fn_already_cloned;
+  
   /* Double check that no one output the function into assembly file
      early.  */
   gcc_checking_assert (!DECL_ASSEMBLER_NAME_SET_P (decl)
                || (node-&amp;gt;thunk.thunk_p || node-&amp;gt;same_body_alias)
-               ||  !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)));
+               ||  !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
+       || is_cloned_elem_func);
 
 
   /* Keep constructors, destructors and virtual functions.  */
Index: cilk.h
===================================================================
--- cilk.h(revision 187789)
+++ cilk.h(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -195,6 +195,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #define notify_zc_intrinsic_fndecl      cilk_trees[NOTIFY_ZC_INTRINSIC]
 #define notify_intrinsic_fndecl         cilk_trees[NOTIFY_INTRINSIC]
 
+/* this is the max number of data we have have in elem-function arrays */
+#define MAX_VARS 50
 
 typedef struct zca_data_t
 {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -205,7 +207,41 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   struct zca_data_t *ptr_next;
 } zca_data;
 
+/* These are different mask options. I put 12345 so that we can defferenciate
+ * the value during debugging */
+enum mask_options {
+  USE_MASK = 12345,
+  USE_NOMASK,
+  USE_BOTH
+};
 
+/* this data structure will hold all the data from the vector attribute */
+typedef struct
+{
+  char *proc_type;
+  enum mask_options mask;
+  int vectorlength[MAX_VARS];
+  int no_vlengths;
+  char *uniform_vars[MAX_VARS];
+  int no_uvars;
+  int uniform_location[MAX_VARS]; /* their location in parm list */
+  char *linear_vars[MAX_VARS];
+  int linear_steps[MAX_VARS];
+  int linear_location[MAX_VARS]; /* their location in parm list */
+  int no_lvars;
+  int private_location[MAX_VARS]; /* parm not in uniform or linear list */
+  int no_pvars;
+  char *func_prefix;
+  int total_no_args;
+} elem_fn_info;
+
+/* this data structure will hold all the arguments in the function */
+typedef struct {
+  tree induction_var;
+  tree arguments;
+  tree return_var;
+} fn_vect_elements;
+
 /* Offset of fields in the Cilk frame descriptor.
    Index is same as for cilk_trees.  If the index
    does not correspond to a field of the Cilk frame
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -270,6 +306,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 extern void debug_zca_data (void);
 extern zca_data *get_zca_entry (int);
 extern void insert_in_zca_table (zca_data);
-extern bool is_elem_fn (tree); 
+extern bool is_elem_fn (tree);
 extern tree find_elem_fn_name (tree, tree, tree);
+extern void elem_fn_create_fn (tree);
+extern char *find_processor_code (elem_fn_info *);
+extern char *find_vlength_code (elem_fn_info *);
+extern tree rename_elem_fn (tree, const char *);
+extern char *find_suffix (elem_fn_info *, bool);
+extern enum elem_fn_parm_type find_elem_fn_parm_type (gimple, tree, tree *);
+extern tree find_elem_fn_name (tree, tree, tree);
+elem_fn_info *extract_elem_fn_values (tree);
 #endif /* GCC_CILK_H */
Index: elem-function.c
===================================================================
--- elem-function.c(revision 187789)
+++ elem-function.c(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,9 +1,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* This file is part of the Intel(R) Cilk(TM) Plus support
-   This file contains the functions for Elemental functions.
+   This file contains C/C++ specific functions for elemental
+   functions.
    
    Copyright (C) 2012  Free Software Foundation, Inc.
    Written by Balaji V. Iyer &amp;lt;balaji.v.iyer&amp;lt; at &amp;gt;intel.com&amp;gt;,
-   Intel Corporation
+              Intel Corporation
 
    Many Thanks to Karthik Kumar for advice on the basic technique
    about cloning functions.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -29,7 +30,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
-#include "rtl.h"
+#include "langhooks.h"
+#include "cilk.h"
 #include "tm_p.h"
 #include "hard-reg-set.h"
 #include "basic-block.h"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -40,8 +42,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include "tree-dump.h"
 #include "tree-pass.h"
 #include "timevar.h"
-#include "cfgloop.h"
 #include "flags.h"
+#include "c-tree.h"
 #include "tree-inline.h"
 #include "cgraph.h"
 #include "ipa-prop.h"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -52,196 +54,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include "intl.h"
 #include "vec.h"
 
-#define MAX_VARS 50
 
-enum mask_options {
-  USE_MASK = 12345,
-  USE_NOMASK,
-  USE_BOTH
-};
-
-typedef struct
-{
-  char *proc_type;
-  enum mask_options mask;
-  int vectorlength[MAX_VARS];
-  int no_vlengths;
-  char *uniform_vars[MAX_VARS];
-  int no_uvars;
-  int uniform_location[MAX_VARS]; /* their location in parm list */
-  char *linear_vars[MAX_VARS];
-  int linear_steps[MAX_VARS];
-  int linear_location[MAX_VARS]; /* their location in parm list */
-  int no_lvars;
-  int private_location[MAX_VARS]; /* parm not in uniform or linear list */
-  int no_pvars;
-  char *func_prefix;
-  int total_no_args;
-} elem_fn_info;
-
-static elem_fn_info *extract_elem_fn_values (tree);
 static tree create_optimize_attribute (int);
 static tree create_processor_attribute (elem_fn_info *, tree *);
+static tree elem_fn_build_array (tree base_var, tree index);
 
-/* this is an helper function for find_elem_fn_param_type */
-static enum elem_fn_parm_type
-find_elem_fn_parm_type_1 (tree fndecl, int parm_no, tree *step_size)
-{
-  int ii = 0;
-  elem_fn_info *elem_fn_values;
 
-  elem_fn_values = extract_elem_fn_values (fndecl);
-  if (!elem_fn_values)
-    return TYPE_NONE;
-
-  for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_lvars; ii++)
-    if (elem_fn_values-&amp;gt;linear_location[ii] == parm_no)
-      {
-if (step_size != NULL)
-  *step_size = build_int_cst (integer_type_node,
-      elem_fn_values-&amp;gt;linear_steps[ii]);
-return TYPE_LINEAR;
-      }
-    
-  for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_uvars; ii++)
-    if (elem_fn_values-&amp;gt;uniform_location[ii] == parm_no)
-      return TYPE_UNIFORM;
-    
-  return TYPE_NONE;
-}
-  
-  
-/* this function will return the type of a parameter in elemental function.
-   The choices are UNIFORM or LINEAR. */
-enum elem_fn_parm_type
-find_elem_fn_parm_type (gimple stmt, tree op, tree *step_size)
-{
-  tree fndecl, parm = NULL_TREE;
-  int ii, nargs;
-  enum elem_fn_parm_type return_type = TYPE_NONE;
-  
-  if (gimple_code (stmt) != GIMPLE_CALL)
-    return TYPE_NONE;
-
-  fndecl = gimple_call_fndecl (stmt);
-  gcc_assert (fndecl);
-
-  nargs = gimple_call_num_args (stmt);
-
-  for (ii = 0; ii &amp;lt; nargs; ii++)
-    {
-      parm = gimple_call_arg (stmt, ii);
-      if (op == parm)
-{
-  return_type = find_elem_fn_parm_type_1 (fndecl, ii, step_size);
-  return return_type;
-}
-    }
-  return return_type;
-}
-  
-/* this function will concatinate the suffix to the existing function decl */
-static tree
-rename_elem_fn (tree decl, const char *suffix)
-{
-  int length = 0;
-  const char *fn_name = IDENTIFIER_POINTER (DECL_NAME (decl));
-  char *new_fn_name;
-  tree new_decl = NULL_TREE;
-  
-  if (!suffix || !fn_name)
-    return decl;
-  else
-    new_decl = decl;
-
-  length = strlen (fn_name) + strlen (suffix) + 1;
-  new_fn_name = (char *)xmalloc (length);
-  strcpy (new_fn_name, fn_name);
-  strcat (new_fn_name, suffix);
-
-  DECL_NAME (new_decl) = get_identifier (new_fn_name);
-  return new_decl;
-}
-
-/* this function will check to see if the node is part of an function that
- * needs to be converted to its vector equivalent. */
-bool
-is_elem_fn (tree fndecl)
-{
-  tree ii_tree;
-
-  for (ii_tree = DECL_ATTRIBUTES (fndecl); ii_tree;
-       ii_tree = TREE_CHAIN (ii_tree))
-    {
-      tree ii_value = TREE_PURPOSE (ii_tree);
-      if (TREE_CODE (ii_value) == IDENTIFIER_NODE
-  &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (ii_value), "vector"))
-return true;
-    }
-
-  /* If we are here, then we didn't find a vector keyword, so it is false */
-  return false;
-}
-
-/* This function will find the appropriate processor code in the function
- * mangling vector function
- */
-static char *
-find_processor_code (elem_fn_info *elem_fn_values)
-{
-  if (!elem_fn_values || !elem_fn_values-&amp;gt;proc_type)
-    return xstrdup ("B");
-
-  if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium_4"))
-    return xstrdup ("B");
-  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium4_sse3"))
-    return xstrdup ("D");
-  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_ssse3"))
-    return xstrdup ("E");
-  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_sse_4_1"))
-    return xstrdup ("F");
-  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core_i7_sse4_2"))
-    return xstrdup ("H");
-  else
-    gcc_unreachable ();
-
-  return NULL; /* should never get here */
-}
-
-/* this function will return vectorlength, if specified, in string format -OR-
- * it will give the default vector length for the specified architecture. */
-static char *
-find_vlength_code (elem_fn_info *elem_fn_values)
-{
-  char *vlength_code = (char *) xmalloc (sizeof (char) * 10);
-  if (!elem_fn_values)
-    { 
-      sprintf (vlength_code, "4");
-      return vlength_code;
-    }
-
-  memset (vlength_code, 10, 0);
-  
-  if (elem_fn_values-&amp;gt;no_vlengths != 0)
-    sprintf(vlength_code,"%d", elem_fn_values-&amp;gt;vectorlength[0]);
-  else
-    {
-      if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium_4"))
-sprintf (vlength_code,"4");
-      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium4_sse3"))
-sprintf (vlength_code, "4");
-      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_ssse3"))
-sprintf (vlength_code, "4");
-      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_sse_4_1"))
-sprintf (vlength_code, "4");
-      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core_i7_sse4_2"))
-sprintf (vlength_code, "4");
-      else
-gcc_unreachable ();
-    }
-  return vlength_code;
-}
-
 /* This function will create the appropriate __target__ attribute for the
  * processor */
 static tree
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -356,7 +174,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   VEC(tree,gc) *opt_vec = VEC_alloc (tree,gc, 4);
   char optimization[2];
   optimization[0] = 'O';
-  sprintf(&amp;amp;optimization[1], "%1d", option);
+  
+  if (option == 3)
+    optimization[1] = '3';
+  else if (option == 2)
+    optimization[1] = '2';
+  else if (option == 1)
+    optimization[1] = '1';
+  else if (option == 0)
+    optimization[1] = '0';
+  
   VEC_safe_push (tree, gc, opt_vec, build_string (2, optimization));
   opt_attr = build_tree_list_vec (opt_vec);
   VEC_truncate (tree, opt_vec, 0);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -364,343 +191,363 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   return opt_attr;
 }
 
-/* this function will find the appropriate mangling suffix for the vector
- * function */
-static char *
-find_suffix (elem_fn_info *elem_fn_values, bool masked)
+
+/* this function will store return expression to a temporary var */
+static tree
+replace_return_with_new_var (tree *tp, int *walk_subtrees, void *data)
 {
-  char *suffix = (char*)xmalloc (100);
-  char tmp_str[10];
-  int arg_number, ii_pvar, ii_uvar, ii_lvar;
-  strcpy (suffix, "._simdsimd_");
-  strcat (suffix, find_processor_code (elem_fn_values));
-  strcat (suffix, find_vlength_code (elem_fn_values));
-  if (masked)
-    strcpy (suffix, "m");
-  else
-    strcat (suffix, "n");
+  tree mod_expr = NULL_TREE, return_var = NULL_TREE, ret_expr = NULL_TREE;
+  
+  if (!*tp)
+    return NULL_TREE;
 
-  for (arg_number = 1; arg_number &amp;lt;= elem_fn_values-&amp;gt;total_no_args;
-       arg_number++)
+  if (TREE_CODE (*tp) == RETURN_EXPR)
     {
-      for (ii_lvar = 0; ii_lvar &amp;lt; elem_fn_values-&amp;gt;no_lvars; ii_lvar++)
+      return_var = (tree) data;
+      ret_expr = TREE_OPERAND (TREE_OPERAND (*tp, 0), 1);
+      mod_expr = build2 (MODIFY_EXPR, TREE_TYPE (return_var), return_var,
+ ret_expr);
+      *tp = mod_expr;
+      *walk_subtrees = 0;
+    }
+  return NULL_TREE;
+}
+
+
+/* This function will create a vector access as a array access */
+static tree
+elem_fn_build_array (tree base_var, tree index)
+{
+  return build_array_ref (UNKNOWN_LOCATION, base_var, index);
+}
+
+/* this function wil replace all vector references with array references. */
+static tree
+replace_array_ref_for_vec (tree *tp, int *walk_subtrees, void *data)
+{
+  tree ii_var;
+  fn_vect_elements *func_data;
+  if (!*tp)
+    return NULL_TREE;
+
+  if (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == PARM_DECL)
+    {
+      func_data = (fn_vect_elements *) data;
+      gcc_assert (func_data-&amp;gt;induction_var);
+      for (ii_var = func_data-&amp;gt;arguments; ii_var; ii_var = DECL_CHAIN (ii_var))
 {
-  if (elem_fn_values-&amp;gt;linear_location[ii_lvar] == arg_number)
+  if (DECL_NAME (ii_var) == DECL_NAME (*tp))
     {
-      strcat (suffix, "_l");
-      sprintf(tmp_str, "%d", elem_fn_values-&amp;gt;linear_steps[ii_lvar]);
-      strcat (suffix, tmp_str);
+      *tp =  elem_fn_build_array (*tp, func_data-&amp;gt;induction_var);
+      *walk_subtrees = 0;
+      return NULL_TREE;
     }
 }
-      for (ii_uvar = 0; ii_uvar &amp;lt; elem_fn_values-&amp;gt;no_uvars; ii_uvar++)
+      if (func_data-&amp;gt;return_var &amp;amp;&amp;amp;
+  (DECL_NAME (*tp) == DECL_NAME (func_data-&amp;gt;return_var)))
 {
-  if (elem_fn_values-&amp;gt;uniform_location[ii_uvar] == arg_number)
-    strcat (suffix, "_s1");
+  *tp = elem_fn_build_array (*tp, func_data-&amp;gt;induction_var);
+  *walk_subtrees = 0;
 }
-      for (ii_pvar = 0; ii_pvar &amp;lt; elem_fn_values-&amp;gt;no_pvars; ii_pvar++)
-{
-  if (elem_fn_values-&amp;gt;private_location[ii_pvar] == arg_number)
-    strcat (suffix, "_v1");
-}
-    } 
-  return suffix;
+    }
+  return NULL_TREE;
 }
 
-tree
-find_elem_fn_name (tree old_fndecl,
-   tree vectype_out ATTRIBUTE_UNUSED,
-   tree vectype_in ATTRIBUTE_UNUSED)
+/* this function will move return values to the end of the function */
+static void
+fix_elem_fn_return_value (tree fndecl, tree induction_var)
 {
-  elem_fn_info *elem_fn_values = NULL;
-  tree new_fndecl = NULL_TREE, arg_type = NULL_TREE;
-  char *suffix = NULL;
+  fn_vect_elements data;
+  tree old_fndecl;
+  tree new_var, new_var_init,  new_body = NULL_TREE;
+  tree ret_expr, ret_stmt = NULL_TREE;
+  if (!fndecl || !DECL_SAVED_TREE (fndecl))
+    return;
+
+  if (TREE_TYPE (DECL_RESULT (fndecl)) == void_type_node)
+    return;
+
+  old_fndecl = current_function_decl;
+  push_cfun (DECL_STRUCT_FUNCTION (fndecl));
+  current_function_decl = fndecl;
   
-  elem_fn_values = extract_elem_fn_values (old_fndecl);
- 
-  if (elem_fn_values)
+  new_var = create_tmp_var (TREE_TYPE (DECL_RESULT (fndecl)), "elem_fn_ret");
+  new_var_init =
+    build_vector_from_val
+    (TREE_TYPE (DECL_RESULT (fndecl)),
+     build_zero_cst (TREE_TYPE (TREE_TYPE (DECL_RESULT (fndecl)))));
+  DECL_INITIAL (new_var) = new_var_init;
+  walk_tree (&amp;amp;DECL_SAVED_TREE (fndecl), replace_return_with_new_var,
+     (void *)new_var, NULL);
+  data.return_var = new_var;
+  data.arguments = DECL_ARGUMENTS (fndecl);
+  data.induction_var = induction_var;
+
+  walk_tree (&amp;amp;DECL_SAVED_TREE (fndecl), replace_array_ref_for_vec,
+     (void *) &amp;amp;data, NULL);
+  ret_expr = build2 (MODIFY_EXPR, TREE_TYPE (new_var),
+     DECL_RESULT (fndecl), new_var);
+  
+  ret_stmt = build1 (RETURN_EXPR, TREE_TYPE (ret_expr), ret_expr);
+  if (TREE_CODE (DECL_SAVED_TREE (fndecl)) == BIND_EXPR)
     {
-      if (elem_fn_values-&amp;gt;no_vlengths &amp;gt; 0)
+      
+      if (!BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl)))
+        ;
+      else if (TREE_CODE (BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl))) !=
+       TREE_LIST)
 {
-  if (elem_fn_values-&amp;gt;vectorlength[0] ==
-      (int)TYPE_VECTOR_SUBPARTS (vectype_out))
-    suffix = find_suffix (elem_fn_values, false);
-  else
-    return NULL_TREE;
+  append_to_statement_list_force
+    (BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl)), &amp;amp;new_body);
+  append_to_statement_list_force (ret_stmt, &amp;amp;new_body);
 }
       else
-return NULL_TREE;
+{
+  new_body = BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl));
+  append_to_statement_list_force (ret_stmt, &amp;amp;new_body);
+}
+      BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl)) = new_body;
     }
-  else
+
+  pop_cfun ();
+  current_function_decl = old_fndecl;
+  return;
+}
+
+/* this function will break a vector value to scalar with a for loop in front */
+static tree
+add_elem_fn_loop (tree fndecl, int vlength)
+{
+  tree exit_label = NULL_TREE, if_label = NULL_TREE, body_label = NULL_TREE;
+  tree fn_body, loop = NULL_TREE, loop_var, mod_var, incr_expr, cond_expr;
+  tree cmp_expr, old_fndecl;
+  
+  if (!fndecl)
+    return NULL_TREE; 
+
+  if (!DECL_SAVED_TREE (fndecl))
     return NULL_TREE;
 
-  new_fndecl = copy_node (rename_elem_fn (old_fndecl, suffix));
-  TREE_TYPE (new_fndecl) = copy_node (TREE_TYPE (old_fndecl));
+  old_fndecl = current_function_decl;
+  push_cfun (DECL_STRUCT_FUNCTION (fndecl));
+  current_function_decl = fndecl;
+  
+  if (TREE_CODE (DECL_SAVED_TREE (fndecl)) == BIND_EXPR)
+    fn_body = BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl));
+  else
+    fn_body = DECL_SAVED_TREE (fndecl);
 
-  TYPE_ARG_TYPES (TREE_TYPE (new_fndecl)) =
-    copy_list (TYPE_ARG_TYPES (TREE_TYPE (new_fndecl)));
+  loop = alloc_stmt_list ();
   
-  for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (new_fndecl));
-       arg_type &amp;amp;&amp;amp; arg_type != void_type_node;
-       arg_type = TREE_CHAIN (arg_type))
-    TREE_VALUE (arg_type) = vectype_out;
+  loop_var = create_tmp_var (integer_type_node, "ii_elem_fn_vec_val");
+  mod_var = build2 (MODIFY_EXPR, void_type_node, loop_var,
+    build_int_cst (integer_type_node, 0));
+  append_to_statement_list_force (mod_var, &amp;amp;loop);
   
-  if (TREE_TYPE (TREE_TYPE (new_fndecl)) != void_type_node)
-    {
-      TREE_TYPE (TREE_TYPE (new_fndecl)) =
-copy_node (TREE_TYPE (TREE_TYPE (new_fndecl)));
-      TREE_TYPE (TREE_TYPE (new_fndecl)) = vectype_out;
-      DECL_MODE (new_fndecl) = TYPE_MODE (vectype_out);
-    }
+  if_label = build_decl (UNKNOWN_LOCATION, LABEL_DECL,
+ get_identifier ("if_lab"), void_type_node);
+  DECL_CONTEXT (if_label) = fndecl;
+  DECL_ARTIFICIAL (if_label) = 0;
+  DECL_IGNORED_P (if_label) = 1;
+
+  exit_label = build_decl (UNKNOWN_LOCATION, LABEL_DECL,
+   get_identifier ("exit_label"), void_type_node);
+  DECL_CONTEXT (exit_label) = fndecl;
+  DECL_ARTIFICIAL (exit_label) = 0;
+  DECL_IGNORED_P (exit_label) = 1;
+
+  body_label = build_decl (UNKNOWN_LOCATION, LABEL_DECL,
+   get_identifier ("body_label"), void_type_node);
+  DECL_CONTEXT (body_label) = fndecl;
+  DECL_ARTIFICIAL (body_label) = 0;
+  DECL_IGNORED_P (body_label) = 1;
+  append_to_statement_list_force (build1 (LABEL_EXPR, void_type_node,
+  if_label), &amp;amp;loop);
+  cmp_expr = build2 (LT_EXPR, boolean_type_node, loop_var,
+     build_int_cst (integer_type_node, vlength));
+  cond_expr = build3 (COND_EXPR, void_type_node, cmp_expr,
+      build1 (GOTO_EXPR, void_type_node, body_label),
+      build1 (GOTO_EXPR, void_type_node, exit_label));
+
+  append_to_statement_list_force (cond_expr, &amp;amp;loop);
+  append_to_statement_list_force (build1 (LABEL_EXPR, void_type_node,
+  body_label), &amp;amp;loop);
+  append_to_statement_list_force (fn_body, &amp;amp;loop);
+
+  incr_expr = build2 (MODIFY_EXPR, void_type_node, loop_var,
+      build2 (PLUS_EXPR, TREE_TYPE (loop_var), loop_var,
+      build_int_cst (integer_type_node, 1)));
+
+  append_to_statement_list_force (incr_expr, &amp;amp;loop);
+  append_to_statement_list_force (build1 (GOTO_EXPR, void_type_node, if_label),
+  &amp;amp;loop);
+  append_to_statement_list_force (build1 (LABEL_EXPR, void_type_node,
+  exit_label), &amp;amp;loop);
   
-  return new_fndecl;
+  if (TREE_CODE (DECL_SAVED_TREE (fndecl)) == BIND_EXPR)
+    BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl)) = loop;
+  else
+    DECL_SAVED_TREE (fndecl) = loop;
+
+  pop_cfun ();
+  current_function_decl = old_fndecl;
+  
+  return loop_var;
 }
 
-/* this function wil create the elemental vector function node */
-static struct cgraph_node *
-create_elem_fn_nodes (struct cgraph_node *node)
+/* this function will add the mask if statement for masked clone */
+static void
+add_elem_fn_mask (tree fndecl)
 {
-  tree new_decl, old_decl, new_decl_name, opt_attr;
-  tree proc_attr, opp_proc_attr = NULL_TREE;
-  struct cgraph_node *new_node;
-  elem_fn_info *elem_fn_values = NULL;
-  char *suffix = NULL;
-  
-  old_decl = node-&amp;gt;symbol.decl;
-  new_decl = copy_node (old_decl);
-  TREE_TYPE (new_decl) = copy_node (TREE_TYPE (old_decl));
-  elem_fn_values = extract_elem_fn_values (old_decl);
+  tree ii_arg;
+  tree cond_expr, cmp_expr, old_fndecl;
+  tree fn_body = NULL_TREE;
 
-  if (elem_fn_values)
+  old_fndecl = current_function_decl;
+  push_cfun (DECL_STRUCT_FUNCTION (fndecl));
+  current_function_decl = fndecl;
+  
+  if (!DECL_SAVED_TREE (fndecl))
+    return;
+  
+  for (ii_arg = DECL_ARGUMENTS (fndecl); DECL_CHAIN (ii_arg);
+       ii_arg = DECL_CHAIN (ii_arg))
     {
-      suffix = find_suffix (elem_fn_values, false);
+      ;
     }
+  if (TREE_CODE (DECL_SAVED_TREE (fndecl)) == BIND_EXPR)
+    fn_body = BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl));
   else
-    return NULL;
-  
-  new_decl_name = rename_elem_fn (new_decl, suffix);
+    fn_body = DECL_SAVED_TREE (fndecl); /* not sure if we ever get here */
 
-  SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME(new_decl_name));
-  SET_DECL_RTL (new_decl, NULL);
-  TREE_SYMBOL_REFERENCED (DECL_NAME (new_decl_name)) = 1;
-  
-  new_node = cgraph_copy_node_for_versioning (node, new_decl, NULL, NULL);
-  new_node-&amp;gt;symbol.externally_visible = node-&amp;gt;symbol.externally_visible;
-  new_node-&amp;gt;lowered = true;
+  gcc_assert (DECL_NAME (ii_arg) == get_identifier ("__elem_fn_mask"));
 
-  tree_elem_fn_versioning (old_decl, new_decl, NULL, false, NULL, false, NULL,
-   NULL, elem_fn_values-&amp;gt;vectorlength[0]);
-  cgraph_call_function_insertion_hooks (new_node);
-  DECL_STRUCT_FUNCTION (new_decl)-&amp;gt;elem_fn_already_cloned = true;
-  DECL_STRUCT_FUNCTION (new_decl)-&amp;gt;curr_properties = cfun-&amp;gt;curr_properties;
-  DECL_ATTRIBUTES (cfun-&amp;gt;decl) =
-    remove_attribute ("vector", DECL_ATTRIBUTES (cfun-&amp;gt;decl));
-  DECL_ATTRIBUTES (new_node-&amp;gt;symbol.decl) =
-    remove_attribute ("vector", DECL_ATTRIBUTES (new_node-&amp;gt;symbol.decl));
+  cmp_expr = fold_build2 (NE_EXPR, TREE_TYPE (ii_arg), ii_arg,
+  build_int_cst (TREE_TYPE (TREE_TYPE (ii_arg)), 0));
+  cond_expr = fold_build3 (COND_EXPR, void_type_node, cmp_expr, fn_body,
+   build_empty_stmt (UNKNOWN_LOCATION));
 
-  proc_attr = create_processor_attribute (elem_fn_values, &amp;amp;opp_proc_attr);
+  if (TREE_CODE (DECL_SAVED_TREE (fndecl)) == BIND_EXPR)
+    BIND_EXPR_BODY (DECL_SAVED_TREE (fndecl)) = cond_expr;
+  else
+    DECL_SAVED_TREE (fndecl) = cond_expr;
+
+  pop_cfun ();
+  current_function_decl = old_fndecl;
   
-  if (proc_attr)
-    decl_attributes (&amp;amp;new_node-&amp;gt;symbol.decl, proc_attr, 0);
-  if (opp_proc_attr)
-    decl_attributes (&amp;amp;cfun-&amp;gt;decl, opp_proc_attr, 0);
+  return;
+ 
+}
 
-  opt_attr = create_optimize_attribute (3); /* this will turn vectorizer on */
-  if (opt_attr)
-    decl_attributes (&amp;amp;new_node-&amp;gt;symbol.decl, opt_attr, 0);
+/* this function will do hacks necessary to recognize the cloned function */
+static void
+cg_hacks (tree fndecl)
+{
+  const tree outer = current_function_decl;
+  struct function *f = DECL_STRUCT_FUNCTION (fndecl);
+
+  f-&amp;gt;curr_properties = cfun-&amp;gt;curr_properties;
+  push_cfun (f);
+  current_function_decl = fndecl;
   
-  return new_node;
+  cgraph_add_new_function (fndecl, false);
+  cgraph_finalize_function (fndecl, true);
+
+  pop_cfun ();
+  current_function_decl = outer;
+
+  return;
 }
 
-/* This function will extact the vector attribute and store the data in the
- * elem_fn_info structure.
- */
-static elem_fn_info *
-extract_elem_fn_values (tree decl)
+/* this function will create clones for function marked with vector attribute */
+void
+elem_fn_create_fn (tree fndecl)
 {
+  tree new_masked_fn = NULL_TREE, new_unmasked_fn = NULL_TREE;
+  tree induction_var = NULL_TREE;
   elem_fn_info *elem_fn_values = NULL;
-  int x = 0; /* this is a dummy variable */
-  int arg_number = 0, ii = 0;
-  tree ii_tree, jj_tree, kk_tree;
-  tree decl_attr = DECL_ATTRIBUTES (decl);
-  
-  if (!decl_attr)
-    return NULL;
+  char *masked_suffix = NULL, *unmasked_suffix = NULL;
+  tree proc_attr = NULL_TREE, opp_proc_attr = NULL_TREE, opt_attr = NULL_TREE;
+  if (!fndecl)
+    return;
 
-  elem_fn_values = (elem_fn_info *)xmalloc (sizeof (elem_fn_info));
-  gcc_assert (elem_fn_values);
+  elem_fn_values = extract_elem_fn_values (fndecl);
 
-  elem_fn_values-&amp;gt;proc_type = NULL;
-  elem_fn_values-&amp;gt;mask = USE_BOTH;
-  elem_fn_values-&amp;gt;no_vlengths = 0;
-  elem_fn_values-&amp;gt;no_uvars = 0;
-  elem_fn_values-&amp;gt;no_lvars = 0;
-  
+  if (!elem_fn_values)
+    return;
 
-  for (ii_tree = decl_attr; ii_tree; ii_tree = TREE_CHAIN (ii_tree))
+  if (elem_fn_values-&amp;gt;mask == USE_MASK)
+    masked_suffix = find_suffix (elem_fn_values, true);
+  else if (elem_fn_values-&amp;gt;mask == USE_NOMASK)
+    unmasked_suffix = find_suffix (elem_fn_values, false);
+  else
     {
-      tree ii_purpose = TREE_PURPOSE (ii_tree);
-      tree ii_value = TREE_VALUE (ii_tree);
-      if (TREE_CODE (ii_purpose) == IDENTIFIER_NODE
-  &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (ii_purpose), "vector"))
-{
-  for (jj_tree = ii_value; jj_tree;
-       jj_tree = TREE_CHAIN (jj_tree))
-    {
-      tree jj_value = TREE_VALUE (jj_tree);
-      tree jj_purpose = TREE_PURPOSE (jj_value);
-      if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
-  &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "processor"))
-{
-  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
-       kk_tree = TREE_CHAIN (kk_tree))
-    {
-      tree kk_value = TREE_VALUE (kk_tree);
-      if (TREE_CODE (kk_value) == STRING_CST)
-elem_fn_values-&amp;gt;proc_type =
-  xstrdup (TREE_STRING_POINTER (kk_value));
-    }
-}
-      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
-       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose),
-  "vectorlength"))
-{
-  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
-       kk_tree = TREE_CHAIN (kk_tree))
-    {
-      tree kk_value = TREE_VALUE (kk_tree);
-      if (TREE_CODE (kk_value) == INTEGER_CST)
-{
-  x = elem_fn_values-&amp;gt;no_vlengths;
-  elem_fn_values-&amp;gt;vectorlength[x] =
-    (int) TREE_INT_CST_LOW (kk_value);
-  elem_fn_values-&amp;gt;no_vlengths++;
-}
-    }
-}
-      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
-       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "uniform"))
-{
-  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
-       kk_tree = TREE_CHAIN (kk_tree))
-    {
-      tree kk_value = TREE_VALUE (kk_tree);
-      elem_fn_values-&amp;gt;uniform_vars[elem_fn_values-&amp;gt;no_uvars] =
-xstrdup (TREE_STRING_POINTER (kk_value));
-      elem_fn_values-&amp;gt;no_uvars++;
-    }
-}
-      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
-       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "linear"))
-{
-  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
-       kk_tree = TREE_CHAIN (kk_tree))
-    {
-      tree kk_value = TREE_VALUE (kk_tree);
-      elem_fn_values-&amp;gt;linear_vars[elem_fn_values-&amp;gt;no_lvars] =
-xstrdup (TREE_STRING_POINTER (kk_value));
-      kk_tree = TREE_CHAIN (kk_tree);
-      kk_value = TREE_VALUE (kk_tree);
-      elem_fn_values-&amp;gt;linear_steps[elem_fn_values-&amp;gt;no_lvars] =
-TREE_INT_CST_LOW (kk_value);
-      elem_fn_values-&amp;gt;no_lvars++;
-    }
-}
-      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
-       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "mask"))
-elem_fn_values-&amp;gt;mask = USE_MASK;
-      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
-       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "nomask"))
-elem_fn_values-&amp;gt;mask = USE_NOMASK;
-    }
-}
+      masked_suffix   = find_suffix (elem_fn_values, true);
+      unmasked_suffix = find_suffix (elem_fn_values, false);
     }
 
-  for (ii_tree = DECL_ARGUMENTS (decl); ii_tree; ii_tree = DECL_CHAIN (ii_tree))
+  if (masked_suffix)
     {
-      arg_number++;
-      bool already_found = false;
-      for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_uvars; ii++)
-{
-  if (DECL_NAME (ii_tree)
-      &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (DECL_NAME (ii_tree)),
-  elem_fn_values-&amp;gt;uniform_vars[ii]))
-    {
-      already_found = true;
-      elem_fn_values-&amp;gt;uniform_location[ii] = arg_number;
-    }
-}
-      for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_lvars; ii++)
-{
-  if (DECL_NAME (ii_tree)
-      &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (DECL_NAME (ii_tree)),
-  elem_fn_values-&amp;gt;linear_vars[ii]))
-    {
-      if (already_found)
-  fatal_error
-    ("variable %s defined in both uniform and linear clause",
-     elem_fn_values-&amp;gt;linear_vars[ii]);
-      else
-{
-  already_found = true;
-  elem_fn_values-&amp;gt;linear_location[ii] = arg_number;
-}
-    }
-}
-      if (!already_found) /* this means this variable is a private */
-elem_fn_values-&amp;gt;private_location[elem_fn_values-&amp;gt;no_pvars++] =
-  arg_number;
-    }
+      new_masked_fn = copy_node (fndecl);
+      new_masked_fn = rename_elem_fn (new_masked_fn, masked_suffix);
+      SET_DECL_RTL (new_masked_fn, NULL);
+      TREE_SYMBOL_REFERENCED (DECL_NAME (new_masked_fn)) = 1;
+      tree_elem_fn_versioning (fndecl, new_masked_fn, NULL, false, NULL, false,
+       NULL, NULL, elem_fn_values-&amp;gt;vectorlength[0],
+       true);
+      proc_attr = create_processor_attribute (elem_fn_values, &amp;amp;opp_proc_attr);
+      if (proc_attr)
+decl_attributes (&amp;amp;new_masked_fn, proc_attr, 0);
+      if (opp_proc_attr)
+decl_attributes (&amp;amp;fndecl, opp_proc_attr, 0);
+      
+      opt_attr = create_optimize_attribute (3); /* will turn vectorizer on */
+      if (opt_attr)
+decl_attributes (&amp;amp;new_masked_fn, opt_attr, 0);
 
-  elem_fn_values-&amp;gt;total_no_args = arg_number;
-  
-  return elem_fn_values;
-}  
-
-/* Entry point function for creating the vector elemental function */
-static unsigned int
-create_elem_vec_fn (void)
-{
-  struct cgraph_node *ii_node, *copied_node;
-  
-  FOR_EACH_DEFINED_FUNCTION (ii_node)
-    {
-      tree node_decl = ii_node-&amp;gt;symbol.decl;
-      if (is_elem_fn (node_decl)
-  &amp;amp;&amp;amp; DECL_STRUCT_FUNCTION (node_decl) 
-  &amp;amp;&amp;amp; !DECL_STRUCT_FUNCTION (node_decl)-&amp;gt;elem_fn_already_cloned)
-{
-         copied_node = create_elem_fn_nodes (ii_node);
-  if (DECL_RTL (ii_node-&amp;gt;symbol.decl))
-    {
-      SET_DECL_RTL (copied_node-&amp;gt;symbol.decl,
-    copy_rtx (DECL_RTL (ii_node-&amp;gt;symbol.decl)));
-      XEXP (DECL_RTL (copied_node-&amp;gt;symbol.decl), 0) =
-gen_rtx_SYMBOL_REF
-(GET_MODE (XEXP (DECL_RTL (ii_node-&amp;gt;symbol.decl), 0)),
- IDENTIFIER_POINTER (DECL_NAME (copied_node-&amp;gt;symbol.decl)));
-    }
-  
-}
+      DECL_ATTRIBUTES (new_masked_fn) =
+remove_attribute ("vector", DECL_ATTRIBUTES (new_masked_fn));
+
+      add_elem_fn_mask (new_masked_fn);
+      induction_var = add_elem_fn_loop (new_masked_fn,
+elem_fn_values-&amp;gt;vectorlength[0]);
+      fix_elem_fn_return_value (new_masked_fn, induction_var);
+      cg_hacks (new_masked_fn);
+      SET_DECL_ASSEMBLER_NAME (new_masked_fn, DECL_NAME (new_masked_fn));
+      if (DECL_STRUCT_FUNCTION (new_masked_fn))
+DECL_STRUCT_FUNCTION (new_masked_fn)-&amp;gt;elem_fn_already_cloned = true;
     }
-  return 0;
-}
- 
-
-struct gimple_opt_pass pass_elem_fn =
-  {
+  if (unmasked_suffix)
     {
-      GIMPLE_PASS,
-      "tree_elem_fn",/* name */
-      0,/* gate */
-      create_elem_vec_fn,/* execute */
-      NULL,/* sub */
-      NULL,/* next */
-      0,/* static_pass_number */
-      TV_NONE,/* tv_id */
-      PROP_gimple_any| PROP_cfg, /* properties_required */
-      0,/* properties_provided */
-      0,/* properties_destroyed */
-      0,/* todo_flags_start */
-      TODO_verify_flow,/* todo_flags_finish */
+      new_unmasked_fn = copy_node (fndecl);
+      new_unmasked_fn = rename_elem_fn (new_unmasked_fn, unmasked_suffix);
+      SET_DECL_RTL (new_unmasked_fn, NULL);
+      TREE_SYMBOL_REFERENCED (DECL_NAME (new_unmasked_fn)) = 1;
+      tree_elem_fn_versioning (fndecl, new_unmasked_fn, NULL, false, NULL,
+       false, NULL, NULL,
+       elem_fn_values-&amp;gt;vectorlength[0], false);
+      proc_attr = create_processor_attribute (elem_fn_values, &amp;amp;opp_proc_attr);
+      if (proc_attr)
+decl_attributes (&amp;amp;new_unmasked_fn, proc_attr, 0);
+      if (opp_proc_attr)
+decl_attributes (&amp;amp;fndecl, opp_proc_attr, 0);
+      
+      opt_attr = create_optimize_attribute (3); /* will turn vectorizer on */
+      if (opt_attr)
+decl_attributes (&amp;amp;new_unmasked_fn, opt_attr, 0);
+
+      DECL_ATTRIBUTES (new_unmasked_fn) =
+remove_attribute ("vector", DECL_ATTRIBUTES (new_unmasked_fn));
+      induction_var = add_elem_fn_loop (new_unmasked_fn,
+elem_fn_values-&amp;gt;vectorlength[0]);
+      fix_elem_fn_return_value (new_unmasked_fn, induction_var);
+      cg_hacks (new_unmasked_fn);
+      SET_DECL_ASSEMBLER_NAME (new_unmasked_fn, DECL_NAME (new_unmasked_fn));
+      if (DECL_STRUCT_FUNCTION (new_unmasked_fn))
+DECL_STRUCT_FUNCTION (new_unmasked_fn)-&amp;gt;elem_fn_already_cloned = true;
     }
-  };
+  DECL_ATTRIBUTES (fndecl) = remove_attribute ("vector",
+       DECL_ATTRIBUTES (fndecl));
+  free (elem_fn_values);
+  return;
+}
Index: elem-function-common.c
===================================================================
--- elem-function-common.c(revision 0)
+++ elem-function-common.c(revision 0)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,461 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+/* This file is part of the Intel(R) Cilk(TM) Plus support
+   This file contains the language independent functions for
+   Elemental functions.
+   
+   Copyright (C) 2012  Free Software Foundation, Inc.
+   Written by Balaji V. Iyer &amp;lt;balaji.v.iyer&amp;lt; at &amp;gt;intel.com&amp;gt;,
+              Intel Corporation
+
+   Many Thanks to Karthik Kumar for advice on the basic technique
+   about cloning functions.
+   
+   This file is part of GCC.
+
+   GCC 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, or (at your option)
+   any later version.
+
+   GCC 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
+   &amp;lt;http://www.gnu.org/licenses/&amp;gt;.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "langhooks.h"
+#include "cilk.h"
+#include "tm_p.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "output.h"
+#include "c-family/c-common.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "tree-dump.h"
+#include "tree-pass.h"
+#include "timevar.h"
+#include "flags.h"
+#include "c-tree.h"
+#include "tree-inline.h"
+#include "cgraph.h"
+#include "ipa-prop.h"
+#include "opts.h"
+#include "tree-iterator.h"
+#include "toplev.h"
+#include "options.h"
+#include "intl.h"
+#include "vec.h"
+#include "cilk.h"
+
+#define MAX_VARS 50
+
+enum elem_fn_parm_type find_elem_fn_parm_type (gimple, tree, tree *);
+bool is_elem_fn (tree);
+tree find_elem_fn_name (tree old_fndecl, tree vectype_out, tree vectype_in);
+elem_fn_info *extract_elem_fn_values (tree decl);
+
+/* This function will find the appropriate processor code in the function
+ * mangling vector function
+ */
+char *
+find_processor_code (elem_fn_info *elem_fn_values)
+{
+  if (!elem_fn_values || !elem_fn_values-&amp;gt;proc_type)
+    return xstrdup ("B");
+
+  if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium_4"))
+    return xstrdup ("B");
+  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium4_sse3"))
+    return xstrdup ("D");
+  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_ssse3"))
+    return xstrdup ("E");
+  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_sse_4_1"))
+    return xstrdup ("F");
+  else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core_i7_sse4_2"))
+    return xstrdup ("H");
+  else
+    gcc_unreachable ();
+
+  return NULL; /* should never get here */
+}
+
+/* this function will return vectorlength, if specified, in string format -OR-
+ * it will give the default vector length for the specified architecture. */
+char *
+find_vlength_code (elem_fn_info *elem_fn_values)
+{
+  char *vlength_code = (char *) xmalloc (sizeof (char) * 10);
+  if (!elem_fn_values)
+    { 
+      sprintf (vlength_code, "4");
+      return vlength_code;
+    }
+
+  memset (vlength_code, 10, 0);
+  
+  if (elem_fn_values-&amp;gt;no_vlengths != 0)
+    sprintf(vlength_code,"%d", elem_fn_values-&amp;gt;vectorlength[0]);
+  else
+    {
+      if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium_4"))
+sprintf (vlength_code,"4");
+      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "pentium4_sse3"))
+sprintf (vlength_code, "4");
+      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_ssse3"))
+sprintf (vlength_code, "4");
+      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core2_duo_sse_4_1"))
+sprintf (vlength_code, "4");
+      else if (!strcmp (elem_fn_values-&amp;gt;proc_type, "core_i7_sse4_2"))
+sprintf (vlength_code, "4");
+      else
+gcc_unreachable ();
+    }
+  return vlength_code;
+}
+
+
+/* this function will concatinate the suffix to the existing function decl */
+tree
+rename_elem_fn (tree decl, const char *suffix)
+{
+  int length = 0;
+  const char *fn_name = IDENTIFIER_POINTER (DECL_NAME (decl));
+  char *new_fn_name;
+  tree new_decl = NULL_TREE;
+  
+  if (!suffix || !fn_name)
+    return decl;
+  else
+    new_decl = decl;
+
+  length = strlen (fn_name) + strlen (suffix) + 1;
+  new_fn_name = (char *)xmalloc (length);
+  strcpy (new_fn_name, fn_name);
+  strcat (new_fn_name, suffix);
+
+  DECL_NAME (new_decl) = get_identifier (new_fn_name);
+  return new_decl;
+}
+
+
+/* this function will find the appropriate mangling suffix for the vector
+ * function */
+char *
+find_suffix (elem_fn_info *elem_fn_values, bool masked)
+{
+  char *suffix = (char*)xmalloc (100);
+  char tmp_str[10];
+  int arg_number, ii_pvar, ii_uvar, ii_lvar;
+  strcpy (suffix, "._simdsimd_");
+  strcat (suffix, find_processor_code (elem_fn_values));
+  strcat (suffix, find_vlength_code (elem_fn_values));
+
+  if (masked)
+    strcat (suffix, "m");
+  else
+    strcat (suffix, "n");
+
+  for (arg_number = 1; arg_number &amp;lt;= elem_fn_values-&amp;gt;total_no_args;
+       arg_number++)
+    {
+      for (ii_lvar = 0; ii_lvar &amp;lt; elem_fn_values-&amp;gt;no_lvars; ii_lvar++)
+{
+  if (elem_fn_values-&amp;gt;linear_location[ii_lvar] == arg_number)
+    {
+      strcat (suffix, "_l");
+      sprintf(tmp_str, "%d", elem_fn_values-&amp;gt;linear_steps[ii_lvar]);
+      strcat (suffix, tmp_str);
+    }
+}
+      for (ii_uvar = 0; ii_uvar &amp;lt; elem_fn_values-&amp;gt;no_uvars; ii_uvar++)
+{
+  if (elem_fn_values-&amp;gt;uniform_location[ii_uvar] == arg_number)
+    strcat (suffix, "_s1");
+}
+      for (ii_pvar = 0; ii_pvar &amp;lt; elem_fn_values-&amp;gt;no_pvars; ii_pvar++)
+{
+  if (elem_fn_values-&amp;gt;private_location[ii_pvar] == arg_number)
+    strcat (suffix, "_v1");
+}
+    } 
+  return suffix;
+}
+
+
+/* this is an helper function for find_elem_fn_param_type */
+static enum elem_fn_parm_type
+find_elem_fn_parm_type_1 (tree fndecl, int parm_no, tree *step_size)
+{
+  int ii = 0;
+  elem_fn_info *elem_fn_values;
+
+  elem_fn_values = extract_elem_fn_values (fndecl);
+  if (!elem_fn_values)
+    return TYPE_NONE;
+
+  for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_lvars; ii++)
+    if (elem_fn_values-&amp;gt;linear_location[ii] == parm_no)
+      {
+if (step_size != NULL)
+  *step_size = build_int_cst (integer_type_node,
+      elem_fn_values-&amp;gt;linear_steps[ii]);
+return TYPE_LINEAR;
+      }
+    
+  for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_uvars; ii++)
+    if (elem_fn_values-&amp;gt;uniform_location[ii] == parm_no)
+      return TYPE_UNIFORM;
+    
+  return TYPE_NONE;
+}
+  
+  
+/* this function will return the type of a parameter in elemental function.
+   The choices are UNIFORM or LINEAR. */
+enum elem_fn_parm_type
+find_elem_fn_parm_type (gimple stmt, tree op, tree *step_size)
+{
+  tree fndecl, parm = NULL_TREE;
+  int ii, nargs;
+  enum elem_fn_parm_type return_type = TYPE_NONE;
+  
+  if (gimple_code (stmt) != GIMPLE_CALL)
+    return TYPE_NONE;
+
+  fndecl = gimple_call_fndecl (stmt);
+  gcc_assert (fndecl);
+
+  nargs = gimple_call_num_args (stmt);
+
+  for (ii = 0; ii &amp;lt; nargs; ii++)
+    {
+      parm = gimple_call_arg (stmt, ii);
+      if (op == parm)
+{
+  return_type = find_elem_fn_parm_type_1 (fndecl, ii, step_size);
+  return return_type;
+}
+    }
+  return return_type;
+}
+/* this function will return the appropriate cloned named for the function */
+tree
+find_elem_fn_name (tree old_fndecl, tree vectype_out, 
+   tree vectype_in ATTRIBUTE_UNUSED)
+{
+  elem_fn_info *elem_fn_values = NULL;
+  tree new_fndecl = NULL_TREE, arg_type = NULL_TREE;
+  char *suffix = NULL;
+  
+  elem_fn_values = extract_elem_fn_values (old_fndecl);
+ 
+  if (elem_fn_values)
+    {
+      if (elem_fn_values-&amp;gt;no_vlengths &amp;gt; 0)
+{
+  if (elem_fn_values-&amp;gt;vectorlength[0] ==
+      (int)TYPE_VECTOR_SUBPARTS (vectype_out))
+    suffix = find_suffix (elem_fn_values, false);
+  else
+    return NULL_TREE;
+}
+      else
+return NULL_TREE;
+    }
+  else
+    return NULL_TREE;
+
+  new_fndecl = copy_node (rename_elem_fn (old_fndecl, suffix));
+  TREE_TYPE (new_fndecl) = copy_node (TREE_TYPE (old_fndecl));
+
+  TYPE_ARG_TYPES (TREE_TYPE (new_fndecl)) =
+    copy_list (TYPE_ARG_TYPES (TREE_TYPE (new_fndecl)));
+  
+  for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (new_fndecl));
+       arg_type &amp;amp;&amp;amp; arg_type != void_type_node;
+       arg_type = TREE_CHAIN (arg_type))
+    TREE_VALUE (arg_type) = vectype_out;
+  
+  if (TREE_TYPE (TREE_TYPE (new_fndecl)) != void_type_node)
+    {
+      TREE_TYPE (TREE_TYPE (new_fndecl)) =
+copy_node (TREE_TYPE (TREE_TYPE (new_fndecl)));
+      TREE_TYPE (TREE_TYPE (new_fndecl)) = vectype_out;
+      DECL_MODE (new_fndecl) = TYPE_MODE (vectype_out);
+    }
+  
+  return new_fndecl;
+}
+
+/* this function will extract the elem. function values from a vector and store
+ * it in a data structure and return that */
+elem_fn_info *
+extract_elem_fn_values (tree decl)
+{
+  elem_fn_info *elem_fn_values = NULL;
+  int x = 0; /* this is a dummy variable */
+  int arg_number = 0, ii = 0;
+  tree ii_tree, jj_tree, kk_tree;
+  tree decl_attr = DECL_ATTRIBUTES (decl);
+  
+  if (!decl_attr)
+    return NULL;
+
+  elem_fn_values = (elem_fn_info *)xmalloc (sizeof (elem_fn_info));
+  gcc_assert (elem_fn_values);
+
+  elem_fn_values-&amp;gt;proc_type = NULL;
+  elem_fn_values-&amp;gt;mask = USE_BOTH;
+  elem_fn_values-&amp;gt;no_vlengths = 0;
+  elem_fn_values-&amp;gt;no_uvars = 0;
+  elem_fn_values-&amp;gt;no_lvars = 0;
+  
+
+  for (ii_tree = decl_attr; ii_tree; ii_tree = TREE_CHAIN (ii_tree))
+    {
+      tree ii_purpose = TREE_PURPOSE (ii_tree);
+      tree ii_value = TREE_VALUE (ii_tree);
+      if (TREE_CODE (ii_purpose) == IDENTIFIER_NODE
+  &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (ii_purpose), "vector"))
+{
+  for (jj_tree = ii_value; jj_tree;
+       jj_tree = TREE_CHAIN (jj_tree))
+    {
+      tree jj_value = TREE_VALUE (jj_tree);
+      tree jj_purpose = TREE_PURPOSE (jj_value);
+      if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
+  &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "processor"))
+{
+  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
+       kk_tree = TREE_CHAIN (kk_tree))
+    {
+      tree kk_value = TREE_VALUE (kk_tree);
+      if (TREE_CODE (kk_value) == STRING_CST)
+elem_fn_values-&amp;gt;proc_type =
+  xstrdup (TREE_STRING_POINTER (kk_value));
+    }
+}
+      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
+       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose),
+  "vectorlength"))
+{
+  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
+       kk_tree = TREE_CHAIN (kk_tree))
+    {
+      tree kk_value = TREE_VALUE (kk_tree);
+      if (TREE_CODE (kk_value) == INTEGER_CST)
+{
+  x = elem_fn_values-&amp;gt;no_vlengths;
+  elem_fn_values-&amp;gt;vectorlength[x] =
+    (int) TREE_INT_CST_LOW (kk_value);
+  elem_fn_values-&amp;gt;no_vlengths++;
+}
+    }
+}
+      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
+       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "uniform"))
+{
+  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
+       kk_tree = TREE_CHAIN (kk_tree))
+    {
+      tree kk_value = TREE_VALUE (kk_tree);
+      elem_fn_values-&amp;gt;uniform_vars[elem_fn_values-&amp;gt;no_uvars] =
+xstrdup (TREE_STRING_POINTER (kk_value));
+      elem_fn_values-&amp;gt;no_uvars++;
+    }
+}
+      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
+       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "linear"))
+{
+  for (kk_tree = TREE_VALUE (jj_value); kk_tree;
+       kk_tree = TREE_CHAIN (kk_tree))
+    {
+      tree kk_value = TREE_VALUE (kk_tree);
+      elem_fn_values-&amp;gt;linear_vars[elem_fn_values-&amp;gt;no_lvars] =
+xstrdup (TREE_STRING_POINTER (kk_value));
+      kk_tree = TREE_CHAIN (kk_tree);
+      kk_value = TREE_VALUE (kk_tree);
+      elem_fn_values-&amp;gt;linear_steps[elem_fn_values-&amp;gt;no_lvars] =
+TREE_INT_CST_LOW (kk_value);
+      elem_fn_values-&amp;gt;no_lvars++;
+    }
+}
+      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
+       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "mask"))
+elem_fn_values-&amp;gt;mask = USE_MASK;
+      else if (TREE_CODE (jj_purpose) == IDENTIFIER_NODE
+       &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (jj_purpose), "nomask"))
+elem_fn_values-&amp;gt;mask = USE_NOMASK;
+    }
+}
+    }
+
+  for (ii_tree = DECL_ARGUMENTS (decl); ii_tree;
+       ii_tree = DECL_CHAIN (ii_tree))
+    {
+      arg_number++;
+      bool already_found = false;
+      for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_uvars; ii++)
+{
+  if (DECL_NAME (ii_tree)
+      &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (DECL_NAME (ii_tree)),
+  elem_fn_values-&amp;gt;uniform_vars[ii]))
+    {
+      already_found = true;
+      elem_fn_values-&amp;gt;uniform_location[ii] = arg_number;
+    }
+}
+      for (ii = 0; ii &amp;lt; elem_fn_values-&amp;gt;no_lvars; ii++)
+{
+  if (DECL_NAME (ii_tree)
+      &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (DECL_NAME (ii_tree)),
+  elem_fn_values-&amp;gt;linear_vars[ii]))
+    {
+      if (already_found)
+  fatal_error
+    ("variable %s defined in both uniform and linear clause",
+     elem_fn_values-&amp;gt;linear_vars[ii]);
+      else
+{
+  already_found = true;
+  elem_fn_values-&amp;gt;linear_location[ii] = arg_number;
+}
+    }
+}
+      if (!already_found) /* this means this variable is a private */
+elem_fn_values-&amp;gt;private_location[elem_fn_values-&amp;gt;no_pvars++] =
+  arg_number;
+    }
+
+  elem_fn_values-&amp;gt;total_no_args = arg_number;
+  
+  return elem_fn_values;
+}
+
+/* this function will check to see if the node is part of an function that
+ * needs to be converted to its vector equivalent. */
+bool
+is_elem_fn (tree fndecl)
+{
+  tree ii_tree;
+
+  for (ii_tree = DECL_ATTRIBUTES (fndecl); ii_tree;
+       ii_tree = TREE_CHAIN (ii_tree))
+    {
+      tree ii_value = TREE_PURPOSE (ii_tree);
+      if (TREE_CODE (ii_value) == IDENTIFIER_NODE
+  &amp;amp;&amp;amp; !strcmp (IDENTIFIER_POINTER (ii_value), "vector"))
+return true;
+    }
+
+  /* If we are here, then we didn't find a vector keyword, so it is false */
+  return false;
+}
Index: gimplify.c
===================================================================
--- gimplify.c(revision 187789)
+++ gimplify.c(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -8360,6 +8360,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
   oldfn = current_function_decl;
   current_function_decl = fndecl;
+
+  /* here we check to see if we have a function with the attribute vector
+   * with it. If so, then we must clone it to masked/unmasked when apropriate.
+   */
+  if (flag_enable_cilk &amp;amp;&amp;amp; is_elem_fn (fndecl))
+    elem_fn_create_fn (fndecl);
+  
   if (DECL_STRUCT_FUNCTION (fndecl))
     push_cfun (DECL_STRUCT_FUNCTION (fndecl));
   else
Index: tree-inline.c
===================================================================
--- tree-inline.c(revision 187789)
+++ tree-inline.c(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3806,7 +3806,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 static inline void
 elem_fn_add_local_variables (struct function *callee, struct function *caller,
      copy_body_data *id, bool check_var_ann,
-     int vlength)
+     int vlength ATTRIBUTE_UNUSED)
 {
   tree var;
   unsigned ix;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -3836,9 +3836,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     SET_DECL_DEBUG_EXPR (new_var, tem);
   }
 TREE_TYPE (new_var) = copy_node (TREE_TYPE (new_var));
-TREE_TYPE (new_var) =
-  build_vector_type (copy_node (TREE_TYPE (new_var)), vlength);
-DECL_GIMPLE_REG_P (new_var) = 1;
  add_local_decl (caller, new_var);
       }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -4994,27 +4991,35 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 static tree
 elem_fn_copy_arguments_for_versioning (tree orig_parm, copy_body_data * id,
        bitmap args_to_skip, tree *vars,
-       int vlength)
+       int vlength, bool masked)
 {
   tree arg, *parg;
   tree new_parm = NULL;
   int i = 0;
-
+  tree masked_parm = NULL_TREE;
   parg = &amp;amp;new_parm;
 
+  if (masked)
+    {
+      masked_parm = build_decl (UNKNOWN_LOCATION, PARM_DECL,
+get_identifier ("__elem_fn_mask"),
+build_vector_type (integer_type_node, vlength));
+      DECL_ARG_TYPE (masked_parm) = build_vector_type (integer_type_node,
+       vlength);
+      DECL_ARTIFICIAL (masked_parm) = 1;
+      lang_hooks.dup_lang_specific_decl (masked_parm);
+    }
   for (arg = orig_parm; arg; arg = DECL_CHAIN (arg), i++)
     if (!args_to_skip || !bitmap_bit_p (args_to_skip, i))
       {
         tree new_tree = remap_decl (arg, id);
 if (TREE_CODE (new_tree) != PARM_DECL)
   new_tree = id-&amp;gt;copy_decl (arg, id);
-/* bviyer; I am using a dummy value of 4 to make sure this works */
 TREE_TYPE (new_tree) = copy_node (TREE_TYPE (new_tree));
-TREE_TYPE (new_tree) =
-  build_vector_type (TREE_TYPE (new_tree), vlength);
-DECL_ARG_TYPE (new_tree) =
-  build_vector_type (DECL_ARG_TYPE (new_tree), vlength);
-DECL_GIMPLE_REG_P (new_tree) = 1;
+TREE_TYPE (new_tree) = build_vector_type (TREE_TYPE (new_tree),
+  vlength);
+DECL_ARG_TYPE (new_tree) = build_vector_type (DECL_ARG_TYPE (new_tree),
+      vlength);
         lang_hooks.dup_lang_specific_decl (new_tree);
         *parg = new_tree;
 parg = &amp;amp;DECL_CHAIN (new_tree);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5031,6 +5036,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         DECL_CHAIN (var) = *vars;
         *vars = var;
       }
+  if (masked &amp;amp;&amp;amp; masked_parm)
+    {
+      for (arg = new_parm; DECL_CHAIN (arg); arg = DECL_CHAIN(arg))
+;
+      
+      DECL_CONTEXT (masked_parm) = DECL_CONTEXT (arg);
+      DECL_CHAIN (arg) = masked_parm;
+    }
   return new_parm;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5444,20 +5457,60 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   return;
 }
 
+static void
+initialize_elem_fn_cfun (tree new_fndecl, tree callee_fndecl)
+{
+  struct function *src_cfun = DECL_STRUCT_FUNCTION (callee_fndecl);
+
+  /* Get clean struct function.  */
+  push_struct_function (new_fndecl);
+
+  /* We will rebuild these, so just sanity check that they are empty.  */
+  gcc_assert (VALUE_HISTOGRAMS (cfun) == NULL);
+  gcc_assert (cfun-&amp;gt;local_decls == NULL);
+  gcc_assert (cfun-&amp;gt;cfg == NULL);
+  gcc_assert (cfun-&amp;gt;decl == new_fndecl);
+
+  /* Copy items we preserve during cloning.  */
+  cfun-&amp;gt;static_chain_decl = src_cfun-&amp;gt;static_chain_decl;
+  cfun-&amp;gt;nonlocal_goto_save_area = src_cfun-&amp;gt;nonlocal_goto_save_area;
+  cfun-&amp;gt;function_end_locus = src_cfun-&amp;gt;function_end_locus;
+  cfun-&amp;gt;curr_properties = src_cfun-&amp;gt;curr_properties &amp;amp; ~PROP_loops;
+  cfun-&amp;gt;last_verified = src_cfun-&amp;gt;last_verified;
+  cfun-&amp;gt;va_list_gpr_size = src_cfun-&amp;gt;va_list_gpr_size;
+  cfun-&amp;gt;va_list_fpr_size = src_cfun-&amp;gt;va_list_fpr_size;
+  cfun-&amp;gt;has_nonlocal_label = src_cfun-&amp;gt;has_nonlocal_label;
+  cfun-&amp;gt;stdarg = src_cfun-&amp;gt;stdarg;
+  cfun-&amp;gt;after_inlining = src_cfun-&amp;gt;after_inlining;
+  cfun-&amp;gt;can_throw_non_call_exceptions
+    = src_cfun-&amp;gt;can_throw_non_call_exceptions;
+  cfun-&amp;gt;returns_struct = src_cfun-&amp;gt;returns_struct;
+  cfun-&amp;gt;returns_pcc_struct = src_cfun-&amp;gt;returns_pcc_struct;
+  cfun-&amp;gt;after_tree_profile = src_cfun-&amp;gt;after_tree_profile;
+  
+  if (src_cfun-&amp;gt;eh)
+    init_eh_for_function ();
+
+  if (src_cfun-&amp;gt;gimple_df)
+    {
+      init_tree_ssa (cfun);
+      cfun-&amp;gt;gimple_df-&amp;gt;in_ssa_p = true;
+      init_ssa_operands (cfun);
+    }
+  pop_cfun ();
+}
+
 void
 tree_elem_fn_versioning (tree old_decl, tree new_decl,
  VEC(ipa_replace_map_p,gc)* tree_map,
  bool update_clones, bitmap args_to_skip,
- bool skip_return, bitmap blocks_to_copy,
- basic_block new_entry, int vlength)
+ bool skip_return, bitmap blocks_to_copy ATTRIBUTE_UNUSED,
+ basic_block new_entry ATTRIBUTE_UNUSED, int vlength, bool masked)
 {
-  struct cgraph_node *old_version_node;
-  struct cgraph_node *new_version_node;
   copy_body_data id;
   tree p;
   unsigned i;
   struct ipa_replace_map *replace_info;
-  basic_block old_entry_block, bb;
   VEC (gimple, heap) *init_stmts = VEC_alloc (gimple, heap, 10);
 
   tree old_current_function_decl = current_function_decl;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5466,21 +5519,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL
       &amp;amp;&amp;amp; TREE_CODE (new_decl) == FUNCTION_DECL);
   DECL_POSSIBLY_INLINED (old_decl) = 1;
-
-  old_version_node = cgraph_get_node (old_decl);
-  gcc_checking_assert (old_version_node);
-  new_version_node = cgraph_get_node (new_decl);
-  gcc_checking_assert (new_version_node);
-
-  if (TREE_TYPE (TREE_TYPE (old_decl)) != void_type_node)
-    {
-      TREE_TYPE (TREE_TYPE (new_decl)) =
-copy_node (TREE_TYPE (TREE_TYPE (old_decl)));
-      TREE_TYPE (TREE_TYPE (new_decl)) =
-build_vector_type (TREE_TYPE (TREE_TYPE (new_decl)), vlength);
-    }
   
-  
   /* Copy over debug args.  */
   if (DECL_HAS_DEBUG_ARGS_P (old_decl))
     {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5502,9 +5541,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   (*debug_hooks-&amp;gt;outlining_inline_function) (old_decl);
 
   DECL_ARTIFICIAL (new_decl) = 1;
-  DECL_ABSTRACT_ORIGIN (new_decl) = DECL_ORIGIN (old_decl);
-  DECL_FUNCTION_PERSONALITY (new_decl) = DECL_FUNCTION_PERSONALITY (old_decl);
-
   /* Prepare the data structures for the tree copy.  */
   memset (&amp;amp;id, 0, sizeof (id));
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5515,24 +5551,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   id.debug_map = NULL;
   id.src_fn = old_decl;
   id.dst_fn = new_decl;
-  id.src_node = old_version_node;
-  id.dst_node = new_version_node;
+  id.src_node = NULL;
+  id.dst_node = NULL;
   id.src_cfun = DECL_STRUCT_FUNCTION (old_decl);
-  if (id.src_node-&amp;gt;ipa_transforms_to_apply)
-    {
-      VEC(ipa_opt_pass,heap) * old_transforms_to_apply =
-id.dst_node-&amp;gt;ipa_transforms_to_apply;
-      unsigned int i;
 
-      id.dst_node-&amp;gt;ipa_transforms_to_apply =
-VEC_copy (ipa_opt_pass, heap, id.src_node-&amp;gt;ipa_transforms_to_apply);
-      for (i = 0; i &amp;lt; VEC_length (ipa_opt_pass, old_transforms_to_apply); i++)
-        VEC_safe_push (ipa_opt_pass, heap, id.dst_node-&amp;gt;ipa_transforms_to_apply,
-       VEC_index (ipa_opt_pass,
-         old_transforms_to_apply,
-  i));
-    }
-
   id.copy_decl = copy_decl_no_change;
   id.transform_call_graph_edges
     = update_clones ? CB_CGE_MOVE_CLONES : CB_CGE_MOVE;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5541,12 +5563,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   id.transform_lang_insert_block = NULL;
 
   current_function_decl = new_decl;
-  old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION
-    (DECL_STRUCT_FUNCTION (old_decl));
-  initialize_cfun (new_decl, old_decl,
-   old_entry_block-&amp;gt;count);
-  DECL_STRUCT_FUNCTION (new_decl)-&amp;gt;gimple_df-&amp;gt;ipa_pta
-    = id.src_cfun-&amp;gt;gimple_df-&amp;gt;ipa_pta;
+  
+  initialize_elem_fn_cfun (new_decl, old_decl);
   push_cfun (DECL_STRUCT_FUNCTION (new_decl));
 
   /* Copy the function's static chain.  */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5602,7 +5620,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   if (DECL_ARGUMENTS (old_decl) != NULL_TREE)
     DECL_ARGUMENTS (new_decl) =
       elem_fn_copy_arguments_for_versioning (DECL_ARGUMENTS (old_decl), &amp;amp;id,
-     args_to_skip, &amp;amp;vars, vlength);
+     args_to_skip, &amp;amp;vars,
+     vlength, masked);
 
   DECL_INITIAL (new_decl) = remap_blocks (DECL_INITIAL (id.src_fn), &amp;amp;id);
   BLOCK_SUPERCONTEXT (DECL_INITIAL (new_decl)) = new_decl;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5629,7 +5648,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
     {
       tree old_name;
       DECL_RESULT (new_decl) = remap_decl (DECL_RESULT (old_decl), &amp;amp;id);
-      /* bviyer; we are just using 4 for vectorlength just to see if it works */
       if (TREE_TYPE (DECL_RESULT (new_decl)) != void_type_node)
 {
   TREE_TYPE (DECL_RESULT (new_decl)) =
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5638,6 +5656,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   DECL_MODE (DECL_RESULT (new_decl)) =
     TYPE_MODE (TREE_TYPE (DECL_RESULT (new_decl)));
 }
+      if (TREE_TYPE (TREE_TYPE (old_decl)) != void_type_node)
+{
+  TREE_TYPE (new_decl) = copy_node (TREE_TYPE (old_decl));
+  TREE_TYPE (TREE_TYPE (new_decl)) =
+    copy_node (TREE_TYPE (TREE_TYPE (old_decl)));
+  TREE_TYPE (TREE_TYPE (new_decl)) =
+    build_vector_type (TREE_TYPE (TREE_TYPE (new_decl)), vlength);
+}
       lang_hooks.dup_lang_specific_decl (DECL_RESULT (new_decl));
       if (gimple_in_ssa_p (id.src_cfun)
   &amp;amp;&amp;amp; DECL_BY_REFERENCE (DECL_RESULT (old_decl))
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5650,22 +5676,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   set_default_def (DECL_RESULT (new_decl), new_name);
 }
     }
-
-  /* Copy the Function's body.  */
-  copy_body (&amp;amp;id, old_entry_block-&amp;gt;count, REG_BR_PROB_BASE,
-     ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, blocks_to_copy, new_entry);
-
+  walk_tree (&amp;amp;DECL_SAVED_TREE (new_decl), copy_tree_body_r, &amp;amp;id, NULL);
   /* Renumber the lexical scoping (non-code) blocks consecutively.  */
   number_blocks (new_decl);
 
-  /* We want to create the BB unconditionally, so that the addition of
-     debug stmts doesn't affect BB count, which may in the end cause
-     codegen differences.  */
-  bb = split_edge (single_succ_edge (ENTRY_BLOCK_PTR));
-  while (VEC_length (gimple, init_stmts))
-    insert_init_stmt (&amp;amp;id, bb, VEC_pop (gimple, init_stmts));
-  update_clone_info (&amp;amp;id);
-
+  
   /* Remap the nonlocal_goto_save_area, if any.  */
   if (cfun-&amp;gt;nonlocal_goto_save_area)
     {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5675,49 +5690,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       wi.info = &amp;amp;id;
       walk_tree (&amp;amp;cfun-&amp;gt;nonlocal_goto_save_area, remap_gimple_op_r, &amp;amp;wi, NULL);
     }
-
+  
   /* Clean up.  */
   pointer_map_destroy (id.decl_map);
   if (id.debug_map)
     pointer_map_destroy (id.debug_map);
-  free_dominance_info (CDI_DOMINATORS);
-  free_dominance_info (CDI_POST_DOMINATORS);
 
-  fold_marked_statements (0, id.statements_to_fold);
-  pointer_set_destroy (id.statements_to_fold);
-  fold_cond_expr_cond ();
-  delete_unreachable_blocks_update_callgraph (&amp;amp;id);
-  if (id.dst_node-&amp;gt;analyzed)
-    cgraph_rebuild_references ();
-  update_ssa (TODO_update_ssa);
-
-  /* After partial cloning we need to rescale frequencies, so they are
-     within proper range in the cloned function.  */
-  if (new_entry)
-    {
-      struct cgraph_edge *e;
-      rebuild_frequencies ();
-
-      new_version_node-&amp;gt;count = ENTRY_BLOCK_PTR-&amp;gt;count;
-      for (e = new_version_node-&amp;gt;callees; e; e = e-&amp;gt;next_callee)
-{
-  basic_block bb = gimple_bb (e-&amp;gt;call_stmt);
-  e-&amp;gt;frequency = compute_call_stmt_bb_frequency (current_function_decl,
- bb);
-  e-&amp;gt;count = bb-&amp;gt;count;
-}
-      for (e = new_version_node-&amp;gt;indirect_calls; e; e = e-&amp;gt;next_callee)
-{
-  basic_block bb = gimple_bb (e-&amp;gt;call_stmt);
-  e-&amp;gt;frequency = compute_call_stmt_bb_frequency (current_function_decl,
- bb);
-  e-&amp;gt;count = bb-&amp;gt;count;
-}
-    }
-
-  free_dominance_info (CDI_DOMINATORS);
-  free_dominance_info (CDI_POST_DOMINATORS);
-
   gcc_assert (!id.debug_stmts);
   VEC_free (gimple, heap, init_stmts);
   pop_cfun ();
Index: Makefile.in
===================================================================
--- Makefile.in(revision 187789)
+++ Makefile.in(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1126,7 +1126,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
   c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o \
   c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o \
   c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o \
-  c-family/c-semantics.o c-family/c-ada-spec.o cilk-spawn.o
+  c-family/c-semantics.o c-family/c-ada-spec.o cilk-spawn.o elem-function.o
 
 # Language-specific object files for C and Objective C.
 C_AND_OBJC_OBJS = attribs.o c-errors.o c-decl.o c-typeck.o \
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1451,7 +1451,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
         cilk.o \
         cilk-low.o \
 array-notation-common.o \
-elem-function.o \
+elem-function-common.o \
 $(out_object_file) \
 $(EXTRA_OBJS) \
 $(host_hook_obj)
Index: passes.c
===================================================================
--- passes.c(revision 187789)
+++ passes.c(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1311,7 +1311,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
       NEXT_PASS (pass_lower_vector);
       NEXT_PASS (pass_early_warn_uninitialized);
       NEXT_PASS (pass_rebuild_cgraph_edges);
-      NEXT_PASS (pass_elem_fn);
       NEXT_PASS (pass_inline_parameters);
       NEXT_PASS (pass_early_inline);
       NEXT_PASS (pass_all_early_optimizations);
Index: ChangeLog.cilk
===================================================================
--- ChangeLog.cilk(revision 187789)
+++ ChangeLog.cilk(working copy)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,43 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-05-23  Balaji V Iyer  &amp;lt;balaji.v.iyer&amp;lt; at &amp;gt;intel.com&amp;gt;
+
+* cgraphunit.c (cgraph_decide_is_function_needed): Added a check for
+a cloned elemental function in the checking assert.
+* tree-inline.c (elem_fn_add_local_variables): Make vlength as an
+unused attribute.  Also stopped moving local variables to vector values.
+(elem_fn_copy_arguments_for_versioning): Added a bool called masked as
+a new parameter.  Also, added a masked parameter to the cloned function
+if this bool is set to true.  Also, stopped setting arguments to
+GIMPLE_REG.
+(initialize_elem_fn_cfun): New function.
+(tree_elem_fn_versioning): Removed several information pertaining to
+maintaining a CFG.  Also added a masked bool parameter to be passed into
+several local functions.  Called initialize_elem_fn_cfun function.
+* tree-ssa.c (verify_use): Added a check if current function is
+an elemental function.
+* gimplify.c (gimplify_function_tree): Called function to create
+elemental function when the function is marked appropriately.
+* elem-function-common.c (find_processor_code): Moved function from
+elem-function.c.
+(find_vlength_code): Likewise.
+(rename_elem_fn): Likewise.
+(find_suffix): Likewise.
+(find_elem_fn_parm_type_1): Likewise.
+(find_elem_fn_parm_type): Likewise.
+(find_elem_fn_name): Likewise.
+(extract_elem_fn_values): Likewise.
+(is_elem_fn): Likewise.
+* elem-function.c (create_optimize_attribute): Changed sprintf to an
+if-statement.
+(find_suffix): Changed a string copy to string concatination.
+(replace_return_with_new_var): New function.
+(elem_fn_build_array): Likewise.
+(replace_array_ref_for_vec): Likewise.
+(fix_elem_fn_return_value): Likewise.
+(add_elem_fn_loop): Likewise.
+(add_elem_fn_mask): Likewise.
+(cg_hacks): Likewise.
+(elem_fn_create_fn): Likewise.
+* passes.c (init_optimization_passes): Removed elem_fn_pass.
+
 2012-05-08  Balaji V. Iyer  &amp;lt;balaji.v.iyer&amp;lt; at &amp;gt;intel.com&amp;gt;
 
 * cilk.c (expand_builtin_cilk_detach): Added mode type for
&lt;/pre&gt;</description>
    <dc:creator>Iyer, Balaji V</dc:creator>
    <dc:date>2012-05-23T21:19:58</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263659">
    <title>[Patch, fortran] PR 53456 More CPU timing fallbacks</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263659</link>
    <description>&lt;pre&gt;Hi,

the attached patch allows the use of clock_gettime() with
CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID if the target
doesn't have getrusage() or times(). Such a target is apparently
VxWorks 6.something, see
http://www-ad.fnal.gov/controls/micro_p/manuals/vxworks_application_programmers_guide_6.7.pdf

Ok for trunk?

2012-05-23  Janne Blomqvist  &amp;lt;jb&amp;lt; at &amp;gt;gcc.gnu.org&amp;gt;

PR fortran/53456
* intrinsics/time_1.h (gf_cputime): Fallback for clock_gettime.


&lt;/pre&gt;</description>
    <dc:creator>Janne Blomqvist</dc:creator>
    <dc:date>2012-05-23T20:43:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263658">
    <title>Re: [C++ Patch] for c++/51214</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263658</link>
    <description>&lt;pre&gt;2012/5/7 Jason Merrill &amp;lt;jason&amp;lt; at &amp;gt;redhat.com&amp;gt;:

Indeed, let's use good old tree lists. Tested
x86_64-unknown-linux-gnu, OK for trunk and 4.7 ?
gcc/testsuite/ChangeLog

2012-05-23  Fabien Chêne  &amp;lt;fabien&amp;lt; at &amp;gt;gcc.gnu.org&amp;gt;

PR c++/51214
* g++.dg/cpp0x/forw_enum11.C: New.

gcc/cp/ChangeLog

2012-05-23  Fabien Chêne  &amp;lt;fabien&amp;lt; at &amp;gt;gcc.gnu.org&amp;gt;

PR c++/51214
* cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
Declare.
* class.c (insert_into_classtype_sorted_fields): New.
(add_enum_fields_to_record_type): New.
(count_fields): Adjust the comment.
(add_fields_to_record_type): Likewise.
(finish_struct_1): Move the code that inserts the fields for the
sorted case, into insert_into_classtype_sorted_fields, and call
it.
(insert_late_enum_def_into_classtype_sorted_fields): Define.
* decl.c (finish_enum_value_list): Call
insert_late_enum_def_into_classtype_sorted_fields if a late enum
definition is encountered.


&lt;/pre&gt;</description>
    <dc:creator>Fabien Chêne</dc:creator>
    <dc:date>2012-05-23T20:38:41</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.gcc.patches/263657">
    <title>Re: [Patch, Fortran] PR51055 - accept non-spec-expr "i" in allocate(character(len=i)::s)</title>
    <link>http://permalink.gmane.org/gmane.comp.gcc.patches/263657</link>
    <description>&lt;pre&gt;
Looks obvious to me :-)

Ciao!
Steven

&lt;/pre&gt;</description>
    <dc:creator>Steven Bosscher</dc:creator>
    <dc:date>2012-05-23T19:57:52</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.gcc.patches">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.gcc.patches</link>
  </textinput>
</rdf:RDF>

