diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/fixed-point/view-convert-2.c | 139 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/pr56154-1.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/pr56154-2.c | 39 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/pr56154-3.c | 31 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/pr56154-4.c | 34 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/pr56154-aux.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr52448.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr56228.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr56181.c | 25 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/inline-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c | 35 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr53185-2.c | 27 |
12 files changed, 417 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/fixed-point/view-convert-2.c b/gcc/testsuite/gcc.dg/fixed-point/view-convert-2.c new file mode 100644 index 00000000000..fbce5185e16 --- /dev/null +++ b/gcc/testsuite/gcc.dg/fixed-point/view-convert-2.c @@ -0,0 +1,139 @@ +/* PR tree-optimization/56064 */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99 -O2" } */ + +extern void abort (void); +extern void exit (int); + +void test_k (void) +{ + _Accum a; + __INT32_TYPE__ i = -__INT32_MAX__; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&a, &i, sizeof (a)); + + if (a >= 0k) + abort(); +} + +void test_0k (void) +{ + _Accum a; + __INT32_TYPE__ i = 0; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&a, &i, sizeof (a)); + + if (a != 0k) + abort(); +} + + +void test_hr (void) +{ + short _Fract a; + __INT8_TYPE__ i = -__INT8_MAX__; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&a, &i, sizeof (a)); + + if (a >= 0hr) + abort(); +} + +void test_0hr (void) +{ + short _Fract a; + __INT8_TYPE__ i = 0; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&a, &i, sizeof (a)); + + if (a != 0hr) + abort(); +} + + +void test_si (void) +{ + _Accum a = __ACCUM_MIN__; + __INT32_TYPE__ i; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&i, &a, sizeof (i)); + + if (i >= 0) + abort(); +} + +void test_0si (void) +{ + _Accum a = 0; + __INT32_TYPE__ i; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&i, &a, sizeof (i)); + + if (i != 0) + abort(); +} + + +void test_qi (void) +{ + short _Fract a = __SFRACT_MIN__; + __INT8_TYPE__ i; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&i, &a, sizeof (i)); + + if (i >= 0) + abort(); +} + +void test_0qi (void) +{ + short _Fract a = 0hr; + __INT8_TYPE__ i; + + if (sizeof (a) != sizeof (i)) + return; + + __builtin_memcpy (&i, &a, sizeof (i)); + + if (i != 0) + abort(); +} + + +int main (void) +{ + test_hr(); + test_k(); + test_qi(); + test_si(); + + test_0hr(); + test_0k(); + test_0qi(); + test_0si(); + + exit (0); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/guality/pr56154-1.c b/gcc/testsuite/gcc.dg/guality/pr56154-1.c new file mode 100644 index 00000000000..4f02bc96e21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr56154-1.c @@ -0,0 +1,29 @@ +/* PR debug/56154 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-additional-sources "pr56154-aux.c" } */ + +#include "../nop.h" + +union U { int a, b; }; +volatile int z; + +__attribute__((noinline, noclone)) int +foo (int fd, union U x) +{ + int result = x.a != 0; + if (fd != 0) + result = x.a == 0; + asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:17 "x.a" "4" } } */ + z = x.a; + x.a = 6; + asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:20 "x.a" "6" } } */ + return result; +} + +void +test_main (void) +{ + union U u = { .a = 4 }; + foo (0, u); +} diff --git a/gcc/testsuite/gcc.dg/guality/pr56154-2.c b/gcc/testsuite/gcc.dg/guality/pr56154-2.c new file mode 100644 index 00000000000..6c1d5d977f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr56154-2.c @@ -0,0 +1,39 @@ +/* PR debug/56154 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-additional-sources "pr56154-aux.c" } */ + +#include "../nop.h" + +extern void abort (void); + +__attribute__((noinline, noclone)) int +foo (int x) +{ + asm (""); + x++; + asm (""); + x++; + asm (""); + x++; + asm (""); + x++; + asm (""); + x++; + asm (""); + x++; + asm (""); + x++; + asm (""); + x++; + asm (NOP : : : "memory"); + asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-2.c:30 "x" "28" } } */ + return x; +} + +void +test_main (void) +{ + if (foo (20) != 28) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/guality/pr56154-3.c b/gcc/testsuite/gcc.dg/guality/pr56154-3.c new file mode 100644 index 00000000000..095dce9f656 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr56154-3.c @@ -0,0 +1,31 @@ +/* PR debug/56154 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-additional-sources "pr56154-aux.c" } */ + +#include "../nop.h" + +extern void abort (void); + +__attribute__((noinline, noclone)) int +foo (int x) +{ + x++; + x++; + x++; + x++; + x++; + x++; + x++; + x++; + asm (NOP : : : "memory"); + asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-3.c:22 "x" "28" } } */ + return x; +} + +void +test_main (void) +{ + if (foo (20) != 28) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/guality/pr56154-4.c b/gcc/testsuite/gcc.dg/guality/pr56154-4.c new file mode 100644 index 00000000000..bfe7338d62c --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr56154-4.c @@ -0,0 +1,34 @@ +/* PR debug/56154 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-additional-sources "pr56154-aux.c" } */ + +#include "../nop.h" + +extern void abort (void); + +volatile int z; + +__attribute__((noinline, noclone)) int +foo (int x) +{ + z = 6; + x++; + x++; + x++; + x++; + x++; + x++; + x++; + x++; + asm (NOP : : : "memory"); + asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-4.c:25 "x" "28" } } */ + return x; +} + +void +test_main (void) +{ + if (foo (20) != 28) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/guality/pr56154-aux.c b/gcc/testsuite/gcc.dg/guality/pr56154-aux.c new file mode 100644 index 00000000000..131173cb3f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr56154-aux.c @@ -0,0 +1,11 @@ +/* PR debug/56154 */ +/* { dg-do compile } */ + +extern void test_main (void); + +int +main () +{ + test_main (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr52448.c b/gcc/testsuite/gcc.dg/pr52448.c new file mode 100644 index 00000000000..0aeb2130f2c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr52448.c @@ -0,0 +1,30 @@ +/* PR tree-optimization/52448 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim-details" } */ + +extern void perhaps_free_something (void); + +void f1 (int *p, int a, int b, int cond, int cond2) +{ + *p = a; + if (cond) + perhaps_free_something (); + if (cond2) + *p = b; +} + +void f2 (int *p, int a, int b, int *cond, int *cond2) +{ + int i; + *p = a; + for (i = 0; cond[i]; i++) + { + if (cond2[i]) + *p = b; + perhaps_free_something (); + } +} + +/* None of the above conditional stores might be made unconditional. */ +/* { dg-final { scan-tree-dump-not "cstore" "cselim" } } */ +/* { dg-final { cleanup-tree-dump "cselim" } } */ diff --git a/gcc/testsuite/gcc.dg/pr56228.c b/gcc/testsuite/gcc.dg/pr56228.c new file mode 100644 index 00000000000..ccdcbe199a4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56228.c @@ -0,0 +1,16 @@ +/* PR target/56228 */ +/* { dg-do assemble } */ +/* { dg-options "-O2" } */ + +short a[14] = { 1, 2 }; +short b[15] = { 3, 4 }; + +int +foo () +{ + void (*fna) (void) = (void (*) (void)) a; + void (*fnb) (void) = (void (*) (void)) b; + fna (); + fnb (); + return a[1] == b[1]; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr56181.c b/gcc/testsuite/gcc.dg/torture/pr56181.c new file mode 100644 index 00000000000..c382b29c43b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr56181.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */
+/* { dg-options "-ftracer" } */
+
+int a, b;
+
+void f(void)
+{
+ if(a++)
+ {
+ for(a = 0; a < 1;)
+ {
+ for(b = 0; b < 1; b++)
+ {
+ while(a++ < 0);
+lbl:
+ ;
+ }
+
+ if(a)
+ goto lbl;
+ }
+
+ goto lbl;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c index ff140ed5414..35c3ebbdaf7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-einline" } */ +/* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=2" } */ /* { dg-add-options bind_pic_locally } */ extern void inlined (); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c b/gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c new file mode 100644 index 00000000000..c21dc17b527 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c @@ -0,0 +1,35 @@ +/* PR tree-optimization/56205 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-stdarg" } */ + +#include <stdarg.h> + +int a, b; +char c[128]; + +static inline void +foo (int x, char const *y, va_list z) +{ + __builtin_printf ("%s %d %s", x ? "" : "foo", ++a, (y && *y) ? "bar" : ""); + if (y && *y) + __builtin_vprintf (y, z); +} + +void +bar (int x, char const *y, ...) +{ + va_list z; + va_start (z, y); + if (!x && *c == '\0') + ++b; + foo (x, y, z); + va_end (z); +} + +/* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } } */ +/* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ +/* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ +/* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr53185-2.c b/gcc/testsuite/gcc.dg/vect/pr53185-2.c new file mode 100644 index 00000000000..2f9ea16ea92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr53185-2.c @@ -0,0 +1,27 @@ +void __attribute__((noinline,noclone)) +fn1 (int * __restrict f, int * __restrict d, unsigned short a, int c) +{ + unsigned short e; + for (e = 0; e < a; ++e) + f[e] = d[e * c]; +} + +extern void abort (void); + +int main () +{ + int a[32], b[3 * 32]; + int i, off; + for (i = 0; i < 3 * 32; ++i) + b[i] = i; + for (off = 0; off < 8; ++off) + { + fn1 (&a[off], &b[off], 32 - off, 3); + for (i = 0; i < 32 - off; ++i) + if (a[off+i] != b[off+i*3]) + abort (); + } + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ |