Bugzilla – Attachment 514 Details for
Bug 907
ARMv8 NEON compile errors (using both Android NDK & Xcode)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
[patch]
Two patches--new gcc version macro and NEON workaround
eigen_macro.patch (text/plain), 4.75 KB, created by
Tim Murray
on 2015-01-06 00:57:32 UTC
(
hide
)
Description:
Two patches--new gcc version macro and NEON workaround
Filename:
MIME Type:
Creator:
Tim Murray
Created:
2015-01-06 00:57:32 UTC
Size:
4.75 KB
patch
obsolete
># HG changeset patch ># User Tim Murray <timmurray@google.com> ># Date 1420501426 28800 ># Mon Jan 05 15:43:46 2015 -0800 ># Node ID 5c57aecfa8d281e624c7e50f9c65e2232ff5f666 ># Parent 80ff8707665ab092dda76db312c18310b8473c98 >Add macro to determine gcc version at patch level granularity. > >diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h >--- a/Eigen/src/Core/util/Macros.h >+++ b/Eigen/src/Core/util/Macros.h >@@ -102,25 +102,31 @@ > > /// \internal EIGEN_GNUC_STRICT set to 1 if the compiler is really GCC and not a compatible compiler (e.g., ICC, clang, mingw, etc.) > #if EIGEN_COMP_GNUC && !(EIGEN_COMP_CLANG || EIGEN_COMP_CLANG || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM ) > #define EIGEN_COMP_GNUC_STRICT 1 > #else > #define EIGEN_COMP_GNUC_STRICT 0 > #endif > >- > #if EIGEN_COMP_GNUC > #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x) > #define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x) > #define EIGEN_GNUC_AT(x,y) ( __GNUC__==x && __GNUC_MINOR__==y ) >+ #define EIGEN_GNUC_AT_LEAST(x,y,z) ((__GNUC__==x && __GNUC_MINOR__>=y && __GNUC_PATCHLEVEL__>=z ) || __GNUC__>x) >+ #define EIGEN_GNUC_AT_MOST(x,y,z) ((__GNUC__==x && __GNUC_MINOR__<=y && __GNUC_PATCHLEVEL__<=z ) || __GNUC__<x) >+ #define EIGEN_GNUC_AT(x,y,z) ( __GNUC__==x && __GNUC_MINOR__==y && __GNUC_PATCHLEVEL__==z ) >+ > #else > #define EIGEN_GNUC_AT_LEAST(x,y) 0 > #define EIGEN_GNUC_AT_MOST(x,y) 0 > #define EIGEN_GNUC_AT(x,y) 0 >+ #define EIGEN_GNUC_AT_LEAST(x,y,z) 0 >+ #define EIGEN_GNUC_AT_MOST(x,y,z) 0 >+ #define EIGEN_GNUC_AT(x,y,z) 0 > #endif > > // FIXME: could probably be removed as we do not support gcc 3.x anymore > #if EIGEN_COMP_GNUC && (__GNUC__ <= 3) > #define EIGEN_GCC3_OR_OLDER 1 > #else > #define EIGEN_GCC3_OR_OLDER 0 > #endif ># HG changeset patch ># User Tim Murray <timmurray@google.com> ># Date 1420501778 28800 ># Mon Jan 05 15:49:38 2015 -0800 ># Node ID 246d74b505d4f8d3e51af99aa229aff88e81f5d9 ># Parent 5c57aecfa8d281e624c7e50f9c65e2232ff5f666 >Add vector float64x1-friendly implementations for AArch64. > >gcc 4.9.0 through 4.9.2 incorrectly typedef'd float64x1_t to a >scalar float64_t, while gcc 4.9.3+ and clang typedef this to a >1-vector float64_t as specified by the AAPCS64 ABI. This adds >a workaround to allow gcc 4.9.0 through 4.9.2 to work while >fixing clang and future gcc versions as well. > >diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h >--- a/Eigen/src/Core/arch/NEON/PacketMath.h >+++ b/Eigen/src/Core/arch/NEON/PacketMath.h >@@ -592,34 +592,45 @@ template<> EIGEN_STRONG_INLINE void pref > > // FIXME only store the 2 first elements ? > template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { return vgetq_lane_f64(a, 0); } > > template<> EIGEN_STRONG_INLINE Packet2d preverse(const Packet2d& a) { return vcombine_f64(vget_high_f64(a), vget_low_f64(a)); } > > template<> EIGEN_STRONG_INLINE Packet2d pabs(const Packet2d& a) { return vabsq_f64(a); } > >+// FIXME: gcc 4.9.2 and below handle float64x1_t as a float64_t, not a vector of float64_t >+// clang always handles it as a vector >+#if EIGEN_GNUC_PATCH_AT_MOST(4,9,2) > template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a) { return vget_low_f64(a) + vget_high_f64(a); } >+#else >+template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a) { return (vget_low_f64(a) + vget_high_f64(a))[0]; } >+#endif > > template<> EIGEN_STRONG_INLINE Packet2d preduxp<Packet2d>(const Packet2d* vecs) > { > float64x2_t trn1, trn2; > > // NEON zip performs interleaving of the supplied vectors. > // We perform two interleaves in a row to acquire the transposed vector > trn1 = vzip1q_f64(vecs[0], vecs[1]); > trn2 = vzip2q_f64(vecs[0], vecs[1]); > > // Do the addition of the resulting vectors > return vaddq_f64(trn1, trn2); > } > // Other reduction functions: > // mul >+// FIXME: gcc 4.9.2 and below handle float64x1_t as a float64_t, not a vector of float64_t >+// clang always handles it as a vector >+#if EIGEN_GNUC_PATCH_AT_MOST(4,9,2) > template<> EIGEN_STRONG_INLINE double predux_mul<Packet2d>(const Packet2d& a) { return vget_low_f64(a) * vget_high_f64(a); } >- >+#else >+template<> EIGEN_STRONG_INLINE double predux_mul<Packet2d>(const Packet2d& a) { return (vget_low_f64(a) * vget_high_f64(a))[0]; } >+#endif > // min > template<> EIGEN_STRONG_INLINE double predux_min<Packet2d>(const Packet2d& a) { return vgetq_lane_f64(vpminq_f64(a, a), 0); } > > // max > template<> EIGEN_STRONG_INLINE double predux_max<Packet2d>(const Packet2d& a) { return vgetq_lane_f64(vpmaxq_f64(a, a), 0); } > > // this PALIGN_NEON business is to work around a bug in LLVM Clang 3.0 causing incorrect compilation errors, > // see bug 347 and this LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=11074
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 907
: 514