1 /* PR tree-optimization/92734 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* Verify there are no binary additions or subtractions left. There can
5 be just casts and negations. */
6 /* { dg-final { scan-tree-dump-not " \[+-] " "optimized" } } */
7
8 int
f1(int x,unsigned y)9 f1 (int x, unsigned y)
10 {
11 int a = x + y;
12 return a - x;
13 }
14
15 unsigned
f2(unsigned x,int y)16 f2 (unsigned x, int y)
17 {
18 unsigned a = (int) x + y;
19 return a - x;
20 }
21
22 int
f3(int x,unsigned y)23 f3 (int x, unsigned y)
24 {
25 int a = x - y;
26 return a - x;
27 }
28
29 unsigned
f4(unsigned x,int y)30 f4 (unsigned x, int y)
31 {
32 unsigned a = (int) x - y;
33 return a - x;
34 }
35
36 int
f5(unsigned x,int y)37 f5 (unsigned x, int y)
38 {
39 int a = x - y;
40 return a + y;
41 }
42
43 unsigned
f6(int x,unsigned y)44 f6 (int x, unsigned y)
45 {
46 unsigned a = x - (int) y;
47 return a + y;
48 }
49
50 int
f7(int x,unsigned y)51 f7 (int x, unsigned y)
52 {
53 int a = x + y;
54 return x - a;
55 }
56
57 unsigned
f8(unsigned x,int y)58 f8 (unsigned x, int y)
59 {
60 unsigned a = (int) x + y;
61 return x - a;
62 }
63
64 int
f9(int x,unsigned y)65 f9 (int x, unsigned y)
66 {
67 int a = x - y;
68 return x - a;
69 }
70
71 unsigned
f10(unsigned x,int y)72 f10 (unsigned x, int y)
73 {
74 unsigned a = (int) x - y;
75 return x - a;
76 }
77