Reverting merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / pr33619.c
blob8011e69e6ade48bc4e6fb77abb589ea79ed6a997
1 /* PR tree-optimization/33619 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
5 #ifdef __powerpc__
6 # define REG1 __asm__ ("3")
7 # define REG2 __asm__ ("4")
8 #elif defined __x86_64__
9 # define REG1 __asm__ ("rdi")
10 # define REG2 __asm__ ("rsi")
11 #else
12 # define REG1
13 # define REG2
14 #endif
16 static inline void
17 bar (unsigned long x, int y)
19 register unsigned long p1 REG1 = x;
20 register unsigned long p2 REG2 = y;
21 __asm__ volatile ("" : "=r" (p1), "=r" (p2) : "0" (p1), "1" (p2) : "memory");
22 if (p1 != 0xdeadUL || p2 != 0xbefUL)
23 __builtin_abort ();
26 __attribute__((const, noinline)) int
27 baz (int x)
29 return x;
32 __attribute__((noinline)) void
33 foo (unsigned long *x, int y)
35 unsigned long a = *x;
36 bar (a, baz (y));
39 int
40 main (void)
42 unsigned long a = 0xdeadUL;
43 foo (&a, 0xbefUL);
44 return 0;