comparison gcc/doc/extend.texi @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents 58ad6c70ea60
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
33 * Typeof:: @code{typeof}: referring to the type of an expression. 33 * Typeof:: @code{typeof}: referring to the type of an expression.
34 * Conditionals:: Omitting the middle operand of a @samp{?:} expression. 34 * Conditionals:: Omitting the middle operand of a @samp{?:} expression.
35 * Long Long:: Double-word integers---@code{long long int}. 35 * Long Long:: Double-word integers---@code{long long int}.
36 * Complex:: Data types for complex numbers. 36 * Complex:: Data types for complex numbers.
37 * Floating Types:: Additional Floating Types. 37 * Floating Types:: Additional Floating Types.
38 * Half-Precision:: Half-Precision Floating Point.
38 * Decimal Float:: Decimal Floating Types. 39 * Decimal Float:: Decimal Floating Types.
39 * Hex Floats:: Hexadecimal floating-point constants. 40 * Hex Floats:: Hexadecimal floating-point constants.
40 * Fixed-Point:: Fixed-Point Types. 41 * Fixed-Point:: Fixed-Point Types.
42 * Named Address Spaces::Named address spaces.
41 * Zero Length:: Zero-length arrays. 43 * Zero Length:: Zero-length arrays.
42 * Variable Length:: Arrays whose length is computed at run time. 44 * Variable Length:: Arrays whose length is computed at run time.
43 * Empty Structures:: Structures with no members. 45 * Empty Structures:: Structures with no members.
44 * Variadic Macros:: Macros with a variable number of arguments. 46 * Variadic Macros:: Macros with a variable number of arguments.
45 * Escaped Newlines:: Slightly looser rules for escaped newlines. 47 * Escaped Newlines:: Slightly looser rules for escaped newlines.
369 @noindent 371 @noindent
370 This is more friendly to code living in shared libraries, as it reduces 372 This is more friendly to code living in shared libraries, as it reduces
371 the number of dynamic relocations that are needed, and by consequence, 373 the number of dynamic relocations that are needed, and by consequence,
372 allows the data to be read-only. 374 allows the data to be read-only.
373 375
374 The @code{&&foo} expressions for the same label might have different values 376 The @code{&&foo} expressions for the same label might have different
375 if the containing function is inlined or cloned. If a program relies on 377 values if the containing function is inlined or cloned. If a program
376 them being always the same, @code{__attribute__((__noinline__))} should 378 relies on them being always the same,
377 be used to prevent inlining. If @code{&&foo} is used 379 @code{__attribute__((__noinline__,__noclone__))} should be used to
378 in a static variable initializer, inlining is forbidden. 380 prevent inlining and cloning. If @code{&&foo} is used in a static
381 variable initializer, inlining and cloning is forbidden.
379 382
380 @node Nested Functions 383 @node Nested Functions
381 @section Nested Functions 384 @section Nested Functions
382 @cindex nested functions 385 @cindex nested functions
383 @cindex downward funargs 386 @cindex downward funargs
448 but it's not wise to take the risk. If, however, the nested function 451 but it's not wise to take the risk. If, however, the nested function
449 does not refer to anything that has gone out of scope, you should be 452 does not refer to anything that has gone out of scope, you should be
450 safe. 453 safe.
451 454
452 GCC implements taking the address of a nested function using a technique 455 GCC implements taking the address of a nested function using a technique
453 called @dfn{trampolines}. A paper describing them is available as 456 called @dfn{trampolines}. This technique was described in
454 457 @cite{Lexical Closures for C++} (Thomas M. Breuel, USENIX
455 @noindent 458 C++ Conference Proceedings, October 17-21, 1988).
456 @uref{http://people.debian.org/~aaronl/Usenix88-lexic.pdf}.
457 459
458 A nested function can jump to a label inherited from a containing 460 A nested function can jump to a label inherited from a containing
459 function, provided the label was explicitly declared in the containing 461 function, provided the label was explicitly declared in the containing
460 function (@pxref{Local Labels}). Such a jump returns instantly to the 462 function (@pxref{Local Labels}). Such a jump returns instantly to the
461 containing function, exiting the nested function which did the 463 containing function, exiting the nested function which did the
661 663
662 A @code{typeof}-construct can be used anywhere a typedef name could be 664 A @code{typeof}-construct can be used anywhere a typedef name could be
663 used. For example, you can use it in a declaration, in a cast, or inside 665 used. For example, you can use it in a declaration, in a cast, or inside
664 of @code{sizeof} or @code{typeof}. 666 of @code{sizeof} or @code{typeof}.
665 667
668 The operand of @code{typeof} is evaluated for its side effects if and
669 only if it is an expression of variably modified type or the name of
670 such a type.
671
666 @code{typeof} is often useful in conjunction with the 672 @code{typeof} is often useful in conjunction with the
667 statements-within-expressions feature. Here is how the two together can 673 statements-within-expressions feature. Here is how the two together can
668 be used to define a safe ``maximum'' macro that operates on any 674 be used to define a safe ``maximum'' macro that operates on any
669 arithmetic type and evaluates each of its arguments exactly once: 675 arithmetic type and evaluates each of its arguments exactly once:
670 676
913 typedef _Complex float __attribute__((mode(XC))) _Complex80; 919 typedef _Complex float __attribute__((mode(XC))) _Complex80;
914 @end smallexample 920 @end smallexample
915 921
916 Not all targets support additional floating point types. @code{__float80} 922 Not all targets support additional floating point types. @code{__float80}
917 and @code{__float128} types are supported on i386, x86_64 and ia64 targets. 923 and @code{__float128} types are supported on i386, x86_64 and ia64 targets.
924
925 @node Half-Precision
926 @section Half-Precision Floating Point
927 @cindex half-precision floating point
928 @cindex @code{__fp16} data type
929
930 On ARM targets, GCC supports half-precision (16-bit) floating point via
931 the @code{__fp16} type. You must enable this type explicitly
932 with the @option{-mfp16-format} command-line option in order to use it.
933
934 ARM supports two incompatible representations for half-precision
935 floating-point values. You must choose one of the representations and
936 use it consistently in your program.
937
938 Specifying @option{-mfp16-format=ieee} selects the IEEE 754-2008 format.
939 This format can represent normalized values in the range of @math{2^{-14}} to 65504.
940 There are 11 bits of significand precision, approximately 3
941 decimal digits.
942
943 Specifying @option{-mfp16-format=alternative} selects the ARM
944 alternative format. This representation is similar to the IEEE
945 format, but does not support infinities or NaNs. Instead, the range
946 of exponents is extended, so that this format can represent normalized
947 values in the range of @math{2^{-14}} to 131008.
948
949 The @code{__fp16} type is a storage format only. For purposes
950 of arithmetic and other operations, @code{__fp16} values in C or C++
951 expressions are automatically promoted to @code{float}. In addition,
952 you cannot declare a function with a return value or parameters
953 of type @code{__fp16}.
954
955 Note that conversions from @code{double} to @code{__fp16}
956 involve an intermediate conversion to @code{float}. Because
957 of rounding, this can sometimes produce a different result than a
958 direct conversion.
959
960 ARM provides hardware support for conversions between
961 @code{__fp16} and @code{float} values
962 as an extension to VFP and NEON (Advanced SIMD). GCC generates
963 code using these hardware instructions if you compile with
964 options to select an FPU that provides them;
965 for example, @option{-mfpu=neon-fp16 -mfloat-abi=softfp},
966 in addition to the @option{-mfp16-format} option to select
967 a half-precision format.
968
969 Language-level support for the @code{__fp16} data type is
970 independent of whether GCC generates code using hardware floating-point
971 instructions. In cases where hardware support is not specified, GCC
972 implements conversions between @code{__fp16} and @code{float} values
973 as library calls.
918 974
919 @node Decimal Float 975 @node Decimal Float
920 @section Decimal Floating Types 976 @section Decimal Floating Types
921 @cindex decimal floating types 977 @cindex decimal floating types
922 @cindex @code{_Decimal32} data type 978 @cindex @code{_Decimal32} data type
950 1006
951 GCC support of decimal float as specified by the draft technical report 1007 GCC support of decimal float as specified by the draft technical report
952 is incomplete: 1008 is incomplete:
953 1009
954 @itemize @bullet 1010 @itemize @bullet
955 @item
956 Pragma @code{FLOAT_CONST_DECIMAL64} is not supported, nor is the @samp{d}
957 suffix for literal constants of type @code{double}.
958
959 @item 1011 @item
960 When the value of a decimal floating type cannot be represented in the 1012 When the value of a decimal floating type cannot be represented in the
961 integer type to which it is being converted, the result is undefined 1013 integer type to which it is being converted, the result is undefined
962 rather than the result value specified by the draft technical report. 1014 rather than the result value specified by the draft technical report.
963 1015
1145 Pragmas to control overflow and rounding behaviors are not implemented. 1197 Pragmas to control overflow and rounding behaviors are not implemented.
1146 @end itemize 1198 @end itemize
1147 1199
1148 Fixed-point types are supported by the DWARF2 debug information format. 1200 Fixed-point types are supported by the DWARF2 debug information format.
1149 1201
1202 @node Named Address Spaces
1203 @section Named address spaces
1204 @cindex named address spaces
1205
1206 As an extension, the GNU C compiler supports named address spaces as
1207 defined in the N1275 draft of ISO/IEC DTR 18037. Support for named
1208 address spaces in GCC will evolve as the draft technical report changes.
1209 Calling conventions for any target might also change. At present, only
1210 the SPU target supports other address spaces. On the SPU target, for
1211 example, variables may be declared as belonging to another address space
1212 by qualifying the type with the @code{__ea} address space identifier:
1213
1214 @smallexample
1215 extern int __ea i;
1216 @end smallexample
1217
1218 When the variable @code{i} is accessed, the compiler will generate
1219 special code to access this variable. It may use runtime library
1220 support, or generate special machine instructions to access that address
1221 space.
1222
1223 The @code{__ea} identifier may be used exactly like any other C type
1224 qualifier (e.g., @code{const} or @code{volatile}). See the N1275
1225 document for more details.
1226
1150 @node Zero Length 1227 @node Zero Length
1151 @section Arrays of Length Zero 1228 @section Arrays of Length Zero
1152 @cindex arrays of length zero 1229 @cindex arrays of length zero
1153 @cindex zero-length arrays 1230 @cindex zero-length arrays
1154 @cindex length-zero arrays 1231 @cindex length-zero arrays
1830 The keyword @code{__attribute__} allows you to specify special 1907 The keyword @code{__attribute__} allows you to specify special
1831 attributes when making a declaration. This keyword is followed by an 1908 attributes when making a declaration. This keyword is followed by an
1832 attribute specification inside double parentheses. The following 1909 attribute specification inside double parentheses. The following
1833 attributes are currently defined for functions on all targets: 1910 attributes are currently defined for functions on all targets:
1834 @code{aligned}, @code{alloc_size}, @code{noreturn}, 1911 @code{aligned}, @code{alloc_size}, @code{noreturn},
1835 @code{returns_twice}, @code{noinline}, @code{always_inline}, 1912 @code{returns_twice}, @code{noinline}, @code{noclone},
1836 @code{flatten}, @code{pure}, @code{const}, @code{nothrow}, 1913 @code{always_inline}, @code{flatten}, @code{pure}, @code{const},
1837 @code{sentinel}, @code{format}, @code{format_arg}, 1914 @code{nothrow}, @code{sentinel}, @code{format}, @code{format_arg},
1838 @code{no_instrument_function}, @code{section}, @code{constructor}, 1915 @code{no_instrument_function}, @code{section}, @code{constructor},
1839 @code{destructor}, @code{used}, @code{unused}, @code{deprecated}, 1916 @code{destructor}, @code{used}, @code{unused}, @code{deprecated},
1840 @code{weak}, @code{malloc}, @code{alias}, @code{warn_unused_result}, 1917 @code{weak}, @code{malloc}, @code{alias}, @code{warn_unused_result},
1841 @code{nonnull}, @code{gnu_inline}, @code{externally_visible}, 1918 @code{nonnull}, @code{gnu_inline}, @code{externally_visible},
1842 @code{hot}, @code{cold}, @code{artificial}, @code{error} 1919 @code{hot}, @code{cold}, @code{artificial}, @code{error} and
1843 and @code{warning}. 1920 @code{warning}. Several other attributes are defined for functions on
1844 Several other attributes are defined for functions on particular 1921 particular target systems. Other attributes, including @code{section}
1845 target systems. Other attributes, including @code{section} are 1922 are supported for variables declarations (@pxref{Variable Attributes})
1846 supported for variables declarations (@pxref{Variable Attributes}) and 1923 and for types (@pxref{Type Attributes}).
1847 for types (@pxref{Type Attributes}). 1924
1925 GCC plugins may provide their own attributes.
1848 1926
1849 You may also specify attributes with @samp{__} preceding and following 1927 You may also specify attributes with @samp{__} preceding and following
1850 each keyword. This allows you to use them in header files without 1928 each keyword. This allows you to use them in header files without
1851 being concerned about a possible macro of the same name. For example, 1929 being concerned about a possible macro of the same name. For example,
1852 you may use @code{__noreturn__} instead of @code{noreturn}. 1930 you may use @code{__noreturn__} instead of @code{noreturn}.
1968 should appear during debugging as a unit, depending on the debug 2046 should appear during debugging as a unit, depending on the debug
1969 info format it will either mean marking the function as artificial 2047 info format it will either mean marking the function as artificial
1970 or using the caller location for all instructions within the inlined 2048 or using the caller location for all instructions within the inlined
1971 body. 2049 body.
1972 2050
2051 @item bank_switch
2052 @cindex interrupt handler functions
2053 When added to an interrupt handler with the M32C port, causes the
2054 prologue and epilogue to use bank switching to preserve the registers
2055 rather than saving them on the stack.
2056
1973 @item flatten 2057 @item flatten
1974 @cindex @code{flatten} function attribute 2058 @cindex @code{flatten} function attribute
1975 Generally, inlining into a function is limited. For a function marked with 2059 Generally, inlining into a function is limited. For a function marked with
1976 this attribute, every call inside this function will be inlined, if possible. 2060 this attribute, every call inside this function will be inlined, if possible.
1977 Whether the function itself is considered for inlining depends on its size and 2061 Whether the function itself is considered for inlining depends on its size and
2062 objects (@pxref{C++ Attributes}). 2146 objects (@pxref{C++ Attributes}).
2063 2147
2064 These attributes are not currently implemented for Objective-C@. 2148 These attributes are not currently implemented for Objective-C@.
2065 2149
2066 @item deprecated 2150 @item deprecated
2151 @itemx deprecated (@var{msg})
2067 @cindex @code{deprecated} attribute. 2152 @cindex @code{deprecated} attribute.
2068 The @code{deprecated} attribute results in a warning if the function 2153 The @code{deprecated} attribute results in a warning if the function
2069 is used anywhere in the source file. This is useful when identifying 2154 is used anywhere in the source file. This is useful when identifying
2070 functions that are expected to be removed in a future version of a 2155 functions that are expected to be removed in a future version of a
2071 program. The warning also includes the location of the declaration 2156 program. The warning also includes the location of the declaration
2077 int old_fn () __attribute__ ((deprecated)); 2162 int old_fn () __attribute__ ((deprecated));
2078 int old_fn (); 2163 int old_fn ();
2079 int (*fn_ptr)() = old_fn; 2164 int (*fn_ptr)() = old_fn;
2080 @end smallexample 2165 @end smallexample
2081 2166
2082 results in a warning on line 3 but not line 2. 2167 results in a warning on line 3 but not line 2. The optional msg
2168 argument, which must be a string, will be printed in the warning if
2169 present.
2083 2170
2084 The @code{deprecated} attribute can also be used for variables and 2171 The @code{deprecated} attribute can also be used for variables and
2085 types (@pxref{Variable Attributes}, @pxref{Type Attributes}.) 2172 types (@pxref{Variable Attributes}, @pxref{Type Attributes}.)
2173
2174 @item disinterrupt
2175 @cindex @code{disinterrupt} attribute
2176 On MeP targets, this attribute causes the compiler to emit
2177 instructions to disable interrupts for the duration of the given
2178 function.
2086 2179
2087 @item dllexport 2180 @item dllexport
2088 @cindex @code{__declspec(dllexport)} 2181 @cindex @code{__declspec(dllexport)}
2089 On Microsoft Windows targets and Symbian OS targets the 2182 On Microsoft Windows targets and Symbian OS targets the
2090 @code{dllexport} attribute causes the compiler to provide a global 2183 @code{dllexport} attribute causes the compiler to provide a global
2146 2239
2147 On the SH Symbian OS target the @code{dllimport} attribute also has 2240 On the SH Symbian OS target the @code{dllimport} attribute also has
2148 another affect---it can cause the vtable and run-time type information 2241 another affect---it can cause the vtable and run-time type information
2149 for a class to be exported. This happens when the class has a 2242 for a class to be exported. This happens when the class has a
2150 dllimport'ed constructor or a non-inline, non-pure virtual function 2243 dllimport'ed constructor or a non-inline, non-pure virtual function
2151 and, for either of those two conditions, the class also has a inline 2244 and, for either of those two conditions, the class also has an inline
2152 constructor or destructor and has a key function that is defined in 2245 constructor or destructor and has a key function that is defined in
2153 the current translation unit. 2246 the current translation unit.
2154 2247
2155 For Microsoft Windows based targets the use of the @code{dllimport} 2248 For Microsoft Windows based targets the use of the @code{dllimport}
2156 attribute on functions is not necessary, but provides a small 2249 attribute on functions is not necessary, but provides a small
2207 to invoke a board-specific routine to switch the memory bank and call the 2300 to invoke a board-specific routine to switch the memory bank and call the
2208 real function. The board-specific routine simulates a @code{call}. 2301 real function. The board-specific routine simulates a @code{call}.
2209 At the end of a function, it will jump to a board-specific routine 2302 At the end of a function, it will jump to a board-specific routine
2210 instead of using @code{rts}. The board-specific return routine simulates 2303 instead of using @code{rts}. The board-specific return routine simulates
2211 the @code{rtc}. 2304 the @code{rtc}.
2305
2306 On MeP targets this causes the compiler to use a calling convention
2307 which assumes the called function is too far away for the built-in
2308 addressing modes.
2309
2310 @item fast_interrupt
2311 @cindex interrupt handler functions
2312 Use this attribute on the M32C and RX ports to indicate that the specified
2313 function is a fast interrupt handler. This is just like the
2314 @code{interrupt} attribute, except that @code{freit} is used to return
2315 instead of @code{reit}.
2212 2316
2213 @item fastcall 2317 @item fastcall
2214 @cindex functions that pop the argument stack on the 386 2318 @cindex functions that pop the argument stack on the 386
2215 On the Intel 386, the @code{fastcall} attribute causes the compiler to 2319 On the Intel 386, the @code{fastcall} attribute causes the compiler to
2216 pass the first argument (if of integral type) in the register ECX and 2320 pass the first argument (if of integral type) in the register ECX and
2395 2499
2396 This attribute is ignored for R8C target. 2500 This attribute is ignored for R8C target.
2397 2501
2398 @item interrupt 2502 @item interrupt
2399 @cindex interrupt handler functions 2503 @cindex interrupt handler functions
2400 Use this attribute on the ARM, AVR, CRX, M32C, M32R/D, m68k, 2504 Use this attribute on the ARM, AVR, CRX, M32C, M32R/D, m68k, MeP, MIPS,
2401 and Xstormy16 ports to indicate that the specified function is an 2505 RX and Xstormy16 ports to indicate that the specified function is an
2402 interrupt handler. The compiler will generate function entry and exit 2506 interrupt handler. The compiler will generate function entry and exit
2403 sequences suitable for use in an interrupt handler when this attribute 2507 sequences suitable for use in an interrupt handler when this attribute
2404 is present. 2508 is present.
2405 2509
2406 Note, interrupt handlers for the Blackfin, H8/300, H8/300H, H8S, and 2510 Note, interrupt handlers for the Blackfin, H8/300, H8/300H, H8S, and
2417 2521
2418 Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF@. 2522 Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF@.
2419 2523
2420 On ARMv7-M the interrupt type is ignored, and the attribute means the function 2524 On ARMv7-M the interrupt type is ignored, and the attribute means the function
2421 may be called with a word aligned stack pointer. 2525 may be called with a word aligned stack pointer.
2526
2527 On MIPS targets, you can use the following attributes to modify the behavior
2528 of an interrupt handler:
2529 @table @code
2530 @item use_shadow_register_set
2531 @cindex @code{use_shadow_register_set} attribute
2532 Assume that the handler uses a shadow register set, instead of
2533 the main general-purpose registers.
2534
2535 @item keep_interrupts_masked
2536 @cindex @code{keep_interrupts_masked} attribute
2537 Keep interrupts masked for the whole function. Without this attribute,
2538 GCC tries to reenable interrupts for as much of the function as it can.
2539
2540 @item use_debug_exception_return
2541 @cindex @code{use_debug_exception_return} attribute
2542 Return using the @code{deret} instruction. Interrupt handlers that don't
2543 have this attribute return using @code{eret} instead.
2544 @end table
2545
2546 You can use any combination of these attributes, as shown below:
2547 @smallexample
2548 void __attribute__ ((interrupt)) v0 ();
2549 void __attribute__ ((interrupt, use_shadow_register_set)) v1 ();
2550 void __attribute__ ((interrupt, keep_interrupts_masked)) v2 ();
2551 void __attribute__ ((interrupt, use_debug_exception_return)) v3 ();
2552 void __attribute__ ((interrupt, use_shadow_register_set,
2553 keep_interrupts_masked)) v4 ();
2554 void __attribute__ ((interrupt, use_shadow_register_set,
2555 use_debug_exception_return)) v5 ();
2556 void __attribute__ ((interrupt, keep_interrupts_masked,
2557 use_debug_exception_return)) v6 ();
2558 void __attribute__ ((interrupt, use_shadow_register_set,
2559 keep_interrupts_masked,
2560 use_debug_exception_return)) v7 ();
2561 @end smallexample
2422 2562
2423 @item interrupt_handler 2563 @item interrupt_handler
2424 @cindex interrupt handler functions on the Blackfin, m68k, H8/300 and SH processors 2564 @cindex interrupt handler functions on the Blackfin, m68k, H8/300 and SH processors
2425 Use this attribute on the Blackfin, m68k, H8/300, H8/300H, H8S, and SH to 2565 Use this attribute on the Blackfin, m68k, H8/300, H8/300H, H8S, and SH to
2426 indicate that the specified function is an interrupt handler. The compiler 2566 indicate that the specified function is an interrupt handler. The compiler
2450 @cindex @code{l1_text} function attribute 2590 @cindex @code{l1_text} function attribute
2451 This attribute specifies a function to be placed into L1 Instruction 2591 This attribute specifies a function to be placed into L1 Instruction
2452 SRAM@. The function will be put into a specific section named @code{.l1.text}. 2592 SRAM@. The function will be put into a specific section named @code{.l1.text}.
2453 With @option{-mfdpic}, function calls with a such function as the callee 2593 With @option{-mfdpic}, function calls with a such function as the callee
2454 or caller will use inlined PLT. 2594 or caller will use inlined PLT.
2595
2596 @item l2
2597 @cindex @code{l2} function attribute
2598 On the Blackfin, this attribute specifies a function to be placed into L2
2599 SRAM. The function will be put into a specific section named
2600 @code{.l1.text}. With @option{-mfdpic}, callers of such functions will use
2601 an inlined PLT.
2455 2602
2456 @item long_call/short_call 2603 @item long_call/short_call
2457 @cindex indirect calls on ARM 2604 @cindex indirect calls on ARM
2458 This attribute specifies how a particular function is called on 2605 This attribute specifies how a particular function is called on
2459 ARM@. Both attributes override the @option{-mlong-calls} (@pxref{ARM Options}) 2606 ARM@. Both attributes override the @option{-mlong-calls} (@pxref{ARM Options})
2559 GNU/Linux and other systems. The default is to use the Microsoft ABI 2706 GNU/Linux and other systems. The default is to use the Microsoft ABI
2560 when targeting Windows. On all other systems, the default is the AMD ABI. 2707 when targeting Windows. On all other systems, the default is the AMD ABI.
2561 2708
2562 Note, This feature is currently sorried out for Windows targets trying to 2709 Note, This feature is currently sorried out for Windows targets trying to
2563 2710
2711 @item ms_hook_prologue
2712 @cindex @code{ms_hook_prologue} attribute
2713
2714 On 32 bit i[34567]86-*-* targets, you can use this function attribute to make
2715 gcc generate the "hot-patching" function prologue used in Win32 API
2716 functions in Microsoft Windows XP Service Pack 2 and newer. This requires
2717 support for the swap suffix in the assembler. (GNU Binutils 2.19.51 or later)
2718
2564 @item naked 2719 @item naked
2565 @cindex function without a prologue/epilogue code 2720 @cindex function without a prologue/epilogue code
2566 Use this attribute on the ARM, AVR, IP2K and SPU ports to indicate that 2721 Use this attribute on the ARM, AVR, IP2K, RX and SPU ports to indicate that
2567 the specified function does not need prologue/epilogue sequences generated by 2722 the specified function does not need prologue/epilogue sequences generated by
2568 the compiler. It is up to the programmer to provide these sequences. The 2723 the compiler. It is up to the programmer to provide these sequences. The
2569 only statements that can be safely included in naked functions are 2724 only statements that can be safely included in naked functions are
2570 @code{asm} statements that do not have operands. All other statements, 2725 @code{asm} statements that do not have operands. All other statements,
2571 including declarations of local variables, @code{if} statements, and so 2726 including declarations of local variables, @code{if} statements, and so
2577 @cindex functions which do not handle memory bank switching on 68HC11/68HC12 2732 @cindex functions which do not handle memory bank switching on 68HC11/68HC12
2578 On 68HC11 and 68HC12 the @code{near} attribute causes the compiler to 2733 On 68HC11 and 68HC12 the @code{near} attribute causes the compiler to
2579 use the normal calling convention based on @code{jsr} and @code{rts}. 2734 use the normal calling convention based on @code{jsr} and @code{rts}.
2580 This attribute can be used to cancel the effect of the @option{-mlong-calls} 2735 This attribute can be used to cancel the effect of the @option{-mlong-calls}
2581 option. 2736 option.
2737
2738 On MeP targets this attribute causes the compiler to assume the called
2739 function is close enough to use the normal calling convention,
2740 overriding the @code{-mtf} command line option.
2582 2741
2583 @item nesting 2742 @item nesting
2584 @cindex Allow nesting in an interrupt handler on the Blackfin processor. 2743 @cindex Allow nesting in an interrupt handler on the Blackfin processor.
2585 Use this attribute together with @code{interrupt_handler}, 2744 Use this attribute together with @code{interrupt_handler},
2586 @code{exception_handler} or @code{nmi_handler} to indicate that the function 2745 @code{exception_handler} or @code{nmi_handler} to indicate that the function
2613 @smallexample 2772 @smallexample
2614 asm (""); 2773 asm ("");
2615 @end smallexample 2774 @end smallexample
2616 (@pxref{Extended Asm}) in the called function, to serve as a special 2775 (@pxref{Extended Asm}) in the called function, to serve as a special
2617 side-effect. 2776 side-effect.
2777
2778 @item noclone
2779 @cindex @code{noclone} function attribute
2780 This function attribute prevents a function from being considered for
2781 cloning - a mechanism which produces specialized copies of functions
2782 and which is (currently) performed by interprocedural constant
2783 propagation.
2618 2784
2619 @item nonnull (@var{arg-index}, @dots{}) 2785 @item nonnull (@var{arg-index}, @dots{})
2620 @cindex @code{nonnull} function attribute 2786 @cindex @code{nonnull} function attribute
2621 The @code{nonnull} attribute specifies that some function parameters should 2787 The @code{nonnull} attribute specifies that some function parameters should
2622 be non-null pointers. For instance, the declaration: 2788 be non-null pointers. For instance, the declaration:
2719 This can be used for instance to have frequently executed functions 2885 This can be used for instance to have frequently executed functions
2720 compiled with more aggressive optimization options that produce faster 2886 compiled with more aggressive optimization options that produce faster
2721 and larger code, while other functions can be called with less 2887 and larger code, while other functions can be called with less
2722 aggressive options. 2888 aggressive options.
2723 2889
2890 @item pcs
2891 @cindex @code{pcs} function attribute
2892
2893 The @code{pcs} attribute can be used to control the calling convention
2894 used for a function on ARM. The attribute takes an argument that specifies
2895 the calling convention to use.
2896
2897 When compiling using the AAPCS ABI (or a variant of that) then valid
2898 values for the argument are @code{"aapcs"} and @code{"aapcs-vfp"}. In
2899 order to use a variant other than @code{"aapcs"} then the compiler must
2900 be permitted to use the appropriate co-processor registers (i.e., the
2901 VFP registers must be available in order to use @code{"aapcs-vfp"}).
2902 For example,
2903
2904 @smallexample
2905 /* Argument passed in r0, and result returned in r0+r1. */
2906 double f2d (float) __attribute__((pcs("aapcs")));
2907 @end smallexample
2908
2909 Variadic functions always use the @code{"aapcs"} calling convention and
2910 the compiler will reject attempts to specify an alternative.
2911
2724 @item pure 2912 @item pure
2725 @cindex @code{pure} function attribute 2913 @cindex @code{pure} function attribute
2726 Many functions have no effects except the return value and their 2914 Many functions have no effects except the return value and their
2727 return value depends only on the parameters and/or global variables. 2915 return value depends only on the parameters and/or global variables.
2728 Such a function can be subject 2916 Such a function can be subject
3015 @item sse4a 3203 @item sse4a
3016 @itemx no-sse4a 3204 @itemx no-sse4a
3017 @cindex @code{target("sse4a")} attribute 3205 @cindex @code{target("sse4a")} attribute
3018 Enable/disable the generation of the SSE4A instructions. 3206 Enable/disable the generation of the SSE4A instructions.
3019 3207
3020 @item sse5 3208 @item fma4
3021 @itemx no-sse5 3209 @itemx no-fma4
3022 @cindex @code{target("sse5")} attribute 3210 @cindex @code{target("fma4")} attribute
3023 Enable/disable the generation of the SSE5 instructions. 3211 Enable/disable the generation of the FMA4 instructions.
3212
3213 @item xop
3214 @itemx no-xop
3215 @cindex @code{target("xop")} attribute
3216 Enable/disable the generation of the XOP instructions.
3217
3218 @item lwp
3219 @itemx no-lwp
3220 @cindex @code{target("lwp")} attribute
3221 Enable/disable the generation of the LWP instructions.
3024 3222
3025 @item ssse3 3223 @item ssse3
3026 @itemx no-ssse3 3224 @itemx no-ssse3
3027 @cindex @code{target("ssse3")} attribute 3225 @cindex @code{target("ssse3")} attribute
3028 Enable/disable the generation of the SSSE3 instructions. 3226 Enable/disable the generation of the SSSE3 instructions.
3091 options, or you can separate the option with a comma (@code{,}). 3289 options, or you can separate the option with a comma (@code{,}).
3092 3290
3093 On the 386, the inliner will not inline a function that has different 3291 On the 386, the inliner will not inline a function that has different
3094 target options than the caller, unless the callee has a subset of the 3292 target options than the caller, unless the callee has a subset of the
3095 target options of the caller. For example a function declared with 3293 target options of the caller. For example a function declared with
3096 @code{target("sse5")} can inline a function with 3294 @code{target("sse3")} can inline a function with
3097 @code{target("sse2")}, since @code{-msse5} implies @code{-msse2}. 3295 @code{target("sse2")}, since @code{-msse3} implies @code{-msse2}.
3098 3296
3099 The @code{target} attribute is not implemented in GCC versions earlier 3297 The @code{target} attribute is not implemented in GCC versions earlier
3100 than 4.4, and at present only the 386 uses it. 3298 than 4.4, and at present only the 386 uses it.
3101 3299
3102 @item tiny_data 3300 @item tiny_data
3232 visibility of their template. 3430 visibility of their template.
3233 3431
3234 If both the template and enclosing class have explicit visibility, the 3432 If both the template and enclosing class have explicit visibility, the
3235 visibility from the template is used. 3433 visibility from the template is used.
3236 3434
3435 @item vliw
3436 @cindex @code{vliw} attribute
3437 On MeP, the @code{vliw} attribute tells the compiler to emit
3438 instructions in VLIW mode instead of core mode. Note that this
3439 attribute is not allowed unless a VLIW coprocessor has been configured
3440 and enabled through command line options.
3441
3237 @item warn_unused_result 3442 @item warn_unused_result
3238 @cindex @code{warn_unused_result} attribute 3443 @cindex @code{warn_unused_result} attribute
3239 The @code{warn_unused_result} attribute causes a warning to be emitted 3444 The @code{warn_unused_result} attribute causes a warning to be emitted
3240 if a caller of the function with this attribute does not use its 3445 if a caller of the function with this attribute does not use its
3241 return value. This is useful for functions where not checking 3446 return value. This is useful for functions where not checking
3398 attribute it makes sense to use after a label is @code{unused}. This 3603 attribute it makes sense to use after a label is @code{unused}. This
3399 feature is intended for code generated by programs which contains labels 3604 feature is intended for code generated by programs which contains labels
3400 that may be unused but which is compiled with @option{-Wall}. It would 3605 that may be unused but which is compiled with @option{-Wall}. It would
3401 not normally be appropriate to use in it human-written code, though it 3606 not normally be appropriate to use in it human-written code, though it
3402 could be useful in cases where the code that jumps to the label is 3607 could be useful in cases where the code that jumps to the label is
3403 contained within an @code{#ifdef} conditional. GNU C++ does not permit 3608 contained within an @code{#ifdef} conditional. GNU C++ only permits
3404 such placement of attribute lists, as it is permissible for a 3609 attributes on labels if the attribute specifier is immediately
3405 declaration, which could begin with an attribute list, to be labelled in 3610 followed by a semicolon (i.e., the label applies to an empty
3406 C++. Declarations cannot be labelled in C90 or C99, so the ambiguity 3611 statement). If the semicolon is missing, C++ label attributes are
3407 does not arise there. 3612 ambiguous, as it is permissible for a declaration, which could begin
3613 with an attribute list, to be labelled in C++. Declarations cannot be
3614 labelled in C90 or C99, so the ambiguity does not arise there.
3408 3615
3409 An attribute specifier list may appear as part of a @code{struct}, 3616 An attribute specifier list may appear as part of a @code{struct},
3410 @code{union} or @code{enum} specifier. It may go either immediately 3617 @code{union} or @code{enum} specifier. It may go either immediately
3411 after the @code{struct}, @code{union} or @code{enum} keyword, or after 3618 after the @code{struct}, @code{union} or @code{enum} keyword, or after
3412 the closing brace. The former syntax is preferred. 3619 the closing brace. The former syntax is preferred.
3806 4013
3807 These attributes override the default chosen by the 4014 These attributes override the default chosen by the
3808 @option{-fno-common} and @option{-fcommon} flags respectively. 4015 @option{-fno-common} and @option{-fcommon} flags respectively.
3809 4016
3810 @item deprecated 4017 @item deprecated
4018 @itemx deprecated (@var{msg})
3811 @cindex @code{deprecated} attribute 4019 @cindex @code{deprecated} attribute
3812 The @code{deprecated} attribute results in a warning if the variable 4020 The @code{deprecated} attribute results in a warning if the variable
3813 is used anywhere in the source file. This is useful when identifying 4021 is used anywhere in the source file. This is useful when identifying
3814 variables that are expected to be removed in a future version of a 4022 variables that are expected to be removed in a future version of a
3815 program. The warning also includes the location of the declaration 4023 program. The warning also includes the location of the declaration
3821 extern int old_var __attribute__ ((deprecated)); 4029 extern int old_var __attribute__ ((deprecated));
3822 extern int old_var; 4030 extern int old_var;
3823 int new_fn () @{ return old_var; @} 4031 int new_fn () @{ return old_var; @}
3824 @end smallexample 4032 @end smallexample
3825 4033
3826 results in a warning on line 3 but not line 2. 4034 results in a warning on line 3 but not line 2. The optional msg
4035 argument, which must be a string, will be printed in the warning if
4036 present.
3827 4037
3828 The @code{deprecated} attribute can also be used for functions and 4038 The @code{deprecated} attribute can also be used for functions and
3829 types (@pxref{Function Attributes}, @pxref{Type Attributes}.) 4039 types (@pxref{Function Attributes}, @pxref{Type Attributes}.)
3830 4040
3831 @item mode (@var{mode}) 4041 @item mode (@var{mode})
4023 4233
4024 Three attributes are currently defined for the Blackfin. 4234 Three attributes are currently defined for the Blackfin.
4025 4235
4026 @table @code 4236 @table @code
4027 @item l1_data 4237 @item l1_data
4028 @item l1_data_A 4238 @itemx l1_data_A
4029 @item l1_data_B 4239 @itemx l1_data_B
4030 @cindex @code{l1_data} variable attribute 4240 @cindex @code{l1_data} variable attribute
4031 @cindex @code{l1_data_A} variable attribute 4241 @cindex @code{l1_data_A} variable attribute
4032 @cindex @code{l1_data_B} variable attribute 4242 @cindex @code{l1_data_B} variable attribute
4033 Use these attributes on the Blackfin to place the variable into L1 Data SRAM. 4243 Use these attributes on the Blackfin to place the variable into L1 Data SRAM.
4034 Variables with @code{l1_data} attribute will be put into the specific section 4244 Variables with @code{l1_data} attribute will be put into the specific section
4035 named @code{.l1.data}. Those with @code{l1_data_A} attribute will be put into 4245 named @code{.l1.data}. Those with @code{l1_data_A} attribute will be put into
4036 the specific section named @code{.l1.data.A}. Those with @code{l1_data_B} 4246 the specific section named @code{.l1.data.A}. Those with @code{l1_data_B}
4037 attribute will be put into the specific section named @code{.l1.data.B}. 4247 attribute will be put into the specific section named @code{.l1.data.B}.
4248
4249 @item l2
4250 @cindex @code{l2} variable attribute
4251 Use this attribute on the Blackfin to place the variable into L2 SRAM.
4252 Variables with @code{l2} attribute will be put into the specific section
4253 named @code{.l2.data}.
4038 @end table 4254 @end table
4039 4255
4040 @subsection M32R/D Variable Attributes 4256 @subsection M32R/D Variable Attributes
4041 4257
4042 One attribute is currently defined for the M32R/D@. 4258 One attribute is currently defined for the M32R/D@.
4052 addresses can be loaded with the @code{ld24} instruction). 4268 addresses can be loaded with the @code{ld24} instruction).
4053 4269
4054 Medium and large model objects may live anywhere in the 32-bit address space 4270 Medium and large model objects may live anywhere in the 32-bit address space
4055 (the compiler will generate @code{seth/add3} instructions to load their 4271 (the compiler will generate @code{seth/add3} instructions to load their
4056 addresses). 4272 addresses).
4273 @end table
4274
4275 @anchor{MeP Variable Attributes}
4276 @subsection MeP Variable Attributes
4277
4278 The MeP target has a number of addressing modes and busses. The
4279 @code{near} space spans the standard memory space's first 16 megabytes
4280 (24 bits). The @code{far} space spans the entire 32-bit memory space.
4281 The @code{based} space is a 128 byte region in the memory space which
4282 is addressed relative to the @code{$tp} register. The @code{tiny}
4283 space is a 65536 byte region relative to the @code{$gp} register. In
4284 addition to these memory regions, the MeP target has a separate 16-bit
4285 control bus which is specified with @code{cb} attributes.
4286
4287 @table @code
4288
4289 @item based
4290 Any variable with the @code{based} attribute will be assigned to the
4291 @code{.based} section, and will be accessed with relative to the
4292 @code{$tp} register.
4293
4294 @item tiny
4295 Likewise, the @code{tiny} attribute assigned variables to the
4296 @code{.tiny} section, relative to the @code{$gp} register.
4297
4298 @item near
4299 Variables with the @code{near} attribute are assumed to have addresses
4300 that fit in a 24-bit addressing mode. This is the default for large
4301 variables (@code{-mtiny=4} is the default) but this attribute can
4302 override @code{-mtiny=} for small variables, or override @code{-ml}.
4303
4304 @item far
4305 Variables with the @code{far} attribute are addressed using a full
4306 32-bit address. Since this covers the entire memory space, this
4307 allows modules to make no assumptions about where variables might be
4308 stored.
4309
4310 @item io
4311 @itemx io (@var{addr})
4312 Variables with the @code{io} attribute are used to address
4313 memory-mapped peripherals. If an address is specified, the variable
4314 is assigned that address, else it is not assigned an address (it is
4315 assumed some other module will assign an address). Example:
4316
4317 @example
4318 int timer_count __attribute__((io(0x123)));
4319 @end example
4320
4321 @item cb
4322 @itemx cb (@var{addr})
4323 Variables with the @code{cb} attribute are used to access the control
4324 bus, using special instructions. @code{addr} indicates the control bus
4325 address. Example:
4326
4327 @example
4328 int cpu_clock __attribute__((cb(0x123)));
4329 @end example
4330
4057 @end table 4331 @end table
4058 4332
4059 @anchor{i386 Variable Attributes} 4333 @anchor{i386 Variable Attributes}
4060 @subsection i386 Variable Attributes 4334 @subsection i386 Variable Attributes
4061 4335
4379 int i; 4653 int i;
4380 struct my_unpacked_struct s; 4654 struct my_unpacked_struct s;
4381 @}; 4655 @};
4382 @end smallexample 4656 @end smallexample
4383 4657
4384 You may only specify this attribute on the definition of a @code{enum}, 4658 You may only specify this attribute on the definition of an @code{enum},
4385 @code{struct} or @code{union}, not on a @code{typedef} which does not 4659 @code{struct} or @code{union}, not on a @code{typedef} which does not
4386 also define the enumerated type, structure or union. 4660 also define the enumerated type, structure or union.
4387 4661
4388 @item transparent_union 4662 @item transparent_union
4389 This attribute, attached to a @code{union} type definition, indicates 4663 This attribute, attached to a @code{union} type definition, indicates
4451 the case with lock or thread classes, which are usually defined and then 4725 the case with lock or thread classes, which are usually defined and then
4452 not referenced, but contain constructors and destructors that have 4726 not referenced, but contain constructors and destructors that have
4453 nontrivial bookkeeping functions. 4727 nontrivial bookkeeping functions.
4454 4728
4455 @item deprecated 4729 @item deprecated
4730 @itemx deprecated (@var{msg})
4456 The @code{deprecated} attribute results in a warning if the type 4731 The @code{deprecated} attribute results in a warning if the type
4457 is used anywhere in the source file. This is useful when identifying 4732 is used anywhere in the source file. This is useful when identifying
4458 types that are expected to be removed in a future version of a program. 4733 types that are expected to be removed in a future version of a program.
4459 If possible, the warning also includes the location of the declaration 4734 If possible, the warning also includes the location of the declaration
4460 of the deprecated type, to enable users to easily find further 4735 of the deprecated type, to enable users to easily find further
4473 @end smallexample 4748 @end smallexample
4474 4749
4475 results in a warning on line 2 and 3 but not lines 4, 5, or 6. No 4750 results in a warning on line 2 and 3 but not lines 4, 5, or 6. No
4476 warning is issued for line 4 because T2 is not explicitly 4751 warning is issued for line 4 because T2 is not explicitly
4477 deprecated. Line 5 has no warning because T3 is explicitly 4752 deprecated. Line 5 has no warning because T3 is explicitly
4478 deprecated. Similarly for line 6. 4753 deprecated. Similarly for line 6. The optional msg
4754 argument, which must be a string, will be printed in the warning if
4755 present.
4479 4756
4480 The @code{deprecated} attribute can also be used for functions and 4757 The @code{deprecated} attribute can also be used for functions and
4481 variables (@pxref{Function Attributes}, @pxref{Variable Attributes}.) 4758 variables (@pxref{Function Attributes}, @pxref{Variable Attributes}.)
4482 4759
4483 @item may_alias 4760 @item may_alias
4552 4829
4553 In this code, @code{C::C} is exported from the current DLL, but the 4830 In this code, @code{C::C} is exported from the current DLL, but the
4554 virtual table for @code{C} is not exported. (You can use 4831 virtual table for @code{C} is not exported. (You can use
4555 @code{__attribute__} instead of @code{__declspec} if you prefer, but 4832 @code{__attribute__} instead of @code{__declspec} if you prefer, but
4556 most Symbian OS code uses @code{__declspec}.) 4833 most Symbian OS code uses @code{__declspec}.)
4834
4835 @anchor{MeP Type Attributes}
4836 @subsection MeP Type Attributes
4837
4838 Many of the MeP variable attributes may be applied to types as well.
4839 Specifically, the @code{based}, @code{tiny}, @code{near}, and
4840 @code{far} attributes may be applied to either. The @code{io} and
4841 @code{cb} attributes may not be applied to types.
4557 4842
4558 @anchor{i386 Type Attributes} 4843 @anchor{i386 Type Attributes}
4559 @subsection i386 Type Attributes 4844 @subsection i386 Type Attributes
4560 4845
4561 Two attributes are currently defined for i386 configurations: 4846 Two attributes are currently defined for i386 configurations:
5011 and most Unix assemblers do. 5296 and most Unix assemblers do.
5012 5297
5013 Speaking of labels, jumps from one @code{asm} to another are not 5298 Speaking of labels, jumps from one @code{asm} to another are not
5014 supported. The compiler's optimizers do not know about these jumps, and 5299 supported. The compiler's optimizers do not know about these jumps, and
5015 therefore they cannot take account of them when deciding how to 5300 therefore they cannot take account of them when deciding how to
5016 optimize. 5301 optimize. @xref{Extended asm with goto}.
5017 5302
5018 @cindex macros containing @code{asm} 5303 @cindex macros containing @code{asm}
5019 Usually the most convenient way to use these @code{asm} instructions is to 5304 Usually the most convenient way to use these @code{asm} instructions is to
5020 encapsulate them in macros that look like functions. For example, 5305 encapsulate them in macros that look like functions. For example,
5021 5306
5109 ``compare'' instructions because they don't have any output operands. 5394 ``compare'' instructions because they don't have any output operands.
5110 5395
5111 For reasons similar to those described above, it is not possible to give 5396 For reasons similar to those described above, it is not possible to give
5112 an assembler instruction access to the condition code left by previous 5397 an assembler instruction access to the condition code left by previous
5113 instructions. 5398 instructions.
5399
5400 @anchor{Extended asm with goto}
5401 As of GCC version 4.5, @code{asm goto} may be used to have the assembly
5402 jump to one or more C labels. In this form, a fifth section after the
5403 clobber list contains a list of all C labels to which the assembly may jump.
5404 Each label operand is implicitly self-named. The @code{asm} is also assumed
5405 to fall through to the next statement.
5406
5407 This form of @code{asm} is restricted to not have outputs. This is due
5408 to a internal restriction in the compiler that control transfer instructions
5409 cannot have outputs. This restriction on @code{asm goto} may be lifted
5410 in some future version of the compiler. In the mean time, @code{asm goto}
5411 may include a memory clobber, and so leave outputs in memory.
5412
5413 @smallexample
5414 int frob(int x)
5415 @{
5416 int y;
5417 asm goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5"
5418 : : "r"(x), "r"(&y) : "r5", "memory" : error);
5419 return y;
5420 error:
5421 return -1;
5422 @}
5423 @end smallexample
5424
5425 In this (inefficient) example, the @code{frob} instruction sets the
5426 carry bit to indicate an error. The @code{jc} instruction detects
5427 this and branches to the @code{error} label. Finally, the output
5428 of the @code{frob} instruction (@code{%r5}) is stored into the memory
5429 for variable @code{y}, which is later read by the @code{return} statement.
5430
5431 @smallexample
5432 void doit(void)
5433 @{
5434 int i = 0;
5435 asm goto ("mfsr %%r1, 123; jmp %%r1;"
5436 ".pushsection doit_table;"
5437 ".long %l0, %l1, %l2, %l3;"
5438 ".popsection"
5439 : : : "r1" : label1, label2, label3, label4);
5440 __builtin_unreachable ();
5441
5442 label1:
5443 f1();
5444 return;
5445 label2:
5446 f2();
5447 return;
5448 label3:
5449 i = 1;
5450 label4:
5451 f3(i);
5452 @}
5453 @end smallexample
5454
5455 In this (also inefficient) example, the @code{mfsr} instruction reads
5456 an address from some out-of-band machine register, and the following
5457 @code{jmp} instruction branches to that address. The address read by
5458 the @code{mfsr} instruction is assumed to have been previously set via
5459 some application-specific mechanism to be one of the four values stored
5460 in the @code{doit_table} section. Finally, the @code{asm} is followed
5461 by a call to @code{__builtin_unreachable} to indicate that the @code{asm}
5462 does not in fact fall through.
5463
5464 @smallexample
5465 #define TRACE1(NUM) \
5466 do @{ \
5467 asm goto ("0: nop;" \
5468 ".pushsection trace_table;" \
5469 ".long 0b, %l0;" \
5470 ".popsection" \
5471 : : : : trace#NUM); \
5472 if (0) @{ trace#NUM: trace(); @} \
5473 @} while (0)
5474 #define TRACE TRACE1(__COUNTER__)
5475 @end smallexample
5476
5477 In this example (which in fact inspired the @code{asm goto} feature)
5478 we want on rare occasions to call the @code{trace} function; on other
5479 occasions we'd like to keep the overhead to the absolute minimum.
5480 The normal code path consists of a single @code{nop} instruction.
5481 However, we record the address of this @code{nop} together with the
5482 address of a label that calls the @code{trace} function. This allows
5483 the @code{nop} instruction to be patched at runtime to be an
5484 unconditional branch to the stored label. It is assumed that an
5485 optimizing compiler will move the labeled block out of line, to
5486 optimize the fall through path from the @code{asm}.
5114 5487
5115 If you are writing a header file that should be includable in ISO C 5488 If you are writing a header file that should be includable in ISO C
5116 programs, write @code{__asm__} instead of @code{asm}. @xref{Alternate 5489 programs, write @code{__asm__} instead of @code{asm}. @xref{Alternate
5117 Keywords}. 5490 Keywords}.
5118 5491
5630 any function other than the current one; in such cases, or when the top 6003 any function other than the current one; in such cases, or when the top
5631 of the stack has been reached, this function will return @code{0} or a 6004 of the stack has been reached, this function will return @code{0} or a
5632 random value. In addition, @code{__builtin_frame_address} may be used 6005 random value. In addition, @code{__builtin_frame_address} may be used
5633 to determine if the top of the stack has been reached. 6006 to determine if the top of the stack has been reached.
5634 6007
6008 Additional post-processing of the returned value may be needed, see
6009 @code{__builtin_extract_return_address}.
6010
5635 This function should only be used with a nonzero argument for debugging 6011 This function should only be used with a nonzero argument for debugging
5636 purposes. 6012 purposes.
6013 @end deftypefn
6014
6015 @deftypefn {Built-in Function} {void *} __builtin_extract_return_address (void *@var{addr})
6016 The address as returned by @code{__builtin_return_address} may have to be fed
6017 through this function to get the actual encoded address. For example, on the
6018 31-bit S/390 platform the highest bit has to be masked out, or on SPARC
6019 platforms an offset has to be added for the true next instruction to be
6020 executed.
6021
6022 If no fixup is needed, this function simply passes through @var{addr}.
6023 @end deftypefn
6024
6025 @deftypefn {Built-in Function} {void *} __builtin_frob_return_address (void *@var{addr})
6026 This function does the reverse of @code{__builtin_extract_return_address}.
5637 @end deftypefn 6027 @end deftypefn
5638 6028
5639 @deftypefn {Built-in Function} {void *} __builtin_frame_address (unsigned int @var{level}) 6029 @deftypefn {Built-in Function} {void *} __builtin_frame_address (unsigned int @var{level})
5640 This function is similar to @code{__builtin_return_address}, but it 6030 This function is similar to @code{__builtin_return_address}, but it
5641 returns the address of the function frame rather than the return address 6031 returns the address of the function frame rather than the return address
5698 architecture does not allow for this specific SIMD type, GCC will 6088 architecture does not allow for this specific SIMD type, GCC will
5699 produce code that uses 4 @code{SIs}. 6089 produce code that uses 4 @code{SIs}.
5700 6090
5701 The types defined in this manner can be used with a subset of normal C 6091 The types defined in this manner can be used with a subset of normal C
5702 operations. Currently, GCC will allow using the following operators 6092 operations. Currently, GCC will allow using the following operators
5703 on these types: @code{+, -, *, /, unary minus, ^, |, &, ~}@. 6093 on these types: @code{+, -, *, /, unary minus, ^, |, &, ~, %}@.
5704 6094
5705 The operations behave like C++ @code{valarrays}. Addition is defined as 6095 The operations behave like C++ @code{valarrays}. Addition is defined as
5706 the addition of the corresponding elements of the operands. For 6096 the addition of the corresponding elements of the operands. For
5707 example, in the code below, each of the 4 elements in @var{a} will be 6097 example, in the code below, each of the 4 elements in @var{a} will be
5708 added to the corresponding 4 elements in @var{b} and the resulting 6098 added to the corresponding 4 elements in @var{b} and the resulting
6632 7022
6633 @deftypefn {Built-in Function} @var{type} __builtin_choose_expr (@var{const_exp}, @var{exp1}, @var{exp2}) 7023 @deftypefn {Built-in Function} @var{type} __builtin_choose_expr (@var{const_exp}, @var{exp1}, @var{exp2})
6634 7024
6635 You can use the built-in function @code{__builtin_choose_expr} to 7025 You can use the built-in function @code{__builtin_choose_expr} to
6636 evaluate code depending on the value of a constant expression. This 7026 evaluate code depending on the value of a constant expression. This
6637 built-in function returns @var{exp1} if @var{const_exp}, which is a 7027 built-in function returns @var{exp1} if @var{const_exp}, which is an
6638 constant expression that must be able to be determined at compile time, 7028 integer constant expression, is nonzero. Otherwise it returns 0.
6639 is nonzero. Otherwise it returns 0.
6640 7029
6641 This built-in function is analogous to the @samp{? :} operator in C, 7030 This built-in function is analogous to the @samp{? :} operator in C,
6642 except that the expression returned has its type unaltered by promotion 7031 except that the expression returned has its type unaltered by promotion
6643 rules. Also, the built-in function does not evaluate the expression 7032 rules. Also, the built-in function does not evaluate the expression
6644 that was not chosen. For example, if @var{const_exp} evaluates to true, 7033 that was not chosen. For example, if @var{const_exp} evaluates to true,
6713 @}; 7102 @};
6714 @end smallexample 7103 @end smallexample
6715 7104
6716 @noindent 7105 @noindent
6717 This is an acceptable initializer even if @var{EXPRESSION} is not a 7106 This is an acceptable initializer even if @var{EXPRESSION} is not a
6718 constant expression. GCC must be more conservative about evaluating the 7107 constant expression, including the case where
7108 @code{__builtin_constant_p} returns 1 because @var{EXPRESSION} can be
7109 folded to a constant but @var{EXPRESSION} contains operands that would
7110 not otherwise be permitted in a static initializer (for example,
7111 @code{0 && foo ()}). GCC must be more conservative about evaluating the
6719 built-in in this case, because it has no opportunity to perform 7112 built-in in this case, because it has no opportunity to perform
6720 optimization. 7113 optimization.
6721 7114
6722 Previous versions of GCC did not accept this built-in in data 7115 Previous versions of GCC did not accept this built-in in data
6723 initializers. The earliest version where it is completely safe is 7116 initializers. The earliest version where it is completely safe is
6760 This function causes the program to exit abnormally. GCC implements 7153 This function causes the program to exit abnormally. GCC implements
6761 this function by using a target-dependent mechanism (such as 7154 this function by using a target-dependent mechanism (such as
6762 intentionally executing an illegal instruction) or by calling 7155 intentionally executing an illegal instruction) or by calling
6763 @code{abort}. The mechanism used may vary from release to release so 7156 @code{abort}. The mechanism used may vary from release to release so
6764 you should not rely on any particular implementation. 7157 you should not rely on any particular implementation.
7158 @end deftypefn
7159
7160 @deftypefn {Built-in Function} void __builtin_unreachable (void)
7161 If control flow reaches the point of the @code{__builtin_unreachable},
7162 the program is undefined. It is useful in situations where the
7163 compiler cannot deduce the unreachability of the code.
7164
7165 One such case is immediately following an @code{asm} statement that
7166 will either never terminate, or one that transfers control elsewhere
7167 and never returns. In this example, without the
7168 @code{__builtin_unreachable}, GCC would issue a warning that control
7169 reaches the end of a non-void function. It would also generate code
7170 to return after the @code{asm}.
7171
7172 @smallexample
7173 int f (int c, int v)
7174 @{
7175 if (c)
7176 @{
7177 return v;
7178 @}
7179 else
7180 @{
7181 asm("jmp error_handler");
7182 __builtin_unreachable ();
7183 @}
7184 @}
7185 @end smallexample
7186
7187 Because the @code{asm} statement unconditionally transfers control out
7188 of the function, control will never reach the end of the function
7189 body. The @code{__builtin_unreachable} is in fact unreachable and
7190 communicates this fact to the compiler.
7191
7192 Another use for @code{__builtin_unreachable} is following a call a
7193 function that never returns but that is not declared
7194 @code{__attribute__((noreturn))}, as in this example:
7195
7196 @smallexample
7197 void function_that_never_returns (void);
7198
7199 int g (int c)
7200 @{
7201 if (c)
7202 @{
7203 return 1;
7204 @}
7205 else
7206 @{
7207 function_that_never_returns ();
7208 __builtin_unreachable ();
7209 @}
7210 @}
7211 @end smallexample
7212
6765 @end deftypefn 7213 @end deftypefn
6766 7214
6767 @deftypefn {Built-in Function} void __builtin___clear_cache (char *@var{begin}, char *@var{end}) 7215 @deftypefn {Built-in Function} void __builtin___clear_cache (char *@var{begin}, char *@var{end})
6768 This function is used to flush the processor's instruction cache for 7216 This function is used to flush the processor's instruction cache for
6769 the region of memory between @var{begin} inclusive and @var{end} 7217 the region of memory between @var{begin} inclusive and @var{end}
7048 * MIPS DSP Built-in Functions:: 7496 * MIPS DSP Built-in Functions::
7049 * MIPS Paired-Single Support:: 7497 * MIPS Paired-Single Support::
7050 * MIPS Loongson Built-in Functions:: 7498 * MIPS Loongson Built-in Functions::
7051 * Other MIPS Built-in Functions:: 7499 * Other MIPS Built-in Functions::
7052 * picoChip Built-in Functions:: 7500 * picoChip Built-in Functions::
7053 * PowerPC AltiVec Built-in Functions:: 7501 * PowerPC AltiVec/VSX Built-in Functions::
7502 * RX Built-in Functions::
7054 * SPARC VIS Built-in Functions:: 7503 * SPARC VIS Built-in Functions::
7055 * SPU Built-in Functions:: 7504 * SPU Built-in Functions::
7056 @end menu 7505 @end menu
7057 7506
7058 @node Alpha Built-in Functions 7507 @node Alpha Built-in Functions
7777 64-bit mode. 8226 64-bit mode.
7778 8227
7779 @table @code 8228 @table @code
7780 @item __float128 __builtin_infq (void) 8229 @item __float128 __builtin_infq (void)
7781 Similar to @code{__builtin_inf}, except the return type is @code{__float128}. 8230 Similar to @code{__builtin_inf}, except the return type is @code{__float128}.
8231 @findex __builtin_infq
8232
8233 @item __float128 __builtin_huge_valq (void)
8234 Similar to @code{__builtin_huge_val}, except the return type is @code{__float128}.
8235 @findex __builtin_huge_valq
7782 @end table 8236 @end table
7783 8237
7784 The following built-in functions are made available by @option{-mmmx}. 8238 The following built-in functions are made available by @option{-mmmx}.
7785 All of them generate the machine instruction that is part of the name. 8239 All of them generate the machine instruction that is part of the name.
7786 8240
8485 v2di __builtin_ia32_extrqi (v2di, const unsigned int, const unsigned int) 8939 v2di __builtin_ia32_extrqi (v2di, const unsigned int, const unsigned int)
8486 v2di __builtin_ia32_insertq (v2di, v2di) 8940 v2di __builtin_ia32_insertq (v2di, v2di)
8487 v2di __builtin_ia32_insertqi (v2di, v2di, const unsigned int, const unsigned int) 8941 v2di __builtin_ia32_insertqi (v2di, v2di, const unsigned int, const unsigned int)
8488 @end smallexample 8942 @end smallexample
8489 8943
8490 The following built-in functions are available when @option{-msse5} is used. 8944 The following built-in functions are available when @option{-mxop} is used.
8945 @smallexample
8946 v2df __builtin_ia32_vfrczpd (v2df)
8947 v4sf __builtin_ia32_vfrczps (v4sf)
8948 v2df __builtin_ia32_vfrczsd (v2df, v2df)
8949 v4sf __builtin_ia32_vfrczss (v4sf, v4sf)
8950 v4df __builtin_ia32_vfrczpd256 (v4df)
8951 v8sf __builtin_ia32_vfrczps256 (v8sf)
8952 v2di __builtin_ia32_vpcmov (v2di, v2di, v2di)
8953 v2di __builtin_ia32_vpcmov_v2di (v2di, v2di, v2di)
8954 v4si __builtin_ia32_vpcmov_v4si (v4si, v4si, v4si)
8955 v8hi __builtin_ia32_vpcmov_v8hi (v8hi, v8hi, v8hi)
8956 v16qi __builtin_ia32_vpcmov_v16qi (v16qi, v16qi, v16qi)
8957 v2df __builtin_ia32_vpcmov_v2df (v2df, v2df, v2df)
8958 v4sf __builtin_ia32_vpcmov_v4sf (v4sf, v4sf, v4sf)
8959 v4di __builtin_ia32_vpcmov_v4di256 (v4di, v4di, v4di)
8960 v8si __builtin_ia32_vpcmov_v8si256 (v8si, v8si, v8si)
8961 v16hi __builtin_ia32_vpcmov_v16hi256 (v16hi, v16hi, v16hi)
8962 v32qi __builtin_ia32_vpcmov_v32qi256 (v32qi, v32qi, v32qi)
8963 v4df __builtin_ia32_vpcmov_v4df256 (v4df, v4df, v4df)
8964 v8sf __builtin_ia32_vpcmov_v8sf256 (v8sf, v8sf, v8sf)
8965 v16qi __builtin_ia32_vpcomeqb (v16qi, v16qi)
8966 v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi)
8967 v4si __builtin_ia32_vpcomeqd (v4si, v4si)
8968 v2di __builtin_ia32_vpcomeqq (v2di, v2di)
8969 v16qi __builtin_ia32_vpcomequb (v16qi, v16qi)
8970 v4si __builtin_ia32_vpcomequd (v4si, v4si)
8971 v2di __builtin_ia32_vpcomequq (v2di, v2di)
8972 v8hi __builtin_ia32_vpcomequw (v8hi, v8hi)
8973 v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi)
8974 v16qi __builtin_ia32_vpcomfalseb (v16qi, v16qi)
8975 v4si __builtin_ia32_vpcomfalsed (v4si, v4si)
8976 v2di __builtin_ia32_vpcomfalseq (v2di, v2di)
8977 v16qi __builtin_ia32_vpcomfalseub (v16qi, v16qi)
8978 v4si __builtin_ia32_vpcomfalseud (v4si, v4si)
8979 v2di __builtin_ia32_vpcomfalseuq (v2di, v2di)
8980 v8hi __builtin_ia32_vpcomfalseuw (v8hi, v8hi)
8981 v8hi __builtin_ia32_vpcomfalsew (v8hi, v8hi)
8982 v16qi __builtin_ia32_vpcomgeb (v16qi, v16qi)
8983 v4si __builtin_ia32_vpcomged (v4si, v4si)
8984 v2di __builtin_ia32_vpcomgeq (v2di, v2di)
8985 v16qi __builtin_ia32_vpcomgeub (v16qi, v16qi)
8986 v4si __builtin_ia32_vpcomgeud (v4si, v4si)
8987 v2di __builtin_ia32_vpcomgeuq (v2di, v2di)
8988 v8hi __builtin_ia32_vpcomgeuw (v8hi, v8hi)
8989 v8hi __builtin_ia32_vpcomgew (v8hi, v8hi)
8990 v16qi __builtin_ia32_vpcomgtb (v16qi, v16qi)
8991 v4si __builtin_ia32_vpcomgtd (v4si, v4si)
8992 v2di __builtin_ia32_vpcomgtq (v2di, v2di)
8993 v16qi __builtin_ia32_vpcomgtub (v16qi, v16qi)
8994 v4si __builtin_ia32_vpcomgtud (v4si, v4si)
8995 v2di __builtin_ia32_vpcomgtuq (v2di, v2di)
8996 v8hi __builtin_ia32_vpcomgtuw (v8hi, v8hi)
8997 v8hi __builtin_ia32_vpcomgtw (v8hi, v8hi)
8998 v16qi __builtin_ia32_vpcomleb (v16qi, v16qi)
8999 v4si __builtin_ia32_vpcomled (v4si, v4si)
9000 v2di __builtin_ia32_vpcomleq (v2di, v2di)
9001 v16qi __builtin_ia32_vpcomleub (v16qi, v16qi)
9002 v4si __builtin_ia32_vpcomleud (v4si, v4si)
9003 v2di __builtin_ia32_vpcomleuq (v2di, v2di)
9004 v8hi __builtin_ia32_vpcomleuw (v8hi, v8hi)
9005 v8hi __builtin_ia32_vpcomlew (v8hi, v8hi)
9006 v16qi __builtin_ia32_vpcomltb (v16qi, v16qi)
9007 v4si __builtin_ia32_vpcomltd (v4si, v4si)
9008 v2di __builtin_ia32_vpcomltq (v2di, v2di)
9009 v16qi __builtin_ia32_vpcomltub (v16qi, v16qi)
9010 v4si __builtin_ia32_vpcomltud (v4si, v4si)
9011 v2di __builtin_ia32_vpcomltuq (v2di, v2di)
9012 v8hi __builtin_ia32_vpcomltuw (v8hi, v8hi)
9013 v8hi __builtin_ia32_vpcomltw (v8hi, v8hi)
9014 v16qi __builtin_ia32_vpcomneb (v16qi, v16qi)
9015 v4si __builtin_ia32_vpcomned (v4si, v4si)
9016 v2di __builtin_ia32_vpcomneq (v2di, v2di)
9017 v16qi __builtin_ia32_vpcomneub (v16qi, v16qi)
9018 v4si __builtin_ia32_vpcomneud (v4si, v4si)
9019 v2di __builtin_ia32_vpcomneuq (v2di, v2di)
9020 v8hi __builtin_ia32_vpcomneuw (v8hi, v8hi)
9021 v8hi __builtin_ia32_vpcomnew (v8hi, v8hi)
9022 v16qi __builtin_ia32_vpcomtrueb (v16qi, v16qi)
9023 v4si __builtin_ia32_vpcomtrued (v4si, v4si)
9024 v2di __builtin_ia32_vpcomtrueq (v2di, v2di)
9025 v16qi __builtin_ia32_vpcomtrueub (v16qi, v16qi)
9026 v4si __builtin_ia32_vpcomtrueud (v4si, v4si)
9027 v2di __builtin_ia32_vpcomtrueuq (v2di, v2di)
9028 v8hi __builtin_ia32_vpcomtrueuw (v8hi, v8hi)
9029 v8hi __builtin_ia32_vpcomtruew (v8hi, v8hi)
9030 v4si __builtin_ia32_vphaddbd (v16qi)
9031 v2di __builtin_ia32_vphaddbq (v16qi)
9032 v8hi __builtin_ia32_vphaddbw (v16qi)
9033 v2di __builtin_ia32_vphadddq (v4si)
9034 v4si __builtin_ia32_vphaddubd (v16qi)
9035 v2di __builtin_ia32_vphaddubq (v16qi)
9036 v8hi __builtin_ia32_vphaddubw (v16qi)
9037 v2di __builtin_ia32_vphaddudq (v4si)
9038 v4si __builtin_ia32_vphadduwd (v8hi)
9039 v2di __builtin_ia32_vphadduwq (v8hi)
9040 v4si __builtin_ia32_vphaddwd (v8hi)
9041 v2di __builtin_ia32_vphaddwq (v8hi)
9042 v8hi __builtin_ia32_vphsubbw (v16qi)
9043 v2di __builtin_ia32_vphsubdq (v4si)
9044 v4si __builtin_ia32_vphsubwd (v8hi)
9045 v4si __builtin_ia32_vpmacsdd (v4si, v4si, v4si)
9046 v2di __builtin_ia32_vpmacsdqh (v4si, v4si, v2di)
9047 v2di __builtin_ia32_vpmacsdql (v4si, v4si, v2di)
9048 v4si __builtin_ia32_vpmacssdd (v4si, v4si, v4si)
9049 v2di __builtin_ia32_vpmacssdqh (v4si, v4si, v2di)
9050 v2di __builtin_ia32_vpmacssdql (v4si, v4si, v2di)
9051 v4si __builtin_ia32_vpmacsswd (v8hi, v8hi, v4si)
9052 v8hi __builtin_ia32_vpmacssww (v8hi, v8hi, v8hi)
9053 v4si __builtin_ia32_vpmacswd (v8hi, v8hi, v4si)
9054 v8hi __builtin_ia32_vpmacsww (v8hi, v8hi, v8hi)
9055 v4si __builtin_ia32_vpmadcsswd (v8hi, v8hi, v4si)
9056 v4si __builtin_ia32_vpmadcswd (v8hi, v8hi, v4si)
9057 v16qi __builtin_ia32_vpperm (v16qi, v16qi, v16qi)
9058 v16qi __builtin_ia32_vprotb (v16qi, v16qi)
9059 v4si __builtin_ia32_vprotd (v4si, v4si)
9060 v2di __builtin_ia32_vprotq (v2di, v2di)
9061 v8hi __builtin_ia32_vprotw (v8hi, v8hi)
9062 v16qi __builtin_ia32_vpshab (v16qi, v16qi)
9063 v4si __builtin_ia32_vpshad (v4si, v4si)
9064 v2di __builtin_ia32_vpshaq (v2di, v2di)
9065 v8hi __builtin_ia32_vpshaw (v8hi, v8hi)
9066 v16qi __builtin_ia32_vpshlb (v16qi, v16qi)
9067 v4si __builtin_ia32_vpshld (v4si, v4si)
9068 v2di __builtin_ia32_vpshlq (v2di, v2di)
9069 v8hi __builtin_ia32_vpshlw (v8hi, v8hi)
9070 @end smallexample
9071
9072 The following built-in functions are available when @option{-mfma4} is used.
8491 All of them generate the machine instruction that is part of the name 9073 All of them generate the machine instruction that is part of the name
8492 with MMX registers. 9074 with MMX registers.
8493 9075
8494 @smallexample 9076 @smallexample
8495 v2df __builtin_ia32_comeqpd (v2df, v2df)
8496 v2df __builtin_ia32_comeqps (v2df, v2df)
8497 v4sf __builtin_ia32_comeqsd (v4sf, v4sf)
8498 v4sf __builtin_ia32_comeqss (v4sf, v4sf)
8499 v2df __builtin_ia32_comfalsepd (v2df, v2df)
8500 v2df __builtin_ia32_comfalseps (v2df, v2df)
8501 v4sf __builtin_ia32_comfalsesd (v4sf, v4sf)
8502 v4sf __builtin_ia32_comfalsess (v4sf, v4sf)
8503 v2df __builtin_ia32_comgepd (v2df, v2df)
8504 v2df __builtin_ia32_comgeps (v2df, v2df)
8505 v4sf __builtin_ia32_comgesd (v4sf, v4sf)
8506 v4sf __builtin_ia32_comgess (v4sf, v4sf)
8507 v2df __builtin_ia32_comgtpd (v2df, v2df)
8508 v2df __builtin_ia32_comgtps (v2df, v2df)
8509 v4sf __builtin_ia32_comgtsd (v4sf, v4sf)
8510 v4sf __builtin_ia32_comgtss (v4sf, v4sf)
8511 v2df __builtin_ia32_comlepd (v2df, v2df)
8512 v2df __builtin_ia32_comleps (v2df, v2df)
8513 v4sf __builtin_ia32_comlesd (v4sf, v4sf)
8514 v4sf __builtin_ia32_comless (v4sf, v4sf)
8515 v2df __builtin_ia32_comltpd (v2df, v2df)
8516 v2df __builtin_ia32_comltps (v2df, v2df)
8517 v4sf __builtin_ia32_comltsd (v4sf, v4sf)
8518 v4sf __builtin_ia32_comltss (v4sf, v4sf)
8519 v2df __builtin_ia32_comnepd (v2df, v2df)
8520 v2df __builtin_ia32_comneps (v2df, v2df)
8521 v4sf __builtin_ia32_comnesd (v4sf, v4sf)
8522 v4sf __builtin_ia32_comness (v4sf, v4sf)
8523 v2df __builtin_ia32_comordpd (v2df, v2df)
8524 v2df __builtin_ia32_comordps (v2df, v2df)
8525 v4sf __builtin_ia32_comordsd (v4sf, v4sf)
8526 v4sf __builtin_ia32_comordss (v4sf, v4sf)
8527 v2df __builtin_ia32_comtruepd (v2df, v2df)
8528 v2df __builtin_ia32_comtrueps (v2df, v2df)
8529 v4sf __builtin_ia32_comtruesd (v4sf, v4sf)
8530 v4sf __builtin_ia32_comtruess (v4sf, v4sf)
8531 v2df __builtin_ia32_comueqpd (v2df, v2df)
8532 v2df __builtin_ia32_comueqps (v2df, v2df)
8533 v4sf __builtin_ia32_comueqsd (v4sf, v4sf)
8534 v4sf __builtin_ia32_comueqss (v4sf, v4sf)
8535 v2df __builtin_ia32_comugepd (v2df, v2df)
8536 v2df __builtin_ia32_comugeps (v2df, v2df)
8537 v4sf __builtin_ia32_comugesd (v4sf, v4sf)
8538 v4sf __builtin_ia32_comugess (v4sf, v4sf)
8539 v2df __builtin_ia32_comugtpd (v2df, v2df)
8540 v2df __builtin_ia32_comugtps (v2df, v2df)
8541 v4sf __builtin_ia32_comugtsd (v4sf, v4sf)
8542 v4sf __builtin_ia32_comugtss (v4sf, v4sf)
8543 v2df __builtin_ia32_comulepd (v2df, v2df)
8544 v2df __builtin_ia32_comuleps (v2df, v2df)
8545 v4sf __builtin_ia32_comulesd (v4sf, v4sf)
8546 v4sf __builtin_ia32_comuless (v4sf, v4sf)
8547 v2df __builtin_ia32_comultpd (v2df, v2df)
8548 v2df __builtin_ia32_comultps (v2df, v2df)
8549 v4sf __builtin_ia32_comultsd (v4sf, v4sf)
8550 v4sf __builtin_ia32_comultss (v4sf, v4sf)
8551 v2df __builtin_ia32_comunepd (v2df, v2df)
8552 v2df __builtin_ia32_comuneps (v2df, v2df)
8553 v4sf __builtin_ia32_comunesd (v4sf, v4sf)
8554 v4sf __builtin_ia32_comuness (v4sf, v4sf)
8555 v2df __builtin_ia32_comunordpd (v2df, v2df)
8556 v2df __builtin_ia32_comunordps (v2df, v2df)
8557 v4sf __builtin_ia32_comunordsd (v4sf, v4sf)
8558 v4sf __builtin_ia32_comunordss (v4sf, v4sf)
8559 v2df __builtin_ia32_fmaddpd (v2df, v2df, v2df) 9077 v2df __builtin_ia32_fmaddpd (v2df, v2df, v2df)
8560 v4sf __builtin_ia32_fmaddps (v4sf, v4sf, v4sf) 9078 v4sf __builtin_ia32_fmaddps (v4sf, v4sf, v4sf)
8561 v2df __builtin_ia32_fmaddsd (v2df, v2df, v2df) 9079 v2df __builtin_ia32_fmaddsd (v2df, v2df, v2df)
8562 v4sf __builtin_ia32_fmaddss (v4sf, v4sf, v4sf) 9080 v4sf __builtin_ia32_fmaddss (v4sf, v4sf, v4sf)
8563 v2df __builtin_ia32_fmsubpd (v2df, v2df, v2df) 9081 v2df __builtin_ia32_fmsubpd (v2df, v2df, v2df)
8570 v4sf __builtin_ia32_fnmaddss (v4sf, v4sf, v4sf) 9088 v4sf __builtin_ia32_fnmaddss (v4sf, v4sf, v4sf)
8571 v2df __builtin_ia32_fnmsubpd (v2df, v2df, v2df) 9089 v2df __builtin_ia32_fnmsubpd (v2df, v2df, v2df)
8572 v4sf __builtin_ia32_fnmsubps (v4sf, v4sf, v4sf) 9090 v4sf __builtin_ia32_fnmsubps (v4sf, v4sf, v4sf)
8573 v2df __builtin_ia32_fnmsubsd (v2df, v2df, v2df) 9091 v2df __builtin_ia32_fnmsubsd (v2df, v2df, v2df)
8574 v4sf __builtin_ia32_fnmsubss (v4sf, v4sf, v4sf) 9092 v4sf __builtin_ia32_fnmsubss (v4sf, v4sf, v4sf)
8575 v2df __builtin_ia32_frczpd (v2df) 9093 v2df __builtin_ia32_fmaddsubpd (v2df, v2df, v2df)
8576 v4sf __builtin_ia32_frczps (v4sf) 9094 v4sf __builtin_ia32_fmaddsubps (v4sf, v4sf, v4sf)
8577 v2df __builtin_ia32_frczsd (v2df, v2df) 9095 v2df __builtin_ia32_fmsubaddpd (v2df, v2df, v2df)
8578 v4sf __builtin_ia32_frczss (v4sf, v4sf) 9096 v4sf __builtin_ia32_fmsubaddps (v4sf, v4sf, v4sf)
8579 v2di __builtin_ia32_pcmov (v2di, v2di, v2di) 9097 v4df __builtin_ia32_fmaddpd256 (v4df, v4df, v4df)
8580 v2di __builtin_ia32_pcmov_v2di (v2di, v2di, v2di) 9098 v8sf __builtin_ia32_fmaddps256 (v8sf, v8sf, v8sf)
8581 v4si __builtin_ia32_pcmov_v4si (v4si, v4si, v4si) 9099 v4df __builtin_ia32_fmsubpd256 (v4df, v4df, v4df)
8582 v8hi __builtin_ia32_pcmov_v8hi (v8hi, v8hi, v8hi) 9100 v8sf __builtin_ia32_fmsubps256 (v8sf, v8sf, v8sf)
8583 v16qi __builtin_ia32_pcmov_v16qi (v16qi, v16qi, v16qi) 9101 v4df __builtin_ia32_fnmaddpd256 (v4df, v4df, v4df)
8584 v2df __builtin_ia32_pcmov_v2df (v2df, v2df, v2df) 9102 v8sf __builtin_ia32_fnmaddps256 (v8sf, v8sf, v8sf)
8585 v4sf __builtin_ia32_pcmov_v4sf (v4sf, v4sf, v4sf) 9103 v4df __builtin_ia32_fnmsubpd256 (v4df, v4df, v4df)
8586 v16qi __builtin_ia32_pcomeqb (v16qi, v16qi) 9104 v8sf __builtin_ia32_fnmsubps256 (v8sf, v8sf, v8sf)
8587 v8hi __builtin_ia32_pcomeqw (v8hi, v8hi) 9105 v4df __builtin_ia32_fmaddsubpd256 (v4df, v4df, v4df)
8588 v4si __builtin_ia32_pcomeqd (v4si, v4si) 9106 v8sf __builtin_ia32_fmaddsubps256 (v8sf, v8sf, v8sf)
8589 v2di __builtin_ia32_pcomeqq (v2di, v2di) 9107 v4df __builtin_ia32_fmsubaddpd256 (v4df, v4df, v4df)
8590 v16qi __builtin_ia32_pcomequb (v16qi, v16qi) 9108 v8sf __builtin_ia32_fmsubaddps256 (v8sf, v8sf, v8sf)
8591 v4si __builtin_ia32_pcomequd (v4si, v4si) 9109
8592 v2di __builtin_ia32_pcomequq (v2di, v2di) 9110 @end smallexample
8593 v8hi __builtin_ia32_pcomequw (v8hi, v8hi) 9111
8594 v8hi __builtin_ia32_pcomeqw (v8hi, v8hi) 9112 The following built-in functions are available when @option{-mlwp} is used.
8595 v16qi __builtin_ia32_pcomfalseb (v16qi, v16qi) 9113
8596 v4si __builtin_ia32_pcomfalsed (v4si, v4si) 9114 @smallexample
8597 v2di __builtin_ia32_pcomfalseq (v2di, v2di) 9115 void __builtin_ia32_llwpcb16 (void *);
8598 v16qi __builtin_ia32_pcomfalseub (v16qi, v16qi) 9116 void __builtin_ia32_llwpcb32 (void *);
8599 v4si __builtin_ia32_pcomfalseud (v4si, v4si) 9117 void __builtin_ia32_llwpcb64 (void *);
8600 v2di __builtin_ia32_pcomfalseuq (v2di, v2di) 9118 void * __builtin_ia32_llwpcb16 (void);
8601 v8hi __builtin_ia32_pcomfalseuw (v8hi, v8hi) 9119 void * __builtin_ia32_llwpcb32 (void);
8602 v8hi __builtin_ia32_pcomfalsew (v8hi, v8hi) 9120 void * __builtin_ia32_llwpcb64 (void);
8603 v16qi __builtin_ia32_pcomgeb (v16qi, v16qi) 9121 void __builtin_ia32_lwpval16 (unsigned short, unsigned int, unsigned short)
8604 v4si __builtin_ia32_pcomged (v4si, v4si) 9122 void __builtin_ia32_lwpval32 (unsigned int, unsigned int, unsigned int)
8605 v2di __builtin_ia32_pcomgeq (v2di, v2di) 9123 void __builtin_ia32_lwpval64 (unsigned __int64, unsigned int, unsigned int)
8606 v16qi __builtin_ia32_pcomgeub (v16qi, v16qi) 9124 unsigned char __builtin_ia32_lwpins16 (unsigned short, unsigned int, unsigned short)
8607 v4si __builtin_ia32_pcomgeud (v4si, v4si) 9125 unsigned char __builtin_ia32_lwpins32 (unsigned int, unsigned int, unsigned int)
8608 v2di __builtin_ia32_pcomgeuq (v2di, v2di) 9126 unsigned char __builtin_ia32_lwpins64 (unsigned __int64, unsigned int, unsigned int)
8609 v8hi __builtin_ia32_pcomgeuw (v8hi, v8hi)
8610 v8hi __builtin_ia32_pcomgew (v8hi, v8hi)
8611 v16qi __builtin_ia32_pcomgtb (v16qi, v16qi)
8612 v4si __builtin_ia32_pcomgtd (v4si, v4si)
8613 v2di __builtin_ia32_pcomgtq (v2di, v2di)
8614 v16qi __builtin_ia32_pcomgtub (v16qi, v16qi)
8615 v4si __builtin_ia32_pcomgtud (v4si, v4si)
8616 v2di __builtin_ia32_pcomgtuq (v2di, v2di)
8617 v8hi __builtin_ia32_pcomgtuw (v8hi, v8hi)
8618 v8hi __builtin_ia32_pcomgtw (v8hi, v8hi)
8619 v16qi __builtin_ia32_pcomleb (v16qi, v16qi)
8620 v4si __builtin_ia32_pcomled (v4si, v4si)
8621 v2di __builtin_ia32_pcomleq (v2di, v2di)
8622 v16qi __builtin_ia32_pcomleub (v16qi, v16qi)
8623 v4si __builtin_ia32_pcomleud (v4si, v4si)
8624 v2di __builtin_ia32_pcomleuq (v2di, v2di)
8625 v8hi __builtin_ia32_pcomleuw (v8hi, v8hi)
8626 v8hi __builtin_ia32_pcomlew (v8hi, v8hi)
8627 v16qi __builtin_ia32_pcomltb (v16qi, v16qi)
8628 v4si __builtin_ia32_pcomltd (v4si, v4si)
8629 v2di __builtin_ia32_pcomltq (v2di, v2di)
8630 v16qi __builtin_ia32_pcomltub (v16qi, v16qi)
8631 v4si __builtin_ia32_pcomltud (v4si, v4si)
8632 v2di __builtin_ia32_pcomltuq (v2di, v2di)
8633 v8hi __builtin_ia32_pcomltuw (v8hi, v8hi)
8634 v8hi __builtin_ia32_pcomltw (v8hi, v8hi)
8635 v16qi __builtin_ia32_pcomneb (v16qi, v16qi)
8636 v4si __builtin_ia32_pcomned (v4si, v4si)
8637 v2di __builtin_ia32_pcomneq (v2di, v2di)
8638 v16qi __builtin_ia32_pcomneub (v16qi, v16qi)
8639 v4si __builtin_ia32_pcomneud (v4si, v4si)
8640 v2di __builtin_ia32_pcomneuq (v2di, v2di)
8641 v8hi __builtin_ia32_pcomneuw (v8hi, v8hi)
8642 v8hi __builtin_ia32_pcomnew (v8hi, v8hi)
8643 v16qi __builtin_ia32_pcomtrueb (v16qi, v16qi)
8644 v4si __builtin_ia32_pcomtrued (v4si, v4si)
8645 v2di __builtin_ia32_pcomtrueq (v2di, v2di)
8646 v16qi __builtin_ia32_pcomtrueub (v16qi, v16qi)
8647 v4si __builtin_ia32_pcomtrueud (v4si, v4si)
8648 v2di __builtin_ia32_pcomtrueuq (v2di, v2di)
8649 v8hi __builtin_ia32_pcomtrueuw (v8hi, v8hi)
8650 v8hi __builtin_ia32_pcomtruew (v8hi, v8hi)
8651 v4df __builtin_ia32_permpd (v2df, v2df, v16qi)
8652 v4sf __builtin_ia32_permps (v4sf, v4sf, v16qi)
8653 v4si __builtin_ia32_phaddbd (v16qi)
8654 v2di __builtin_ia32_phaddbq (v16qi)
8655 v8hi __builtin_ia32_phaddbw (v16qi)
8656 v2di __builtin_ia32_phadddq (v4si)
8657 v4si __builtin_ia32_phaddubd (v16qi)
8658 v2di __builtin_ia32_phaddubq (v16qi)
8659 v8hi __builtin_ia32_phaddubw (v16qi)
8660 v2di __builtin_ia32_phaddudq (v4si)
8661 v4si __builtin_ia32_phadduwd (v8hi)
8662 v2di __builtin_ia32_phadduwq (v8hi)
8663 v4si __builtin_ia32_phaddwd (v8hi)
8664 v2di __builtin_ia32_phaddwq (v8hi)
8665 v8hi __builtin_ia32_phsubbw (v16qi)
8666 v2di __builtin_ia32_phsubdq (v4si)
8667 v4si __builtin_ia32_phsubwd (v8hi)
8668 v4si __builtin_ia32_pmacsdd (v4si, v4si, v4si)
8669 v2di __builtin_ia32_pmacsdqh (v4si, v4si, v2di)
8670 v2di __builtin_ia32_pmacsdql (v4si, v4si, v2di)
8671 v4si __builtin_ia32_pmacssdd (v4si, v4si, v4si)
8672 v2di __builtin_ia32_pmacssdqh (v4si, v4si, v2di)
8673 v2di __builtin_ia32_pmacssdql (v4si, v4si, v2di)
8674 v4si __builtin_ia32_pmacsswd (v8hi, v8hi, v4si)
8675 v8hi __builtin_ia32_pmacssww (v8hi, v8hi, v8hi)
8676 v4si __builtin_ia32_pmacswd (v8hi, v8hi, v4si)
8677 v8hi __builtin_ia32_pmacsww (v8hi, v8hi, v8hi)
8678 v4si __builtin_ia32_pmadcsswd (v8hi, v8hi, v4si)
8679 v4si __builtin_ia32_pmadcswd (v8hi, v8hi, v4si)
8680 v16qi __builtin_ia32_pperm (v16qi, v16qi, v16qi)
8681 v16qi __builtin_ia32_protb (v16qi, v16qi)
8682 v4si __builtin_ia32_protd (v4si, v4si)
8683 v2di __builtin_ia32_protq (v2di, v2di)
8684 v8hi __builtin_ia32_protw (v8hi, v8hi)
8685 v16qi __builtin_ia32_pshab (v16qi, v16qi)
8686 v4si __builtin_ia32_pshad (v4si, v4si)
8687 v2di __builtin_ia32_pshaq (v2di, v2di)
8688 v8hi __builtin_ia32_pshaw (v8hi, v8hi)
8689 v16qi __builtin_ia32_pshlb (v16qi, v16qi)
8690 v4si __builtin_ia32_pshld (v4si, v4si)
8691 v2di __builtin_ia32_pshlq (v2di, v2di)
8692 v8hi __builtin_ia32_pshlw (v8hi, v8hi)
8693 @end smallexample
8694
8695 The following builtin-in functions are available when @option{-msse5}
8696 is used. The second argument must be an integer constant and generate
8697 the machine instruction that is part of the name with the @samp{_imm}
8698 suffix removed.
8699
8700 @smallexample
8701 v16qi __builtin_ia32_protb_imm (v16qi, int)
8702 v4si __builtin_ia32_protd_imm (v4si, int)
8703 v2di __builtin_ia32_protq_imm (v2di, int)
8704 v8hi __builtin_ia32_protw_imm (v8hi, int)
8705 @end smallexample 9127 @end smallexample
8706 9128
8707 The following built-in functions are available when @option{-m3dnow} is used. 9129 The following built-in functions are available when @option{-m3dnow} is used.
8708 All of them generate the machine instruction that is part of the name. 9130 All of them generate the machine instruction that is part of the name.
8709 9131
9501 Saturating addition. Return the result of adding @var{x} and @var{y}, 9923 Saturating addition. Return the result of adding @var{x} and @var{y},
9502 storing the value 32767 if the result overflows. 9924 storing the value 32767 if the result overflows.
9503 9925
9504 @item int __builtin_subs (int @var{x}, int @var{y}) 9926 @item int __builtin_subs (int @var{x}, int @var{y})
9505 Saturating subtraction. Return the result of subtracting @var{y} from 9927 Saturating subtraction. Return the result of subtracting @var{y} from
9506 @var{x}, storing the value -32768 if the result overflows. 9928 @var{x}, storing the value @minus{}32768 if the result overflows.
9507 9929
9508 @item void __builtin_halt (void) 9930 @item void __builtin_halt (void)
9509 Halt. The processor will stop execution. This built-in is useful for 9931 Halt. The processor will stop execution. This built-in is useful for
9510 implementing assertions. 9932 implementing assertions.
9511 9933
9521 Insert a @samp{cache} instruction with operands @var{op} and @var{addr}. 9943 Insert a @samp{cache} instruction with operands @var{op} and @var{addr}.
9522 GCC defines the preprocessor macro @code{___GCC_HAVE_BUILTIN_MIPS_CACHE} 9944 GCC defines the preprocessor macro @code{___GCC_HAVE_BUILTIN_MIPS_CACHE}
9523 when this function is available. 9945 when this function is available.
9524 @end table 9946 @end table
9525 9947
9526 @node PowerPC AltiVec Built-in Functions 9948 @node PowerPC AltiVec/VSX Built-in Functions
9527 @subsection PowerPC AltiVec Built-in Functions 9949 @subsection PowerPC AltiVec Built-in Functions
9528 9950
9529 GCC provides an interface for the PowerPC family of processors to access 9951 GCC provides an interface for the PowerPC family of processors to access
9530 the AltiVec operations described in Motorola's AltiVec Programming 9952 the AltiVec operations described in Motorola's AltiVec Programming
9531 Interface Manual. The interface is made available by including 9953 Interface Manual. The interface is made available by including
9546 vector unsigned int 9968 vector unsigned int
9547 vector signed int 9969 vector signed int
9548 vector bool int 9970 vector bool int
9549 vector float 9971 vector float
9550 @end smallexample 9972 @end smallexample
9973
9974 If @option{-mvsx} is used the following additional vector types are
9975 implemented.
9976
9977 @smallexample
9978 vector unsigned long
9979 vector signed long
9980 vector double
9981 @end smallexample
9982
9983 The long types are only implemented for 64-bit code generation, and
9984 the long type is only used in the floating point/integer conversion
9985 instructions.
9551 9986
9552 GCC's implementation of the high-level language interface available from 9987 GCC's implementation of the high-level language interface available from
9553 C and C++ code differs from Motorola's documentation in several ways. 9988 C and C++ code differs from Motorola's documentation in several ways.
9554 9989
9555 @itemize @bullet 9990 @itemize @bullet
9811 10246
9812 vector signed char vec_vavgsb (vector signed char, vector signed char); 10247 vector signed char vec_vavgsb (vector signed char, vector signed char);
9813 10248
9814 vector unsigned char vec_vavgub (vector unsigned char, 10249 vector unsigned char vec_vavgub (vector unsigned char,
9815 vector unsigned char); 10250 vector unsigned char);
10251
10252 vector float vec_copysign (vector float);
9816 10253
9817 vector float vec_ceil (vector float); 10254 vector float vec_ceil (vector float);
9818 10255
9819 vector signed int vec_cmpb (vector float, vector float); 10256 vector signed int vec_cmpb (vector float, vector float);
9820 10257
11414 int vec_any_numeric (vector float); 11851 int vec_any_numeric (vector float);
11415 11852
11416 int vec_any_out (vector float, vector float); 11853 int vec_any_out (vector float, vector float);
11417 @end smallexample 11854 @end smallexample
11418 11855
11856 If the vector/scalar (VSX) instruction set is available, the following
11857 additional functions are available:
11858
11859 @smallexample
11860 vector double vec_abs (vector double);
11861 vector double vec_add (vector double, vector double);
11862 vector double vec_and (vector double, vector double);
11863 vector double vec_and (vector double, vector bool long);
11864 vector double vec_and (vector bool long, vector double);
11865 vector double vec_andc (vector double, vector double);
11866 vector double vec_andc (vector double, vector bool long);
11867 vector double vec_andc (vector bool long, vector double);
11868 vector double vec_ceil (vector double);
11869 vector bool long vec_cmpeq (vector double, vector double);
11870 vector bool long vec_cmpge (vector double, vector double);
11871 vector bool long vec_cmpgt (vector double, vector double);
11872 vector bool long vec_cmple (vector double, vector double);
11873 vector bool long vec_cmplt (vector double, vector double);
11874 vector float vec_div (vector float, vector float);
11875 vector double vec_div (vector double, vector double);
11876 vector double vec_floor (vector double);
11877 vector double vec_madd (vector double, vector double, vector double);
11878 vector double vec_max (vector double, vector double);
11879 vector double vec_min (vector double, vector double);
11880 vector float vec_msub (vector float, vector float, vector float);
11881 vector double vec_msub (vector double, vector double, vector double);
11882 vector float vec_mul (vector float, vector float);
11883 vector double vec_mul (vector double, vector double);
11884 vector float vec_nearbyint (vector float);
11885 vector double vec_nearbyint (vector double);
11886 vector float vec_nmadd (vector float, vector float, vector float);
11887 vector double vec_nmadd (vector double, vector double, vector double);
11888 vector double vec_nmsub (vector double, vector double, vector double);
11889 vector double vec_nor (vector double, vector double);
11890 vector double vec_or (vector double, vector double);
11891 vector double vec_or (vector double, vector bool long);
11892 vector double vec_or (vector bool long, vector double);
11893 vector double vec_perm (vector double,
11894 vector double,
11895 vector unsigned char);
11896 vector float vec_rint (vector float);
11897 vector double vec_rint (vector double);
11898 vector double vec_sel (vector double, vector double, vector bool long);
11899 vector double vec_sel (vector double, vector double, vector unsigned long);
11900 vector double vec_sub (vector double, vector double);
11901 vector float vec_sqrt (vector float);
11902 vector double vec_sqrt (vector double);
11903 vector double vec_trunc (vector double);
11904 vector double vec_xor (vector double, vector double);
11905 vector double vec_xor (vector double, vector bool long);
11906 vector double vec_xor (vector bool long, vector double);
11907 int vec_all_eq (vector double, vector double);
11908 int vec_all_ge (vector double, vector double);
11909 int vec_all_gt (vector double, vector double);
11910 int vec_all_le (vector double, vector double);
11911 int vec_all_lt (vector double, vector double);
11912 int vec_all_nan (vector double);
11913 int vec_all_ne (vector double, vector double);
11914 int vec_all_nge (vector double, vector double);
11915 int vec_all_ngt (vector double, vector double);
11916 int vec_all_nle (vector double, vector double);
11917 int vec_all_nlt (vector double, vector double);
11918 int vec_all_numeric (vector double);
11919 int vec_any_eq (vector double, vector double);
11920 int vec_any_ge (vector double, vector double);
11921 int vec_any_gt (vector double, vector double);
11922 int vec_any_le (vector double, vector double);
11923 int vec_any_lt (vector double, vector double);
11924 int vec_any_nan (vector double);
11925 int vec_any_ne (vector double, vector double);
11926 int vec_any_nge (vector double, vector double);
11927 int vec_any_ngt (vector double, vector double);
11928 int vec_any_nle (vector double, vector double);
11929 int vec_any_nlt (vector double, vector double);
11930 int vec_any_numeric (vector double);
11931 @end smallexample
11932
11933 GCC provides a few other builtins on Powerpc to access certain instructions:
11934 @smallexample
11935 float __builtin_recipdivf (float, float);
11936 float __builtin_rsqrtf (float);
11937 double __builtin_recipdiv (double, double);
11938 long __builtin_bpermd (long, long);
11939 int __builtin_bswap16 (int);
11940 @end smallexample
11941
11942 @node RX Built-in Functions
11943 @subsection RX Built-in Functions
11944 GCC supports some of the RX instructions which cannot be expressed in
11945 the C programming language via the use of built-in functions. The
11946 following functions are supported:
11947
11948 @deftypefn {Built-in Function} void __builtin_rx_brk (void)
11949 Generates the @code{brk} machine instruction.
11950 @end deftypefn
11951
11952 @deftypefn {Built-in Function} void __builtin_rx_clrpsw (int)
11953 Generates the @code{clrpsw} machine instruction to clear the specified
11954 bit in the processor status word.
11955 @end deftypefn
11956
11957 @deftypefn {Built-in Function} void __builtin_rx_int (int)
11958 Generates the @code{int} machine instruction to generate an interrupt
11959 with the specified value.
11960 @end deftypefn
11961
11962 @deftypefn {Built-in Function} void __builtin_rx_machi (int, int)
11963 Generates the @code{machi} machine instruction to add the result of
11964 multiplying the top 16-bits of the two arguments into the
11965 accumulator.
11966 @end deftypefn
11967
11968 @deftypefn {Built-in Function} void __builtin_rx_maclo (int, int)
11969 Generates the @code{maclo} machine instruction to add the result of
11970 multiplying the bottom 16-bits of the two arguments into the
11971 accumulator.
11972 @end deftypefn
11973
11974 @deftypefn {Built-in Function} void __builtin_rx_mulhi (int, int)
11975 Generates the @code{mulhi} machine instruction to place the result of
11976 multiplying the top 16-bits of the two arguments into the
11977 accumulator.
11978 @end deftypefn
11979
11980 @deftypefn {Built-in Function} void __builtin_rx_mullo (int, int)
11981 Generates the @code{mullo} machine instruction to place the result of
11982 multiplying the bottom 16-bits of the two arguments into the
11983 accumulator.
11984 @end deftypefn
11985
11986 @deftypefn {Built-in Function} int __builtin_rx_mvfachi (void)
11987 Generates the @code{mvfachi} machine instruction to read the top
11988 32-bits of the accumulator.
11989 @end deftypefn
11990
11991 @deftypefn {Built-in Function} int __builtin_rx_mvfacmi (void)
11992 Generates the @code{mvfacmi} machine instruction to read the middle
11993 32-bits of the accumulator.
11994 @end deftypefn
11995
11996 @deftypefn {Built-in Function} int __builtin_rx_mvfc (int)
11997 Generates the @code{mvfc} machine instruction which reads the control
11998 register specified in its argument and returns its value.
11999 @end deftypefn
12000
12001 @deftypefn {Built-in Function} void __builtin_rx_mvtachi (int)
12002 Generates the @code{mvtachi} machine instruction to set the top
12003 32-bits of the accumulator.
12004 @end deftypefn
12005
12006 @deftypefn {Built-in Function} void __builtin_rx_mvtaclo (int)
12007 Generates the @code{mvtaclo} machine instruction to set the bottom
12008 32-bits of the accumulator.
12009 @end deftypefn
12010
12011 @deftypefn {Built-in Function} void __builtin_rx_mvtc (int reg, int val)
12012 Generates the @code{mvtc} machine instruction which sets control
12013 register number @code{reg} to @code{val}.
12014 @end deftypefn
12015
12016 @deftypefn {Built-in Function} void __builtin_rx_mvtipl (int)
12017 Generates the @code{mvtipl} machine instruction set the interrupt
12018 priority level.
12019 @end deftypefn
12020
12021 @deftypefn {Built-in Function} void __builtin_rx_racw (int)
12022 Generates the @code{racw} machine instruction to round the accumulator
12023 according to the specified mode.
12024 @end deftypefn
12025
12026 @deftypefn {Built-in Function} int __builtin_rx_revw (int)
12027 Generates the @code{revw} machine instruction which swaps the bytes in
12028 the argument so that bits 0--7 now occupy bits 8--15 and vice versa,
12029 and also bits 16--23 occupy bits 24--31 and vice versa.
12030 @end deftypefn
12031
12032 @deftypefn {Built-in Function} void __builtin_rx_rmpa (void)
12033 Generates the @code{rmpa} machine instruction which initiates a
12034 repeated multiply and accumulate sequence.
12035 @end deftypefn
12036
12037 @deftypefn {Built-in Function} void __builtin_rx_round (float)
12038 Generates the @code{round} machine instruction which returns the
12039 floating point argument rounded according to the current rounding mode
12040 set in the floating point status word register.
12041 @end deftypefn
12042
12043 @deftypefn {Built-in Function} int __builtin_rx_sat (int)
12044 Generates the @code{sat} machine instruction which returns the
12045 saturated value of the argument.
12046 @end deftypefn
12047
12048 @deftypefn {Built-in Function} void __builtin_rx_setpsw (int)
12049 Generates the @code{setpsw} machine instruction to set the specified
12050 bit in the processor status word.
12051 @end deftypefn
12052
12053 @deftypefn {Built-in Function} void __builtin_rx_wait (void)
12054 Generates the @code{wait} machine instruction.
12055 @end deftypefn
12056
11419 @node SPARC VIS Built-in Functions 12057 @node SPARC VIS Built-in Functions
11420 @subsection SPARC VIS Built-in Functions 12058 @subsection SPARC VIS Built-in Functions
11421 12059
11422 GCC supports SIMD operations on the SPARC using both the generic vector 12060 GCC supports SIMD operations on the SPARC using both the generic vector
11423 extensions (@pxref{Vector Extensions}) as well as built-in functions for 12061 extensions (@pxref{Vector Extensions}) as well as built-in functions for
11541 for further explanation. 12179 for further explanation.
11542 12180
11543 @menu 12181 @menu
11544 * ARM Pragmas:: 12182 * ARM Pragmas::
11545 * M32C Pragmas:: 12183 * M32C Pragmas::
12184 * MeP Pragmas::
11546 * RS/6000 and PowerPC Pragmas:: 12185 * RS/6000 and PowerPC Pragmas::
11547 * Darwin Pragmas:: 12186 * Darwin Pragmas::
11548 * Solaris Pragmas:: 12187 * Solaris Pragmas::
11549 * Symbol-Renaming Pragmas:: 12188 * Symbol-Renaming Pragmas::
11550 * Structure-Packing Pragmas:: 12189 * Structure-Packing Pragmas::
11591 performance-critical function uses a memreg for temporary values, 12230 performance-critical function uses a memreg for temporary values,
11592 as it may allow you to reduce the number of memregs used. 12231 as it may allow you to reduce the number of memregs used.
11593 12232
11594 @end table 12233 @end table
11595 12234
12235 @node MeP Pragmas
12236 @subsection MeP Pragmas
12237
12238 @table @code
12239
12240 @item custom io_volatile (on|off)
12241 @cindex pragma, custom io_volatile
12242 Overrides the command line option @code{-mio-volatile} for the current
12243 file. Note that for compatibility with future GCC releases, this
12244 option should only be used once before any @code{io} variables in each
12245 file.
12246
12247 @item GCC coprocessor available @var{registers}
12248 @cindex pragma, coprocessor available
12249 Specifies which coprocessor registers are available to the register
12250 allocator. @var{registers} may be a single register, register range
12251 separated by ellipses, or comma-separated list of those. Example:
12252
12253 @example
12254 #pragma GCC coprocessor available $c0...$c10, $c28
12255 @end example
12256
12257 @item GCC coprocessor call_saved @var{registers}
12258 @cindex pragma, coprocessor call_saved
12259 Specifies which coprocessor registers are to be saved and restored by
12260 any function using them. @var{registers} may be a single register,
12261 register range separated by ellipses, or comma-separated list of
12262 those. Example:
12263
12264 @example
12265 #pragma GCC coprocessor call_saved $c4...$c6, $c31
12266 @end example
12267
12268 @item GCC coprocessor subclass '(A|B|C|D)' = @var{registers}
12269 @cindex pragma, coprocessor subclass
12270 Creates and defines a register class. These register classes can be
12271 used by inline @code{asm} constructs. @var{registers} may be a single
12272 register, register range separated by ellipses, or comma-separated
12273 list of those. Example:
12274
12275 @example
12276 #pragma GCC coprocessor subclass 'B' = $c2, $c4, $c6
12277
12278 asm ("cpfoo %0" : "=B" (x));
12279 @end example
12280
12281 @item GCC disinterrupt @var{name} , @var{name} @dots{}
12282 @cindex pragma, disinterrupt
12283 For the named functions, the compiler adds code to disable interrupts
12284 for the duration of those functions. Any functions so named, which
12285 are not encountered in the source, cause a warning that the pragma was
12286 not used. Examples:
12287
12288 @example
12289 #pragma disinterrupt foo
12290 #pragma disinterrupt bar, grill
12291 int foo () @{ @dots{} @}
12292 @end example
12293
12294 @item GCC call @var{name} , @var{name} @dots{}
12295 @cindex pragma, call
12296 For the named functions, the compiler always uses a register-indirect
12297 call model when calling the named functions. Examples:
12298
12299 @example
12300 extern int foo ();
12301 #pragma call foo
12302 @end example
12303
12304 @end table
12305
11596 @node RS/6000 and PowerPC Pragmas 12306 @node RS/6000 and PowerPC Pragmas
11597 @subsection RS/6000 and PowerPC Pragmas 12307 @subsection RS/6000 and PowerPC Pragmas
11598 12308
11599 The RS/6000 and PowerPC targets define one pragma for controlling 12309 The RS/6000 and PowerPC targets define one pragma for controlling
11600 whether or not the @code{longcall} attribute is added to function 12310 whether or not the @code{longcall} attribute is added to function
11687 @node Symbol-Renaming Pragmas 12397 @node Symbol-Renaming Pragmas
11688 @subsection Symbol-Renaming Pragmas 12398 @subsection Symbol-Renaming Pragmas
11689 12399
11690 For compatibility with the Solaris and Tru64 UNIX system headers, GCC 12400 For compatibility with the Solaris and Tru64 UNIX system headers, GCC
11691 supports two @code{#pragma} directives which change the name used in 12401 supports two @code{#pragma} directives which change the name used in
11692 assembly for a given declaration. These pragmas are only available on 12402 assembly for a given declaration. @code{#pragma_extern_prefix} is only
11693 platforms whose system headers need them. To get this effect on all 12403 available on platforms whose system headers need it. To get this effect
11694 platforms supported by GCC, use the asm labels extension (@pxref{Asm 12404 on all platforms supported by GCC, use the asm labels extension (@pxref{Asm
11695 Labels}). 12405 Labels}).
11696 12406
11697 @table @code 12407 @table @code
11698 @item redefine_extname @var{oldname} @var{newname} 12408 @item redefine_extname @var{oldname} @var{newname}
11699 @cindex pragma, redefine_extname 12409 @cindex pragma, redefine_extname
11700 12410
11701 This pragma gives the C function @var{oldname} the assembly symbol 12411 This pragma gives the C function @var{oldname} the assembly symbol
11702 @var{newname}. The preprocessor macro @code{__PRAGMA_REDEFINE_EXTNAME} 12412 @var{newname}. The preprocessor macro @code{__PRAGMA_REDEFINE_EXTNAME}
11703 will be defined if this pragma is available (currently only on 12413 will be defined if this pragma is available (currently on all platforms).
11704 Solaris).
11705 12414
11706 @item extern_prefix @var{string} 12415 @item extern_prefix @var{string}
11707 @cindex pragma, extern_prefix 12416 @cindex pragma, extern_prefix
11708 12417
11709 This pragma causes all subsequent external function and variable 12418 This pragma causes all subsequent external function and variable