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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [complex-6.c] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
/* This test tests complex conjugate and passing/returning of
/* This test tests complex conjugate and passing/returning of
   complex parameter.  */
   complex parameter.  */
 
 
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
 
 
int err;
int err;
 
 
#define TEST(TYPE, FUNC)                                        \
#define TEST(TYPE, FUNC)                                        \
__complex__ TYPE                                                \
__complex__ TYPE                                                \
ctest_ ## FUNC (__complex__ TYPE x)                             \
ctest_ ## FUNC (__complex__ TYPE x)                             \
{                                                               \
{                                                               \
  __complex__ TYPE res;                                         \
  __complex__ TYPE res;                                         \
                                                                \
                                                                \
  res = ~x;                                                     \
  res = ~x;                                                     \
                                                                \
                                                                \
  return res;                                                   \
  return res;                                                   \
}                                                               \
}                                                               \
                                                                \
                                                                \
void                                                            \
void                                                            \
test_ ## FUNC (void)                                            \
test_ ## FUNC (void)                                            \
{                                                               \
{                                                               \
  __complex__ TYPE res, x;                                      \
  __complex__ TYPE res, x;                                      \
                                                                \
                                                                \
  x = 1.0 + 2.0i;                                               \
  x = 1.0 + 2.0i;                                               \
                                                                \
                                                                \
  res = ctest_ ## FUNC (x);                                     \
  res = ctest_ ## FUNC (x);                                     \
                                                                \
                                                                \
  if (res != 1.0 - 2.0i)                                        \
  if (res != 1.0 - 2.0i)                                        \
    {                                                           \
    {                                                           \
      printf ("test_" #FUNC " failed\n");                       \
      printf ("test_" #FUNC " failed\n");                       \
      ++err;                                                    \
      ++err;                                                    \
    }                                                           \
    }                                                           \
}
}
 
 
 
 
TEST(float, float)
TEST(float, float)
TEST(double, double)
TEST(double, double)
TEST(long double, long_double)
TEST(long double, long_double)
TEST(int, int)
TEST(int, int)
TEST(long int, long_int)
TEST(long int, long_int)
 
 
int
int
main (void)
main (void)
{
{
 
 
  err = 0;
  err = 0;
 
 
  test_float ();
  test_float ();
  test_double ();
  test_double ();
  test_long_double ();
  test_long_double ();
  test_int ();
  test_int ();
  test_long_int ();
  test_long_int ();
 
 
  if (err != 0)
  if (err != 0)
    abort ();
    abort ();
 
 
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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