Coverage Report

Created: 2025-06-13 06:18

/src/gdal/port/cpl_cpu_features.h
Line
Count
Source (jump to first uncovered line)
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
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef CPL_CPU_FEATURES_H
14
#define CPL_CPU_FEATURES_H
15
16
#include "cpl_port.h"
17
#include "cpl_string.h"
18
19
//! @cond Doxygen_Suppress
20
21
#ifdef HAVE_SSE_AT_COMPILE_TIME
22
#if (defined(_M_X64) || defined(__x86_64))
23
#define HAVE_INLINE_SSE
24
25
static bool inline CPLHaveRuntimeSSE()
26
0
{
27
0
    return true;
28
0
}
Unexecuted instantiation: rasterio.cpp:CPLHaveRuntimeSSE()
Unexecuted instantiation: cpl_cpu_features.cpp:CPLHaveRuntimeSSE()
Unexecuted instantiation: gdalgrid.cpp:CPLHaveRuntimeSSE()
29
#else
30
bool CPLHaveRuntimeSSE();
31
#endif
32
#endif
33
34
#ifdef USE_NEON_OPTIMIZATIONS
35
static bool inline CPLHaveRuntimeSSSE3()
36
{
37
    return true;
38
}
39
#elif defined(HAVE_SSSE3_AT_COMPILE_TIME)
40
#if __SSSE3__
41
#define HAVE_INLINE_SSSE3
42
43
static bool inline CPLHaveRuntimeSSSE3()
44
{
45
#ifdef DEBUG
46
    if (!CPLTestBool(CPLGetConfigOption("GDAL_USE_SSSE3", "YES")))
47
        return false;
48
#endif
49
    return true;
50
}
51
#else
52
#if defined(__GNUC__) && !defined(DEBUG)
53
extern bool bCPLHasSSSE3;
54
55
static bool inline CPLHaveRuntimeSSSE3()
56
{
57
    return bCPLHasSSSE3;
58
}
59
#else
60
bool CPLHaveRuntimeSSSE3();
61
#endif
62
#endif
63
#endif
64
65
#ifdef HAVE_AVX_AT_COMPILE_TIME
66
#if __AVX__
67
#define HAVE_INLINE_AVX
68
69
static bool inline CPLHaveRuntimeAVX()
70
{
71
    return true;
72
}
73
#elif defined(__GNUC__)
74
extern bool bCPLHasAVX;
75
76
static bool inline CPLHaveRuntimeAVX()
77
0
{
78
0
    return bCPLHasAVX;
79
0
}
Unexecuted instantiation: rasterio.cpp:CPLHaveRuntimeAVX()
Unexecuted instantiation: cpl_cpu_features.cpp:CPLHaveRuntimeAVX()
Unexecuted instantiation: gdalgrid.cpp:CPLHaveRuntimeAVX()
80
#else
81
bool CPLHaveRuntimeAVX();
82
#endif
83
#endif
84
85
//! @endcond
86
87
#endif  // CPL_CPU_FEATURES_H