aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c
new file mode 100644
index 000000000..dd52c50fa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-1.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+/* -mlongcall will cause us to place &foo in the CTR register. */
+/* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
+/* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized" } */
+/* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -mshort-calls" {target epiphany-*-*} } */
+
+
+/* On 31-bit S/390 the function address will be stored (once) in the literal pool,
+ so scan-assembler-times "foo" will return 1 even if the loop is fully unrolled.
+ -msmall-exec avoids this by enabling a call instruction with immediate operand. */
+/* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -msmall-exec" { target s390-*-* } } */
+
+/* On Darwin, we call extern functions via a stub in PIC mode which is default and
+ the stub is named after the function. To avoid this we use -static to go out
+ of PIC mode. */
+/* { dg-options "-O1 -ftree-loop-ivcanon -funroll-loops -fdump-tree-ivcanon-details -fdump-tree-cunroll-details -fdump-tree-optimized -static" { target *-*-darwin* } } */
+
+/* On MIPS, disable generating hints (R_MIPS_JALR) for PIC calls. In addition
+ to the load from the GOT this also contains the name of the function so for
+ each call the function name would appear twice. */
+/* { 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*-*-* } } */
+__attribute__ ((pure))
+int foo (int x);
+int xxx(void)
+{
+ int x = 45;
+ int sum;
+
+ while (x >>= 1)
+ sum += foo (x) * 2;
+ return sum;
+}
+
+/* We should be able to find out that the loop iterates four times and unroll it completely. */
+
+/* { dg-final { scan-tree-dump-times "Added canonical iv to loop 1, 4 iterations" 1 "ivcanon"} } */
+/* { dg-final { cleanup-tree-dump "ivcanon" } } */
+/* { dg-final { scan-tree-dump-times "loop with 5 iterations completely unrolled" 1 "cunroll"} } */
+/* { dg-final { cleanup-tree-dump "cunroll" } } */
+/* { dg-final { scan-tree-dump-times "foo" 5 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+/* Because hppa, ia64 and Windows targets include an external declaration
+ for foo as well as the calls we need to look for something more specific
+ than just foo in order to count only the calls and not the declaration. */
+/* The SH targets always use separate instructions to load the address
+ and to do the actual call - bsr is only generated by link time
+ relaxation. */
+/* CRIS keeps the address in a register. */
+/* m68k sometimes puts the address in a register, depending on CPU and PIC. */
+
+/* { dg-final { scan-assembler-times "foo" 5 { xfail hppa*-*-* ia64*-*-* sh*-*-* cris-*-* crisv32-*-* fido-*-* m68k-*-* i?86-*-mingw* i?86-*-cygwin* x86_64-*-mingw* } } } */
+/* { dg-final { scan-assembler-times "foo,%r" 5 { target hppa*-*-* } } } */
+/* { dg-final { scan-assembler-times "= foo" 5 { target ia64*-*-* } } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*_foo" 5 { target i?86-*-mingw* i?86-*-cygwin* } } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*foo" 5 { target x86_64-*-mingw* } } } */
+/* { dg-final { scan-assembler-times "jsr|bsrf|blink\ttr?,r18" 5 { target sh*-*-* } } } */
+/* { dg-final { scan-assembler-times "Jsr \\\$r" 5 { target cris-*-* } } } */
+/* { dg-final { scan-assembler-times "\[jb\]sr" 5 { target fido-*-* m68k-*-* } } } */