OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [complex-6.c] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* This test tests complex conjugate and passing/returning of
2
   complex parameter.  */
3
 
4
#include <stdlib.h>
5
#include <stdio.h>
6
 
7
int err;
8
 
9
#define TEST(TYPE, FUNC)                                        \
10
__complex__ TYPE                                                \
11
ctest_ ## FUNC (__complex__ TYPE x)                             \
12
{                                                               \
13
  __complex__ TYPE res;                                         \
14
                                                                \
15
  res = ~x;                                                     \
16
                                                                \
17
  return res;                                                   \
18
}                                                               \
19
                                                                \
20
void                                                            \
21
test_ ## FUNC (void)                                            \
22
{                                                               \
23
  __complex__ TYPE res, x;                                      \
24
                                                                \
25
  x = 1.0 + 2.0i;                                               \
26
                                                                \
27
  res = ctest_ ## FUNC (x);                                     \
28
                                                                \
29
  if (res != 1.0 - 2.0i)                                        \
30
    {                                                           \
31
      printf ("test_" #FUNC " failed\n");                       \
32
      ++err;                                                    \
33
    }                                                           \
34
}
35
 
36
 
37
TEST(float, float)
38
TEST(double, double)
39
TEST(long double, long_double)
40
TEST(int, int)
41
TEST(long int, long_int)
42
 
43
int
44
main (void)
45
{
46
 
47
  err = 0;
48
 
49
  test_float ();
50
  test_double ();
51
  test_long_double ();
52
  test_int ();
53
  test_long_int ();
54
 
55
  if (err != 0)
56
    abort ();
57
 
58
  return 0;
59
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.