annotate gcc/testsuite/gcc.dg/tree-ssa/loop-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* -mlongcall will cause us to place &foo in the CTR register. */
kono
parents:
diff changeset
3 /* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
kono
parents:
diff changeset
4 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized" } */
kono
parents:
diff changeset
5 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -mshort-calls" {target epiphany-*-*} } */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 /* On 31-bit S/390 the function address will be stored (once) in the literal pool,
kono
parents:
diff changeset
9 so scan-assembler-times "foo" will return 1 even if the loop is fully unrolled.
kono
parents:
diff changeset
10 -msmall-exec avoids this by enabling a call instruction with immediate operand. */
kono
parents:
diff changeset
11 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -msmall-exec" { target s390-*-* } } */
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 /* On Darwin, we call extern functions via a stub in PIC mode which is default and
kono
parents:
diff changeset
14 the stub is named after the function. To avoid this we use -static to go out
kono
parents:
diff changeset
15 of PIC mode. */
kono
parents:
diff changeset
16 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -static" { target *-*-darwin* } } */
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 /* On MIPS, disable generating hints (R_MIPS_JALR) for PIC calls. In addition
kono
parents:
diff changeset
19 to the load from the GOT this also contains the name of the function so for
kono
parents:
diff changeset
20 each call the function name would appear twice. */
kono
parents:
diff changeset
21 /* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -mno-relax-pic-calls" { target mips*-*-* } } */
kono
parents:
diff changeset
22 __attribute__ ((pure))
kono
parents:
diff changeset
23 int foo (int x);
kono
parents:
diff changeset
24 int xxx(void)
kono
parents:
diff changeset
25 {
kono
parents:
diff changeset
26 int x = 45;
kono
parents:
diff changeset
27 int sum = 0;
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 while (x >>= 1)
kono
parents:
diff changeset
30 sum += foo (x) * 2;
kono
parents:
diff changeset
31 return sum;
kono
parents:
diff changeset
32 }
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 /* We should be able to find out that the loop iterates four times and unroll it completely. */
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 /* { dg-final { scan-tree-dump-times "Added canonical iv to loop 1, 4 iterations" 1 "ivcanon"} } */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
37 /* { dg-final { scan-tree-dump-times "loop with 4 iterations completely unrolled" 1 "cunroll"} } */
111
kono
parents:
diff changeset
38 /* { dg-final { scan-tree-dump-times "foo" 5 "optimized"} } */
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 /* Because hppa, ia64 and Windows targets include an external declaration
kono
parents:
diff changeset
41 for foo as well as the calls we need to look for something more specific
kono
parents:
diff changeset
42 than just foo in order to count only the calls and not the declaration. */
kono
parents:
diff changeset
43 /* The SH targets always use separate instructions to load the address
kono
parents:
diff changeset
44 and to do the actual call - bsr is only generated by link time
kono
parents:
diff changeset
45 relaxation. */
kono
parents:
diff changeset
46 /* CRIS keeps the address in a register. */
kono
parents:
diff changeset
47 /* m68k sometimes puts the address in a register, depending on CPU and PIC. */
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 /* { dg-final { scan-assembler-times "foo" 5 { xfail hppa*-*-* ia64*-*-* sh*-*-* cris-*-* crisv32-*-* fido-*-* m68k-*-* i?86-*-mingw* i?86-*-cygwin* x86_64-*-mingw* visium-*-* nvptx*-*-* } } } */
kono
parents:
diff changeset
50 /* { dg-final { scan-assembler-times "foo,%r" 5 { target hppa*-*-* } } } */
kono
parents:
diff changeset
51 /* { dg-final { scan-assembler-times "= foo" 5 { target ia64*-*-* } } } */
kono
parents:
diff changeset
52 /* { dg-final { scan-assembler-times "call\[ \t\]*_foo" 5 { target i?86-*-mingw* i?86-*-cygwin* } } } */
kono
parents:
diff changeset
53 /* { dg-final { scan-assembler-times "call\[ \t\]*foo" 5 { target x86_64-*-mingw* } } } */
kono
parents:
diff changeset
54 /* { dg-final { scan-assembler-times "jsr|bsrf|blink\ttr?,r18" 5 { target sh*-*-* } } } */
kono
parents:
diff changeset
55 /* { dg-final { scan-assembler-times "Jsr \\\$r" 5 { target cris-*-* } } } */
kono
parents:
diff changeset
56 /* { dg-final { scan-assembler-times "\[jb\]sr" 5 { target fido-*-* m68k-*-* } } } */
kono
parents:
diff changeset
57 /* { dg-final { scan-assembler-times "bra *tr,r\[1-9\]*,r21" 5 { target visium-*-* } } } */
kono
parents:
diff changeset
58 /* { dg-final { scan-assembler-times "(?n)\[ \t\]call\[ \t\].*\[ \t\]foo," 5 { target nvptx*-*-* } } } */