-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsimd.h
80 lines (72 loc) · 1.9 KB
/
simd.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* -*- C++ -*-
*
* simd.h
*
* Copyright (C) 2015 jh10001 <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#define __SIMD_H__
#ifdef USE_SIMD_X86_SSE3
#include <pmmintrin.h>
#define USE_SIMD_X86_SSE2 1
#endif
#ifdef USE_SIMD_X86_SSE2
#include <emmintrin.h>
#define USE_SIMD_X86_SSE 1
#endif
#ifdef USE_SIMD_X86_SSE
#include <xmmintrin.h>
#endif
#ifdef USE_SIMD_ARM_NEON
#include <arm_neon.h>
#endif
#ifdef __GNUC__
#define inline static __inline __attribute__((__always_inline__))
#elif defined(_MSC_VER)
#define inline __forceinline
#endif
namespace simd {
template<unsigned imm>
struct immint {
#if _MSC_VER < 1900
static const int value = imm;
operator int() const { return value; }
#else
static constexpr int value = imm;
constexpr operator int() const { return value; }
#endif
};
}
#if defined(USE_SIMD_X86_SSE2) || defined(USE_SIMD_ARM_NEON)
#include "int8x4.h"
#include "int8x4.inl"
#include "int8x8.h"
#include "int8x8.inl"
#include "int8x16.h"
#include "int8x16.inl"
#include "int16x4.h"
#include "int16x4.inl"
#include "int16x8.h"
#include "int16x8.inl"
#include "int32x2.h"
#include "int32x2.inl"
#include "int32x4.h"
#include "int32x4.inl"
#include "vec128.h"
#include "vec128.inl"
#endif
#undef inline