diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-10-17 22:50:45 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-10-17 22:50:45 -0400 |
commit | 7ba8c6bc81f4785162c1f7ede1a0e8e5b95b7c67 (patch) | |
tree | a7b62f2b1964cd2de31f3bc389e4737a608dbe3b /cpu.h | |
parent | f8d97b83ed6d65946570a2ec9d6aa1ac5ff7ce94 (diff) | |
download | cryptopp-git-7ba8c6bc81f4785162c1f7ede1a0e8e5b95b7c67.tar.gz |
Cleanup Altivec and Power7 code paths
This changes the dependency from Altivec to Power7. Internally we needed Power7 but it was cut-in as a pseudo Altivec dependency. Also see http://groups.google.com/forum/#!topic/cryptopp-users/fmEKOG41SG8
Diffstat (limited to 'cpu.h')
-rw-r--r-- | cpu.h | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -407,8 +407,11 @@ void CRYPTOPP_API DetectPowerpcFeatures(); //! \returns true if the hardware is capable of Altivec at runtime, false otherwise.
//! \details Altivec instructions are available under most modern PowerPCs.
//! \details Runtime support requires compile time support. When compiling with GCC, you may
-//! need to compile with <tt>-mcpu=power8</tt>; while IBM XL C/C++ compilers require
-//! <tt>-qarch=pwr8 -qaltivec</tt>. Also see PowerPC's <tt>_ALTIVEC_</tt> preprocessor macro.
+//! need to compile with <tt>-mcpu=power7</tt>; while IBM XL C/C++ compilers require
+//! <tt>-qarch=pwr7 -qaltivec</tt>. Also see PowerPC's <tt>_ALTIVEC_</tt> preprocessor macro.
+//! \details Atilvec was first available on Power4 platforms. However Crypto++ releies on unaligned
+//! loads and stores which is a Power7 feature. If the platform lacks Power7 extensions, then the
+//! GNUmakefile sets <tt>-DCRYPTOPP_DISABLE_ALTIVEC</tt>.
//! \note This function is only available on PowerPC and PowerPC-64 platforms
inline bool HasAltivec()
{
@@ -423,6 +426,26 @@ inline bool HasAltivec() //! \details Runtime support requires compile time support. When compiling with GCC, you may
//! need to compile with <tt>-mcpu=power8</tt>; while IBM XL C/C++ compilers require
//! <tt>-qarch=pwr8 -qaltivec</tt>. Also see PowerPC's <tt>_ALTIVEC_</tt> preprocessor macro.
+//! \details Atilvec was first available on Power4 platforms. However Crypto++ releies on unaligned
+//! loads and stores which is a Power7 feature. If the platform lacks Power7 extensions, then the
+//! GNUmakefile sets <tt>-DCRYPTOPP_DISABLE_ALTIVEC</tt>.
+//! \note This function is only available on PowerPC and PowerPC-64 platforms
+inline bool HasPower7()
+{
+ if (!g_PowerpcDetectionDone)
+ DetectPowerpcFeatures();
+ return g_hasPower7;
+}
+
+//! \brief Determine if a PowerPC processor has Power8 available
+//! \returns true if the hardware is capable of Power8 at runtime, false otherwise.
+//! \details Altivec instructions are available under most modern PowerPCs.
+//! \details Runtime support requires compile time support. When compiling with GCC, you may
+//! need to compile with <tt>-mcpu=power8</tt>; while IBM XL C/C++ compilers require
+//! <tt>-qarch=pwr8 -qaltivec</tt>. Also see PowerPC's <tt>_ALTIVEC_</tt> preprocessor macro.
+//! \details Atilvec was first available on Power4 platforms. However Crypto++ releies on unaligned
+//! loads and stores which is a Power7 feature. If the platform lacks Power7 extensions, then the
+//! GNUmakefile sets <tt>-DCRYPTOPP_DISABLE_ALTIVEC</tt>.
//! \note This function is only available on PowerPC and PowerPC-64 platforms
inline bool HasPower8()
{
|