[PATCH, VECTOR ABI] Add __attribute__((__simd__)) to GCC.

Jakub Jelinek jakub@redhat.com
Fri Nov 13 12:16:00 GMT 2015


On Fri, Nov 13, 2015 at 02:54:33PM +0300, Kirill Yukhin wrote:
> @@ -9013,6 +9016,35 @@ handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *)
>    return NULL_TREE;
>  }
>  
> +/* Handle an "simd" attribute.  */

/* Handle a "simd" attribute.  */
instead?

> +static tree
> +handle_simd_attribute (tree *node, tree name, tree, int , bool *no_add_attrs)

No space after int.

> +@item simd
> +@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
> +single invocation.  Specifying this attribute allows compiler to
> +assume that such a versions are available at link time (provided

Not a native english speaker, but I'd leave the "a " out.

> +in the same or another translation unit).  Generated versions are
> +target dependent and described in corresponding Vector ABI document.  For
> +x86_64 target this document can be found
> +@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
> +It is prohibited to use the attribute along with Cilk Plus's @code{vector}

I think we usually don't say prohibited in the docs, perhaps
"The attribute should not be used together with Cilk Plus @code{vector}
attribute on the same function."?

> +attribute. If the attribute is specified and @code{#pragma omp declare simd}
> +presented on a declaration and @code{-fopenmp} or @code{-fopenmp-simd}

is present on ?

> diff --git a/gcc/testsuite/c-c++-common/attr-simd-2.c b/gcc/testsuite/c-c++-common/attr-simd-2.c
> new file mode 100644
> index 0000000..bc91ccf
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd-2.c
> @@ -0,0 +1,14 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fdump-tree-optimized -fopenmp-simd" } */
> +
> +#pragma omp declare simd
> +__attribute__((__simd__))
> +extern

Maybe just add
#ifdef __cplusplus
"C"
#endif
and remove the C++ mangling cruft from the scan-assembler lines?

> +int simd_attr (void)
> +{
> +  return 0;
> +}
> +
> +/* { dg-final { scan-tree-dump "omp declare simd" "optimized" } } */
> +/* { dg-final { scan-assembler-times "_ZGVbN4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */
> +/* { dg-final { scan-assembler-times "_ZGVbM4_(?:_Z9)?simd_attr(?:v)?:" 1 { target { i?86-*-* x86_64-*-* } } } } */

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/attr-simd.c

Similarly.

Ok for trunk with those changes.

	Jakub



More information about the Gcc-patches mailing list