re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / asm-3.c
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 #define REGISTER "0"
9 #endif
10
11 static inline int source(void)
12 {
13 register int hardreg __asm__(REGISTER);
14 asm("" : "=r"(hardreg));
15 return hardreg;
16 }
17
18 void test(void)
19 {
20 int t = source();
21 foo(t);
22 bar(t);
23 }
24
25 /* Hardreg should appear exactly 3 times -- declaration, asm stmt,
26 and copy out. */
27 /* { dg-final { scan-tree-dump-times "hardreg" 3 "optimized" } } */
28
29 /* In particular, hardreg should *not* appear in the call to bar. */
30 /* { dg-final { scan-tree-dump-times "bar \[(\]t\[)\]" 1 "optimized" } } */
31
32 /* { dg-final { cleanup-tree-dump "optimized" } } */