OSDN Git Service

* gcc.dg/tree-ssa/loop-1.c: Handle i?86-*-mingw* i?86-*-cygwin* as
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-1.c
1 /* { dg-do compile } */
2 /* -mlongcall will cause us to place &foo in the CTR register.  */
3 /* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
4 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized" } */
5
6 /* On 31-bit S/390 the function address will be stored (once) in the literal pool,
7    so scan-assembler-times "foo" will return 1 even if the loop is fully unrolled.
8    -msmall-exec avoids this by enabling a call instruction with immediate operand.  */
9 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -msmall-exec" { target s390-*-* } } */
10
11 /* On Darwin, we call extern functions via a stub in PIC mode which is default and
12    the stub is named after the function.  To avoid this we use -static to go out
13    of PIC mode.  */
14 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -static" { target *-*-darwin* } } */
15
16 void xxx(void)
17 {
18   int x = 45;
19
20   while (x >>= 1)
21     foo ();
22 }
23
24 /* We should be able to find out that the loop iterates four times and unroll it completely.  */
25
26 /* { dg-final { scan-tree-dump-times "Added canonical iv to loop 1, 4 iterations" 1 "ivcanon"} } */
27 /* { dg-final { cleanup-tree-dump "ivcanon" } } */
28 /* { dg-final { scan-tree-dump-times "Unrolled loop 1 completely" 1 "cunroll"} } */
29 /* { dg-final { cleanup-tree-dump "cunroll" } } */
30 /* { dg-final { scan-tree-dump-times "foo" 5 "optimized"} } */
31 /* { dg-final { cleanup-tree-dump "optimized" } } */
32
33 /* Because hppa, ia64 and Windows targets include an external declaration
34    for foo as well as the calls we need to look for something more specific
35    than just foo in order to count only the calls and not the declaration.  */
36 /* The SH targets always use separate instructions to load the address
37    and to do the actual call - bsr is only generated by link time
38    relaxation.  */
39 /* CRIS keeps the address in a register.  */
40 /* m68k sometimes puts the address in a register, depending on CPU and PIC.  */
41
42 /* { dg-final { scan-assembler-times "foo" 5 { xfail hppa*-*-* ia64*-*-* sh*-*-* cris-*-* crisv32-*-* fido-*-* m68k-*-* i?86-*-mingw* i?86-*-cygwin* } } } */
43 /* { dg-final { scan-assembler-times "foo,%r" 5 { target hppa*-*-* } } } */
44 /* { dg-final { scan-assembler-times "= foo"  5 { target ia64*-*-* } } } */
45 /* { dg-final { scan-assembler-times "call\[ \t\]*_foo" 5 { target i?86-*-mingw* i?86-*-cygwin* } } } */
46 /* { dg-final { scan-assembler-times "jsr|bsrf|blink\ttr?,r18"  5 { target sh*-*-* } } } */
47 /* { dg-final { scan-assembler-times "Jsr \\\$r" 5 { target cris-*-* } } } */
48 /* { dg-final { scan-assembler-times "\[jb\]sr" 5 { target fido-*-* m68k-*-* } } } */