mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-27 11:50:29 +00:00
Fix PPC64 compile with Clang 3.8 on Little Endian machines
Lets see what this breaks. Clang is a bane in the PowerPC world. Its stupid preprocessor define tricks create more work than it is worth.
This commit is contained in:
parent
d75bce40ec
commit
3a8d45b5e3
52
ppc_simd.h
52
ppc_simd.h
@ -95,10 +95,18 @@
|
|||||||
// https://www-01.ibm.com/support/docview.wss?uid=swg21683541.
|
// https://www-01.ibm.com/support/docview.wss?uid=swg21683541.
|
||||||
|
|
||||||
#if defined(__xlc__) && (__xlc__ < 0x0d01)
|
#if defined(__xlc__) && (__xlc__ < 0x0d01)
|
||||||
# define __early_xlc__ 1
|
# define early_xlc 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__xlC__) && (__xlC__ < 0x0d01)
|
#if defined(__xlC__) && (__xlC__ < 0x0d01)
|
||||||
# define __early_xlC__ 1
|
# define early_xlC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Clang did not add vec_xl for little endian until November 2016
|
||||||
|
// via https://reviews.llvm.org/D26519 . The release coincides
|
||||||
|
// with roughly Clang 4.0 released March 2017. There is a
|
||||||
|
// Clang 3.9.1 release, but it is not clear of vec_xl made it.
|
||||||
|
#if defined(__clang__) && (__clang_major__ >= 4)
|
||||||
|
# define later_clang 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VecLoad_ALTIVEC and VecStore_ALTIVEC are
|
// VecLoad_ALTIVEC and VecStore_ALTIVEC are
|
||||||
@ -253,9 +261,9 @@ inline uint32x4_p VecLoad_ALTIVEC(int off, const byte src[16])
|
|||||||
inline uint32x4_p VecLoad(const byte src[16])
|
inline uint32x4_p VecLoad(const byte src[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
return (uint32x4_p)vec_xlw4(0, (byte*)src);
|
return (uint32x4_p)vec_xlw4(0, (byte*)src);
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
return (uint32x4_p)vec_xl(0, (byte*)src);
|
return (uint32x4_p)vec_xl(0, (byte*)src);
|
||||||
# else
|
# else
|
||||||
return (uint32x4_p)vec_vsx_ld(0, (byte*)src);
|
return (uint32x4_p)vec_vsx_ld(0, (byte*)src);
|
||||||
@ -281,9 +289,9 @@ inline uint32x4_p VecLoad(const byte src[16])
|
|||||||
inline uint32x4_p VecLoad(int off, const byte src[16])
|
inline uint32x4_p VecLoad(int off, const byte src[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
return (uint32x4_p)vec_xlw4(off, (byte*)src);
|
return (uint32x4_p)vec_xlw4(off, (byte*)src);
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
return (uint32x4_p)vec_xl(off, (byte*)src);
|
return (uint32x4_p)vec_xl(off, (byte*)src);
|
||||||
# else
|
# else
|
||||||
return (uint32x4_p)vec_vsx_ld(off, (byte*)src);
|
return (uint32x4_p)vec_vsx_ld(off, (byte*)src);
|
||||||
@ -383,9 +391,9 @@ inline uint64x2_p VecLoad(int off, const word64 src[2])
|
|||||||
inline uint32x4_p VecLoadAligned(const byte src[16])
|
inline uint32x4_p VecLoadAligned(const byte src[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
return (uint32x4_p)vec_xlw4(0, (byte*)src);
|
return (uint32x4_p)vec_xlw4(0, (byte*)src);
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
return (uint32x4_p)vec_xl(0, (byte*)src);
|
return (uint32x4_p)vec_xl(0, (byte*)src);
|
||||||
# else
|
# else
|
||||||
return (uint32x4_p)vec_vsx_ld(0, (byte*)src);
|
return (uint32x4_p)vec_vsx_ld(0, (byte*)src);
|
||||||
@ -411,9 +419,9 @@ inline uint32x4_p VecLoadAligned(const byte src[16])
|
|||||||
inline uint32x4_p VecLoadAligned(int off, const byte src[16])
|
inline uint32x4_p VecLoadAligned(int off, const byte src[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
return (uint32x4_p)vec_xlw4(off, (byte*)src);
|
return (uint32x4_p)vec_xlw4(off, (byte*)src);
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
return (uint32x4_p)vec_xl(off, (byte*)src);
|
return (uint32x4_p)vec_xl(off, (byte*)src);
|
||||||
# else
|
# else
|
||||||
return (uint32x4_p)vec_vsx_ld(off, (byte*)src);
|
return (uint32x4_p)vec_vsx_ld(off, (byte*)src);
|
||||||
@ -440,13 +448,13 @@ inline uint32x4_p VecLoadAligned(int off, const byte src[16])
|
|||||||
inline uint32x4_p VecLoadBE(const byte src[16])
|
inline uint32x4_p VecLoadBE(const byte src[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
return (uint32x4_p)vec_xlw4(0, (byte*)src);
|
return (uint32x4_p)vec_xlw4(0, (byte*)src);
|
||||||
# else
|
# else
|
||||||
return (uint32x4_p)VecReverse(vec_xlw4(0, (byte*)src));
|
return (uint32x4_p)VecReverse(vec_xlw4(0, (byte*)src));
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
return (uint32x4_p)vec_xl_be(0, (byte*)src);
|
return (uint32x4_p)vec_xl_be(0, (byte*)src);
|
||||||
# else
|
# else
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
@ -481,13 +489,13 @@ inline uint32x4_p VecLoadBE(const byte src[16])
|
|||||||
inline uint32x4_p VecLoadBE(int off, const byte src[16])
|
inline uint32x4_p VecLoadBE(int off, const byte src[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
return (uint32x4_p)vec_xlw4(off, (byte*)src);
|
return (uint32x4_p)vec_xlw4(off, (byte*)src);
|
||||||
# else
|
# else
|
||||||
return (uint32x4_p)VecReverse(vec_xlw4(off, (byte*)src));
|
return (uint32x4_p)VecReverse(vec_xlw4(off, (byte*)src));
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
return (uint32x4_p)vec_xl_be(off, (byte*)src);
|
return (uint32x4_p)vec_xl_be(off, (byte*)src);
|
||||||
# else
|
# else
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
@ -605,9 +613,9 @@ template<class T>
|
|||||||
inline void VecStore(const T data, byte dest[16])
|
inline void VecStore(const T data, byte dest[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
vec_xstw4((uint8x16_p)data, 0, (byte*)dest);
|
vec_xstw4((uint8x16_p)data, 0, (byte*)dest);
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
vec_xst((uint8x16_p)data, 0, (byte*)dest);
|
vec_xst((uint8x16_p)data, 0, (byte*)dest);
|
||||||
# else
|
# else
|
||||||
vec_vsx_st((uint8x16_p)data, 0, (byte*)dest);
|
vec_vsx_st((uint8x16_p)data, 0, (byte*)dest);
|
||||||
@ -636,9 +644,9 @@ template<class T>
|
|||||||
inline void VecStore(const T data, int off, byte dest[16])
|
inline void VecStore(const T data, int off, byte dest[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
vec_xstw4((uint8x16_p)data, off, (byte*)dest);
|
vec_xstw4((uint8x16_p)data, off, (byte*)dest);
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
vec_xst((uint8x16_p)data, off, (byte*)dest);
|
vec_xst((uint8x16_p)data, off, (byte*)dest);
|
||||||
# else
|
# else
|
||||||
vec_vsx_st((uint8x16_p)data, off, (byte*)dest);
|
vec_vsx_st((uint8x16_p)data, off, (byte*)dest);
|
||||||
@ -751,13 +759,13 @@ template <class T>
|
|||||||
inline void VecStoreBE(const T data, byte dest[16])
|
inline void VecStoreBE(const T data, byte dest[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
vec_xstw4((uint8x16_p)data, 0, (byte*)dest);
|
vec_xstw4((uint8x16_p)data, 0, (byte*)dest);
|
||||||
# else
|
# else
|
||||||
vec_xstw4((uint8x16_p)VecReverse(data), 0, (byte*)dest);
|
vec_xstw4((uint8x16_p)VecReverse(data), 0, (byte*)dest);
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
vec_xst_be((uint8x16_p)data, 0, (byte*)dest);
|
vec_xst_be((uint8x16_p)data, 0, (byte*)dest);
|
||||||
# else
|
# else
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
@ -795,13 +803,13 @@ template <class T>
|
|||||||
inline void VecStoreBE(const T data, int off, byte dest[16])
|
inline void VecStoreBE(const T data, int off, byte dest[16])
|
||||||
{
|
{
|
||||||
#if defined(_ARCH_PWR8)
|
#if defined(_ARCH_PWR8)
|
||||||
# if defined(__early_xlc__) || defined(__early_xlC__)
|
# if defined(early_xlc) || defined(early_xlC)
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
vec_xstw4((uint8x16_p)data, off, (byte*)dest);
|
vec_xstw4((uint8x16_p)data, off, (byte*)dest);
|
||||||
# else
|
# else
|
||||||
vec_xstw4((uint8x16_p)VecReverse(data), off, (byte*)dest);
|
vec_xstw4((uint8x16_p)VecReverse(data), off, (byte*)dest);
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__xlc__) || defined(__xlC__) || defined(__clang__)
|
# elif defined(__xlc__) || defined(__xlC__) || defined(later_clang)
|
||||||
vec_xst_be((uint8x16_p)data, off, (byte*)dest);
|
vec_xst_be((uint8x16_p)data, off, (byte*)dest);
|
||||||
# else
|
# else
|
||||||
# if (CRYPTOPP_BIG_ENDIAN)
|
# if (CRYPTOPP_BIG_ENDIAN)
|
||||||
|
Loading…
Reference in New Issue
Block a user