1 /* A runtime check for AltiVec capability. */
2 /* Contributed by Ziemowit Laski <zlaski@apple.com> */
5 extern void exit (int);
6 extern void abort (void);
9 sig_ill_handler (int sig)
14 void altivec_check(void) {
16 /* Exit on systems without AltiVec. */
17 signal (SIGILL, sig_ill_handler);
19 asm volatile ("vor v0,v0,v0");
21 asm volatile ("vor 0,0,0");
23 signal (SIGILL, SIG_DFL);
26 void altivec_cell_check (void)
29 /* Exit on systems without the Cell Altivec instructions. */
30 signal (SIGILL, sig_ill_handler);
32 asm volatile ("vor v0,v0,v0");
33 asm volatile ("lvlx v0,r0,r0");
35 asm volatile ("vor 0,0,0");
36 asm volatile ("lvlx 0,0,0");
38 signal (SIGILL, SIG_DFL);
40 /* altivec_cell_check shouldn't be called without -mcpu=cell. */