tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

cpu_detect.h (1858B)


      1 // Copyright 2022 The Abseil Authors
      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 //     https://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 ABSL_CRC_INTERNAL_CPU_DETECT_H_
     16 #define ABSL_CRC_INTERNAL_CPU_DETECT_H_
     17 
     18 #include "absl/base/config.h"
     19 
     20 namespace absl {
     21 ABSL_NAMESPACE_BEGIN
     22 namespace crc_internal {
     23 
     24 // Enumeration of architectures that we have special-case tuning parameters for.
     25 // This set may change over time.
     26 enum class CpuType {
     27  kUnknown,
     28  kIntelHaswell,
     29  kAmdRome,
     30  kAmdNaples,
     31  kAmdMilan,
     32  kAmdGenoa,
     33  kAmdRyzenV3000,
     34  kIntelCascadelakeXeon,
     35  kIntelSkylakeXeon,
     36  kIntelBroadwell,
     37  kIntelSkylake,
     38  kIntelIvybridge,
     39  kIntelSandybridge,
     40  kIntelWestmere,
     41  kArmNeoverseN1,
     42  kArmNeoverseV1,
     43  kAmpereSiryn,
     44  kArmNeoverseN2,
     45  kArmNeoverseV2
     46 };
     47 
     48 // Returns the type of host CPU this code is running on.  Returns kUnknown if
     49 // the host CPU is of unknown type, or if detection otherwise fails.
     50 CpuType GetCpuType();
     51 
     52 // Returns whether the host CPU supports the CPU features needed for our
     53 // accelerated implementations. The CpuTypes enumerated above apart from
     54 // kUnknown support the required features. On unknown CPUs, we can use
     55 // this to see if it's safe to use hardware acceleration, though without any
     56 // tuning.
     57 bool SupportsArmCRC32PMULL();
     58 
     59 }  // namespace crc_internal
     60 ABSL_NAMESPACE_END
     61 }  // namespace absl
     62 
     63 #endif  // ABSL_CRC_INTERNAL_CPU_DETECT_H_