Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.8/simd-support/vsx.c @ 167:bd3cc4d1df30
Add FFTW 3.3.8 source, and a Linux build
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 19 Nov 2019 14:52:55 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
166:cbd6d7e562c7 | 167:bd3cc4d1df30 |
---|---|
1 /* | |
2 * Copyright (c) 2003, 2007-14 Matteo Frigo | |
3 * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology | |
4 * | |
5 * VSX SIMD implementation added 2015 Erik Lindahl. | |
6 * Erik Lindahl places his modifications in the public domain. | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
21 * | |
22 */ | |
23 | |
24 | |
25 #include "kernel/ifftw.h" | |
26 | |
27 #if HAVE_VSX | |
28 | |
29 #if HAVE_SYS_SYSCTL_H | |
30 # include <sys/sysctl.h> | |
31 #endif | |
32 | |
33 #include <signal.h> | |
34 #include <setjmp.h> | |
35 | |
36 static jmp_buf jb; | |
37 | |
38 static void sighandler(int x) | |
39 { | |
40 longjmp(jb, 1); | |
41 } | |
42 | |
43 static int really_have_vsx(void) | |
44 { | |
45 void (*oldsig)(int); | |
46 oldsig = signal(SIGILL, sighandler); | |
47 if (setjmp(jb)) { | |
48 signal(SIGILL, oldsig); | |
49 return 0; | |
50 } else { | |
51 float mem[2]; | |
52 __asm__ __volatile__ ("stxsdx 0,0,%0" :: "r" (mem) : "memory" ); | |
53 signal(SIGILL, oldsig); | |
54 return 1; | |
55 } | |
56 return 0; | |
57 } | |
58 | |
59 int X(have_simd_vsx)(void) | |
60 { | |
61 static int init = 0, res; | |
62 if (!init) { | |
63 res = really_have_vsx(); | |
64 init = 1; | |
65 } | |
66 return res; | |
67 } | |
68 | |
69 #endif |