[06/22] Use popcount_hwi rather than builtin

Message ID 20231004123921.634024-7-j@lambda.is
State Unresolved
Headers
Series [01/22] Add condition coverage profiling |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Jørgen Kvalsvik Oct. 4, 2023, 12:39 p.m. UTC
  From: Jørgen Kvalsvik <jorgen.kvalsvik@woven.toyota>

---
 gcc/gcov.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Jan Hubicka Oct. 5, 2023, 1:01 p.m. UTC | #1
Hi,
can you please also squash those changes which fixes patch #1
so it is easier to review?
Honza
> From: Jørgen Kvalsvik <jorgen.kvalsvik@woven.toyota>
> 
> ---
>  gcc/gcov.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/gcov.cc b/gcc/gcov.cc
> index 274f2fc5d9f..35be97cf5ac 100644
> --- a/gcc/gcov.cc
> +++ b/gcc/gcov.cc
> @@ -46,6 +46,7 @@ along with Gcov; see the file COPYING3.  If not see
>  #include "color-macros.h"
>  #include "pretty-print.h"
>  #include "json.h"
> +#include "hwint.h"
>  
>  #include <zlib.h>
>  #include <getopt.h>
> @@ -159,7 +160,7 @@ condition_info::condition_info (): truev (0), falsev (0), n_terms (0)
>  
>  int condition_info::popcount () const
>  {
> -    return __builtin_popcountll (truev) + __builtin_popcountll (falsev);
> +    return popcount_hwi (truev) + popcount_hwi (falsev);
>  }
>  
>  /* Describes a basic block. Contains lists of arcs to successor and
> -- 
> 2.30.2
>
  

Patch

diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index 274f2fc5d9f..35be97cf5ac 100644
--- a/gcc/gcov.cc
+++ b/gcc/gcov.cc
@@ -46,6 +46,7 @@  along with Gcov; see the file COPYING3.  If not see
 #include "color-macros.h"
 #include "pretty-print.h"
 #include "json.h"
+#include "hwint.h"
 
 #include <zlib.h>
 #include <getopt.h>
@@ -159,7 +160,7 @@  condition_info::condition_info (): truev (0), falsev (0), n_terms (0)
 
 int condition_info::popcount () const
 {
-    return __builtin_popcountll (truev) + __builtin_popcountll (falsev);
+    return popcount_hwi (truev) + popcount_hwi (falsev);
 }
 
 /* Describes a basic block. Contains lists of arcs to successor and