summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-26 02:40:31 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-26 02:40:31 +0000
commit503733d51e176d5a1f25368e6779571f6be9bd38 (patch)
tree89c8c348a9e0651724438367caf493fd2c71f690 /gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c
parentced4068a806f214d43721e310d16b361e011b925 (diff)
downloadgcc-503733d51e176d5a1f25368e6779571f6be9bd38.tar.gz
* builtins.c (fold_builtin_1): Treat ccos and ccosh as 'even'
functions. * fold-const.c (negate_mathfn_p): Treat casin, casinh, catan, catanh, cproj, csin, csinh, ctan and ctanh as 'odd' functions. testsuite: * gcc.dg/builtins-20.c: Add more cases. * gcc.dg/torture/builtin-symmetric-1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121200 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c b/gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c
index b8ea99d84cf..4834d8e2b32 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-symmetric-1.c
@@ -21,6 +21,16 @@ extern void link_error(int);
link_error(__LINE__); \
} while (0)
+/* Test that FUNC(-ARG) == FUNC(ARG), where ARG has a complex type. */
+#define TESTIT_EVEN_C(FUNC) do { \
+ if (__builtin_##FUNC##f(-cxf) != __builtin_##FUNC##f(cxf)) \
+ link_error(__LINE__); \
+ if (__builtin_##FUNC(-cx) != __builtin_##FUNC(cx)) \
+ link_error(__LINE__); \
+ if (__builtin_##FUNC##l(-cxl) != __builtin_##FUNC##l(cxl)) \
+ link_error(__LINE__); \
+ } while (0)
+
/* Test that FUNC(-VAR) == FUNC(VAR), where VAR has an int type. */
#define TESTIT_EVEN_I(FUNC,VAR) do { \
if (__builtin_##FUNC(-VAR) != __builtin_##FUNC(VAR)) \
@@ -37,13 +47,28 @@ extern void link_error(int);
link_error(__LINE__); \
} while (0)
+/* Test that -FUNC(ARG) == FUNC(-ARG), where ARG has a complex type. */
+#define TESTIT_ODD_C(FUNC) do { \
+ if (-__builtin_##FUNC##f(-cxf) != __builtin_##FUNC##f(cxf)) \
+ link_error(__LINE__); \
+ if (-__builtin_##FUNC(-cx) != __builtin_##FUNC(cx)) \
+ link_error(__LINE__); \
+ if (-__builtin_##FUNC##l(-cxl) != __builtin_##FUNC##l(cxl)) \
+ link_error(__LINE__); \
+ } while (0)
+
void foo (float xf, double x, long double xl,
+ __complex__ float cxf, __complex__ double cx, __complex__ long double cxl,
int i, long l, long long ll, __INTMAX_TYPE__ im)
{
TESTIT_EVEN(cos);
TESTIT_EVEN(cosh);
TESTIT_EVEN(fabs);
+ TESTIT_EVEN_C(ccos);
+ TESTIT_EVEN_C(ccosh);
+ TESTIT_EVEN_C(cabs);
+
TESTIT_EVEN_I(abs, i);
TESTIT_EVEN_I(imaxabs, im);
TESTIT_EVEN_I(labs, l);
@@ -67,10 +92,20 @@ void foo (float xf, double x, long double xl,
TESTIT_ODD(tan);
TESTIT_ODD(tanh);
TESTIT_ODD(trunc);
+
+ TESTIT_ODD_C(casin);
+ TESTIT_ODD_C(casinh);
+ TESTIT_ODD_C(catan);
+ TESTIT_ODD_C(catanh);
+ TESTIT_ODD_C(cproj);
+ TESTIT_ODD_C(csin);
+ TESTIT_ODD_C(csinh);
+ TESTIT_ODD_C(ctan);
+ TESTIT_ODD_C(ctanh);
}
int main()
{
- foo (1,1,1,1,1,1,1);
+ foo (1,1,1,1,1,1,1,1,1,1);
return 0;
}