Mercurial > vec
diff src/cpu.c @ 25:92156fe32755
impl/ppc/altivec: update to new implementation
the signed average function is wrong; it needs to round up the number
when only one of them is odd, but that doesn't necessarily seem to be
true because altivec is weird, and that's what we need to emulate the
quirks for. ugh.
also the altivec backend uses the generic functions instead of fallbacks
because it does indeed use the exact same memory structure as the generic
implementation...
author | Paper <paper@tflc.us> |
---|---|
date | Sun, 24 Nov 2024 11:15:59 +0000 |
parents | e26874655738 |
children |
line wrap: on
line diff
--- a/src/cpu.c Sun Nov 24 03:32:53 2024 -0500 +++ b/src/cpu.c Sun Nov 24 11:15:59 2024 +0000 @@ -44,6 +44,7 @@ * 3. This notice may not be removed or altered from any source distribution. */ +#include "vec/vec.h" #include "vec/cpu.h" #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) @@ -55,7 +56,7 @@ #elif defined(__FreeBSD__) && defined(__powerpc__) # include <machine/cpu.h> # include <sys/auxv.h> -#elif defined(__ALTIVEC__) +#elif defined(VEC_COMPILER_HAS_ALTIVEC) # include <signal.h> # include <setjmp.h> #endif @@ -310,8 +311,8 @@ void (*handler)(int sig); handler = signal(SIGILL, vec_CPU_illegal_instruction); if (!setjmp(vec_jmpbuf)) { - vector unsigned char vec; - vec_and(vec, vec); + __asm__ __volatile__("mtspr 256, %0\n\t" + "vand %%v0, %%v0, %%v0" ::"r"(-1)); altivec = 1; } signal(SIGILL, handler); @@ -494,4 +495,4 @@ vec_CPU_features |= VEC_CPU_HAS_NEON; } return vec_CPU_features; -} \ No newline at end of file +}