OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-stable/gcc-4.5.1/gcc/testsuite/gcc.dg/tree-prof
    from Rev 816 to Rev 826
    Reverse comparison

Rev 816 → Rev 826

/inliner-1.c
0,0 → 1,38
/* { dg-options "-O2 -fdump-tree-optimized" } */
int a;
int b[100];
void abort (void);
 
inline void
cold_function ()
{
int i;
for (i = 0; i < 99; i++)
if (b[i] / (b[i+1] + 1))
abort ();
}
 
inline void
hot_function ()
{
int i;
for (i = 0; i < 99; i++)
if (b[i] / (b[i+1] + 1))
abort ();
}
 
main ()
{
if (a)
cold_function ();
else
hot_function ();
return 0;
}
 
/* cold function should be inlined, while hot function should not.
Look for "cold_function () [tail call];" call statement not for the
declaration or other apperances of the string in dump. */
/* { dg-final-use { scan-tree-dump "cold_function ..;" "optimized"} } */
/* { dg-final-use { scan-tree-dump-not "hot_function ..;" "optimized"} } */
/* { dg-final-use { cleanup-tree-dump "optimized" } } */
inliner-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bb-reorg.c =================================================================== --- bb-reorg.c (nonexistent) +++ bb-reorg.c (revision 826) @@ -0,0 +1,39 @@ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition" } */ + +#include + +#define SIZE 1000 +int t0 = 0; +const char *t2[SIZE]; +char buf[SIZE]; + +void +foo (void) +{ + char *s = buf; + t0 = 1; + + for (;;) + { + if (*s == '\0') + break; + else + { + t2[t0] = s; + t0++; + } + *s++ = '\0'; + } + t2[t0] = NULL; +} + + +int +main () +{ + strcpy (buf, "hello"); + foo (); + return 0; +} +
bb-reorg.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr34999.c =================================================================== --- pr34999.c (nonexistent) +++ pr34999.c (revision 826) @@ -0,0 +1,45 @@ +/* Same test as built-in-setjmp.c. Includes the case where + the source block of a crossing fallthru edge ends with a call. */ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition" } */ + +extern int strcmp(const char *, const char *); +extern char *strcpy(char *, const char *); +extern void abort(void); +extern void exit(int); + +void *buf[20]; + +void __attribute__((noinline)) +sub2 (void) +{ + __builtin_longjmp (buf, 1); +} + +int +main () +{ + char *p = (char *) __builtin_alloca (20); + + strcpy (p, "test"); + + if (__builtin_setjmp (buf)) + { + if (strcmp (p, "test") != 0) + abort (); + + exit (0); + } + + { + int *q = (int *) __builtin_alloca (p[2] * sizeof (int)); + int i; + + for (i = 0; i < p[2]; i++) + q[i] = 0; + + while (1) + sub2 (); + } +} +
pr34999.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stringop-1.c =================================================================== --- stringop-1.c (nonexistent) +++ stringop-1.c (revision 826) @@ -0,0 +1,22 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +int a[1000]; +int b[1000]; +int size=1; +int max=10000; +main() +{ + int i; + for (i=0;i
stringop-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ic-misattribution-1.c =================================================================== --- ic-misattribution-1.c (nonexistent) +++ ic-misattribution-1.c (revision 826) @@ -0,0 +1,19 @@ +/* { dg-options "-O2 -fdump-tree-tree_profile" } */ +/* { dg-additional-sources "ic-misattribution-1a.c" } */ + +extern void other_caller (void); + +void +callee (void) +{ + return; +} + +void +caller(void (*func) (void)) +{ + func (); +} + +/* { dg-final-use { scan-tree-dump "hist->count 1 hist->all 1" "tree_profile" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
ic-misattribution-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stringop-2.c =================================================================== --- stringop-2.c (nonexistent) +++ stringop-2.c (revision 826) @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +int a[1000]; +int b[1000]; +int size=1; +int max=10000; +main() +{ + int i; + for (i=0;i
stringop-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: update-loopch.c =================================================================== --- update-loopch.c (nonexistent) +++ update-loopch.c (revision 826) @@ -0,0 +1,21 @@ +/* { dg-options "-O2 -fdump-tree-tree_profile-blocks -fdump-tree-optimized-blocks" } */ +int max = 33333; +int a[8]; +int +main () +{ + int i; + for (i = 0; i < max; i++) + { + a[i % 8]++; + } + return 0; +} +/* Loop header copying will peel away the initial conditional, so the loop body + is once reached directly from entry point of function, rest via loopback + edge. */ +/* { dg-final-use { scan-tree-dump "count:33333" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "count:33332" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
update-loopch.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ic-misattribution-1a.c =================================================================== --- ic-misattribution-1a.c (nonexistent) +++ ic-misattribution-1a.c (revision 826) @@ -0,0 +1,22 @@ +/* { dg-options "-DEMPTY" } */ +/* This file is only needed in combination with ic-misattribution-1.c + but there's no easy way to make this file ignored. */ +extern void callee (void); +extern void caller (void (*func) (void)); + +typedef void (*func_t) (void); +func_t func; + +int +main () +{ +#ifdef EMPTY +#else + func = callee; + caller (callee); + func (); +#endif + return 0; +} + +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
ic-misattribution-1a.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: update-tailcall.c =================================================================== --- update-tailcall.c (nonexistent) +++ update-tailcall.c (revision 826) @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-tree-tailc -fdump-tree-optimized" } */ +__attribute__ ((noinline)) +int factorial(int x) +{ + if (x == 1) + return 1; + else + return x*factorial(--x); +} +int gbl; +int +main() +{ + gbl = factorial(100); + return 0; +} +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "tailc"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "tailc" } } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
update-tailcall.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: tree-prof.exp =================================================================== --- tree-prof.exp (nonexistent) +++ tree-prof.exp (revision 826) @@ -0,0 +1,54 @@ +# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Test the functionality of programs compiled with profile-directed block +# ordering using -fprofile-generate followed by -fbranch-use. + +load_lib target-supports.exp + +# Some targets don't support tree profiling. +if { ![check_profiling_available ""] } { + return +} + +# The procedures in profopt.exp need these parameters. +set tool gcc +set prof_ext "gcda" + +# Override the list defined in profopt.exp. +set PROFOPT_OPTIONS [list {}] + +if $tracelevel then { + strace $tracelevel +} + +# Load support procs. +load_lib profopt.exp + +# These are globals used by profopt-execute. The first is options +# needed to generate profile data, the second is options to use the +# profile data. +set profile_option "-fprofile-generate -D_PROFILE_GENERATE" +set feedback_option "-fprofile-use -D_PROFILE_USE" + +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + profopt-execute $src +} Index: tracer-1.c =================================================================== --- tracer-1.c (nonexistent) +++ tracer-1.c (revision 826) @@ -0,0 +1,18 @@ +/* { dg-options "-O2 -ftracer -fdump-tree-tracer" } */ +main () +{ + int i; + int a, b, c; + for (i = 0; i < 1000; i++) + { + if (i % 17) + a++; + else + b++; + c++; + } + return 0; +} +/* Superblock formation should produce two copies of the increment of c */ +/* { dg-final-generate { scan-tree-dump-times "goto ;" 2 "tracer" } } */ +/* { dg-final-use { cleanup-tree-dump "tracer" } } */
tracer-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: indir-call-prof.c =================================================================== --- indir-call-prof.c (nonexistent) +++ indir-call-prof.c (revision 826) @@ -0,0 +1,45 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ + +static int a1 (void) +{ + return 10; +} + +static int a2 (void) +{ + return 0; +} + +typedef int (*tp) (void); + +static tp aa [] = {a2, a1, a1, a1, a1}; + +void setp (int (**pp) (void), int i) +{ + if (!i) + *pp = aa [i]; + else + *pp = aa [(i & 2) + 1]; +} + +int +main (void) +{ + int (*p) (void); + int i; + + for (i = 0; i < 10; i ++) + { + setp (&p, i); + p (); + } + + return 0; +} + +/* { dg-final-use { scan-tree-dump "Indirect call -> direct call.* a1 transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ + +
indir-call-prof.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: val-prof-1.c =================================================================== --- val-prof-1.c (nonexistent) +++ val-prof-1.c (revision 826) @@ -0,0 +1,22 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +int a[1000]; +int b = 256; +int c = 257; +main () +{ + int i; + int n; + for (i = 0; i < 1000; i++) + { + if (i % 17) + n = c; + else n = b; + a[i] /= n; + } + return 0; +} +/* { dg-final-use { scan-tree-dump "Div.mod by constant n=257 transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* != 257\\)" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
val-prof-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: wcoverage-mismatch.c =================================================================== --- wcoverage-mismatch.c (nonexistent) +++ wcoverage-mismatch.c (revision 826) @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -Wcoverage-mismatch -w" } */ + +int __attribute__((noinline)) bar (void) +{ +} + +int foo (int i) +{ +#ifdef _PROFILE_USE + if (i) + bar (); +#endif + return 0; +} + +int main(int argc, char **argv) +{ + foo (argc); + return 0; +}
wcoverage-mismatch.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: val-prof-2.c =================================================================== --- val-prof-2.c (nonexistent) +++ val-prof-2.c (revision 826) @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +unsigned int a[1000]; +unsigned int b = 256; +unsigned int c = 1024; +unsigned int d = 17; +main () +{ + int i; + unsigned int n; + for (i = 0; i < 1000; i++) + { + a[i]=100*i; + } + for (i = 0; i < 1000; i++) + { + if (i % 2) + n = b; + else if (i % 3) + n = c; + else + n = d; + a[i] %= n; + } + return 0; +} +/* { dg-final-use { scan-tree-dump "Mod power of 2 transformation on insn" "tree_profile"} } */ +/* This is part of code checking that n is power of 2, so we are sure that the transformation + didn't get optimized out. */ +/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 0xffff" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
val-prof-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: val-prof-3.c =================================================================== --- val-prof-3.c (nonexistent) +++ val-prof-3.c (revision 826) @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +unsigned int a[1000]; +unsigned int b = 257; +unsigned int c = 1023; +unsigned int d = 19; +main () +{ + int i; + unsigned int n; + for (i = 0; i < 1000; i++) + { + a[i]=18; + } + for (i = 0; i < 1000; i++) + { + if (i % 2) + n = b; + else if (i % 3) + n = c; + else + n = d; + a[i] %= n; + } + return 0; +} +/* { dg-final-use { scan-tree-dump "Mod subtract transformation on insn" "tree_profile"} } */ +/* This is part of code checking that n is greater than the divisor so we are sure that it + didn't get optimized out. */ +/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
val-prof-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: val-prof-4.c =================================================================== --- val-prof-4.c (nonexistent) +++ val-prof-4.c (revision 826) @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +unsigned int a[1000]; +unsigned int b = 999; +unsigned int c = 1002; +unsigned int d = 1003; +main () +{ + int i; + unsigned int n; + for (i = 0; i < 1000; i++) + { + a[i]=1000+i; + } + for (i = 0; i < 1000; i++) + { + if (i % 2) + n = b; + else if (i % 3) + n = c; + else + n = d; + a[i] %= n; + } + return 0; +} +/* { dg-final-use { scan-tree-dump "Mod subtract transformation on insn" "tree_profile"} } */ +/* This is part of code checking that n is greater than the divisor so we are sure that it + didn't get optimized out. */ +/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
val-prof-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: val-prof-5.c =================================================================== --- val-prof-5.c (nonexistent) +++ val-prof-5.c (revision 826) @@ -0,0 +1,17 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +int a[1000]; +int b=997; +main() +{ + int i; + for (i = 0; i < 1000; i++) + if (a[i]) + a[i]/=b; + else + a[i]/=b; + return 0; +} +/* { dg-final-use { scan-tree-dump "Div.mod by constant b.*=997 transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
val-prof-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: val-prof-6.c =================================================================== --- val-prof-6.c (nonexistent) +++ val-prof-6.c (revision 826) @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +char a[1000]; +char b[1000]; +int size=1000; +__attribute__ ((noinline)) +t(int size) +{ + __builtin_memcpy(a,b,size); +} +int +main() +{ + int i; + for (i=0; i < size; i++) + t(i); + return 0; +} +/* { dg-final-use { scan-tree-dump "Average value sum:499500" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "IOR value" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
val-prof-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: val-prof-7.c =================================================================== --- val-prof-7.c (nonexistent) +++ val-prof-7.c (revision 826) @@ -0,0 +1,26 @@ +/* { dg-options "-O2 -fdump-tree-tree_profile -mtune=core2" } */ +/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */ + +#include + +int foo(int len) +{ + char array[1000]; + bzero(array, len); + return 0; +} + +int main() { + int i; + for (i = 0; i < 1000; i++) + { + if (i > 990) + foo(16); + else + foo(8); + } + return 0; +} + +/* { dg-final-use { scan-tree-dump "Single value 8 stringop transformation on bzero" "tree_profile"} } */ +/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */
val-prof-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: update-cunroll-2.c =================================================================== --- update-cunroll-2.c (nonexistent) +++ update-cunroll-2.c (revision 826) @@ -0,0 +1,21 @@ + +/* { dg-options "-O2 -fdump-tree-optimized-blocks" } */ +int a[8]; +__attribute__ ((noinline)) +int t() +{ + int i; + for (i = 0; i < 3; i++) + if (a[i]) + break; + return i; +} +main () +{ + int i; + for (i = 0; i < 1000; i++) + t (); + return 0; +} +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */
update-cunroll-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.