1 /****************************  vectorclass.h   ********************************
2 * Author:        Agner Fog
3 * Date created:  2012-05-30
4 * Last modified: 2017-05-10
5 * Version:       1.29
6 * Project:       vector classes
7 * Description:
8 * Header file defining vector classes as interface to intrinsic functions
9 * in x86 microprocessors with SSE2 and later instruction sets up to AVX512.
10 *
11 * Instructions:
12 * Use Gnu, Clang, Intel or Microsoft C++ compiler. Compile for the desired
13 * instruction set, which must be at least SSE2. Specify the supported
14 * instruction set by a command line define, e.g. __SSE4_1__ if the
15 * compiler does not automatically do so.
16 *
17 * Each vector object is represented internally in the CPU as a vector
18 * register with 128, 256 or 512 bits.
19 *
20 * This header file includes the appropriate header files depending on the
21 * supported instruction set
22 *
23 * For detailed instructions, see VectorClass.pdf
24 *
25 * (c) Copyright 2012-2017 GNU General Public License www.gnu.org/licenses
26 ******************************************************************************/
27 #ifndef VECTORCLASS_H
28 #define VECTORCLASS_H  129
29 
30 // Maximum vector size, bits. Allowed values are 128, 256, 512
31 #ifndef MAX_VECTOR_SIZE
32 #define MAX_VECTOR_SIZE 256
33 #endif
34 
35 #include "instrset.h"        // Select supported instruction set
36 
37 #if INSTRSET < 2             // SSE2 required
38   #error Please compile for the SSE2 instruction set or higher
39 #else
40 
41 #include "vectori128.h"      // 128-bit integer vectors
42 #include "vectorf128.h"      // 128-bit floating point vectors
43 
44 #if MAX_VECTOR_SIZE >= 256
45 #if INSTRSET >= 8
46   #include "vectori256.h"    // 256-bit integer vectors, requires AVX2 instruction set
47 #else
48   #include "vectori256e.h"   // 256-bit integer vectors, emulated
49 #endif  // INSTRSET >= 8
50 #if INSTRSET >= 7
51   #include "vectorf256.h"    // 256-bit floating point vectors, requires AVX instruction set
52 #else
53   #include "vectorf256e.h"   // 256-bit floating point vectors, emulated
54 #endif  //  INSTRSET >= 7
55 #endif  //  MAX_VECTOR_SIZE >= 256
56 
57 #if MAX_VECTOR_SIZE >= 512
58 #if INSTRSET >= 9
59   #include "vectori512.h"    // 512-bit integer vectors, requires AVX512 instruction set
60   #include "vectorf512.h"    // 512-bit floating point vectors, requires AVX512 instruction set
61 #else
62   #include "vectori512e.h"   // 512-bit integer vectors, emulated
63   #include "vectorf512e.h"   // 512-bit floating point vectors, emulated
64 #endif  //  INSTRSET >= 9
65 #endif  //  MAX_VECTOR_SIZE >= 512
66 
67 #endif  // INSTRSET >= 2
68 
69 #endif  // VECTORCLASS_H
70