Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.3/simd-support/neon.c @ 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 | |
22 #include "ifftw.h" | |
23 | |
24 #if HAVE_NEON | |
25 | |
26 /* check for an environment where signals are known to work */ | |
27 #if defined(unix) || defined(linux) | |
28 # include <signal.h> | |
29 # include <setjmp.h> | |
30 | |
31 static jmp_buf jb; | |
32 | |
33 static void sighandler(int x) | |
34 { | |
35 UNUSED(x); | |
36 longjmp(jb, 1); | |
37 } | |
38 | |
39 static int really_have_neon(void) | |
40 { | |
41 void (*oldsig)(int); | |
42 oldsig = signal(SIGILL, sighandler); | |
43 if (setjmp(jb)) { | |
44 signal(SIGILL, oldsig); | |
45 return 0; | |
46 } else { | |
47 /* paranoia: encode the instruction in binary because the | |
48 assembler may not recognize it without -mfpu=neon */ | |
49 /*asm volatile ("vand q0, q0, q0");*/ | |
50 asm volatile (".long 0xf2000150"); | |
51 signal(SIGILL, oldsig); | |
52 return 1; | |
53 } | |
54 } | |
55 | |
56 extern void X(check_alignment_of_sse2_pm)(void); | |
57 | |
58 int X(have_simd_neon)(void) | |
59 { | |
60 static int init = 0, res; | |
61 | |
62 if (!init) { | |
63 res = really_have_neon(); | |
64 init = 1; | |
65 } | |
66 return res; | |
67 } | |
68 | |
69 | |
70 #else | |
71 /* don't know how to autodetect NEON; assume it is present */ | |
72 int X(have_simd_neon)(void) | |
73 { | |
74 return 1; | |
75 } | |
76 #endif | |
77 | |
78 #endif |