summaryrefslogtreecommitdiff
path: root/cpu.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-10-17 22:50:45 -0400
committerJeffrey Walton <noloader@gmail.com>2017-10-17 22:50:45 -0400
commit7ba8c6bc81f4785162c1f7ede1a0e8e5b95b7c67 (patch)
treea7b62f2b1964cd2de31f3bc389e4737a608dbe3b /cpu.h
parentf8d97b83ed6d65946570a2ec9d6aa1ac5ff7ce94 (diff)
downloadcryptopp-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.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/cpu.h b/cpu.h
index 35710a93..66336489 100644
--- a/cpu.h
+++ b/cpu.h
@@ -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()
{