1.. title:: clang-tidy - portability-simd-intrinsics 2 3portability-simd-intrinsics 4=========================== 5 6Finds SIMD intrinsics calls and suggests ``std::experimental::simd`` (`P0214`_) 7alternatives. 8 9If the option :option:`Suggest` is set to `true`, for 10 11.. code-block:: c++ 12 13 _mm_add_epi32(a, b); // x86 14 vec_add(a, b); // Power 15 16the check suggests an alternative: ``operator+`` on ``std::experimental::simd`` 17objects. 18 19Otherwise, it just complains the intrinsics are non-portable (and there are 20`P0214`_ alternatives). 21 22Many architectures provide SIMD operations (e.g. x86 SSE/AVX, Power AltiVec/VSX, 23ARM NEON). It is common that SIMD code implementing the same algorithm, is 24written in multiple target-dispatching pieces to optimize for different 25architectures or micro-architectures. 26 27The C++ standard proposal `P0214`_ and its extensions cover many common SIMD 28operations. By migrating from target-dependent intrinsics to `P0214`_ 29operations, the SIMD code can be simplified and pieces for different targets can 30be unified. 31 32Refer to `P0214`_ for introduction and motivation for the data-parallel standard 33library. 34 35Options 36------- 37 38.. option:: Suggest 39 40 If this option is set to `true` (default is `false`), the check will suggest 41 `P0214`_ alternatives, otherwise it only points out the intrinsic function is 42 non-portable. 43 44.. option:: Std 45 46 The namespace used to suggest `P0214`_ alternatives. If not specified, `std::` 47 for `-std=c++20` and `std::experimental::` for `-std=c++11`. 48 49.. _P0214: https://wg21.link/p0214 50