OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [builtins-18.c] - Blame information for rev 404

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Copyright (C) 2003 Free Software Foundation.
2
 
3
   Check that built-in cabs, cabsf and cabsl functions don't
4
   break anything and produces the expected results.
5
 
6
   Written by Roger Sayle, 1st June 2003.  */
7
 
8
/* { dg-do link } */
9
/* { dg-options "-O2 -ffast-math" } */
10
/* { dg-add-options c99_runtime } */
11
 
12
#include "builtins-config.h"
13
 
14
extern void link_error(void);
15
 
16
extern float cabsf (float _Complex);
17
extern double cabs (double _Complex);
18
extern long double cabsl (long double _Complex);
19
 
20
int
21
main (void)
22
{
23
  /* For each type, test both runtime and compile time (constant folding)
24
     optimization.  */
25
  float _Complex fc = 3.0F + 4.0iF;
26
  double _Complex dc = 3.0 + 4.0i;
27
  long double _Complex ldc = 3.0L + 4.0iL;
28
 
29
#ifdef HAVE_C99_RUNTIME
30
  /* Test floats.  */
31
  if (cabsf (fc) != 5.0F)
32
    link_error ();
33
  if (__builtin_cabsf (fc) != 5.0F)
34
    link_error ();
35
  if (cabsf (3.0F + 4.0iF) != 5.0F)
36
    link_error ();
37
  if (__builtin_cabsf (3.0F + 4.0iF) != 5.0F)
38
    link_error ();
39
#endif
40
 
41
  /* Test doubles.  */
42
  if (cabs (dc) != 5.0)
43
    link_error ();
44
  if (__builtin_cabs (dc) != 5.0)
45
    link_error ();
46
  if (cabs (3.0 + 4.0i) != 5.0)
47
    link_error ();
48
  if (__builtin_cabs (3.0 + 4.0i) != 5.0)
49
    link_error ();
50
 
51
#ifdef HAVE_C99_RUNTIME
52
  /* Test long doubles.  */
53
  if (cabsl (ldc) != 5.0L)
54
    link_error ();
55
  if (__builtin_cabsl (ldc) != 5.0L)
56
    link_error ();
57
  if (cabsl (3.0L + 4.0iL) != 5.0L)
58
    link_error ();
59
  if (__builtin_cabsl (3.0L + 4.0iL) != 5.0L)
60
    link_error ();
61
#endif
62
 
63
  return 0;
64
}
65
 

powered by: WebSVN 2.1.0

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