.. Copyright 1988-2022 Free Software Foundation, Inc. This is part of the GCC manual. For copying conditions, see the copyright.rst file. .. _x86-function-attributes: x86 Function Attributes ^^^^^^^^^^^^^^^^^^^^^^^ These function attributes are supported by the x86 back end: .. index:: cdecl function attribute, x86-32, functions that pop the argument stack on x86-32 .. option:: cdecl On the x86-32 targets, the ``cdecl`` attribute causes the compiler to assume that the calling function pops off the stack space used to pass arguments. This is useful to override the effects of the :option:`-mrtd` switch. .. index:: fastcall function attribute, x86-32, functions that pop the argument stack on x86-32 .. x86-fn-attr:: fastcall On x86-32 targets, the :x86-fn-attr:`fastcall` attribute causes the compiler to pass the first argument (if of integral type) in the register ECX and the second argument (if of integral type) in the register EDX. Subsequent and other typed arguments are passed on the stack. The called function pops the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack. .. index:: thiscall function attribute, x86-32, functions that pop the argument stack on x86-32 .. x86-fn-attr:: thiscall On x86-32 targets, the :x86-fn-attr:`thiscall` attribute causes the compiler to pass the first argument (if of integral type) in the register ECX. Subsequent and other typed arguments are passed on the stack. The called function pops the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack. The :x86-fn-attr:`thiscall` attribute is intended for C++ non-static member functions. As a GCC extension, this calling convention can be used for C functions and for static member methods. .. index:: ms_abi function attribute, x86, sysv_abi function attribute, x86 .. x86-fn-attr:: ms_abi, sysv_abi On 32-bit and 64-bit x86 targets, you can use an ABI attribute to indicate which calling convention should be used for a function. The :x86-fn-attr:`ms_abi` attribute tells the compiler to use the Microsoft ABI, while the ``sysv_abi`` attribute tells the compiler to use the System V ELF ABI, which is used on GNU/Linux and other systems. The default is to use the Microsoft ABI when targeting Windows. On all other systems, the default is the System V ELF ABI. Note, the :x86-fn-attr:`ms_abi` attribute for Microsoft Windows 64-bit targets currently requires the :option:`-maccumulate-outgoing-args` option. .. index:: callee_pop_aggregate_return function attribute, x86 .. x86-fn-attr:: callee_pop_aggregate_return (number) On x86-32 targets, you can use this attribute to control how aggregates are returned in memory. If the caller is responsible for popping the hidden pointer together with the rest of the arguments, specify :samp:`{number}` equal to zero. If callee is responsible for popping the hidden pointer, specify :samp:`{number}` equal to one. The default x86-32 ABI assumes that the callee pops the stack for hidden pointer. However, on x86-32 Microsoft Windows targets, the compiler assumes that the caller pops the stack for hidden pointer. .. index:: ms_hook_prologue function attribute, x86 .. x86-fn-attr:: ms_hook_prologue On 32-bit and 64-bit x86 targets, you can use this function attribute to make GCC generate the 'hot-patching' function prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2 and newer. .. index:: naked function attribute, x86 .. x86-fn-attr:: naked This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic ``asm`` statements can safely be included in naked functions (see :ref:`basic-asm`). While using extended ``asm`` or a mixture of basic ``asm`` and C code may appear to work, they cannot be depended upon to work reliably and are not supported. .. index:: regparm function attribute, x86, functions that are passed arguments in registers on x86-32 .. x86-fn-attr:: regparm (number) On x86-32 targets, the ``regparm`` attribute causes the compiler to pass arguments number one to :samp:`{number}` if they are of integral type in registers EAX, EDX, and ECX instead of on the stack. Functions that take a variable number of arguments continue to be passed all of their arguments on the stack. Beware that on some ELF systems this attribute is unsuitable for global functions in shared libraries with lazy binding (which is the default). Lazy binding sends the first call via resolving code in the loader, which might assume EAX, EDX and ECX can be clobbered, as per the standard calling conventions. Solaris 8 is affected by this. Systems with the GNU C Library version 2.1 or higher and FreeBSD are believed to be safe since the loaders there save EAX, EDX and ECX. (Lazy binding can be disabled with the linker or the loader if desired, to avoid the problem.) .. index:: sseregparm function attribute, x86 .. x86-fn-attr:: sseregparm On x86-32 targets with SSE support, the :x86-fn-attr:`sseregparm` attribute causes the compiler to pass up to 3 floating-point arguments in SSE registers instead of on the stack. Functions that take a variable number of arguments continue to pass all of their floating-point arguments on the stack. .. index:: force_align_arg_pointer function attribute, x86 .. x86-fn-attr:: force_align_arg_pointer On x86 targets, the :x86-fn-attr:`force_align_arg_pointer` attribute may be applied to individual function definitions, generating an alternate prologue and epilogue that realigns the run-time stack if necessary. This supports mixing legacy codes that run with a 4-byte aligned stack with modern codes that keep a 16-byte stack for SSE compatibility. .. index:: stdcall function attribute, x86-32, functions that pop the argument stack on x86-32 .. x86-fn-attr:: stdcall On x86-32 targets, the :x86-fn-attr:`stdcall` attribute causes the compiler to assume that the called function pops off the stack space used to pass arguments, unless it takes a variable number of arguments. .. index:: no_caller_saved_registers function attribute, x86 .. x86-fn-attr:: no_caller_saved_registers Use this attribute to indicate that the specified function has no caller-saved registers. That is, all registers are callee-saved. For example, this attribute can be used for a function called from an interrupt handler. The compiler generates proper function entry and exit sequences to save and restore any modified registers, except for the EFLAGS register. Since GCC doesn't preserve SSE, MMX nor x87 states, the GCC option :option:`-mgeneral-regs-only` should be used to compile functions with :x86-fn-attr:`no_caller_saved_registers` attribute. .. index:: interrupt function attribute, x86 .. x86-fn-attr:: interrupt Use this attribute to indicate that the specified function is an interrupt handler or an exception handler (depending on parameters passed to the function, explained further). The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. The ``IRET`` instruction, instead of the ``RET`` instruction, is used to return from interrupt handlers. All registers, except for the EFLAGS register which is restored by the ``IRET`` instruction, are preserved by the compiler. Since GCC doesn't preserve SSE, MMX nor x87 states, the GCC option :option:`-mgeneral-regs-only` should be used to compile interrupt and exception handlers. Any interruptible-without-stack-switch code must be compiled with :option:`-mno-red-zone` since interrupt handlers can and will, because of the hardware design, touch the red zone. An interrupt handler must be declared with a mandatory pointer argument: .. code-block:: c++ struct interrupt_frame; __attribute__ ((interrupt)) void f (struct interrupt_frame *frame) { } and you must define ``struct interrupt_frame`` as described in the processor's manual. Exception handlers differ from interrupt handlers because the system pushes an error code on the stack. An exception handler declaration is similar to that for an interrupt handler, but with a different mandatory function signature. The compiler arranges to pop the error code off the stack before the ``IRET`` instruction. .. code-block:: c++ #ifdef __x86_64__ typedef unsigned long long int uword_t; #else typedef unsigned int uword_t; #endif struct interrupt_frame; __attribute__ ((interrupt)) void f (struct interrupt_frame *frame, uword_t error_code) { ... } Exception handlers should only be used for exceptions that push an error code; you should use an interrupt handler in other cases. The system will crash if the wrong kind of handler is used. .. index:: target function attribute .. x86-fn-attr:: target (options) As discussed in :ref:`common-function-attributes`, this attribute allows specification of target-specific compilation options. On the x86, the following options are allowed: :samp:`3dnow` :samp:`no-3dnow` .. index:: target("3dnow") function attribute, x86 Enable/disable the generation of the 3DNow! instructions. :samp:`3dnowa` :samp:`no-3dnowa` .. index:: target("3dnowa") function attribute, x86 Enable/disable the generation of the enhanced 3DNow! instructions. :samp:`abm` :samp:`no-abm` .. index:: target("abm") function attribute, x86 Enable/disable the generation of the advanced bit instructions. :samp:`adx` :samp:`no-adx` .. index:: target("adx") function attribute, x86 Enable/disable the generation of the ADX instructions. :samp:`aes` :samp:`no-aes` .. index:: target("aes") function attribute, x86 Enable/disable the generation of the AES instructions. :samp:`avx` :samp:`no-avx` .. index:: target("avx") function attribute, x86 Enable/disable the generation of the AVX instructions. :samp:`avx2` :samp:`no-avx2` .. index:: target("avx2") function attribute, x86 Enable/disable the generation of the AVX2 instructions. :samp:`avx5124fmaps` :samp:`no-avx5124fmaps` .. index:: target("avx5124fmaps") function attribute, x86 Enable/disable the generation of the AVX5124FMAPS instructions. :samp:`avx5124vnniw` :samp:`no-avx5124vnniw` .. index:: target("avx5124vnniw") function attribute, x86 Enable/disable the generation of the AVX5124VNNIW instructions. :samp:`avx512bitalg` :samp:`no-avx512bitalg` .. index:: target("avx512bitalg") function attribute, x86 Enable/disable the generation of the AVX512BITALG instructions. :samp:`avx512bw` :samp:`no-avx512bw` .. index:: target("avx512bw") function attribute, x86 Enable/disable the generation of the AVX512BW instructions. :samp:`avx512cd` :samp:`no-avx512cd` .. index:: target("avx512cd") function attribute, x86 Enable/disable the generation of the AVX512CD instructions. :samp:`avx512dq` :samp:`no-avx512dq` .. index:: target("avx512dq") function attribute, x86 Enable/disable the generation of the AVX512DQ instructions. :samp:`avx512er` :samp:`no-avx512er` .. index:: target("avx512er") function attribute, x86 Enable/disable the generation of the AVX512ER instructions. :samp:`avx512f` :samp:`no-avx512f` .. index:: target("avx512f") function attribute, x86 Enable/disable the generation of the AVX512F instructions. :samp:`avx512ifma` :samp:`no-avx512ifma` .. index:: target("avx512ifma") function attribute, x86 Enable/disable the generation of the AVX512IFMA instructions. :samp:`avx512pf` :samp:`no-avx512pf` .. index:: target("avx512pf") function attribute, x86 Enable/disable the generation of the AVX512PF instructions. :samp:`avx512vbmi` :samp:`no-avx512vbmi` .. index:: target("avx512vbmi") function attribute, x86 Enable/disable the generation of the AVX512VBMI instructions. :samp:`avx512vbmi2` :samp:`no-avx512vbmi2` .. index:: target("avx512vbmi2") function attribute, x86 Enable/disable the generation of the AVX512VBMI2 instructions. :samp:`avx512vl` :samp:`no-avx512vl` .. index:: target("avx512vl") function attribute, x86 Enable/disable the generation of the AVX512VL instructions. :samp:`avx512vnni` :samp:`no-avx512vnni` .. index:: target("avx512vnni") function attribute, x86 Enable/disable the generation of the AVX512VNNI instructions. :samp:`avx512vpopcntdq` :samp:`no-avx512vpopcntdq` .. index:: target("avx512vpopcntdq") function attribute, x86 Enable/disable the generation of the AVX512VPOPCNTDQ instructions. :samp:`bmi` :samp:`no-bmi` .. index:: target("bmi") function attribute, x86 Enable/disable the generation of the BMI instructions. :samp:`bmi2` :samp:`no-bmi2` .. index:: target("bmi2") function attribute, x86 Enable/disable the generation of the BMI2 instructions. :samp:`cldemote` :samp:`no-cldemote` .. index:: target("cldemote") function attribute, x86 Enable/disable the generation of the CLDEMOTE instructions. :samp:`clflushopt` :samp:`no-clflushopt` .. index:: target("clflushopt") function attribute, x86 Enable/disable the generation of the CLFLUSHOPT instructions. :samp:`clwb` :samp:`no-clwb` .. index:: target("clwb") function attribute, x86 Enable/disable the generation of the CLWB instructions. :samp:`clzero` :samp:`no-clzero` .. index:: target("clzero") function attribute, x86 Enable/disable the generation of the CLZERO instructions. :samp:`crc32` :samp:`no-crc32` .. index:: target("crc32") function attribute, x86 Enable/disable the generation of the CRC32 instructions. :samp:`cx16` :samp:`no-cx16` .. index:: target("cx16") function attribute, x86 Enable/disable the generation of the CMPXCHG16B instructions. :samp:`default` .. index:: target("default") function attribute, x86 See :ref:`function-multiversioning`, where it is used to specify the default function version. :samp:`f16c` :samp:`no-f16c` .. index:: target("f16c") function attribute, x86 Enable/disable the generation of the F16C instructions. :samp:`fma` :samp:`no-fma` .. index:: target("fma") function attribute, x86 Enable/disable the generation of the FMA instructions. :samp:`fma4` :samp:`no-fma4` .. index:: target("fma4") function attribute, x86 Enable/disable the generation of the FMA4 instructions. :samp:`fsgsbase` :samp:`no-fsgsbase` .. index:: target("fsgsbase") function attribute, x86 Enable/disable the generation of the FSGSBASE instructions. :samp:`fxsr` :samp:`no-fxsr` .. index:: target("fxsr") function attribute, x86 Enable/disable the generation of the FXSR instructions. :samp:`gfni` :samp:`no-gfni` .. index:: target("gfni") function attribute, x86 Enable/disable the generation of the GFNI instructions. :samp:`hle` :samp:`no-hle` .. index:: target("hle") function attribute, x86 Enable/disable the generation of the HLE instruction prefixes. :samp:`lwp` :samp:`no-lwp` .. index:: target("lwp") function attribute, x86 Enable/disable the generation of the LWP instructions. :samp:`lzcnt` :samp:`no-lzcnt` .. index:: target("lzcnt") function attribute, x86 Enable/disable the generation of the LZCNT instructions. :samp:`mmx` :samp:`no-mmx` .. index:: target("mmx") function attribute, x86 Enable/disable the generation of the MMX instructions. :samp:`movbe` :samp:`no-movbe` .. index:: target("movbe") function attribute, x86 Enable/disable the generation of the MOVBE instructions. :samp:`movdir64b` :samp:`no-movdir64b` .. index:: target("movdir64b") function attribute, x86 Enable/disable the generation of the MOVDIR64B instructions. :samp:`movdiri` :samp:`no-movdiri` .. index:: target("movdiri") function attribute, x86 Enable/disable the generation of the MOVDIRI instructions. :samp:`mwait` :samp:`no-mwait` .. index:: target("mwait") function attribute, x86 Enable/disable the generation of the MWAIT and MONITOR instructions. :samp:`mwaitx` :samp:`no-mwaitx` .. index:: target("mwaitx") function attribute, x86 Enable/disable the generation of the MWAITX instructions. :samp:`pclmul` :samp:`no-pclmul` .. index:: target("pclmul") function attribute, x86 Enable/disable the generation of the PCLMUL instructions. :samp:`pconfig` :samp:`no-pconfig` .. index:: target("pconfig") function attribute, x86 Enable/disable the generation of the PCONFIG instructions. :samp:`pku` :samp:`no-pku` .. index:: target("pku") function attribute, x86 Enable/disable the generation of the PKU instructions. :samp:`popcnt` :samp:`no-popcnt` .. index:: target("popcnt") function attribute, x86 Enable/disable the generation of the POPCNT instruction. :samp:`prefetchwt1` :samp:`no-prefetchwt1` .. index:: target("prefetchwt1") function attribute, x86 Enable/disable the generation of the PREFETCHWT1 instructions. :samp:`prfchw` :samp:`no-prfchw` .. index:: target("prfchw") function attribute, x86 Enable/disable the generation of the PREFETCHW instruction. :samp:`ptwrite` :samp:`no-ptwrite` .. index:: target("ptwrite") function attribute, x86 Enable/disable the generation of the PTWRITE instructions. :samp:`rdpid` :samp:`no-rdpid` .. index:: target("rdpid") function attribute, x86 Enable/disable the generation of the RDPID instructions. :samp:`rdrnd` :samp:`no-rdrnd` .. index:: target("rdrnd") function attribute, x86 Enable/disable the generation of the RDRND instructions. :samp:`rdseed` :samp:`no-rdseed` .. index:: target("rdseed") function attribute, x86 Enable/disable the generation of the RDSEED instructions. :samp:`rtm` :samp:`no-rtm` .. index:: target("rtm") function attribute, x86 Enable/disable the generation of the RTM instructions. :samp:`sahf` :samp:`no-sahf` .. index:: target("sahf") function attribute, x86 Enable/disable the generation of the SAHF instructions. :samp:`sgx` :samp:`no-sgx` .. index:: target("sgx") function attribute, x86 Enable/disable the generation of the SGX instructions. :samp:`sha` :samp:`no-sha` .. index:: target("sha") function attribute, x86 Enable/disable the generation of the SHA instructions. :samp:`shstk` :samp:`no-shstk` .. index:: target("shstk") function attribute, x86 Enable/disable the shadow stack built-in functions from CET. :samp:`sse` :samp:`no-sse` .. index:: target("sse") function attribute, x86 Enable/disable the generation of the SSE instructions. :samp:`sse2` :samp:`no-sse2` .. index:: target("sse2") function attribute, x86 Enable/disable the generation of the SSE2 instructions. :samp:`sse3` :samp:`no-sse3` .. index:: target("sse3") function attribute, x86 Enable/disable the generation of the SSE3 instructions. :samp:`sse4` :samp:`no-sse4` .. index:: target("sse4") function attribute, x86 Enable/disable the generation of the SSE4 instructions (both SSE4.1 and SSE4.2). :samp:`sse4.1` :samp:`no-sse4.1` .. index:: target("sse4.1") function attribute, x86 Enable/disable the generation of the SSE4.1 instructions. :samp:`sse4.2` :samp:`no-sse4.2` .. index:: target("sse4.2") function attribute, x86 Enable/disable the generation of the SSE4.2 instructions. :samp:`sse4a` :samp:`no-sse4a` .. index:: target("sse4a") function attribute, x86 Enable/disable the generation of the SSE4A instructions. :samp:`ssse3` :samp:`no-ssse3` .. index:: target("ssse3") function attribute, x86 Enable/disable the generation of the SSSE3 instructions. :samp:`tbm` :samp:`no-tbm` .. index:: target("tbm") function attribute, x86 Enable/disable the generation of the TBM instructions. :samp:`vaes` :samp:`no-vaes` .. index:: target("vaes") function attribute, x86 Enable/disable the generation of the VAES instructions. :samp:`vpclmulqdq` :samp:`no-vpclmulqdq` .. index:: target("vpclmulqdq") function attribute, x86 Enable/disable the generation of the VPCLMULQDQ instructions. :samp:`waitpkg` :samp:`no-waitpkg` .. index:: target("waitpkg") function attribute, x86 Enable/disable the generation of the WAITPKG instructions. :samp:`wbnoinvd` :samp:`no-wbnoinvd` .. index:: target("wbnoinvd") function attribute, x86 Enable/disable the generation of the WBNOINVD instructions. :samp:`xop` :samp:`no-xop` .. index:: target("xop") function attribute, x86 Enable/disable the generation of the XOP instructions. :samp:`xsave` :samp:`no-xsave` .. index:: target("xsave") function attribute, x86 Enable/disable the generation of the XSAVE instructions. :samp:`xsavec` :samp:`no-xsavec` .. index:: target("xsavec") function attribute, x86 Enable/disable the generation of the XSAVEC instructions. :samp:`xsaveopt` :samp:`no-xsaveopt` .. index:: target("xsaveopt") function attribute, x86 Enable/disable the generation of the XSAVEOPT instructions. :samp:`xsaves` :samp:`no-xsaves` .. index:: target("xsaves") function attribute, x86 Enable/disable the generation of the XSAVES instructions. :samp:`amx-tile` :samp:`no-amx-tile` .. index:: target("amx-tile") function attribute, x86 Enable/disable the generation of the AMX-TILE instructions. :samp:`amx-int8` :samp:`no-amx-int8` .. index:: target("amx-int8") function attribute, x86 Enable/disable the generation of the AMX-INT8 instructions. :samp:`amx-bf16` :samp:`no-amx-bf16` .. index:: target("amx-bf16") function attribute, x86 Enable/disable the generation of the AMX-BF16 instructions. :samp:`uintr` :samp:`no-uintr` .. index:: target("uintr") function attribute, x86 Enable/disable the generation of the UINTR instructions. :samp:`hreset` :samp:`no-hreset` .. index:: target("hreset") function attribute, x86 Enable/disable the generation of the HRESET instruction. :samp:`kl` :samp:`no-kl` .. index:: target("kl") function attribute, x86 Enable/disable the generation of the KEYLOCKER instructions. :samp:`widekl` :samp:`no-widekl` .. index:: target("widekl") function attribute, x86 Enable/disable the generation of the WIDEKL instructions. :samp:`avxvnni` :samp:`no-avxvnni` .. index:: target("avxvnni") function attribute, x86 Enable/disable the generation of the AVXVNNI instructions. :samp:`avxifma` :samp:`no-avxifma` .. index:: target("avxifma") function attribute, x86 Enable/disable the generation of the AVXIFMA instructions. :samp:`avxvnniint8` :samp:`no-avxvnniint8` .. index:: target("avxvnniint8") function attribute, x86 Enable/disable the generation of the AVXVNNIINT8 instructions. :samp:`avxneconvert` :samp:`no-avxneconvert` .. index:: target("avxneconvert") function attribute, x86 Enable/disable the generation of the AVXNECONVERT instructions. :samp:`cmpccxadd` :samp:`no-cmpccxadd` .. index:: target("cmpccxadd") function attribute, x86 Enable/disable the generation of the CMPccXADD instructions. :samp:`amx-fp16` :samp:`no-amx-fp16` .. index:: target("amx-fp16") function attribute, x86 Enable/disable the generation of the AMX-FP16 instructions. :samp:`prefetchi` :samp:`no-prefetchi` .. index:: target("prefetchi") function attribute, x86 Enable/disable the generation of the PREFETCHI instructions. :samp:`raoint` :samp:`no-raoint` .. index:: target("raoint") function attribute, x86 Enable/disable the generation of the RAOINT instructions. :samp:`cld` :samp:`no-cld` .. index:: target("cld") function attribute, x86 Enable/disable the generation of the CLD before string moves. :samp:`fancy-math-387` :samp:`no-fancy-math-387` .. index:: target("fancy-math-387") function attribute, x86 Enable/disable the generation of the ``sin``, ``cos``, and ``sqrt`` instructions on the 387 floating-point unit. :samp:`ieee-fp` :samp:`no-ieee-fp` .. index:: target("ieee-fp") function attribute, x86 Enable/disable the generation of floating point that depends on IEEE arithmetic. :samp:`inline-all-stringops` :samp:`no-inline-all-stringops` .. index:: target("inline-all-stringops") function attribute, x86 Enable/disable inlining of string operations. :samp:`inline-stringops-dynamically` :samp:`no-inline-stringops-dynamically` .. index:: target("inline-stringops-dynamically") function attribute, x86 Enable/disable the generation of the inline code to do small string operations and calling the library routines for large operations. :samp:`align-stringops` :samp:`no-align-stringops` .. index:: target("align-stringops") function attribute, x86 Do/do not align destination of inlined string operations. :samp:`recip` :samp:`no-recip` .. index:: target("recip") function attribute, x86 Enable/disable the generation of RCPSS, RCPPS, RSQRTSS and RSQRTPS instructions followed an additional Newton-Raphson step instead of doing a floating-point division. :samp:`general-regs-only` .. index:: target("general-regs-only") function attribute, x86 Generate code which uses only the general registers. :samp:`arch={ARCH}` .. index:: target("arch=ARCH") function attribute, x86 Specify the architecture to generate code for in compiling the function. :samp:`tune={TUNE}` .. index:: target("tune=TUNE") function attribute, x86 Specify the architecture to tune for in compiling the function. :samp:`fpmath={FPMATH}` .. index:: target("fpmath=FPMATH") function attribute, x86 Specify which floating-point unit to use. You must specify the ``target("fpmath=sse,387")`` option as ``target("fpmath=sse+387")`` because the comma would separate different options. :samp:`prefer-vector-width={OPT}` .. index:: prefer-vector-width function attribute, x86 On x86 targets, the ``prefer-vector-width`` attribute informs the compiler to use :samp:`{OPT}` -bit vector width in instructions instead of the default on the selected platform. Valid :samp:`{OPT}` values are: :samp:`none` No extra limitations applied to GCC other than defined by the selected platform. :samp:`128` Prefer 128-bit vector width for instructions. :samp:`256` Prefer 256-bit vector width for instructions. :samp:`512` Prefer 512-bit vector width for instructions. On the x86, the inliner does not inline a function that has different target options than the caller, unless the callee has a subset of the target options of the caller. For example a function declared with ``target("sse3")`` can inline a function with ``target("sse2")``, since ``-msse3`` implies ``-msse2``. .. index:: indirect_branch function attribute, x86 .. x86-fn-attr:: indirect_branch("choice") On x86 targets, the ``indirect_branch`` attribute causes the compiler to convert indirect call and jump with :samp:`{choice}`. :samp:`keep` keeps indirect call and jump unmodified. :samp:`thunk` converts indirect call and jump to call and return thunk. :samp:`thunk-inline` converts indirect call and jump to inlined call and return thunk. :samp:`thunk-extern` converts indirect call and jump to external call and return thunk provided in a separate object file. .. index:: function_return function attribute, x86 .. x86-fn-attr:: function_return("choice") On x86 targets, the ``function_return`` attribute causes the compiler to convert function return with :samp:`{choice}`. :samp:`keep` keeps function return unmodified. :samp:`thunk` converts function return to call and return thunk. :samp:`thunk-inline` converts function return to inlined call and return thunk. :samp:`thunk-extern` converts function return to external call and return thunk provided in a separate object file. .. index:: nocf_check function attribute .. x86-fn-attr:: nocf_check The :x86-fn-attr:`nocf_check` attribute on a function is used to inform the compiler that the function's prologue should not be instrumented when compiled with the :option:`-fcf-protection=branch` option. The compiler assumes that the function's address is a valid target for a control-flow transfer. The :x86-fn-attr:`nocf_check` attribute on a type of pointer to function is used to inform the compiler that a call through the pointer should not be instrumented when compiled with the :option:`-fcf-protection=branch` option. The compiler assumes that the function's address from the pointer is a valid target for a control-flow transfer. A direct function call through a function name is assumed to be a safe call thus direct calls are not instrumented by the compiler. The :x86-fn-attr:`nocf_check` attribute is applied to an object's type. In case of assignment of a function address or a function pointer to another pointer, the attribute is not carried over from the right-hand object's type; the type of left-hand object stays unchanged. The compiler checks for :x86-fn-attr:`nocf_check` attribute mismatch and reports a warning in case of mismatch. .. code-block:: c++ { int foo (void) __attribute__(nocf_check); void (*foo1)(void) __attribute__(nocf_check); void (*foo2)(void); /* foo's address is assumed to be valid. */ int foo (void) /* This call site is not checked for control-flow validity. */ (*foo1)(); /* A warning is issued about attribute mismatch. */ foo1 = foo2; /* This call site is still not checked. */ (*foo1)(); /* This call site is checked. */ (*foo2)(); /* A warning is issued about attribute mismatch. */ foo2 = foo1; /* This call site is still checked. */ (*foo2)(); return 0; } .. index:: cf_check function attribute, x86 .. x86-fn-attr:: cf_check The :x86-fn-attr:`cf_check` attribute on a function is used to inform the compiler that ENDBR instruction should be placed at the function entry when :option:`-fcf-protection=branch` is enabled. .. index:: indirect_return function attribute, x86 .. x86-fn-attr:: indirect_return The :x86-fn-attr:`indirect_return` attribute can be applied to a function, as well as variable or type of function pointer to inform the compiler that the function may return via indirect branch. .. index:: fentry_name function attribute, x86 .. x86-fn-attr:: fentry_name("name") On x86 targets, the ``fentry_name`` attribute sets the function to call on function entry when function instrumentation is enabled with :option:`-pg -mfentry`. When :samp:`{name}` is nop then a 5 byte nop sequence is generated. .. index:: fentry_section function attribute, x86 .. x86-fn-attr:: fentry_section("name") On x86 targets, the ``fentry_section`` attribute sets the name of the section to record function entry instrumentation calls in when enabled with :option:`-pg -mrecord-mcount` .. index:: nodirect_extern_access function attribute .. option:: nodirect_extern_access This attribute, attached to a global variable or function, is the counterpart to option :option:`-mno-direct-extern-access`.