aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr120231-1.c
blob: c1ce44fd557110c0f27ddb7ebafb6c5a11d09ece (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
66
67
/* PR tree-optimization/120231 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-add-options float32 } */
/* { dg-add-options float64 } */
/* { dg-add-options float128 } */
/* { dg-require-effective-target float32 } */
/* { dg-require-effective-target float64 } */
/* { dg-require-effective-target float128 } */
/* { dg-final { scan-tree-dump-not "link_failure \\\(\\\);" "optimized" } } */

void link_failure (void);

void
foo (_Float64 x)
{
  if (x >= -64.0f64 && x <= 0x1.p+140f64)
    {
      _Float32 z = x;
      _Float128 w = z;
      _Float128 v = x;
      if (__builtin_isnan (z)
	  || __builtin_isnan (w)
	  || __builtin_isnan (v)
	  || z < -64.0f32
	  || w < -64.0f128
	  || __builtin_isinf (v)
	  || v < -64.0f128
	  || v > 0x1.p+140f128)
	link_failure ();
    }
}

void
bar (_Float64 x)
{
  _Float32 z = x;
  if (z >= -64.0f32 && z <= 0x1.p+38f32)
    {
      if (__builtin_isnan (x)
	  || __builtin_isinf (x)
	  || x < -0x1.000001p+6f64
	  || x > 0x1.000001p+38f64)
	link_failure ();
    }
}

void
baz (_Float64 x)
{
  _Float128 w = x;
  if (w >= -64.0f128 && w <= 0x1.p+1026f128)
    {
      if (__builtin_isnan (x)
	  || __builtin_isinf (x)
	  || x < -64.0f64)
	link_failure ();
    }
  if (w >= 128.25f128 && w <= 0x1.p+1020f128)
    {
      if (__builtin_isnan (x)
	  || __builtin_isinf (x)
	  || x < 128.25f64
	  || x > 0x1.p+1020f64)
	link_failure ();
    }
}