1 // Copyright 2017 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_CPUINFO_MIPS_H_ 16 #define CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_ 17 18 #include "cpu_features_cache_info.h" 19 #include "cpu_features_macros.h" 20 21 CPU_FEATURES_START_CPP_NAMESPACE 22 23 typedef struct { 24 int msa : 1; // MIPS SIMD Architecture 25 // https://www.mips.com/products/architectures/ase/simd/ 26 int eva : 1; // Enhanced Virtual Addressing 27 // https://www.mips.com/products/architectures/mips64/ 28 int r6 : 1; // True if is release 6 of the processor. 29 30 // Make sure to update MipsFeaturesEnum below if you add a field here. 31 } MipsFeatures; 32 33 typedef struct { 34 MipsFeatures features; 35 } MipsInfo; 36 37 MipsInfo GetMipsInfo(void); 38 39 //////////////////////////////////////////////////////////////////////////////// 40 // Introspection functions 41 42 typedef enum { 43 MIPS_MSA, 44 MIPS_EVA, 45 MIPS_R6, 46 MIPS_LAST_, 47 } MipsFeaturesEnum; 48 49 int GetMipsFeaturesEnumValue(const MipsFeatures* features, 50 MipsFeaturesEnum value); 51 52 const char* GetMipsFeaturesEnumName(MipsFeaturesEnum); 53 54 CPU_FEATURES_END_CPP_NAMESPACE 55 56 #if !defined(CPU_FEATURES_ARCH_MIPS) 57 #error "Including cpuinfo_mips.h from a non-mips target." 58 #endif 59 60 #endif // CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_ 61