summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-3.c
blob: 49bea5e126e90ee65f970ebf4f82b92a4efaab1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Copyright (C) 2002  Free Software Foundation.

   Verify that built-in math function constant folding of constant
   arguments is correctly performed by the by the compiler.

   Written by Roger Sayle, 16th August 2002.  */

/* { dg-do link } */
/* { dg-options "-O2 -ffast-math" } */

extern void link_error(void);

int main()
{
  if (sqrt (0.0) != 0.0)
    link_error ();

  if (sqrt (1.0) != 1.0)
    link_error ();

  if (exp (0.0) != 1.0)
    link_error ();

  if (log (1.0) != 0.0)
    link_error ();


  if (sqrtf (0.0f) != 0.0f)
    link_error ();

  if (sqrtf (1.0f) != 1.0f)
    link_error ();

  if (expf (0.0f) != 1.0f)
    link_error ();

  if (logf (1.0f) != 0.0f)
    link_error ();


  if (sqrtl (0.0l) != 0.0l)
    link_error ();

  if (sqrtl (1.0l) != 1.0l)
    link_error ();

  if (expl (0.0l) != 1.0l)
    link_error ();

  if (logl (1.0l) != 0.0l)
    link_error ();

  return 0;
}