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