Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/range-sqrt-2.c

raw
1 // { dg-do compile }
2 // { dg-options "-O2 -fdump-tree-evrp -fno-thread-jumps" }
3
4 #include <math.h>
5
6 void use (double);
7 void link_error ();
8
9 void
10 foo (double x)
11 {
12 if (x < 1.0 || x > 9.0)
13 __builtin_unreachable ();
14 x = sqrt (x);
15 if (x < 0.875 || x > 3.125)
16 link_error ();
17 use (x);
18 }
19
20 void
21 bar (double x)
22 {
23 if (sqrt (x) >= 2.0 && sqrt (x) <= 4.0)
24 {
25 if (__builtin_isnan (x))
26 link_error ();
27 if (x < 3.875 || x > 16.125)
28 link_error ();
29 }
30 }
31
32 void
33 stool (double x)
34 {
35 if (x >= 64.0)
36 {
37 double res1 = sqrt (x);
38 double res2 = __builtin_sqrt (x);
39 if (res1 < 7.875 || res2 < 7.875)
40 link_error ();
41 }
42 }
43
44 // { dg-final { scan-tree-dump-not "link_error" "evrp" { target { { *-*-linux* } && { glibc } } } } }