Debian Codegraph @

gcc/testsuite/g++.dg/recip_sqrt_mult_1.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-Ofast -fnon-call-exceptions -fdump-tree-recip" } */
3
4 double res, res2, tmp;
5 void
6 foo1 (double a, double b)
7 {
8 try {
9 tmp = 1.0 / __builtin_sqrt (a);
10 res = tmp * tmp;
11 res2 = a * tmp;
12 }
13 catch (...)
14 { ; }
15 }
16
17 void
18 foo4 (double a, double b, int c, int d)
19 {
20 try {
21 tmp = 1.0 / __builtin_sqrt (a);
22 }
23 catch (...)
24 {
25 if (c)
26 res = tmp * tmp;
27
28 if (d)
29 res2 = a * tmp;
30 }
31 }
32
33 void
34 foo5 (double a, double b, int c, int d)
35 {
36 try {
37 tmp = 1.0 / __builtin_sqrt (a);
38 res = tmp * tmp;
39
40 if (d)
41 res2 = a * tmp;
42 }
43 catch (...)
44 { ; }
45 }
46
47 /* { dg-final { scan-tree-dump-times "Optimizing reciprocal sqrt multiplications" 2 "recip" } } */
48 /* { dg-final { scan-tree-dump-times "Replacing squaring multiplication" 2 "recip" } } */
49 /* { dg-final { scan-tree-dump-times "Replacing original division" 2 "recip" } } */