blob: 612b4a5d6b2324b72512a10c2c54f5ae646c040c [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
12#define SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Niels Möllera12c42a2018-07-25 16:05:48 +020014#include <stdint.h>
15
Mirko Bonadeibef022b2020-09-06 16:07:15 +020016namespace webrtc {
17
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000018// List of features in x86.
Zhaoliang Ma72e43212020-08-17 17:13:41 +080019typedef enum { kSSE2, kSSE3, kAVX2 } CPUFeature;
niklase@google.com470e71d2011-07-07 08:21:25 +000020
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000021// List of features in ARM.
22enum {
Karl Wiberg79eb1d92017-11-08 12:26:07 +010023 kCPUFeatureARMv7 = (1 << 0),
24 kCPUFeatureVFPv3 = (1 << 1),
25 kCPUFeatureNEON = (1 << 2),
26 kCPUFeatureLDREXSTREX = (1 << 3)
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000027};
28
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000029// Returns true if the CPU supports the feature.
Mirko Bonadeibef022b2020-09-06 16:07:15 +020030int GetCPUInfo(CPUFeature feature);
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000031
niklase@google.com470e71d2011-07-07 08:21:25 +000032// No CPU feature is available => straight C path.
Mirko Bonadeibef022b2020-09-06 16:07:15 +020033int GetCPUInfoNoASM(CPUFeature feature);
niklase@google.com470e71d2011-07-07 08:21:25 +000034
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000035// Return the features in an ARM device.
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000036// It detects the features in the hardware platform, and returns supported
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000037// values in the above enum definition as a bitmask.
Mirko Bonadeibef022b2020-09-06 16:07:15 +020038uint64_t GetCPUFeaturesARM(void);
39
40} // namespace webrtc
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000041
Karl Wiberg79eb1d92017-11-08 12:26:07 +010042#endif // SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_