aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/sinatan-3.c
blob: 600d475ba55f9cd2d0351ab73d4d5e17366380a3 (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
56
57
58
59
60
61
62
63
64
65
/* { dg-do compile } */
/* { dg-options "-Ofast -fdump-tree-optimized" } */

extern float sinf (float);
extern float cosf (float);
extern float atanf (float);
extern double sin (double);
extern double cos (double);
extern double atan (double);
extern long double sinl (long double);
extern long double cosl (long double);
extern long double atanl (long double);

float __attribute__ ((noinline)) 
cosatanf_(float x)
{
    float atg = atanf(x);
    return cosf(atg) + atg;
}

double __attribute__ ((noinline)) 
cosatan_(double x)
{
    double atg = atan(x);
    return cos(atg) + atg;
}

long double __attribute__ ((noinline)) 
cosatanl_(long double x)
{
    long double atg = atanl(x);
    return cosl(atg) + atg;
}

float __attribute__ ((noinline)) 
sinatanf_(float x)
{
    float atg = atanf(x);
    return sinf(atg) + atg;
}

double __attribute__ ((noinline)) 
sinatan_(double x)
{
    double atg = atan(x);
    return sin(atg) + atg;
}

long double __attribute__ ((noinline)) 
sinatanl_(long double x)
{
    long double atg = atanl(x);
    return sinl(atg) + atg;
}

/* There should be calls to both sin and atan */
/* { dg-final { scan-tree-dump "cos " "optimized" } } */
/* { dg-final { scan-tree-dump "sin " "optimized" } } */
/* { dg-final { scan-tree-dump "atan " "optimized" } } */
/* { dg-final { scan-tree-dump "cosf " "optimized" } } */
/* { dg-final { scan-tree-dump "sinf " "optimized" } } */
/* { dg-final { scan-tree-dump "atanf " "optimized" } } */
/* { dg-final { scan-tree-dump "cosl " "optimized" } } */
/* { dg-final { scan-tree-dump "sinl " "optimized" } } */
/* { dg-final { scan-tree-dump "atanl " "optimized" } } */