re-enable auto-vectorization

This commit is contained in:
Christian Zimmermann 2021-09-21 14:01:04 +02:00
parent 388531c37f
commit 8f6094233a
2 changed files with 12 additions and 10 deletions

View file

@ -90,6 +90,7 @@ namespace CNORXZ
protected: protected:
AccessTemplate() = default; AccessTemplate() = default;
}; };
template <typename T> template <typename T>
@ -146,22 +147,23 @@ namespace CNORXZ
public: public:
VPointerAccess(T* ptr, T* origPtr) : mPtr(ptr), mOrigPtr(origPtr) {} VPointerAccess(T* ptr, T* origPtr) : mPtr(ptr), mOrigPtr(origPtr) {}
VPointerAccess(const PointerAccess<T>& in) : mPtr(in.get(0)), mOrigPtr(in.oget(0)) {}
VPointerAccess(const VPointerAccess& in) = default; VPointerAccess(const VPointerAccess& in) = default;
VPointerAccess(VPointerAccess&& in) = default; VPointerAccess(VPointerAccess&& in) = default;
VPointerAccess& operator=(const VPointerAccess& in) = default; VPointerAccess& operator=(const VPointerAccess& in) = default;
VPointerAccess& operator=(VPointerAccess&& in) = default; VPointerAccess& operator=(VPointerAccess&& in) = default;
VType<T>* get(size_t pos) { return reinterpret_cast<VType<T>*>(mPtr+pos); } value_type* get(size_t pos) { return reinterpret_cast<value_type*>(mPtr+pos); }
VType<T>* get(size_t pos) const { return reinterpret_cast<VType<T>*>(mPtr+pos); } value_type* get(size_t pos) const { return reinterpret_cast<value_type*>(mPtr+pos); }
VPointerAccess<T>& set(size_t pos) { mPtr = mOrigPtr + pos; return *this; } VPointerAccess<T>& set(size_t pos) { mPtr = mOrigPtr + pos; return *this; }
VType<T>* oget(size_t pos) const { return reinterpret_cast<VType<T>*>(mOrigPtr+pos); } value_type* oget(size_t pos) const { return reinterpret_cast<value_type*>(mOrigPtr+pos); }
template <class F, typename Op, class ExtType> template <class F, typename Op, class ExtType>
inline void exec(size_t pos, const Op& op, ExtType e) const inline void exec(size_t pos, const Op& op, ExtType e) const
{ {
CHECK; F::selfApply(*get(pos),op.template vget<value_type>(e));
F::selfApply(*get(pos),op.vget(e));
} }
}; };

View file

@ -483,8 +483,8 @@ namespace CNORXZ
auto OperationRoot<T,Ranges...>::asxExpr(const OpClass& in) const auto OperationRoot<T,Ranges...>::asxExpr(const OpClass& in) const
{ {
static_assert( OpClass::SIZE == decltype(in.rootSteps())::SIZE, "Ext Size mismatch" ); static_assert( OpClass::SIZE == decltype(in.rootSteps())::SIZE, "Ext Size mismatch" );
return in.loop(AssignmentExpr<T,Func,PointerAccess<T>,OperationRoot<T,Ranges...>,OpClass> return in.loop(AssignmentExpr<T,Func,Access,OperationRoot<T,Ranges...>,OpClass>
(mDataAcc,*this,in)); (Access(mDataAcc),*this,in));
} }
template <typename T, class... Ranges> template <typename T, class... Ranges>
@ -541,9 +541,9 @@ namespace CNORXZ
if constexpr(VABLE){ if constexpr(VABLE){
CHECK; CHECK;
typedef typename TarOp::value_type T; typedef typename TarOp::value_type T;
auto x = th.template asx<Func,VPointerAccess<T>>(in); auto x = th.template asx<VFunc<Func>,VPointerAccess<T>>(in);
//if(x.rootSteps(x.vI()) == 1){ if(x.rootSteps(x.vI()) == 1){
if(0){ //if(0){
CHECK; CHECK;
x(); x();
} }