xref: /aosp_15_r20/external/cpu_features/include/internal/windows_utils.h (revision eca53ba6d2e951e174b64682eaf56a36b8204c89)
1 // Copyright 2022 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_
16 #define CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_
17 
18 #include "cpu_features_macros.h"
19 
20 #ifdef CPU_FEATURES_OS_WINDOWS
21 
22 #include <windows.h>  // IsProcessorFeaturePresent
23 
24 // modern WinSDK winnt.h contains newer features detection definitions
25 #if !defined(PF_SSSE3_INSTRUCTIONS_AVAILABLE)
26 #define PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
27 #endif
28 
29 #if !defined(PF_SSE4_1_INSTRUCTIONS_AVAILABLE)
30 #define PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
31 #endif
32 
33 #if !defined(PF_SSE4_2_INSTRUCTIONS_AVAILABLE)
34 #define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
35 #endif
36 
37 #if !defined(PF_ARM_VFP_32_REGISTERS_AVAILABLE)
38 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
39 #endif
40 
41 #if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE)
42 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
43 #endif
44 
45 #if !defined(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)
46 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
47 #endif
48 
49 #if !defined(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)
50 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
51 #endif
52 
53 #if !defined(PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE)
54 #define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
55 #endif
56 
57 #if !defined(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE)
58 #define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
59 #endif
60 
61 #if !defined(PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE)
62 #define PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE 44
63 #endif
64 
65 #if !defined(PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE)
66 #define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45
67 #endif
68 
69 #endif  // CPU_FEATURES_OS_WINDOWS
70 #endif  // CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_
71