Debian Codegraph @

gcc/testsuite/gcc.dg/vect/pr113281-3.c

raw
1 /* { dg-do compile } */
2
3 #define N 128
4
5 short x[N];
6 short y[N];
7
8 void
9 f1 (void)
10 {
11 for (int i = 0; i < N; ++i)
12 x[i] >>= (y[i] < 30 ? y[i] : 30);
13 }
14
15 void
16 f2 (void)
17 {
18 for (int i = 0; i < N; ++i)
19 x[i] >>= ((y[i] & 15) + 2);
20 }
21
22 void
23 f3 (void)
24 {
25 for (int i = 0; i < N; ++i)
26 x[i] >>= (y[i] < 16 ? y[i] : 16);
27 }
28
29 void
30 f4 (void)
31 {
32 for (int i = 0; i < N; ++i)
33 x[i] = 32768 >> ((y[i] & 15) + 3);
34 }
35
36 /* { dg-final { scan-tree-dump {can narrow to signed:31 without loss [^\n]+>>} "vect" } } */
37 /* { dg-final { scan-tree-dump {can narrow to signed:18 without loss [^\n]+>>} "vect" } } */
38 /* { dg-final { scan-tree-dump {can narrow to signed:17 without loss [^\n]+>>} "vect" } } */
39 /* { dg-final { scan-tree-dump {can narrow to unsigned:19 without loss [^\n]+>>} "vect" } } */