Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.3/simd-support/simd-common.h @ 10:37bf6b4a2645
Add FFTW3
author | Chris Cannam |
---|---|
date | Wed, 20 Mar 2013 15:35:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:c0fb53affa76 | 10:37bf6b4a2645 |
---|---|
1 /* | |
2 * Copyright (c) 2003, 2007-11 Matteo Frigo | |
3 * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License as published by | |
7 * the Free Software Foundation; either version 2 of the License, or | |
8 * (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with this program; if not, write to the Free Software | |
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 * | |
19 */ | |
20 | |
21 /* detection of alignment. This is complicated because a machine may | |
22 support multiple SIMD extensions (e.g. SSE2 and AVX) but only one | |
23 set of alignment contraints. So this alignment stuff cannot be | |
24 defined in the SIMD header files. Rather than defining a separate | |
25 set of "machine" header files, we just do this ugly ifdef here. */ | |
26 #if defined(HAVE_SSE2) || defined(HAVE_AVX) | |
27 # if defined(FFTW_SINGLE) | |
28 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */ | |
29 # define ALIGNMENTA 16 /* Alignment for the LDA/STA macros */ | |
30 # else | |
31 # define ALIGNMENT 16 /* Alignment for the LD/ST macros */ | |
32 # define ALIGNMENTA 16 /* Alignment for the LDA/STA macros */ | |
33 # endif | |
34 #elif defined(HAVE_ALTIVEC) | |
35 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */ | |
36 # define ALIGNMENTA 16 /* Alignment for the LDA/STA macros */ | |
37 #elif defined(HAVE_NEON) | |
38 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */ | |
39 # define ALIGNMENTA 8 /* Alignment for the LDA/STA macros */ | |
40 #endif | |
41 | |
42 #if HAVE_SIMD | |
43 # ifndef ALIGNMENT | |
44 # error "ALIGNMENT not defined" | |
45 # endif | |
46 # ifndef ALIGNMENTA | |
47 # error "ALIGNMENTA not defined" | |
48 # endif | |
49 #endif | |
50 | |
51 /* rename for precision and for SIMD extensions */ | |
52 #define XSIMD0(name, suffix) CONCAT(name, suffix) | |
53 #define XSIMD(name) XSIMD0(X(name), SIMD_SUFFIX) | |
54 #define XSIMD_STRING(x) x STRINGIZE(SIMD_SUFFIX) | |
55 | |
56 /* TAINT_BIT is set if pointers are not guaranteed to be multiples of | |
57 ALIGNMENT */ | |
58 #define TAINT_BIT 1 | |
59 | |
60 /* TAINT_BITA is set if pointers are not guaranteed to be multiples of | |
61 ALIGNMENTA */ | |
62 #define TAINT_BITA 2 | |
63 | |
64 #define PTRINT(p) ((uintptr_t)(p)) | |
65 | |
66 #define ALIGNED(p) \ | |
67 (((PTRINT(UNTAINT(p)) % ALIGNMENT) == 0) && !(PTRINT(p) & TAINT_BIT)) | |
68 | |
69 #define ALIGNEDA(p) \ | |
70 (((PTRINT(UNTAINT(p)) % ALIGNMENTA) == 0) && !(PTRINT(p) & TAINT_BITA)) | |
71 | |
72 #define SIMD_STRIDE_OK(x) (!(((x) * sizeof(R)) % ALIGNMENT)) | |
73 #define SIMD_STRIDE_OKA(x) (!(((x) * sizeof(R)) % ALIGNMENTA)) | |
74 #define SIMD_VSTRIDE_OK SIMD_STRIDE_OK | |
75 |