aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/altivec_check.h
blob: 736054821f183213f54afa8e9f2ec5a9172a951d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* A runtime check for AltiVec capability.  */
/* Contributed by Ziemowit Laski  <zlaski@apple.com>  */

#include <signal.h>
extern void exit (int);
extern void abort (void);

void 
sig_ill_handler (int sig)
{
    exit (0);
}

void altivec_check(void) {

  /* Exit on systems without AltiVec.  */
  signal (SIGILL, sig_ill_handler);
#ifdef __MACH__
  asm volatile ("vor v0,v0,v0");
#else
  asm volatile ("vor 0,0,0");
#endif
  signal (SIGILL, SIG_DFL);
}