From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../c-c++-common/torture/complex-sign-mul-one.c | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c (limited to 'gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c') diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c new file mode 100644 index 000000000..ad02a2cd6 --- /dev/null +++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c @@ -0,0 +1,63 @@ +/* Test complex arithmetic with signed zeros. Pure complex + multiplication with 1.0 + 0.0i. */ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" { target c } } */ + +#include "complex-sign.h" + +#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \ + do { \ + _Complex TYPE a1, b1, c1; \ + volatile _Complex TYPE a2, b2, c2; \ + a1 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a1, COPY, S1, S2); \ + b1 = ONE + ZEROI; \ + c1 = a1 * b1; \ + CHECK_RES (c1, COPY, SR, SI); \ + c1 = a1 * (ONE + ZEROI); \ + CHECK_RES (c1, COPY, SR, SI); \ + a2 = ENCODE(ZERO, ZEROI, S1, S2); \ + CHECK_RES (a2, COPY, S1, S2); \ + b2 = ONE + ZEROI; \ + c2 = a2 * b2; \ + CHECK_RES (c2, COPY, SR, SI); \ + c2 = a2 * (ONE + ZEROI); \ + CHECK_RES (c2, COPY, SR, SI); \ + } while (0) + +#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \ + do { \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, +, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, -, +); \ + CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, -); \ + } while (0) + +void +check_mul_float (void) +{ +#ifndef __SPU__ + CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f); +#endif +} + +void +check_mul_double (void) +{ + CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0); +} + +void +check_mul_long_double (void) +{ + CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l); +} + +int +main (void) +{ + check_mul_float (); + check_mul_double (); + check_mul_long_double (); + exit (0); +} -- cgit v1.2.3