Provided by: libsdl3-doc_3.2.8+ds-1_all bug

NAME

       SDL_TARGETING - A macro to tag a function as targeting a specific CPU architecture.

HEADER FILE

       Defined in SDL3/SDL_intrin.h

SYNOPSIS

       #include "SDL3/SDL.h"

       #define SDL_TARGETING(x) __attribute__((target(x)))

DESCRIPTION

       This  is  a  hint  to the compiler that a function should be built with support for a CPU instruction set
       that might be different than the rest of the program.

       The particulars of this are explained in the GCC documentation:

       https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-target-function-attribute

       An example of using this feature is to turn on SSE2 support for a specific function, even if the rest  of
       the source code is not compiled to use SSE2 code:

              #ifdef SDL_SSE2_INTRINSICS
              static void SDL_TARGETING("sse2") DoSomethingWithSSE2(char *x) {
                 ...use SSE2 intrinsic functions, etc...
              }
              #endif

              // later...
              #ifdef SDL_SSE2_INTRINSICS
              if (SDL_HasSSE2()) {
                  DoSomethingWithSSE2(str);
              }
              #endif

       The  application  is,  on a whole, built without SSE2 instructions, so it will run on Intel machines that
       don't support SSE2. But then at runtime, it checks if the system  supports  the  instructions,  and  then
       calls into a function that uses SSE2 opcodes. The ifdefs make sure that this code isn't used on platforms
       that don't have SSE2 at all.

       On compilers without target support, this is defined to nothing.

       This  symbol  is used by SDL internally, but apps and other libraries are welcome to use it for their own
       interfaces as well.

AVAILABILITY

       This macro is available since SDL 3.2.0.

Simple Directmedia Layer                            SDL 3.2.8                                   SDL_TARGETING(3)