1 /* 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ 12 #define SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ 13 14 #include <stdint.h> 15 16 namespace webrtc { 17 18 // List of features in x86. 19 typedef enum { kSSE2, kSSE3, kAVX2 } CPUFeature; 20 21 // List of features in ARM. 22 enum { 23 kCPUFeatureARMv7 = (1 << 0), 24 kCPUFeatureVFPv3 = (1 << 1), 25 kCPUFeatureNEON = (1 << 2), 26 kCPUFeatureLDREXSTREX = (1 << 3) 27 }; 28 29 // Returns true if the CPU supports the feature. 30 int GetCPUInfo(CPUFeature feature); 31 32 // No CPU feature is available => straight C path. 33 int GetCPUInfoNoASM(CPUFeature feature); 34 35 // Return the features in an ARM device. 36 // It detects the features in the hardware platform, and returns supported 37 // values in the above enum definition as a bitmask. 38 uint64_t GetCPUFeaturesARM(void); 39 40 } // namespace webrtc 41 42 #endif // SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ 43