1#ifndef sse2_64_32_H 2#define sse2_64_32_H 1 3 4#include "common.h" 5 6#ifdef HAVE_INTRIN_H 7# include <intrin.h> 8#endif 9 10#if defined(HAVE_EMMINTRIN_H) && \ 11 !(defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || \ 12 defined(_M_X64) || defined(_M_AMD64)) 13 14# include <emmintrin.h> 15# include <stdint.h> 16 17# ifndef _mm_set_epi64x 18# define _mm_set_epi64x(Q0, Q1) sodium__mm_set_epi64x((Q0), (Q1)) 19static inline __m128i 20sodium__mm_set_epi64x(int64_t q1, int64_t q0) 21{ 22 union { int64_t as64; int32_t as32[2]; } x0, x1; 23 x0.as64 = q0; x1.as64 = q1; 24 return _mm_set_epi32(x1.as32[1], x1.as32[0], x0.as32[1], x0.as32[0]); 25} 26# endif 27 28# ifndef _mm_set1_epi64x 29# define _mm_set1_epi64x(Q) sodium__mm_set1_epi64x(Q) 30static inline __m128i 31sodium__mm_set1_epi64x(int64_t q) 32{ 33 return _mm_set_epi64x(q, q); 34} 35# endif 36 37# ifndef _mm_cvtsi64_si128 38# define _mm_cvtsi64_si128(Q) sodium__mm_cvtsi64_si128(Q) 39static inline __m128i 40sodium__mm_cvtsi64_si128(int64_t q) 41{ 42 union { int64_t as64; int32_t as32[2]; } x; 43 x.as64 = q; 44 return _mm_setr_epi32(x.as32[0], x.as32[1], 0, 0); 45} 46# endif 47 48#endif 49 50#endif 51