From 4cf634e42f925a944712f020bf4e67782cd41674 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Thu, 1 Oct 2026 19:25:37 -0500 Subject: [PATCH 1/4] Apply Eigen upstream patch for eigen_memset_helper Source: https://gitlab.com/libeigen/eigen/-/commit/e246f9cb68d07e8f15c60a2404ac9a625c349223 --- DESCRIPTION | 4 ++-- inst/include/Eigen/src/Core/Fill.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cf12c938..42131555 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: RcppEigen Type: Package Title: 'Rcpp' Integration for the 'Eigen' Templated Linear Algebra Library -Version: 0.4.9.9-2 -Date: 2026-06-04 +Version: 0.4.9.9-4 +Date: 2026-10-01 Authors@R: c(person("Doug", "Bates", role = "aut", comment = c(ORCID = "0000-0001-8316-9503")), person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org", diff --git a/inst/include/Eigen/src/Core/Fill.h b/inst/include/Eigen/src/Core/Fill.h index 779ef26a..6f459358 100644 --- a/inst/include/Eigen/src/Core/Fill.h +++ b/inst/include/Eigen/src/Core/Fill.h @@ -93,8 +93,10 @@ struct eigen_fill_impl { template struct eigen_memset_helper { - static constexpr bool value = - std::is_trivially_copyable::value && eigen_fill_helper::value; + using Scalar = typename Xpr::Scalar; + static constexpr bool value = std::is_trivially_copyable::value && + !static_cast(NumTraits::RequireInitialization) && + eigen_fill_helper::value; }; template From dd7dcc15c613e595da6105a76ff2897fa99bc271 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Tue, 6 Oct 2026 20:30:44 -0500 Subject: [PATCH 2/4] Add previous commit as diff in patches/ --- ChangeLog | 8 ++++++++ patches/eigen-5.0.1-stan.diff | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 patches/eigen-5.0.1-stan.diff diff --git a/ChangeLog b/ChangeLog index 7a2574e2..f8888b1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2026-10-06 Dirk Eddelbuettel + + * patches/eigen-5.0.1-stan.diff: Document previous commit as diff + +2026-10-01 Dirk Eddelbuettel + + * inst/include/Eigen/src/Core/Fill.h: Apply patch to aid StanHeaders + 2026-07-27 Dirk Eddelbuettel * configure.ac: Conditionally adding compilation flags diff --git a/patches/eigen-5.0.1-stan.diff b/patches/eigen-5.0.1-stan.diff new file mode 100644 index 00000000..ba8fc4be --- /dev/null +++ b/patches/eigen-5.0.1-stan.diff @@ -0,0 +1,17 @@ +diff --git o/inst/include/Eigen/src/Core/Fill.h w/inst/include/Eigen/src/Core/Fill.h +index 779ef26..6f45935 100644 +--- o/inst/include/Eigen/src/Core/Fill.h ++++ w/inst/include/Eigen/src/Core/Fill.h +@@ -93,8 +93,10 @@ struct eigen_fill_impl { + + template + struct eigen_memset_helper { +- static constexpr bool value = +- std::is_trivially_copyable::value && eigen_fill_helper::value; ++ using Scalar = typename Xpr::Scalar; ++ static constexpr bool value = std::is_trivially_copyable::value && ++ !static_cast(NumTraits::RequireInitialization) && ++ eigen_fill_helper::value; + }; + + template From 3959c8bc091c84b1135ab44ffbe367a36c80c8cf Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Wed, 7 Oct 2026 05:40:28 -0700 Subject: [PATCH 3/4] Apply upstream Eigen commits e246f9cb and 43a01f06 (#152) - [e246f9cb](https://gitlab.com/libeigen/eigen/-/commit/e246f9cb68d07e8f15c60a2404ac9a625c349223): Use memset in Fill.h only if !NumTraits::RequireInitialization (already present in branch) - [43a01f06](https://gitlab.com/libeigen/eigen/-/commit/43a01f06ad52a2e07e8b522eb7106bdde5d8bb5c): Update AVX and AVX512 to support gcc < 10.1 and clang < 10 Co-authored-by: Dirk Eddelbuettel --- ChangeLog | 11 +++- .../Eigen/src/Core/arch/AVX/TypeCasting.h | 40 +++++++++++- .../Eigen/src/Core/arch/AVX512/PacketMath.h | 62 ++++++++++++++++--- .../Eigen/src/Core/arch/AVX512/TypeCasting.h | 10 ++- 4 files changed, 111 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8888b1e..e90b3a59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,19 @@ + +2026-10-07 Steve Bronder + + * inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h: Apply upstream + commit 43a01f06 to support gcc < 10.1 and clang < 10 + * inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h: Idem + * inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h: Idem + 2026-10-06 Dirk Eddelbuettel * patches/eigen-5.0.1-stan.diff: Document previous commit as diff 2026-10-01 Dirk Eddelbuettel - * inst/include/Eigen/src/Core/Fill.h: Apply patch to aid StanHeaders + * inst/include/Eigen/src/Core/Fill.h: Apply upstream commit e246f9cb + to use memset only if !NumTraits::RequireInitialization 2026-07-27 Dirk Eddelbuettel diff --git a/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h b/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h index 767e2d55..9feb38f8 100644 --- a/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h +++ b/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h @@ -56,6 +56,40 @@ struct type_casting_traits : vectorized_type_casting_traits(tmp), lo); + _mm_storeu_si128(reinterpret_cast<__m128i*>(tmp + 4), hi); + return _mm256_loadu_si256(reinterpret_cast(tmp)); +#endif +#else + return _mm256_set_m128i(hi, lo); +#endif +} + template <> EIGEN_STRONG_INLINE Packet16b pcast(const Packet8f& a, const Packet8f& b) { __m256 nonzero_a = _mm256_cmp_ps(a, pzero(a), _CMP_NEQ_UQ); @@ -109,7 +143,7 @@ EIGEN_STRONG_INLINE Packet8i pcast(const Packet8f& a) { template <> EIGEN_STRONG_INLINE Packet8i pcast(const Packet4d& a, const Packet4d& b) { - return _mm256_set_m128i(_mm256_cvttpd_epi32(b), _mm256_cvttpd_epi32(a)); + return _eigen_mm256_set_m128i(_mm256_cvttpd_epi32(b), _mm256_cvttpd_epi32(a)); } template <> @@ -124,7 +158,7 @@ EIGEN_STRONG_INLINE Packet8f pcast(const Packet8i& a) { template <> EIGEN_STRONG_INLINE Packet8f pcast(const Packet4d& a, const Packet4d& b) { - return _mm256_set_m128(_mm256_cvtpd_ps(b), _mm256_cvtpd_ps(a)); + return _eigen_mm256_set_m128(_mm256_cvtpd_ps(b), _mm256_cvtpd_ps(a)); } template <> @@ -249,7 +283,7 @@ EIGEN_STRONG_INLINE Packet4d pcast(const Packet4l& a) { template <> EIGEN_STRONG_INLINE Packet4d pcast(const Packet2l& a, const Packet2l& b) { - return _mm256_set_m128d((pcast(b)), (pcast(a))); + return _eigen_mm256_set_m128d((pcast(b)), (pcast(a))); } template <> diff --git a/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h b/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h index b76c8a77..baeefa3c 100644 --- a/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h +++ b/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h @@ -44,6 +44,54 @@ typedef eigen_packet_wrapper<__m512i, 6> Packet32s; typedef eigen_packet_wrapper<__m256i, 6> Packet16s; typedef eigen_packet_wrapper<__m128i, 6> Packet8s; +EIGEN_STRONG_INLINE Packet16i _eigen_mm512_loadu_epi32(const int* from) { +#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) + return _mm512_loadu_si512(reinterpret_cast(from)); +#else + return _mm512_loadu_epi32(from); +#endif +} + +EIGEN_STRONG_INLINE Packet16i _eigen_mm512_loadu_epi64(const int64_t* from) { +#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) + return _mm512_loadu_si512(reinterpret_cast(from)); +#else + return _mm512_loadu_epi64(from); +#endif +} + +EIGEN_STRONG_INLINE void _eigen_mm512_storeu_epi32(void* to, const Packet16i& from) { +#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) + _mm512_storeu_si512(to, from); +#else + _mm512_storeu_epi32(to, from); +#endif +} + +EIGEN_STRONG_INLINE void _eigen_mm512_storeu_epi64(void* to, const Packet16i& from) { +#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) + _mm512_storeu_si512(to, from); +#else + _mm512_storeu_epi64(to, from); +#endif +} + +EIGEN_STRONG_INLINE void _eigen_mm256_storeu_epi32(void* to, const __m256i& from) { +#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) + _mm256_storeu_si256(reinterpret_cast<__m256i*>(to), from); +#else + _mm256_storeu_epi32(to, from); +#endif +} + +EIGEN_STRONG_INLINE void _eigen_mm_storeu_epi32(void* to, const __m128i& from) { +#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) + _mm_storeu_si128(reinterpret_cast<__m128i*>(to), from); +#else + _mm_storeu_epi32(to, from); +#endif +} + template <> struct is_arithmetic<__m512> { enum { value = true }; @@ -1033,11 +1081,11 @@ EIGEN_STRONG_INLINE Packet8d ploadu(const double* from) { } template <> EIGEN_STRONG_INLINE Packet16i ploadu(const int* from) { - EIGEN_DEBUG_UNALIGNED_LOAD return _mm512_loadu_epi32(from); + EIGEN_DEBUG_UNALIGNED_LOAD return _eigen_mm512_loadu_epi32(from); } template <> EIGEN_STRONG_INLINE Packet8l ploadu(const int64_t* from) { - EIGEN_DEBUG_UNALIGNED_LOAD return _mm512_loadu_epi64(from); + EIGEN_DEBUG_UNALIGNED_LOAD return _eigen_mm512_loadu_epi64(from); } template <> @@ -1158,11 +1206,11 @@ EIGEN_STRONG_INLINE void pstoreu(double* to, const Packet8d& from) { } template <> EIGEN_STRONG_INLINE void pstoreu(int* to, const Packet16i& from) { - EIGEN_DEBUG_UNALIGNED_STORE _mm512_storeu_epi32(to, from); + EIGEN_DEBUG_UNALIGNED_STORE _eigen_mm512_storeu_epi32(to, from); } template <> EIGEN_STRONG_INLINE void pstoreu(int64_t* to, const Packet8l& from) { - EIGEN_DEBUG_UNALIGNED_STORE _mm512_storeu_epi64(to, from); + EIGEN_DEBUG_UNALIGNED_STORE _eigen_mm512_storeu_epi64(to, from); } template <> EIGEN_STRONG_INLINE void pstoreu(float* to, const Packet16f& from, uint16_t umask) { @@ -3019,19 +3067,19 @@ EIGEN_STRONG_INLINE void pstore(numext::int16_t* out, template <> EIGEN_STRONG_INLINE void pstoreu(numext::int16_t* out, const Packet32s& x) { EIGEN_DEBUG_UNALIGNED_STORE - _mm512_storeu_epi32(out, x); + _eigen_mm512_storeu_epi32(out, x); } template <> EIGEN_STRONG_INLINE void pstoreu(numext::int16_t* out, const Packet16s& x) { EIGEN_DEBUG_UNALIGNED_STORE - _mm256_storeu_epi32(out, x); + _eigen_mm256_storeu_epi32(out, x); } template <> EIGEN_STRONG_INLINE void pstoreu(numext::int16_t* out, const Packet8s& x) { EIGEN_DEBUG_UNALIGNED_STORE - _mm_storeu_epi32(out, x); + _eigen_mm_storeu_epi32(out, x); } template <> diff --git a/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h b/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h index fc55fd86..e970d43d 100644 --- a/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h +++ b/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h @@ -52,9 +52,17 @@ struct type_casting_traits : vectorized_type_casting_traits struct type_casting_traits : vectorized_type_casting_traits {}; +EIGEN_STRONG_INLINE __mmask16 _eigen_mm512_cmpneq_ps_mask(__m512 a, __m512 b) { +#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 810) + return _mm512_cmp_ps_mask(a, b, _CMP_NEQ_UQ); +#else + return _mm512_cmpneq_ps_mask(a, b); +#endif +} + template <> EIGEN_STRONG_INLINE Packet16b pcast(const Packet16f& a) { - __mmask16 mask = _mm512_cmpneq_ps_mask(a, pzero(a)); + __mmask16 mask = _eigen_mm512_cmpneq_ps_mask(a, pzero(a)); return _mm512_maskz_cvtepi32_epi8(mask, _mm512_set1_epi32(1)); } From 550d5162eee9d5bfcafc4941c159dccfa9eb8745 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Wed, 7 Oct 2026 07:56:52 -0500 Subject: [PATCH 4/4] Update local diff to contain both Eigen upstream commits --- patches/eigen-5.0.1-stan.diff | 212 +++++++++++++++++++++++++++++++++- 1 file changed, 208 insertions(+), 4 deletions(-) diff --git a/patches/eigen-5.0.1-stan.diff b/patches/eigen-5.0.1-stan.diff index ba8fc4be..eb627af9 100644 --- a/patches/eigen-5.0.1-stan.diff +++ b/patches/eigen-5.0.1-stan.diff @@ -1,9 +1,9 @@ -diff --git o/inst/include/Eigen/src/Core/Fill.h w/inst/include/Eigen/src/Core/Fill.h +diff --git c/inst/include/Eigen/src/Core/Fill.h w/inst/include/Eigen/src/Core/Fill.h index 779ef26..6f45935 100644 ---- o/inst/include/Eigen/src/Core/Fill.h +--- c/inst/include/Eigen/src/Core/Fill.h +++ w/inst/include/Eigen/src/Core/Fill.h @@ -93,8 +93,10 @@ struct eigen_fill_impl { - + template struct eigen_memset_helper { - static constexpr bool value = @@ -13,5 +13,209 @@ index 779ef26..6f45935 100644 + !static_cast(NumTraits::RequireInitialization) && + eigen_fill_helper::value; }; - + template +diff --git c/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h w/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h +index 767e2d5..9feb38f 100644 +--- c/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h ++++ w/inst/include/Eigen/src/Core/arch/AVX/TypeCasting.h +@@ -56,6 +56,40 @@ struct type_casting_traits : vectorized_type_casting_traits(tmp), lo); ++ _mm_storeu_si128(reinterpret_cast<__m128i*>(tmp + 4), hi); ++ return _mm256_loadu_si256(reinterpret_cast(tmp)); ++#endif ++#else ++ return _mm256_set_m128i(hi, lo); ++#endif ++} ++ + template <> + EIGEN_STRONG_INLINE Packet16b pcast(const Packet8f& a, const Packet8f& b) { + __m256 nonzero_a = _mm256_cmp_ps(a, pzero(a), _CMP_NEQ_UQ); +@@ -109,7 +143,7 @@ EIGEN_STRONG_INLINE Packet8i pcast(const Packet8f& a) { + + template <> + EIGEN_STRONG_INLINE Packet8i pcast(const Packet4d& a, const Packet4d& b) { +- return _mm256_set_m128i(_mm256_cvttpd_epi32(b), _mm256_cvttpd_epi32(a)); ++ return _eigen_mm256_set_m128i(_mm256_cvttpd_epi32(b), _mm256_cvttpd_epi32(a)); + } + + template <> +@@ -124,7 +158,7 @@ EIGEN_STRONG_INLINE Packet8f pcast(const Packet8i& a) { + + template <> + EIGEN_STRONG_INLINE Packet8f pcast(const Packet4d& a, const Packet4d& b) { +- return _mm256_set_m128(_mm256_cvtpd_ps(b), _mm256_cvtpd_ps(a)); ++ return _eigen_mm256_set_m128(_mm256_cvtpd_ps(b), _mm256_cvtpd_ps(a)); + } + + template <> +@@ -249,7 +283,7 @@ EIGEN_STRONG_INLINE Packet4d pcast(const Packet4l& a) { + + template <> + EIGEN_STRONG_INLINE Packet4d pcast(const Packet2l& a, const Packet2l& b) { +- return _mm256_set_m128d((pcast(b)), (pcast(a))); ++ return _eigen_mm256_set_m128d((pcast(b)), (pcast(a))); + } + + template <> +diff --git c/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h w/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h +index b76c8a7..baeefa3 100644 +--- c/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h ++++ w/inst/include/Eigen/src/Core/arch/AVX512/PacketMath.h +@@ -44,6 +44,54 @@ typedef eigen_packet_wrapper<__m512i, 6> Packet32s; + typedef eigen_packet_wrapper<__m256i, 6> Packet16s; + typedef eigen_packet_wrapper<__m128i, 6> Packet8s; + ++EIGEN_STRONG_INLINE Packet16i _eigen_mm512_loadu_epi32(const int* from) { ++#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) ++ return _mm512_loadu_si512(reinterpret_cast(from)); ++#else ++ return _mm512_loadu_epi32(from); ++#endif ++} ++ ++EIGEN_STRONG_INLINE Packet16i _eigen_mm512_loadu_epi64(const int64_t* from) { ++#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) ++ return _mm512_loadu_si512(reinterpret_cast(from)); ++#else ++ return _mm512_loadu_epi64(from); ++#endif ++} ++ ++EIGEN_STRONG_INLINE void _eigen_mm512_storeu_epi32(void* to, const Packet16i& from) { ++#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) ++ _mm512_storeu_si512(to, from); ++#else ++ _mm512_storeu_epi32(to, from); ++#endif ++} ++ ++EIGEN_STRONG_INLINE void _eigen_mm512_storeu_epi64(void* to, const Packet16i& from) { ++#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) ++ _mm512_storeu_si512(to, from); ++#else ++ _mm512_storeu_epi64(to, from); ++#endif ++} ++ ++EIGEN_STRONG_INLINE void _eigen_mm256_storeu_epi32(void* to, const __m256i& from) { ++#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) ++ _mm256_storeu_si256(reinterpret_cast<__m256i*>(to), from); ++#else ++ _mm256_storeu_epi32(to, from); ++#endif ++} ++ ++EIGEN_STRONG_INLINE void _eigen_mm_storeu_epi32(void* to, const __m128i& from) { ++#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 1010) ++ _mm_storeu_si128(reinterpret_cast<__m128i*>(to), from); ++#else ++ _mm_storeu_epi32(to, from); ++#endif ++} ++ + template <> + struct is_arithmetic<__m512> { + enum { value = true }; +@@ -1033,11 +1081,11 @@ EIGEN_STRONG_INLINE Packet8d ploadu(const double* from) { + } + template <> + EIGEN_STRONG_INLINE Packet16i ploadu(const int* from) { +- EIGEN_DEBUG_UNALIGNED_LOAD return _mm512_loadu_epi32(from); ++ EIGEN_DEBUG_UNALIGNED_LOAD return _eigen_mm512_loadu_epi32(from); + } + template <> + EIGEN_STRONG_INLINE Packet8l ploadu(const int64_t* from) { +- EIGEN_DEBUG_UNALIGNED_LOAD return _mm512_loadu_epi64(from); ++ EIGEN_DEBUG_UNALIGNED_LOAD return _eigen_mm512_loadu_epi64(from); + } + + template <> +@@ -1158,11 +1206,11 @@ EIGEN_STRONG_INLINE void pstoreu(double* to, const Packet8d& from) { + } + template <> + EIGEN_STRONG_INLINE void pstoreu(int* to, const Packet16i& from) { +- EIGEN_DEBUG_UNALIGNED_STORE _mm512_storeu_epi32(to, from); ++ EIGEN_DEBUG_UNALIGNED_STORE _eigen_mm512_storeu_epi32(to, from); + } + template <> + EIGEN_STRONG_INLINE void pstoreu(int64_t* to, const Packet8l& from) { +- EIGEN_DEBUG_UNALIGNED_STORE _mm512_storeu_epi64(to, from); ++ EIGEN_DEBUG_UNALIGNED_STORE _eigen_mm512_storeu_epi64(to, from); + } + template <> + EIGEN_STRONG_INLINE void pstoreu(float* to, const Packet16f& from, uint16_t umask) { +@@ -3019,19 +3067,19 @@ EIGEN_STRONG_INLINE void pstore(numext::int16_t* out, + template <> + EIGEN_STRONG_INLINE void pstoreu(numext::int16_t* out, const Packet32s& x) { + EIGEN_DEBUG_UNALIGNED_STORE +- _mm512_storeu_epi32(out, x); ++ _eigen_mm512_storeu_epi32(out, x); + } + + template <> + EIGEN_STRONG_INLINE void pstoreu(numext::int16_t* out, const Packet16s& x) { + EIGEN_DEBUG_UNALIGNED_STORE +- _mm256_storeu_epi32(out, x); ++ _eigen_mm256_storeu_epi32(out, x); + } + + template <> + EIGEN_STRONG_INLINE void pstoreu(numext::int16_t* out, const Packet8s& x) { + EIGEN_DEBUG_UNALIGNED_STORE +- _mm_storeu_epi32(out, x); ++ _eigen_mm_storeu_epi32(out, x); + } + + template <> +diff --git c/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h w/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h +index fc55fd8..e970d43 100644 +--- c/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h ++++ w/inst/include/Eigen/src/Core/arch/AVX512/TypeCasting.h +@@ -52,9 +52,17 @@ struct type_casting_traits : vectorized_type_casting_traits + struct type_casting_traits : vectorized_type_casting_traits {}; + ++EIGEN_STRONG_INLINE __mmask16 _eigen_mm512_cmpneq_ps_mask(__m512 a, __m512 b) { ++#if EIGEN_COMP_GNUC && (EIGEN_COMP_CLANG < 1000 || EIGEN_COMP_GNUC < 810) ++ return _mm512_cmp_ps_mask(a, b, _CMP_NEQ_UQ); ++#else ++ return _mm512_cmpneq_ps_mask(a, b); ++#endif ++} ++ + template <> + EIGEN_STRONG_INLINE Packet16b pcast(const Packet16f& a) { +- __mmask16 mask = _mm512_cmpneq_ps_mask(a, pzero(a)); ++ __mmask16 mask = _eigen_mm512_cmpneq_ps_mask(a, pzero(a)); + return _mm512_maskz_cvtepi32_epi8(mask, _mm512_set1_epi32(1)); + }