Coverage Report

Created: 2025-06-10 13:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/bitcoin/src/compat/cpuid.h
Line
Count
Source
1
// Copyright (c) 2017-2022 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_COMPAT_CPUID_H
6
#define BITCOIN_COMPAT_CPUID_H
7
8
#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
9
#define HAVE_GETCPUID
10
11
#include <cpuid.h>
12
13
#include <cstdint>
14
15
// We can't use cpuid.h's __get_cpuid as it does not support subleafs.
16
void static inline GetCPUID(uint32_t leaf, uint32_t subleaf, uint32_t& a, uint32_t& b, uint32_t& c, uint32_t& d)
17
754k
{
18
754k
#ifdef __GNUC__
19
754k
    __cpuid_count(leaf, subleaf, a, b, c, d);
20
#else
21
  __asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
22
#endif
23
754k
}
random.cpp:GetCPUID(unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Line
Count
Source
17
22.1k
{
18
22.1k
#ifdef __GNUC__
19
22.1k
    __cpuid_count(leaf, subleaf, a, b, c, d);
20
#else
21
  __asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
22
#endif
23
22.1k
}
randomenv.cpp:GetCPUID(unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Line
Count
Source
17
709k
{
18
709k
#ifdef __GNUC__
19
709k
    __cpuid_count(leaf, subleaf, a, b, c, d);
20
#else
21
  __asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
22
#endif
23
709k
}
sha256.cpp:GetCPUID(unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Line
Count
Source
17
22.1k
{
18
22.1k
#ifdef __GNUC__
19
22.1k
    __cpuid_count(leaf, subleaf, a, b, c, d);
20
#else
21
  __asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
22
#endif
23
22.1k
}
24
25
#endif // defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
26
#endif // BITCOIN_COMPAT_CPUID_H