Tighten condition in vect/pr85586.c (PR 85654)
[official-gcc.git] / gcc / testsuite / gcc.dg / pr66187-1.c
blob62aea6978d97d35611e91484be344acc67a94660
1 /* PR tree-optimization/66187 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fno-wrapv" } */
5 __attribute__((noinline, noclone)) int
6 f0 (unsigned char x, unsigned char y)
8 return (x + y) & 0x2ff;
11 __attribute__((noinline, noclone)) int
12 f1 (unsigned char x, unsigned char y)
14 return (x - y) & 0x2ff;
17 __attribute__((noinline, noclone)) int
18 f2 (signed char x, signed char y)
20 return (x + y) & -4;
23 __attribute__((noinline, noclone)) int
24 f3 (signed char x, signed char y)
26 return (x + y) & 0xf8;
29 __attribute__((noinline, noclone)) int
30 f4 (signed char x, signed char y)
32 return (x + y) & 0x78;
35 __attribute__((noinline, noclone)) int
36 f5 (unsigned char x, unsigned char y)
38 int a = x;
39 int b = y;
40 int c = a + b;
41 return c & 0x2ff;
44 __attribute__((noinline, noclone)) int
45 f6 (unsigned char x, unsigned char y)
47 int a = x;
48 int b = y;
49 int c = a - b;
50 return c & 0x2ff;
53 __attribute__((noinline, noclone)) int
54 f7 (signed char x, signed char y)
56 int a = x;
57 int b = y;
58 int c = a + b;
59 return c & -4;
62 __attribute__((noinline, noclone)) int
63 f8 (signed char x, signed char y)
65 int a = x;
66 int b = y;
67 int c = a + b;
68 return c & 0xf8;
71 __attribute__((noinline, noclone)) int
72 f9 (signed char x, signed char y)
74 int a = x;
75 int b = y;
76 int c = a + b;
77 return c & 0x78;
80 int
81 main ()
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;