Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr103144-shift-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -fdump-tree-vect-details -mprefer-vector-width=256" } */
3 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 6 "vect" } } */
4
5 #define N 10000
6 void
7 __attribute__((noipa))
8 foo_shl (int* a, int b)
9 {
10 for (int i = 0; i != N; i++)
11 {
12 a[i] = b;
13 b <<= 1;
14 }
15 }
16
17 void
18 __attribute__((noipa))
19 foo_ashr (int* a, int b)
20 {
21 for (int i = 0; i != N; i++)
22 {
23 a[i] = b;
24 b >>= 1;
25 }
26 }
27
28 void
29 __attribute__((noipa))
30 foo_lshr (unsigned int* a, unsigned int b)
31 {
32 for (int i = 0; i != N; i++)
33 {
34 a[i] = b;
35 b >>= 1U;
36 }
37 }
38
39 void
40 __attribute__((noipa))
41 foo_shl_peel (int* a, int b)
42 {
43 for (int i = 0; i != 39; i++)
44 {
45 a[i] = b;
46 b <<= 1;
47 }
48 }
49
50 void
51 __attribute__((noipa))
52 foo_ashr_peel (int* a, int b)
53 {
54 for (int i = 0; i != 39; i++)
55 {
56 a[i] = b;
57 b >>= 1;
58 }
59 }
60
61 void
62 __attribute__((noipa))
63 foo_lshr_peel (unsigned int* a, unsigned int b)
64 {
65 for (int i = 0; i != 39; i++)
66 {
67 a[i] = b;
68 b >>= 1U;
69 }
70 }