1*9356374aSAndroid Build Coastguard Worker // Copyright 2022 The Abseil Authors 2*9356374aSAndroid Build Coastguard Worker // 3*9356374aSAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License"); 4*9356374aSAndroid Build Coastguard Worker // you may not use this file except in compliance with the License. 5*9356374aSAndroid Build Coastguard Worker // You may obtain a copy of the License at 6*9356374aSAndroid Build Coastguard Worker // 7*9356374aSAndroid Build Coastguard Worker // https://www.apache.org/licenses/LICENSE-2.0 8*9356374aSAndroid Build Coastguard Worker // 9*9356374aSAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software 10*9356374aSAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS, 11*9356374aSAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*9356374aSAndroid Build Coastguard Worker // See the License for the specific language governing permissions and 13*9356374aSAndroid Build Coastguard Worker // limitations under the License. 14*9356374aSAndroid Build Coastguard Worker 15*9356374aSAndroid Build Coastguard Worker #ifndef ABSL_CRC_INTERNAL_CPU_DETECT_H_ 16*9356374aSAndroid Build Coastguard Worker #define ABSL_CRC_INTERNAL_CPU_DETECT_H_ 17*9356374aSAndroid Build Coastguard Worker 18*9356374aSAndroid Build Coastguard Worker #include "absl/base/config.h" 19*9356374aSAndroid Build Coastguard Worker 20*9356374aSAndroid Build Coastguard Worker namespace absl { 21*9356374aSAndroid Build Coastguard Worker ABSL_NAMESPACE_BEGIN 22*9356374aSAndroid Build Coastguard Worker namespace crc_internal { 23*9356374aSAndroid Build Coastguard Worker 24*9356374aSAndroid Build Coastguard Worker // Enumeration of architectures that we have special-case tuning parameters for. 25*9356374aSAndroid Build Coastguard Worker // This set may change over time. 26*9356374aSAndroid Build Coastguard Worker enum class CpuType { 27*9356374aSAndroid Build Coastguard Worker kUnknown, 28*9356374aSAndroid Build Coastguard Worker kIntelHaswell, 29*9356374aSAndroid Build Coastguard Worker kAmdRome, 30*9356374aSAndroid Build Coastguard Worker kAmdNaples, 31*9356374aSAndroid Build Coastguard Worker kAmdMilan, 32*9356374aSAndroid Build Coastguard Worker kAmdGenoa, 33*9356374aSAndroid Build Coastguard Worker kAmdRyzenV3000, 34*9356374aSAndroid Build Coastguard Worker kIntelCascadelakeXeon, 35*9356374aSAndroid Build Coastguard Worker kIntelSkylakeXeon, 36*9356374aSAndroid Build Coastguard Worker kIntelBroadwell, 37*9356374aSAndroid Build Coastguard Worker kIntelSkylake, 38*9356374aSAndroid Build Coastguard Worker kIntelIvybridge, 39*9356374aSAndroid Build Coastguard Worker kIntelSandybridge, 40*9356374aSAndroid Build Coastguard Worker kIntelWestmere, 41*9356374aSAndroid Build Coastguard Worker kArmNeoverseN1, 42*9356374aSAndroid Build Coastguard Worker kArmNeoverseV1, 43*9356374aSAndroid Build Coastguard Worker kAmpereSiryn, 44*9356374aSAndroid Build Coastguard Worker kArmNeoverseN2, 45*9356374aSAndroid Build Coastguard Worker kArmNeoverseV2 46*9356374aSAndroid Build Coastguard Worker }; 47*9356374aSAndroid Build Coastguard Worker 48*9356374aSAndroid Build Coastguard Worker // Returns the type of host CPU this code is running on. Returns kUnknown if 49*9356374aSAndroid Build Coastguard Worker // the host CPU is of unknown type, or if detection otherwise fails. 50*9356374aSAndroid Build Coastguard Worker CpuType GetCpuType(); 51*9356374aSAndroid Build Coastguard Worker 52*9356374aSAndroid Build Coastguard Worker // Returns whether the host CPU supports the CPU features needed for our 53*9356374aSAndroid Build Coastguard Worker // accelerated implementations. The CpuTypes enumerated above apart from 54*9356374aSAndroid Build Coastguard Worker // kUnknown support the required features. On unknown CPUs, we can use 55*9356374aSAndroid Build Coastguard Worker // this to see if it's safe to use hardware acceleration, though without any 56*9356374aSAndroid Build Coastguard Worker // tuning. 57*9356374aSAndroid Build Coastguard Worker bool SupportsArmCRC32PMULL(); 58*9356374aSAndroid Build Coastguard Worker 59*9356374aSAndroid Build Coastguard Worker } // namespace crc_internal 60*9356374aSAndroid Build Coastguard Worker ABSL_NAMESPACE_END 61*9356374aSAndroid Build Coastguard Worker } // namespace absl 62*9356374aSAndroid Build Coastguard Worker 63*9356374aSAndroid Build Coastguard Worker #endif // ABSL_CRC_INTERNAL_CPU_DETECT_H_ 64