This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, testsuite] Support SPU floating-point format in builtin-cproj-1.c


On Tue, Jan 4, 2011 at 12:23 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Hello,
>
> the testcase gcc.dg/torture/builtin-cproj-1.c fails on SPU, because
> the single-precision floating point format on this platform does not
> support Infinity values.
>
> The following patch fixes the test to avoid single-precision tests
> that need Infinity on the SPU target, just like already done for several
> other math tests.
>
> Tested on spu-elf.
>
> OK for mainline?

Ok.

Thanks,
Richard.

> Bye,
> Ulrich
>
> ChangeLog:
>
> ? ? ? ?* gcc.dg/torture/builtin-cproj-1.c: On the __SPU__ target, do not
> ? ? ? ?use __builtin_inff. ?Skip all single-precision tests that require
> ? ? ? ?Infinity.
>
>
> Index: gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c
> ===================================================================
> *** gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c ? ? ?(revision 168294)
> --- gcc/testsuite/gcc.dg/torture/builtin-cproj-1.c ? ? ?(working copy)
> *************** extern void link_error(int);
> *** 16,22 ****
> --- 16,26 ----
> ?#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)
> *************** extern void link_error(int);
> *** 30,35 ****
> --- 34,40 ----
>
> ?/* 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__); \
> *************** extern void link_error(int);
> *** 38,43 ****
> --- 43,56 ----
> ? ?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 { \
> *************** extern void link_error(int);
> *** 47,52 ****
> --- 60,66 ----
>
> ?/* 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)) \
> *************** extern void link_error(int);
> *** 58,65 ****
> --- 72,90 ----
> ? ? ? ?|| 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 \
> *************** extern void link_error(int);
> *** 74,82 ****
> --- 99,121 ----
> ? ?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); \
> *************** extern void link_error(int);
> *** 94,101 ****
> --- 133,155 ----
> ? ? ? ?|| 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; \
> *************** extern void link_error(int);
> *** 116,121 ****
> --- 170,192 ----
> ? ?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)
> --
> ?Dr. Ulrich Weigand
> ?GNU Toolchain for Linux on System z and Cell BE
> ?Ulrich.Weigand@de.ibm.com
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]