Line data Source code
1 : ///////////////////////////////////////////////////////////////////////////
2 : // Inastemp - Berenger Bramas MPCDF - 2016
3 : // Under MIT Licence, please you must read the LICENCE file.
4 : ///////////////////////////////////////////////////////////////////////////
5 : #ifndef INAVECAVX2FLOAT_HPP
6 : #define INAVECAVX2FLOAT_HPP
7 :
8 : #include "InastempGlobal.h"
9 : #include "AVX/InaVecAVXFloat.hpp"
10 :
11 : #ifndef INASTEMP_USE_AVX2
12 : #error InaVecAVX2<float> is included but AVX2 is not enable in the configuration
13 : #endif
14 :
15 : #include <tmmintrin.h>
16 : #include <emmintrin.h>
17 :
18 : template <class RealType>
19 : class InaVecAVX2;
20 :
21 : // AVX2 _mm256_abs_epi32 is not useful here
22 : template <>
23 : class alignas(32) InaVecAVX2<float> : public InaVecAVX<float> {
24 : using Parent = InaVecAVX<float>;
25 :
26 : public:
27 : using Parent::GetVecLength;
28 :
29 6506 : using InaVecAVX<float>::InaVecAVX;
30 :
31 136 : inline InaVecAVX2(){}
32 :
33 : inline InaVecAVX2(const InaVecAVX<float>& other)
34 537 : : Parent(other){}
35 :
36 : inline static const char* GetName() {
37 : return "InaVecAVX2<float>";
38 : }
39 :
40 : #ifdef __FMA__
41 : static constexpr bool IsRealFma(){
42 : return true;
43 : }
44 : #endif
45 :
46 : inline static InaIfElse< InaVecAVX2<float> >::ThenClass If(const typename Parent::MaskType& inTest) {
47 30 : return InaIfElse< InaVecAVX2<float> >::IfClass().If(inTest);
48 : }
49 :
50 : #ifdef __FMA__
51 : inline static InaVecAVX2<float> Fma(const InaVecAVX2<float>& inValAdd, const InaVecAVX2<float>& inValMul1, const InaVecAVX2<float>& inValMul2){
52 : return _mm256_fmadd_ps(inValMul1.Parent::vec, inValMul2.Parent::vec, inValAdd.Parent::vec);
53 : }
54 : #endif
55 : };
56 :
57 :
58 : #endif
|