diff options
author | Jeffrey Walton <noloader@gmail.com> | 2020-08-06 21:11:34 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2020-08-06 21:11:34 -0400 |
commit | 59ba8790dc4fb485876f5f2310e0ea043daea88b (patch) | |
tree | 2a276505eb428736994b55bca8f1fdee2749df34 /config_align.h | |
parent | 47b38d8a6bcbb63bf0b9ad520198bb8eab2b8241 (diff) | |
download | cryptopp-git-59ba8790dc4fb485876f5f2310e0ea043daea88b.tar.gz |
Update comments in config_align.h
Diffstat (limited to 'config_align.h')
-rw-r--r-- | config_align.h | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/config_align.h b/config_align.h index 7477e289..0f2d0b34 100644 --- a/config_align.h +++ b/config_align.h @@ -15,12 +15,18 @@ #ifndef CRYPTOPP_CONFIG_ALIGN_H
#define CRYPTOPP_CONFIG_ALIGN_H
-#include "config_cpu.h"
-#include "config_cxx.h"
-#include "config_ver.h"
+#include "config_asm.h" // CRYPTOPP_DISABLE_ASM
+#include "config_cpu.h" // X86, X32, X64, ARM32, ARM64, etc
+#include "config_cxx.h" // CRYPTOPP_CXX11_ALIGNAS
+#include "config_ver.h" // Compiler versions
-// Nearly all Intel's and AMD's have SSE. Enable it independent of SSE ASM and intrinscs
-#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM)
+// Nearly all Intel's and AMD's have SSE. Enable it independent of SSE ASM and intrinscs.
+// ARM NEON and ARMv8 ASIMD only need natural alignment of an element in the vector.
+// Altivec through POWER7 need vector alignment. POWER8 and POWER9 relax the requirement.
+#if defined(CRYPTOPP_DISABLE_ASM)
+ #define CRYPTOPP_BOOL_ALIGN16 0
+#elif (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || \
+ CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
#define CRYPTOPP_BOOL_ALIGN16 1
#else
#define CRYPTOPP_BOOL_ALIGN16 0
@@ -44,18 +50,16 @@ // IBM XL C/C++ alignment modifier per Optimization Guide, pp. 19-20.
// __IBM_ATTRIBUTES per XLC 12.1 AIX Compiler Manual, p. 473.
// CRYPTOPP_ALIGN_DATA may not be reliable on AIX.
-#ifndef CRYPTOPP_ALIGN_DATA
- #if defined(CRYPTOPP_CXX11_ALIGNAS)
- #define CRYPTOPP_ALIGN_DATA(x) alignas(x)
- #elif defined(_MSC_VER)
- #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
- #elif defined(__GNUC__) || defined(__clang__) || (__SUNPRO_CC >= 0x5100)
- #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
- #elif defined(__xlc__) || defined(__xlC__)
- #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
- #else
- #define CRYPTOPP_ALIGN_DATA(x)
- #endif
+#if defined(CRYPTOPP_CXX11_ALIGNAS)
+ #define CRYPTOPP_ALIGN_DATA(x) alignas(x)
+#elif defined(_MSC_VER)
+ #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
+#elif defined(__GNUC__) || defined(__clang__) || (__SUNPRO_CC >= 0x5100)
+ #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
+#elif defined(__xlc__) || defined(__xlC__)
+ #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
+#else
+ #define CRYPTOPP_ALIGN_DATA(x)
#endif
#endif // CRYPTOPP_CONFIG_ALIGN_H
|