aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKirill Yukhin <kirill.yukhin@intel.com>2015-12-04 14:22:06 +0000
committerKirill Yukhin <kyukhin@gcc.gnu.org>2015-12-04 14:22:06 +0000
commite7b69085f8d11a547e9462ab042fda8f3fc57d6c (patch)
tree7b54e87197f8bb6f0b6d062e5f62d02d6433c6c4 /gcc
parentc48516f9a20633303541cd28ab8125bc5724470f (diff)
downloadgcc-e7b69085f8d11a547e9462ab042fda8f3fc57d6c.zip
gcc-e7b69085f8d11a547e9462ab042fda8f3fc57d6c.tar.gz
gcc-e7b69085f8d11a547e9462ab042fda8f3fc57d6c.tar.bz2
Add notinbranch/inbranch flags to attribute __simd__.
gcc/ * c-family/c-common.c (c_common_attribute_table[]): Update max arguments count for "simd" attribute. (handle_simd_attribute): Parse "notinbranch" and "inbranch" arguments. * doc/extend.texi ("simd"): Describe new flags. gcc/testsuite/ * c-c++-common/attr-simd-4.c: New test. * c-c++-common/attr-simd-5.c: New test. From-SVN: r231270
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-family/c-common.c42
-rw-r--r--gcc/doc/extend.texi4
-rw-r--r--gcc/testsuite/ChangeLog5
4 files changed, 53 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 723aa40..1db1edd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-04 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * c-family/c-common.c (c_common_attribute_table[]): Update max arguments
+ count for "simd" attribute.
+ (handle_simd_attribute): Parse "notinbranch" and "inbranch" arguments.
+ * doc/extend.texi ("simd"): Describe new flags.
+
2015-12-04 Ilya Enkovich <enkovich.gnu@gmail.com>
* config/i386/sse.md (<avx512>_store<mode>_mask): Fix
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a8122b3..381a925 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -817,7 +817,7 @@ const struct attribute_spec c_common_attribute_table[] =
handle_omp_declare_simd_attribute, false },
{ "cilk simd function", 0, -1, true, false, false,
handle_omp_declare_simd_attribute, false },
- { "simd", 0, 0, true, false, false,
+ { "simd", 0, 1, true, false, false,
handle_simd_attribute, false },
{ "omp declare target", 0, 0, true, false, false,
handle_omp_declare_target_attribute, false },
@@ -8473,7 +8473,7 @@ handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *)
/* Handle a "simd" attribute. */
static tree
-handle_simd_attribute (tree *node, tree name, tree, int, bool *no_add_attrs)
+handle_simd_attribute (tree *node, tree name, tree args, int, bool *no_add_attrs)
{
if (TREE_CODE (*node) == FUNCTION_DECL)
{
@@ -8486,9 +8486,41 @@ handle_simd_attribute (tree *node, tree name, tree, int, bool *no_add_attrs)
*no_add_attrs = true;
}
else
- DECL_ATTRIBUTES (*node)
- = tree_cons (get_identifier ("omp declare simd"),
- NULL_TREE, DECL_ATTRIBUTES (*node));
+ {
+ tree t = get_identifier ("omp declare simd");
+ tree attr = NULL_TREE;
+ if (args)
+ {
+ tree id = TREE_VALUE (args);
+
+ if (TREE_CODE (id) != STRING_CST)
+ {
+ error ("attribute %qE argument not a string", name);
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+
+ if (strcmp (TREE_STRING_POINTER (id), "notinbranch") == 0)
+ attr = build_omp_clause (DECL_SOURCE_LOCATION (*node),
+ OMP_CLAUSE_NOTINBRANCH);
+ else
+ if (strcmp (TREE_STRING_POINTER (id), "inbranch") == 0)
+ attr = build_omp_clause (DECL_SOURCE_LOCATION (*node),
+ OMP_CLAUSE_INBRANCH);
+ else
+ {
+ error ("only %<inbranch%> and %<notinbranch%> flags are "
+ "allowed for %<__simd__%> attribute");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+ }
+
+ DECL_ATTRIBUTES (*node) = tree_cons (t,
+ build_tree_list (NULL_TREE,
+ attr),
+ DECL_ATTRIBUTES (*node));
+ }
}
else
{
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 6a5e2b8..d0f631f 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3142,6 +3142,7 @@ At the function call it will create resolver @code{ifunc}, that will
dynamically call a clone suitable for current architecture.
@item simd
+@itemx simd("@var{mask}")
@cindex @code{simd} function attribute.
This attribute enables creation of one or more function versions that
can process multiple arguments using SIMD instructions from a
@@ -3156,6 +3157,9 @@ attribute on the same function.
If the attribute is specified and @code{#pragma omp declare simd}
present on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}
switch is specified, then the attribute is ignored.
+The optional argument @var{mask} may have "notinbranch" or "inbranch"
+value and instructs the compiler to generate non-masked or masked
+clones correspondingly. By default, all clones are generated.
@item target (@var{options})
@cindex @code{target} function attribute
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4c81b17..19cd658 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-04 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * c-c++-common/attr-simd-4.c: New test.
+ * c-c++-common/attr-simd-5.c: New test.
+
2015-12-04 Nathan Sidwell <nathan@acm.org>
* gcc.dg/graphite/id-28.c: Requires pthreads.