diff options
author | Richard Braun <rbraun@sceen.net> | 2018-07-08 16:46:28 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-07-08 16:51:18 +0200 |
commit | 41c375a698a4807e6b9e2cc43235aa281655ff19 (patch) | |
tree | 1c9e7040d7785259d3e9bb440d187cdc2239af8b | |
parent | 2daf0c73f09804588642d53d111495048a9c5886 (diff) |
x86/pmu_intel: use the compiler popcount built-in
-rw-r--r-- | arch/x86/machine/pmu_intel.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c index c1ee3885..6e3f946e 100644 --- a/arch/x86/machine/pmu_intel.c +++ b/arch/x86/machine/pmu_intel.c @@ -143,27 +143,6 @@ pmu_intel_ack_status(uint64_t status) return cpu_set_msr64(PMU_INTEL_MSR_GLOBAL_OVF_CTRL, status); } -/* - * TODO Use the compiler built-in once libgcc is linked again. - */ -static unsigned int -pmu_popcount(unsigned int bits) -{ - unsigned int count; - - count = 0; - - while (bits) { - if (bits & 1) { - count++; - } - - bits >>= 1; - } - - return count; -} - static int pmu_intel_translate(unsigned int *raw_event_idp, unsigned event_id) { @@ -380,7 +359,7 @@ pmu_intel_setup(void) perfmon_register(&pmu_intel_dev); log_info("pmu: intel v%d, nr_pmcs:%u pmc_width:%u events:%#x nr_events:%u", pmu->version, pmu->nr_pmcs, pmu->pmc_width, pmu->events, - pmu_popcount(pmu->events)); + __builtin_popcount(pmu->events)); return 0; } |