1 /* PR tree-optimization/67815 */
2 /* { dg-do compile } */
3 /* { dg-options "-Ofast -g -fdump-tree-reassoc1-details" } */
4
5 extern float barf (float, float);
6 extern double bar (double, double);
7
8 float
f0(float x)9 f0 (float x)
10 {
11 return 7.5 * __builtin_copysignf (2.0, x);
12 }
13
14 float
f1(float x)15 f1 (float x)
16 {
17 return -7.5 * __builtin_copysignf (2.0, x);
18 }
19
20 double
f2(double x,double y)21 f2 (double x, double y)
22 {
23 return x * ((1.0/12) * __builtin_copysign (1.0, y));
24 }
25
26 double
f3(double x,double y)27 f3 (double x, double y)
28 {
29 return (x * (-1.0/12)) * __builtin_copysign (1.0, y);
30 }
31
32 double
f4(double x,double y,double z)33 f4 (double x, double y, double z)
34 {
35 return (x * z) * ((1.0/12) * __builtin_copysign (4.0, y));
36 }
37
38 double
f5(double x,double y,double z)39 f5 (double x, double y, double z)
40 {
41 return (x * (-1.0/12)) * z * __builtin_copysign (2.0, y);
42 }
43
44 float
f6(float x,float y)45 f6 (float x, float y)
46 {
47 return 7.5f * y * __builtin_copysignf (2.0f, x);
48 }
49
50 float
f7(float x,float y)51 f7 (float x, float y)
52 {
53 return -7.5f * y * __builtin_copysignf (2.0f, x);
54 }
55
56 float
f8(float x)57 f8 (float x)
58 {
59 float tmp1 = 7.5f;
60 float tmp2 = __builtin_copysignf (2.0f, x);
61 return tmp1 * tmp2;
62 }
63
64 double
f9(double x)65 f9 (double x)
66 {
67 double tmp1 = 7.5;
68 double tmp2 = __builtin_copysign (2.0, x);
69 return tmp1 * tmp2;
70 }
71
72 float
f10(float x)73 f10 (float x)
74 {
75 float tmp1 = 7.5f;
76 float tmp2 = __builtin_copysignf (2.0f, x);
77 float tmp3 = tmp2 * 24.0f;
78 return tmp1 * tmp2;
79 }
80
81 double
f11(double x)82 f11 (double x)
83 {
84 double tmp1 = 7.5;
85 double tmp2 = __builtin_copysign (2.0, x);
86 double tmp3 = tmp2 * 24.0;
87 return tmp1 * tmp2;
88 }
89
90 float
f12(float x)91 f12 (float x)
92 {
93 float tmp1 = 7.5f;
94 float tmp2 = __builtin_copysignf (2.0f, x);
95 /* Can't reassoc here. */
96 return barf (tmp1 * tmp2, tmp2);
97 }
98
99 double
f13(double x)100 f13 (double x)
101 {
102 double tmp1 = 7.5;
103 double tmp2 = __builtin_copysign (2.0, x);
104 /* Can't reassoc here. */
105 return bar (tmp1 * tmp2, tmp2);
106 }
107 /* { dg-final { scan-tree-dump-times "Optimizing copysign" 12 "reassoc1"} }*/
108