summaryrefslogtreecommitdiff
path: root/include/tools/simdsupport.hxx
blob: 74afc9300b1a968e0a0ab0213f9e433113821c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 */

// Determine the compiler support for SIMD compiler intrinsics.
// This changes from one compiled unit to the other, depending if
// the support has been detected and if the compiled unit contains
// code using intrinsics or not. So we have to (re)set them again
// every time this file has been included.

#undef LO_SSE2_AVAILABLE
#undef LO_SSSE3_AVAILABLE
#undef LO_AVX_AVAILABLE
#undef LO_AVX2_AVAILABLE

#if defined(_MSC_VER) // VISUAL STUDIO COMPILER

// SSE2 is required for X64
#if (defined(_M_X64) || defined(_M_IX86_FP) && _M_IX86_FP >= 2)
#define LO_SSE2_AVAILABLE
#endif

// compiled with /arch:AVX
#if defined(__AVX__)
#ifndef LO_SSE2_AVAILABLE
#define LO_SSE2_AVAILABLE
#endif
#define LO_SSSE3_AVAILABLE
#define LO_AVX_AVAILABLE
#endif

// compiled with /arch:AVX2
#if defined(__AVX2__)
#define LO_AVX2_AVAILABLE
#endif

#else // Clang and GCC

#if defined(__SSE2__) || defined(__x86_64__) // SSE2 is required for X64
#define LO_SSE2_AVAILABLE
#endif

#if defined(__SSSE3__)
#define LO_SSSE3_AVAILABLE
#endif
#if defined(__AVX__)
#define LO_AVX_AVAILABLE

#endif
#if defined(__AVX2__)
#define LO_AVX2_AVAILABLE
#endif

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */