Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr97997-2.c

raw
1 /* PR tree-optimization/97997 */
2 /* { dg-do compile { target { ilp32 || lp64 } } } */
3 /* { dg-options "-O2 -fdump-tree-optimized -fwrapv" } */
4 /* { dg-final { scan-tree-dump-times "return x_\[0-9]*\\\(D\\\);" 4 "optimized" } } */
5 /* { dg-final { scan-tree-dump-not " / " "optimized" } } */
6 /* { dg-final { scan-tree-dump-not " \\* " "optimized" } } */
7
8 unsigned short
9 f1 (unsigned short x)
10 {
11 return x * 10 / 10;
12 }
13
14 unsigned short
15 f2 (unsigned short x)
16 {
17 int a = x;
18 int b = 10;
19 int c = 10;
20 return a * b / c;
21 }
22
23 short
24 f3 (short x, short y)
25 {
26 return x * y / y;
27 }
28
29 int
30 f4 (int x, int y)
31 {
32 if (x >= 30000)
33 __builtin_unreachable ();
34 if (x <= -30000)
35 __builtin_unreachable ();
36 if (y >= __INT_MAX__ / 30000)
37 __builtin_unreachable ();
38 if (y <= -__INT_MAX__ / 30000)
39 __builtin_unreachable ();
40 return x * y / y;
41 }