diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c | 71 |
2 files changed, 77 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 51daa49..e697796 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-01-04 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * gcc.dg/torture/builtin-cproj-1.c: On the __SPU__ target, do not + use __builtin_inff. Skip all single-precision tests that require + Infinity. + 2011-01-03 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> * g++.dg/torture/pr46111.C: Add dg-require-effective-target pthread. diff --git a/gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c b/gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c index 031a2fc..53ae604 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c @@ -16,7 +16,11 @@ extern void link_error(int); #define CPROJ(X) __builtin_cproj(X) #define CPROJF(X) __builtin_cprojf(X) #define CPROJL(X) __builtin_cprojl(X) +#ifndef __SPU__ #define INF __builtin_inff() +#else +#define INF __builtin_inf() +#endif #define I 1i #define CPSGN(X,Y) __builtin_copysignf((X),(Y)) #define CIMAG(X) __builtin_cimagf(X) @@ -30,6 +34,7 @@ extern void link_error(int); /* Test that (cproj(X) == ZERO+Inf) and that the signs of the imaginary parts match. ZERO is +/- 0i. */ +#ifndef __SPU__ #define TEST_CST_INF(X,ZERO) do { \ if (CPROJF(X) != ZERO+INF || CKSGN_I(CPROJF(X),ZERO+INF)) \ link_error(__LINE__); \ @@ -38,6 +43,14 @@ extern void link_error(int); if (CPROJL(X) != ZERO+INF || CKSGN_I(CPROJL(X),ZERO+INF)) \ link_error(__LINE__); \ } while (0) +#else +#define TEST_CST_INF(X,ZERO) do { \ + if (CPROJ(X) != ZERO+INF || CKSGN_I(CPROJ(X),ZERO+INF)) \ + link_error(__LINE__); \ + if (CPROJL(X) != ZERO+INF || CKSGN_I(CPROJL(X),ZERO+INF)) \ + link_error(__LINE__); \ +} while (0) +#endif /* Test that (cproj(X) == X) for all finite (X). */ #define TEST_CST(X) do { \ @@ -47,6 +60,7 @@ extern void link_error(int); /* Test that cproj(X + I*INF) -> (ZERO + INF), where ZERO is +-0i. NEG is either blank or a minus sign when ZERO is negative. */ +#ifndef __SPU__ #define TEST_IMAG_INF(NEG,ZERO) do { \ if (CPROJF(f+I*NEG INF) != ZERO+INF \ || CKSGN_I (CPROJF(f+I*NEG INF), ZERO+INF)) \ @@ -58,8 +72,19 @@ extern void link_error(int); || CKSGN_I (CPROJL(ld+I*NEG INF), ZERO+INF)) \ link_error(__LINE__); \ } while (0) +#else +#define TEST_IMAG_INF(NEG,ZERO) do { \ + if (CPROJ(d+I*NEG INF) != ZERO+INF \ + || CKSGN_I (CPROJ(d+I*NEG INF), ZERO+INF)) \ + link_error(__LINE__); \ + if (CPROJL(ld+I*NEG INF) != ZERO+INF \ + || CKSGN_I (CPROJL(ld+I*NEG INF), ZERO+INF)) \ + link_error(__LINE__); \ +} while (0) +#endif /* Like TEST_IMAG_INF, but check that side effects are honored. */ +#ifndef __SPU__ #define TEST_IMAG_INF_SIDE_EFFECT(NEG,ZERO) do { \ int side = 4; \ if (CPROJF(++side+I*NEG INF) != ZERO+INF \ @@ -74,9 +99,23 @@ extern void link_error(int); if (side != 10) \ link_error(__LINE__); \ } while (0) +#else +#define TEST_IMAG_INF_SIDE_EFFECT(NEG,ZERO) do { \ + int side = 4; \ + if (CPROJ(++side+I*NEG INF) != ZERO+INF \ + || CKSGN_I (CPROJ(++side+I*NEG INF), ZERO+INF)) \ + link_error(__LINE__); \ + if (CPROJL(++side+I*NEG INF) != ZERO+INF \ + || CKSGN_I (CPROJL(++side+I*NEG INF), ZERO+INF)) \ + link_error(__LINE__); \ + if (side != 8) \ + link_error(__LINE__); \ +} while (0) +#endif /* Test that cproj(INF, POSITIVE) -> INF+0i. NEG is either blank or a minus sign to test negative INF. */ +#ifndef __SPU__ #define TEST_REAL_INF(NEG) do { \ __real cf = NEG INF; \ __imag cf = (x ? 4 : 5); \ @@ -94,8 +133,23 @@ extern void link_error(int); || CKSGN_I (CPROJL(cld), INF)) \ link_error(__LINE__); \ } while (0) +#else +#define TEST_REAL_INF(NEG) do { \ + __real cd = NEG INF; \ + __imag cd = (x ? 4 : 5); \ + if (CPROJ(cd) != INF \ + || CKSGN_I (CPROJ(cd), INF)) \ + link_error(__LINE__); \ + __real cld = NEG INF; \ + __imag cld = (x ? 4 : 5); \ + if (CPROJL(cld) != INF \ + || CKSGN_I (CPROJL(cld), INF)) \ + link_error(__LINE__); \ +} while (0) +#endif /* Like TEST_REAL_INF, but check that side effects are honored. */ +#ifndef __SPU__ #define TEST_REAL_INF_SIDE_EFFECT(NEG) do { \ int side = -9; \ __real cf = NEG INF; \ @@ -116,6 +170,23 @@ extern void link_error(int); if (side != -3) \ link_error(__LINE__); \ } while (0) +#else +#define TEST_REAL_INF_SIDE_EFFECT(NEG) do { \ + int side = -9; \ + __real cd = NEG INF; \ + __imag cd = (x ? 4 : 5); \ + if (CPROJ((++side,cd)) != INF \ + || CKSGN_I (CPROJ((++side,cd)), INF)) \ + link_error(__LINE__); \ + __real cld = NEG INF; \ + __imag cld = (x ? 4 : 5); \ + if (CPROJL((++side,cld)) != INF \ + || CKSGN_I (CPROJL((++side,cld)), INF)) \ + link_error(__LINE__); \ + if (side != -5) \ + link_error(__LINE__); \ +} while (0) +#endif void foo (_Complex long double cld, _Complex double cd, _Complex float cf, long double ld, double d, float f, int x) |