13#if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
17#ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY
22#ifndef EXCEPTION_EXECUTE_HANDLER
23# define EXCEPTION_EXECUTE_HANDLER 1
27extern const char PPC_SIMD_FNAME[] = __FILE__;
29NAMESPACE_BEGIN(CryptoPP)
31#ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY
33 typedef void (*SigHandler)(int);
35 static jmp_buf s_jmpSIGILL;
36 static void SigIllHandler(
int)
38 longjmp(s_jmpSIGILL, 1);
43#if (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
44bool CPU_ProbeAltivec()
46#if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES)
48#elif (_ARCH_PWR3) && (CRYPTOPP_ALTIVEC_AVAILABLE)
49# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
53 volatile int result =
true;
55 volatile SigHandler oldHandler = signal(SIGILL, SigIllHandler);
56 if (oldHandler == SIG_ERR)
59 volatile sigset_t oldMask;
60 if (sigprocmask(0, NULLPTR, (sigset_t*)&oldMask))
62 signal(SIGILL, oldHandler);
66 if (setjmp(s_jmpSIGILL))
70 CRYPTOPP_ALIGN_DATA(16)
71 const
byte b1[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
72 CRYPTOPP_ALIGN_DATA(16)
73 const
byte b2[16] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
74 CRYPTOPP_ALIGN_DATA(16)
byte b3[16];
77 const uint8x16_p v1 = (uint8x16_p)vec_ld(0, (
byte*)b1);
78 const uint8x16_p v2 = (uint8x16_p)vec_ld(0, (
byte*)b2);
79 const uint8x16_p v3 = (uint8x16_p)VecXor(v1, v2);
82 result = (0 == std::memcmp(b2, b3, 16));
85 sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULLPTR);
86 signal(SIGILL, oldHandler);
Library configuration file.
unsigned char byte
8-bit unsigned datatype
Support functions for PowerPC and vector operations.