2 This file is part of PulseAudio.
4 Copyright 2004-2006 Lennart Poettering
5 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
7 PulseAudio is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation; either version 2.1 of the License,
10 or (at your option) any later version.
12 PulseAudio is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with PulseAudio; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 /* First, define HAVE_VECTOR if we have the gcc vector extensions at all */
27 /* || defined(__ALTIVEC__)*/
31 /* This is supposed to be portable to different SIMD instruction
32 * sets. We define vector types for different base types: uint8_t,
33 * int16_t, int32_t, float. The vector type is a union. The fields .i,
34 * .u, .f are arrays for accessing the separate elements of a
35 * vector. .v is a gcc vector type of the right format. .m is the
36 * vector in the type the SIMD extenstion specific intrinsics API
37 * expects. PA_xxx_VECTOR_SIZE is the size of the
38 * entries. PA_xxxx_VECTOR_MAKE constructs a gcc vector variable with
39 * the same value in all elements. */
43 #include <xmmintrin.h>
44 #include <emmintrin.h>
46 #define PA_UINT8_VECTOR_SIZE 16
47 #define PA_INT16_VECTOR_SIZE 8
48 #define PA_INT32_VECTOR_SIZE 4
49 #define PA_FLOAT_VECTOR_SIZE 4
51 #define PA_UINT8_VECTOR_MAKE(x) (pa_v16qi) { x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x }
52 #define PA_INT16_VECTOR_MAKE(x) (pa_v8hi) { x, x, x, x, x, x, x, x }
53 #define PA_INT32_VECTOR_MAKE(x) (pa_v4si) { x, x, x, x }
54 #define PA_FLOAT_VECTOR_MAKE(x) (pa_v4fi) { x, x, x, x }
59 typedef uint8_t pa_v16qi
__attribute__ ((vector_size (PA_UINT8_VECTOR_SIZE
* sizeof(uint8_t))));
60 typedef union pa_uint8_vector
{
61 uint8_t u
[PA_UINT8_VECTOR_SIZE
];
69 typedef int16_t pa_v8hi
__attribute__ ((vector_size (PA_INT16_VECTOR_SIZE
* sizeof(int16_t))));
70 typedef union pa_int16_vector
{
71 int16_t i
[PA_INT16_VECTOR_SIZE
];
79 typedef int32_t pa_v4si
__attribute__ ((vector_size (PA_INT32_VECTOR_SIZE
* sizeof(int32_t))));
80 typedef union pa_int32_vector
{
81 int32_t i
[PA_INT32_VECTOR_SIZE
];
89 typedef float pa_v4sf
__attribute__ ((vector_size (PA_FLOAT_VECTOR_SIZE
* sizeof(float))));
90 typedef union pa_float_vector
{
91 float f
[PA_FLOAT_VECTOR_SIZE
];