blob: cd3a676ab802316972f0eaa4f29737516103e884 [file] [log] [blame]
Guillaume Chatelet439d3712018-02-01 10:03:09 +01001// Copyright 2017 Google Inc.
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
Guillaume Chatelet8e58ef02018-02-01 10:38:48 +010015#ifndef CPU_FEATURES_INCLUDE_CPUINFO_AARCH64_H_
16#define CPU_FEATURES_INCLUDE_CPUINFO_AARCH64_H_
Guillaume Chatelet439d3712018-02-01 10:03:09 +010017
18#include "cpu_features_macros.h"
Artem Alekseev653d5812019-07-02 17:52:25 +030019#include "cpu_features_cache_info.h"
Guillaume Chatelet439d3712018-02-01 10:03:09 +010020
Guillaume Chatelete4195732018-02-12 16:15:15 +010021CPU_FEATURES_START_CPP_NAMESPACE
Guillaume Chatelet439d3712018-02-01 10:03:09 +010022
23typedef struct {
24 int fp : 1; // Floating-point.
25 int asimd : 1; // Advanced SIMD.
26 int aes : 1; // Hardware-accelerated Advanced Encryption Standard.
27 int pmull : 1; // Polynomial multiply long.
28 int sha1 : 1; // Hardware-accelerated SHA1.
29 int sha2 : 1; // Hardware-accelerated SHA2-256.
30 int crc32 : 1; // Hardware-accelerated CRC-32.
31
32 // Make sure to update Aarch64FeaturesEnum below if you add a field here.
33} Aarch64Features;
34
35typedef struct {
36 Aarch64Features features;
37 int implementer;
38 int variant;
39 int part;
40 int revision;
41} Aarch64Info;
42
43Aarch64Info GetAarch64Info(void);
44
45////////////////////////////////////////////////////////////////////////////////
46// Introspection functions
47
48typedef enum {
49 AARCH64_FP,
50 AARCH64_ASIMD,
51 AARCH64_AES,
52 AARCH64_PMULL,
53 AARCH64_SHA1,
54 AARCH64_SHA2,
55 AARCH64_CRC32,
56 AARCH64_LAST_,
57} Aarch64FeaturesEnum;
58
59int GetAarch64FeaturesEnumValue(const Aarch64Features* features,
60 Aarch64FeaturesEnum value);
61
62const char* GetAarch64FeaturesEnumName(Aarch64FeaturesEnum);
63
Guillaume Chatelete4195732018-02-12 16:15:15 +010064CPU_FEATURES_END_CPP_NAMESPACE
Guillaume Chatelet439d3712018-02-01 10:03:09 +010065
Guillaume Chatelet4155ee72019-01-18 13:38:22 +010066#if !defined(CPU_FEATURES_ARCH_AARCH64)
67#error "Including cpuinfo_aarch64.h from a non-aarch64 target."
68#endif
69
Guillaume Chatelet8e58ef02018-02-01 10:38:48 +010070#endif // CPU_FEATURES_INCLUDE_CPUINFO_AARCH64_H_