Skip to content
Snippets Groups Projects
Commit c11a6fe1 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Provide fallback if no arch flag is given

parent 4fe88b61
No related branches found
No related tags found
No related merge requests found
#ifndef DUNE_CODEGEN_SUMFACT_HORIZONTALADD_HH #ifndef DUNE_CODEGEN_SUMFACT_HORIZONTALADD_HH
#define DUNE_CODEGEN_SUMFACT_HORIZONTALADD_HH #define DUNE_CODEGEN_SUMFACT_HORIZONTALADD_HH
#include<immintrin.h>
#include<dune/codegen/common/vectorclass.hh> #include<dune/codegen/common/vectorclass.hh>
template<class V> // Only use our custom implementations if we have AVX2 or later!
typename base_floatingpoint<V>::value horizontal_add_lower(const V& x) #if INSTRSET >= 8
{
return horizontal_add(x.get_low());
}
template<class V>
typename base_floatingpoint<V>::value horizontal_add_upper(const V& x)
{
return horizontal_add(x.get_high());
}
/** Implement a variant of horizontal_add(Vec2d) that avoids the haddpd /** Implement a variant of horizontal_add(Vec2d) that avoids the haddpd
* instruction and instead uses the shuffle port. * instruction and instead uses the shuffle port.
...@@ -49,6 +39,27 @@ static inline double permuting_horizontal_add(const Vec8d& a) ...@@ -49,6 +39,27 @@ static inline double permuting_horizontal_add(const Vec8d& a)
#endif #endif
#else
template<typename V>
static inline double permuting_horizontal_add (const V& a)
{
return horizontal_add(a);
}
#endif
template<class V>
typename base_floatingpoint<V>::value horizontal_add_lower(const V& x)
{
return horizontal_add(x.get_low());
}
template<class V>
typename base_floatingpoint<V>::value horizontal_add_upper(const V& x)
{
return horizontal_add(x.get_high());
}
template<class V> template<class V>
typename base_floatingpoint<V>::value permuting_horizontal_add_lower(const V& x) typename base_floatingpoint<V>::value permuting_horizontal_add_lower(const V& x)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment