GCC simd fix

This commit is contained in:
Jack Andersen 2019-02-15 15:31:42 -10:00
parent 2041ec3156
commit 31b437e784
2 changed files with 24 additions and 16 deletions

View File

@ -659,7 +659,7 @@ public:
#pragma GCC system_header #pragma GCC system_header
#endif #endif
namespace zeus::_simd { namespace athena::_simd {
enum class _StorageKind { enum class _StorageKind {
_Scalar, _Scalar,
@ -837,8 +837,8 @@ constexpr bool __vectorizable() {
!std::is_same<_Tp, bool>::value; !std::is_same<_Tp, bool>::value;
} }
} // namespace zeus::_simd } // namespace athena::_simd
namespace zeus::_simd::simd_abi { namespace athena::_simd::simd_abi {
using scalar = __simd_abi<_StorageKind::_Scalar, 1>; using scalar = __simd_abi<_StorageKind::_Scalar, 1>;
@ -851,8 +851,8 @@ inline constexpr size_t max_fixed_size = 32;
template <class _Tp> template <class _Tp>
using compatible = fixed_size<16 / sizeof(_Tp)>; using compatible = fixed_size<16 / sizeof(_Tp)>;
} // namespace zeus::_simd::simd_abi } // namespace athena::_simd::simd_abi
namespace zeus::_simd { namespace athena::_simd {
template <class _Tp, class _Abi = simd_abi::compatible<_Tp>> template <class _Tp, class _Abi = simd_abi::compatible<_Tp>>
class simd; class simd;
@ -1280,9 +1280,10 @@ public:
// generator constructor // generator constructor
template <class _Generator, template <class _Generator,
int = typename std::enable_if<__can_generate<_Generator>(std::make_index_sequence<size()>()), int>::type()> int = typename std::enable_if<__can_generate<_Generator>(
std::make_index_sequence<simd_size<_Tp, _Abi>::value>()), int>::type()>
explicit simd(_Generator&& __g) { explicit simd(_Generator&& __g) {
__generator_init(std::forward<_Generator>(__g), std::make_index_sequence<size()>()); __generator_init(std::forward<_Generator>(__g), std::make_index_sequence<simd_size<_Tp, _Abi>::value>());
} }
// load constructor // load constructor
@ -1527,4 +1528,4 @@ public:
void __set(size_t __index, bool __val) noexcept { __storage_.set(__index, __val); } void __set(size_t __index, bool __val) noexcept { __storage_.set(__index, __val); }
}; };
} // namespace zeus::_simd } // namespace athena::_simd

View File

@ -1,6 +1,10 @@
#pragma once #pragma once
#define _ZEUS_SIMD_INCLUDED #define _ATHENA_SIMD_INCLUDED
namespace zeus::_simd { #ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-attributes"
#endif
namespace athena::_simd {
using namespace std; using namespace std;
} }
#include "parallelism_v2_simd.hpp" #include "parallelism_v2_simd.hpp"
@ -14,22 +18,25 @@ using namespace std;
#else #else
namespace simd_abi { namespace simd_abi {
template <typename T> template <typename T>
struct zeus_native {}; struct athena_native {};
template <> template <>
struct zeus_native<float> { struct athena_native<float> {
using type = fixed_size<4>; using type = fixed_size<4>;
}; };
template <> template <>
struct zeus_native<double> { struct athena_native<double> {
using type = fixed_size<4>; using type = fixed_size<4>;
}; };
} // namespace simd_abi } // namespace simd_abi
#endif #endif
namespace zeus { #ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
namespace athena {
template <typename T> template <typename T>
using simd = _simd::simd<T, typename _simd::simd_abi::zeus_native<T>::type>; using simd = _simd::simd<T, typename _simd::simd_abi::athena_native<T>::type>;
template <typename T> template <typename T>
using simd_values = _simd::simd_data<simd<T>>; using simd_values = _simd::simd_data<simd<T>>;
using simd_floats = simd_values<float>; using simd_floats = simd_values<float>;
using simd_doubles = simd_values<double>; using simd_doubles = simd_values<double>;
} // namespace zeus } // namespace athena