annotate gcc/testsuite/gcc.dg/tree-ssa/popcount5.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
1 /* PR tree-optimization/94800 */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
2 /* { dg-do compile } */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
3 /* { dg-require-effective-target popcount } */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
4 /* { dg-require-effective-target int32plus } */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
5 /* { dg-options "-O2 -fdump-tree-optimized" } */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
6
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
7 const unsigned m1 = 0x55555555UL;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
8 const unsigned m2 = 0x33333333UL;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
9 const unsigned m4 = 0x0F0F0F0FUL;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
10 const int shift = 24;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
11
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
12 int popcount64c(unsigned x)
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
13 {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
14 x -= (x >> 1) & m1;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
15 x = (x & m2) + ((x >> 2) & m2);
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
16 x = (x + (x >> 4)) & m4;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
17 x += (x << 8);
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
18 x += (x << 16);
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
19 return x >> shift;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
20 }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
21
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
22 /* { dg-final { scan-tree-dump-times "\.POPCOUNT" 1 "optimized" } } */