better dispatching
This commit is contained in:
parent
1c5c9eb579
commit
ff1ff8c25e
1 changed files with 14 additions and 4 deletions
|
@ -34,6 +34,18 @@
|
||||||
#undef ARCH
|
#undef ARCH
|
||||||
|
|
||||||
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=5)
|
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=5)
|
||||||
|
|
||||||
|
static int have_avx(void)
|
||||||
|
{
|
||||||
|
static int res=-1;
|
||||||
|
if (res<0)
|
||||||
|
{
|
||||||
|
__builtin_cpu_init();
|
||||||
|
res = __builtin_cpu_supports("avx");
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void inner_loop_avx (sharp_job *job, const int *ispair,const double *cth,
|
void inner_loop_avx (sharp_job *job, const int *ispair,const double *cth,
|
||||||
const double *sth, int llim, int ulim, sharp_Ylmgen_C *gen, int mi,
|
const double *sth, int llim, int ulim, sharp_Ylmgen_C *gen, int mi,
|
||||||
const int *mlim);
|
const int *mlim);
|
||||||
|
@ -44,8 +56,7 @@ void inner_loop (sharp_job *job, const int *ispair,const double *cth,
|
||||||
const int *mlim)
|
const int *mlim)
|
||||||
{
|
{
|
||||||
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=5)
|
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=5)
|
||||||
__builtin_cpu_init();
|
if (have_avx())
|
||||||
if (__builtin_cpu_supports("avx"))
|
|
||||||
inner_loop_avx (job, ispair, cth, sth, llim, ulim, gen, mi, mlim);
|
inner_loop_avx (job, ispair, cth, sth, llim, ulim, gen, mi, mlim);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,8 +66,7 @@ void inner_loop (sharp_job *job, const int *ispair,const double *cth,
|
||||||
int sharp_veclen(void)
|
int sharp_veclen(void)
|
||||||
{
|
{
|
||||||
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=5)
|
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=5)
|
||||||
__builtin_cpu_init();
|
if (have_avx())
|
||||||
if (__builtin_cpu_supports("avx"))
|
|
||||||
return 4;
|
return 4;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue