File: features.h

package info (click to toggle)
lsp-plugins 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 91,856 kB
  • sloc: cpp: 427,831; xml: 57,779; makefile: 9,961; php: 1,005; sh: 18
file content (200 lines) | stat: -rw-r--r-- 6,152 bytes parent folder | download
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
 * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
 *           (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
 *
 * This file is part of lsp-dsp-lib
 * Created on: 31 мар. 2020 г.
 *
 * lsp-dsp-lib is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * lsp-dsp-lib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with lsp-dsp-lib. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef PRIVATE_DSP_ARCH_AARCH64_FEATURES_H_
#define PRIVATE_DSP_ARCH_AARCH64_FEATURES_H_

#include <lsp-plug.in/common/types.h>

#ifdef ARCH_AARCH64

    #ifdef PLATFORM_POSIX
        #include <sys/auxv.h>
    #endif /* PLATFORM_POSIX */

    // Override some constants if they were not defined previously
    #ifndef HWCAP_FP
        #define HWCAP_FP                0
    #endif /* HWCAP_FP */

    #ifndef HWCAP_ASIMD
        #define HWCAP_ASIMD             0
    #endif /* HWCAP_ASIMD */

    #ifndef HWCAP_EVTSTRM
        #define HWCAP_EVTSTRM           0
    #endif /* HWCAP_EVTSTRM */

    #ifndef HWCAP_AES
        #define HWCAP_AES               0
    #endif /* HWCAP_AES */

    #ifndef HWCAP_PMULL
        #define HWCAP_PMULL             0
    #endif /* HWCAP_PMULL */

    #ifndef HWCAP_SHA1
        #define HWCAP_SHA1              0
    #endif /* HWCAP_SHA1 */

    #ifndef HWCAP_SHA2
        #define HWCAP_SHA2              0
    #endif /* HWCAP_SHA2 */

    #ifndef HWCAP_CRC32
        #define HWCAP_CRC32             0
    #endif /* HWCAP_CRC32 */

    #ifndef HWCAP_ATOMICS
        #define HWCAP_ATOMICS           0
    #endif /* HWCAP_ATOMICS */

    #ifndef HWCAP_FPHP
        #define HWCAP_FPHP              0
    #endif /* HWCAP_FPHP */

    #ifndef HWCAP_ASIMDHP
        #define HWCAP_ASIMDHP           0
    #endif /* HWCAP_ASIMDHP */

    #ifndef HWCAP_CPUID
        #define HWCAP_CPUID             0
    #endif /* HWCAP_CPUID */

    #ifndef HWCAP_ASIMDRDM
        #define HWCAP_ASIMDRDM          0
    #endif /* HWCAP_ASIMDRDM */

    #ifndef HWCAP_JSCVT
        #define HWCAP_JSCVT             0
    #endif /* HWCAP_JSCVT */

    #ifndef HWCAP_FCMA
        #define HWCAP_FCMA              0
    #endif /* HWCAP_FCMA */

    #ifndef HWCAP_LRCPC
        #define HWCAP_LRCPC             0
    #endif /* HWCAP_LRCPC */

    #ifndef HWCAP_DCPOP
        #define HWCAP_DCPOP             0
    #endif /* HWCAP_DCPOP */

    #ifndef HWCAP_SHA3
        #define HWCAP_SHA3              0
    #endif /* HWCAP_SHA3 */

    #ifndef HWCAP_SM3
        #define HWCAP_SM3               0
    #endif /* HWCAP_SM3 */

    #ifndef HWCAP_SM4
        #define HWCAP_SM4               0
    #endif /* HWCAP_SM4 */

    #ifndef HWCAP_ASIMDDP
        #define HWCAP_ASIMDDP           0
    #endif /* HWCAP_ASIMDDP */

    #ifndef HWCAP_SHA512
        #define HWCAP_SHA512            0
    #endif /* HWCAP_SHA512 */

    #ifndef HWCAP_SVE
        #define HWCAP_SVE               0
    #endif /* HWCAP_SVE */

    #ifndef HWCAP_ASIMDFHM
        #define HWCAP_ASIMDFHM          0
    #endif /* HWCAP_ASIMDFHM */

    #ifndef HWCAP_DIT
        #define HWCAP_DIT               0
    #endif /* HWCAP_DIT */

    #ifndef HWCAP_USCAT
        #define HWCAP_USCAT             0
    #endif /* HWCAP_USCAT */

    #ifndef HWCAP_ILRCPC
        #define HWCAP_ILRCPC            0
    #endif /* HWCAP_ILRCPC */

    #ifndef HWCAP_FLAGM
        #define HWCAP_FLAGM             0
    #endif /* HWCAP_FLAGM */

    // Define LSP-defined AARCH-64 specific macros
    #define HWCAP_AARCH64_FP                HWCAP_FP
    #define HWCAP_AARCH64_ASIMD             HWCAP_ASIMD
    #define HWCAP_AARCH64_EVTSTRM           HWCAP_EVTSTRM
    #define HWCAP_AARCH64_AES               HWCAP_AES
    #define HWCAP_AARCH64_PMULL             HWCAP_PMULL
    #define HWCAP_AARCH64_SHA1              HWCAP_SHA1
    #define HWCAP_AARCH64_SHA2              HWCAP_SHA2
    #define HWCAP_AARCH64_CRC32             HWCAP_CRC32
    #define HWCAP_AARCH64_ATOMICS           HWCAP_ATOMICS
    #define HWCAP_AARCH64_FPHP              HWCAP_FPHP
    #define HWCAP_AARCH64_ASIMDHP           HWCAP_ASIMDHP
    #define HWCAP_AARCH64_CPUID             HWCAP_CPUID
    #define HWCAP_AARCH64_ASIMDRDM          HWCAP_ASIMDRDM
    #define HWCAP_AARCH64_JSCVT             HWCAP_JSCVT
    #define HWCAP_AARCH64_FCMA              HWCAP_FCMA
    #define HWCAP_AARCH64_LRCPC             HWCAP_LRCPC
    #define HWCAP_AARCH64_DCPOP             HWCAP_DCPOP
    #define HWCAP_AARCH64_SHA3              HWCAP_SHA3
    #define HWCAP_AARCH64_SM3               HWCAP_SM3
    #define HWCAP_AARCH64_SM4               HWCAP_SM4
    #define HWCAP_AARCH64_ASIMDDP           HWCAP_ASIMDDP
    #define HWCAP_AARCH64_SHA512            HWCAP_SHA512
    #define HWCAP_AARCH64_SVE               HWCAP_SVE
    #define HWCAP_AARCH64_ASIMDFHM          HWCAP_ASIMDFHM
    #define HWCAP_AARCH64_DIT               HWCAP_DIT
    #define HWCAP_AARCH64_USCAT             HWCAP_USCAT
    #define HWCAP_AARCH64_ILRCPC            HWCAP_ILRCPC
    #define HWCAP_AARCH64_FLAGM             HWCAP_FLAGM

    namespace lsp
    {
        namespace aarch64
        {
            typedef struct cpu_features_t
            {
                size_t      implementer;
                size_t      architecture;
                size_t      variant;
                size_t      part;
                size_t      revision;
                uint64_t    hwcap;
            } cpu_features_t;

            void detect_cpu_features(cpu_features_t *f);

            void dsp_init(const cpu_features_t *f);
        } /* namespace aarch64 */
    } /* namespace lsp */

    #define LSP_DSP_CPU_NAMESPACE           aarch64

#endif /* ARCH_AARCH64 */

#endif /* PRIVATE_DSP_ARCH_AARCH64_FEATURES_H_ */