comparison src/cpuinfo/SDL_cpuinfo.c @ 795:275708f2e838

Check for altivec assembly support before trying to use it. :)
author Sam Lantinga <slouken@libsdl.org>
date Thu, 29 Jan 2004 16:15:12 +0000
parents c20f08c4f437
children dec19b813b04
comparison
equal deleted inserted replaced
794:a5defa3b93e1 795:275708f2e838
234 int hasVectorUnit = 0; 234 int hasVectorUnit = 0;
235 size_t length = sizeof(hasVectorUnit); 235 size_t length = sizeof(hasVectorUnit);
236 int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); 236 int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
237 if( 0 == error ) 237 if( 0 == error )
238 altivec = (hasVectorUnit != 0); 238 altivec = (hasVectorUnit != 0);
239 #elseif defined(USE_SETJMP) && defined(__GNUC__) && defined(__powerpc__) 239 #elif defined(USE_SETJMP) && defined(GCC_ALTIVEC)
240 void (*handler)(int sig); 240 void (*handler)(int sig);
241 handler = signal(SIGILL, illegal_instruction); 241 handler = signal(SIGILL, illegal_instruction);
242 if ( setjmp(jmpbuf) == 0 ) { 242 if ( setjmp(jmpbuf) == 0 ) {
243 asm volatile ("mtspr 256, %0\n\t" 243 asm volatile ("mtspr 256, %0\n\t"
244 "vand %%v0, %%v0, %%v0" 244 "vand %%v0, %%v0, %%v0"