1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

Simplify _mm_roti_epi64 definition

This commit is contained in:
Frank Denis 2023-09-02 15:22:40 +02:00
parent 4ebe29b2e3
commit 503a1ef2c3
3 changed files with 42 additions and 48 deletions

View File

@ -5,10 +5,8 @@
#define LOADU(p) _mm_loadu_si128((const __m128i *) (const void *) (p)) #define LOADU(p) _mm_loadu_si128((const __m128i *) (const void *) (p))
#define STOREU(p, r) _mm_storeu_si128((__m128i *) (void *) (p), r) #define STOREU(p, r) _mm_storeu_si128((__m128i *) (void *) (p), r)
#ifndef __XOP__ // XOP feature set enabled implies _mm_roti_epi64 is existing AFAIK so no need to define the libsodium replacement. #if !(defined(_mm_roti_epi64) && defined(__XOP__))
# ifdef _mm_roti_epi64 // If we have the function macro but not the feature set macro it will fail compiling. #undef _mm_roti_epi64
# undef _mm_roti_epi64 // So we hide the existing one and use the one provided by libsodium. Hiding avoids warnings for macro redefinitions.
# endif
#define _mm_roti_epi64(x, c) \ #define _mm_roti_epi64(x, c) \
(-(c) == 32) \ (-(c) == 32) \
? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1)) \ ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1)) \

View File

@ -5,10 +5,7 @@
#define LOADU(p) _mm_loadu_si128((const __m128i *) (const void *) (p)) #define LOADU(p) _mm_loadu_si128((const __m128i *) (const void *) (p))
#define STOREU(p, r) _mm_storeu_si128((__m128i *) (void *) (p), r) #define STOREU(p, r) _mm_storeu_si128((__m128i *) (void *) (p), r)
#ifndef __XOP__ // XOP feature set enabled implies _mm_roti_epi64 is existing AFAIK so no need to define the libsodium replacement. #if !(defined(_mm_roti_epi64) && defined(__XOP__))
# ifdef _mm_roti_epi64 // If we have the function macro but not the feature set macro it will fail compiling.
# undef _mm_roti_epi64 // So we hide the existing one and use the one provided by libsodium. Hiding avoids warnings for macro redefinitions.
# endif
#define _mm_roti_epi64(x, c) \ #define _mm_roti_epi64(x, c) \
(-(c) == 32) \ (-(c) == 32) \
? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1)) \ ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1)) \

View File

@ -8,10 +8,9 @@
(_mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9)) (_mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9))
#define r24 \ #define r24 \
(_mm_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10)) (_mm_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10))
#ifndef __XOP__ // XOP feature set enabled implies _mm_roti_epi64 is existing AFAIK so no need to define the libsodium replacement.
# ifdef _mm_roti_epi64 // If we have the function macro but not the feature set macro it will fail compiling. #if !(defined(_mm_roti_epi64) && defined(__XOP__))
# undef _mm_roti_epi64 // So we hide the existing one and use the one provided by libsodium. Hiding avoids warnings for macro redefinitions. #undef _mm_roti_epi64
# endif
#define _mm_roti_epi64(x, c) \ #define _mm_roti_epi64(x, c) \
(-(c) == 32) \ (-(c) == 32) \
? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1)) \ ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1)) \