Mercurial > vec
comparison src/cpu.c @ 34:8b5e0974fd41
Backed out changeset 92156fe32755
author | Paper <paper@tflc.us> |
---|---|
date | Fri, 25 Apr 2025 17:40:46 -0400 |
parents | bf6ad516f1e6 |
children |
comparison
equal
deleted
inserted
replaced
33:4655b49eaf9f | 34:8b5e0974fd41 |
---|---|
42 * 2. Altered source versions must be plainly marked as such, and must not be | 42 * 2. Altered source versions must be plainly marked as such, and must not be |
43 * misrepresented as being the original software. | 43 * misrepresented as being the original software. |
44 * 3. This notice may not be removed or altered from any source distribution. | 44 * 3. This notice may not be removed or altered from any source distribution. |
45 */ | 45 */ |
46 | 46 |
47 #include "vec/vec.h" | |
48 #include "vec/cpu.h" | 47 #include "vec/cpu.h" |
49 | 48 |
50 #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) | 49 #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) |
51 # include <sys/sysctl.h> // For AltiVec check | 50 # include <sys/sysctl.h> // For AltiVec check |
52 #elif defined(__OpenBSD__) && defined(__powerpc__) | 51 #elif defined(__OpenBSD__) && defined(__powerpc__) |
54 # include <sys/sysctl.h> // For AltiVec check | 53 # include <sys/sysctl.h> // For AltiVec check |
55 # include <machine/cpu.h> | 54 # include <machine/cpu.h> |
56 #elif defined(__FreeBSD__) && defined(__powerpc__) | 55 #elif defined(__FreeBSD__) && defined(__powerpc__) |
57 # include <machine/cpu.h> | 56 # include <machine/cpu.h> |
58 # include <sys/auxv.h> | 57 # include <sys/auxv.h> |
59 #elif defined(VEC_COMPILER_HAS_ALTIVEC) | 58 #elif defined(__ALTIVEC__) |
60 # include <signal.h> | 59 # include <signal.h> |
61 # include <setjmp.h> | 60 # include <setjmp.h> |
62 #endif | 61 #endif |
63 | 62 |
64 #ifdef __FreeBSD__ | 63 #ifdef __FreeBSD__ |
309 altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC; | 308 altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC; |
310 #elif defined(VEC_COMPILER_HAS_ALTIVEC) && defined(__GNUC__) | 309 #elif defined(VEC_COMPILER_HAS_ALTIVEC) && defined(__GNUC__) |
311 void (*handler)(int sig); | 310 void (*handler)(int sig); |
312 handler = signal(SIGILL, vec_CPU_illegal_instruction); | 311 handler = signal(SIGILL, vec_CPU_illegal_instruction); |
313 if (!setjmp(vec_jmpbuf)) { | 312 if (!setjmp(vec_jmpbuf)) { |
314 __asm__ __volatile__("mtspr 256, %0\n\t" | 313 vector unsigned char vec; |
315 "vand %%v0, %%v0, %%v0" ::"r"(-1)); | 314 vec_and(vec, vec); |
316 altivec = 1; | 315 altivec = 1; |
317 } | 316 } |
318 signal(SIGILL, handler); | 317 signal(SIGILL, handler); |
319 #endif | 318 #endif |
320 return altivec; | 319 return altivec; |