LCOV - code coverage report
Current view: top level - port - cpl_cpu_features.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2024-04-28 18:08:58 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  CPL - Common Portability Library
       4             :  * Purpose:  Prototypes, and definitions for of CPU features detection
       5             :  * Author:   Even Rouault, <even dot rouault at spatialys dot com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2016, Even Rouault <even dot rouault at spatialys dot com>
       9             :  *
      10             :  * Permission is hereby granted, free of charge, to any person obtaining a
      11             :  * copy of this software and associated documentation files (the "Software"),
      12             :  * to deal in the Software without restriction, including without limitation
      13             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      14             :  * and/or sell copies of the Software, and to permit persons to whom the
      15             :  * Software is furnished to do so, subject to the following conditions:
      16             :  *
      17             :  * The above copyright notice and this permission notice shall be included
      18             :  * in all copies or substantial portions of the Software.
      19             :  *
      20             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      21             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      22             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      23             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      24             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      25             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      26             :  * DEALINGS IN THE SOFTWARE.
      27             :  ****************************************************************************/
      28             : 
      29             : #ifndef CPL_CPU_FEATURES_H
      30             : #define CPL_CPU_FEATURES_H
      31             : 
      32             : #include "cpl_port.h"
      33             : #include "cpl_string.h"
      34             : 
      35             : //! @cond Doxygen_Suppress
      36             : 
      37             : #ifdef HAVE_SSE_AT_COMPILE_TIME
      38             : #if (defined(_M_X64) || defined(__x86_64))
      39             : #define HAVE_INLINE_SSE
      40             : 
      41           3 : static bool inline CPLHaveRuntimeSSE()
      42             : {
      43           3 :     return true;
      44             : }
      45             : #else
      46             : bool CPLHaveRuntimeSSE();
      47             : #endif
      48             : #endif
      49             : 
      50             : #ifdef HAVE_SSSE3_AT_COMPILE_TIME
      51             : #if __SSSE3__
      52             : #define HAVE_INLINE_SSSE3
      53             : 
      54             : static bool inline CPLHaveRuntimeSSSE3()
      55             : {
      56             : #ifdef DEBUG
      57             :     if (!CPLTestBool(CPLGetConfigOption("GDAL_USE_SSSE3", "YES")))
      58             :         return false;
      59             : #endif
      60             :     return true;
      61             : }
      62             : #else
      63             : #if defined(__GNUC__) && !defined(DEBUG)
      64             : extern bool bCPLHasSSSE3;
      65             : 
      66             : static bool inline CPLHaveRuntimeSSSE3()
      67             : {
      68             :     return bCPLHasSSSE3;
      69             : }
      70             : #else
      71             : bool CPLHaveRuntimeSSSE3();
      72             : #endif
      73             : #endif
      74             : #endif
      75             : 
      76             : #ifdef HAVE_AVX_AT_COMPILE_TIME
      77             : #if __AVX__
      78             : #define HAVE_INLINE_AVX
      79             : 
      80             : static bool inline CPLHaveRuntimeAVX()
      81             : {
      82             :     return true;
      83             : }
      84             : #elif defined(__GNUC__)
      85             : extern bool bCPLHasAVX;
      86             : 
      87           8 : static bool inline CPLHaveRuntimeAVX()
      88             : {
      89           8 :     return bCPLHasAVX;
      90             : }
      91             : #else
      92             : bool CPLHaveRuntimeAVX();
      93             : #endif
      94             : #endif
      95             : 
      96             : //! @endcond
      97             : 
      98             : #endif  // CPL_CPU_FEATURES_H

Generated by: LCOV version 1.14