111
|
1 /* PR tree-optimization/66187 */
|
|
2 /* { dg-do run } */
|
|
3 /* { dg-options "-O2 -fwrapv" } */
|
|
4
|
|
5 __attribute__((noinline, noclone)) int
|
|
6 f0 (unsigned char x, unsigned char y)
|
|
7 {
|
|
8 return (x + y) & 0x2ff;
|
|
9 }
|
|
10
|
|
11 __attribute__((noinline, noclone)) int
|
|
12 f1 (unsigned char x, unsigned char y)
|
|
13 {
|
|
14 return (x - y) & 0x2ff;
|
|
15 }
|
|
16
|
|
17 __attribute__((noinline, noclone)) int
|
|
18 f2 (signed char x, signed char y)
|
|
19 {
|
|
20 return (x + y) & -4;
|
|
21 }
|
|
22
|
|
23 __attribute__((noinline, noclone)) int
|
|
24 f3 (signed char x, signed char y)
|
|
25 {
|
|
26 return (x + y) & 0xf8;
|
|
27 }
|
|
28
|
|
29 __attribute__((noinline, noclone)) int
|
|
30 f4 (signed char x, signed char y)
|
|
31 {
|
|
32 return (x + y) & 0x78;
|
|
33 }
|
|
34
|
|
35 __attribute__((noinline, noclone)) int
|
|
36 f5 (unsigned char x, unsigned char y)
|
|
37 {
|
|
38 int a = x;
|
|
39 int b = y;
|
|
40 int c = a + b;
|
|
41 return c & 0x2ff;
|
|
42 }
|
|
43
|
|
44 __attribute__((noinline, noclone)) int
|
|
45 f6 (unsigned char x, unsigned char y)
|
|
46 {
|
|
47 int a = x;
|
|
48 int b = y;
|
|
49 int c = a - b;
|
|
50 return c & 0x2ff;
|
|
51 }
|
|
52
|
|
53 __attribute__((noinline, noclone)) int
|
|
54 f7 (signed char x, signed char y)
|
|
55 {
|
|
56 int a = x;
|
|
57 int b = y;
|
|
58 int c = a + b;
|
|
59 return c & -4;
|
|
60 }
|
|
61
|
|
62 __attribute__((noinline, noclone)) int
|
|
63 f8 (signed char x, signed char y)
|
|
64 {
|
|
65 int a = x;
|
|
66 int b = y;
|
|
67 int c = a + b;
|
|
68 return c & 0xf8;
|
|
69 }
|
|
70
|
|
71 __attribute__((noinline, noclone)) int
|
|
72 f9 (signed char x, signed char y)
|
|
73 {
|
|
74 int a = x;
|
|
75 int b = y;
|
|
76 int c = a + b;
|
|
77 return c & 0x78;
|
|
78 }
|
|
79
|
|
80 int
|
|
81 main ()
|
|
82 {
|
|
83 if (__SCHAR_MAX__ != 127 || sizeof (int) != 4)
|
|
84 return 0;
|
|
85 if (f0 (0xff, 0xff) != 0xfe
|
|
86 || f1 (0, 1) != 0x2ff
|
|
87 || f2 (-2, 1) != -4
|
|
88 || f3 (-2, 1) != 0xf8
|
|
89 || f4 (-2, 1) != 0x78
|
|
90 || f5 (0xff, 0xff) != 0xfe
|
|
91 || f6 (0, 1) != 0x2ff
|
|
92 || f7 (-2, 1) != -4
|
|
93 || f8 (-2, 1) != 0xf8
|
|
94 || f9 (-2, 1) != 0x78)
|
|
95 __builtin_abort ();
|
|
96 return 0;
|
|
97 }
|