Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/tree-ssa/popcount.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* { dg-do compile } */ | |
2 /* { dg-options "-O3 -fdump-tree-optimized -fno-tree-ch" } */ | |
3 | |
4 extern int foo (int); | |
5 | |
6 int PopCount (long b) { | |
7 int c = 0; | |
8 b++; | |
9 | |
10 while (b) { | |
11 b &= b - 1; | |
12 c++; | |
13 } | |
14 return c; | |
15 } | |
16 int PopCount2 (long b) { | |
17 int c = 0; | |
18 | |
19 while (b) { | |
20 b &= b - 1; | |
21 c++; | |
22 } | |
23 foo (c); | |
24 return foo (c); | |
25 } | |
26 | |
27 void PopCount3 (long b1) { | |
28 | |
29 for (long i = 0; i < b1; ++i) | |
30 { | |
31 long b = i; | |
32 int c = 0; | |
33 while (b) { | |
34 b &= b - 1; | |
35 c++; | |
36 } | |
37 foo (c); | |
38 } | |
39 } | |
40 | |
41 /* { dg-final { scan-tree-dump-times "__builtin_popcount" 3 "optimized" } } */ |