mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 12:46:00 +08:00
backport 7209d6a12610d4682c65a99f12b0d0278fbbe81d
(fix gemv_static_vector_if on architectures that cannot aligned on the stack (e.g., ARM NEON))
This commit is contained in:
parent
4c7d57490c
commit
e3a521be6b
@ -375,8 +375,23 @@ struct gemv_static_vector_if<Scalar,Size,Dynamic,true>
|
|||||||
template<typename Scalar,int Size,int MaxSize>
|
template<typename Scalar,int Size,int MaxSize>
|
||||||
struct gemv_static_vector_if<Scalar,Size,MaxSize,true>
|
struct gemv_static_vector_if<Scalar,Size,MaxSize,true>
|
||||||
{
|
{
|
||||||
|
#if EIGEN_ALIGN_STATICALLY
|
||||||
internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0> m_data;
|
internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0> m_data;
|
||||||
EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; }
|
EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; }
|
||||||
|
#else
|
||||||
|
// Some architectures cannot align on the stack,
|
||||||
|
// => let's manually enforce alignment by allocating more data and return the address of the first aligned element.
|
||||||
|
enum {
|
||||||
|
ForceAlignment = internal::packet_traits<Scalar>::Vectorizable,
|
||||||
|
PacketSize = internal::packet_traits<Scalar>::size
|
||||||
|
};
|
||||||
|
internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?PacketSize:0),0> m_data;
|
||||||
|
EIGEN_STRONG_INLINE Scalar* data() {
|
||||||
|
return ForceAlignment
|
||||||
|
? reinterpret_cast<Scalar*>((reinterpret_cast<size_t>(m_data.array) & ~(size_t(15))) + 16)
|
||||||
|
: m_data.array;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct gemv_selector<OnTheRight,ColMajor,true>
|
template<> struct gemv_selector<OnTheRight,ColMajor,true>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user