diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/torture')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c | 41 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c | 52 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c | 30 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c | 15 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c | 10 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c | 27 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c | 37 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc | 4 |
8 files changed, 214 insertions, 2 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c new file mode 100644 index 0000000..ea11f26 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c @@ -0,0 +1,41 @@ +/* Test that exact underflow in __float128 signals the underflow + exception if trapping is enabled, but does not raise the flag + otherwise. */ + +/* { dg-do run { target i?86-*-*gnu* x86_64-*-*gnu* } } */ +/* { dg-options "-D_GNU_SOURCE" } */ +/* { dg-require-effective-target fenv_exceptions } */ + +#include <fenv.h> +#include <setjmp.h> +#include <signal.h> +#include <stdlib.h> + +volatile sig_atomic_t caught_sigfpe; +sigjmp_buf buf; + +static void +handle_sigfpe (int sig) +{ + caught_sigfpe = 1; + siglongjmp (buf, 1); +} + +int +main (void) +{ + volatile __float128 a = 0x1p-16382q, b = 0x1p-2q; + volatile __float128 r; + r = a * b; + if (fetestexcept (FE_UNDERFLOW)) + abort (); + if (r != 0x1p-16384q) + abort (); + feenableexcept (FE_UNDERFLOW); + signal (SIGFPE, handle_sigfpe); + if (sigsetjmp (buf, 1) == 0) + r = a * b; + if (!caught_sigfpe) + abort (); + exit (0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c new file mode 100644 index 0000000..f0dcef4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ + +#include <stdlib.h> + +#define NUM_OF_STATES 4 +typedef unsigned int entry_t[2]; +typedef struct entries_item { entry_t metricEntries_[0]; } entries_item_t; + +void __attribute__((noinline,noclone)) +test_00(size_t numOfStates, entries_item_t* p_bm, + const unsigned int* polyArray, + size_t polyArraySize) +{ + size_t idx; + unsigned int hlp0, hlp1; + for (idx = 0; idx < numOfStates; ++idx) + { + size_t idy; + + hlp0 = (idx << 1) | 0x00; + hlp1 = (idx << 1) | 0x01; + p_bm->metricEntries_[idx][0] = 0; + p_bm->metricEntries_[idx][1] = 0; + for (idy = 0; idy < polyArraySize; ++idy) + { + p_bm->metricEntries_[idx][0] + |= __builtin_parity(hlp0 & polyArray[idy]) << idy; + p_bm->metricEntries_[idx][1] + |= __builtin_parity(hlp1 & polyArray[idy]) << idy; + } + } +} + +int main() +{ + unsigned int polyArray[] = { 0x07, 0x05 }; + entries_item_t* pBranchMetrics; + pBranchMetrics = malloc(sizeof(entry_t) * NUM_OF_STATES); + test_00(NUM_OF_STATES, pBranchMetrics, polyArray, + sizeof(polyArray) / sizeof(polyArray[0])); + if (pBranchMetrics->metricEntries_[0][0] != 0 + || pBranchMetrics->metricEntries_[0][1] != 3 + || pBranchMetrics->metricEntries_[1][0] != 1 + || pBranchMetrics->metricEntries_[1][1] != 2 + || pBranchMetrics->metricEntries_[2][0] != 3 + || pBranchMetrics->metricEntries_[2][1] != 0 + || pBranchMetrics->metricEntries_[3][0] != 2 + || pBranchMetrics->metricEntries_[3][1] != 1) + abort (); + free(pBranchMetrics); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c new file mode 100644 index 0000000..de8951a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ + +int a[4], b, c, d; + +int +fn1 (int p) +{ + for (; d; d++) + { + unsigned int h; + for (h = 0; h < 3; h++) + { + if (a[c+c+h]) + { + if (p) + break; + return 0; + } + b = 0; + } + } + return 0; +} + +int +main () +{ + fn1 (0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c new file mode 100644 index 0000000..29defac --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +int a = 0, b = 1, c = 0, d = 1, e, f, g, h; +int +main () +{ + e = 1 >> d; + f = ((31 / (1 > e)) || c) / 2; + g = b || a; + h = 31 / g; + if (!h) + __builtin_abort(); + return 0; +} + diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c new file mode 100644 index 0000000..f4cbc43 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c @@ -0,0 +1,10 @@ +/* { dg-do run } */ + +int a = 0, b = 0, c = 0, d, e; +int +main (void) +{ + d = ((20 % (1 != b)) && c) + 2147483647; + e = 20 % (a >= 0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c new file mode 100644 index 0000000..06ede54 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +#include <setjmp.h> + +struct longjmp_buffer { + jmp_buf buf; +}; + +void plouf(); + +extern long interprete() +{ + long * sp; + int i; + long *args; + int n; + + struct longjmp_buffer raise_buf; + setjmp (raise_buf.buf); + + plouf(); + sp -= 4; + for (i = 0; i < n; i++) + args[i] = sp[10-i]; + plouf(); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c new file mode 100644 index 0000000..169993e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +extern void abort (void); +extern int memcmp (const void * , const void *, __SIZE_TYPE__); + +void __attribute__((noinline,noclone)) +foo(int *in) +{ + int i; + for (i = 62; i >= 10; i--) + { + in[i - 8] -= in[i]; + in[i - 5] += in[i] * 2; + in[i - 4] += in[i]; + } +} + +int main() +{ + int x[64]; + int y[64] = { 0, 1, -2380134, -1065336, -1026376, 3264240, 3113534, 2328130, 3632054, 3839634, 2380136, 1065339, 1026380, 1496037, 1397286, 789976, 386408, 450984, 597112, 497464, 262008, 149184, 194768, 231519, 173984, 87753, 60712, 82042, 87502, 60014, 30050, 25550, 33570, 32386, 20464, 10675, 10868, 13329, 11794, 6892, 3988, 4564, 5148, 4228, 2284, 1568, 1848, 1943, 1472, 741, 628, 702, 714, 474, 230, 234, 238, 242, 120, 59, 60, 61, 62, 63 }; + int i; + + for (i = 0; i < 64; ++i) + { + x[i] = i; + __asm__ volatile (""); + } + + foo (x); + + if (memcmp (x, y, sizeof (x)) != 0) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc b/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc index c50fa8e..d0cb738 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc @@ -23,7 +23,8 @@ T (19, 3, 2, 1, 0) \ T (20, 0, 4, 1, 5) \ T (21, 2, 6, 3, 7) \ T (22, 1, 2, 3, 0) \ -T (23, 2, 1, 0, 3) +T (23, 2, 1, 0, 3) \ +T (24, 2, 5, 6, 3) #define EXPTESTS \ T (116, 1, 2, 4, 3) \ T (117, 7, 3, 3, 0) \ @@ -31,7 +32,6 @@ T (118, 5, 3, 2, 7) \ T (119, 0, 3, 5, 6) \ T (120, 0, 0, 1, 5) \ T (121, 4, 6, 2, 1) \ -T (122, 2, 5, 6, 3) \ T (123, 4, 6, 3, 2) \ T (124, 4, 7, 5, 6) \ T (125, 0, 4, 2, 4) \ |