summaryrefslogtreecommitdiffstats
path: root/src/common/x64/cpu_detect.h
blob: e3b63302eadeefba4d2a4b52c8fee37c68e0c5bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2013 Dolphin Emulator Project / 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

namespace Common {

enum class Manufacturer : u32 {
    Intel = 0,
    AMD = 1,
    Hygon = 2,
    Unknown = 3,
};

/// x86/x64 CPU capabilities that may be detected by this module
struct CPUCaps {
    Manufacturer manufacturer;
    char cpu_string[0x21];
    char brand_string[0x41];
    bool sse;
    bool sse2;
    bool sse3;
    bool ssse3;
    bool sse4_1;
    bool sse4_2;
    bool lzcnt;
    bool avx;
    bool avx2;
    bool avx512;
    bool bmi1;
    bool bmi2;
    bool fma;
    bool fma4;
    bool aes;
    bool invariant_tsc;
    u32 base_frequency;
    u32 max_frequency;
    u32 bus_frequency;
};

/**
 * Gets the supported capabilities of the host CPU
 * @return Reference to a CPUCaps struct with the detected host CPU capabilities
 */
const CPUCaps& GetCPUCaps();

} // namespace Common