diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2014-06-20 13:50:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-20 02:04:52 +0000 |
commit | 3c447213baf828ebd01c45ad459552b3c9922c92 (patch) | |
tree | 198ed6386925c6ff5c24faf686b836aa74082836 /gcc-4.8/gcc/testsuite/g++.dg/opt | |
parent | e1be674a8e345aaa025ad9f1d38bab4272301e1d (diff) | |
parent | f190d6284359da8ae8694b2d2e14b01602a959ed (diff) | |
download | toolchain_gcc-3c447213baf828ebd01c45ad459552b3c9922c92.tar.gz toolchain_gcc-3c447213baf828ebd01c45ad459552b3c9922c92.tar.bz2 toolchain_gcc-3c447213baf828ebd01c45ad459552b3c9922c92.zip |
Merge "Merge GCC 4.8.3"
Diffstat (limited to 'gcc-4.8/gcc/testsuite/g++.dg/opt')
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/opt/pr58864.C | 21 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/opt/pr59470.C | 188 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/opt/pr59647.C | 32 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/opt/pr60849.C | 13 |
4 files changed, 254 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/opt/pr58864.C b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr58864.C new file mode 100644 index 000000000..b8587f298 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr58864.C @@ -0,0 +1,21 @@ +// PR target/58864 +// { dg-do compile } +// { dg-options "-Os" } +// { dg-additional-options "-march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } + +struct A { A (); ~A (); }; +struct B { B (); }; + +float d, e; + +void +foo () +{ + A a; + float c = d; + while (1) + { + B b; + e = c ? -c : 0; + } +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/opt/pr59470.C b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr59470.C new file mode 100644 index 000000000..4698ab717 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr59470.C @@ -0,0 +1,188 @@ +// PR middle-end/59470 +// { dg-do run } +// { dg-options "-O2 -fstack-protector" } +// { dg-additional-options "-fPIC" { target fpic } } +// { dg-require-effective-target fstack_protector } + +struct A +{ + int a1; + A () throw () : a1 (0) {} +}; + +struct B +{ + unsigned int b1 () throw (); +}; + +__attribute__((noinline, noclone)) unsigned int +B::b1 () throw () +{ + asm volatile ("" : : : "memory"); + return 0; +} + +struct C +{ + const A **c1; + void c2 (const A *, unsigned int); +}; + +__attribute__((noinline, noclone)) void +C::c2 (const A *, unsigned int) +{ + asm volatile ("" : : : "memory"); +} + +struct D +{ + C *d1; +}; + +struct E +{ + int e1; + int e2; + D e3; +}; + +struct F +{ + virtual int f1 (const char * s, int n); +}; + +struct G +{ + F *g1; + bool g2; + G & g3 (const char * ws, int len) + { + if (__builtin_expect (!g2, true) + && __builtin_expect (this->g1->f1 (ws, len) != len, false)) + g2 = true; + return *this; + } +}; + +struct H : public A +{ + const char *h1; + unsigned int h2; + bool h3; + const char *h4; + char h5; + char h6; + char h7[31]; + bool h8; + H () : h1 (0), h2 (0), h4 (0), h5 (0), h6 (0), h8 (false) {} + void h9 (const D &) __attribute__((noinline, noclone)); +}; + +void +H::h9 (const D &) +{ + h3 = true; + __builtin_memset (h7, 0, sizeof (h7)); + asm volatile ("" : : : "memory"); +}; + +B b; + +inline const H * +foo (const D &x) +{ + const unsigned int i = b.b1 (); + const A **j = x.d1->c1; + if (!j[i]) + { + H *k = 0; + try + { + k = new H; + k->h9 (x); + } + catch (...) + { + } + x.d1->c2 (k, i); + } + return static_cast <const H *>(j[i]); +} + +__attribute__((noinline, noclone)) int +bar (char *x, unsigned long v, const char *y, int z, bool w) +{ + asm volatile ("" : : "r" (x), "r" (v), "r" (y) : "memory"); + asm volatile ("" : : "r" (z), "r" (w) : "memory"); + return 8; +} + +__attribute__((noinline, noclone)) void +baz (void *z, const char *g, unsigned int h, char s, E &e, char *n, char *c, int &l) +{ + asm volatile ("" : : "r" (z), "r" (g), "r" (h) : "memory"); + asm volatile ("" : : "r" (s), "r" (&e), "r" (n) : "memory"); + asm volatile ("" : : "r" (c), "r" (&l) : "memory"); + if (n == c) + __builtin_abort (); + int i = 0; + asm ("" : "+r" (i)); + if (i == 0) + __builtin_exit (0); +} + +__attribute__((noinline, noclone)) G +test (void *z, G s, E &x, char, long v) +{ + const D &d = x.e3; + const H *h = foo (d); + const char *q = h->h7; + const int f = x.e2; + const int i = 5 * sizeof (long); + char *c = static_cast <char *>(__builtin_alloca (i)); + const int b = f & 74; + const bool e = (b != 64 && b != 8); + const unsigned long u = ((v > 0 || !e) ? (unsigned long) v : -(unsigned long) v); + int l = bar (c + i, u, q, f, e); + c += i - l; + if (h->h3) + { + char *c2 = static_cast <char *>(__builtin_alloca ((l + 1) * 2)); + baz (z, h->h1, h->h2, h->h6, x, c2 + 2, c, l); + c = c2 + 2; + } + if (__builtin_expect (e, true)) + { + } + else if ((f & 4096) && v) + { + { + const bool m = f & 176; + *--c = q[m]; + *--c = q[1]; + } + } + const int w = x.e1; + if (w > l) + { + char * c3 = static_cast <char *>(__builtin_alloca (w)); + c = c3; + } + return s.g3 (c, l); +} + +int +main () +{ + H h; + const A *j[1]; + C c; + G g; + E e; + h.h9 (e.e3); + j[0] = &h; + c.c1 = j; + e.e3.d1 = &c; + test (0, g, e, 0, 0); + __builtin_abort (); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/opt/pr59647.C b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr59647.C new file mode 100644 index 000000000..1fc5067d8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr59647.C @@ -0,0 +1,32 @@ +// PR rtl-optimization/59647 +// { dg-do compile } +// { dg-options "-O2 -fno-tree-vrp" } +// { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ia32 } } } + +void f1 (int); +void f2 (); +double f3 (int); + +struct A +{ + int f4 () const + { + if (a == 0) + return 1; + return 0; + } + unsigned f5 () + { + if (!f4 ()) + f2 (); + return a; + } + int a; +}; + +void +f6 (A *x) +{ + unsigned b = x->f5 (); + f1 (b - 1 - f3 (x->f5 () - 1U)); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/opt/pr60849.C b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr60849.C new file mode 100644 index 000000000..52d8826b0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr60849.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-O2" } + +int g; + +extern "C" int isnan (); + +void foo(float a) { + int (*xx)(...); + xx = isnan; + if (xx(a)) + g++; +} |