1 /* PR 17739 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 
5 #ifdef __hppa__
6 #define REGISTER "1"
7 #else
8 #ifdef __moxie__
9 #define REGISTER "8"
10 #else
11 #define REGISTER "0"
12 #endif
13 #endif
14 
15 void foo (int);
16 void bar (int);
17 
source(void)18 static inline int source(void)
19 {
20   register int hardreg __asm__(REGISTER);
21   asm("" : "=r"(hardreg));
22   return hardreg;
23 }
24 
test(void)25 void test(void)
26 {
27   int t = source();
28   foo(t);
29   bar(t);
30 }
31 
32 /* Hardreg should appear exactly 3 times -- declaration, asm stmt,
33    and copy out.  */
34 /* { dg-final { scan-tree-dump-times "hardreg" 3 "optimized" } } */
35 
36 /* In particular, hardreg should *not* appear in the call to bar.  */
37 /* { dg-final { scan-tree-dump-times "bar \[(\]\[^\n\r\]*_.\[)\]" 1 "optimized" } } */
38 
39