aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/darwin-longlong.c
blob: b9392c0c37b66da16801b763eb022142f7c2b3ec (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-xfail-if "" { "powerpc-*-eabispe*" "powerpc-ibm-aix*" } { "-mcpu=G5" } { "" } } */
/* { dg-options "-mcpu=G5" } */

#include <signal.h>
#include <stdlib.h>

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


int  msw(long long in)
{
  union {
    long long ll;
    int  i[2];
  } ud;
  ud.ll = in;
  return ud.i[0];
}

int main()
{

  /* Exit on systems without 64bit instructions.  */
  signal (SIGILL, sig_ill_handler);
#ifdef __MACH__
  asm volatile ("extsw r0,r0");
#else
  asm volatile ("extsw 0,0");
#endif
  signal (SIGILL, SIG_DFL);

  if (msw(1) != 0)
    abort();
  exit(0);
}