Blender  V2.93
util_optimization.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __UTIL_OPTIMIZATION_H__
18 #define __UTIL_OPTIMIZATION_H__
19 
20 #ifndef __KERNEL_GPU__
21 
22 /* x86
23  *
24  * Compile a regular, SSE2 and SSE3 kernel. */
25 
26 # if defined(i386) || defined(_M_IX86)
27 
28 /* We require minimum SSE2 support on x86, so auto enable. */
29 # define __KERNEL_SSE2__
30 # ifdef WITH_KERNEL_SSE2
31 # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
32 # endif
33 # ifdef WITH_KERNEL_SSE3
34 # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
35 # endif
36 
37 /* x86-64
38  *
39  * Compile a regular (includes SSE2), SSE3, SSE 4.1, AVX and AVX2 kernel. */
40 
41 # elif defined(__x86_64__) || defined(_M_X64)
42 
43 /* SSE2 is always available on x86-64 CPUs, so auto enable */
44 # define __KERNEL_SSE2__
45 /* no SSE2 kernel on x86-64, part of regular kernel */
46 # ifdef WITH_KERNEL_SSE3
47 # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
48 # endif
49 # ifdef WITH_KERNEL_SSE41
50 # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
51 # endif
52 # ifdef WITH_KERNEL_AVX
53 # define WITH_CYCLES_OPTIMIZED_KERNEL_AVX
54 # endif
55 # ifdef WITH_KERNEL_AVX2
56 # define WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
57 # endif
58 
59 /* Arm Neon
60  *
61  * Compile a SSE4 kernel emulated with Neon. Most code is shared with
62  * SSE, some specializations for performance and compatibility are made
63  * made testing for __KERNEL_NEON__. */
64 
65 # elif defined(__ARM_NEON) && defined(WITH_SSE2NEON)
66 
67 # define __KERNEL_NEON__
68 # define __KERNEL_SSE__
69 # define __KERNEL_SSE2__
70 # define __KERNEL_SSE3__
71 # define __KERNEL_SSE41__
72 
73 # endif
74 
75 #endif
76 
77 #endif /* __UTIL_OPTIMIZATION_H__ */