/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you include this header file into source
files compiled by GCC, this header file does not by itself cause
the resulting executable to be covered by the GNU General Public
License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General
Public License. */
/* Implemented from the specification included in the Intel C++ Compiler
User Guide and Reference, version 8.0. */
#ifndef _EMMINTRIN_H_INCLUDED
#define _EMMINTRIN_H_INCLUDED
#ifdef __SSE2__
#include <xmmintrin.h>
/* SSE2 */
typedef double __v2df __attribute__ ((__vector_size__ (16)));
typedef long long __v2di __attribute__ ((__vector_size__ (16)));
typedef int __v4si __attribute__ ((__vector_size__ (16)));
typedef short __v8hi __attribute__ ((__vector_size__ (16)));
typedef char __v16qi __attribute__ ((__vector_size__ (16)));
typedef __v2di __m128i;
typedef __v2df __m128d;
/* Create a selector for use with the SHUFPD instruction. */
#define _MM_SHUFFLE2(fp1,fp0) \
(((fp1) << 1) | (fp0))
/* Create a vector with element 0 as F and the rest zero. */
static __inline __m128d __attribute__((__always_inline__))
_mm_set_sd (double __F)
{
return __extension__ (__m128d){ __F, 0 };
}
/* Create a vector with both elements equal to F. */
static __inline __m128d __attribute__((__always_inline__))
_mm_set1_pd (double __F)
{
return __extension__ (__m128d){ __F, __F };
}
static __inline __m128d __attribute__((__always_inline__))
_mm_set_pd1 (double __F)
{
return _mm_set1_pd (__F);
}
/* Create a vector with the lower value X and upper value W. */
static __inline __m128d __attribute__((__always_inline__))
_mm_set_pd (double __W, double __X)
{
return __extension__ (__m128d){ __X, __W };
}
/* Create a vector with the lower value W and upper value X. */
static __inline __m128d __attribute__((__always_inline__))
_mm_setr_pd (double __W, double __X)
{
return __extension__ (__m128d){ __W, __X };
}
/* Create a vector of zeros. */
static __inline __m128d __attribute__((__always_inline__))
_mm_setzero_pd (void)
{
return __extension__ (__m128d){ 0.0, 0.0 };
}
/* Sets the low DPFP value of A from the low value of B. */
static __inline __m128d __attribute__((__always_inline__))
_mm_move_sd (__m128d __A, __m128d __B)
{
return (__m128d) __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B);
}
/* Load two DPFP values from P. The address must be 16-byte aligned. */
static __inline __m128d __attribute__((__always_inline__))
_mm_load_pd (double const *__P)
{
return *(__m128d *)__P;
}
/* Load two DPFP values from P. The address need not be 16-byte aligned. */
static __inline __m128d __attribute__((__always_inline__))
_mm_loadu_pd (double const *__P)
{
return __builtin_ia32_loadupd (__P);
}
/* Create a vector with all two elements equal to *P. */
static __inline __m128d __attribute__((__always_inline__))
_mm_load1_pd (double const *__P)
{
return _mm_set1_pd (*__P);
}
/* Create a vector with element 0 as *P and the rest zero. */
static __inline __m128d __attribute__((__always_inline__))
_mm_load_sd (double const *__P)
{
return _mm_set_sd (*__P);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_load_pd1 (double const *__P)
{
return _mm_load1_pd (__P);
}
/* Load two DPFP values in reverse order. The address must be aligned. */
static __inline __m128d __attribute__((__always_inline__))
_mm_loadr_pd (double const *__P)
{
__m128d __tmp = _mm_load_pd (__P);
return __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,1));
}
/* Store two DPFP values. The address must be 16-byte aligned. */
static __inline void __attribute__((__always_inline__))
_mm_store_pd (double *__P, __m128d __A)
{
*(__m128d *)__P = __A;
}
/* Store two DPFP values. The address need not be 16-byte aligned. */
static __inline void __attribute__((__always_inline__))
_mm_storeu_pd (double *__P, __m128d __A)
{
__builtin_ia32_storeupd (__P, __A);
}
/* Stores the lower DPFP value. */
static __inline void __attribute__((__always_inline__))
_mm_store_sd (double *__P, __m128d __A)
{
*__P = __builtin_ia32_vec_ext_v2df (__A, 0);
}
static __inline void __attribute__((__always_inline__))
_mm_storel_pd (double *__P, __m128d __A)
{
_mm_store_sd (__P, __A);
}
/* Stores the upper DPFP value. */
static __inline void __attribute__((__always_inline__))
_mm_storeh_pd (double *__P, __m128d __A)
{
*__P = __builtin_ia32_vec_ext_v2df (__A, 1);
}
/* Store the lower DPFP value across two words.
The address must be 16-byte aligned. */
static __inline void __attribute__((__always_inline__))
_mm_store1_pd (double *__P, __m128d __A)
{
_mm_store_pd (__P, __builtin_ia32_shufpd (__A, __A, _MM_SHUFFLE2 (0,0)));
}
static __inline void __attribute__((__always_inline__))
_mm_store_pd1 (double *__P, __m128d __A)
{
_mm_store1_pd (__P, __A);
}
/* Store two DPFP values in reverse order. The address must be aligned. */
static __inline void __attribute__((__always_inline__))
_mm_storer_pd (double *__P, __m128d __A)
{
_mm_store_pd (__P, __builtin_ia32_shufpd (__A, __A, _MM_SHUFFLE2 (0,1)));
}
static __inline int __attribute__((__always_inline__))
_mm_cvtsi128_si32 (__m128i __A)
{
return __builtin_ia32_vec_ext_v4si ((__v4si)__A, 0);
}
#ifdef __x86_64__
static __inline long long __attribute__((__always_inline__))
_mm_cvtsi128_si64x (__m128i __A)
{
return __builtin_ia32_vec_ext_v2di ((__v2di)__A, 0);
}
#endif
static __inline __m128d __attribute__((__always_inline__))
_mm_add_pd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_addpd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_add_sd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_addsd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_sub_pd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_subpd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_sub_sd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_subsd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_mul_pd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_mulpd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_mul_sd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_mulsd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_div_pd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_divpd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_div_sd (__m128d __A, __m128d __B)
{
return (__m128d)__builtin_ia32_divsd ((__v2df)__A, (__v2df)__B);
}
static __inline __m128d __attribute__((__always_inline__))
_mm_sqrt_pd (__m128d __A)
{
return (__m128d)__builtin_ia32_sqrtpd ((__
- 1
- 2
- 3
- 4
- 5
- 6
前往页