Skip to content

Commit

Permalink
[libcxx] implement <simd> ABI for Clang/GCC vector extension, constru…
Browse files Browse the repository at this point in the history
…ctors, copy_from and copy_to.

Summary:
This patch adds a new macro _LIBCPP_HAS_NO_VECTOR_EXTENSION for detecting
whether a vector extension (\_\_attribute\_\_((vector_size(num_bytes)))) is
available.

On the top of that, this patch implements the following API:
* all constructors
* operator[]
* copy_from
* copy_to

It also defines simd_abi::native to use vector extension, if available.
In GCC and Clang, certain values with vector extension are passed by registers,
instead of memory.

Based on D41148.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits, MaskRay, lichray, sanjoy

Differential Revision: https://reviews.llvm.org/D41376

llvm-svn: 338309
  • Loading branch information
timshen91 committed Jul 30, 2018
1 parent 0bb8e89 commit 47ad09b
Show file tree
Hide file tree
Showing 18 changed files with 1,477 additions and 445 deletions.
4 changes: 4 additions & 0 deletions libcxx/include/__config
Expand Up @@ -620,6 +620,8 @@ namespace std {

#define _LIBCPP_ALWAYS_INLINE __forceinline

#define _LIBCPP_HAS_NO_VECTOR_EXTENSION

#elif defined(_LIBCPP_COMPILER_IBM)

#define _ALIGNAS(x) __attribute__((__aligned__(x)))
Expand Down Expand Up @@ -652,6 +654,8 @@ namespace std {

#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))

#define _LIBCPP_HAS_NO_VECTOR_EXTENSION

#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]

#if _LIBCPP_STD_VER >= 17
Expand Down
7 changes: 7 additions & 0 deletions libcxx/include/experimental/__config
Expand Up @@ -64,4 +64,11 @@
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
} _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD

// TODO: support more targets
#if defined(__AVX__)
#define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
#else
#define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16
#endif

#endif

0 comments on commit 47ad09b

Please sign in to comment.