blob: b92b6538b6ce03c34e70717e6569ff1934669d61 [file] [log] [blame]
Georgios Pinitas08302c12021-06-09 10:08:27 +01001/*
Viet-Hoa Do03b29712022-06-01 11:47:14 +01002 * Copyright (c) 2021-2022 Arm Limited.
Georgios Pinitas08302c12021-06-09 10:08:27 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef SRC_COMMON_CPUINFO_CPUISAINFO_H
25#define SRC_COMMON_CPUINFO_CPUISAINFO_H
26
27#include <cstdint>
28
29namespace arm_compute
30{
31namespace cpuinfo
32{
33/** CPU ISA (Instruction Set Architecture) information
34 *
35 * Contains ISA related information around the Arm architecture
36 */
37struct CpuIsaInfo
38{
39 /* SIMD extension support */
40 bool neon{ false };
41 bool sve{ false };
42 bool sve2{ false };
Viet-Hoa Do03b29712022-06-01 11:47:14 +010043 bool sme{ false };
44 bool sme2{ false };
Georgios Pinitas08302c12021-06-09 10:08:27 +010045
46 /* Data-type extensions support */
47 bool fp16{ false };
48 bool bf16{ false };
Michalis Spyrou20fca522021-06-07 14:23:57 +010049 bool svebf16{ false };
Georgios Pinitas08302c12021-06-09 10:08:27 +010050
51 /* Instruction support */
52 bool dot{ false };
Michalis Spyrou20fca522021-06-07 14:23:57 +010053 bool i8mm{ false };
54 bool svei8mm{ false };
55 bool svef32mm{ false };
Georgios Pinitas08302c12021-06-09 10:08:27 +010056};
57
58/** Identify ISA related information through system information
59 *
60 * @param[in] hwcaps HWCAPS feature information
61 * @param[in] hwcaps2 HWCAPS2 feature information
62 * @param[in] midr MIDR value
63 *
64 * @return CpuIsaInfo A populated ISA feature structure
65 */
66CpuIsaInfo init_cpu_isa_from_hwcaps(uint32_t hwcaps, uint32_t hwcaps2, uint32_t midr);
67
68/** Identify ISA related information through register information
69 *
70 * @param[in] isar0 Value of Instruction Set Attribute Register 0 (ID_AA64ISAR0_EL1)
71 * @param[in] isar1 Value of Instruction Set Attribute Register 1 (ID_AA64ISAR1_EL1)
Viet-Hoa Do03b29712022-06-01 11:47:14 +010072 * @param[in] pfr0 Value of Processor Feature Register 0 (ID_AA64PFR0_EL1)
73 * @param[in] pfr1 Value of Processor Feature Register 1 (ID_AA64PFR1_EL1)
Georgios Pinitas08302c12021-06-09 10:08:27 +010074 * @param[in] svefr0 Value of SVE feature ID register 0 (ID_AA64ZFR0_EL1)
75 * @param[in] midr Value of Main ID Register (MIDR)
76 *
77 * @return CpuIsaInfo A populated ISA feature structure
78 */
Viet-Hoa Do03b29712022-06-01 11:47:14 +010079CpuIsaInfo init_cpu_isa_from_regs(uint64_t isar0, uint64_t isar1, uint64_t pfr0, uint64_t pfr1, uint64_t svefr0, uint64_t midr);
Georgios Pinitas08302c12021-06-09 10:08:27 +010080} // namespace cpuinfo
81} // namespace arm_compute
82
83#endif /* SRC_COMMON_CPUINFO_CPUISAINFO_H */