util_optimization.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef __UTIL_OPTIMIZATION_H__
  17. #define __UTIL_OPTIMIZATION_H__
  18. #ifndef __KERNEL_GPU__
  19. /* x86
  20. *
  21. * Compile a regular, SSE2 and SSE3 kernel. */
  22. # if defined(i386) || defined(_M_IX86)
  23. /* We require minimum SSE2 support on x86, so auto enable. */
  24. # define __KERNEL_SSE2__
  25. # ifdef WITH_KERNEL_SSE2
  26. # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
  27. # endif
  28. # ifdef WITH_KERNEL_SSE3
  29. # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
  30. # endif
  31. # endif /* defined(i386) || defined(_M_IX86) */
  32. /* x86-64
  33. *
  34. * Compile a regular (includes SSE2), SSE3, SSE 4.1, AVX and AVX2 kernel. */
  35. # if defined(__x86_64__) || defined(_M_X64)
  36. /* SSE2 is always available on x86-64 CPUs, so auto enable */
  37. # define __KERNEL_SSE2__
  38. /* no SSE2 kernel on x86-64, part of regular kernel */
  39. # ifdef WITH_KERNEL_SSE3
  40. # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
  41. # endif
  42. # ifdef WITH_KERNEL_SSE41
  43. # define WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
  44. # endif
  45. # ifdef WITH_KERNEL_AVX
  46. # define WITH_CYCLES_OPTIMIZED_KERNEL_AVX
  47. # endif
  48. # ifdef WITH_KERNEL_AVX2
  49. # define WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
  50. # endif
  51. # endif /* defined(__x86_64__) || defined(_M_X64) */
  52. #endif
  53. #endif /* __UTIL_OPTIMIZATION_H__ */