From 9aa5234fd7b15a4f37ea78ec9facff765535fa61 Mon Sep 17 00:00:00 2001 From: No Author Date: Sat, 27 Nov 2004 16:59:16 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'gcc-3_3-branch'. From-SVN: r91382 --- gcc/testsuite/g++.dg/warn/Winline-4.C | 17 +++++++++++ gcc/testsuite/gcc.dg/20030204-1.c | 17 +++++++++++ gcc/testsuite/gcc.dg/loop-6.c | 25 ++++++++++++++++ gcc/testsuite/gcc.dg/pr9771-1.c | 43 +++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Winline-4.C create mode 100644 gcc/testsuite/gcc.dg/20030204-1.c create mode 100644 gcc/testsuite/gcc.dg/loop-6.c create mode 100644 gcc/testsuite/gcc.dg/pr9771-1.c diff --git a/gcc/testsuite/g++.dg/warn/Winline-4.C b/gcc/testsuite/g++.dg/warn/Winline-4.C new file mode 100644 index 000000000000..188ab5aa8961 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Winline-4.C @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-O2 -Winline" } +// Origin: +// PR 17115: We should not emit -Winline warning for functions marked with +// noinline + +struct Foo { + __attribute__((noinline)) int a(int r) { return r & 1; } + virtual __attribute__((noinline)) int b(int r) { return r & 1; } + static __attribute__((noinline)) int c(int r) { return r & 1; } +}; + +int bar(int r) { + Foo f; + int k = 1; k &= f.a(r); k &= f.b(r); k &= f.a(r); + return k; +} diff --git a/gcc/testsuite/gcc.dg/20030204-1.c b/gcc/testsuite/gcc.dg/20030204-1.c new file mode 100644 index 000000000000..33a9eb229f9c --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030204-1.c @@ -0,0 +1,17 @@ +/* PR optimization/8555 */ +/* { dg-do compile } */ +/* { dg-options "-O -ffast-math -funroll-loops" } */ +/* { dg-options "-march=pentium3 -O -ffast-math -funroll-loops" { target i?86-*-* } } */ +/* { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } } */ + +float foo (float *a, int i) +{ + int j; + float x = a[j = i - 1], y; + + for (j = i; --j >= 0; ) + if ((y = a[j]) > x) + x = y; + + return x; +} diff --git a/gcc/testsuite/gcc.dg/loop-6.c b/gcc/testsuite/gcc.dg/loop-6.c new file mode 100644 index 000000000000..653854eb8a09 --- /dev/null +++ b/gcc/testsuite/gcc.dg/loop-6.c @@ -0,0 +1,25 @@ +/* PR optimization/18577 */ +/* Origin: Falk Hueffner */ + +/* { dg-do run } */ +/* { dg-options "-O2 -funroll-all-loops" } */ + +static float tfcos12[3]; +__attribute__((noinline)) double f(double x) { return x; } +int g; + +int main(void) +{ + int i, j; + for (i = 0; i < 1; i++) + tfcos12[i] = 0.5; + + for (i = 0; i < 1; i++) + { + tfcos12[i] = 0.5 * f(i); + for (j = 0; j < 12; j++) + g++; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr9771-1.c b/gcc/testsuite/gcc.dg/pr9771-1.c new file mode 100644 index 000000000000..1e3bc036aeee --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr9771-1.c @@ -0,0 +1,43 @@ +/* PR rtl-optimization/9771 */ +/* { dg-do run { target i?86-*-* } } */ +/* { dg-options "-O2 -fomit-frame-pointer -ffixed-ebp" } */ + +extern void abort(void); +extern void exit(int); + +register long *B asm ("ebp"); + +long x = 10; +long y = 20; + +void bar(void) +{ + B = &y; +} + +void foo() +{ + long *adr = B; + long save = *adr; + + *adr = 123; + + bar(); + + *adr = save; +} + +int main() +{ + B = &x; + + foo(); + + if (x != 10 || y != 20) + abort(); + + /* We can't return, as our caller may assume %ebp is preserved! */ + /* We could save/restore it (like foo), but its easier to exit. */ + exit(0); +} + -- 2.47.2