summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-convround-1.c
blob: 86612aa81b3d22414fbe772c098daef11b215b84 (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
/* PR middle-end/28473.  */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-original" } */

extern double round(double);
extern double floor(double);
extern double ceil(double);

unsigned long long test1(double x)
{
  return (unsigned long long) round(x);
}

unsigned long long test2(double x)
{
  return (unsigned long long) floor(x);
}
unsigned long long test3(double x)
{
  return (unsigned long long) ceil(x);
}

/* { dg-final { scan-tree-dump-times "__builtin_lround" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_llround" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_lfloor" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_llfloor" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_lceil" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_llceil" 0 "original" } } */
/* { dg-final { cleanup-tree-dump "original" } } */