Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr95852-3.c

raw
1 /* PR tree-optimization/95852 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized -masm=att" } */
4 /* { dg-final { scan-tree-dump-times " = \.MUL_OVERFLOW " 32 "optimized" } } */
5 /* { dg-final { scan-assembler-times "\timull\t" 32 } } */
6 /* { dg-final { scan-assembler-times "\tseto\t" 8 } } */
7 /* { dg-final { scan-assembler-times "\tsetno\t" 8 } } */
8 /* { dg-final { scan-assembler-times "\tjn\?o\t" 16 } } */
9
10 unsigned fn (void);
11
12 int
13 f1 (unsigned x, unsigned y, unsigned *res)
14 {
15 *res = x * y;
16 return x && ((int) *res / (int) x) != (int) y;
17 }
18
19 unsigned
20 f2 (unsigned x, unsigned y)
21 {
22 unsigned int r = x * y;
23 if (x && ((int) r / (int) x) != (int) y)
24 return fn ();
25 return r;
26 }
27
28 int
29 f3 (unsigned x, unsigned y, unsigned *res)
30 {
31 *res = x * y;
32 return !x || ((int) *res / (int) x) == (int) y;
33 }
34
35 unsigned
36 f4 (unsigned x, unsigned y)
37 {
38 unsigned int r = x * y;
39 if (!x || ((int) r / (int) x) == (int) y)
40 return fn ();
41 return r;
42 }
43
44 int
45 f5 (int x, int y, int *res)
46 {
47 *res = (unsigned) x * y;
48 return x && (*res / x) != y;
49 }
50
51 int
52 f6 (int x, int y)
53 {
54 int r = (unsigned) x * y;
55 if (x && (r / x) != y)
56 return fn ();
57 return r;
58 }
59
60 int
61 f7 (int x, int y, int *res)
62 {
63 *res = (unsigned) x * y;
64 return !x || (*res / x) == y;
65 }
66
67 int
68 f8 (int x, int y)
69 {
70 int r = (unsigned) x * y;
71 if (!x || (r / x) == y)
72 return fn ();
73 return r;
74 }
75
76 int
77 f9 (unsigned x, unsigned y, unsigned *res)
78 {
79 *res = x * y;
80 return y && ((int) *res / (int) y) != (int) x;
81 }
82
83 unsigned
84 f10 (unsigned x, unsigned y)
85 {
86 unsigned int r = x * y;
87 if (y && ((int) r / (int) y) != (int) x)
88 return fn ();
89 return r;
90 }
91
92 int
93 f11 (unsigned x, unsigned y, unsigned *res)
94 {
95 *res = x * y;
96 return !y || ((int) *res / (int) y) == (int) x;
97 }
98
99 unsigned
100 f12 (unsigned x, unsigned y)
101 {
102 unsigned int r = x * y;
103 if (!y || ((int) r / (int) y) == (int) x)
104 return fn ();
105 return r;
106 }
107
108 int
109 f13 (int x, int y, int *res)
110 {
111 *res = (unsigned) x * y;
112 return y && (*res / y) != x;
113 }
114
115 int
116 f14 (int x, int y)
117 {
118 int r = (unsigned) x * y;
119 if (y && (r / y) != x)
120 return fn ();
121 return r;
122 }
123
124 int
125 f15 (int x, int y, int *res)
126 {
127 *res = (unsigned) x * y;
128 return !y || (*res / y) == x;
129 }
130
131 int
132 f16 (int x, int y)
133 {
134 int r = (unsigned) x * y;
135 if (!y || (r / y) == x)
136 return fn ();
137 return r;
138 }
139
140 int
141 f17 (unsigned x, unsigned *res)
142 {
143 *res = x * 35U;
144 return x && ((int) *res / (int) x) != 35;
145 }
146
147 unsigned
148 f18 (unsigned x)
149 {
150 unsigned int r = x * 35U;
151 if (x && ((int) r / (int) x) != 35)
152 return fn ();
153 return r;
154 }
155
156 int
157 f19 (unsigned x, unsigned *res)
158 {
159 *res = x * 35U;
160 return !x || ((int) *res / (int) x) == 35;
161 }
162
163 unsigned
164 f20 (unsigned x)
165 {
166 unsigned int r = x * 35U;
167 if (!x || ((int) r / (int) x) == 35)
168 return fn ();
169 return r;
170 }
171
172 int
173 f21 (int x, int *res)
174 {
175 *res = (unsigned) x * 35;
176 return x && (*res / x) != 35;
177 }
178
179 int
180 f22 (int x)
181 {
182 int r = (unsigned) x * 35;
183 if (x && (r / x) != 35)
184 return fn ();
185 return r;
186 }
187
188 int
189 f23 (int x, int *res)
190 {
191 *res = (unsigned) x * 35;
192 return !x || (*res / x) == 35;
193 }
194
195 int
196 f24 (int x)
197 {
198 int r = (unsigned) x * 35;
199 if (!x || (r / x) == 35)
200 return fn ();
201 return r;
202 }
203
204 int
205 f25 (unsigned x, unsigned *res)
206 {
207 *res = x * 35U;
208 return ((int) *res / 35) != (int) x;
209 }
210
211 unsigned
212 f26 (unsigned x)
213 {
214 unsigned int r = x * 35U;
215 if (((int) r / 35) != (int) x)
216 return fn ();
217 return r;
218 }
219
220 int
221 f27 (unsigned x, unsigned *res)
222 {
223 *res = x * 35U;
224 return ((int) *res / 35) == (int) x;
225 }
226
227 unsigned
228 f28 (unsigned x)
229 {
230 unsigned int r = x * 35U;
231 if (((int) r / 35) == (int) x)
232 return fn ();
233 return r;
234 }
235
236 int
237 f29 (int x, int *res)
238 {
239 *res = (unsigned) x * 35;
240 return 35 && (*res / 35) != x;
241 }
242
243 int
244 f30 (int x)
245 {
246 int r = (unsigned) x * 35;
247 if ((r / 35) != x)
248 return fn ();
249 return r;
250 }
251
252 int
253 f31 (int x, int *res)
254 {
255 *res = (unsigned) x * 35;
256 return (*res / 35) == x;
257 }
258
259 int
260 f32 (int x)
261 {
262 int r = (unsigned) x * 35;
263 if ((r / 35) == x)
264 return fn ();
265 return r;
266 }