Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr105776.c

raw
1 /* PR tree-optimization/105776 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized -masm=att" } */
4 /* { dg-final { scan-tree-dump-times " = \.MUL_OVERFLOW " 5 "optimized" } } */
5 /* { dg-final { scan-assembler-times "\timull\t" 5 } } */
6 /* { dg-final { scan-assembler-times "\tsetno\t" 5 } } */
7
8 int
9 foo (unsigned x, unsigned y)
10 {
11 unsigned int r = x * y;
12 return !x || ((int) r / (int) x) == (int) y;
13 }
14
15 int
16 bar (unsigned x, unsigned y)
17 {
18 return !x || ((int) (x * y) / (int) x) == (int) y;
19 }
20
21 int
22 baz (unsigned x, unsigned y)
23 {
24 if (x == 0)
25 return 1;
26 return ((int) (x * y) / (int) x) == y;
27 }
28
29 int
30 qux (unsigned x, unsigned y, unsigned *z)
31 {
32 unsigned int r = x * y;
33 *z = r;
34 return !x || ((int) r / (int) x) == (int) y;
35 }
36
37 int
38 corge (unsigned x, unsigned y, unsigned *z)
39 {
40 unsigned int r = x * y;
41 *z = r;
42 return !x || ((int) r / (int) x) == y;
43 }