111
|
1 /* PR tree-optimization/69097 */
|
|
2 /* { dg-do compile } */
|
|
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
|
|
4 /* All the x % -y below should be optimized into x % y, as
|
|
5 it should never be INT_MIN % -(-1). */
|
|
6 /* { dg-final { scan-tree-dump-not "-y" "optimized" } } */
|
|
7
|
|
8 int
|
|
9 f1 (int x, int y)
|
|
10 {
|
|
11 if (x == -__INT_MAX__ - 1)
|
|
12 __builtin_unreachable ();
|
|
13 return x % -y;
|
|
14 }
|
|
15
|
|
16 int
|
|
17 f2 (int x, int y)
|
|
18 {
|
|
19 if (x < -__INT_MAX__)
|
|
20 __builtin_unreachable ();
|
|
21 return x % -y;
|
|
22 }
|
|
23
|
|
24 int
|
|
25 f3 (int x, int y)
|
|
26 {
|
|
27 if (y == -1)
|
|
28 __builtin_unreachable ();
|
|
29 return x % -y;
|
|
30 }
|
|
31
|
|
32 int
|
|
33 f4 (int x, int y)
|
|
34 {
|
|
35 if (y < 0)
|
|
36 __builtin_unreachable ();
|
|
37 return x % -y;
|
|
38 }
|
|
39
|
|
40 int
|
|
41 f5 (int x, int y)
|
|
42 {
|
|
43 if (y >= -1)
|
|
44 __builtin_unreachable ();
|
|
45 return x % -y;
|
|
46 }
|
|
47
|
|
48 int
|
|
49 f6 (int x, int y)
|
|
50 {
|
|
51 if (y < 0 || y > 24)
|
|
52 __builtin_unreachable ();
|
|
53 return x % -y;
|
|
54 }
|
|
55
|
|
56 int
|
|
57 f7 (int x, int y)
|
|
58 {
|
|
59 if (y <= -17 || y >= -1)
|
|
60 __builtin_unreachable ();
|
|
61 return x % -y;
|
|
62 }
|
|
63
|
|
64 int
|
|
65 f8 (int x, int y)
|
|
66 {
|
|
67 if (y >= -13 && y <= 15)
|
|
68 __builtin_unreachable ();
|
|
69 return x % -y;
|
|
70 }
|
|
71
|
|
72 int
|
|
73 f9 (int x, int y)
|
|
74 {
|
|
75 return x % -(y & ~4);
|
|
76 }
|
|
77
|
|
78 int
|
|
79 f10 (int x, int y)
|
|
80 {
|
|
81 if (x != -__INT_MAX__ - 1)
|
|
82 return x % -y;
|
|
83 return 34;
|
|
84 }
|
|
85
|
|
86 int
|
|
87 f11 (int x, int y)
|
|
88 {
|
|
89 if (x >= -__INT_MAX__)
|
|
90 return x % -y;
|
|
91 return 34;
|
|
92 }
|
|
93
|
|
94 int
|
|
95 f12 (int x, int y)
|
|
96 {
|
|
97 if (y != -1)
|
|
98 return x % -y;
|
|
99 return 34;
|
|
100 }
|
|
101
|
|
102 int
|
|
103 f13 (int x, int y)
|
|
104 {
|
|
105 if (y >= 0)
|
|
106 return x % -y;
|
|
107 return 34;
|
|
108 }
|
|
109
|
|
110 int
|
|
111 f14 (int x, int y)
|
|
112 {
|
|
113 if (y < -1)
|
|
114 return x % -y;
|
|
115 return 34;
|
|
116 }
|
|
117
|
|
118 int
|
|
119 f15 (int x, int y)
|
|
120 {
|
|
121 if (y >= 0 && y <= 24)
|
|
122 return x % -y;
|
|
123 return 34;
|
|
124 }
|
|
125
|
|
126 int
|
|
127 f16 (int x, int y)
|
|
128 {
|
|
129 if (y > -17 && y < -1)
|
|
130 return x % -y;
|
|
131 return 34;
|
|
132 }
|
|
133
|
|
134 int
|
|
135 f17 (int x, int y)
|
|
136 {
|
|
137 if (y < -13 || y > 15)
|
|
138 return x % -y;
|
|
139 return 34;
|
|
140 }
|