summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr31866.c
blob: 4081c0e6ad955d23a569937db70e4413bc5d2ce3 (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
/* PR tree-optimization/31866 */
/* { dg-do compile { target alpha*-*-* cris-*-* crisv32-*-* i?86-*-* mmix-*-* powerpc*-*-* rs6000-*-* x86_64-*-* } } */
/* { dg-options "-O2" } */

#if defined (__alpha__)
# define REG "$1"
#elif defined (__CRIS__)
# define REG "r10"
#elif defined (__i386__)
# define REG "%eax"
#elif defined (__MMIX__)
# define REG "$8"
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
	|| defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
# define REG "6"
#elif defined (__x86_64__)
# define REG "rax"
#endif

long int
foo (void)
{
  unsigned long int s;
  long int a = (long int) 0;
  register long int r asm (REG) = a;
  asm ("" : "=r" (s) : "0" (r));
  return s;
}