2016-01-02 14:51:32 +00:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: ./lib/simd/Grid_avx.h
|
|
|
|
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
|
|
|
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
|
|
|
Author: Guido Cossu <cossu@iroiro-pc.kek.jp>
|
|
|
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|
|
|
Author: neo <cossu@post.kek.jp>
|
|
|
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
See the full license in the file "LICENSE" in the top level distribution directory
|
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
2015-05-22 09:33:15 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
/*! @file Grid_avx.h
|
|
|
|
@brief Optimization libraries for AVX1/2 instructions set
|
|
|
|
|
|
|
|
Using intrinsics
|
|
|
|
*/
|
2015-06-16 15:34:45 +01:00
|
|
|
// Time-stamp: <2015-06-16 23:30:41 neo>
|
2015-05-22 09:33:15 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <immintrin.h>
|
2015-11-04 10:29:58 +00:00
|
|
|
#ifdef AVXFMA4
|
|
|
|
#include <x86intrin.h>
|
|
|
|
#endif
|
2015-05-22 09:33:15 +01:00
|
|
|
// _mm256_set_m128i(hi,lo); // not defined in all versions of immintrin.h
|
|
|
|
#ifndef _mm256_set_m128i
|
|
|
|
#define _mm256_set_m128i(hi,lo) _mm256_insertf128_si256(_mm256_castsi128_si256(lo),(hi),1)
|
|
|
|
#endif
|
|
|
|
|
2015-12-10 22:55:00 +00:00
|
|
|
namespace Grid {
|
2015-05-22 09:33:15 +01:00
|
|
|
namespace Optimization {
|
2015-05-27 16:07:17 +01:00
|
|
|
|
|
|
|
template<class vtype>
|
|
|
|
union uconv {
|
|
|
|
__m256 f;
|
|
|
|
vtype v;
|
|
|
|
};
|
|
|
|
|
|
|
|
union u256f {
|
|
|
|
__m256 v;
|
|
|
|
float f[8];
|
|
|
|
};
|
|
|
|
|
|
|
|
union u256d {
|
|
|
|
__m256d v;
|
|
|
|
double f[4];
|
|
|
|
};
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
struct Vsplat{
|
|
|
|
//Complex float
|
|
|
|
inline __m256 operator()(float a, float b){
|
|
|
|
return _mm256_set_ps(b,a,b,a,b,a,b,a);
|
|
|
|
}
|
|
|
|
// Real float
|
|
|
|
inline __m256 operator()(float a){
|
|
|
|
return _mm256_set_ps(a,a,a,a,a,a,a,a);
|
|
|
|
}
|
|
|
|
//Complex double
|
|
|
|
inline __m256d operator()(double a, double b){
|
|
|
|
return _mm256_set_pd(b,a,b,a);
|
|
|
|
}
|
|
|
|
//Real double
|
|
|
|
inline __m256d operator()(double a){
|
|
|
|
return _mm256_set_pd(a,a,a,a);
|
|
|
|
}
|
|
|
|
//Integer
|
|
|
|
inline __m256i operator()(Integer a){
|
|
|
|
return _mm256_set1_epi32(a);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Vstore{
|
|
|
|
//Float
|
|
|
|
inline void operator()(__m256 a, float* F){
|
|
|
|
_mm256_store_ps(F,a);
|
|
|
|
}
|
|
|
|
//Double
|
|
|
|
inline void operator()(__m256d a, double* D){
|
|
|
|
_mm256_store_pd(D,a);
|
|
|
|
}
|
|
|
|
//Integer
|
|
|
|
inline void operator()(__m256i a, Integer* I){
|
|
|
|
_mm256_store_si256((__m256i*)I,a);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Vstream{
|
|
|
|
//Float
|
|
|
|
inline void operator()(float * a, __m256 b){
|
|
|
|
_mm256_stream_ps(a,b);
|
|
|
|
}
|
|
|
|
//Double
|
|
|
|
inline void operator()(double * a, __m256d b){
|
|
|
|
_mm256_stream_pd(a,b);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Vset{
|
|
|
|
// Complex float
|
|
|
|
inline __m256 operator()(Grid::ComplexF *a){
|
|
|
|
return _mm256_set_ps(a[3].imag(),a[3].real(),a[2].imag(),a[2].real(),a[1].imag(),a[1].real(),a[0].imag(),a[0].real());
|
|
|
|
}
|
|
|
|
// Complex double
|
|
|
|
inline __m256d operator()(Grid::ComplexD *a){
|
|
|
|
return _mm256_set_pd(a[1].imag(),a[1].real(),a[0].imag(),a[0].real());
|
|
|
|
}
|
|
|
|
// Real float
|
|
|
|
inline __m256 operator()(float *a){
|
|
|
|
return _mm256_set_ps(a[7],a[6],a[5],a[4],a[3],a[2],a[1],a[0]);
|
|
|
|
}
|
|
|
|
// Real double
|
|
|
|
inline __m256d operator()(double *a){
|
|
|
|
return _mm256_set_pd(a[3],a[2],a[1],a[0]);
|
|
|
|
}
|
|
|
|
// Integer
|
|
|
|
inline __m256i operator()(Integer *a){
|
|
|
|
return _mm256_set_epi32(a[7],a[6],a[5],a[4],a[3],a[2],a[1],a[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename Out_type, typename In_type>
|
|
|
|
struct Reduce{
|
|
|
|
//Need templated class to overload output type
|
|
|
|
//General form must generate error if compiled
|
|
|
|
inline Out_type operator()(In_type in){
|
|
|
|
printf("Error, using wrong Reduce function\n");
|
|
|
|
exit(1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Arithmetic operations
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
struct Sum{
|
|
|
|
//Complex/Real float
|
|
|
|
inline __m256 operator()(__m256 a, __m256 b){
|
|
|
|
return _mm256_add_ps(a,b);
|
|
|
|
}
|
|
|
|
//Complex/Real double
|
|
|
|
inline __m256d operator()(__m256d a, __m256d b){
|
|
|
|
return _mm256_add_pd(a,b);
|
|
|
|
}
|
|
|
|
//Integer
|
|
|
|
inline __m256i operator()(__m256i a, __m256i b){
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX1) || defined (AVXFMA) || defined (AVXFMA4)
|
2015-05-22 09:33:15 +01:00
|
|
|
__m128i a0,a1;
|
|
|
|
__m128i b0,b1;
|
|
|
|
a0 = _mm256_extractf128_si256(a,0);
|
|
|
|
b0 = _mm256_extractf128_si256(b,0);
|
|
|
|
a1 = _mm256_extractf128_si256(a,1);
|
|
|
|
b1 = _mm256_extractf128_si256(b,1);
|
|
|
|
a0 = _mm_add_epi32(a0,b0);
|
|
|
|
a1 = _mm_add_epi32(a1,b1);
|
|
|
|
return _mm256_set_m128i(a1,a0);
|
|
|
|
#endif
|
|
|
|
#if defined (AVX2)
|
|
|
|
return _mm256_add_epi32(a,b);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Sub{
|
|
|
|
//Complex/Real float
|
|
|
|
inline __m256 operator()(__m256 a, __m256 b){
|
|
|
|
return _mm256_sub_ps(a,b);
|
|
|
|
}
|
|
|
|
//Complex/Real double
|
|
|
|
inline __m256d operator()(__m256d a, __m256d b){
|
|
|
|
return _mm256_sub_pd(a,b);
|
|
|
|
}
|
|
|
|
//Integer
|
|
|
|
inline __m256i operator()(__m256i a, __m256i b){
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX1) || defined (AVXFMA) || defined (AVXFMA4)
|
2015-05-22 09:33:15 +01:00
|
|
|
__m128i a0,a1;
|
|
|
|
__m128i b0,b1;
|
|
|
|
a0 = _mm256_extractf128_si256(a,0);
|
|
|
|
b0 = _mm256_extractf128_si256(b,0);
|
|
|
|
a1 = _mm256_extractf128_si256(a,1);
|
|
|
|
b1 = _mm256_extractf128_si256(b,1);
|
|
|
|
a0 = _mm_sub_epi32(a0,b0);
|
|
|
|
a1 = _mm_sub_epi32(a1,b1);
|
|
|
|
return _mm256_set_m128i(a1,a0);
|
|
|
|
#endif
|
|
|
|
#if defined (AVX2)
|
|
|
|
return _mm256_sub_epi32(a,b);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-12-08 16:43:28 +00:00
|
|
|
struct MultRealPart{
|
|
|
|
inline __m256 operator()(__m256 a, __m256 b){
|
|
|
|
__m256 ymm0;
|
|
|
|
ymm0 = _mm256_shuffle_ps(a,a,_MM_SELECT_FOUR_FOUR(2,2,0,0)); // ymm0 <- ar ar,
|
|
|
|
return _mm256_mul_ps(ymm0,b); // ymm0 <- ar bi, ar br
|
|
|
|
}
|
|
|
|
inline __m256d operator()(__m256d a, __m256d b){
|
|
|
|
__m256d ymm0;
|
|
|
|
ymm0 = _mm256_shuffle_pd(a,a,0x0); // ymm0 <- ar ar, ar,ar b'00,00
|
|
|
|
return _mm256_mul_pd(ymm0,b); // ymm0 <- ar bi, ar br
|
|
|
|
}
|
|
|
|
};
|
|
|
|
struct MaddRealPart{
|
|
|
|
inline __m256 operator()(__m256 a, __m256 b, __m256 c){
|
|
|
|
__m256 ymm0 = _mm256_moveldup_ps(a); // ymm0 <- ar ar,
|
2016-12-18 01:27:34 +00:00
|
|
|
return _mm256_add_ps(_mm256_mul_ps( ymm0, b),c);
|
2016-12-08 16:43:28 +00:00
|
|
|
}
|
|
|
|
inline __m256d operator()(__m256d a, __m256d b, __m256d c){
|
|
|
|
__m256d ymm0 = _mm256_shuffle_pd( a, a, 0x0 );
|
|
|
|
return _mm256_add_pd(_mm256_mul_pd( ymm0, b),c);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
struct MultComplex{
|
|
|
|
// Complex float
|
|
|
|
inline __m256 operator()(__m256 a, __m256 b){
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX1)
|
2015-05-22 09:33:15 +01:00
|
|
|
__m256 ymm0,ymm1,ymm2;
|
2015-09-25 16:55:04 +01:00
|
|
|
ymm0 = _mm256_shuffle_ps(a,a,_MM_SELECT_FOUR_FOUR(2,2,0,0)); // ymm0 <- ar ar,
|
2015-05-22 09:33:15 +01:00
|
|
|
ymm0 = _mm256_mul_ps(ymm0,b); // ymm0 <- ar bi, ar br
|
|
|
|
// FIXME AVX2 could MAC
|
2015-09-25 16:55:04 +01:00
|
|
|
ymm1 = _mm256_shuffle_ps(b,b,_MM_SELECT_FOUR_FOUR(2,3,0,1)); // ymm1 <- br,bi
|
|
|
|
ymm2 = _mm256_shuffle_ps(a,a,_MM_SELECT_FOUR_FOUR(3,3,1,1)); // ymm2 <- ai,ai
|
2015-05-22 09:33:15 +01:00
|
|
|
ymm1 = _mm256_mul_ps(ymm1,ymm2); // ymm1 <- br ai, ai bi
|
|
|
|
return _mm256_addsub_ps(ymm0,ymm1);
|
2015-10-08 23:38:52 +01:00
|
|
|
#endif
|
|
|
|
#if defined (AVXFMA4)
|
2015-11-04 10:29:58 +00:00
|
|
|
__m256 a_real = _mm256_shuffle_ps(a,a,_MM_SELECT_FOUR_FOUR(2,2,0,0)); // ar ar,
|
|
|
|
__m256 a_imag = _mm256_shuffle_ps(a,a,_MM_SELECT_FOUR_FOUR(3,3,1,1)); // ai ai
|
|
|
|
__m256 tmp = _mm256_shuffle_ps( b,b, _MM_SELECT_FOUR_FOUR(2,3,0,1));
|
|
|
|
a_imag = _mm256_mul_ps( a_imag,tmp ); // (Ai, Ai) * (Bi, Br) = Ai Bi, Ai Br
|
2015-10-08 23:38:52 +01:00
|
|
|
return _mm256_maddsub_ps( a_real, b, a_imag ); // Ar Br , Ar Bi +- Ai Bi = ArBr-AiBi , ArBi+AiBr
|
|
|
|
#endif
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX2) || defined (AVXFMA)
|
2015-10-08 23:38:52 +01:00
|
|
|
__m256 a_real = _mm256_moveldup_ps( a ); // Ar Ar
|
|
|
|
__m256 a_imag = _mm256_movehdup_ps( a ); // Ai Ai
|
2015-11-06 10:31:48 +00:00
|
|
|
a_imag = _mm256_mul_ps( a_imag, _mm256_shuffle_ps( b,b, _MM_SELECT_FOUR_FOUR(2,3,0,1) )); // (Ai, Ai) * (Bi, Br) = Ai Bi, Ai Br
|
2015-10-08 23:38:52 +01:00
|
|
|
return _mm256_fmaddsub_ps( a_real, b, a_imag ); // Ar Br , Ar Bi +- Ai Bi = ArBr-AiBi , ArBi+AiBr
|
|
|
|
#endif
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
|
|
|
// Complex double
|
|
|
|
inline __m256d operator()(__m256d a, __m256d b){
|
|
|
|
//Multiplication of (ak+ibk)*(ck+idk)
|
|
|
|
// a + i b can be stored as a data structure
|
|
|
|
//From intel optimisation reference guide
|
|
|
|
/*
|
|
|
|
movsldup xmm0, Src1; load real parts into the destination,
|
|
|
|
; a1, a1, a0, a0
|
|
|
|
movaps xmm1, src2; load the 2nd pair of complex values, ; i.e. d1, c1, d0, c0
|
|
|
|
mulps xmm0, xmm1; temporary results, a1d1, a1c1, a0d0, ; a0c0
|
|
|
|
shufps xmm1, xmm1, b1; reorder the real and imaginary ; parts, c1, d1, c0, d0
|
|
|
|
movshdup xmm2, Src1; load the imaginary parts into the ; destination, b1, b1, b0, b0
|
|
|
|
mulps xmm2, xmm1; temporary results, b1c1, b1d1, b0c0, ; b0d0
|
|
|
|
addsubps xmm0, xmm2; b1c1+a1d1, a1c1 -b1d1, b0c0+a0d
|
|
|
|
VSHUFPD (VEX.256 encoded version)
|
|
|
|
IF IMM0[0] = 0
|
|
|
|
THEN DEST[63:0]=SRC1[63:0] ELSE DEST[63:0]=SRC1[127:64] FI;
|
|
|
|
IF IMM0[1] = 0
|
|
|
|
THEN DEST[127:64]=SRC2[63:0] ELSE DEST[127:64]=SRC2[127:64] FI;
|
|
|
|
IF IMM0[2] = 0
|
|
|
|
THEN DEST[191:128]=SRC1[191:128] ELSE DEST[191:128]=SRC1[255:192] FI;
|
|
|
|
IF IMM0[3] = 0
|
|
|
|
THEN DEST[255:192]=SRC2[191:128] ELSE DEST[255:192]=SRC2[255:192] FI; // Ox5 r<->i ; 0xC unchanged
|
|
|
|
*/
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX1)
|
2015-05-22 09:33:15 +01:00
|
|
|
__m256d ymm0,ymm1,ymm2;
|
|
|
|
ymm0 = _mm256_shuffle_pd(a,a,0x0); // ymm0 <- ar ar, ar,ar b'00,00
|
|
|
|
ymm0 = _mm256_mul_pd(ymm0,b); // ymm0 <- ar bi, ar br
|
|
|
|
ymm1 = _mm256_shuffle_pd(b,b,0x5); // ymm1 <- br,bi b'01,01
|
|
|
|
ymm2 = _mm256_shuffle_pd(a,a,0xF); // ymm2 <- ai,ai b'11,11
|
|
|
|
ymm1 = _mm256_mul_pd(ymm1,ymm2); // ymm1 <- br ai, ai bi
|
|
|
|
return _mm256_addsub_pd(ymm0,ymm1);
|
2015-10-08 23:38:52 +01:00
|
|
|
#endif
|
|
|
|
#if defined (AVXFMA4)
|
2015-11-04 10:29:58 +00:00
|
|
|
__m256d a_real = _mm256_shuffle_pd(a,a,0x0);//arar
|
|
|
|
__m256d a_imag = _mm256_shuffle_pd(a,a,0xF);//aiai
|
2015-10-08 23:38:52 +01:00
|
|
|
a_imag = _mm256_mul_pd( a_imag, _mm256_permute_pd( b, 0x5 ) ); // (Ai, Ai) * (Bi, Br) = Ai Bi, Ai Br
|
|
|
|
return _mm256_maddsub_pd( a_real, b, a_imag ); // Ar Br , Ar Bi +- Ai Bi = ArBr-AiBi , ArBi+AiBr
|
|
|
|
#endif
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX2) || defined (AVXFMA)
|
2015-11-06 10:31:48 +00:00
|
|
|
__m256d a_real = _mm256_movedup_pd( a ); // Ar Ar
|
|
|
|
__m256d a_imag = _mm256_shuffle_pd(a,a,0xF);//aiai
|
2015-10-08 23:38:52 +01:00
|
|
|
a_imag = _mm256_mul_pd( a_imag, _mm256_permute_pd( b, 0x5 ) ); // (Ai, Ai) * (Bi, Br) = Ai Bi, Ai Br
|
|
|
|
return _mm256_fmaddsub_pd( a_real, b, a_imag ); // Ar Br , Ar Bi +- Ai Bi = ArBr-AiBi , ArBi+AiBr
|
|
|
|
#endif
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
2015-11-04 10:29:58 +00:00
|
|
|
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
};
|
|
|
|
|
2015-11-04 10:29:58 +00:00
|
|
|
#if 0
|
|
|
|
struct ComplexDot {
|
|
|
|
|
|
|
|
inline void Prep(__m256 ari,__m256 &air) {
|
|
|
|
cdotRIperm(ari,air);
|
|
|
|
}
|
|
|
|
inline void Mul(__m256 ari,__m256 air,__m256 b,__m256 &riir,__m256 &iirr) {
|
|
|
|
riir=air*b;
|
|
|
|
iirr=arr*b;
|
|
|
|
};
|
|
|
|
inline void Madd(__m256 ari,__m256 air,__m256 b,__m256 &riir,__m256 &iirr) {
|
|
|
|
mac(riir,air,b);
|
|
|
|
mac(iirr,ari,b);
|
|
|
|
}
|
|
|
|
inline void End(__m256 ari,__m256 &air) {
|
|
|
|
// cdotRI
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
struct Mult{
|
2015-10-08 23:38:52 +01:00
|
|
|
|
|
|
|
inline void mac(__m256 &a, __m256 b, __m256 c){
|
|
|
|
#if defined (AVX1)
|
|
|
|
a= _mm256_add_ps(_mm256_mul_ps(b,c),a);
|
|
|
|
#endif
|
|
|
|
#if defined (AVXFMA4)
|
|
|
|
a= _mm256_macc_ps(b,c,a);
|
|
|
|
#endif
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX2) || defined (AVXFMA)
|
2015-10-08 23:38:52 +01:00
|
|
|
a= _mm256_fmadd_ps( b, c, a);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void mac(__m256d &a, __m256d b, __m256d c){
|
|
|
|
#if defined (AVX1)
|
|
|
|
a= _mm256_add_pd(_mm256_mul_pd(b,c),a);
|
|
|
|
#endif
|
|
|
|
#if defined (AVXFMA4)
|
|
|
|
a= _mm256_macc_pd(b,c,a);
|
|
|
|
#endif
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX2) || defined (AVXFMA)
|
2015-10-08 23:38:52 +01:00
|
|
|
a= _mm256_fmadd_pd( b, c, a);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
// Real float
|
|
|
|
inline __m256 operator()(__m256 a, __m256 b){
|
|
|
|
return _mm256_mul_ps(a,b);
|
|
|
|
}
|
|
|
|
// Real double
|
|
|
|
inline __m256d operator()(__m256d a, __m256d b){
|
|
|
|
return _mm256_mul_pd(a,b);
|
|
|
|
}
|
|
|
|
// Integer
|
|
|
|
inline __m256i operator()(__m256i a, __m256i b){
|
2016-11-21 16:47:18 +00:00
|
|
|
#if defined (AVX1) || defined (AVXFMA)
|
2015-05-22 09:33:15 +01:00
|
|
|
__m128i a0,a1;
|
|
|
|
__m128i b0,b1;
|
|
|
|
a0 = _mm256_extractf128_si256(a,0);
|
|
|
|
b0 = _mm256_extractf128_si256(b,0);
|
|
|
|
a1 = _mm256_extractf128_si256(a,1);
|
|
|
|
b1 = _mm256_extractf128_si256(b,1);
|
2017-04-13 08:38:12 +01:00
|
|
|
a0 = _mm_mullo_epi32(a0,b0);
|
|
|
|
a1 = _mm_mullo_epi32(a1,b1);
|
2015-05-22 09:33:15 +01:00
|
|
|
return _mm256_set_m128i(a1,a0);
|
|
|
|
#endif
|
|
|
|
#if defined (AVX2)
|
2015-06-16 15:34:45 +01:00
|
|
|
return _mm256_mullo_epi32(a,b);
|
2015-05-22 09:33:15 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-09-26 09:42:22 +01:00
|
|
|
struct Div{
|
|
|
|
// Real float
|
|
|
|
inline __m256 operator()(__m256 a, __m256 b){
|
|
|
|
return _mm256_div_ps(a,b);
|
|
|
|
}
|
|
|
|
// Real double
|
|
|
|
inline __m256d operator()(__m256d a, __m256d b){
|
|
|
|
return _mm256_div_pd(a,b);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
struct Conj{
|
|
|
|
// Complex single
|
|
|
|
inline __m256 operator()(__m256 in){
|
|
|
|
return _mm256_xor_ps(_mm256_addsub_ps(_mm256_setzero_ps(),in), _mm256_set1_ps(-0.f));
|
|
|
|
}
|
|
|
|
// Complex double
|
|
|
|
inline __m256d operator()(__m256d in){
|
2015-06-04 06:17:58 +01:00
|
|
|
return _mm256_xor_pd(_mm256_addsub_pd(_mm256_setzero_pd(),in), _mm256_set1_pd(-0.f));
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
|
|
|
// do not define for integer input
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TimesMinusI{
|
|
|
|
//Complex single
|
|
|
|
inline __m256 operator()(__m256 in, __m256 ret){
|
|
|
|
__m256 tmp =_mm256_addsub_ps(_mm256_setzero_ps(),in); // r,-i
|
2015-09-25 16:55:04 +01:00
|
|
|
return _mm256_shuffle_ps(tmp,tmp,_MM_SELECT_FOUR_FOUR(2,3,0,1)); //-i,r
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
|
|
|
//Complex double
|
|
|
|
inline __m256d operator()(__m256d in, __m256d ret){
|
|
|
|
__m256d tmp = _mm256_addsub_pd(_mm256_setzero_pd(),in); // r,-i
|
|
|
|
return _mm256_shuffle_pd(tmp,tmp,0x5);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TimesI{
|
|
|
|
//Complex single
|
|
|
|
inline __m256 operator()(__m256 in, __m256 ret){
|
2015-09-25 16:55:04 +01:00
|
|
|
__m256 tmp =_mm256_shuffle_ps(in,in,_MM_SELECT_FOUR_FOUR(2,3,0,1)); // i,r
|
2015-05-22 09:33:15 +01:00
|
|
|
return _mm256_addsub_ps(_mm256_setzero_ps(),tmp); // i,-r
|
|
|
|
}
|
|
|
|
//Complex double
|
|
|
|
inline __m256d operator()(__m256d in, __m256d ret){
|
|
|
|
__m256d tmp = _mm256_shuffle_pd(in,in,0x5);
|
|
|
|
return _mm256_addsub_pd(_mm256_setzero_pd(),tmp); // i,-r
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////
|
|
|
|
// Some Template specialization
|
2015-05-27 16:07:17 +01:00
|
|
|
//////////////////////////////////////////////
|
|
|
|
|
2015-09-25 16:55:04 +01:00
|
|
|
struct Permute{
|
|
|
|
|
|
|
|
static inline __m256 Permute0(__m256 in){
|
2016-04-15 18:17:42 +01:00
|
|
|
return _mm256_permute2f128_ps(in,in,0x01); //ABCD EFGH -> EFGH ABCD
|
2015-09-25 16:55:04 +01:00
|
|
|
};
|
|
|
|
static inline __m256 Permute1(__m256 in){
|
2016-04-15 18:17:42 +01:00
|
|
|
return _mm256_shuffle_ps(in,in,_MM_SELECT_FOUR_FOUR(1,0,3,2)); //ABCD EFGH -> CDAB GHEF
|
2015-09-25 16:55:04 +01:00
|
|
|
};
|
|
|
|
static inline __m256 Permute2(__m256 in){
|
2016-04-15 18:17:42 +01:00
|
|
|
return _mm256_shuffle_ps(in,in,_MM_SELECT_FOUR_FOUR(2,3,0,1)); //ABCD EFGH -> BADC FEHG
|
2015-09-25 16:55:04 +01:00
|
|
|
};
|
|
|
|
static inline __m256 Permute3(__m256 in){
|
|
|
|
return in;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline __m256d Permute0(__m256d in){
|
2016-04-15 18:17:42 +01:00
|
|
|
return _mm256_permute2f128_pd(in,in,0x01); //AB CD -> CD AB
|
2015-09-25 16:55:04 +01:00
|
|
|
};
|
2016-04-15 18:17:42 +01:00
|
|
|
static inline __m256d Permute1(__m256d in){ //AB CD -> BA DC
|
2015-09-25 16:55:04 +01:00
|
|
|
return _mm256_shuffle_pd(in,in,0x5);
|
|
|
|
};
|
|
|
|
static inline __m256d Permute2(__m256d in){
|
|
|
|
return in;
|
|
|
|
};
|
|
|
|
static inline __m256d Permute3(__m256d in){
|
|
|
|
return in;
|
|
|
|
};
|
2017-02-15 11:11:04 +00:00
|
|
|
};
|
|
|
|
|
2017-04-12 19:32:37 +01:00
|
|
|
struct PrecisionChange {
|
|
|
|
static inline __m256i StoH (__m256 a,__m256 b) {
|
|
|
|
__m128i ha = _mm256_cvtps_ph(a,0);
|
|
|
|
__m128i hb = _mm256_cvtps_ph(b,0);
|
|
|
|
__m256 h = _mm256_castps128_ps256(ha);
|
|
|
|
h = _mm256_insertf128_ps(h,hb,1);
|
|
|
|
return h;
|
|
|
|
}
|
|
|
|
static inline void HtoS (__m256i h,__m256 &sa,__m256 &sb) {
|
|
|
|
sa = _mm256_cvtph_ps(_mm256_extractf128_ps(h,0));
|
|
|
|
sb = _mm256_cvtph_ps(_mm256_extractf128_ps(h,1));
|
|
|
|
}
|
|
|
|
static inline __m256 DtoS (__m256d a,__m256d b) {
|
|
|
|
__m128 sa = _mm256_cvtpd_ps(a);
|
|
|
|
__m128 sb = _mm256_cvtpd_ps(b);
|
|
|
|
__m256 s = _mm256_castps128_ps256(sa);
|
|
|
|
s = _mm256_insertf128_ps(s,sb,1);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
static inline void StoD (__m256 s,__m256d &a,__m256d &b) {
|
|
|
|
a = _mm256_cvtps_pd(_mm256_extractf128_ps(s,0));
|
|
|
|
b = _mm256_cvtps_pd(_mm256_extractf128_ps(s,1));
|
|
|
|
}
|
2017-04-13 08:38:12 +01:00
|
|
|
static inline __m256i DtoH (__m256d a,__m256d b,__m256d c,__m256d d) {
|
2017-04-12 19:32:37 +01:00
|
|
|
__m256 sa,sb;
|
|
|
|
sa = DtoS(a,b);
|
|
|
|
sb = DtoS(c,d);
|
|
|
|
return StoH(sa,sb);
|
|
|
|
}
|
|
|
|
static inline void HtoD (__m256i h,__m256d &a,__m256d &b,__m256d &c,__m256d &d) {
|
|
|
|
__m256 sa,sb;
|
|
|
|
HtoS(h,sa,sb);
|
|
|
|
StoD(sa,a,b);
|
|
|
|
StoD(sb,c,d);
|
|
|
|
}
|
|
|
|
};
|
2017-02-15 11:11:04 +00:00
|
|
|
struct Exchange{
|
|
|
|
// 3210 ordering
|
|
|
|
static inline void Exchange0(__m256 &out1,__m256 &out2,__m256 in1,__m256 in2){
|
2017-02-16 23:52:44 +00:00
|
|
|
//Invertible
|
|
|
|
//AB CD -> AC BD
|
|
|
|
//AC BD -> AB CD
|
2017-02-15 11:11:04 +00:00
|
|
|
out1= _mm256_permute2f128_ps(in1,in2,0x20);
|
|
|
|
out2= _mm256_permute2f128_ps(in1,in2,0x31);
|
|
|
|
};
|
|
|
|
static inline void Exchange1(__m256 &out1,__m256 &out2,__m256 in1,__m256 in2){
|
2017-02-16 23:52:44 +00:00
|
|
|
//Invertible
|
|
|
|
// ABCD EFGH ->ABEF CDGH
|
|
|
|
// ABEF CDGH ->ABCD EFGH
|
2017-02-15 11:11:04 +00:00
|
|
|
out1= _mm256_shuffle_ps(in1,in2,_MM_SELECT_FOUR_FOUR(1,0,1,0));
|
|
|
|
out2= _mm256_shuffle_ps(in1,in2,_MM_SELECT_FOUR_FOUR(3,2,3,2));
|
|
|
|
};
|
|
|
|
static inline void Exchange2(__m256 &out1,__m256 &out2,__m256 in1,__m256 in2){
|
2017-02-16 23:52:44 +00:00
|
|
|
// Invertible ?
|
|
|
|
// ABCD EFGH -> ACEG BDFH
|
|
|
|
// ACEG BDFH -> AEBF CGDH
|
|
|
|
// out1= _mm256_shuffle_ps(in1,in2,_MM_SELECT_FOUR_FOUR(2,0,2,0));
|
|
|
|
// out2= _mm256_shuffle_ps(in1,in2,_MM_SELECT_FOUR_FOUR(3,1,3,1));
|
|
|
|
// Bollocks; need
|
|
|
|
// AECG BFDH -> ABCD EFGH
|
|
|
|
out1= _mm256_shuffle_ps(in1,in2,_MM_SELECT_FOUR_FOUR(2,0,2,0)); /*ACEG*/
|
|
|
|
out2= _mm256_shuffle_ps(in1,in2,_MM_SELECT_FOUR_FOUR(3,1,3,1)); /*BDFH*/
|
|
|
|
out1= _mm256_shuffle_ps(out1,out1,_MM_SELECT_FOUR_FOUR(3,1,2,0)); /*AECG*/
|
|
|
|
out2= _mm256_shuffle_ps(out2,out2,_MM_SELECT_FOUR_FOUR(3,1,2,0)); /*AECG*/
|
2017-02-15 11:11:04 +00:00
|
|
|
};
|
|
|
|
static inline void Exchange3(__m256 &out1,__m256 &out2,__m256 in1,__m256 in2){
|
|
|
|
assert(0);
|
|
|
|
return;
|
|
|
|
};
|
2015-09-25 16:55:04 +01:00
|
|
|
|
2017-02-15 11:11:04 +00:00
|
|
|
static inline void Exchange0(__m256d &out1,__m256d &out2,__m256d in1,__m256d in2){
|
|
|
|
out1= _mm256_permute2f128_pd(in1,in2,0x20);
|
|
|
|
out2= _mm256_permute2f128_pd(in1,in2,0x31);
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
static inline void Exchange1(__m256d &out1,__m256d &out2,__m256d in1,__m256d in2){
|
|
|
|
out1= _mm256_shuffle_pd(in1,in2,0x0);
|
|
|
|
out2= _mm256_shuffle_pd(in1,in2,0xF);
|
|
|
|
};
|
|
|
|
static inline void Exchange2(__m256d &out1,__m256d &out2,__m256d in1,__m256d in2){
|
|
|
|
assert(0);
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
static inline void Exchange3(__m256d &out1,__m256d &out2,__m256d in1,__m256d in2){
|
|
|
|
assert(0);
|
|
|
|
return;
|
|
|
|
};
|
2015-09-25 16:55:04 +01:00
|
|
|
};
|
|
|
|
|
2017-02-15 11:11:04 +00:00
|
|
|
|
2016-10-11 10:03:01 +01:00
|
|
|
#if defined (AVX2)
|
2016-10-10 23:50:13 +01:00
|
|
|
#define _mm256_alignr_epi32_grid(ret,a,b,n) ret=(__m256) _mm256_alignr_epi8((__m256i)a,(__m256i)b,(n*4)%16)
|
|
|
|
#define _mm256_alignr_epi64_grid(ret,a,b,n) ret=(__m256d) _mm256_alignr_epi8((__m256i)a,(__m256i)b,(n*8)%16)
|
2016-04-19 22:23:51 +01:00
|
|
|
#endif
|
|
|
|
|
2016-10-19 18:35:18 +01:00
|
|
|
#if defined (AVX1) || defined (AVXFMA)
|
2016-10-10 23:50:13 +01:00
|
|
|
#define _mm256_alignr_epi32_grid(ret,a,b,n) { \
|
2016-04-19 22:23:51 +01:00
|
|
|
__m128 aa, bb; \
|
|
|
|
\
|
|
|
|
aa = _mm256_extractf128_ps(a,1); \
|
|
|
|
bb = _mm256_extractf128_ps(b,1); \
|
2016-04-22 14:33:41 +01:00
|
|
|
aa = (__m128)_mm_alignr_epi8((__m128i)aa,(__m128i)bb,(n*4)%16); \
|
2016-04-19 22:23:51 +01:00
|
|
|
ret = _mm256_insertf128_ps(ret,aa,1); \
|
|
|
|
\
|
|
|
|
aa = _mm256_extractf128_ps(a,0); \
|
|
|
|
bb = _mm256_extractf128_ps(b,0); \
|
2016-04-22 14:33:41 +01:00
|
|
|
aa = (__m128)_mm_alignr_epi8((__m128i)aa,(__m128i)bb,(n*4)%16); \
|
2016-04-19 22:23:51 +01:00
|
|
|
ret = _mm256_insertf128_ps(ret,aa,0); \
|
|
|
|
}
|
|
|
|
|
2016-10-10 23:50:13 +01:00
|
|
|
#define _mm256_alignr_epi64_grid(ret,a,b,n) { \
|
2016-04-22 14:33:41 +01:00
|
|
|
__m128d aa, bb; \
|
2016-04-19 22:23:51 +01:00
|
|
|
\
|
|
|
|
aa = _mm256_extractf128_pd(a,1); \
|
|
|
|
bb = _mm256_extractf128_pd(b,1); \
|
2016-04-22 14:33:41 +01:00
|
|
|
aa = (__m128d)_mm_alignr_epi8((__m128i)aa,(__m128i)bb,(n*8)%16); \
|
2016-04-19 22:23:51 +01:00
|
|
|
ret = _mm256_insertf128_pd(ret,aa,1); \
|
|
|
|
\
|
|
|
|
aa = _mm256_extractf128_pd(a,0); \
|
|
|
|
bb = _mm256_extractf128_pd(b,0); \
|
2016-04-22 14:33:41 +01:00
|
|
|
aa = (__m128d)_mm_alignr_epi8((__m128i)aa,(__m128i)bb,(n*8)%16); \
|
2016-04-19 22:23:51 +01:00
|
|
|
ret = _mm256_insertf128_pd(ret,aa,0); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2016-10-11 10:03:01 +01:00
|
|
|
|
2016-04-19 22:23:51 +01:00
|
|
|
struct Rotate{
|
|
|
|
|
|
|
|
static inline __m256 rotate(__m256 in,int n){
|
|
|
|
switch(n){
|
|
|
|
case 0: return tRotate<0>(in);break;
|
|
|
|
case 1: return tRotate<1>(in);break;
|
|
|
|
case 2: return tRotate<2>(in);break;
|
|
|
|
case 3: return tRotate<3>(in);break;
|
|
|
|
case 4: return tRotate<4>(in);break;
|
|
|
|
case 5: return tRotate<5>(in);break;
|
|
|
|
case 6: return tRotate<6>(in);break;
|
|
|
|
case 7: return tRotate<7>(in);break;
|
|
|
|
default: assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static inline __m256d rotate(__m256d in,int n){
|
|
|
|
switch(n){
|
|
|
|
case 0: return tRotate<0>(in);break;
|
|
|
|
case 1: return tRotate<1>(in);break;
|
|
|
|
case 2: return tRotate<2>(in);break;
|
|
|
|
case 3: return tRotate<3>(in);break;
|
|
|
|
default: assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<int n>
|
|
|
|
static inline __m256 tRotate(__m256 in){
|
|
|
|
__m256 tmp = Permute::Permute0(in);
|
|
|
|
__m256 ret;
|
|
|
|
if ( n > 3 ) {
|
2016-10-10 23:50:13 +01:00
|
|
|
_mm256_alignr_epi32_grid(ret,in,tmp,n);
|
2016-04-19 22:23:51 +01:00
|
|
|
} else {
|
2016-10-10 23:50:13 +01:00
|
|
|
_mm256_alignr_epi32_grid(ret,tmp,in,n);
|
2016-04-19 22:23:51 +01:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<int n>
|
|
|
|
static inline __m256d tRotate(__m256d in){
|
|
|
|
__m256d tmp = Permute::Permute0(in);
|
|
|
|
__m256d ret;
|
|
|
|
if ( n > 1 ) {
|
2016-10-10 23:50:13 +01:00
|
|
|
_mm256_alignr_epi64_grid(ret,in,tmp,n);
|
2016-04-19 22:23:51 +01:00
|
|
|
} else {
|
2016-10-10 23:50:13 +01:00
|
|
|
_mm256_alignr_epi64_grid(ret,tmp,in,n);
|
2016-04-19 22:23:51 +01:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
//Complex float Reduce
|
|
|
|
template<>
|
|
|
|
inline Grid::ComplexF Reduce<Grid::ComplexF, __m256>::operator()(__m256 in){
|
|
|
|
__m256 v1,v2;
|
2015-09-25 16:55:04 +01:00
|
|
|
v1=Optimization::Permute::Permute0(in); // avx 256; quad complex single
|
|
|
|
v1= _mm256_add_ps(v1,in);
|
|
|
|
v2=Optimization::Permute::Permute1(v1);
|
2015-05-22 09:33:15 +01:00
|
|
|
v1 = _mm256_add_ps(v1,v2);
|
2015-05-27 16:07:17 +01:00
|
|
|
u256f conv; conv.v = v1;
|
2015-05-27 02:49:33 +01:00
|
|
|
return Grid::ComplexF(conv.f[0],conv.f[1]);
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
2015-05-27 16:07:17 +01:00
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
//Real float Reduce
|
|
|
|
template<>
|
|
|
|
inline Grid::RealF Reduce<Grid::RealF, __m256>::operator()(__m256 in){
|
|
|
|
__m256 v1,v2;
|
2015-09-25 16:55:04 +01:00
|
|
|
v1 = Optimization::Permute::Permute0(in); // avx 256; octo-double
|
2015-05-22 09:33:15 +01:00
|
|
|
v1 = _mm256_add_ps(v1,in);
|
2015-09-25 16:55:04 +01:00
|
|
|
v2 = Optimization::Permute::Permute1(v1);
|
2015-05-22 09:33:15 +01:00
|
|
|
v1 = _mm256_add_ps(v1,v2);
|
2015-09-25 16:55:04 +01:00
|
|
|
v2 = Optimization::Permute::Permute2(v1);
|
2015-05-22 09:33:15 +01:00
|
|
|
v1 = _mm256_add_ps(v1,v2);
|
2015-05-27 16:07:17 +01:00
|
|
|
u256f conv; conv.v=v1;
|
|
|
|
return conv.f[0];
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Complex double Reduce
|
|
|
|
template<>
|
|
|
|
inline Grid::ComplexD Reduce<Grid::ComplexD, __m256d>::operator()(__m256d in){
|
|
|
|
__m256d v1;
|
2015-09-25 16:55:04 +01:00
|
|
|
v1 = Optimization::Permute::Permute0(in); // sse 128; paired complex single
|
2015-05-22 09:33:15 +01:00
|
|
|
v1 = _mm256_add_pd(v1,in);
|
2015-05-27 16:07:17 +01:00
|
|
|
u256d conv; conv.v = v1;
|
|
|
|
return Grid::ComplexD(conv.f[0],conv.f[1]);
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Real double Reduce
|
|
|
|
template<>
|
|
|
|
inline Grid::RealD Reduce<Grid::RealD, __m256d>::operator()(__m256d in){
|
|
|
|
__m256d v1,v2;
|
2015-09-25 16:55:04 +01:00
|
|
|
v1 = Optimization::Permute::Permute0(in); // avx 256; quad double
|
2015-05-22 09:33:15 +01:00
|
|
|
v1 = _mm256_add_pd(v1,in);
|
2015-09-25 16:55:04 +01:00
|
|
|
v2 = Optimization::Permute::Permute1(v1);
|
2015-05-22 09:33:15 +01:00
|
|
|
v1 = _mm256_add_pd(v1,v2);
|
2015-05-27 16:07:17 +01:00
|
|
|
u256d conv; conv.v = v1;
|
|
|
|
return conv.f[0];
|
2015-05-22 09:33:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Integer Reduce
|
|
|
|
template<>
|
|
|
|
inline Integer Reduce<Integer, __m256i>::operator()(__m256i in){
|
|
|
|
// FIXME unimplemented
|
|
|
|
printf("Reduce : Missing integer implementation -> FIX\n");
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Here assign types
|
2015-12-10 22:55:00 +00:00
|
|
|
|
2017-04-12 19:32:37 +01:00
|
|
|
typedef __m256i SIMD_Htype; // Single precision type
|
2015-05-22 09:33:15 +01:00
|
|
|
typedef __m256 SIMD_Ftype; // Single precision type
|
|
|
|
typedef __m256d SIMD_Dtype; // Double precision type
|
|
|
|
typedef __m256i SIMD_Itype; // Integer type
|
|
|
|
|
2015-05-27 04:11:44 +01:00
|
|
|
// prefecthing
|
|
|
|
inline void v_prefetch0(int size, const char *ptr){
|
|
|
|
for(int i=0;i<size;i+=64){ // Define L1 linesize above
|
|
|
|
_mm_prefetch(ptr+i+4096,_MM_HINT_T1);
|
|
|
|
_mm_prefetch(ptr+i+512,_MM_HINT_T0);
|
|
|
|
}
|
|
|
|
}
|
2015-06-09 07:46:21 +01:00
|
|
|
inline void prefetch_HINT_T0(const char *ptr){
|
|
|
|
_mm_prefetch(ptr,_MM_HINT_T0);
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:33:15 +01:00
|
|
|
// Function name aliases
|
|
|
|
typedef Optimization::Vsplat VsplatSIMD;
|
|
|
|
typedef Optimization::Vstore VstoreSIMD;
|
|
|
|
typedef Optimization::Vset VsetSIMD;
|
|
|
|
typedef Optimization::Vstream VstreamSIMD;
|
|
|
|
|
2015-12-10 22:55:00 +00:00
|
|
|
template <typename S, typename T> using ReduceSIMD = Optimization::Reduce<S,T>;
|
2015-05-22 09:33:15 +01:00
|
|
|
|
|
|
|
// Arithmetic operations
|
|
|
|
typedef Optimization::Sum SumSIMD;
|
|
|
|
typedef Optimization::Sub SubSIMD;
|
2016-09-26 09:42:22 +01:00
|
|
|
typedef Optimization::Div DivSIMD;
|
2015-05-22 09:33:15 +01:00
|
|
|
typedef Optimization::Mult MultSIMD;
|
2016-12-08 16:43:28 +00:00
|
|
|
typedef Optimization::MultComplex MultComplexSIMD;
|
|
|
|
typedef Optimization::MultRealPart MultRealPartSIMD;
|
|
|
|
typedef Optimization::MaddRealPart MaddRealPartSIMD;
|
2015-05-22 09:33:15 +01:00
|
|
|
typedef Optimization::Conj ConjSIMD;
|
|
|
|
typedef Optimization::TimesMinusI TimesMinusISIMD;
|
|
|
|
typedef Optimization::TimesI TimesISIMD;
|
|
|
|
|
|
|
|
}
|