b06661ef7c50f66471528f1651a9d0005ee6b0d9
[dragonfly.git] / contrib / gcc-5.0 / gcc / doc / extend.texi
1 @c Copyright (C) 1988-2015 Free Software Foundation, Inc.
2
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @node C Extensions
7 @chapter Extensions to the C Language Family
8 @cindex extensions, C language
9 @cindex C language extensions
10
11 @opindex pedantic
12 GNU C provides several language features not found in ISO standard C@.
13 (The @option{-pedantic} option directs GCC to print a warning message if
14 any of these features is used.)  To test for the availability of these
15 features in conditional compilation, check for a predefined macro
16 @code{__GNUC__}, which is always defined under GCC@.
17
18 These extensions are available in C and Objective-C@.  Most of them are
19 also available in C++.  @xref{C++ Extensions,,Extensions to the
20 C++ Language}, for extensions that apply @emph{only} to C++.
21
22 Some features that are in ISO C99 but not C90 or C++ are also, as
23 extensions, accepted by GCC in C90 mode and in C++.
24
25 @menu
26 * Statement Exprs::     Putting statements and declarations inside expressions.
27 * Local Labels::        Labels local to a block.
28 * Labels as Values::    Getting pointers to labels, and computed gotos.
29 * Nested Functions::    As in Algol and Pascal, lexical scoping of functions.
30 * Constructing Calls::  Dispatching a call to another function.
31 * Typeof::              @code{typeof}: referring to the type of an expression.
32 * Conditionals::        Omitting the middle operand of a @samp{?:} expression.
33 * __int128::            128-bit integers---@code{__int128}.
34 * Long Long::           Double-word integers---@code{long long int}.
35 * Complex::             Data types for complex numbers.
36 * Floating Types::      Additional Floating Types.
37 * Half-Precision::      Half-Precision Floating Point.
38 * Decimal Float::       Decimal Floating Types.
39 * Hex Floats::          Hexadecimal floating-point constants.
40 * Fixed-Point::         Fixed-Point Types.
41 * Named Address Spaces::Named address spaces.
42 * Zero Length::         Zero-length arrays.
43 * Empty Structures::    Structures with no members.
44 * Variable Length::     Arrays whose length is computed at run time.
45 * Variadic Macros::     Macros with a variable number of arguments.
46 * Escaped Newlines::    Slightly looser rules for escaped newlines.
47 * Subscripting::        Any array can be subscripted, even if not an lvalue.
48 * Pointer Arith::       Arithmetic on @code{void}-pointers and function pointers.
49 * Pointers to Arrays::  Pointers to arrays with qualifiers work as expected.
50 * Initializers::        Non-constant initializers.
51 * Compound Literals::   Compound literals give structures, unions
52                         or arrays as values.
53 * Designated Inits::    Labeling elements of initializers.
54 * Case Ranges::         `case 1 ... 9' and such.
55 * Cast to Union::       Casting to union type from any member of the union.
56 * Mixed Declarations::  Mixing declarations and code.
57 * Function Attributes:: Declaring that functions have no side effects,
58                         or that they can never return.
59 * Label Attributes::    Specifying attributes on labels.
60 * Attribute Syntax::    Formal syntax for attributes.
61 * Function Prototypes:: Prototype declarations and old-style definitions.
62 * C++ Comments::        C++ comments are recognized.
63 * Dollar Signs::        Dollar sign is allowed in identifiers.
64 * Character Escapes::   @samp{\e} stands for the character @key{ESC}.
65 * Variable Attributes:: Specifying attributes of variables.
66 * Type Attributes::     Specifying attributes of types.
67 * Alignment::           Inquiring about the alignment of a type or variable.
68 * Inline::              Defining inline functions (as fast as macros).
69 * Volatiles::           What constitutes an access to a volatile object.
70 * Using Assembly Language with C:: Instructions and extensions for interfacing C with assembler.
71 * Alternate Keywords::  @code{__const__}, @code{__asm__}, etc., for header files.
72 * Incomplete Enums::    @code{enum foo;}, with details to follow.
73 * Function Names::      Printable strings which are the name of the current
74                         function.
75 * Return Address::      Getting the return or frame address of a function.
76 * Vector Extensions::   Using vector instructions through built-in functions.
77 * Offsetof::            Special syntax for implementing @code{offsetof}.
78 * __sync Builtins::     Legacy built-in functions for atomic memory access.
79 * __atomic Builtins::   Atomic built-in functions with memory model.
80 * Integer Overflow Builtins:: Built-in functions to perform arithmetics and
81                         arithmetic overflow checking.
82 * x86 specific memory model extensions for transactional memory:: x86 memory models.
83 * Object Size Checking:: Built-in functions for limited buffer overflow
84                         checking.
85 * Pointer Bounds Checker builtins:: Built-in functions for Pointer Bounds Checker.
86 * Cilk Plus Builtins::  Built-in functions for the Cilk Plus language extension.
87 * Other Builtins::      Other built-in functions.
88 * Target Builtins::     Built-in functions specific to particular targets.
89 * Target Format Checks:: Format checks specific to particular targets.
90 * Pragmas::             Pragmas accepted by GCC.
91 * Unnamed Fields::      Unnamed struct/union fields within structs/unions.
92 * Thread-Local::        Per-thread variables.
93 * Binary constants::    Binary constants using the @samp{0b} prefix.
94 @end menu
95
96 @node Statement Exprs
97 @section Statements and Declarations in Expressions
98 @cindex statements inside expressions
99 @cindex declarations inside expressions
100 @cindex expressions containing statements
101 @cindex macros, statements in expressions
102
103 @c the above section title wrapped and causes an underfull hbox.. i
104 @c changed it from "within" to "in". --mew 4feb93
105 A compound statement enclosed in parentheses may appear as an expression
106 in GNU C@.  This allows you to use loops, switches, and local variables
107 within an expression.
108
109 Recall that a compound statement is a sequence of statements surrounded
110 by braces; in this construct, parentheses go around the braces.  For
111 example:
112
113 @smallexample
114 (@{ int y = foo (); int z;
115    if (y > 0) z = y;
116    else z = - y;
117    z; @})
118 @end smallexample
119
120 @noindent
121 is a valid (though slightly more complex than necessary) expression
122 for the absolute value of @code{foo ()}.
123
124 The last thing in the compound statement should be an expression
125 followed by a semicolon; the value of this subexpression serves as the
126 value of the entire construct.  (If you use some other kind of statement
127 last within the braces, the construct has type @code{void}, and thus
128 effectively no value.)
129
130 This feature is especially useful in making macro definitions ``safe'' (so
131 that they evaluate each operand exactly once).  For example, the
132 ``maximum'' function is commonly defined as a macro in standard C as
133 follows:
134
135 @smallexample
136 #define max(a,b) ((a) > (b) ? (a) : (b))
137 @end smallexample
138
139 @noindent
140 @cindex side effects, macro argument
141 But this definition computes either @var{a} or @var{b} twice, with bad
142 results if the operand has side effects.  In GNU C, if you know the
143 type of the operands (here taken as @code{int}), you can define
144 the macro safely as follows:
145
146 @smallexample
147 #define maxint(a,b) \
148   (@{int _a = (a), _b = (b); _a > _b ? _a : _b; @})
149 @end smallexample
150
151 Embedded statements are not allowed in constant expressions, such as
152 the value of an enumeration constant, the width of a bit-field, or
153 the initial value of a static variable.
154
155 If you don't know the type of the operand, you can still do this, but you
156 must use @code{typeof} or @code{__auto_type} (@pxref{Typeof}).
157
158 In G++, the result value of a statement expression undergoes array and
159 function pointer decay, and is returned by value to the enclosing
160 expression.  For instance, if @code{A} is a class, then
161
162 @smallexample
163         A a;
164
165         (@{a;@}).Foo ()
166 @end smallexample
167
168 @noindent
169 constructs a temporary @code{A} object to hold the result of the
170 statement expression, and that is used to invoke @code{Foo}.
171 Therefore the @code{this} pointer observed by @code{Foo} is not the
172 address of @code{a}.
173
174 In a statement expression, any temporaries created within a statement
175 are destroyed at that statement's end.  This makes statement
176 expressions inside macros slightly different from function calls.  In
177 the latter case temporaries introduced during argument evaluation are
178 destroyed at the end of the statement that includes the function
179 call.  In the statement expression case they are destroyed during
180 the statement expression.  For instance,
181
182 @smallexample
183 #define macro(a)  (@{__typeof__(a) b = (a); b + 3; @})
184 template<typename T> T function(T a) @{ T b = a; return b + 3; @}
185
186 void foo ()
187 @{
188   macro (X ());
189   function (X ());
190 @}
191 @end smallexample
192
193 @noindent
194 has different places where temporaries are destroyed.  For the
195 @code{macro} case, the temporary @code{X} is destroyed just after
196 the initialization of @code{b}.  In the @code{function} case that
197 temporary is destroyed when the function returns.
198
199 These considerations mean that it is probably a bad idea to use
200 statement expressions of this form in header files that are designed to
201 work with C++.  (Note that some versions of the GNU C Library contained
202 header files using statement expressions that lead to precisely this
203 bug.)
204
205 Jumping into a statement expression with @code{goto} or using a
206 @code{switch} statement outside the statement expression with a
207 @code{case} or @code{default} label inside the statement expression is
208 not permitted.  Jumping into a statement expression with a computed
209 @code{goto} (@pxref{Labels as Values}) has undefined behavior.
210 Jumping out of a statement expression is permitted, but if the
211 statement expression is part of a larger expression then it is
212 unspecified which other subexpressions of that expression have been
213 evaluated except where the language definition requires certain
214 subexpressions to be evaluated before or after the statement
215 expression.  In any case, as with a function call, the evaluation of a
216 statement expression is not interleaved with the evaluation of other
217 parts of the containing expression.  For example,
218
219 @smallexample
220   foo (), ((@{ bar1 (); goto a; 0; @}) + bar2 ()), baz();
221 @end smallexample
222
223 @noindent
224 calls @code{foo} and @code{bar1} and does not call @code{baz} but
225 may or may not call @code{bar2}.  If @code{bar2} is called, it is
226 called after @code{foo} and before @code{bar1}.
227
228 @node Local Labels
229 @section Locally Declared Labels
230 @cindex local labels
231 @cindex macros, local labels
232
233 GCC allows you to declare @dfn{local labels} in any nested block
234 scope.  A local label is just like an ordinary label, but you can
235 only reference it (with a @code{goto} statement, or by taking its
236 address) within the block in which it is declared.
237
238 A local label declaration looks like this:
239
240 @smallexample
241 __label__ @var{label};
242 @end smallexample
243
244 @noindent
245 or
246
247 @smallexample
248 __label__ @var{label1}, @var{label2}, /* @r{@dots{}} */;
249 @end smallexample
250
251 Local label declarations must come at the beginning of the block,
252 before any ordinary declarations or statements.
253
254 The label declaration defines the label @emph{name}, but does not define
255 the label itself.  You must do this in the usual way, with
256 @code{@var{label}:}, within the statements of the statement expression.
257
258 The local label feature is useful for complex macros.  If a macro
259 contains nested loops, a @code{goto} can be useful for breaking out of
260 them.  However, an ordinary label whose scope is the whole function
261 cannot be used: if the macro can be expanded several times in one
262 function, the label is multiply defined in that function.  A
263 local label avoids this problem.  For example:
264
265 @smallexample
266 #define SEARCH(value, array, target)              \
267 do @{                                              \
268   __label__ found;                                \
269   typeof (target) _SEARCH_target = (target);      \
270   typeof (*(array)) *_SEARCH_array = (array);     \
271   int i, j;                                       \
272   int value;                                      \
273   for (i = 0; i < max; i++)                       \
274     for (j = 0; j < max; j++)                     \
275       if (_SEARCH_array[i][j] == _SEARCH_target)  \
276         @{ (value) = i; goto found; @}              \
277   (value) = -1;                                   \
278  found:;                                          \
279 @} while (0)
280 @end smallexample
281
282 This could also be written using a statement expression:
283
284 @smallexample
285 #define SEARCH(array, target)                     \
286 (@{                                                \
287   __label__ found;                                \
288   typeof (target) _SEARCH_target = (target);      \
289   typeof (*(array)) *_SEARCH_array = (array);     \
290   int i, j;                                       \
291   int value;                                      \
292   for (i = 0; i < max; i++)                       \
293     for (j = 0; j < max; j++)                     \
294       if (_SEARCH_array[i][j] == _SEARCH_target)  \
295         @{ value = i; goto found; @}                \
296   value = -1;                                     \
297  found:                                           \
298   value;                                          \
299 @})
300 @end smallexample
301
302 Local label declarations also make the labels they declare visible to
303 nested functions, if there are any.  @xref{Nested Functions}, for details.
304
305 @node Labels as Values
306 @section Labels as Values
307 @cindex labels as values
308 @cindex computed gotos
309 @cindex goto with computed label
310 @cindex address of a label
311
312 You can get the address of a label defined in the current function
313 (or a containing function) with the unary operator @samp{&&}.  The
314 value has type @code{void *}.  This value is a constant and can be used
315 wherever a constant of that type is valid.  For example:
316
317 @smallexample
318 void *ptr;
319 /* @r{@dots{}} */
320 ptr = &&foo;
321 @end smallexample
322
323 To use these values, you need to be able to jump to one.  This is done
324 with the computed goto statement@footnote{The analogous feature in
325 Fortran is called an assigned goto, but that name seems inappropriate in
326 C, where one can do more than simply store label addresses in label
327 variables.}, @code{goto *@var{exp};}.  For example,
328
329 @smallexample
330 goto *ptr;
331 @end smallexample
332
333 @noindent
334 Any expression of type @code{void *} is allowed.
335
336 One way of using these constants is in initializing a static array that
337 serves as a jump table:
338
339 @smallexample
340 static void *array[] = @{ &&foo, &&bar, &&hack @};
341 @end smallexample
342
343 @noindent
344 Then you can select a label with indexing, like this:
345
346 @smallexample
347 goto *array[i];
348 @end smallexample
349
350 @noindent
351 Note that this does not check whether the subscript is in bounds---array
352 indexing in C never does that.
353
354 Such an array of label values serves a purpose much like that of the
355 @code{switch} statement.  The @code{switch} statement is cleaner, so
356 use that rather than an array unless the problem does not fit a
357 @code{switch} statement very well.
358
359 Another use of label values is in an interpreter for threaded code.
360 The labels within the interpreter function can be stored in the
361 threaded code for super-fast dispatching.
362
363 You may not use this mechanism to jump to code in a different function.
364 If you do that, totally unpredictable things happen.  The best way to
365 avoid this is to store the label address only in automatic variables and
366 never pass it as an argument.
367
368 An alternate way to write the above example is
369
370 @smallexample
371 static const int array[] = @{ &&foo - &&foo, &&bar - &&foo,
372                              &&hack - &&foo @};
373 goto *(&&foo + array[i]);
374 @end smallexample
375
376 @noindent
377 This is more friendly to code living in shared libraries, as it reduces
378 the number of dynamic relocations that are needed, and by consequence,
379 allows the data to be read-only.
380 This alternative with label differences is not supported for the AVR target,
381 please use the first approach for AVR programs.
382
383 The @code{&&foo} expressions for the same label might have different
384 values if the containing function is inlined or cloned.  If a program
385 relies on them being always the same,
386 @code{__attribute__((__noinline__,__noclone__))} should be used to
387 prevent inlining and cloning.  If @code{&&foo} is used in a static
388 variable initializer, inlining and cloning is forbidden.
389
390 @node Nested Functions
391 @section Nested Functions
392 @cindex nested functions
393 @cindex downward funargs
394 @cindex thunks
395
396 A @dfn{nested function} is a function defined inside another function.
397 Nested functions are supported as an extension in GNU C, but are not
398 supported by GNU C++.
399
400 The nested function's name is local to the block where it is defined.
401 For example, here we define a nested function named @code{square}, and
402 call it twice:
403
404 @smallexample
405 @group
406 foo (double a, double b)
407 @{
408   double square (double z) @{ return z * z; @}
409
410   return square (a) + square (b);
411 @}
412 @end group
413 @end smallexample
414
415 The nested function can access all the variables of the containing
416 function that are visible at the point of its definition.  This is
417 called @dfn{lexical scoping}.  For example, here we show a nested
418 function which uses an inherited variable named @code{offset}:
419
420 @smallexample
421 @group
422 bar (int *array, int offset, int size)
423 @{
424   int access (int *array, int index)
425     @{ return array[index + offset]; @}
426   int i;
427   /* @r{@dots{}} */
428   for (i = 0; i < size; i++)
429     /* @r{@dots{}} */ access (array, i) /* @r{@dots{}} */
430 @}
431 @end group
432 @end smallexample
433
434 Nested function definitions are permitted within functions in the places
435 where variable definitions are allowed; that is, in any block, mixed
436 with the other declarations and statements in the block.
437
438 It is possible to call the nested function from outside the scope of its
439 name by storing its address or passing the address to another function:
440
441 @smallexample
442 hack (int *array, int size)
443 @{
444   void store (int index, int value)
445     @{ array[index] = value; @}
446
447   intermediate (store, size);
448 @}
449 @end smallexample
450
451 Here, the function @code{intermediate} receives the address of
452 @code{store} as an argument.  If @code{intermediate} calls @code{store},
453 the arguments given to @code{store} are used to store into @code{array}.
454 But this technique works only so long as the containing function
455 (@code{hack}, in this example) does not exit.
456
457 If you try to call the nested function through its address after the
458 containing function exits, all hell breaks loose.  If you try
459 to call it after a containing scope level exits, and if it refers
460 to some of the variables that are no longer in scope, you may be lucky,
461 but it's not wise to take the risk.  If, however, the nested function
462 does not refer to anything that has gone out of scope, you should be
463 safe.
464
465 GCC implements taking the address of a nested function using a technique
466 called @dfn{trampolines}.  This technique was described in
467 @cite{Lexical Closures for C++} (Thomas M. Breuel, USENIX
468 C++ Conference Proceedings, October 17-21, 1988).
469
470 A nested function can jump to a label inherited from a containing
471 function, provided the label is explicitly declared in the containing
472 function (@pxref{Local Labels}).  Such a jump returns instantly to the
473 containing function, exiting the nested function that did the
474 @code{goto} and any intermediate functions as well.  Here is an example:
475
476 @smallexample
477 @group
478 bar (int *array, int offset, int size)
479 @{
480   __label__ failure;
481   int access (int *array, int index)
482     @{
483       if (index > size)
484         goto failure;
485       return array[index + offset];
486     @}
487   int i;
488   /* @r{@dots{}} */
489   for (i = 0; i < size; i++)
490     /* @r{@dots{}} */ access (array, i) /* @r{@dots{}} */
491   /* @r{@dots{}} */
492   return 0;
493
494  /* @r{Control comes here from @code{access}
495     if it detects an error.}  */
496  failure:
497   return -1;
498 @}
499 @end group
500 @end smallexample
501
502 A nested function always has no linkage.  Declaring one with
503 @code{extern} or @code{static} is erroneous.  If you need to declare the nested function
504 before its definition, use @code{auto} (which is otherwise meaningless
505 for function declarations).
506
507 @smallexample
508 bar (int *array, int offset, int size)
509 @{
510   __label__ failure;
511   auto int access (int *, int);
512   /* @r{@dots{}} */
513   int access (int *array, int index)
514     @{
515       if (index > size)
516         goto failure;
517       return array[index + offset];
518     @}
519   /* @r{@dots{}} */
520 @}
521 @end smallexample
522
523 @node Constructing Calls
524 @section Constructing Function Calls
525 @cindex constructing calls
526 @cindex forwarding calls
527
528 Using the built-in functions described below, you can record
529 the arguments a function received, and call another function
530 with the same arguments, without knowing the number or types
531 of the arguments.
532
533 You can also record the return value of that function call,
534 and later return that value, without knowing what data type
535 the function tried to return (as long as your caller expects
536 that data type).
537
538 However, these built-in functions may interact badly with some
539 sophisticated features or other extensions of the language.  It
540 is, therefore, not recommended to use them outside very simple
541 functions acting as mere forwarders for their arguments.
542
543 @deftypefn {Built-in Function} {void *} __builtin_apply_args ()
544 This built-in function returns a pointer to data
545 describing how to perform a call with the same arguments as are passed
546 to the current function.
547
548 The function saves the arg pointer register, structure value address,
549 and all registers that might be used to pass arguments to a function
550 into a block of memory allocated on the stack.  Then it returns the
551 address of that block.
552 @end deftypefn
553
554 @deftypefn {Built-in Function} {void *} __builtin_apply (void (*@var{function})(), void *@var{arguments}, size_t @var{size})
555 This built-in function invokes @var{function}
556 with a copy of the parameters described by @var{arguments}
557 and @var{size}.
558
559 The value of @var{arguments} should be the value returned by
560 @code{__builtin_apply_args}.  The argument @var{size} specifies the size
561 of the stack argument data, in bytes.
562
563 This function returns a pointer to data describing
564 how to return whatever value is returned by @var{function}.  The data
565 is saved in a block of memory allocated on the stack.
566
567 It is not always simple to compute the proper value for @var{size}.  The
568 value is used by @code{__builtin_apply} to compute the amount of data
569 that should be pushed on the stack and copied from the incoming argument
570 area.
571 @end deftypefn
572
573 @deftypefn {Built-in Function} {void} __builtin_return (void *@var{result})
574 This built-in function returns the value described by @var{result} from
575 the containing function.  You should specify, for @var{result}, a value
576 returned by @code{__builtin_apply}.
577 @end deftypefn
578
579 @deftypefn {Built-in Function} {} __builtin_va_arg_pack ()
580 This built-in function represents all anonymous arguments of an inline
581 function.  It can be used only in inline functions that are always
582 inlined, never compiled as a separate function, such as those using
583 @code{__attribute__ ((__always_inline__))} or
584 @code{__attribute__ ((__gnu_inline__))} extern inline functions.
585 It must be only passed as last argument to some other function
586 with variable arguments.  This is useful for writing small wrapper
587 inlines for variable argument functions, when using preprocessor
588 macros is undesirable.  For example:
589 @smallexample
590 extern int myprintf (FILE *f, const char *format, ...);
591 extern inline __attribute__ ((__gnu_inline__)) int
592 myprintf (FILE *f, const char *format, ...)
593 @{
594   int r = fprintf (f, "myprintf: ");
595   if (r < 0)
596     return r;
597   int s = fprintf (f, format, __builtin_va_arg_pack ());
598   if (s < 0)
599     return s;
600   return r + s;
601 @}
602 @end smallexample
603 @end deftypefn
604
605 @deftypefn {Built-in Function} {size_t} __builtin_va_arg_pack_len ()
606 This built-in function returns the number of anonymous arguments of
607 an inline function.  It can be used only in inline functions that
608 are always inlined, never compiled as a separate function, such
609 as those using @code{__attribute__ ((__always_inline__))} or
610 @code{__attribute__ ((__gnu_inline__))} extern inline functions.
611 For example following does link- or run-time checking of open
612 arguments for optimized code:
613 @smallexample
614 #ifdef __OPTIMIZE__
615 extern inline __attribute__((__gnu_inline__)) int
616 myopen (const char *path, int oflag, ...)
617 @{
618   if (__builtin_va_arg_pack_len () > 1)
619     warn_open_too_many_arguments ();
620
621   if (__builtin_constant_p (oflag))
622     @{
623       if ((oflag & O_CREAT) != 0 && __builtin_va_arg_pack_len () < 1)
624         @{
625           warn_open_missing_mode ();
626           return __open_2 (path, oflag);
627         @}
628       return open (path, oflag, __builtin_va_arg_pack ());
629     @}
630
631   if (__builtin_va_arg_pack_len () < 1)
632     return __open_2 (path, oflag);
633
634   return open (path, oflag, __builtin_va_arg_pack ());
635 @}
636 #endif
637 @end smallexample
638 @end deftypefn
639
640 @node Typeof
641 @section Referring to a Type with @code{typeof}
642 @findex typeof
643 @findex sizeof
644 @cindex macros, types of arguments
645
646 Another way to refer to the type of an expression is with @code{typeof}.
647 The syntax of using of this keyword looks like @code{sizeof}, but the
648 construct acts semantically like a type name defined with @code{typedef}.
649
650 There are two ways of writing the argument to @code{typeof}: with an
651 expression or with a type.  Here is an example with an expression:
652
653 @smallexample
654 typeof (x[0](1))
655 @end smallexample
656
657 @noindent
658 This assumes that @code{x} is an array of pointers to functions;
659 the type described is that of the values of the functions.
660
661 Here is an example with a typename as the argument:
662
663 @smallexample
664 typeof (int *)
665 @end smallexample
666
667 @noindent
668 Here the type described is that of pointers to @code{int}.
669
670 If you are writing a header file that must work when included in ISO C
671 programs, write @code{__typeof__} instead of @code{typeof}.
672 @xref{Alternate Keywords}.
673
674 A @code{typeof} construct can be used anywhere a typedef name can be
675 used.  For example, you can use it in a declaration, in a cast, or inside
676 of @code{sizeof} or @code{typeof}.
677
678 The operand of @code{typeof} is evaluated for its side effects if and
679 only if it is an expression of variably modified type or the name of
680 such a type.
681
682 @code{typeof} is often useful in conjunction with
683 statement expressions (@pxref{Statement Exprs}).
684 Here is how the two together can
685 be used to define a safe ``maximum'' macro which operates on any
686 arithmetic type and evaluates each of its arguments exactly once:
687
688 @smallexample
689 #define max(a,b) \
690   (@{ typeof (a) _a = (a); \
691       typeof (b) _b = (b); \
692     _a > _b ? _a : _b; @})
693 @end smallexample
694
695 @cindex underscores in variables in macros
696 @cindex @samp{_} in variables in macros
697 @cindex local variables in macros
698 @cindex variables, local, in macros
699 @cindex macros, local variables in
700
701 The reason for using names that start with underscores for the local
702 variables is to avoid conflicts with variable names that occur within the
703 expressions that are substituted for @code{a} and @code{b}.  Eventually we
704 hope to design a new form of declaration syntax that allows you to declare
705 variables whose scopes start only after their initializers; this will be a
706 more reliable way to prevent such conflicts.
707
708 @noindent
709 Some more examples of the use of @code{typeof}:
710
711 @itemize @bullet
712 @item
713 This declares @code{y} with the type of what @code{x} points to.
714
715 @smallexample
716 typeof (*x) y;
717 @end smallexample
718
719 @item
720 This declares @code{y} as an array of such values.
721
722 @smallexample
723 typeof (*x) y[4];
724 @end smallexample
725
726 @item
727 This declares @code{y} as an array of pointers to characters:
728
729 @smallexample
730 typeof (typeof (char *)[4]) y;
731 @end smallexample
732
733 @noindent
734 It is equivalent to the following traditional C declaration:
735
736 @smallexample
737 char *y[4];
738 @end smallexample
739
740 To see the meaning of the declaration using @code{typeof}, and why it
741 might be a useful way to write, rewrite it with these macros:
742
743 @smallexample
744 #define pointer(T)  typeof(T *)
745 #define array(T, N) typeof(T [N])
746 @end smallexample
747
748 @noindent
749 Now the declaration can be rewritten this way:
750
751 @smallexample
752 array (pointer (char), 4) y;
753 @end smallexample
754
755 @noindent
756 Thus, @code{array (pointer (char), 4)} is the type of arrays of 4
757 pointers to @code{char}.
758 @end itemize
759
760 In GNU C, but not GNU C++, you may also declare the type of a variable
761 as @code{__auto_type}.  In that case, the declaration must declare
762 only one variable, whose declarator must just be an identifier, the
763 declaration must be initialized, and the type of the variable is
764 determined by the initializer; the name of the variable is not in
765 scope until after the initializer.  (In C++, you should use C++11
766 @code{auto} for this purpose.)  Using @code{__auto_type}, the
767 ``maximum'' macro above could be written as:
768
769 @smallexample
770 #define max(a,b) \
771   (@{ __auto_type _a = (a); \
772       __auto_type _b = (b); \
773     _a > _b ? _a : _b; @})
774 @end smallexample
775
776 Using @code{__auto_type} instead of @code{typeof} has two advantages:
777
778 @itemize @bullet
779 @item Each argument to the macro appears only once in the expansion of
780 the macro.  This prevents the size of the macro expansion growing
781 exponentially when calls to such macros are nested inside arguments of
782 such macros.
783
784 @item If the argument to the macro has variably modified type, it is
785 evaluated only once when using @code{__auto_type}, but twice if
786 @code{typeof} is used.
787 @end itemize
788
789 @emph{Compatibility Note:} In addition to @code{typeof}, GCC 2 supported
790 a more limited extension that permitted one to write
791
792 @smallexample
793 typedef @var{T} = @var{expr};
794 @end smallexample
795
796 @noindent
797 with the effect of declaring @var{T} to have the type of the expression
798 @var{expr}.  This extension does not work with GCC 3 (versions between
799 3.0 and 3.2 crash; 3.2.1 and later give an error).  Code that
800 relies on it should be rewritten to use @code{typeof}:
801
802 @smallexample
803 typedef typeof(@var{expr}) @var{T};
804 @end smallexample
805
806 @noindent
807 This works with all versions of GCC@.
808
809 @node Conditionals
810 @section Conditionals with Omitted Operands
811 @cindex conditional expressions, extensions
812 @cindex omitted middle-operands
813 @cindex middle-operands, omitted
814 @cindex extensions, @code{?:}
815 @cindex @code{?:} extensions
816
817 The middle operand in a conditional expression may be omitted.  Then
818 if the first operand is nonzero, its value is the value of the conditional
819 expression.
820
821 Therefore, the expression
822
823 @smallexample
824 x ? : y
825 @end smallexample
826
827 @noindent
828 has the value of @code{x} if that is nonzero; otherwise, the value of
829 @code{y}.
830
831 This example is perfectly equivalent to
832
833 @smallexample
834 x ? x : y
835 @end smallexample
836
837 @cindex side effect in @code{?:}
838 @cindex @code{?:} side effect
839 @noindent
840 In this simple case, the ability to omit the middle operand is not
841 especially useful.  When it becomes useful is when the first operand does,
842 or may (if it is a macro argument), contain a side effect.  Then repeating
843 the operand in the middle would perform the side effect twice.  Omitting
844 the middle operand uses the value already computed without the undesirable
845 effects of recomputing it.
846
847 @node __int128
848 @section 128-bit integers
849 @cindex @code{__int128} data types
850
851 As an extension the integer scalar type @code{__int128} is supported for
852 targets which have an integer mode wide enough to hold 128 bits.
853 Simply write @code{__int128} for a signed 128-bit integer, or
854 @code{unsigned __int128} for an unsigned 128-bit integer.  There is no
855 support in GCC for expressing an integer constant of type @code{__int128}
856 for targets with @code{long long} integer less than 128 bits wide.
857
858 @node Long Long
859 @section Double-Word Integers
860 @cindex @code{long long} data types
861 @cindex double-word arithmetic
862 @cindex multiprecision arithmetic
863 @cindex @code{LL} integer suffix
864 @cindex @code{ULL} integer suffix
865
866 ISO C99 supports data types for integers that are at least 64 bits wide,
867 and as an extension GCC supports them in C90 mode and in C++.
868 Simply write @code{long long int} for a signed integer, or
869 @code{unsigned long long int} for an unsigned integer.  To make an
870 integer constant of type @code{long long int}, add the suffix @samp{LL}
871 to the integer.  To make an integer constant of type @code{unsigned long
872 long int}, add the suffix @samp{ULL} to the integer.
873
874 You can use these types in arithmetic like any other integer types.
875 Addition, subtraction, and bitwise boolean operations on these types
876 are open-coded on all types of machines.  Multiplication is open-coded
877 if the machine supports a fullword-to-doubleword widening multiply
878 instruction.  Division and shifts are open-coded only on machines that
879 provide special support.  The operations that are not open-coded use
880 special library routines that come with GCC@.
881
882 There may be pitfalls when you use @code{long long} types for function
883 arguments without function prototypes.  If a function
884 expects type @code{int} for its argument, and you pass a value of type
885 @code{long long int}, confusion results because the caller and the
886 subroutine disagree about the number of bytes for the argument.
887 Likewise, if the function expects @code{long long int} and you pass
888 @code{int}.  The best way to avoid such problems is to use prototypes.
889
890 @node Complex
891 @section Complex Numbers
892 @cindex complex numbers
893 @cindex @code{_Complex} keyword
894 @cindex @code{__complex__} keyword
895
896 ISO C99 supports complex floating data types, and as an extension GCC
897 supports them in C90 mode and in C++.  GCC also supports complex integer data
898 types which are not part of ISO C99.  You can declare complex types
899 using the keyword @code{_Complex}.  As an extension, the older GNU
900 keyword @code{__complex__} is also supported.
901
902 For example, @samp{_Complex double x;} declares @code{x} as a
903 variable whose real part and imaginary part are both of type
904 @code{double}.  @samp{_Complex short int y;} declares @code{y} to
905 have real and imaginary parts of type @code{short int}; this is not
906 likely to be useful, but it shows that the set of complex types is
907 complete.
908
909 To write a constant with a complex data type, use the suffix @samp{i} or
910 @samp{j} (either one; they are equivalent).  For example, @code{2.5fi}
911 has type @code{_Complex float} and @code{3i} has type
912 @code{_Complex int}.  Such a constant always has a pure imaginary
913 value, but you can form any complex value you like by adding one to a
914 real constant.  This is a GNU extension; if you have an ISO C99
915 conforming C library (such as the GNU C Library), and want to construct complex
916 constants of floating type, you should include @code{<complex.h>} and
917 use the macros @code{I} or @code{_Complex_I} instead.
918
919 @cindex @code{__real__} keyword
920 @cindex @code{__imag__} keyword
921 To extract the real part of a complex-valued expression @var{exp}, write
922 @code{__real__ @var{exp}}.  Likewise, use @code{__imag__} to
923 extract the imaginary part.  This is a GNU extension; for values of
924 floating type, you should use the ISO C99 functions @code{crealf},
925 @code{creal}, @code{creall}, @code{cimagf}, @code{cimag} and
926 @code{cimagl}, declared in @code{<complex.h>} and also provided as
927 built-in functions by GCC@.
928
929 @cindex complex conjugation
930 The operator @samp{~} performs complex conjugation when used on a value
931 with a complex type.  This is a GNU extension; for values of
932 floating type, you should use the ISO C99 functions @code{conjf},
933 @code{conj} and @code{conjl}, declared in @code{<complex.h>} and also
934 provided as built-in functions by GCC@.
935
936 GCC can allocate complex automatic variables in a noncontiguous
937 fashion; it's even possible for the real part to be in a register while
938 the imaginary part is on the stack (or vice versa).  Only the DWARF 2
939 debug info format can represent this, so use of DWARF 2 is recommended.
940 If you are using the stabs debug info format, GCC describes a noncontiguous
941 complex variable as if it were two separate variables of noncomplex type.
942 If the variable's actual name is @code{foo}, the two fictitious
943 variables are named @code{foo$real} and @code{foo$imag}.  You can
944 examine and set these two fictitious variables with your debugger.
945
946 @node Floating Types
947 @section Additional Floating Types
948 @cindex additional floating types
949 @cindex @code{__float80} data type
950 @cindex @code{__float128} data type
951 @cindex @code{w} floating point suffix
952 @cindex @code{q} floating point suffix
953 @cindex @code{W} floating point suffix
954 @cindex @code{Q} floating point suffix
955
956 As an extension, GNU C supports additional floating
957 types, @code{__float80} and @code{__float128} to support 80-bit
958 (@code{XFmode}) and 128-bit (@code{TFmode}) floating types.
959 Support for additional types includes the arithmetic operators:
960 add, subtract, multiply, divide; unary arithmetic operators;
961 relational operators; equality operators; and conversions to and from
962 integer and other floating types.  Use a suffix @samp{w} or @samp{W}
963 in a literal constant of type @code{__float80} and @samp{q} or @samp{Q}
964 for @code{_float128}.  You can declare complex types using the
965 corresponding internal complex type, @code{XCmode} for @code{__float80}
966 type and @code{TCmode} for @code{__float128} type:
967
968 @smallexample
969 typedef _Complex float __attribute__((mode(TC))) _Complex128;
970 typedef _Complex float __attribute__((mode(XC))) _Complex80;
971 @end smallexample
972
973 Not all targets support additional floating-point types.  @code{__float80}
974 and @code{__float128} types are supported on x86 and IA-64 targets.
975 The @code{__float128} type is supported on hppa HP-UX targets.
976
977 @node Half-Precision
978 @section Half-Precision Floating Point
979 @cindex half-precision floating point
980 @cindex @code{__fp16} data type
981
982 On ARM targets, GCC supports half-precision (16-bit) floating point via
983 the @code{__fp16} type.  You must enable this type explicitly
984 with the @option{-mfp16-format} command-line option in order to use it.
985
986 ARM supports two incompatible representations for half-precision
987 floating-point values.  You must choose one of the representations and
988 use it consistently in your program.
989
990 Specifying @option{-mfp16-format=ieee} selects the IEEE 754-2008 format.
991 This format can represent normalized values in the range of @math{2^{-14}} to 65504.
992 There are 11 bits of significand precision, approximately 3
993 decimal digits.
994
995 Specifying @option{-mfp16-format=alternative} selects the ARM
996 alternative format.  This representation is similar to the IEEE
997 format, but does not support infinities or NaNs.  Instead, the range
998 of exponents is extended, so that this format can represent normalized
999 values in the range of @math{2^{-14}} to 131008.
1000
1001 The @code{__fp16} type is a storage format only.  For purposes
1002 of arithmetic and other operations, @code{__fp16} values in C or C++
1003 expressions are automatically promoted to @code{float}.  In addition,
1004 you cannot declare a function with a return value or parameters
1005 of type @code{__fp16}.
1006
1007 Note that conversions from @code{double} to @code{__fp16}
1008 involve an intermediate conversion to @code{float}.  Because
1009 of rounding, this can sometimes produce a different result than a
1010 direct conversion.
1011
1012 ARM provides hardware support for conversions between
1013 @code{__fp16} and @code{float} values
1014 as an extension to VFP and NEON (Advanced SIMD).  GCC generates
1015 code using these hardware instructions if you compile with
1016 options to select an FPU that provides them;
1017 for example, @option{-mfpu=neon-fp16 -mfloat-abi=softfp},
1018 in addition to the @option{-mfp16-format} option to select
1019 a half-precision format.
1020
1021 Language-level support for the @code{__fp16} data type is
1022 independent of whether GCC generates code using hardware floating-point
1023 instructions.  In cases where hardware support is not specified, GCC
1024 implements conversions between @code{__fp16} and @code{float} values
1025 as library calls.
1026
1027 @node Decimal Float
1028 @section Decimal Floating Types
1029 @cindex decimal floating types
1030 @cindex @code{_Decimal32} data type
1031 @cindex @code{_Decimal64} data type
1032 @cindex @code{_Decimal128} data type
1033 @cindex @code{df} integer suffix
1034 @cindex @code{dd} integer suffix
1035 @cindex @code{dl} integer suffix
1036 @cindex @code{DF} integer suffix
1037 @cindex @code{DD} integer suffix
1038 @cindex @code{DL} integer suffix
1039
1040 As an extension, GNU C supports decimal floating types as
1041 defined in the N1312 draft of ISO/IEC WDTR24732.  Support for decimal
1042 floating types in GCC will evolve as the draft technical report changes.
1043 Calling conventions for any target might also change.  Not all targets
1044 support decimal floating types.
1045
1046 The decimal floating types are @code{_Decimal32}, @code{_Decimal64}, and
1047 @code{_Decimal128}.  They use a radix of ten, unlike the floating types
1048 @code{float}, @code{double}, and @code{long double} whose radix is not
1049 specified by the C standard but is usually two.
1050
1051 Support for decimal floating types includes the arithmetic operators
1052 add, subtract, multiply, divide; unary arithmetic operators;
1053 relational operators; equality operators; and conversions to and from
1054 integer and other floating types.  Use a suffix @samp{df} or
1055 @samp{DF} in a literal constant of type @code{_Decimal32}, @samp{dd}
1056 or @samp{DD} for @code{_Decimal64}, and @samp{dl} or @samp{DL} for
1057 @code{_Decimal128}.
1058
1059 GCC support of decimal float as specified by the draft technical report
1060 is incomplete:
1061
1062 @itemize @bullet
1063 @item
1064 When the value of a decimal floating type cannot be represented in the
1065 integer type to which it is being converted, the result is undefined
1066 rather than the result value specified by the draft technical report.
1067
1068 @item
1069 GCC does not provide the C library functionality associated with
1070 @file{math.h}, @file{fenv.h}, @file{stdio.h}, @file{stdlib.h}, and
1071 @file{wchar.h}, which must come from a separate C library implementation.
1072 Because of this the GNU C compiler does not define macro
1073 @code{__STDC_DEC_FP__} to indicate that the implementation conforms to
1074 the technical report.
1075 @end itemize
1076
1077 Types @code{_Decimal32}, @code{_Decimal64}, and @code{_Decimal128}
1078 are supported by the DWARF 2 debug information format.
1079
1080 @node Hex Floats
1081 @section Hex Floats
1082 @cindex hex floats
1083
1084 ISO C99 supports floating-point numbers written not only in the usual
1085 decimal notation, such as @code{1.55e1}, but also numbers such as
1086 @code{0x1.fp3} written in hexadecimal format.  As a GNU extension, GCC
1087 supports this in C90 mode (except in some cases when strictly
1088 conforming) and in C++.  In that format the
1089 @samp{0x} hex introducer and the @samp{p} or @samp{P} exponent field are
1090 mandatory.  The exponent is a decimal number that indicates the power of
1091 2 by which the significant part is multiplied.  Thus @samp{0x1.f} is
1092 @tex
1093 $1 {15\over16}$,
1094 @end tex
1095 @ifnottex
1096 1 15/16,
1097 @end ifnottex
1098 @samp{p3} multiplies it by 8, and the value of @code{0x1.fp3}
1099 is the same as @code{1.55e1}.
1100
1101 Unlike for floating-point numbers in the decimal notation the exponent
1102 is always required in the hexadecimal notation.  Otherwise the compiler
1103 would not be able to resolve the ambiguity of, e.g., @code{0x1.f}.  This
1104 could mean @code{1.0f} or @code{1.9375} since @samp{f} is also the
1105 extension for floating-point constants of type @code{float}.
1106
1107 @node Fixed-Point
1108 @section Fixed-Point Types
1109 @cindex fixed-point types
1110 @cindex @code{_Fract} data type
1111 @cindex @code{_Accum} data type
1112 @cindex @code{_Sat} data type
1113 @cindex @code{hr} fixed-suffix
1114 @cindex @code{r} fixed-suffix
1115 @cindex @code{lr} fixed-suffix
1116 @cindex @code{llr} fixed-suffix
1117 @cindex @code{uhr} fixed-suffix
1118 @cindex @code{ur} fixed-suffix
1119 @cindex @code{ulr} fixed-suffix
1120 @cindex @code{ullr} fixed-suffix
1121 @cindex @code{hk} fixed-suffix
1122 @cindex @code{k} fixed-suffix
1123 @cindex @code{lk} fixed-suffix
1124 @cindex @code{llk} fixed-suffix
1125 @cindex @code{uhk} fixed-suffix
1126 @cindex @code{uk} fixed-suffix
1127 @cindex @code{ulk} fixed-suffix
1128 @cindex @code{ullk} fixed-suffix
1129 @cindex @code{HR} fixed-suffix
1130 @cindex @code{R} fixed-suffix
1131 @cindex @code{LR} fixed-suffix
1132 @cindex @code{LLR} fixed-suffix
1133 @cindex @code{UHR} fixed-suffix
1134 @cindex @code{UR} fixed-suffix
1135 @cindex @code{ULR} fixed-suffix
1136 @cindex @code{ULLR} fixed-suffix
1137 @cindex @code{HK} fixed-suffix
1138 @cindex @code{K} fixed-suffix
1139 @cindex @code{LK} fixed-suffix
1140 @cindex @code{LLK} fixed-suffix
1141 @cindex @code{UHK} fixed-suffix
1142 @cindex @code{UK} fixed-suffix
1143 @cindex @code{ULK} fixed-suffix
1144 @cindex @code{ULLK} fixed-suffix
1145
1146 As an extension, GNU C supports fixed-point types as
1147 defined in the N1169 draft of ISO/IEC DTR 18037.  Support for fixed-point
1148 types in GCC will evolve as the draft technical report changes.
1149 Calling conventions for any target might also change.  Not all targets
1150 support fixed-point types.
1151
1152 The fixed-point types are
1153 @code{short _Fract},
1154 @code{_Fract},
1155 @code{long _Fract},
1156 @code{long long _Fract},
1157 @code{unsigned short _Fract},
1158 @code{unsigned _Fract},
1159 @code{unsigned long _Fract},
1160 @code{unsigned long long _Fract},
1161 @code{_Sat short _Fract},
1162 @code{_Sat _Fract},
1163 @code{_Sat long _Fract},
1164 @code{_Sat long long _Fract},
1165 @code{_Sat unsigned short _Fract},
1166 @code{_Sat unsigned _Fract},
1167 @code{_Sat unsigned long _Fract},
1168 @code{_Sat unsigned long long _Fract},
1169 @code{short _Accum},
1170 @code{_Accum},
1171 @code{long _Accum},
1172 @code{long long _Accum},
1173 @code{unsigned short _Accum},
1174 @code{unsigned _Accum},
1175 @code{unsigned long _Accum},
1176 @code{unsigned long long _Accum},
1177 @code{_Sat short _Accum},
1178 @code{_Sat _Accum},
1179 @code{_Sat long _Accum},
1180 @code{_Sat long long _Accum},
1181 @code{_Sat unsigned short _Accum},
1182 @code{_Sat unsigned _Accum},
1183 @code{_Sat unsigned long _Accum},
1184 @code{_Sat unsigned long long _Accum}.
1185
1186 Fixed-point data values contain fractional and optional integral parts.
1187 The format of fixed-point data varies and depends on the target machine.
1188
1189 Support for fixed-point types includes:
1190 @itemize @bullet
1191 @item
1192 prefix and postfix increment and decrement operators (@code{++}, @code{--})
1193 @item
1194 unary arithmetic operators (@code{+}, @code{-}, @code{!})
1195 @item
1196 binary arithmetic operators (@code{+}, @code{-}, @code{*}, @code{/})
1197 @item
1198 binary shift operators (@code{<<}, @code{>>})
1199 @item
1200 relational operators (@code{<}, @code{<=}, @code{>=}, @code{>})
1201 @item
1202 equality operators (@code{==}, @code{!=})
1203 @item
1204 assignment operators (@code{+=}, @code{-=}, @code{*=}, @code{/=},
1205 @code{<<=}, @code{>>=})
1206 @item
1207 conversions to and from integer, floating-point, or fixed-point types
1208 @end itemize
1209
1210 Use a suffix in a fixed-point literal constant:
1211 @itemize
1212 @item @samp{hr} or @samp{HR} for @code{short _Fract} and
1213 @code{_Sat short _Fract}
1214 @item @samp{r} or @samp{R} for @code{_Fract} and @code{_Sat _Fract}
1215 @item @samp{lr} or @samp{LR} for @code{long _Fract} and
1216 @code{_Sat long _Fract}
1217 @item @samp{llr} or @samp{LLR} for @code{long long _Fract} and
1218 @code{_Sat long long _Fract}
1219 @item @samp{uhr} or @samp{UHR} for @code{unsigned short _Fract} and
1220 @code{_Sat unsigned short _Fract}
1221 @item @samp{ur} or @samp{UR} for @code{unsigned _Fract} and
1222 @code{_Sat unsigned _Fract}
1223 @item @samp{ulr} or @samp{ULR} for @code{unsigned long _Fract} and
1224 @code{_Sat unsigned long _Fract}
1225 @item @samp{ullr} or @samp{ULLR} for @code{unsigned long long _Fract}
1226 and @code{_Sat unsigned long long _Fract}
1227 @item @samp{hk} or @samp{HK} for @code{short _Accum} and
1228 @code{_Sat short _Accum}
1229 @item @samp{k} or @samp{K} for @code{_Accum} and @code{_Sat _Accum}
1230 @item @samp{lk} or @samp{LK} for @code{long _Accum} and
1231 @code{_Sat long _Accum}
1232 @item @samp{llk} or @samp{LLK} for @code{long long _Accum} and
1233 @code{_Sat long long _Accum}
1234 @item @samp{uhk} or @samp{UHK} for @code{unsigned short _Accum} and
1235 @code{_Sat unsigned short _Accum}
1236 @item @samp{uk} or @samp{UK} for @code{unsigned _Accum} and
1237 @code{_Sat unsigned _Accum}
1238 @item @samp{ulk} or @samp{ULK} for @code{unsigned long _Accum} and
1239 @code{_Sat unsigned long _Accum}
1240 @item @samp{ullk} or @samp{ULLK} for @code{unsigned long long _Accum}
1241 and @code{_Sat unsigned long long _Accum}
1242 @end itemize
1243
1244 GCC support of fixed-point types as specified by the draft technical report
1245 is incomplete:
1246
1247 @itemize @bullet
1248 @item
1249 Pragmas to control overflow and rounding behaviors are not implemented.
1250 @end itemize
1251
1252 Fixed-point types are supported by the DWARF 2 debug information format.
1253
1254 @node Named Address Spaces
1255 @section Named Address Spaces
1256 @cindex Named Address Spaces
1257
1258 As an extension, GNU C supports named address spaces as
1259 defined in the N1275 draft of ISO/IEC DTR 18037.  Support for named
1260 address spaces in GCC will evolve as the draft technical report
1261 changes.  Calling conventions for any target might also change.  At
1262 present, only the AVR, SPU, M32C, and RL78 targets support address
1263 spaces other than the generic address space.
1264
1265 Address space identifiers may be used exactly like any other C type
1266 qualifier (e.g., @code{const} or @code{volatile}).  See the N1275
1267 document for more details.
1268
1269 @anchor{AVR Named Address Spaces}
1270 @subsection AVR Named Address Spaces
1271
1272 On the AVR target, there are several address spaces that can be used
1273 in order to put read-only data into the flash memory and access that
1274 data by means of the special instructions @code{LPM} or @code{ELPM}
1275 needed to read from flash.
1276
1277 Per default, any data including read-only data is located in RAM
1278 (the generic address space) so that non-generic address spaces are
1279 needed to locate read-only data in flash memory
1280 @emph{and} to generate the right instructions to access this data
1281 without using (inline) assembler code.
1282
1283 @table @code
1284 @item __flash
1285 @cindex @code{__flash} AVR Named Address Spaces
1286 The @code{__flash} qualifier locates data in the
1287 @code{.progmem.data} section. Data is read using the @code{LPM}
1288 instruction. Pointers to this address space are 16 bits wide.
1289
1290 @item __flash1
1291 @itemx __flash2
1292 @itemx __flash3
1293 @itemx __flash4
1294 @itemx __flash5
1295 @cindex @code{__flash1} AVR Named Address Spaces
1296 @cindex @code{__flash2} AVR Named Address Spaces
1297 @cindex @code{__flash3} AVR Named Address Spaces
1298 @cindex @code{__flash4} AVR Named Address Spaces
1299 @cindex @code{__flash5} AVR Named Address Spaces
1300 These are 16-bit address spaces locating data in section
1301 @code{.progmem@var{N}.data} where @var{N} refers to
1302 address space @code{__flash@var{N}}.
1303 The compiler sets the @code{RAMPZ} segment register appropriately 
1304 before reading data by means of the @code{ELPM} instruction.
1305
1306 @item __memx
1307 @cindex @code{__memx} AVR Named Address Spaces
1308 This is a 24-bit address space that linearizes flash and RAM:
1309 If the high bit of the address is set, data is read from
1310 RAM using the lower two bytes as RAM address.
1311 If the high bit of the address is clear, data is read from flash
1312 with @code{RAMPZ} set according to the high byte of the address.
1313 @xref{AVR Built-in Functions,,@code{__builtin_avr_flash_segment}}.
1314
1315 Objects in this address space are located in @code{.progmemx.data}.
1316 @end table
1317
1318 @b{Example}
1319
1320 @smallexample
1321 char my_read (const __flash char ** p)
1322 @{
1323     /* p is a pointer to RAM that points to a pointer to flash.
1324        The first indirection of p reads that flash pointer
1325        from RAM and the second indirection reads a char from this
1326        flash address.  */
1327
1328     return **p;
1329 @}
1330
1331 /* Locate array[] in flash memory */
1332 const __flash int array[] = @{ 3, 5, 7, 11, 13, 17, 19 @};
1333
1334 int i = 1;
1335
1336 int main (void)
1337 @{
1338    /* Return 17 by reading from flash memory */
1339    return array[array[i]];
1340 @}
1341 @end smallexample
1342
1343 @noindent
1344 For each named address space supported by avr-gcc there is an equally
1345 named but uppercase built-in macro defined. 
1346 The purpose is to facilitate testing if respective address space
1347 support is available or not:
1348
1349 @smallexample
1350 #ifdef __FLASH
1351 const __flash int var = 1;
1352
1353 int read_var (void)
1354 @{
1355     return var;
1356 @}
1357 #else
1358 #include <avr/pgmspace.h> /* From AVR-LibC */
1359
1360 const int var PROGMEM = 1;
1361
1362 int read_var (void)
1363 @{
1364     return (int) pgm_read_word (&var);
1365 @}
1366 #endif /* __FLASH */
1367 @end smallexample
1368
1369 @noindent
1370 Notice that attribute @ref{AVR Variable Attributes,,@code{progmem}}
1371 locates data in flash but
1372 accesses to these data read from generic address space, i.e.@:
1373 from RAM,
1374 so that you need special accessors like @code{pgm_read_byte}
1375 from @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC}}
1376 together with attribute @code{progmem}.
1377
1378 @noindent
1379 @b{Limitations and caveats}
1380
1381 @itemize
1382 @item
1383 Reading across the 64@tie{}KiB section boundary of
1384 the @code{__flash} or @code{__flash@var{N}} address spaces
1385 shows undefined behavior. The only address space that
1386 supports reading across the 64@tie{}KiB flash segment boundaries is
1387 @code{__memx}.
1388
1389 @item
1390 If you use one of the @code{__flash@var{N}} address spaces
1391 you must arrange your linker script to locate the
1392 @code{.progmem@var{N}.data} sections according to your needs.
1393
1394 @item
1395 Any data or pointers to the non-generic address spaces must
1396 be qualified as @code{const}, i.e.@: as read-only data.
1397 This still applies if the data in one of these address
1398 spaces like software version number or calibration lookup table are intended to
1399 be changed after load time by, say, a boot loader. In this case
1400 the right qualification is @code{const} @code{volatile} so that the compiler
1401 must not optimize away known values or insert them
1402 as immediates into operands of instructions.
1403
1404 @item
1405 The following code initializes a variable @code{pfoo}
1406 located in static storage with a 24-bit address:
1407 @smallexample
1408 extern const __memx char foo;
1409 const __memx void *pfoo = &foo;
1410 @end smallexample
1411
1412 @noindent
1413 Such code requires at least binutils 2.23, see
1414 @w{@uref{http://sourceware.org/PR13503,PR13503}}.
1415
1416 @end itemize
1417
1418 @subsection M32C Named Address Spaces
1419 @cindex @code{__far} M32C Named Address Spaces
1420
1421 On the M32C target, with the R8C and M16C CPU variants, variables
1422 qualified with @code{__far} are accessed using 32-bit addresses in
1423 order to access memory beyond the first 64@tie{}Ki bytes.  If
1424 @code{__far} is used with the M32CM or M32C CPU variants, it has no
1425 effect.
1426
1427 @subsection RL78 Named Address Spaces
1428 @cindex @code{__far} RL78 Named Address Spaces
1429
1430 On the RL78 target, variables qualified with @code{__far} are accessed
1431 with 32-bit pointers (20-bit addresses) rather than the default 16-bit
1432 addresses.  Non-far variables are assumed to appear in the topmost
1433 64@tie{}KiB of the address space.
1434
1435 @subsection SPU Named Address Spaces
1436 @cindex @code{__ea} SPU Named Address Spaces
1437
1438 On the SPU target variables may be declared as
1439 belonging to another address space by qualifying the type with the
1440 @code{__ea} address space identifier:
1441
1442 @smallexample
1443 extern int __ea i;
1444 @end smallexample
1445
1446 @noindent 
1447 The compiler generates special code to access the variable @code{i}.
1448 It may use runtime library
1449 support, or generate special machine instructions to access that address
1450 space.
1451
1452 @node Zero Length
1453 @section Arrays of Length Zero
1454 @cindex arrays of length zero
1455 @cindex zero-length arrays
1456 @cindex length-zero arrays
1457 @cindex flexible array members
1458
1459 Zero-length arrays are allowed in GNU C@.  They are very useful as the
1460 last element of a structure that is really a header for a variable-length
1461 object:
1462
1463 @smallexample
1464 struct line @{
1465   int length;
1466   char contents[0];
1467 @};
1468
1469 struct line *thisline = (struct line *)
1470   malloc (sizeof (struct line) + this_length);
1471 thisline->length = this_length;
1472 @end smallexample
1473
1474 In ISO C90, you would have to give @code{contents} a length of 1, which
1475 means either you waste space or complicate the argument to @code{malloc}.
1476
1477 In ISO C99, you would use a @dfn{flexible array member}, which is
1478 slightly different in syntax and semantics:
1479
1480 @itemize @bullet
1481 @item
1482 Flexible array members are written as @code{contents[]} without
1483 the @code{0}.
1484
1485 @item
1486 Flexible array members have incomplete type, and so the @code{sizeof}
1487 operator may not be applied.  As a quirk of the original implementation
1488 of zero-length arrays, @code{sizeof} evaluates to zero.
1489
1490 @item
1491 Flexible array members may only appear as the last member of a
1492 @code{struct} that is otherwise non-empty.
1493
1494 @item
1495 A structure containing a flexible array member, or a union containing
1496 such a structure (possibly recursively), may not be a member of a
1497 structure or an element of an array.  (However, these uses are
1498 permitted by GCC as extensions.)
1499 @end itemize
1500
1501 GCC versions before 3.0 allowed zero-length arrays to be statically
1502 initialized, as if they were flexible arrays.  In addition to those
1503 cases that were useful, it also allowed initializations in situations
1504 that would corrupt later data.  Non-empty initialization of zero-length
1505 arrays is now treated like any case where there are more initializer
1506 elements than the array holds, in that a suitable warning about ``excess
1507 elements in array'' is given, and the excess elements (all of them, in
1508 this case) are ignored.
1509
1510 Instead GCC allows static initialization of flexible array members.
1511 This is equivalent to defining a new structure containing the original
1512 structure followed by an array of sufficient size to contain the data.
1513 E.g.@: in the following, @code{f1} is constructed as if it were declared
1514 like @code{f2}.
1515
1516 @smallexample
1517 struct f1 @{
1518   int x; int y[];
1519 @} f1 = @{ 1, @{ 2, 3, 4 @} @};
1520
1521 struct f2 @{
1522   struct f1 f1; int data[3];
1523 @} f2 = @{ @{ 1 @}, @{ 2, 3, 4 @} @};
1524 @end smallexample
1525
1526 @noindent
1527 The convenience of this extension is that @code{f1} has the desired
1528 type, eliminating the need to consistently refer to @code{f2.f1}.
1529
1530 This has symmetry with normal static arrays, in that an array of
1531 unknown size is also written with @code{[]}.
1532
1533 Of course, this extension only makes sense if the extra data comes at
1534 the end of a top-level object, as otherwise we would be overwriting
1535 data at subsequent offsets.  To avoid undue complication and confusion
1536 with initialization of deeply nested arrays, we simply disallow any
1537 non-empty initialization except when the structure is the top-level
1538 object.  For example:
1539
1540 @smallexample
1541 struct foo @{ int x; int y[]; @};
1542 struct bar @{ struct foo z; @};
1543
1544 struct foo a = @{ 1, @{ 2, 3, 4 @} @};        // @r{Valid.}
1545 struct bar b = @{ @{ 1, @{ 2, 3, 4 @} @} @};    // @r{Invalid.}
1546 struct bar c = @{ @{ 1, @{ @} @} @};            // @r{Valid.}
1547 struct foo d[1] = @{ @{ 1, @{ 2, 3, 4 @} @} @};  // @r{Invalid.}
1548 @end smallexample
1549
1550 @node Empty Structures
1551 @section Structures With No Members
1552 @cindex empty structures
1553 @cindex zero-size structures
1554
1555 GCC permits a C structure to have no members:
1556
1557 @smallexample
1558 struct empty @{
1559 @};
1560 @end smallexample
1561
1562 The structure has size zero.  In C++, empty structures are part
1563 of the language.  G++ treats empty structures as if they had a single
1564 member of type @code{char}.
1565
1566 @node Variable Length
1567 @section Arrays of Variable Length
1568 @cindex variable-length arrays
1569 @cindex arrays of variable length
1570 @cindex VLAs
1571
1572 Variable-length automatic arrays are allowed in ISO C99, and as an
1573 extension GCC accepts them in C90 mode and in C++.  These arrays are
1574 declared like any other automatic arrays, but with a length that is not
1575 a constant expression.  The storage is allocated at the point of
1576 declaration and deallocated when the block scope containing the declaration
1577 exits.  For
1578 example:
1579
1580 @smallexample
1581 FILE *
1582 concat_fopen (char *s1, char *s2, char *mode)
1583 @{
1584   char str[strlen (s1) + strlen (s2) + 1];
1585   strcpy (str, s1);
1586   strcat (str, s2);
1587   return fopen (str, mode);
1588 @}
1589 @end smallexample
1590
1591 @cindex scope of a variable length array
1592 @cindex variable-length array scope
1593 @cindex deallocating variable length arrays
1594 Jumping or breaking out of the scope of the array name deallocates the
1595 storage.  Jumping into the scope is not allowed; you get an error
1596 message for it.
1597
1598 @cindex variable-length array in a structure
1599 As an extension, GCC accepts variable-length arrays as a member of
1600 a structure or a union.  For example:
1601
1602 @smallexample
1603 void
1604 foo (int n)
1605 @{
1606   struct S @{ int x[n]; @};
1607 @}
1608 @end smallexample
1609
1610 @cindex @code{alloca} vs variable-length arrays
1611 You can use the function @code{alloca} to get an effect much like
1612 variable-length arrays.  The function @code{alloca} is available in
1613 many other C implementations (but not in all).  On the other hand,
1614 variable-length arrays are more elegant.
1615
1616 There are other differences between these two methods.  Space allocated
1617 with @code{alloca} exists until the containing @emph{function} returns.
1618 The space for a variable-length array is deallocated as soon as the array
1619 name's scope ends.  (If you use both variable-length arrays and
1620 @code{alloca} in the same function, deallocation of a variable-length array
1621 also deallocates anything more recently allocated with @code{alloca}.)
1622
1623 You can also use variable-length arrays as arguments to functions:
1624
1625 @smallexample
1626 struct entry
1627 tester (int len, char data[len][len])
1628 @{
1629   /* @r{@dots{}} */
1630 @}
1631 @end smallexample
1632
1633 The length of an array is computed once when the storage is allocated
1634 and is remembered for the scope of the array in case you access it with
1635 @code{sizeof}.
1636
1637 If you want to pass the array first and the length afterward, you can
1638 use a forward declaration in the parameter list---another GNU extension.
1639
1640 @smallexample
1641 struct entry
1642 tester (int len; char data[len][len], int len)
1643 @{
1644   /* @r{@dots{}} */
1645 @}
1646 @end smallexample
1647
1648 @cindex parameter forward declaration
1649 The @samp{int len} before the semicolon is a @dfn{parameter forward
1650 declaration}, and it serves the purpose of making the name @code{len}
1651 known when the declaration of @code{data} is parsed.
1652
1653 You can write any number of such parameter forward declarations in the
1654 parameter list.  They can be separated by commas or semicolons, but the
1655 last one must end with a semicolon, which is followed by the ``real''
1656 parameter declarations.  Each forward declaration must match a ``real''
1657 declaration in parameter name and data type.  ISO C99 does not support
1658 parameter forward declarations.
1659
1660 @node Variadic Macros
1661 @section Macros with a Variable Number of Arguments.
1662 @cindex variable number of arguments
1663 @cindex macro with variable arguments
1664 @cindex rest argument (in macro)
1665 @cindex variadic macros
1666
1667 In the ISO C standard of 1999, a macro can be declared to accept a
1668 variable number of arguments much as a function can.  The syntax for
1669 defining the macro is similar to that of a function.  Here is an
1670 example:
1671
1672 @smallexample
1673 #define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)
1674 @end smallexample
1675
1676 @noindent
1677 Here @samp{@dots{}} is a @dfn{variable argument}.  In the invocation of
1678 such a macro, it represents the zero or more tokens until the closing
1679 parenthesis that ends the invocation, including any commas.  This set of
1680 tokens replaces the identifier @code{__VA_ARGS__} in the macro body
1681 wherever it appears.  See the CPP manual for more information.
1682
1683 GCC has long supported variadic macros, and used a different syntax that
1684 allowed you to give a name to the variable arguments just like any other
1685 argument.  Here is an example:
1686
1687 @smallexample
1688 #define debug(format, args...) fprintf (stderr, format, args)
1689 @end smallexample
1690
1691 @noindent
1692 This is in all ways equivalent to the ISO C example above, but arguably
1693 more readable and descriptive.
1694
1695 GNU CPP has two further variadic macro extensions, and permits them to
1696 be used with either of the above forms of macro definition.
1697
1698 In standard C, you are not allowed to leave the variable argument out
1699 entirely; but you are allowed to pass an empty argument.  For example,
1700 this invocation is invalid in ISO C, because there is no comma after
1701 the string:
1702
1703 @smallexample
1704 debug ("A message")
1705 @end smallexample
1706
1707 GNU CPP permits you to completely omit the variable arguments in this
1708 way.  In the above examples, the compiler would complain, though since
1709 the expansion of the macro still has the extra comma after the format
1710 string.
1711
1712 To help solve this problem, CPP behaves specially for variable arguments
1713 used with the token paste operator, @samp{##}.  If instead you write
1714
1715 @smallexample
1716 #define debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
1717 @end smallexample
1718
1719 @noindent
1720 and if the variable arguments are omitted or empty, the @samp{##}
1721 operator causes the preprocessor to remove the comma before it.  If you
1722 do provide some variable arguments in your macro invocation, GNU CPP
1723 does not complain about the paste operation and instead places the
1724 variable arguments after the comma.  Just like any other pasted macro
1725 argument, these arguments are not macro expanded.
1726
1727 @node Escaped Newlines
1728 @section Slightly Looser Rules for Escaped Newlines
1729 @cindex escaped newlines
1730 @cindex newlines (escaped)
1731
1732 Recently, the preprocessor has relaxed its treatment of escaped
1733 newlines.  Previously, the newline had to immediately follow a
1734 backslash.  The current implementation allows whitespace in the form
1735 of spaces, horizontal and vertical tabs, and form feeds between the
1736 backslash and the subsequent newline.  The preprocessor issues a
1737 warning, but treats it as a valid escaped newline and combines the two
1738 lines to form a single logical line.  This works within comments and
1739 tokens, as well as between tokens.  Comments are @emph{not} treated as
1740 whitespace for the purposes of this relaxation, since they have not
1741 yet been replaced with spaces.
1742
1743 @node Subscripting
1744 @section Non-Lvalue Arrays May Have Subscripts
1745 @cindex subscripting
1746 @cindex arrays, non-lvalue
1747
1748 @cindex subscripting and function values
1749 In ISO C99, arrays that are not lvalues still decay to pointers, and
1750 may be subscripted, although they may not be modified or used after
1751 the next sequence point and the unary @samp{&} operator may not be
1752 applied to them.  As an extension, GNU C allows such arrays to be
1753 subscripted in C90 mode, though otherwise they do not decay to
1754 pointers outside C99 mode.  For example,
1755 this is valid in GNU C though not valid in C90:
1756
1757 @smallexample
1758 @group
1759 struct foo @{int a[4];@};
1760
1761 struct foo f();
1762
1763 bar (int index)
1764 @{
1765   return f().a[index];
1766 @}
1767 @end group
1768 @end smallexample
1769
1770 @node Pointer Arith
1771 @section Arithmetic on @code{void}- and Function-Pointers
1772 @cindex void pointers, arithmetic
1773 @cindex void, size of pointer to
1774 @cindex function pointers, arithmetic
1775 @cindex function, size of pointer to
1776
1777 In GNU C, addition and subtraction operations are supported on pointers to
1778 @code{void} and on pointers to functions.  This is done by treating the
1779 size of a @code{void} or of a function as 1.
1780
1781 A consequence of this is that @code{sizeof} is also allowed on @code{void}
1782 and on function types, and returns 1.
1783
1784 @opindex Wpointer-arith
1785 The option @option{-Wpointer-arith} requests a warning if these extensions
1786 are used.
1787
1788 @node Pointers to Arrays
1789 @section Pointers to arrays with qualifiers work as expected
1790 @cindex pointers to arrays
1791 @cindex const qualifier
1792
1793 In GNU C, pointers to arrays with qualifiers work similar to pointers
1794 to other qualified types. For example, a value of type @code{int (*)[5]}
1795 can be used to initialize a variable of type @code{const int (*)[5]}.
1796 These types are incompatible in ISO C because the @code{const} qualifier
1797 is formally attached to the element type of the array and not the
1798 array itself.
1799
1800 @smallexample
1801 extern void
1802 transpose (int N, int M, double out[M][N], const double in[N][M]);
1803 double x[3][2];
1804 double y[2][3];
1805 @r{@dots{}}
1806 transpose(3, 2, y, x);
1807 @end smallexample
1808
1809 @node Initializers
1810 @section Non-Constant Initializers
1811 @cindex initializers, non-constant
1812 @cindex non-constant initializers
1813
1814 As in standard C++ and ISO C99, the elements of an aggregate initializer for an
1815 automatic variable are not required to be constant expressions in GNU C@.
1816 Here is an example of an initializer with run-time varying elements:
1817
1818 @smallexample
1819 foo (float f, float g)
1820 @{
1821   float beat_freqs[2] = @{ f-g, f+g @};
1822   /* @r{@dots{}} */
1823 @}
1824 @end smallexample
1825
1826 @node Compound Literals
1827 @section Compound Literals
1828 @cindex constructor expressions
1829 @cindex initializations in expressions
1830 @cindex structures, constructor expression
1831 @cindex expressions, constructor
1832 @cindex compound literals
1833 @c The GNU C name for what C99 calls compound literals was "constructor expressions".
1834
1835 ISO C99 supports compound literals.  A compound literal looks like
1836 a cast containing an initializer.  Its value is an object of the
1837 type specified in the cast, containing the elements specified in
1838 the initializer; it is an lvalue.  As an extension, GCC supports
1839 compound literals in C90 mode and in C++, though the semantics are
1840 somewhat different in C++.
1841
1842 Usually, the specified type is a structure.  Assume that
1843 @code{struct foo} and @code{structure} are declared as shown:
1844
1845 @smallexample
1846 struct foo @{int a; char b[2];@} structure;
1847 @end smallexample
1848
1849 @noindent
1850 Here is an example of constructing a @code{struct foo} with a compound literal:
1851
1852 @smallexample
1853 structure = ((struct foo) @{x + y, 'a', 0@});
1854 @end smallexample
1855
1856 @noindent
1857 This is equivalent to writing the following:
1858
1859 @smallexample
1860 @{
1861   struct foo temp = @{x + y, 'a', 0@};
1862   structure = temp;
1863 @}
1864 @end smallexample
1865
1866 You can also construct an array, though this is dangerous in C++, as
1867 explained below.  If all the elements of the compound literal are
1868 (made up of) simple constant expressions, suitable for use in
1869 initializers of objects of static storage duration, then the compound
1870 literal can be coerced to a pointer to its first element and used in
1871 such an initializer, as shown here:
1872
1873 @smallexample
1874 char **foo = (char *[]) @{ "x", "y", "z" @};
1875 @end smallexample
1876
1877 Compound literals for scalar types and union types are
1878 also allowed, but then the compound literal is equivalent
1879 to a cast.
1880
1881 As a GNU extension, GCC allows initialization of objects with static storage
1882 duration by compound literals (which is not possible in ISO C99, because
1883 the initializer is not a constant).
1884 It is handled as if the object is initialized only with the bracket
1885 enclosed list if the types of the compound literal and the object match.
1886 The initializer list of the compound literal must be constant.
1887 If the object being initialized has array type of unknown size, the size is
1888 determined by compound literal size.
1889
1890 @smallexample
1891 static struct foo x = (struct foo) @{1, 'a', 'b'@};
1892 static int y[] = (int []) @{1, 2, 3@};
1893 static int z[] = (int [3]) @{1@};
1894 @end smallexample
1895
1896 @noindent
1897 The above lines are equivalent to the following:
1898 @smallexample
1899 static struct foo x = @{1, 'a', 'b'@};
1900 static int y[] = @{1, 2, 3@};
1901 static int z[] = @{1, 0, 0@};
1902 @end smallexample
1903
1904 In C, a compound literal designates an unnamed object with static or
1905 automatic storage duration.  In C++, a compound literal designates a
1906 temporary object, which only lives until the end of its
1907 full-expression.  As a result, well-defined C code that takes the
1908 address of a subobject of a compound literal can be undefined in C++.
1909 For instance, if the array compound literal example above appeared
1910 inside a function, any subsequent use of @samp{foo} in C++ has
1911 undefined behavior because the lifetime of the array ends after the
1912 declaration of @samp{foo}.  As a result, the C++ compiler now rejects
1913 the conversion of a temporary array to a pointer.
1914
1915 As an optimization, the C++ compiler sometimes gives array compound
1916 literals longer lifetimes: when the array either appears outside a
1917 function or has const-qualified type.  If @samp{foo} and its
1918 initializer had elements of @samp{char *const} type rather than
1919 @samp{char *}, or if @samp{foo} were a global variable, the array
1920 would have static storage duration.  But it is probably safest just to
1921 avoid the use of array compound literals in code compiled as C++.
1922
1923 @node Designated Inits
1924 @section Designated Initializers
1925 @cindex initializers with labeled elements
1926 @cindex labeled elements in initializers
1927 @cindex case labels in initializers
1928 @cindex designated initializers
1929
1930 Standard C90 requires the elements of an initializer to appear in a fixed
1931 order, the same as the order of the elements in the array or structure
1932 being initialized.
1933
1934 In ISO C99 you can give the elements in any order, specifying the array
1935 indices or structure field names they apply to, and GNU C allows this as
1936 an extension in C90 mode as well.  This extension is not
1937 implemented in GNU C++.
1938
1939 To specify an array index, write
1940 @samp{[@var{index}] =} before the element value.  For example,
1941
1942 @smallexample
1943 int a[6] = @{ [4] = 29, [2] = 15 @};
1944 @end smallexample
1945
1946 @noindent
1947 is equivalent to
1948
1949 @smallexample
1950 int a[6] = @{ 0, 0, 15, 0, 29, 0 @};
1951 @end smallexample
1952
1953 @noindent
1954 The index values must be constant expressions, even if the array being
1955 initialized is automatic.
1956
1957 An alternative syntax for this that has been obsolete since GCC 2.5 but
1958 GCC still accepts is to write @samp{[@var{index}]} before the element
1959 value, with no @samp{=}.
1960
1961 To initialize a range of elements to the same value, write
1962 @samp{[@var{first} ... @var{last}] = @var{value}}.  This is a GNU
1963 extension.  For example,
1964
1965 @smallexample
1966 int widths[] = @{ [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 @};
1967 @end smallexample
1968
1969 @noindent
1970 If the value in it has side-effects, the side-effects happen only once,
1971 not for each initialized field by the range initializer.
1972
1973 @noindent
1974 Note that the length of the array is the highest value specified
1975 plus one.
1976
1977 In a structure initializer, specify the name of a field to initialize
1978 with @samp{.@var{fieldname} =} before the element value.  For example,
1979 given the following structure,
1980
1981 @smallexample
1982 struct point @{ int x, y; @};
1983 @end smallexample
1984
1985 @noindent
1986 the following initialization
1987
1988 @smallexample
1989 struct point p = @{ .y = yvalue, .x = xvalue @};
1990 @end smallexample
1991
1992 @noindent
1993 is equivalent to
1994
1995 @smallexample
1996 struct point p = @{ xvalue, yvalue @};
1997 @end smallexample
1998
1999 Another syntax that has the same meaning, obsolete since GCC 2.5, is
2000 @samp{@var{fieldname}:}, as shown here:
2001
2002 @smallexample
2003 struct point p = @{ y: yvalue, x: xvalue @};
2004 @end smallexample
2005
2006 Omitted field members are implicitly initialized the same as objects
2007 that have static storage duration.
2008
2009 @cindex designators
2010 The @samp{[@var{index}]} or @samp{.@var{fieldname}} is known as a
2011 @dfn{designator}.  You can also use a designator (or the obsolete colon
2012 syntax) when initializing a union, to specify which element of the union
2013 should be used.  For example,
2014
2015 @smallexample
2016 union foo @{ int i; double d; @};
2017
2018 union foo f = @{ .d = 4 @};
2019 @end smallexample
2020
2021 @noindent
2022 converts 4 to a @code{double} to store it in the union using
2023 the second element.  By contrast, casting 4 to type @code{union foo}
2024 stores it into the union as the integer @code{i}, since it is
2025 an integer.  (@xref{Cast to Union}.)
2026
2027 You can combine this technique of naming elements with ordinary C
2028 initialization of successive elements.  Each initializer element that
2029 does not have a designator applies to the next consecutive element of the
2030 array or structure.  For example,
2031
2032 @smallexample
2033 int a[6] = @{ [1] = v1, v2, [4] = v4 @};
2034 @end smallexample
2035
2036 @noindent
2037 is equivalent to
2038
2039 @smallexample
2040 int a[6] = @{ 0, v1, v2, 0, v4, 0 @};
2041 @end smallexample
2042
2043 Labeling the elements of an array initializer is especially useful
2044 when the indices are characters or belong to an @code{enum} type.
2045 For example:
2046
2047 @smallexample
2048 int whitespace[256]
2049   = @{ [' '] = 1, ['\t'] = 1, ['\h'] = 1,
2050       ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 @};
2051 @end smallexample
2052
2053 @cindex designator lists
2054 You can also write a series of @samp{.@var{fieldname}} and
2055 @samp{[@var{index}]} designators before an @samp{=} to specify a
2056 nested subobject to initialize; the list is taken relative to the
2057 subobject corresponding to the closest surrounding brace pair.  For
2058 example, with the @samp{struct point} declaration above:
2059
2060 @smallexample
2061 struct point ptarray[10] = @{ [2].y = yv2, [2].x = xv2, [0].x = xv0 @};
2062 @end smallexample
2063
2064 @noindent
2065 If the same field is initialized multiple times, it has the value from
2066 the last initialization.  If any such overridden initialization has
2067 side-effect, it is unspecified whether the side-effect happens or not.
2068 Currently, GCC discards them and issues a warning.
2069
2070 @node Case Ranges
2071 @section Case Ranges
2072 @cindex case ranges
2073 @cindex ranges in case statements
2074
2075 You can specify a range of consecutive values in a single @code{case} label,
2076 like this:
2077
2078 @smallexample
2079 case @var{low} ... @var{high}:
2080 @end smallexample
2081
2082 @noindent
2083 This has the same effect as the proper number of individual @code{case}
2084 labels, one for each integer value from @var{low} to @var{high}, inclusive.
2085
2086 This feature is especially useful for ranges of ASCII character codes:
2087
2088 @smallexample
2089 case 'A' ... 'Z':
2090 @end smallexample
2091
2092 @strong{Be careful:} Write spaces around the @code{...}, for otherwise
2093 it may be parsed wrong when you use it with integer values.  For example,
2094 write this:
2095
2096 @smallexample
2097 case 1 ... 5:
2098 @end smallexample
2099
2100 @noindent
2101 rather than this:
2102
2103 @smallexample
2104 case 1...5:
2105 @end smallexample
2106
2107 @node Cast to Union
2108 @section Cast to a Union Type
2109 @cindex cast to a union
2110 @cindex union, casting to a
2111
2112 A cast to union type is similar to other casts, except that the type
2113 specified is a union type.  You can specify the type either with
2114 @code{union @var{tag}} or with a typedef name.  A cast to union is actually
2115 a constructor, not a cast, and hence does not yield an lvalue like
2116 normal casts.  (@xref{Compound Literals}.)
2117
2118 The types that may be cast to the union type are those of the members
2119 of the union.  Thus, given the following union and variables:
2120
2121 @smallexample
2122 union foo @{ int i; double d; @};
2123 int x;
2124 double y;
2125 @end smallexample
2126
2127 @noindent
2128 both @code{x} and @code{y} can be cast to type @code{union foo}.
2129
2130 Using the cast as the right-hand side of an assignment to a variable of
2131 union type is equivalent to storing in a member of the union:
2132
2133 @smallexample
2134 union foo u;
2135 /* @r{@dots{}} */
2136 u = (union foo) x  @equiv{}  u.i = x
2137 u = (union foo) y  @equiv{}  u.d = y
2138 @end smallexample
2139
2140 You can also use the union cast as a function argument:
2141
2142 @smallexample
2143 void hack (union foo);
2144 /* @r{@dots{}} */
2145 hack ((union foo) x);
2146 @end smallexample
2147
2148 @node Mixed Declarations
2149 @section Mixed Declarations and Code
2150 @cindex mixed declarations and code
2151 @cindex declarations, mixed with code
2152 @cindex code, mixed with declarations
2153
2154 ISO C99 and ISO C++ allow declarations and code to be freely mixed
2155 within compound statements.  As an extension, GNU C also allows this in
2156 C90 mode.  For example, you could do:
2157
2158 @smallexample
2159 int i;
2160 /* @r{@dots{}} */
2161 i++;
2162 int j = i + 2;
2163 @end smallexample
2164
2165 Each identifier is visible from where it is declared until the end of
2166 the enclosing block.
2167
2168 @node Function Attributes
2169 @section Declaring Attributes of Functions
2170 @cindex function attributes
2171 @cindex declaring attributes of functions
2172 @cindex functions that never return
2173 @cindex functions that return more than once
2174 @cindex functions that have no side effects
2175 @cindex functions in arbitrary sections
2176 @cindex functions that behave like malloc
2177 @cindex @code{volatile} applied to function
2178 @cindex @code{const} applied to function
2179 @cindex functions with @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style arguments
2180 @cindex functions with non-null pointer arguments
2181 @cindex functions that are passed arguments in registers on x86-32
2182 @cindex functions that pop the argument stack on x86-32
2183 @cindex functions that do not pop the argument stack on x86-32
2184 @cindex functions that have different compilation options on x86-32
2185 @cindex functions that have different optimization options
2186 @cindex functions that are dynamically resolved
2187
2188 In GNU C, you declare certain things about functions called in your program
2189 which help the compiler optimize function calls and check your code more
2190 carefully.
2191
2192 The keyword @code{__attribute__} allows you to specify special
2193 attributes when making a declaration.  This keyword is followed by an
2194 attribute specification inside double parentheses.  The following
2195 attributes are currently defined for functions on all targets:
2196 @code{aligned}, @code{alloc_size}, @code{alloc_align}, @code{assume_aligned},
2197 @code{noreturn}, @code{returns_twice}, @code{noinline}, @code{noclone},
2198 @code{no_icf},
2199 @code{always_inline}, @code{flatten}, @code{pure}, @code{const},
2200 @code{nothrow}, @code{sentinel}, @code{format}, @code{format_arg},
2201 @code{no_instrument_function}, @code{no_split_stack},
2202 @code{section}, @code{constructor},
2203 @code{destructor}, @code{used}, @code{unused}, @code{deprecated},
2204 @code{weak}, @code{malloc}, @code{alias}, @code{ifunc},
2205 @code{warn_unused_result}, @code{nonnull},
2206 @code{returns_nonnull}, @code{gnu_inline},
2207 @code{externally_visible}, @code{hot}, @code{cold}, @code{artificial},
2208 @code{no_sanitize_address}, @code{no_address_safety_analysis},
2209 @code{no_sanitize_thread},
2210 @code{no_sanitize_undefined}, @code{no_reorder}, @code{bnd_legacy},
2211 @code{bnd_instrument}, @code{stack_protect},
2212 @code{error} and @code{warning}.
2213 Several other attributes are defined for functions on particular
2214 target systems.  Other attributes, including @code{section} are
2215 supported for variables declarations (@pxref{Variable Attributes}),
2216 labels (@pxref{Label Attributes})
2217 and for types (@pxref{Type Attributes}).
2218
2219 GCC plugins may provide their own attributes.
2220
2221 You may also specify attributes with @samp{__} preceding and following
2222 each keyword.  This allows you to use them in header files without
2223 being concerned about a possible macro of the same name.  For example,
2224 you may use @code{__noreturn__} instead of @code{noreturn}.
2225
2226 @xref{Attribute Syntax}, for details of the exact syntax for using
2227 attributes.
2228
2229 @table @code
2230 @c Keep this table alphabetized by attribute name.  Treat _ as space.
2231
2232 @item alias ("@var{target}")
2233 @cindex @code{alias} attribute
2234 The @code{alias} attribute causes the declaration to be emitted as an
2235 alias for another symbol, which must be specified.  For instance,
2236
2237 @smallexample
2238 void __f () @{ /* @r{Do something.} */; @}
2239 void f () __attribute__ ((weak, alias ("__f")));
2240 @end smallexample
2241
2242 @noindent
2243 defines @samp{f} to be a weak alias for @samp{__f}.  In C++, the
2244 mangled name for the target must be used.  It is an error if @samp{__f}
2245 is not defined in the same translation unit.
2246
2247 Not all target machines support this attribute.
2248
2249 @item aligned (@var{alignment})
2250 @cindex @code{aligned} attribute
2251 This attribute specifies a minimum alignment for the function,
2252 measured in bytes.
2253
2254 You cannot use this attribute to decrease the alignment of a function,
2255 only to increase it.  However, when you explicitly specify a function
2256 alignment this overrides the effect of the
2257 @option{-falign-functions} (@pxref{Optimize Options}) option for this
2258 function.
2259
2260 Note that the effectiveness of @code{aligned} attributes may be
2261 limited by inherent limitations in your linker.  On many systems, the
2262 linker is only able to arrange for functions to be aligned up to a
2263 certain maximum alignment.  (For some linkers, the maximum supported
2264 alignment may be very very small.)  See your linker documentation for
2265 further information.
2266
2267 The @code{aligned} attribute can also be used for variables and fields
2268 (@pxref{Variable Attributes}.)
2269
2270 @item alloc_size
2271 @cindex @code{alloc_size} attribute
2272 The @code{alloc_size} attribute is used to tell the compiler that the
2273 function return value points to memory, where the size is given by
2274 one or two of the functions parameters.  GCC uses this
2275 information to improve the correctness of @code{__builtin_object_size}.
2276
2277 The function parameter(s) denoting the allocated size are specified by
2278 one or two integer arguments supplied to the attribute.  The allocated size
2279 is either the value of the single function argument specified or the product
2280 of the two function arguments specified.  Argument numbering starts at
2281 one.
2282
2283 For instance,
2284
2285 @smallexample
2286 void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)))
2287 void* my_realloc(void*, size_t) __attribute__((alloc_size(2)))
2288 @end smallexample
2289
2290 @noindent
2291 declares that @code{my_calloc} returns memory of the size given by
2292 the product of parameter 1 and 2 and that @code{my_realloc} returns memory
2293 of the size given by parameter 2.
2294
2295 @item alloc_align
2296 @cindex @code{alloc_align} attribute
2297 The @code{alloc_align} attribute is used to tell the compiler that the
2298 function return value points to memory, where the returned pointer minimum
2299 alignment is given by one of the functions parameters.  GCC uses this
2300 information to improve pointer alignment analysis.
2301
2302 The function parameter denoting the allocated alignment is specified by
2303 one integer argument, whose number is the argument of the attribute.
2304 Argument numbering starts at one.
2305
2306 For instance,
2307
2308 @smallexample
2309 void* my_memalign(size_t, size_t) __attribute__((alloc_align(1)))
2310 @end smallexample
2311
2312 @noindent
2313 declares that @code{my_memalign} returns memory with minimum alignment
2314 given by parameter 1.
2315
2316 @item assume_aligned
2317 @cindex @code{assume_aligned} attribute
2318 The @code{assume_aligned} attribute is used to tell the compiler that the
2319 function return value points to memory, where the returned pointer minimum
2320 alignment is given by the first argument.
2321 If the attribute has two arguments, the second argument is misalignment offset.
2322
2323 For instance
2324
2325 @smallexample
2326 void* my_alloc1(size_t) __attribute__((assume_aligned(16)))
2327 void* my_alloc2(size_t) __attribute__((assume_aligned(32, 8)))
2328 @end smallexample
2329
2330 @noindent
2331 declares that @code{my_alloc1} returns 16-byte aligned pointer and
2332 that @code{my_alloc2} returns a pointer whose value modulo 32 is equal
2333 to 8.
2334
2335 @item always_inline
2336 @cindex @code{always_inline} function attribute
2337 Generally, functions are not inlined unless optimization is specified.
2338 For functions declared inline, this attribute inlines the function
2339 independent of any restrictions that otherwise apply to inlining.
2340 Failure to inline such a function is diagnosed as an error.
2341 Note that if such a function is called indirectly the compiler may
2342 or may not inline it depending on optimization level and a failure
2343 to inline an indirect call may or may not be diagnosed.
2344
2345 @item gnu_inline
2346 @cindex @code{gnu_inline} function attribute
2347 This attribute should be used with a function that is also declared
2348 with the @code{inline} keyword.  It directs GCC to treat the function
2349 as if it were defined in gnu90 mode even when compiling in C99 or
2350 gnu99 mode.
2351
2352 If the function is declared @code{extern}, then this definition of the
2353 function is used only for inlining.  In no case is the function
2354 compiled as a standalone function, not even if you take its address
2355 explicitly.  Such an address becomes an external reference, as if you
2356 had only declared the function, and had not defined it.  This has
2357 almost the effect of a macro.  The way to use this is to put a
2358 function definition in a header file with this attribute, and put
2359 another copy of the function, without @code{extern}, in a library
2360 file.  The definition in the header file causes most calls to the
2361 function to be inlined.  If any uses of the function remain, they
2362 refer to the single copy in the library.  Note that the two
2363 definitions of the functions need not be precisely the same, although
2364 if they do not have the same effect your program may behave oddly.
2365
2366 In C, if the function is neither @code{extern} nor @code{static}, then
2367 the function is compiled as a standalone function, as well as being
2368 inlined where possible.
2369
2370 This is how GCC traditionally handled functions declared
2371 @code{inline}.  Since ISO C99 specifies a different semantics for
2372 @code{inline}, this function attribute is provided as a transition
2373 measure and as a useful feature in its own right.  This attribute is
2374 available in GCC 4.1.3 and later.  It is available if either of the
2375 preprocessor macros @code{__GNUC_GNU_INLINE__} or
2376 @code{__GNUC_STDC_INLINE__} are defined.  @xref{Inline,,An Inline
2377 Function is As Fast As a Macro}.
2378
2379 In C++, this attribute does not depend on @code{extern} in any way,
2380 but it still requires the @code{inline} keyword to enable its special
2381 behavior.
2382
2383 @item artificial
2384 @cindex @code{artificial} function attribute
2385 This attribute is useful for small inline wrappers that if possible
2386 should appear during debugging as a unit.  Depending on the debug
2387 info format it either means marking the function as artificial
2388 or using the caller location for all instructions within the inlined
2389 body.
2390
2391 @item bank_switch
2392 @cindex interrupt handler functions
2393 When added to an interrupt handler with the M32C port, causes the
2394 prologue and epilogue to use bank switching to preserve the registers
2395 rather than saving them on the stack.
2396
2397 @item flatten
2398 @cindex @code{flatten} function attribute
2399 Generally, inlining into a function is limited.  For a function marked with
2400 this attribute, every call inside this function is inlined, if possible.
2401 Whether the function itself is considered for inlining depends on its size and
2402 the current inlining parameters.
2403
2404 @item error ("@var{message}")
2405 @cindex @code{error} function attribute
2406 If this attribute is used on a function declaration and a call to such a function
2407 is not eliminated through dead code elimination or other optimizations, an error
2408 that includes @var{message} is diagnosed.  This is useful
2409 for compile-time checking, especially together with @code{__builtin_constant_p}
2410 and inline functions where checking the inline function arguments is not
2411 possible through @code{extern char [(condition) ? 1 : -1];} tricks.
2412 While it is possible to leave the function undefined and thus invoke
2413 a link failure, when using this attribute the problem is diagnosed
2414 earlier and with exact location of the call even in presence of inline
2415 functions or when not emitting debugging information.
2416
2417 @item warning ("@var{message}")
2418 @cindex @code{warning} function attribute
2419 If this attribute is used on a function declaration and a call to such a function
2420 is not eliminated through dead code elimination or other optimizations, a warning
2421 that includes @var{message} is diagnosed.  This is useful
2422 for compile-time checking, especially together with @code{__builtin_constant_p}
2423 and inline functions.  While it is possible to define the function with
2424 a message in @code{.gnu.warning*} section, when using this attribute the problem
2425 is diagnosed earlier and with exact location of the call even in presence
2426 of inline functions or when not emitting debugging information.
2427
2428 @item cdecl
2429 @cindex functions that do pop the argument stack on x86-32
2430 @opindex mrtd
2431 On the x86-32 targets, the @code{cdecl} attribute causes the compiler to
2432 assume that the calling function pops off the stack space used to
2433 pass arguments.  This is
2434 useful to override the effects of the @option{-mrtd} switch.
2435
2436 @item const
2437 @cindex @code{const} function attribute
2438 Many functions do not examine any values except their arguments, and
2439 have no effects except the return value.  Basically this is just slightly
2440 more strict class than the @code{pure} attribute below, since function is not
2441 allowed to read global memory.
2442
2443 @cindex pointer arguments
2444 Note that a function that has pointer arguments and examines the data
2445 pointed to must @emph{not} be declared @code{const}.  Likewise, a
2446 function that calls a non-@code{const} function usually must not be
2447 @code{const}.  It does not make sense for a @code{const} function to
2448 return @code{void}.
2449
2450 The attribute @code{const} is not implemented in GCC versions earlier
2451 than 2.5.  An alternative way to declare that a function has no side
2452 effects, which works in the current version and in some older versions,
2453 is as follows:
2454
2455 @smallexample
2456 typedef int intfn ();
2457
2458 extern const intfn square;
2459 @end smallexample
2460
2461 @noindent
2462 This approach does not work in GNU C++ from 2.6.0 on, since the language
2463 specifies that the @samp{const} must be attached to the return value.
2464
2465 @item constructor
2466 @itemx destructor
2467 @itemx constructor (@var{priority})
2468 @itemx destructor (@var{priority})
2469 @cindex @code{constructor} function attribute
2470 @cindex @code{destructor} function attribute
2471 The @code{constructor} attribute causes the function to be called
2472 automatically before execution enters @code{main ()}.  Similarly, the
2473 @code{destructor} attribute causes the function to be called
2474 automatically after @code{main ()} completes or @code{exit ()} is
2475 called.  Functions with these attributes are useful for
2476 initializing data that is used implicitly during the execution of
2477 the program.
2478
2479 You may provide an optional integer priority to control the order in
2480 which constructor and destructor functions are run.  A constructor
2481 with a smaller priority number runs before a constructor with a larger
2482 priority number; the opposite relationship holds for destructors.  So,
2483 if you have a constructor that allocates a resource and a destructor
2484 that deallocates the same resource, both functions typically have the
2485 same priority.  The priorities for constructor and destructor
2486 functions are the same as those specified for namespace-scope C++
2487 objects (@pxref{C++ Attributes}).
2488
2489 These attributes are not currently implemented for Objective-C@.
2490
2491 @item deprecated
2492 @itemx deprecated (@var{msg})
2493 @cindex @code{deprecated} attribute.
2494 The @code{deprecated} attribute results in a warning if the function
2495 is used anywhere in the source file.  This is useful when identifying
2496 functions that are expected to be removed in a future version of a
2497 program.  The warning also includes the location of the declaration
2498 of the deprecated function, to enable users to easily find further
2499 information about why the function is deprecated, or what they should
2500 do instead.  Note that the warnings only occurs for uses:
2501
2502 @smallexample
2503 int old_fn () __attribute__ ((deprecated));
2504 int old_fn ();
2505 int (*fn_ptr)() = old_fn;
2506 @end smallexample
2507
2508 @noindent
2509 results in a warning on line 3 but not line 2.  The optional @var{msg}
2510 argument, which must be a string, is printed in the warning if
2511 present.
2512
2513 The @code{deprecated} attribute can also be used for variables and
2514 types (@pxref{Variable Attributes}, @pxref{Type Attributes}.)
2515
2516 @item disinterrupt
2517 @cindex @code{disinterrupt} attribute
2518 On Epiphany and MeP targets, this attribute causes the compiler to emit
2519 instructions to disable interrupts for the duration of the given
2520 function.
2521
2522 @item dllexport
2523 @cindex @code{__declspec(dllexport)}
2524 On Microsoft Windows targets and Symbian OS targets the
2525 @code{dllexport} attribute causes the compiler to provide a global
2526 pointer to a pointer in a DLL, so that it can be referenced with the
2527 @code{dllimport} attribute.  On Microsoft Windows targets, the pointer
2528 name is formed by combining @code{_imp__} and the function or variable
2529 name.
2530
2531 You can use @code{__declspec(dllexport)} as a synonym for
2532 @code{__attribute__ ((dllexport))} for compatibility with other
2533 compilers.
2534
2535 On systems that support the @code{visibility} attribute, this
2536 attribute also implies ``default'' visibility.  It is an error to
2537 explicitly specify any other visibility.
2538
2539 In previous versions of GCC, the @code{dllexport} attribute was ignored
2540 for inlined functions, unless the @option{-fkeep-inline-functions} flag
2541 had been used.  The default behavior now is to emit all dllexported
2542 inline functions; however, this can cause object file-size bloat, in
2543 which case the old behavior can be restored by using
2544 @option{-fno-keep-inline-dllexport}.
2545
2546 The attribute is also ignored for undefined symbols.
2547
2548 When applied to C++ classes, the attribute marks defined non-inlined
2549 member functions and static data members as exports.  Static consts
2550 initialized in-class are not marked unless they are also defined
2551 out-of-class.
2552
2553 For Microsoft Windows targets there are alternative methods for
2554 including the symbol in the DLL's export table such as using a
2555 @file{.def} file with an @code{EXPORTS} section or, with GNU ld, using
2556 the @option{--export-all} linker flag.
2557
2558 @item dllimport
2559 @cindex @code{__declspec(dllimport)}
2560 On Microsoft Windows and Symbian OS targets, the @code{dllimport}
2561 attribute causes the compiler to reference a function or variable via
2562 a global pointer to a pointer that is set up by the DLL exporting the
2563 symbol.  The attribute implies @code{extern}.  On Microsoft Windows
2564 targets, the pointer name is formed by combining @code{_imp__} and the
2565 function or variable name.
2566
2567 You can use @code{__declspec(dllimport)} as a synonym for
2568 @code{__attribute__ ((dllimport))} for compatibility with other
2569 compilers.
2570
2571 On systems that support the @code{visibility} attribute, this
2572 attribute also implies ``default'' visibility.  It is an error to
2573 explicitly specify any other visibility.
2574
2575 Currently, the attribute is ignored for inlined functions.  If the
2576 attribute is applied to a symbol @emph{definition}, an error is reported.
2577 If a symbol previously declared @code{dllimport} is later defined, the
2578 attribute is ignored in subsequent references, and a warning is emitted.
2579 The attribute is also overridden by a subsequent declaration as
2580 @code{dllexport}.
2581
2582 When applied to C++ classes, the attribute marks non-inlined
2583 member functions and static data members as imports.  However, the
2584 attribute is ignored for virtual methods to allow creation of vtables
2585 using thunks.
2586
2587 On the SH Symbian OS target the @code{dllimport} attribute also has
2588 another affect---it can cause the vtable and run-time type information
2589 for a class to be exported.  This happens when the class has a
2590 dllimported constructor or a non-inline, non-pure virtual function
2591 and, for either of those two conditions, the class also has an inline
2592 constructor or destructor and has a key function that is defined in
2593 the current translation unit.
2594
2595 For Microsoft Windows targets the use of the @code{dllimport}
2596 attribute on functions is not necessary, but provides a small
2597 performance benefit by eliminating a thunk in the DLL@.  The use of the
2598 @code{dllimport} attribute on imported variables was required on older
2599 versions of the GNU linker, but can now be avoided by passing the
2600 @option{--enable-auto-import} switch to the GNU linker.  As with
2601 functions, using the attribute for a variable eliminates a thunk in
2602 the DLL@.
2603
2604 One drawback to using this attribute is that a pointer to a
2605 @emph{variable} marked as @code{dllimport} cannot be used as a constant
2606 address. However, a pointer to a @emph{function} with the
2607 @code{dllimport} attribute can be used as a constant initializer; in
2608 this case, the address of a stub function in the import lib is
2609 referenced.  On Microsoft Windows targets, the attribute can be disabled
2610 for functions by setting the @option{-mnop-fun-dllimport} flag.
2611
2612 @item eightbit_data
2613 @cindex eight-bit data on the H8/300, H8/300H, and H8S
2614 Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified
2615 variable should be placed into the eight-bit data section.
2616 The compiler generates more efficient code for certain operations
2617 on data in the eight-bit data area.  Note the eight-bit data area is limited to
2618 256 bytes of data.
2619
2620 You must use GAS and GLD from GNU binutils version 2.7 or later for
2621 this attribute to work correctly.
2622
2623 @item exception
2624 @cindex exception handler functions
2625 Use this attribute on the NDS32 target to indicate that the specified function
2626 is an exception handler.  The compiler will generate corresponding sections
2627 for use in an exception handler.
2628
2629 @item exception_handler
2630 @cindex exception handler functions on the Blackfin processor
2631 Use this attribute on the Blackfin to indicate that the specified function
2632 is an exception handler.  The compiler generates function entry and
2633 exit sequences suitable for use in an exception handler when this
2634 attribute is present.
2635
2636 @item externally_visible
2637 @cindex @code{externally_visible} attribute.
2638 This attribute, attached to a global variable or function, nullifies
2639 the effect of the @option{-fwhole-program} command-line option, so the
2640 object remains visible outside the current compilation unit.
2641
2642 If @option{-fwhole-program} is used together with @option{-flto} and 
2643 @command{gold} is used as the linker plugin, 
2644 @code{externally_visible} attributes are automatically added to functions 
2645 (not variable yet due to a current @command{gold} issue) 
2646 that are accessed outside of LTO objects according to resolution file
2647 produced by @command{gold}.
2648 For other linkers that cannot generate resolution file,
2649 explicit @code{externally_visible} attributes are still necessary.
2650
2651 @item far
2652 @cindex functions that handle memory bank switching
2653 On 68HC11 and 68HC12 the @code{far} attribute causes the compiler to
2654 use a calling convention that takes care of switching memory banks when
2655 entering and leaving a function.  This calling convention is also the
2656 default when using the @option{-mlong-calls} option.
2657
2658 On 68HC12 the compiler uses the @code{call} and @code{rtc} instructions
2659 to call and return from a function.
2660
2661 On 68HC11 the compiler generates a sequence of instructions
2662 to invoke a board-specific routine to switch the memory bank and call the
2663 real function.  The board-specific routine simulates a @code{call}.
2664 At the end of a function, it jumps to a board-specific routine
2665 instead of using @code{rts}.  The board-specific return routine simulates
2666 the @code{rtc}.
2667
2668 On MeP targets this causes the compiler to use a calling convention
2669 that assumes the called function is too far away for the built-in
2670 addressing modes.
2671
2672 @item fast_interrupt
2673 @cindex interrupt handler functions
2674 Use this attribute on the M32C and RX ports to indicate that the specified
2675 function is a fast interrupt handler.  This is just like the
2676 @code{interrupt} attribute, except that @code{freit} is used to return
2677 instead of @code{reit}.
2678
2679 @item fastcall
2680 @cindex functions that pop the argument stack on x86-32
2681 On x86-32 targets, the @code{fastcall} attribute causes the compiler to
2682 pass the first argument (if of integral type) in the register ECX and
2683 the second argument (if of integral type) in the register EDX@.  Subsequent
2684 and other typed arguments are passed on the stack.  The called function
2685 pops the arguments off the stack.  If the number of arguments is variable all
2686 arguments are pushed on the stack.
2687
2688 @item thiscall
2689 @cindex functions that pop the argument stack on x86-32
2690 On x86-32 targets, the @code{thiscall} attribute causes the compiler to
2691 pass the first argument (if of integral type) in the register ECX.
2692 Subsequent and other typed arguments are passed on the stack. The called
2693 function pops the arguments off the stack.
2694 If the number of arguments is variable all arguments are pushed on the
2695 stack.
2696 The @code{thiscall} attribute is intended for C++ non-static member functions.
2697 As a GCC extension, this calling convention can be used for C functions
2698 and for static member methods.
2699
2700 @item format (@var{archetype}, @var{string-index}, @var{first-to-check})
2701 @cindex @code{format} function attribute
2702 @opindex Wformat
2703 The @code{format} attribute specifies that a function takes @code{printf},
2704 @code{scanf}, @code{strftime} or @code{strfmon} style arguments that
2705 should be type-checked against a format string.  For example, the
2706 declaration:
2707
2708 @smallexample
2709 extern int
2710 my_printf (void *my_object, const char *my_format, ...)
2711       __attribute__ ((format (printf, 2, 3)));
2712 @end smallexample
2713
2714 @noindent
2715 causes the compiler to check the arguments in calls to @code{my_printf}
2716 for consistency with the @code{printf} style format string argument
2717 @code{my_format}.
2718
2719 The parameter @var{archetype} determines how the format string is
2720 interpreted, and should be @code{printf}, @code{scanf}, @code{strftime},
2721 @code{gnu_printf}, @code{gnu_scanf}, @code{gnu_strftime} or
2722 @code{strfmon}.  (You can also use @code{__printf__},
2723 @code{__scanf__}, @code{__strftime__} or @code{__strfmon__}.)  On
2724 MinGW targets, @code{ms_printf}, @code{ms_scanf}, and
2725 @code{ms_strftime} are also present.
2726 @var{archetype} values such as @code{printf} refer to the formats accepted
2727 by the system's C runtime library,
2728 while values prefixed with @samp{gnu_} always refer
2729 to the formats accepted by the GNU C Library.  On Microsoft Windows
2730 targets, values prefixed with @samp{ms_} refer to the formats accepted by the
2731 @file{msvcrt.dll} library.
2732 The parameter @var{string-index}
2733 specifies which argument is the format string argument (starting
2734 from 1), while @var{first-to-check} is the number of the first
2735 argument to check against the format string.  For functions
2736 where the arguments are not available to be checked (such as
2737 @code{vprintf}), specify the third parameter as zero.  In this case the
2738 compiler only checks the format string for consistency.  For
2739 @code{strftime} formats, the third parameter is required to be zero.
2740 Since non-static C++ methods have an implicit @code{this} argument, the
2741 arguments of such methods should be counted from two, not one, when
2742 giving values for @var{string-index} and @var{first-to-check}.
2743
2744 In the example above, the format string (@code{my_format}) is the second
2745 argument of the function @code{my_print}, and the arguments to check
2746 start with the third argument, so the correct parameters for the format
2747 attribute are 2 and 3.
2748
2749 @opindex ffreestanding
2750 @opindex fno-builtin
2751 The @code{format} attribute allows you to identify your own functions
2752 that take format strings as arguments, so that GCC can check the
2753 calls to these functions for errors.  The compiler always (unless
2754 @option{-ffreestanding} or @option{-fno-builtin} is used) checks formats
2755 for the standard library functions @code{printf}, @code{fprintf},
2756 @code{sprintf}, @code{scanf}, @code{fscanf}, @code{sscanf}, @code{strftime},
2757 @code{vprintf}, @code{vfprintf} and @code{vsprintf} whenever such
2758 warnings are requested (using @option{-Wformat}), so there is no need to
2759 modify the header file @file{stdio.h}.  In C99 mode, the functions
2760 @code{snprintf}, @code{vsnprintf}, @code{vscanf}, @code{vfscanf} and
2761 @code{vsscanf} are also checked.  Except in strictly conforming C
2762 standard modes, the X/Open function @code{strfmon} is also checked as
2763 are @code{printf_unlocked} and @code{fprintf_unlocked}.
2764 @xref{C Dialect Options,,Options Controlling C Dialect}.
2765
2766 For Objective-C dialects, @code{NSString} (or @code{__NSString__}) is
2767 recognized in the same context.  Declarations including these format attributes
2768 are parsed for correct syntax, however the result of checking of such format
2769 strings is not yet defined, and is not carried out by this version of the
2770 compiler.
2771
2772 The target may also provide additional types of format checks.
2773 @xref{Target Format Checks,,Format Checks Specific to Particular
2774 Target Machines}.
2775
2776 @item format_arg (@var{string-index})
2777 @cindex @code{format_arg} function attribute
2778 @opindex Wformat-nonliteral
2779 The @code{format_arg} attribute specifies that a function takes a format
2780 string for a @code{printf}, @code{scanf}, @code{strftime} or
2781 @code{strfmon} style function and modifies it (for example, to translate
2782 it into another language), so the result can be passed to a
2783 @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style
2784 function (with the remaining arguments to the format function the same
2785 as they would have been for the unmodified string).  For example, the
2786 declaration:
2787
2788 @smallexample
2789 extern char *
2790 my_dgettext (char *my_domain, const char *my_format)
2791       __attribute__ ((format_arg (2)));
2792 @end smallexample
2793
2794 @noindent
2795 causes the compiler to check the arguments in calls to a @code{printf},
2796 @code{scanf}, @code{strftime} or @code{strfmon} type function, whose
2797 format string argument is a call to the @code{my_dgettext} function, for
2798 consistency with the format string argument @code{my_format}.  If the
2799 @code{format_arg} attribute had not been specified, all the compiler
2800 could tell in such calls to format functions would be that the format
2801 string argument is not constant; this would generate a warning when
2802 @option{-Wformat-nonliteral} is used, but the calls could not be checked
2803 without the attribute.
2804
2805 The parameter @var{string-index} specifies which argument is the format
2806 string argument (starting from one).  Since non-static C++ methods have
2807 an implicit @code{this} argument, the arguments of such methods should
2808 be counted from two.
2809
2810 The @code{format_arg} attribute allows you to identify your own
2811 functions that modify format strings, so that GCC can check the
2812 calls to @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon}
2813 type function whose operands are a call to one of your own function.
2814 The compiler always treats @code{gettext}, @code{dgettext}, and
2815 @code{dcgettext} in this manner except when strict ISO C support is
2816 requested by @option{-ansi} or an appropriate @option{-std} option, or
2817 @option{-ffreestanding} or @option{-fno-builtin}
2818 is used.  @xref{C Dialect Options,,Options
2819 Controlling C Dialect}.
2820
2821 For Objective-C dialects, the @code{format-arg} attribute may refer to an
2822 @code{NSString} reference for compatibility with the @code{format} attribute
2823 above.
2824
2825 The target may also allow additional types in @code{format-arg} attributes.
2826 @xref{Target Format Checks,,Format Checks Specific to Particular
2827 Target Machines}.
2828
2829 @item function_vector
2830 @cindex calling functions through the function vector on H8/300, M16C, M32C and SH2A processors
2831 Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified
2832 function should be called through the function vector.  Calling a
2833 function through the function vector reduces code size, however;
2834 the function vector has a limited size (maximum 128 entries on the H8/300
2835 and 64 entries on the H8/300H and H8S) and shares space with the interrupt vector.
2836
2837 On SH2A targets, this attribute declares a function to be called using the
2838 TBR relative addressing mode.  The argument to this attribute is the entry
2839 number of the same function in a vector table containing all the TBR
2840 relative addressable functions.  For correct operation the TBR must be setup
2841 accordingly to point to the start of the vector table before any functions with
2842 this attribute are invoked.  Usually a good place to do the initialization is
2843 the startup routine.  The TBR relative vector table can have at max 256 function
2844 entries.  The jumps to these functions are generated using a SH2A specific,
2845 non delayed branch instruction JSR/N @@(disp8,TBR).  You must use GAS and GLD
2846 from GNU binutils version 2.7 or later for this attribute to work correctly.
2847
2848 Please refer the example of M16C target, to see the use of this
2849 attribute while declaring a function,
2850
2851 In an application, for a function being called once, this attribute
2852 saves at least 8 bytes of code; and if other successive calls are being
2853 made to the same function, it saves 2 bytes of code per each of these
2854 calls.
2855
2856 On M16C/M32C targets, the @code{function_vector} attribute declares a
2857 special page subroutine call function. Use of this attribute reduces
2858 the code size by 2 bytes for each call generated to the
2859 subroutine. The argument to the attribute is the vector number entry
2860 from the special page vector table which contains the 16 low-order
2861 bits of the subroutine's entry address. Each vector table has special
2862 page number (18 to 255) that is used in @code{jsrs} instructions.
2863 Jump addresses of the routines are generated by adding 0x0F0000 (in
2864 case of M16C targets) or 0xFF0000 (in case of M32C targets), to the
2865 2-byte addresses set in the vector table. Therefore you need to ensure
2866 that all the special page vector routines should get mapped within the
2867 address range 0x0F0000 to 0x0FFFFF (for M16C) and 0xFF0000 to 0xFFFFFF
2868 (for M32C).
2869
2870 In the following example 2 bytes are saved for each call to
2871 function @code{foo}.
2872
2873 @smallexample
2874 void foo (void) __attribute__((function_vector(0x18)));
2875 void foo (void)
2876 @{
2877 @}
2878
2879 void bar (void)
2880 @{
2881     foo();
2882 @}
2883 @end smallexample
2884
2885 If functions are defined in one file and are called in another file,
2886 then be sure to write this declaration in both files.
2887
2888 This attribute is ignored for R8C target.
2889
2890 @item ifunc ("@var{resolver}")
2891 @cindex @code{ifunc} attribute
2892 The @code{ifunc} attribute is used to mark a function as an indirect
2893 function using the STT_GNU_IFUNC symbol type extension to the ELF
2894 standard.  This allows the resolution of the symbol value to be
2895 determined dynamically at load time, and an optimized version of the
2896 routine can be selected for the particular processor or other system
2897 characteristics determined then.  To use this attribute, first define
2898 the implementation functions available, and a resolver function that
2899 returns a pointer to the selected implementation function.  The
2900 implementation functions' declarations must match the API of the
2901 function being implemented, the resolver's declaration is be a
2902 function returning pointer to void function returning void:
2903
2904 @smallexample
2905 void *my_memcpy (void *dst, const void *src, size_t len)
2906 @{
2907   @dots{}
2908 @}
2909
2910 static void (*resolve_memcpy (void)) (void)
2911 @{
2912   return my_memcpy; // we'll just always select this routine
2913 @}
2914 @end smallexample
2915
2916 @noindent
2917 The exported header file declaring the function the user calls would
2918 contain:
2919
2920 @smallexample
2921 extern void *memcpy (void *, const void *, size_t);
2922 @end smallexample
2923
2924 @noindent
2925 allowing the user to call this as a regular function, unaware of the
2926 implementation.  Finally, the indirect function needs to be defined in
2927 the same translation unit as the resolver function:
2928
2929 @smallexample
2930 void *memcpy (void *, const void *, size_t)
2931      __attribute__ ((ifunc ("resolve_memcpy")));
2932 @end smallexample
2933
2934 Indirect functions cannot be weak, and require a recent binutils (at
2935 least version 2.20.1), and GNU C library (at least version 2.11.1).
2936
2937 @item interrupt
2938 @cindex interrupt handler functions
2939 Use this attribute on the ARC, ARM, AVR, CR16, Epiphany, M32C, M32R/D,
2940 m68k, MeP, MIPS, MSP430, RL78, RX, Visium and Xstormy16 ports to indicate
2941 that the specified function is an interrupt handler.  The compiler generates
2942 function entry and exit sequences suitable for use in an interrupt handler
2943 when this attribute is present.  With Epiphany targets it may also generate
2944 a special section with code to initialize the interrupt vector table.
2945
2946 Note, interrupt handlers for the Blackfin, H8/300, H8/300H, H8S, MicroBlaze,
2947 and SH processors can be specified via the @code{interrupt_handler} attribute.
2948
2949 Note, on the ARC, you must specify the kind of interrupt to be handled
2950 in a parameter to the interrupt attribute like this:
2951
2952 @smallexample
2953 void f () __attribute__ ((interrupt ("ilink1")));
2954 @end smallexample
2955
2956 Permissible values for this parameter are: @w{@code{ilink1}} and
2957 @w{@code{ilink2}}.
2958
2959 Note, on the AVR, the hardware globally disables interrupts when an
2960 interrupt is executed.  The first instruction of an interrupt handler
2961 declared with this attribute is a @code{SEI} instruction to
2962 re-enable interrupts.  See also the @code{signal} function attribute
2963 that does not insert a @code{SEI} instruction.  If both @code{signal} and
2964 @code{interrupt} are specified for the same function, @code{signal}
2965 is silently ignored.
2966
2967 Note, for the ARM, you can specify the kind of interrupt to be handled by
2968 adding an optional parameter to the interrupt attribute like this:
2969
2970 @smallexample
2971 void f () __attribute__ ((interrupt ("IRQ")));
2972 @end smallexample
2973
2974 @noindent
2975 Permissible values for this parameter are: @code{IRQ}, @code{FIQ},
2976 @code{SWI}, @code{ABORT} and @code{UNDEF}.
2977
2978 On ARMv7-M the interrupt type is ignored, and the attribute means the function
2979 may be called with a word-aligned stack pointer.
2980
2981 Note, for the MSP430 you can provide an argument to the interrupt
2982 attribute which specifies a name or number.  If the argument is a
2983 number it indicates the slot in the interrupt vector table (0 - 31) to
2984 which this handler should be assigned.  If the argument is a name it
2985 is treated as a symbolic name for the vector slot.  These names should
2986 match up with appropriate entries in the linker script.  By default
2987 the names @code{watchdog} for vector 26, @code{nmi} for vector 30 and
2988 @code{reset} for vector 31 are recognised.
2989
2990 You can also use the following function attributes to modify how
2991 normal functions interact with interrupt functions:
2992
2993 @table @code
2994 @item critical
2995 @cindex @code{critical} attribute
2996 Critical functions disable interrupts upon entry and restore the
2997 previous interrupt state upon exit.  Critical functions cannot also
2998 have the @code{naked} or @code{reentrant} attributes.  They can have
2999 the @code{interrupt} attribute.
3000
3001 @item reentrant
3002 @cindex @code{reentrant} attribute
3003 Reentrant functions disable interrupts upon entry and enable them
3004 upon exit.  Reentrant functions cannot also have the @code{naked}
3005 or @code{critical} attributes.  They can have the @code{interrupt}
3006 attribute.
3007
3008 @item wakeup
3009 @cindex @code{wakeup} attribute
3010 This attribute only applies to interrupt functions.  It is silently
3011 ignored if applied to a non-interrupt function.  A wakeup interrupt
3012 function will rouse the processor from any low-power state that it
3013 might be in when the function exits.
3014
3015 @end table
3016
3017 On Epiphany targets one or more optional parameters can be added like this:
3018
3019 @smallexample
3020 void __attribute__ ((interrupt ("dma0, dma1"))) universal_dma_handler ();
3021 @end smallexample
3022
3023 Permissible values for these parameters are: @w{@code{reset}},
3024 @w{@code{software_exception}}, @w{@code{page_miss}},
3025 @w{@code{timer0}}, @w{@code{timer1}}, @w{@code{message}},
3026 @w{@code{dma0}}, @w{@code{dma1}}, @w{@code{wand}} and @w{@code{swi}}.
3027 Multiple parameters indicate that multiple entries in the interrupt
3028 vector table should be initialized for this function, i.e.@: for each
3029 parameter @w{@var{name}}, a jump to the function is emitted in
3030 the section @w{ivt_entry_@var{name}}.  The parameter(s) may be omitted
3031 entirely, in which case no interrupt vector table entry is provided.
3032
3033 Note, on Epiphany targets, interrupts are enabled inside the function
3034 unless the @code{disinterrupt} attribute is also specified.
3035
3036 On Epiphany targets, you can also use the following attribute to
3037 modify the behavior of an interrupt handler:
3038 @table @code
3039 @item forwarder_section
3040 @cindex @code{forwarder_section} attribute
3041 The interrupt handler may be in external memory which cannot be
3042 reached by a branch instruction, so generate a local memory trampoline
3043 to transfer control.  The single parameter identifies the section where
3044 the trampoline is placed.
3045 @end table
3046
3047 The following examples are all valid uses of these attributes on
3048 Epiphany targets:
3049 @smallexample
3050 void __attribute__ ((interrupt)) universal_handler ();
3051 void __attribute__ ((interrupt ("dma1"))) dma1_handler ();
3052 void __attribute__ ((interrupt ("dma0, dma1"))) universal_dma_handler ();
3053 void __attribute__ ((interrupt ("timer0"), disinterrupt))
3054   fast_timer_handler ();
3055 void __attribute__ ((interrupt ("dma0, dma1"), forwarder_section ("tramp")))
3056   external_dma_handler ();
3057 @end smallexample
3058
3059 On MIPS targets, you can use the following attributes to modify the behavior
3060 of an interrupt handler:
3061 @table @code
3062 @item use_shadow_register_set
3063 @cindex @code{use_shadow_register_set} attribute
3064 Assume that the handler uses a shadow register set, instead of
3065 the main general-purpose registers.
3066
3067 @item keep_interrupts_masked
3068 @cindex @code{keep_interrupts_masked} attribute
3069 Keep interrupts masked for the whole function.  Without this attribute,
3070 GCC tries to reenable interrupts for as much of the function as it can.
3071
3072 @item use_debug_exception_return
3073 @cindex @code{use_debug_exception_return} attribute
3074 Return using the @code{deret} instruction.  Interrupt handlers that don't
3075 have this attribute return using @code{eret} instead.
3076 @end table
3077
3078 You can use any combination of these attributes, as shown below:
3079 @smallexample
3080 void __attribute__ ((interrupt)) v0 ();
3081 void __attribute__ ((interrupt, use_shadow_register_set)) v1 ();
3082 void __attribute__ ((interrupt, keep_interrupts_masked)) v2 ();
3083 void __attribute__ ((interrupt, use_debug_exception_return)) v3 ();
3084 void __attribute__ ((interrupt, use_shadow_register_set,
3085                      keep_interrupts_masked)) v4 ();
3086 void __attribute__ ((interrupt, use_shadow_register_set,
3087                      use_debug_exception_return)) v5 ();
3088 void __attribute__ ((interrupt, keep_interrupts_masked,
3089                      use_debug_exception_return)) v6 ();
3090 void __attribute__ ((interrupt, use_shadow_register_set,
3091                      keep_interrupts_masked,
3092                      use_debug_exception_return)) v7 ();
3093 @end smallexample
3094
3095 On NDS32 target, this attribute is to indicate that the specified function
3096 is an interrupt handler.  The compiler will generate corresponding sections
3097 for use in an interrupt handler.  You can use the following attributes
3098 to modify the behavior:
3099 @table @code
3100 @item nested
3101 @cindex @code{nested} attribute
3102 This interrupt service routine is interruptible.
3103 @item not_nested
3104 @cindex @code{not_nested} attribute
3105 This interrupt service routine is not interruptible.
3106 @item nested_ready
3107 @cindex @code{nested_ready} attribute
3108 This interrupt service routine is interruptible after @code{PSW.GIE}
3109 (global interrupt enable) is set.  This allows interrupt service routine to
3110 finish some short critical code before enabling interrupts.
3111 @item save_all
3112 @cindex @code{save_all} attribute
3113 The system will help save all registers into stack before entering
3114 interrupt handler.
3115 @item partial_save
3116 @cindex @code{partial_save} attribute
3117 The system will help save caller registers into stack before entering
3118 interrupt handler.
3119 @end table
3120
3121 On RL78, use @code{brk_interrupt} instead of @code{interrupt} for
3122 handlers intended to be used with the @code{BRK} opcode (i.e.@: those
3123 that must end with @code{RETB} instead of @code{RETI}).
3124
3125 On RX targets, you may specify one or more vector numbers as arguments
3126 to the attribute, as well as naming an alternate table name.
3127 Parameters are handled sequentially, so one handler can be assigned to
3128 multiple entries in multiple tables.  One may also pass the magic
3129 string @code{"$default"} which causes the function to be used for any
3130 unfilled slots in the current table.
3131
3132 This example shows a simple assignment of a function to one vector in
3133 the default table (note that preprocessor macros may be used for
3134 chip-specific symbolic vector names):
3135 @smallexample
3136 void __attribute__ ((interrupt (5))) txd1_handler ();
3137 @end smallexample
3138
3139 This example assigns a function to two slots in the default table
3140 (using preprocessor macros defined elsewhere) and makes it the default
3141 for the @code{dct} table:
3142 @smallexample
3143 void __attribute__ ((interrupt (RXD1_VECT,RXD2_VECT,"dct","$default")))
3144         txd1_handler ();
3145 @end smallexample
3146
3147 @item interrupt_handler
3148 @cindex interrupt handler functions on the Blackfin, m68k, H8/300 and SH processors
3149 Use this attribute on the Blackfin, m68k, H8/300, H8/300H, H8S, and SH to
3150 indicate that the specified function is an interrupt handler.  The compiler
3151 generates function entry and exit sequences suitable for use in an
3152 interrupt handler when this attribute is present.
3153
3154 @item interrupt_thread
3155 @cindex interrupt thread functions on fido
3156 Use this attribute on fido, a subarchitecture of the m68k, to indicate
3157 that the specified function is an interrupt handler that is designed
3158 to run as a thread.  The compiler omits generate prologue/epilogue
3159 sequences and replaces the return instruction with a @code{sleep}
3160 instruction.  This attribute is available only on fido.
3161
3162 @item isr
3163 @cindex interrupt service routines on ARM
3164 Use this attribute on ARM to write Interrupt Service Routines. This is an
3165 alias to the @code{interrupt} attribute above.
3166
3167 @item kspisusp
3168 @cindex User stack pointer in interrupts on the Blackfin
3169 When used together with @code{interrupt_handler}, @code{exception_handler}
3170 or @code{nmi_handler}, code is generated to load the stack pointer
3171 from the USP register in the function prologue.
3172
3173 @item l1_text
3174 @cindex @code{l1_text} function attribute
3175 This attribute specifies a function to be placed into L1 Instruction
3176 SRAM@. The function is put into a specific section named @code{.l1.text}.
3177 With @option{-mfdpic}, function calls with a such function as the callee
3178 or caller uses inlined PLT.
3179
3180 @item l2
3181 @cindex @code{l2} function attribute
3182 On the Blackfin, this attribute specifies a function to be placed into L2
3183 SRAM. The function is put into a specific section named
3184 @code{.l1.text}. With @option{-mfdpic}, callers of such functions use
3185 an inlined PLT.
3186
3187 @item leaf
3188 @cindex @code{leaf} function attribute
3189 Calls to external functions with this attribute must return to the current
3190 compilation unit only by return or by exception handling.  In particular, leaf
3191 functions are not allowed to call callback function passed to it from the current
3192 compilation unit or directly call functions exported by the unit or longjmp
3193 into the unit.  Leaf function might still call functions from other compilation
3194 units and thus they are not necessarily leaf in the sense that they contain no
3195 function calls at all.
3196
3197 The attribute is intended for library functions to improve dataflow analysis.
3198 The compiler takes the hint that any data not escaping the current compilation unit can
3199 not be used or modified by the leaf function.  For example, the @code{sin} function
3200 is a leaf function, but @code{qsort} is not.
3201
3202 Note that leaf functions might invoke signals and signal handlers might be
3203 defined in the current compilation unit and use static variables.  The only
3204 compliant way to write such a signal handler is to declare such variables
3205 @code{volatile}.
3206
3207 The attribute has no effect on functions defined within the current compilation
3208 unit.  This is to allow easy merging of multiple compilation units into one,
3209 for example, by using the link-time optimization.  For this reason the
3210 attribute is not allowed on types to annotate indirect calls.
3211
3212 @item long_call/medium_call/short_call
3213 @cindex indirect calls on ARC
3214 @cindex indirect calls on ARM
3215 @cindex indirect calls on Epiphany
3216 These attributes specify how a particular function is called on
3217 ARC, ARM and Epiphany - with @code{medium_call} being specific to ARC.
3218 These attributes override the
3219 @option{-mlong-calls} (@pxref{ARM Options} and @ref{ARC Options})
3220 and @option{-mmedium-calls} (@pxref{ARC Options})
3221 command-line switches and @code{#pragma long_calls} settings.  For ARM, the
3222 @code{long_call} attribute indicates that the function might be far
3223 away from the call site and require a different (more expensive)
3224 calling sequence.   The @code{short_call} attribute always places
3225 the offset to the function from the call site into the @samp{BL}
3226 instruction directly.
3227
3228 For ARC, a function marked with the @code{long_call} attribute is
3229 always called using register-indirect jump-and-link instructions,
3230 thereby enabling the called function to be placed anywhere within the
3231 32-bit address space.  A function marked with the @code{medium_call}
3232 attribute will always be close enough to be called with an unconditional
3233 branch-and-link instruction, which has a 25-bit offset from
3234 the call site.  A function marked with the @code{short_call}
3235 attribute will always be close enough to be called with a conditional
3236 branch-and-link instruction, which has a 21-bit offset from
3237 the call site.
3238
3239 @item longcall/shortcall
3240 @cindex functions called via pointer on the RS/6000 and PowerPC
3241 On the Blackfin, RS/6000 and PowerPC, the @code{longcall} attribute
3242 indicates that the function might be far away from the call site and
3243 require a different (more expensive) calling sequence.  The
3244 @code{shortcall} attribute indicates that the function is always close
3245 enough for the shorter calling sequence to be used.  These attributes
3246 override both the @option{-mlongcall} switch and, on the RS/6000 and
3247 PowerPC, the @code{#pragma longcall} setting.
3248
3249 @xref{RS/6000 and PowerPC Options}, for more information on whether long
3250 calls are necessary.
3251
3252 @item long_call/near/far
3253 @cindex indirect calls on MIPS
3254 These attributes specify how a particular function is called on MIPS@.
3255 The attributes override the @option{-mlong-calls} (@pxref{MIPS Options})
3256 command-line switch.  The @code{long_call} and @code{far} attributes are
3257 synonyms, and cause the compiler to always call
3258 the function by first loading its address into a register, and then using
3259 the contents of that register.  The @code{near} attribute has the opposite
3260 effect; it specifies that non-PIC calls should be made using the more
3261 efficient @code{jal} instruction.
3262
3263 @item malloc
3264 @cindex @code{malloc} attribute
3265 This tells the compiler that a function is @code{malloc}-like, i.e.,
3266 that the pointer @var{P} returned by the function cannot alias any
3267 other pointer valid when the function returns, and moreover no
3268 pointers to valid objects occur in any storage addressed by @var{P}.
3269
3270 Using this attribute can improve optimization.  Functions like
3271 @code{malloc} and @code{calloc} have this property because they return
3272 a pointer to uninitialized or zeroed-out storage.  However, functions
3273 like @code{realloc} do not have this property, as they can return a
3274 pointer to storage containing pointers.
3275
3276 @item mips16/nomips16
3277 @cindex @code{mips16} attribute
3278 @cindex @code{nomips16} attribute
3279
3280 On MIPS targets, you can use the @code{mips16} and @code{nomips16}
3281 function attributes to locally select or turn off MIPS16 code generation.
3282 A function with the @code{mips16} attribute is emitted as MIPS16 code,
3283 while MIPS16 code generation is disabled for functions with the
3284 @code{nomips16} attribute.  These attributes override the
3285 @option{-mips16} and @option{-mno-mips16} options on the command line
3286 (@pxref{MIPS Options}).
3287
3288 When compiling files containing mixed MIPS16 and non-MIPS16 code, the
3289 preprocessor symbol @code{__mips16} reflects the setting on the command line,
3290 not that within individual functions.  Mixed MIPS16 and non-MIPS16 code
3291 may interact badly with some GCC extensions such as @code{__builtin_apply}
3292 (@pxref{Constructing Calls}).
3293
3294 @item micromips/nomicromips
3295 @cindex @code{micromips} attribute
3296 @cindex @code{nomicromips} attribute
3297
3298 On MIPS targets, you can use the @code{micromips} and @code{nomicromips}
3299 function attributes to locally select or turn off microMIPS code generation.
3300 A function with the @code{micromips} attribute is emitted as microMIPS code,
3301 while microMIPS code generation is disabled for functions with the
3302 @code{nomicromips} attribute.  These attributes override the
3303 @option{-mmicromips} and @option{-mno-micromips} options on the command line
3304 (@pxref{MIPS Options}).
3305
3306 When compiling files containing mixed microMIPS and non-microMIPS code, the
3307 preprocessor symbol @code{__mips_micromips} reflects the setting on the
3308 command line,
3309 not that within individual functions.  Mixed microMIPS and non-microMIPS code
3310 may interact badly with some GCC extensions such as @code{__builtin_apply}
3311 (@pxref{Constructing Calls}).
3312
3313 @item model (@var{model-name})
3314 @cindex function addressability on the M32R/D
3315 @cindex variable addressability on the IA-64
3316
3317 On the M32R/D, use this attribute to set the addressability of an
3318 object, and of the code generated for a function.  The identifier
3319 @var{model-name} is one of @code{small}, @code{medium}, or
3320 @code{large}, representing each of the code models.
3321
3322 Small model objects live in the lower 16MB of memory (so that their
3323 addresses can be loaded with the @code{ld24} instruction), and are
3324 callable with the @code{bl} instruction.
3325
3326 Medium model objects may live anywhere in the 32-bit address space (the
3327 compiler generates @code{seth/add3} instructions to load their addresses),
3328 and are callable with the @code{bl} instruction.
3329
3330 Large model objects may live anywhere in the 32-bit address space (the
3331 compiler generates @code{seth/add3} instructions to load their addresses),
3332 and may not be reachable with the @code{bl} instruction (the compiler
3333 generates the much slower @code{seth/add3/jl} instruction sequence).
3334
3335 On IA-64, use this attribute to set the addressability of an object.
3336 At present, the only supported identifier for @var{model-name} is
3337 @code{small}, indicating addressability via ``small'' (22-bit)
3338 addresses (so that their addresses can be loaded with the @code{addl}
3339 instruction).  Caveat: such addressing is by definition not position
3340 independent and hence this attribute must not be used for objects
3341 defined by shared libraries.
3342
3343 @item ms_abi/sysv_abi
3344 @cindex @code{ms_abi} attribute
3345 @cindex @code{sysv_abi} attribute
3346
3347 On 32-bit and 64-bit x86 targets, you can use an ABI attribute
3348 to indicate which calling convention should be used for a function.  The
3349 @code{ms_abi} attribute tells the compiler to use the Microsoft ABI,
3350 while the @code{sysv_abi} attribute tells the compiler to use the ABI
3351 used on GNU/Linux and other systems.  The default is to use the Microsoft ABI
3352 when targeting Windows.  On all other systems, the default is the x86/AMD ABI.
3353
3354 Note, the @code{ms_abi} attribute for Microsoft Windows 64-bit targets currently
3355 requires the @option{-maccumulate-outgoing-args} option.
3356
3357 @item callee_pop_aggregate_return (@var{number})
3358 @cindex @code{callee_pop_aggregate_return} attribute
3359
3360 On x86-32 targets, you can use this attribute to control how
3361 aggregates are returned in memory.  If the caller is responsible for
3362 popping the hidden pointer together with the rest of the arguments, specify
3363 @var{number} equal to zero.  If callee is responsible for popping the
3364 hidden pointer, specify @var{number} equal to one.  
3365
3366 The default x86-32 ABI assumes that the callee pops the
3367 stack for hidden pointer.  However, on x86-32 Microsoft Windows targets,
3368 the compiler assumes that the
3369 caller pops the stack for hidden pointer.
3370
3371 @item ms_hook_prologue
3372 @cindex @code{ms_hook_prologue} attribute
3373
3374 On 32-bit and 64-bit x86 targets, you can use
3375 this function attribute to make GCC generate the ``hot-patching'' function
3376 prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2
3377 and newer.
3378
3379 @item hotpatch (@var{halfwords-before-function-label},@var{halfwords-after-function-label})
3380 @cindex @code{hotpatch} attribute
3381
3382 On S/390 System z targets, you can use this function attribute to
3383 make GCC generate a ``hot-patching'' function prologue.  If the
3384 @option{-mhotpatch=} command-line option is used at the same time,
3385 the @code{hotpatch} attribute takes precedence.  The first of the
3386 two arguments specifies the number of halfwords to be added before
3387 the function label.  A second argument can be used to specify the
3388 number of halfwords to be added after the function label.  For
3389 both arguments the maximum allowed value is 1000000.
3390
3391 If both ar guments are zero, hotpatching is disabled.
3392
3393 @item naked
3394 @cindex function without a prologue/epilogue code
3395 This attribute is available on the ARM, AVR, MCORE, MSP430, NDS32,
3396 RL78, RX and SPU ports.  It allows the compiler to construct the
3397 requisite function declaration, while allowing the body of the
3398 function to be assembly code. The specified function will not have
3399 prologue/epilogue sequences generated by the compiler. Only basic
3400 @code{asm} statements can safely be included in naked functions
3401 (@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
3402 basic @code{asm} and C code may appear to work, they cannot be
3403 depended upon to work reliably and are not supported.
3404
3405 @item near
3406 @cindex functions that do not handle memory bank switching on 68HC11/68HC12
3407 On 68HC11 and 68HC12 the @code{near} attribute causes the compiler to
3408 use the normal calling convention based on @code{jsr} and @code{rts}.
3409 This attribute can be used to cancel the effect of the @option{-mlong-calls}
3410 option.
3411
3412 On MeP targets this attribute causes the compiler to assume the called
3413 function is close enough to use the normal calling convention,
3414 overriding the @option{-mtf} command-line option.
3415
3416 @item nesting
3417 @cindex Allow nesting in an interrupt handler on the Blackfin processor.
3418 Use this attribute together with @code{interrupt_handler},
3419 @code{exception_handler} or @code{nmi_handler} to indicate that the function
3420 entry code should enable nested interrupts or exceptions.
3421
3422 @item nmi_handler
3423 @cindex NMI handler functions on the Blackfin processor
3424 Use this attribute on the Blackfin to indicate that the specified function
3425 is an NMI handler.  The compiler generates function entry and
3426 exit sequences suitable for use in an NMI handler when this
3427 attribute is present.
3428
3429 @item nocompression
3430 @cindex @code{nocompression} attribute
3431 On MIPS targets, you can use the @code{nocompression} function attribute
3432 to locally turn off MIPS16 and microMIPS code generation.  This attribute
3433 overrides the @option{-mips16} and @option{-mmicromips} options on the
3434 command line (@pxref{MIPS Options}).
3435
3436 @item no_instrument_function
3437 @cindex @code{no_instrument_function} function attribute
3438 @opindex finstrument-functions
3439 If @option{-finstrument-functions} is given, profiling function calls are
3440 generated at entry and exit of most user-compiled functions.
3441 Functions with this attribute are not so instrumented.
3442
3443 @item no_split_stack
3444 @cindex @code{no_split_stack} function attribute
3445 @opindex fsplit-stack
3446 If @option{-fsplit-stack} is given, functions have a small
3447 prologue which decides whether to split the stack.  Functions with the
3448 @code{no_split_stack} attribute do not have that prologue, and thus
3449 may run with only a small amount of stack space available.
3450
3451 @item stack_protect
3452 @cindex @code{stack_protect} function attribute
3453 This function attribute make a stack protection of the function if 
3454 flags @option{fstack-protector} or @option{fstack-protector-strong}
3455 or @option{fstack-protector-explicit} are set.
3456
3457 @item noinline
3458 @cindex @code{noinline} function attribute
3459 This function attribute prevents a function from being considered for
3460 inlining.
3461 @c Don't enumerate the optimizations by name here; we try to be
3462 @c future-compatible with this mechanism.
3463 If the function does not have side-effects, there are optimizations
3464 other than inlining that cause function calls to be optimized away,
3465 although the function call is live.  To keep such calls from being
3466 optimized away, put
3467 @smallexample
3468 asm ("");
3469 @end smallexample
3470
3471 @noindent
3472 (@pxref{Extended Asm}) in the called function, to serve as a special
3473 side-effect.
3474
3475 @item noclone
3476 @cindex @code{noclone} function attribute
3477 This function attribute prevents a function from being considered for
3478 cloning---a mechanism that produces specialized copies of functions
3479 and which is (currently) performed by interprocedural constant
3480 propagation.
3481
3482 @item no_icf
3483 @cindex @code{no_icf} function attribute
3484 This function attribute prevents a functions from being merged with another
3485 semantically equivalent function.
3486
3487 @item nonnull (@var{arg-index}, @dots{})
3488 @cindex @code{nonnull} function attribute
3489 The @code{nonnull} attribute specifies that some function parameters should
3490 be non-null pointers.  For instance, the declaration:
3491
3492 @smallexample
3493 extern void *
3494 my_memcpy (void *dest, const void *src, size_t len)
3495         __attribute__((nonnull (1, 2)));
3496 @end smallexample
3497
3498 @noindent
3499 causes the compiler to check that, in calls to @code{my_memcpy},
3500 arguments @var{dest} and @var{src} are non-null.  If the compiler
3501 determines that a null pointer is passed in an argument slot marked
3502 as non-null, and the @option{-Wnonnull} option is enabled, a warning
3503 is issued.  The compiler may also choose to make optimizations based
3504 on the knowledge that certain function arguments will never be null.
3505
3506 If no argument index list is given to the @code{nonnull} attribute,
3507 all pointer arguments are marked as non-null.  To illustrate, the
3508 following declaration is equivalent to the previous example:
3509
3510 @smallexample
3511 extern void *
3512 my_memcpy (void *dest, const void *src, size_t len)
3513         __attribute__((nonnull));
3514 @end smallexample
3515
3516 @item no_reorder
3517 @cindex @code{no_reorder} function or variable attribute
3518 Do not reorder functions or variables marked @code{no_reorder}
3519 against each other or top level assembler statements the executable.
3520 The actual order in the program will depend on the linker command
3521 line. Static variables marked like this are also not removed.
3522 This has a similar effect
3523 as the @option{-fno-toplevel-reorder} option, but only applies to the
3524 marked symbols.
3525
3526 @item returns_nonnull
3527 @cindex @code{returns_nonnull} function attribute
3528 The @code{returns_nonnull} attribute specifies that the function
3529 return value should be a non-null pointer.  For instance, the declaration:
3530
3531 @smallexample
3532 extern void *
3533 mymalloc (size_t len) __attribute__((returns_nonnull));
3534 @end smallexample
3535
3536 @noindent
3537 lets the compiler optimize callers based on the knowledge
3538 that the return value will never be null.
3539
3540 @item noreturn
3541 @cindex @code{noreturn} function attribute
3542 A few standard library functions, such as @code{abort} and @code{exit},
3543 cannot return.  GCC knows this automatically.  Some programs define
3544 their own functions that never return.  You can declare them
3545 @code{noreturn} to tell the compiler this fact.  For example,
3546
3547 @smallexample
3548 @group
3549 void fatal () __attribute__ ((noreturn));
3550
3551 void
3552 fatal (/* @r{@dots{}} */)
3553 @{
3554   /* @r{@dots{}} */ /* @r{Print error message.} */ /* @r{@dots{}} */
3555   exit (1);
3556 @}
3557 @end group
3558 @end smallexample
3559
3560 The @code{noreturn} keyword tells the compiler to assume that
3561 @code{fatal} cannot return.  It can then optimize without regard to what
3562 would happen if @code{fatal} ever did return.  This makes slightly
3563 better code.  More importantly, it helps avoid spurious warnings of
3564 uninitialized variables.
3565
3566 The @code{noreturn} keyword does not affect the exceptional path when that
3567 applies: a @code{noreturn}-marked function may still return to the caller
3568 by throwing an exception or calling @code{longjmp}.
3569
3570 Do not assume that registers saved by the calling function are
3571 restored before calling the @code{noreturn} function.
3572
3573 It does not make sense for a @code{noreturn} function to have a return
3574 type other than @code{void}.
3575
3576 The attribute @code{noreturn} is not implemented in GCC versions
3577 earlier than 2.5.  An alternative way to declare that a function does
3578 not return, which works in the current version and in some older
3579 versions, is as follows:
3580
3581 @smallexample
3582 typedef void voidfn ();
3583
3584 volatile voidfn fatal;
3585 @end smallexample
3586
3587 @noindent
3588 This approach does not work in GNU C++.
3589
3590 @item nothrow
3591 @cindex @code{nothrow} function attribute
3592 The @code{nothrow} attribute is used to inform the compiler that a
3593 function cannot throw an exception.  For example, most functions in
3594 the standard C library can be guaranteed not to throw an exception
3595 with the notable exceptions of @code{qsort} and @code{bsearch} that
3596 take function pointer arguments.  The @code{nothrow} attribute is not
3597 implemented in GCC versions earlier than 3.3.
3598
3599 @item nosave_low_regs
3600 @cindex @code{nosave_low_regs} attribute
3601 Use this attribute on SH targets to indicate that an @code{interrupt_handler}
3602 function should not save and restore registers R0..R7.  This can be used on SH3*
3603 and SH4* targets that have a second R0..R7 register bank for non-reentrant
3604 interrupt handlers.
3605
3606 @item optimize
3607 @cindex @code{optimize} function attribute
3608 The @code{optimize} attribute is used to specify that a function is to
3609 be compiled with different optimization options than specified on the
3610 command line.  Arguments can either be numbers or strings.  Numbers
3611 are assumed to be an optimization level.  Strings that begin with
3612 @code{O} are assumed to be an optimization option, while other options
3613 are assumed to be used with a @code{-f} prefix.  You can also use the
3614 @samp{#pragma GCC optimize} pragma to set the optimization options
3615 that affect more than one function.
3616 @xref{Function Specific Option Pragmas}, for details about the
3617 @samp{#pragma GCC optimize} pragma.
3618
3619 This can be used for instance to have frequently-executed functions
3620 compiled with more aggressive optimization options that produce faster
3621 and larger code, while other functions can be compiled with less
3622 aggressive options.
3623
3624 @item OS_main/OS_task
3625 @cindex @code{OS_main} AVR function attribute
3626 @cindex @code{OS_task} AVR function attribute
3627 On AVR, functions with the @code{OS_main} or @code{OS_task} attribute
3628 do not save/restore any call-saved register in their prologue/epilogue.
3629
3630 The @code{OS_main} attribute can be used when there @emph{is
3631 guarantee} that interrupts are disabled at the time when the function
3632 is entered.  This saves resources when the stack pointer has to be
3633 changed to set up a frame for local variables.
3634
3635 The @code{OS_task} attribute can be used when there is @emph{no
3636 guarantee} that interrupts are disabled at that time when the function
3637 is entered like for, e@.g@. task functions in a multi-threading operating
3638 system. In that case, changing the stack pointer register is
3639 guarded by save/clear/restore of the global interrupt enable flag.
3640
3641 The differences to the @code{naked} function attribute are:
3642 @itemize @bullet
3643 @item @code{naked} functions do not have a return instruction whereas 
3644 @code{OS_main} and @code{OS_task} functions have a @code{RET} or
3645 @code{RETI} return instruction.
3646 @item @code{naked} functions do not set up a frame for local variables
3647 or a frame pointer whereas @code{OS_main} and @code{OS_task} do this
3648 as needed.
3649 @end itemize
3650
3651 @item pcs
3652 @cindex @code{pcs} function attribute
3653
3654 The @code{pcs} attribute can be used to control the calling convention
3655 used for a function on ARM.  The attribute takes an argument that specifies
3656 the calling convention to use.
3657
3658 When compiling using the AAPCS ABI (or a variant of it) then valid
3659 values for the argument are @code{"aapcs"} and @code{"aapcs-vfp"}.  In
3660 order to use a variant other than @code{"aapcs"} then the compiler must
3661 be permitted to use the appropriate co-processor registers (i.e., the
3662 VFP registers must be available in order to use @code{"aapcs-vfp"}).
3663 For example,
3664
3665 @smallexample
3666 /* Argument passed in r0, and result returned in r0+r1.  */
3667 double f2d (float) __attribute__((pcs("aapcs")));
3668 @end smallexample
3669
3670 Variadic functions always use the @code{"aapcs"} calling convention and
3671 the compiler rejects attempts to specify an alternative.
3672
3673 @item pure
3674 @cindex @code{pure} function attribute
3675 Many functions have no effects except the return value and their
3676 return value depends only on the parameters and/or global variables.
3677 Such a function can be subject
3678 to common subexpression elimination and loop optimization just as an
3679 arithmetic operator would be.  These functions should be declared
3680 with the attribute @code{pure}.  For example,
3681
3682 @smallexample
3683 int square (int) __attribute__ ((pure));
3684 @end smallexample
3685
3686 @noindent
3687 says that the hypothetical function @code{square} is safe to call
3688 fewer times than the program says.
3689
3690 Some of common examples of pure functions are @code{strlen} or @code{memcmp}.
3691 Interesting non-pure functions are functions with infinite loops or those
3692 depending on volatile memory or other system resource, that may change between
3693 two consecutive calls (such as @code{feof} in a multithreading environment).
3694
3695 The attribute @code{pure} is not implemented in GCC versions earlier
3696 than 2.96.
3697
3698 @item hot
3699 @cindex @code{hot} function attribute
3700 The @code{hot} attribute on a function is used to inform the compiler that
3701 the function is a hot spot of the compiled program.  The function is
3702 optimized more aggressively and on many targets it is placed into a special
3703 subsection of the text section so all hot functions appear close together,
3704 improving locality.
3705
3706 When profile feedback is available, via @option{-fprofile-use}, hot functions
3707 are automatically detected and this attribute is ignored.
3708
3709 The @code{hot} attribute on functions is not implemented in GCC versions
3710 earlier than 4.3.
3711
3712 @item cold
3713 @cindex @code{cold} function attribute
3714 The @code{cold} attribute on functions is used to inform the compiler that
3715 the function is unlikely to be executed.  The function is optimized for
3716 size rather than speed and on many targets it is placed into a special
3717 subsection of the text section so all cold functions appear close together,
3718 improving code locality of non-cold parts of program.  The paths leading
3719 to calls of cold functions within code are marked as unlikely by the branch
3720 prediction mechanism.  It is thus useful to mark functions used to handle
3721 unlikely conditions, such as @code{perror}, as cold to improve optimization
3722 of hot functions that do call marked functions in rare occasions.
3723
3724 When profile feedback is available, via @option{-fprofile-use}, cold functions
3725 are automatically detected and this attribute is ignored.
3726
3727 The @code{cold} attribute on functions is not implemented in GCC versions
3728 earlier than 4.3.
3729
3730 @item no_sanitize_address
3731 @itemx no_address_safety_analysis
3732 @cindex @code{no_sanitize_address} function attribute
3733 The @code{no_sanitize_address} attribute on functions is used
3734 to inform the compiler that it should not instrument memory accesses
3735 in the function when compiling with the @option{-fsanitize=address} option.
3736 The @code{no_address_safety_analysis} is a deprecated alias of the
3737 @code{no_sanitize_address} attribute, new code should use
3738 @code{no_sanitize_address}.
3739
3740 @item no_sanitize_thread
3741 @cindex @code{no_sanitize_thread} function attribute
3742 The @code{no_sanitize_thread} attribute on functions is used
3743 to inform the compiler that it should not instrument memory accesses
3744 in the function when compiling with the @option{-fsanitize=thread} option.
3745
3746 @item no_sanitize_undefined
3747 @cindex @code{no_sanitize_undefined} function attribute
3748 The @code{no_sanitize_undefined} attribute on functions is used
3749 to inform the compiler that it should not check for undefined behavior
3750 in the function when compiling with the @option{-fsanitize=undefined} option.
3751
3752 @item bnd_legacy
3753 @cindex @code{bnd_legacy} function attribute
3754 The @code{bnd_legacy} attribute on functions is used to inform
3755 compiler that function should not be instrumented when compiled
3756 with @option{-fcheck-pointer-bounds} option.
3757
3758 @item bnd_instrument
3759 @cindex @code{bnd_instrument} function attribute
3760 The @code{bnd_instrument} attribute on functions is used to inform
3761 compiler that function should be instrumented when compiled
3762 with @option{-fchkp-instrument-marked-only} option.
3763
3764 @item regparm (@var{number})
3765 @cindex @code{regparm} attribute
3766 @cindex functions that are passed arguments in registers on x86-32
3767 On x86-32 targets, the @code{regparm} attribute causes the compiler to
3768 pass arguments number one to @var{number} if they are of integral type
3769 in registers EAX, EDX, and ECX instead of on the stack.  Functions that
3770 take a variable number of arguments continue to be passed all of their
3771 arguments on the stack.
3772
3773 Beware that on some ELF systems this attribute is unsuitable for
3774 global functions in shared libraries with lazy binding (which is the
3775 default).  Lazy binding sends the first call via resolving code in
3776 the loader, which might assume EAX, EDX and ECX can be clobbered, as
3777 per the standard calling conventions.  Solaris 8 is affected by this.
3778 Systems with the GNU C Library version 2.1 or higher
3779 and FreeBSD are believed to be
3780 safe since the loaders there save EAX, EDX and ECX.  (Lazy binding can be
3781 disabled with the linker or the loader if desired, to avoid the
3782 problem.)
3783
3784 @item reset
3785 @cindex reset handler functions
3786 Use this attribute on the NDS32 target to indicate that the specified function
3787 is a reset handler.  The compiler will generate corresponding sections
3788 for use in a reset handler.  You can use the following attributes
3789 to provide extra exception handling:
3790 @table @code
3791 @item nmi
3792 @cindex @code{nmi} attribute
3793 Provide a user-defined function to handle NMI exception.
3794 @item warm
3795 @cindex @code{warm} attribute
3796 Provide a user-defined function to handle warm reset exception.
3797 @end table
3798
3799 @item sseregparm
3800 @cindex @code{sseregparm} attribute
3801 On x86-32 targets with SSE support, the @code{sseregparm} attribute
3802 causes the compiler to pass up to 3 floating-point arguments in
3803 SSE registers instead of on the stack.  Functions that take a
3804 variable number of arguments continue to pass all of their
3805 floating-point arguments on the stack.
3806
3807 @item force_align_arg_pointer
3808 @cindex @code{force_align_arg_pointer} attribute
3809 On x86 targets, the @code{force_align_arg_pointer} attribute may be
3810 applied to individual function definitions, generating an alternate
3811 prologue and epilogue that realigns the run-time stack if necessary.
3812 This supports mixing legacy codes that run with a 4-byte aligned stack
3813 with modern codes that keep a 16-byte stack for SSE compatibility.
3814
3815 @item renesas
3816 @cindex @code{renesas} attribute
3817 On SH targets this attribute specifies that the function or struct follows the
3818 Renesas ABI.
3819
3820 @item resbank
3821 @cindex @code{resbank} attribute
3822 On the SH2A target, this attribute enables the high-speed register
3823 saving and restoration using a register bank for @code{interrupt_handler}
3824 routines.  Saving to the bank is performed automatically after the CPU
3825 accepts an interrupt that uses a register bank.
3826
3827 The nineteen 32-bit registers comprising general register R0 to R14,
3828 control register GBR, and system registers MACH, MACL, and PR and the
3829 vector table address offset are saved into a register bank.  Register
3830 banks are stacked in first-in last-out (FILO) sequence.  Restoration
3831 from the bank is executed by issuing a RESBANK instruction.
3832
3833 @item returns_twice
3834 @cindex @code{returns_twice} attribute
3835 The @code{returns_twice} attribute tells the compiler that a function may
3836 return more than one time.  The compiler ensures that all registers
3837 are dead before calling such a function and emits a warning about
3838 the variables that may be clobbered after the second return from the
3839 function.  Examples of such functions are @code{setjmp} and @code{vfork}.
3840 The @code{longjmp}-like counterpart of such function, if any, might need
3841 to be marked with the @code{noreturn} attribute.
3842
3843 @item saveall
3844 @cindex save all registers on the Blackfin, H8/300, H8/300H, and H8S
3845 Use this attribute on the Blackfin, H8/300, H8/300H, and H8S to indicate that
3846 all registers except the stack pointer should be saved in the prologue
3847 regardless of whether they are used or not.
3848
3849 @item save_volatiles
3850 @cindex save volatile registers on the MicroBlaze
3851 Use this attribute on the MicroBlaze to indicate that the function is
3852 an interrupt handler.  All volatile registers (in addition to non-volatile
3853 registers) are saved in the function prologue.  If the function is a leaf
3854 function, only volatiles used by the function are saved.  A normal function
3855 return is generated instead of a return from interrupt.
3856
3857 @item break_handler
3858 @cindex break handler functions
3859 Use this attribute on the MicroBlaze ports to indicate that
3860 the specified function is an break handler.  The compiler generates function
3861 entry and exit sequences suitable for use in an break handler when this
3862 attribute is present. The return from @code{break_handler} is done through
3863 the @code{rtbd} instead of @code{rtsd}.
3864
3865 @smallexample
3866 void f () __attribute__ ((break_handler));
3867 @end smallexample
3868
3869 @item section ("@var{section-name}")
3870 @cindex @code{section} function attribute
3871 Normally, the compiler places the code it generates in the @code{text} section.
3872 Sometimes, however, you need additional sections, or you need certain
3873 particular functions to appear in special sections.  The @code{section}
3874 attribute specifies that a function lives in a particular section.
3875 For example, the declaration:
3876
3877 @smallexample
3878 extern void foobar (void) __attribute__ ((section ("bar")));
3879 @end smallexample
3880
3881 @noindent
3882 puts the function @code{foobar} in the @code{bar} section.
3883
3884 Some file formats do not support arbitrary sections so the @code{section}
3885 attribute is not available on all platforms.
3886 If you need to map the entire contents of a module to a particular
3887 section, consider using the facilities of the linker instead.
3888
3889 @item sentinel
3890 @cindex @code{sentinel} function attribute
3891 This function attribute ensures that a parameter in a function call is
3892 an explicit @code{NULL}.  The attribute is only valid on variadic
3893 functions.  By default, the sentinel is located at position zero, the
3894 last parameter of the function call.  If an optional integer position
3895 argument P is supplied to the attribute, the sentinel must be located at
3896 position P counting backwards from the end of the argument list.
3897
3898 @smallexample
3899 __attribute__ ((sentinel))
3900 is equivalent to
3901 __attribute__ ((sentinel(0)))
3902 @end smallexample
3903
3904 The attribute is automatically set with a position of 0 for the built-in
3905 functions @code{execl} and @code{execlp}.  The built-in function
3906 @code{execle} has the attribute set with a position of 1.
3907
3908 A valid @code{NULL} in this context is defined as zero with any pointer
3909 type.  If your system defines the @code{NULL} macro with an integer type
3910 then you need to add an explicit cast.  GCC replaces @code{stddef.h}
3911 with a copy that redefines NULL appropriately.
3912
3913 The warnings for missing or incorrect sentinels are enabled with
3914 @option{-Wformat}.
3915
3916 @item short_call
3917 See @code{long_call/short_call}.
3918
3919 @item shortcall
3920 See @code{longcall/shortcall}.
3921
3922 @item signal
3923 @cindex interrupt handler functions on the AVR processors
3924 Use this attribute on the AVR to indicate that the specified
3925 function is an interrupt handler.  The compiler generates function
3926 entry and exit sequences suitable for use in an interrupt handler when this
3927 attribute is present.
3928
3929 See also the @code{interrupt} function attribute. 
3930
3931 The AVR hardware globally disables interrupts when an interrupt is executed.
3932 Interrupt handler functions defined with the @code{signal} attribute
3933 do not re-enable interrupts.  It is save to enable interrupts in a
3934 @code{signal} handler.  This ``save'' only applies to the code
3935 generated by the compiler and not to the IRQ layout of the
3936 application which is responsibility of the application.
3937
3938 If both @code{signal} and @code{interrupt} are specified for the same
3939 function, @code{signal} is silently ignored.
3940
3941 @item sp_switch
3942 @cindex @code{sp_switch} attribute
3943 Use this attribute on the SH to indicate an @code{interrupt_handler}
3944 function should switch to an alternate stack.  It expects a string
3945 argument that names a global variable holding the address of the
3946 alternate stack.
3947
3948 @smallexample
3949 void *alt_stack;
3950 void f () __attribute__ ((interrupt_handler,
3951                           sp_switch ("alt_stack")));
3952 @end smallexample
3953
3954 @item stdcall
3955 @cindex functions that pop the argument stack on x86-32
3956 On x86-32 targets, the @code{stdcall} attribute causes the compiler to
3957 assume that the called function pops off the stack space used to
3958 pass arguments, unless it takes a variable number of arguments.
3959
3960 @item syscall_linkage
3961 @cindex @code{syscall_linkage} attribute
3962 This attribute is used to modify the IA-64 calling convention by marking
3963 all input registers as live at all function exits.  This makes it possible
3964 to restart a system call after an interrupt without having to save/restore
3965 the input registers.  This also prevents kernel data from leaking into
3966 application code.
3967
3968 @item target
3969 @cindex @code{target} function attribute
3970 The @code{target} attribute is used to specify that a function is to
3971 be compiled with different target options than specified on the
3972 command line.  This can be used for instance to have functions
3973 compiled with a different ISA (instruction set architecture) than the
3974 default.  You can also use the @samp{#pragma GCC target} pragma to set
3975 more than one function to be compiled with specific target options.
3976 @xref{Function Specific Option Pragmas}, for details about the
3977 @samp{#pragma GCC target} pragma.
3978
3979 For instance on an x86, you could compile one function with
3980 @code{target("sse4.1,arch=core2")} and another with
3981 @code{target("sse4a,arch=amdfam10")}.  This is equivalent to
3982 compiling the first function with @option{-msse4.1} and
3983 @option{-march=core2} options, and the second function with
3984 @option{-msse4a} and @option{-march=amdfam10} options.  It is up to the
3985 user to make sure that a function is only invoked on a machine that
3986 supports the particular ISA it is compiled for (for example by using
3987 @code{cpuid} on x86 to determine what feature bits and architecture
3988 family are used).
3989
3990 @smallexample
3991 int core2_func (void) __attribute__ ((__target__ ("arch=core2")));
3992 int sse3_func (void) __attribute__ ((__target__ ("sse3")));
3993 @end smallexample
3994
3995 You can either use multiple
3996 strings to specify multiple options, or separate the options
3997 with a comma (@samp{,}).
3998
3999 The @code{target} attribute is presently implemented for
4000 x86, PowerPC, and Nios II targets only.
4001 The options supported are specific to each target.
4002
4003 On the x86, the following options are allowed:
4004
4005 @table @samp
4006 @item abm
4007 @itemx no-abm
4008 @cindex @code{target("abm")} attribute
4009 Enable/disable the generation of the advanced bit instructions.
4010
4011 @item aes
4012 @itemx no-aes
4013 @cindex @code{target("aes")} attribute
4014 Enable/disable the generation of the AES instructions.
4015
4016 @item default
4017 @cindex @code{target("default")} attribute
4018 @xref{Function Multiversioning}, where it is used to specify the
4019 default function version.
4020
4021 @item mmx
4022 @itemx no-mmx
4023 @cindex @code{target("mmx")} attribute
4024 Enable/disable the generation of the MMX instructions.
4025
4026 @item pclmul
4027 @itemx no-pclmul
4028 @cindex @code{target("pclmul")} attribute
4029 Enable/disable the generation of the PCLMUL instructions.
4030
4031 @item popcnt
4032 @itemx no-popcnt
4033 @cindex @code{target("popcnt")} attribute
4034 Enable/disable the generation of the POPCNT instruction.
4035
4036 @item sse
4037 @itemx no-sse
4038 @cindex @code{target("sse")} attribute
4039 Enable/disable the generation of the SSE instructions.
4040
4041 @item sse2
4042 @itemx no-sse2
4043 @cindex @code{target("sse2")} attribute
4044 Enable/disable the generation of the SSE2 instructions.
4045
4046 @item sse3
4047 @itemx no-sse3
4048 @cindex @code{target("sse3")} attribute
4049 Enable/disable the generation of the SSE3 instructions.
4050
4051 @item sse4
4052 @itemx no-sse4
4053 @cindex @code{target("sse4")} attribute
4054 Enable/disable the generation of the SSE4 instructions (both SSE4.1
4055 and SSE4.2).
4056
4057 @item sse4.1
4058 @itemx no-sse4.1
4059 @cindex @code{target("sse4.1")} attribute
4060 Enable/disable the generation of the sse4.1 instructions.
4061
4062 @item sse4.2
4063 @itemx no-sse4.2
4064 @cindex @code{target("sse4.2")} attribute
4065 Enable/disable the generation of the sse4.2 instructions.
4066
4067 @item sse4a
4068 @itemx no-sse4a
4069 @cindex @code{target("sse4a")} attribute
4070 Enable/disable the generation of the SSE4A instructions.
4071
4072 @item fma4
4073 @itemx no-fma4
4074 @cindex @code{target("fma4")} attribute
4075 Enable/disable the generation of the FMA4 instructions.
4076
4077 @item xop
4078 @itemx no-xop
4079 @cindex @code{target("xop")} attribute
4080 Enable/disable the generation of the XOP instructions.
4081
4082 @item lwp
4083 @itemx no-lwp
4084 @cindex @code{target("lwp")} attribute
4085 Enable/disable the generation of the LWP instructions.
4086
4087 @item ssse3
4088 @itemx no-ssse3
4089 @cindex @code{target("ssse3")} attribute
4090 Enable/disable the generation of the SSSE3 instructions.
4091
4092 @item cld
4093 @itemx no-cld
4094 @cindex @code{target("cld")} attribute
4095 Enable/disable the generation of the CLD before string moves.
4096
4097 @item fancy-math-387
4098 @itemx no-fancy-math-387
4099 @cindex @code{target("fancy-math-387")} attribute
4100 Enable/disable the generation of the @code{sin}, @code{cos}, and
4101 @code{sqrt} instructions on the 387 floating-point unit.
4102
4103 @item fused-madd
4104 @itemx no-fused-madd
4105 @cindex @code{target("fused-madd")} attribute
4106 Enable/disable the generation of the fused multiply/add instructions.
4107
4108 @item ieee-fp
4109 @itemx no-ieee-fp
4110 @cindex @code{target("ieee-fp")} attribute
4111 Enable/disable the generation of floating point that depends on IEEE arithmetic.
4112
4113 @item inline-all-stringops
4114 @itemx no-inline-all-stringops
4115 @cindex @code{target("inline-all-stringops")} attribute
4116 Enable/disable inlining of string operations.
4117
4118 @item inline-stringops-dynamically
4119 @itemx no-inline-stringops-dynamically
4120 @cindex @code{target("inline-stringops-dynamically")} attribute
4121 Enable/disable the generation of the inline code to do small string
4122 operations and calling the library routines for large operations.
4123
4124 @item align-stringops
4125 @itemx no-align-stringops
4126 @cindex @code{target("align-stringops")} attribute
4127 Do/do not align destination of inlined string operations.
4128
4129 @item recip
4130 @itemx no-recip
4131 @cindex @code{target("recip")} attribute
4132 Enable/disable the generation of RCPSS, RCPPS, RSQRTSS and RSQRTPS
4133 instructions followed an additional Newton-Raphson step instead of
4134 doing a floating-point division.
4135
4136 @item arch=@var{ARCH}
4137 @cindex @code{target("arch=@var{ARCH}")} attribute
4138 Specify the architecture to generate code for in compiling the function.
4139
4140 @item tune=@var{TUNE}
4141 @cindex @code{target("tune=@var{TUNE}")} attribute
4142 Specify the architecture to tune for in compiling the function.
4143
4144 @item fpmath=@var{FPMATH}
4145 @cindex @code{target("fpmath=@var{FPMATH}")} attribute
4146 Specify which floating-point unit to use.  The
4147 @code{target("fpmath=sse,387")} option must be specified as
4148 @code{target("fpmath=sse+387")} because the comma would separate
4149 different options.
4150 @end table
4151
4152 On the PowerPC, the following options are allowed:
4153
4154 @table @samp
4155 @item altivec
4156 @itemx no-altivec
4157 @cindex @code{target("altivec")} attribute
4158 Generate code that uses (does not use) AltiVec instructions.  In
4159 32-bit code, you cannot enable AltiVec instructions unless
4160 @option{-mabi=altivec} is used on the command line.
4161
4162 @item cmpb
4163 @itemx no-cmpb
4164 @cindex @code{target("cmpb")} attribute
4165 Generate code that uses (does not use) the compare bytes instruction
4166 implemented on the POWER6 processor and other processors that support
4167 the PowerPC V2.05 architecture.
4168
4169 @item dlmzb
4170 @itemx no-dlmzb
4171 @cindex @code{target("dlmzb")} attribute
4172 Generate code that uses (does not use) the string-search @samp{dlmzb}
4173 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
4174 generated by default when targeting those processors.
4175
4176 @item fprnd
4177 @itemx no-fprnd
4178 @cindex @code{target("fprnd")} attribute
4179 Generate code that uses (does not use) the FP round to integer
4180 instructions implemented on the POWER5+ processor and other processors
4181 that support the PowerPC V2.03 architecture.
4182
4183 @item hard-dfp
4184 @itemx no-hard-dfp
4185 @cindex @code{target("hard-dfp")} attribute
4186 Generate code that uses (does not use) the decimal floating-point
4187 instructions implemented on some POWER processors.
4188
4189 @item isel
4190 @itemx no-isel
4191 @cindex @code{target("isel")} attribute
4192 Generate code that uses (does not use) ISEL instruction.
4193
4194 @item mfcrf
4195 @itemx no-mfcrf
4196 @cindex @code{target("mfcrf")} attribute
4197 Generate code that uses (does not use) the move from condition
4198 register field instruction implemented on the POWER4 processor and
4199 other processors that support the PowerPC V2.01 architecture.
4200
4201 @item mfpgpr
4202 @itemx no-mfpgpr
4203 @cindex @code{target("mfpgpr")} attribute
4204 Generate code that uses (does not use) the FP move to/from general
4205 purpose register instructions implemented on the POWER6X processor and
4206 other processors that support the extended PowerPC V2.05 architecture.
4207
4208 @item mulhw
4209 @itemx no-mulhw
4210 @cindex @code{target("mulhw")} attribute
4211 Generate code that uses (does not use) the half-word multiply and
4212 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
4213 These instructions are generated by default when targeting those
4214 processors.
4215
4216 @item multiple
4217 @itemx no-multiple
4218 @cindex @code{target("multiple")} attribute
4219 Generate code that uses (does not use) the load multiple word
4220 instructions and the store multiple word instructions.
4221
4222 @item update
4223 @itemx no-update
4224 @cindex @code{target("update")} attribute
4225 Generate code that uses (does not use) the load or store instructions
4226 that update the base register to the address of the calculated memory
4227 location.
4228
4229 @item popcntb
4230 @itemx no-popcntb
4231 @cindex @code{target("popcntb")} attribute
4232 Generate code that uses (does not use) the popcount and double-precision
4233 FP reciprocal estimate instruction implemented on the POWER5
4234 processor and other processors that support the PowerPC V2.02
4235 architecture.
4236
4237 @item popcntd
4238 @itemx no-popcntd
4239 @cindex @code{target("popcntd")} attribute
4240 Generate code that uses (does not use) the popcount instruction
4241 implemented on the POWER7 processor and other processors that support
4242 the PowerPC V2.06 architecture.
4243
4244 @item powerpc-gfxopt
4245 @itemx no-powerpc-gfxopt
4246 @cindex @code{target("powerpc-gfxopt")} attribute
4247 Generate code that uses (does not use) the optional PowerPC
4248 architecture instructions in the Graphics group, including
4249 floating-point select.
4250
4251 @item powerpc-gpopt
4252 @itemx no-powerpc-gpopt
4253 @cindex @code{target("powerpc-gpopt")} attribute
4254 Generate code that uses (does not use) the optional PowerPC
4255 architecture instructions in the General Purpose group, including
4256 floating-point square root.
4257
4258 @item recip-precision
4259 @itemx no-recip-precision
4260 @cindex @code{target("recip-precision")} attribute
4261 Assume (do not assume) that the reciprocal estimate instructions
4262 provide higher-precision estimates than is mandated by the powerpc
4263 ABI.
4264
4265 @item string
4266 @itemx no-string
4267 @cindex @code{target("string")} attribute
4268 Generate code that uses (does not use) the load string instructions
4269 and the store string word instructions to save multiple registers and
4270 do small block moves.
4271
4272 @item vsx
4273 @itemx no-vsx
4274 @cindex @code{target("vsx")} attribute
4275 Generate code that uses (does not use) vector/scalar (VSX)
4276 instructions, and also enable the use of built-in functions that allow
4277 more direct access to the VSX instruction set.  In 32-bit code, you
4278 cannot enable VSX or AltiVec instructions unless
4279 @option{-mabi=altivec} is used on the command line.
4280
4281 @item friz
4282 @itemx no-friz
4283 @cindex @code{target("friz")} attribute
4284 Generate (do not generate) the @code{friz} instruction when the
4285 @option{-funsafe-math-optimizations} option is used to optimize
4286 rounding a floating-point value to 64-bit integer and back to floating
4287 point.  The @code{friz} instruction does not return the same value if
4288 the floating-point number is too large to fit in an integer.
4289
4290 @item avoid-indexed-addresses
4291 @itemx no-avoid-indexed-addresses
4292 @cindex @code{target("avoid-indexed-addresses")} attribute
4293 Generate code that tries to avoid (not avoid) the use of indexed load
4294 or store instructions.
4295
4296 @item paired
4297 @itemx no-paired
4298 @cindex @code{target("paired")} attribute
4299 Generate code that uses (does not use) the generation of PAIRED simd
4300 instructions.
4301
4302 @item longcall
4303 @itemx no-longcall
4304 @cindex @code{target("longcall")} attribute
4305 Generate code that assumes (does not assume) that all calls are far
4306 away so that a longer more expensive calling sequence is required.
4307
4308 @item cpu=@var{CPU}
4309 @cindex @code{target("cpu=@var{CPU}")} attribute
4310 Specify the architecture to generate code for when compiling the
4311 function.  If you select the @code{target("cpu=power7")} attribute when
4312 generating 32-bit code, VSX and AltiVec instructions are not generated
4313 unless you use the @option{-mabi=altivec} option on the command line.
4314
4315 @item tune=@var{TUNE}
4316 @cindex @code{target("tune=@var{TUNE}")} attribute
4317 Specify the architecture to tune for when compiling the function.  If
4318 you do not specify the @code{target("tune=@var{TUNE}")} attribute and
4319 you do specify the @code{target("cpu=@var{CPU}")} attribute,
4320 compilation tunes for the @var{CPU} architecture, and not the
4321 default tuning specified on the command line.
4322 @end table
4323
4324 When compiling for Nios II, the following options are allowed:
4325
4326 @table @samp
4327 @item custom-@var{insn}=@var{N}
4328 @itemx no-custom-@var{insn}
4329 @cindex @code{target("custom-@var{insn}=@var{N}")} attribute
4330 @cindex @code{target("no-custom-@var{insn}")} attribute
4331 Each @samp{custom-@var{insn}=@var{N}} attribute locally enables use of a
4332 custom instruction with encoding @var{N} when generating code that uses 
4333 @var{insn}.  Similarly, @samp{no-custom-@var{insn}} locally inhibits use of
4334 the custom instruction @var{insn}.
4335 These target attributes correspond to the
4336 @option{-mcustom-@var{insn}=@var{N}} and @option{-mno-custom-@var{insn}}
4337 command-line options, and support the same set of @var{insn} keywords.
4338 @xref{Nios II Options}, for more information.
4339
4340 @item custom-fpu-cfg=@var{name}
4341 @cindex @code{target("custom-fpu-cfg=@var{name}")} attribute
4342 This attribute corresponds to the @option{-mcustom-fpu-cfg=@var{name}}
4343 command-line option, to select a predefined set of custom instructions
4344 named @var{name}.
4345 @xref{Nios II Options}, for more information.
4346 @end table
4347
4348 On the x86 and PowerPC back ends, the inliner does not inline a
4349 function that has different target options than the caller, unless the
4350 callee has a subset of the target options of the caller.  For example
4351 a function declared with @code{target("sse3")} can inline a function
4352 with @code{target("sse2")}, since @code{-msse3} implies @code{-msse2}.
4353
4354 @item tiny_data
4355 @cindex tiny data section on the H8/300H and H8S
4356 Use this attribute on the H8/300H and H8S to indicate that the specified
4357 variable should be placed into the tiny data section.
4358 The compiler generates more efficient code for loads and stores
4359 on data in the tiny data section.  Note the tiny data area is limited to
4360 slightly under 32KB of data.
4361
4362 @item trap_exit
4363 @cindex @code{trap_exit} attribute
4364 Use this attribute on the SH for an @code{interrupt_handler} to return using
4365 @code{trapa} instead of @code{rte}.  This attribute expects an integer
4366 argument specifying the trap number to be used.
4367
4368 @item trapa_handler
4369 @cindex @code{trapa_handler} attribute
4370 On SH targets this function attribute is similar to @code{interrupt_handler}
4371 but it does not save and restore all registers.
4372
4373 @item unused
4374 @cindex @code{unused} attribute.
4375 This attribute, attached to a function, means that the function is meant
4376 to be possibly unused.  GCC does not produce a warning for this
4377 function.
4378
4379 @item used
4380 @cindex @code{used} attribute.
4381 This attribute, attached to a function, means that code must be emitted
4382 for the function even if it appears that the function is not referenced.
4383 This is useful, for example, when the function is referenced only in
4384 inline assembly.
4385
4386 When applied to a member function of a C++ class template, the
4387 attribute also means that the function is instantiated if the
4388 class itself is instantiated.
4389
4390 @item vector
4391 @cindex @code{vector} attribute
4392 This RX attribute is similar to the @code{interrupt} attribute, including its
4393 parameters, but does not make the function an interrupt-handler type
4394 function (i.e. it retains the normal C function calling ABI).  See the
4395 @code{interrupt} attribute for a description of its arguments.
4396
4397 @item version_id
4398 @cindex @code{version_id} attribute
4399 This IA-64 HP-UX attribute, attached to a global variable or function, renames a
4400 symbol to contain a version string, thus allowing for function level
4401 versioning.  HP-UX system header files may use function level versioning
4402 for some system calls.
4403
4404 @smallexample
4405 extern int foo () __attribute__((version_id ("20040821")));
4406 @end smallexample
4407
4408 @noindent
4409 Calls to @var{foo} are mapped to calls to @var{foo@{20040821@}}.
4410
4411 @item visibility ("@var{visibility_type}")
4412 @cindex @code{visibility} attribute
4413 This attribute affects the linkage of the declaration to which it is attached.
4414 There are four supported @var{visibility_type} values: default,
4415 hidden, protected or internal visibility.
4416
4417 @smallexample
4418 void __attribute__ ((visibility ("protected")))
4419 f () @{ /* @r{Do something.} */; @}
4420 int i __attribute__ ((visibility ("hidden")));
4421 @end smallexample
4422
4423 The possible values of @var{visibility_type} correspond to the
4424 visibility settings in the ELF gABI.
4425
4426 @table @dfn
4427 @c keep this list of visibilities in alphabetical order.
4428
4429 @item default
4430 Default visibility is the normal case for the object file format.
4431 This value is available for the visibility attribute to override other
4432 options that may change the assumed visibility of entities.
4433
4434 On ELF, default visibility means that the declaration is visible to other
4435 modules and, in shared libraries, means that the declared entity may be
4436 overridden.
4437
4438 On Darwin, default visibility means that the declaration is visible to
4439 other modules.
4440
4441 Default visibility corresponds to ``external linkage'' in the language.
4442
4443 @item hidden
4444 Hidden visibility indicates that the entity declared has a new
4445 form of linkage, which we call ``hidden linkage''.  Two
4446 declarations of an object with hidden linkage refer to the same object
4447 if they are in the same shared object.
4448
4449 @item internal
4450 Internal visibility is like hidden visibility, but with additional
4451 processor specific semantics.  Unless otherwise specified by the
4452 psABI, GCC defines internal visibility to mean that a function is
4453 @emph{never} called from another module.  Compare this with hidden
4454 functions which, while they cannot be referenced directly by other
4455 modules, can be referenced indirectly via function pointers.  By
4456 indicating that a function cannot be called from outside the module,
4457 GCC may for instance omit the load of a PIC register since it is known
4458 that the calling function loaded the correct value.
4459
4460 @item protected
4461 Protected visibility is like default visibility except that it
4462 indicates that references within the defining module bind to the
4463 definition in that module.  That is, the declared entity cannot be
4464 overridden by another module.
4465
4466 @end table
4467
4468 All visibilities are supported on many, but not all, ELF targets
4469 (supported when the assembler supports the @samp{.visibility}
4470 pseudo-op).  Default visibility is supported everywhere.  Hidden
4471 visibility is supported on Darwin targets.
4472
4473 The visibility attribute should be applied only to declarations that
4474 would otherwise have external linkage.  The attribute should be applied
4475 consistently, so that the same entity should not be declared with
4476 different settings of the attribute.
4477
4478 In C++, the visibility attribute applies to types as well as functions
4479 and objects, because in C++ types have linkage.  A class must not have
4480 greater visibility than its non-static data member types and bases,
4481 and class members default to the visibility of their class.  Also, a
4482 declaration without explicit visibility is limited to the visibility
4483 of its type.
4484
4485 In C++, you can mark member functions and static member variables of a
4486 class with the visibility attribute.  This is useful if you know a
4487 particular method or static member variable should only be used from
4488 one shared object; then you can mark it hidden while the rest of the
4489 class has default visibility.  Care must be taken to avoid breaking
4490 the One Definition Rule; for example, it is usually not useful to mark
4491 an inline method as hidden without marking the whole class as hidden.
4492
4493 A C++ namespace declaration can also have the visibility attribute.
4494
4495 @smallexample
4496 namespace nspace1 __attribute__ ((visibility ("protected")))
4497 @{ /* @r{Do something.} */; @}
4498 @end smallexample
4499
4500 This attribute applies only to the particular namespace body, not to
4501 other definitions of the same namespace; it is equivalent to using
4502 @samp{#pragma GCC visibility} before and after the namespace
4503 definition (@pxref{Visibility Pragmas}).
4504
4505 In C++, if a template argument has limited visibility, this
4506 restriction is implicitly propagated to the template instantiation.
4507 Otherwise, template instantiations and specializations default to the
4508 visibility of their template.
4509
4510 If both the template and enclosing class have explicit visibility, the
4511 visibility from the template is used.
4512
4513 @item vliw
4514 @cindex @code{vliw} attribute
4515 On MeP, the @code{vliw} attribute tells the compiler to emit
4516 instructions in VLIW mode instead of core mode.  Note that this
4517 attribute is not allowed unless a VLIW coprocessor has been configured
4518 and enabled through command-line options.
4519
4520 @item warn_unused_result
4521 @cindex @code{warn_unused_result} attribute
4522 The @code{warn_unused_result} attribute causes a warning to be emitted
4523 if a caller of the function with this attribute does not use its
4524 return value.  This is useful for functions where not checking
4525 the result is either a security problem or always a bug, such as
4526 @code{realloc}.
4527
4528 @smallexample
4529 int fn () __attribute__ ((warn_unused_result));
4530 int foo ()
4531 @{
4532   if (fn () < 0) return -1;
4533   fn ();
4534   return 0;
4535 @}
4536 @end smallexample
4537
4538 @noindent
4539 results in warning on line 5.
4540
4541 @item weak
4542 @cindex @code{weak} attribute
4543 The @code{weak} attribute causes the declaration to be emitted as a weak
4544 symbol rather than a global.  This is primarily useful in defining
4545 library functions that can be overridden in user code, though it can
4546 also be used with non-function declarations.  Weak symbols are supported
4547 for ELF targets, and also for a.out targets when using the GNU assembler
4548 and linker.
4549
4550 @item weakref
4551 @itemx weakref ("@var{target}")
4552 @cindex @code{weakref} attribute
4553 The @code{weakref} attribute marks a declaration as a weak reference.
4554 Without arguments, it should be accompanied by an @code{alias} attribute
4555 naming the target symbol.  Optionally, the @var{target} may be given as
4556 an argument to @code{weakref} itself.  In either case, @code{weakref}
4557 implicitly marks the declaration as @code{weak}.  Without a
4558 @var{target}, given as an argument to @code{weakref} or to @code{alias},
4559 @code{weakref} is equivalent to @code{weak}.
4560
4561 @smallexample
4562 static int x() __attribute__ ((weakref ("y")));
4563 /* is equivalent to... */
4564 static int x() __attribute__ ((weak, weakref, alias ("y")));
4565 /* and to... */
4566 static int x() __attribute__ ((weakref));
4567 static int x() __attribute__ ((alias ("y")));
4568 @end smallexample
4569
4570 A weak reference is an alias that does not by itself require a
4571 definition to be given for the target symbol.  If the target symbol is
4572 only referenced through weak references, then it becomes a @code{weak}
4573 undefined symbol.  If it is directly referenced, however, then such
4574 strong references prevail, and a definition is required for the
4575 symbol, not necessarily in the same translation unit.
4576
4577 The effect is equivalent to moving all references to the alias to a
4578 separate translation unit, renaming the alias to the aliased symbol,
4579 declaring it as weak, compiling the two separate translation units and
4580 performing a reloadable link on them.
4581
4582 At present, a declaration to which @code{weakref} is attached can
4583 only be @code{static}.
4584
4585 @end table
4586
4587 You can specify multiple attributes in a declaration by separating them
4588 by commas within the double parentheses or by immediately following an
4589 attribute declaration with another attribute declaration.
4590
4591 @cindex @code{#pragma}, reason for not using
4592 @cindex pragma, reason for not using
4593 Some people object to the @code{__attribute__} feature, suggesting that
4594 ISO C's @code{#pragma} should be used instead.  At the time
4595 @code{__attribute__} was designed, there were two reasons for not doing
4596 this.
4597
4598 @enumerate
4599 @item
4600 It is impossible to generate @code{#pragma} commands from a macro.
4601
4602 @item
4603 There is no telling what the same @code{#pragma} might mean in another
4604 compiler.
4605 @end enumerate
4606
4607 These two reasons applied to almost any application that might have been
4608 proposed for @code{#pragma}.  It was basically a mistake to use
4609 @code{#pragma} for @emph{anything}.
4610
4611 The ISO C99 standard includes @code{_Pragma}, which now allows pragmas
4612 to be generated from macros.  In addition, a @code{#pragma GCC}
4613 namespace is now in use for GCC-specific pragmas.  However, it has been
4614 found convenient to use @code{__attribute__} to achieve a natural
4615 attachment of attributes to their corresponding declarations, whereas
4616 @code{#pragma GCC} is of use for constructs that do not naturally form
4617 part of the grammar.  @xref{Pragmas,,Pragmas Accepted by GCC}.
4618
4619 @node Label Attributes
4620 @section Label Attributes
4621 @cindex Label Attributes
4622
4623 GCC allows attributes to be set on C labels.  @xref{Attribute Syntax}, for 
4624 details of the exact syntax for using attributes.  Other attributes are 
4625 available for functions (@pxref{Function Attributes}), variables 
4626 (@pxref{Variable Attributes}) and for types (@pxref{Type Attributes}).
4627
4628 This example uses the @code{cold} label attribute to indicate the 
4629 @code{ErrorHandling} branch is unlikely to be taken and that the
4630 @code{ErrorHandling} label is unused:
4631
4632 @smallexample
4633
4634    asm goto ("some asm" : : : : NoError);
4635
4636 /* This branch (the fallthru from the asm) is less commonly used */
4637 ErrorHandling: 
4638    __attribute__((cold, unused)); /* Semi-colon is required here */
4639    printf("error\n");
4640    return 0;
4641
4642 NoError:
4643    printf("no error\n");
4644    return 1;
4645 @end smallexample
4646
4647 @table @code
4648 @item unused
4649 @cindex @code{unused} label attribute
4650 This feature is intended for program-generated code that may contain 
4651 unused labels, but which is compiled with @option{-Wall}.  It is
4652 not normally appropriate to use in it human-written code, though it
4653 could be useful in cases where the code that jumps to the label is
4654 contained within an @code{#ifdef} conditional.
4655
4656 @item hot
4657 @cindex @code{hot} label attribute
4658 The @code{hot} attribute on a label is used to inform the compiler that
4659 the path following the label is more likely than paths that are not so
4660 annotated.  This attribute is used in cases where @code{__builtin_expect}
4661 cannot be used, for instance with computed goto or @code{asm goto}.
4662
4663 The @code{hot} attribute on labels is not implemented in GCC versions
4664 earlier than 4.8.
4665
4666 @item cold
4667 @cindex @code{cold} label attribute
4668 The @code{cold} attribute on labels is used to inform the compiler that
4669 the path following the label is unlikely to be executed.  This attribute
4670 is used in cases where @code{__builtin_expect} cannot be used, for instance
4671 with computed goto or @code{asm goto}.
4672
4673 The @code{cold} attribute on labels is not implemented in GCC versions
4674 earlier than 4.8.
4675
4676 @end table
4677
4678 @node Attribute Syntax
4679 @section Attribute Syntax
4680 @cindex attribute syntax
4681
4682 This section describes the syntax with which @code{__attribute__} may be
4683 used, and the constructs to which attribute specifiers bind, for the C
4684 language.  Some details may vary for C++ and Objective-C@.  Because of
4685 infelicities in the grammar for attributes, some forms described here
4686 may not be successfully parsed in all cases.
4687
4688 There are some problems with the semantics of attributes in C++.  For
4689 example, there are no manglings for attributes, although they may affect
4690 code generation, so problems may arise when attributed types are used in
4691 conjunction with templates or overloading.  Similarly, @code{typeid}
4692 does not distinguish between types with different attributes.  Support
4693 for attributes in C++ may be restricted in future to attributes on
4694 declarations only, but not on nested declarators.
4695
4696 @xref{Function Attributes}, for details of the semantics of attributes
4697 applying to functions.  @xref{Variable Attributes}, for details of the
4698 semantics of attributes applying to variables.  @xref{Type Attributes},
4699 for details of the semantics of attributes applying to structure, union
4700 and enumerated types.
4701 @xref{Label Attributes}, for details of the semantics of attributes 
4702 applying to labels.
4703
4704 An @dfn{attribute specifier} is of the form
4705 @code{__attribute__ ((@var{attribute-list}))}.  An @dfn{attribute list}
4706 is a possibly empty comma-separated sequence of @dfn{attributes}, where
4707 each attribute is one of the following:
4708
4709 @itemize @bullet
4710 @item
4711 Empty.  Empty attributes are ignored.
4712
4713 @item
4714 A word (which may be an identifier such as @code{unused}, or a reserved
4715 word such as @code{const}).
4716
4717 @item
4718 A word, followed by, in parentheses, parameters for the attribute.
4719 These parameters take one of the following forms:
4720
4721 @itemize @bullet
4722 @item
4723 An identifier.  For example, @code{mode} attributes use this form.
4724
4725 @item
4726 An identifier followed by a comma and a non-empty comma-separated list
4727 of expressions.  For example, @code{format} attributes use this form.
4728
4729 @item
4730 A possibly empty comma-separated list of expressions.  For example,
4731 @code{format_arg} attributes use this form with the list being a single
4732 integer constant expression, and @code{alias} attributes use this form
4733 with the list being a single string constant.
4734 @end itemize
4735 @end itemize
4736
4737 An @dfn{attribute specifier list} is a sequence of one or more attribute
4738 specifiers, not separated by any other tokens.
4739
4740 @subsubheading Label Attributes
4741
4742 In GNU C, an attribute specifier list may appear after the colon following a
4743 label, other than a @code{case} or @code{default} label.  GNU C++ only permits
4744 attributes on labels if the attribute specifier is immediately
4745 followed by a semicolon (i.e., the label applies to an empty
4746 statement).  If the semicolon is missing, C++ label attributes are
4747 ambiguous, as it is permissible for a declaration, which could begin
4748 with an attribute list, to be labelled in C++.  Declarations cannot be
4749 labelled in C90 or C99, so the ambiguity does not arise there.
4750
4751 @subsubheading Type Attributes
4752
4753 An attribute specifier list may appear as part of a @code{struct},
4754 @code{union} or @code{enum} specifier.  It may go either immediately
4755 after the @code{struct}, @code{union} or @code{enum} keyword, or after
4756 the closing brace.  The former syntax is preferred.
4757 Where attribute specifiers follow the closing brace, they are considered
4758 to relate to the structure, union or enumerated type defined, not to any
4759 enclosing declaration the type specifier appears in, and the type
4760 defined is not complete until after the attribute specifiers.
4761 @c Otherwise, there would be the following problems: a shift/reduce
4762 @c conflict between attributes binding the struct/union/enum and
4763 @c binding to the list of specifiers/qualifiers; and "aligned"
4764 @c attributes could use sizeof for the structure, but the size could be
4765 @c changed later by "packed" attributes.
4766
4767
4768 @subsubheading All other attributes
4769
4770 Otherwise, an attribute specifier appears as part of a declaration,
4771 counting declarations of unnamed parameters and type names, and relates
4772 to that declaration (which may be nested in another declaration, for
4773 example in the case of a parameter declaration), or to a particular declarator
4774 within a declaration.  Where an
4775 attribute specifier is applied to a parameter declared as a function or
4776 an array, it should apply to the function or array rather than the
4777 pointer to which the parameter is implicitly converted, but this is not
4778 yet correctly implemented.
4779
4780 Any list of specifiers and qualifiers at the start of a declaration may
4781 contain attribute specifiers, whether or not such a list may in that
4782 context contain storage class specifiers.  (Some attributes, however,
4783 are essentially in the nature of storage class specifiers, and only make
4784 sense where storage class specifiers may be used; for example,
4785 @code{section}.)  There is one necessary limitation to this syntax: the
4786 first old-style parameter declaration in a function definition cannot
4787 begin with an attribute specifier, because such an attribute applies to
4788 the function instead by syntax described below (which, however, is not
4789 yet implemented in this case).  In some other cases, attribute
4790 specifiers are permitted by this grammar but not yet supported by the
4791 compiler.  All attribute specifiers in this place relate to the
4792 declaration as a whole.  In the obsolescent usage where a type of
4793 @code{int} is implied by the absence of type specifiers, such a list of
4794 specifiers and qualifiers may be an attribute specifier list with no
4795 other specifiers or qualifiers.
4796
4797 At present, the first parameter in a function prototype must have some
4798 type specifier that is not an attribute specifier; this resolves an
4799 ambiguity in the interpretation of @code{void f(int
4800 (__attribute__((foo)) x))}, but is subject to change.  At present, if
4801 the parentheses of a function declarator contain only attributes then
4802 those attributes are ignored, rather than yielding an error or warning
4803 or implying a single parameter of type int, but this is subject to
4804 change.
4805
4806 An attribute specifier list may appear immediately before a declarator
4807 (other than the first) in a comma-separated list of declarators in a
4808 declaration of more than one identifier using a single list of
4809 specifiers and qualifiers.  Such attribute specifiers apply
4810 only to the identifier before whose declarator they appear.  For
4811 example, in
4812
4813 @smallexample
4814 __attribute__((noreturn)) void d0 (void),
4815     __attribute__((format(printf, 1, 2))) d1 (const char *, ...),
4816      d2 (void)
4817 @end smallexample
4818
4819 @noindent
4820 the @code{noreturn} attribute applies to all the functions
4821 declared; the @code{format} attribute only applies to @code{d1}.
4822
4823 An attribute specifier list may appear immediately before the comma,
4824 @code{=} or semicolon terminating the declaration of an identifier other
4825 than a function definition.  Such attribute specifiers apply
4826 to the declared object or function.  Where an
4827 assembler name for an object or function is specified (@pxref{Asm
4828 Labels}), the attribute must follow the @code{asm}
4829 specification.
4830
4831 An attribute specifier list may, in future, be permitted to appear after
4832 the declarator in a function definition (before any old-style parameter
4833 declarations or the function body).
4834
4835 Attribute specifiers may be mixed with type qualifiers appearing inside
4836 the @code{[]} of a parameter array declarator, in the C99 construct by
4837 which such qualifiers are applied to the pointer to which the array is
4838 implicitly converted.  Such attribute specifiers apply to the pointer,
4839 not to the array, but at present this is not implemented and they are
4840 ignored.
4841
4842 An attribute specifier list may appear at the start of a nested
4843 declarator.  At present, there are some limitations in this usage: the
4844 attributes correctly apply to the declarator, but for most individual
4845 attributes the semantics this implies are not implemented.
4846 When attribute specifiers follow the @code{*} of a pointer
4847 declarator, they may be mixed with any type qualifiers present.
4848 The following describes the formal semantics of this syntax.  It makes the
4849 most sense if you are familiar with the formal specification of
4850 declarators in the ISO C standard.
4851
4852 Consider (as in C99 subclause 6.7.5 paragraph 4) a declaration @code{T
4853 D1}, where @code{T} contains declaration specifiers that specify a type
4854 @var{Type} (such as @code{int}) and @code{D1} is a declarator that
4855 contains an identifier @var{ident}.  The type specified for @var{ident}
4856 for derived declarators whose type does not include an attribute
4857 specifier is as in the ISO C standard.
4858
4859 If @code{D1} has the form @code{( @var{attribute-specifier-list} D )},
4860 and the declaration @code{T D} specifies the type
4861 ``@var{derived-declarator-type-list} @var{Type}'' for @var{ident}, then
4862 @code{T D1} specifies the type ``@var{derived-declarator-type-list}
4863 @var{attribute-specifier-list} @var{Type}'' for @var{ident}.
4864
4865 If @code{D1} has the form @code{*
4866 @var{type-qualifier-and-attribute-specifier-list} D}, and the
4867 declaration @code{T D} specifies the type
4868 ``@var{derived-declarator-type-list} @var{Type}'' for @var{ident}, then
4869 @code{T D1} specifies the type ``@var{derived-declarator-type-list}
4870 @var{type-qualifier-and-attribute-specifier-list} pointer to @var{Type}'' for
4871 @var{ident}.
4872
4873 For example,
4874
4875 @smallexample
4876 void (__attribute__((noreturn)) ****f) (void);
4877 @end smallexample
4878
4879 @noindent
4880 specifies the type ``pointer to pointer to pointer to pointer to
4881 non-returning function returning @code{void}''.  As another example,
4882
4883 @smallexample
4884 char *__attribute__((aligned(8))) *f;
4885 @end smallexample
4886
4887 @noindent
4888 specifies the type ``pointer to 8-byte-aligned pointer to @code{char}''.
4889 Note again that this does not work with most attributes; for example,
4890 the usage of @samp{aligned} and @samp{noreturn} attributes given above
4891 is not yet supported.
4892
4893 For compatibility with existing code written for compiler versions that
4894 did not implement attributes on nested declarators, some laxity is
4895 allowed in the placing of attributes.  If an attribute that only applies
4896 to types is applied to a declaration, it is treated as applying to
4897 the type of that declaration.  If an attribute that only applies to
4898 declarations is applied to the type of a declaration, it is treated
4899 as applying to that declaration; and, for compatibility with code
4900 placing the attributes immediately before the identifier declared, such
4901 an attribute applied to a function return type is treated as
4902 applying to the function type, and such an attribute applied to an array
4903 element type is treated as applying to the array type.  If an
4904 attribute that only applies to function types is applied to a
4905 pointer-to-function type, it is treated as applying to the pointer
4906 target type; if such an attribute is applied to a function return type
4907 that is not a pointer-to-function type, it is treated as applying
4908 to the function type.
4909
4910 @node Function Prototypes
4911 @section Prototypes and Old-Style Function Definitions
4912 @cindex function prototype declarations
4913 @cindex old-style function definitions
4914 @cindex promotion of formal parameters
4915
4916 GNU C extends ISO C to allow a function prototype to override a later
4917 old-style non-prototype definition.  Consider the following example:
4918
4919 @smallexample
4920 /* @r{Use prototypes unless the compiler is old-fashioned.}  */
4921 #ifdef __STDC__
4922 #define P(x) x
4923 #else
4924 #define P(x) ()
4925 #endif
4926
4927 /* @r{Prototype function declaration.}  */
4928 int isroot P((uid_t));
4929
4930 /* @r{Old-style function definition.}  */
4931 int
4932 isroot (x)   /* @r{??? lossage here ???} */
4933      uid_t x;
4934 @{
4935   return x == 0;
4936 @}
4937 @end smallexample
4938
4939 Suppose the type @code{uid_t} happens to be @code{short}.  ISO C does
4940 not allow this example, because subword arguments in old-style
4941 non-prototype definitions are promoted.  Therefore in this example the
4942 function definition's argument is really an @code{int}, which does not
4943 match the prototype argument type of @code{short}.
4944
4945 This restriction of ISO C makes it hard to write code that is portable
4946 to traditional C compilers, because the programmer does not know
4947 whether the @code{uid_t} type is @code{short}, @code{int}, or
4948 @code{long}.  Therefore, in cases like these GNU C allows a prototype
4949 to override a later old-style definition.  More precisely, in GNU C, a
4950 function prototype argument type overrides the argument type specified
4951 by a later old-style definition if the former type is the same as the
4952 latter type before promotion.  Thus in GNU C the above example is
4953 equivalent to the following:
4954
4955 @smallexample
4956 int isroot (uid_t);
4957
4958 int
4959 isroot (uid_t x)
4960 @{
4961   return x == 0;
4962 @}
4963 @end smallexample
4964
4965 @noindent
4966 GNU C++ does not support old-style function definitions, so this
4967 extension is irrelevant.
4968
4969 @node C++ Comments
4970 @section C++ Style Comments
4971 @cindex @code{//}
4972 @cindex C++ comments
4973 @cindex comments, C++ style
4974
4975 In GNU C, you may use C++ style comments, which start with @samp{//} and
4976 continue until the end of the line.  Many other C implementations allow
4977 such comments, and they are included in the 1999 C standard.  However,
4978 C++ style comments are not recognized if you specify an @option{-std}
4979 option specifying a version of ISO C before C99, or @option{-ansi}
4980 (equivalent to @option{-std=c90}).
4981
4982 @node Dollar Signs
4983 @section Dollar Signs in Identifier Names
4984 @cindex $
4985 @cindex dollar signs in identifier names
4986 @cindex identifier names, dollar signs in
4987
4988 In GNU C, you may normally use dollar signs in identifier names.
4989 This is because many traditional C implementations allow such identifiers.
4990 However, dollar signs in identifiers are not supported on a few target
4991 machines, typically because the target assembler does not allow them.
4992
4993 @node Character Escapes
4994 @section The Character @key{ESC} in Constants
4995
4996 You can use the sequence @samp{\e} in a string or character constant to
4997 stand for the ASCII character @key{ESC}.
4998
4999 @node Variable Attributes
5000 @section Specifying Attributes of Variables
5001 @cindex attribute of variables
5002 @cindex variable attributes
5003
5004 The keyword @code{__attribute__} allows you to specify special
5005 attributes of variables or structure fields.  This keyword is followed
5006 by an attribute specification inside double parentheses.  Some
5007 attributes are currently defined generically for variables.
5008 Other attributes are defined for variables on particular target
5009 systems.  Other attributes are available for functions
5010 (@pxref{Function Attributes}), labels (@pxref{Label Attributes}) and for 
5011 types (@pxref{Type Attributes}).
5012 Other front ends might define more attributes
5013 (@pxref{C++ Extensions,,Extensions to the C++ Language}).
5014
5015 You may also specify attributes with @samp{__} preceding and following
5016 each keyword.  This allows you to use them in header files without
5017 being concerned about a possible macro of the same name.  For example,
5018 you may use @code{__aligned__} instead of @code{aligned}.
5019
5020 @xref{Attribute Syntax}, for details of the exact syntax for using
5021 attributes.
5022
5023 @table @code
5024 @cindex @code{aligned} attribute
5025 @item aligned (@var{alignment})
5026 This attribute specifies a minimum alignment for the variable or
5027 structure field, measured in bytes.  For example, the declaration:
5028
5029 @smallexample
5030 int x __attribute__ ((aligned (16))) = 0;
5031 @end smallexample
5032
5033 @noindent
5034 causes the compiler to allocate the global variable @code{x} on a
5035 16-byte boundary.  On a 68040, this could be used in conjunction with
5036 an @code{asm} expression to access the @code{move16} instruction which
5037 requires 16-byte aligned operands.
5038
5039 You can also specify the alignment of structure fields.  For example, to
5040 create a double-word aligned @code{int} pair, you could write:
5041
5042 @smallexample
5043 struct foo @{ int x[2] __attribute__ ((aligned (8))); @};
5044 @end smallexample
5045
5046 @noindent
5047 This is an alternative to creating a union with a @code{double} member,
5048 which forces the union to be double-word aligned.
5049
5050 As in the preceding examples, you can explicitly specify the alignment
5051 (in bytes) that you wish the compiler to use for a given variable or
5052 structure field.  Alternatively, you can leave out the alignment factor
5053 and just ask the compiler to align a variable or field to the
5054 default alignment for the target architecture you are compiling for.
5055 The default alignment is sufficient for all scalar types, but may not be
5056 enough for all vector types on a target that supports vector operations.
5057 The default alignment is fixed for a particular target ABI.
5058
5059 GCC also provides a target specific macro @code{__BIGGEST_ALIGNMENT__},
5060 which is the largest alignment ever used for any data type on the
5061 target machine you are compiling for.  For example, you could write:
5062
5063 @smallexample
5064 short array[3] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
5065 @end smallexample
5066
5067 The compiler automatically sets the alignment for the declared
5068 variable or field to @code{__BIGGEST_ALIGNMENT__}.  Doing this can
5069 often make copy operations more efficient, because the compiler can
5070 use whatever instructions copy the biggest chunks of memory when
5071 performing copies to or from the variables or fields that you have
5072 aligned this way.  Note that the value of @code{__BIGGEST_ALIGNMENT__}
5073 may change depending on command-line options.
5074
5075 When used on a struct, or struct member, the @code{aligned} attribute can
5076 only increase the alignment; in order to decrease it, the @code{packed}
5077 attribute must be specified as well.  When used as part of a typedef, the
5078 @code{aligned} attribute can both increase and decrease alignment, and
5079 specifying the @code{packed} attribute generates a warning.
5080
5081 Note that the effectiveness of @code{aligned} attributes may be limited
5082 by inherent limitations in your linker.  On many systems, the linker is
5083 only able to arrange for variables to be aligned up to a certain maximum
5084 alignment.  (For some linkers, the maximum supported alignment may
5085 be very very small.)  If your linker is only able to align variables
5086 up to a maximum of 8-byte alignment, then specifying @code{aligned(16)}
5087 in an @code{__attribute__} still only provides you with 8-byte
5088 alignment.  See your linker documentation for further information.
5089
5090 The @code{aligned} attribute can also be used for functions
5091 (@pxref{Function Attributes}.)
5092
5093 @item cleanup (@var{cleanup_function})
5094 @cindex @code{cleanup} attribute
5095 The @code{cleanup} attribute runs a function when the variable goes
5096 out of scope.  This attribute can only be applied to auto function
5097 scope variables; it may not be applied to parameters or variables
5098 with static storage duration.  The function must take one parameter,
5099 a pointer to a type compatible with the variable.  The return value
5100 of the function (if any) is ignored.
5101
5102 If @option{-fexceptions} is enabled, then @var{cleanup_function}
5103 is run during the stack unwinding that happens during the
5104 processing of the exception.  Note that the @code{cleanup} attribute
5105 does not allow the exception to be caught, only to perform an action.
5106 It is undefined what happens if @var{cleanup_function} does not
5107 return normally.
5108
5109 @item common
5110 @itemx nocommon
5111 @cindex @code{common} attribute
5112 @cindex @code{nocommon} attribute
5113 @opindex fcommon
5114 @opindex fno-common
5115 The @code{common} attribute requests GCC to place a variable in
5116 ``common'' storage.  The @code{nocommon} attribute requests the
5117 opposite---to allocate space for it directly.
5118
5119 These attributes override the default chosen by the
5120 @option{-fno-common} and @option{-fcommon} flags respectively.
5121
5122 @item deprecated
5123 @itemx deprecated (@var{msg})
5124 @cindex @code{deprecated} attribute
5125 The @code{deprecated} attribute results in a warning if the variable
5126 is used anywhere in the source file.  This is useful when identifying
5127 variables that are expected to be removed in a future version of a
5128 program.  The warning also includes the location of the declaration
5129 of the deprecated variable, to enable users to easily find further
5130 information about why the variable is deprecated, or what they should
5131 do instead.  Note that the warning only occurs for uses:
5132
5133 @smallexample
5134 extern int old_var __attribute__ ((deprecated));
5135 extern int old_var;
5136 int new_fn () @{ return old_var; @}
5137 @end smallexample
5138
5139 @noindent
5140 results in a warning on line 3 but not line 2.  The optional @var{msg}
5141 argument, which must be a string, is printed in the warning if
5142 present.
5143
5144 The @code{deprecated} attribute can also be used for functions and
5145 types (@pxref{Function Attributes}, @pxref{Type Attributes}.)
5146
5147 @item mode (@var{mode})
5148 @cindex @code{mode} attribute
5149 This attribute specifies the data type for the declaration---whichever
5150 type corresponds to the mode @var{mode}.  This in effect lets you
5151 request an integer or floating-point type according to its width.
5152
5153 You may also specify a mode of @code{byte} or @code{__byte__} to
5154 indicate the mode corresponding to a one-byte integer, @code{word} or
5155 @code{__word__} for the mode of a one-word integer, and @code{pointer}
5156 or @code{__pointer__} for the mode used to represent pointers.
5157
5158 @item packed
5159 @cindex @code{packed} attribute
5160 The @code{packed} attribute specifies that a variable or structure field
5161 should have the smallest possible alignment---one byte for a variable,
5162 and one bit for a field, unless you specify a larger value with the
5163 @code{aligned} attribute.
5164
5165 Here is a structure in which the field @code{x} is packed, so that it
5166 immediately follows @code{a}:
5167
5168 @smallexample
5169 struct foo
5170 @{
5171   char a;
5172   int x[2] __attribute__ ((packed));
5173 @};
5174 @end smallexample
5175
5176 @emph{Note:} The 4.1, 4.2 and 4.3 series of GCC ignore the
5177 @code{packed} attribute on bit-fields of type @code{char}.  This has
5178 been fixed in GCC 4.4 but the change can lead to differences in the
5179 structure layout.  See the documentation of
5180 @option{-Wpacked-bitfield-compat} for more information.
5181
5182 @item section ("@var{section-name}")
5183 @cindex @code{section} variable attribute
5184 Normally, the compiler places the objects it generates in sections like
5185 @code{data} and @code{bss}.  Sometimes, however, you need additional sections,
5186 or you need certain particular variables to appear in special sections,
5187 for example to map to special hardware.  The @code{section}
5188 attribute specifies that a variable (or function) lives in a particular
5189 section.  For example, this small program uses several specific section names:
5190
5191 @smallexample
5192 struct duart a __attribute__ ((section ("DUART_A"))) = @{ 0 @};
5193 struct duart b __attribute__ ((section ("DUART_B"))) = @{ 0 @};
5194 char stack[10000] __attribute__ ((section ("STACK"))) = @{ 0 @};
5195 int init_data __attribute__ ((section ("INITDATA")));
5196
5197 main()
5198 @{
5199   /* @r{Initialize stack pointer} */
5200   init_sp (stack + sizeof (stack));
5201
5202   /* @r{Initialize initialized data} */
5203   memcpy (&init_data, &data, &edata - &data);
5204
5205   /* @r{Turn on the serial ports} */
5206   init_duart (&a);
5207   init_duart (&b);
5208 @}
5209 @end smallexample
5210
5211 @noindent
5212 Use the @code{section} attribute with
5213 @emph{global} variables and not @emph{local} variables,
5214 as shown in the example.
5215
5216 You may use the @code{section} attribute with initialized or
5217 uninitialized global variables but the linker requires
5218 each object be defined once, with the exception that uninitialized
5219 variables tentatively go in the @code{common} (or @code{bss}) section
5220 and can be multiply ``defined''.  Using the @code{section} attribute
5221 changes what section the variable goes into and may cause the
5222 linker to issue an error if an uninitialized variable has multiple
5223 definitions.  You can force a variable to be initialized with the
5224 @option{-fno-common} flag or the @code{nocommon} attribute.
5225
5226 Some file formats do not support arbitrary sections so the @code{section}
5227 attribute is not available on all platforms.
5228 If you need to map the entire contents of a module to a particular
5229 section, consider using the facilities of the linker instead.
5230
5231 @item shared
5232 @cindex @code{shared} variable attribute
5233 On Microsoft Windows, in addition to putting variable definitions in a named
5234 section, the section can also be shared among all running copies of an
5235 executable or DLL@.  For example, this small program defines shared data
5236 by putting it in a named section @code{shared} and marking the section
5237 shareable:
5238
5239 @smallexample
5240 int foo __attribute__((section ("shared"), shared)) = 0;
5241
5242 int
5243 main()
5244 @{
5245   /* @r{Read and write foo.  All running
5246      copies see the same value.}  */
5247   return 0;
5248 @}
5249 @end smallexample
5250
5251 @noindent
5252 You may only use the @code{shared} attribute along with @code{section}
5253 attribute with a fully-initialized global definition because of the way
5254 linkers work.  See @code{section} attribute for more information.
5255
5256 The @code{shared} attribute is only available on Microsoft Windows@.
5257
5258 @item tls_model ("@var{tls_model}")
5259 @cindex @code{tls_model} attribute
5260 The @code{tls_model} attribute sets thread-local storage model
5261 (@pxref{Thread-Local}) of a particular @code{__thread} variable,
5262 overriding @option{-ftls-model=} command-line switch on a per-variable
5263 basis.
5264 The @var{tls_model} argument should be one of @code{global-dynamic},
5265 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
5266
5267 Not all targets support this attribute.
5268
5269 @item unused
5270 This attribute, attached to a variable, means that the variable is meant
5271 to be possibly unused.  GCC does not produce a warning for this
5272 variable.
5273
5274 @item used
5275 This attribute, attached to a variable with the static storage, means that
5276 the variable must be emitted even if it appears that the variable is not
5277 referenced.
5278
5279 When applied to a static data member of a C++ class template, the
5280 attribute also means that the member is instantiated if the
5281 class itself is instantiated.
5282
5283 @item vector_size (@var{bytes})
5284 This attribute specifies the vector size for the variable, measured in
5285 bytes.  For example, the declaration:
5286
5287 @smallexample
5288 int foo __attribute__ ((vector_size (16)));
5289 @end smallexample
5290
5291 @noindent
5292 causes the compiler to set the mode for @code{foo}, to be 16 bytes,
5293 divided into @code{int} sized units.  Assuming a 32-bit int (a vector of
5294 4 units of 4 bytes), the corresponding mode of @code{foo} is V4SI@.
5295
5296 This attribute is only applicable to integral and float scalars,
5297 although arrays, pointers, and function return values are allowed in
5298 conjunction with this construct.
5299
5300 Aggregates with this attribute are invalid, even if they are of the same
5301 size as a corresponding scalar.  For example, the declaration:
5302
5303 @smallexample
5304 struct S @{ int a; @};
5305 struct S  __attribute__ ((vector_size (16))) foo;
5306 @end smallexample
5307
5308 @noindent
5309 is invalid even if the size of the structure is the same as the size of
5310 the @code{int}.
5311
5312 @item selectany
5313 The @code{selectany} attribute causes an initialized global variable to
5314 have link-once semantics.  When multiple definitions of the variable are
5315 encountered by the linker, the first is selected and the remainder are
5316 discarded.  Following usage by the Microsoft compiler, the linker is told
5317 @emph{not} to warn about size or content differences of the multiple
5318 definitions.
5319
5320 Although the primary usage of this attribute is for POD types, the
5321 attribute can also be applied to global C++ objects that are initialized
5322 by a constructor.  In this case, the static initialization and destruction
5323 code for the object is emitted in each translation defining the object,
5324 but the calls to the constructor and destructor are protected by a
5325 link-once guard variable.
5326
5327 The @code{selectany} attribute is only available on Microsoft Windows
5328 targets.  You can use @code{__declspec (selectany)} as a synonym for
5329 @code{__attribute__ ((selectany))} for compatibility with other
5330 compilers.
5331
5332 @item weak
5333 The @code{weak} attribute is described in @ref{Function Attributes}.
5334
5335 @item dllimport
5336 The @code{dllimport} attribute is described in @ref{Function Attributes}.
5337
5338 @item dllexport
5339 The @code{dllexport} attribute is described in @ref{Function Attributes}.
5340
5341 @end table
5342
5343 @anchor{AVR Variable Attributes}
5344 @subsection AVR Variable Attributes
5345
5346 @table @code
5347 @item progmem
5348 @cindex @code{progmem} AVR variable attribute
5349 The @code{progmem} attribute is used on the AVR to place read-only
5350 data in the non-volatile program memory (flash). The @code{progmem}
5351 attribute accomplishes this by putting respective variables into a
5352 section whose name starts with @code{.progmem}.
5353
5354 This attribute works similar to the @code{section} attribute
5355 but adds additional checking. Notice that just like the
5356 @code{section} attribute, @code{progmem} affects the location
5357 of the data but not how this data is accessed.
5358
5359 In order to read data located with the @code{progmem} attribute
5360 (inline) assembler must be used.
5361 @smallexample
5362 /* Use custom macros from @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC}} */
5363 #include <avr/pgmspace.h> 
5364
5365 /* Locate var in flash memory */
5366 const int var[2] PROGMEM = @{ 1, 2 @};
5367
5368 int read_var (int i)
5369 @{
5370     /* Access var[] by accessor macro from avr/pgmspace.h */
5371     return (int) pgm_read_word (& var[i]);
5372 @}
5373 @end smallexample
5374
5375 AVR is a Harvard architecture processor and data and read-only data
5376 normally resides in the data memory (RAM).
5377
5378 See also the @ref{AVR Named Address Spaces} section for
5379 an alternate way to locate and access data in flash memory.
5380
5381 @item io
5382 @itemx io (@var{addr})
5383 Variables with the @code{io} attribute are used to address
5384 memory-mapped peripherals in the io address range.
5385 If an address is specified, the variable
5386 is assigned that address, and the value is interpreted as an
5387 address in the data address space.
5388 Example:
5389
5390 @smallexample
5391 volatile int porta __attribute__((io (0x22)));
5392 @end smallexample
5393
5394 The address specified in the address in the data address range.
5395
5396 Otherwise, the variable it is not assigned an address, but the
5397 compiler will still use in/out instructions where applicable,
5398 assuming some other module assigns an address in the io address range.
5399 Example:
5400
5401 @smallexample
5402 extern volatile int porta __attribute__((io));
5403 @end smallexample
5404
5405 @item io_low
5406 @itemx io_low (@var{addr})
5407 This is like the @code{io} attribute, but additionally it informs the
5408 compiler that the object lies in the lower half of the I/O area,
5409 allowing the use of @code{cbi}, @code{sbi}, @code{sbic} and @code{sbis}
5410 instructions.
5411
5412 @item address
5413 @itemx address (@var{addr})
5414 Variables with the @code{address} attribute are used to address
5415 memory-mapped peripherals that may lie outside the io address range.
5416
5417 @smallexample
5418 volatile int porta __attribute__((address (0x600)));
5419 @end smallexample
5420
5421 @end table
5422
5423 @subsection Blackfin Variable Attributes
5424
5425 Three attributes are currently defined for the Blackfin.
5426
5427 @table @code
5428 @item l1_data
5429 @itemx l1_data_A
5430 @itemx l1_data_B
5431 @cindex @code{l1_data} variable attribute
5432 @cindex @code{l1_data_A} variable attribute
5433 @cindex @code{l1_data_B} variable attribute
5434 Use these attributes on the Blackfin to place the variable into L1 Data SRAM.
5435 Variables with @code{l1_data} attribute are put into the specific section
5436 named @code{.l1.data}. Those with @code{l1_data_A} attribute are put into
5437 the specific section named @code{.l1.data.A}. Those with @code{l1_data_B}
5438 attribute are put into the specific section named @code{.l1.data.B}.
5439
5440 @item l2
5441 @cindex @code{l2} variable attribute
5442 Use this attribute on the Blackfin to place the variable into L2 SRAM.
5443 Variables with @code{l2} attribute are put into the specific section
5444 named @code{.l2.data}.
5445 @end table
5446
5447 @subsection M32R/D Variable Attributes
5448
5449 One attribute is currently defined for the M32R/D@.
5450
5451 @table @code
5452 @item model (@var{model-name})
5453 @cindex variable addressability on the M32R/D
5454 Use this attribute on the M32R/D to set the addressability of an object.
5455 The identifier @var{model-name} is one of @code{small}, @code{medium},
5456 or @code{large}, representing each of the code models.
5457
5458 Small model objects live in the lower 16MB of memory (so that their
5459 addresses can be loaded with the @code{ld24} instruction).
5460
5461 Medium and large model objects may live anywhere in the 32-bit address space
5462 (the compiler generates @code{seth/add3} instructions to load their
5463 addresses).
5464 @end table
5465
5466 @anchor{MeP Variable Attributes}
5467 @subsection MeP Variable Attributes
5468
5469 The MeP target has a number of addressing modes and busses.  The
5470 @code{near} space spans the standard memory space's first 16 megabytes
5471 (24 bits).  The @code{far} space spans the entire 32-bit memory space.
5472 The @code{based} space is a 128-byte region in the memory space that
5473 is addressed relative to the @code{$tp} register.  The @code{tiny}
5474 space is a 65536-byte region relative to the @code{$gp} register.  In
5475 addition to these memory regions, the MeP target has a separate 16-bit
5476 control bus which is specified with @code{cb} attributes.
5477
5478 @table @code
5479
5480 @item based
5481 Any variable with the @code{based} attribute is assigned to the
5482 @code{.based} section, and is accessed with relative to the
5483 @code{$tp} register.
5484
5485 @item tiny
5486 Likewise, the @code{tiny} attribute assigned variables to the
5487 @code{.tiny} section, relative to the @code{$gp} register.
5488
5489 @item near
5490 Variables with the @code{near} attribute are assumed to have addresses
5491 that fit in a 24-bit addressing mode.  This is the default for large
5492 variables (@code{-mtiny=4} is the default) but this attribute can
5493 override @code{-mtiny=} for small variables, or override @code{-ml}.
5494
5495 @item far
5496 Variables with the @code{far} attribute are addressed using a full
5497 32-bit address.  Since this covers the entire memory space, this
5498 allows modules to make no assumptions about where variables might be
5499 stored.
5500
5501 @item io
5502 @itemx io (@var{addr})
5503 Variables with the @code{io} attribute are used to address
5504 memory-mapped peripherals.  If an address is specified, the variable
5505 is assigned that address, else it is not assigned an address (it is
5506 assumed some other module assigns an address).  Example:
5507
5508 @smallexample
5509 int timer_count __attribute__((io(0x123)));
5510 @end smallexample
5511
5512 @item cb
5513 @itemx cb (@var{addr})
5514 Variables with the @code{cb} attribute are used to access the control
5515 bus, using special instructions.  @code{addr} indicates the control bus
5516 address.  Example:
5517
5518 @smallexample
5519 int cpu_clock __attribute__((cb(0x123)));
5520 @end smallexample
5521
5522 @end table
5523
5524 @subsection PowerPC Variable Attributes
5525
5526 Three attributes currently are defined for PowerPC configurations:
5527 @code{altivec}, @code{ms_struct} and @code{gcc_struct}.
5528
5529 For full documentation of the struct attributes please see the
5530 documentation in @ref{x86 Variable Attributes}.
5531
5532 For documentation of @code{altivec} attribute please see the
5533 documentation in @ref{PowerPC Type Attributes}.
5534
5535 @subsection SPU Variable Attributes
5536
5537 The SPU supports the @code{spu_vector} attribute for variables.  For
5538 documentation of this attribute please see the documentation in
5539 @ref{SPU Type Attributes}.
5540
5541 @anchor{x86 Variable Attributes}
5542 @subsection x86 Variable Attributes
5543
5544 Two attributes are currently defined for x86 configurations:
5545 @code{ms_struct} and @code{gcc_struct}.
5546
5547 @table @code
5548 @item ms_struct
5549 @itemx gcc_struct
5550 @cindex @code{ms_struct} attribute
5551 @cindex @code{gcc_struct} attribute
5552
5553 If @code{packed} is used on a structure, or if bit-fields are used,
5554 it may be that the Microsoft ABI lays out the structure differently
5555 than the way GCC normally does.  Particularly when moving packed
5556 data between functions compiled with GCC and the native Microsoft compiler
5557 (either via function call or as data in a file), it may be necessary to access
5558 either format.
5559
5560 Currently @option{-m[no-]ms-bitfields} is provided for the Microsoft Windows x86
5561 compilers to match the native Microsoft compiler.
5562
5563 The Microsoft structure layout algorithm is fairly simple with the exception
5564 of the bit-field packing.  
5565 The padding and alignment of members of structures and whether a bit-field 
5566 can straddle a storage-unit boundary are determine by these rules:
5567
5568 @enumerate
5569 @item Structure members are stored sequentially in the order in which they are
5570 declared: the first member has the lowest memory address and the last member
5571 the highest.
5572
5573 @item Every data object has an alignment requirement.  The alignment requirement
5574 for all data except structures, unions, and arrays is either the size of the
5575 object or the current packing size (specified with either the
5576 @code{aligned} attribute or the @code{pack} pragma),
5577 whichever is less.  For structures, unions, and arrays,
5578 the alignment requirement is the largest alignment requirement of its members.
5579 Every object is allocated an offset so that:
5580
5581 @smallexample
5582 offset % alignment_requirement == 0
5583 @end smallexample
5584
5585 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
5586 unit if the integral types are the same size and if the next bit-field fits
5587 into the current allocation unit without crossing the boundary imposed by the
5588 common alignment requirements of the bit-fields.
5589 @end enumerate
5590
5591 MSVC interprets zero-length bit-fields in the following ways:
5592
5593 @enumerate
5594 @item If a zero-length bit-field is inserted between two bit-fields that
5595 are normally coalesced, the bit-fields are not coalesced.
5596
5597 For example:
5598
5599 @smallexample
5600 struct
5601  @{
5602    unsigned long bf_1 : 12;
5603    unsigned long : 0;
5604    unsigned long bf_2 : 12;
5605  @} t1;
5606 @end smallexample
5607
5608 @noindent
5609 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
5610 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
5611
5612 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
5613 alignment of the zero-length bit-field is greater than the member that follows it,
5614 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
5615
5616 For example:
5617
5618 @smallexample
5619 struct
5620  @{
5621    char foo : 4;
5622    short : 0;
5623    char bar;
5624  @} t2;
5625
5626 struct
5627  @{
5628    char foo : 4;
5629    short : 0;
5630    double bar;
5631  @} t3;
5632 @end smallexample
5633
5634 @noindent
5635 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
5636 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
5637 bit-field does not affect the alignment of @code{bar} or, as a result, the size
5638 of the structure.
5639
5640 Taking this into account, it is important to note the following:
5641
5642 @enumerate
5643 @item If a zero-length bit-field follows a normal bit-field, the type of the
5644 zero-length bit-field may affect the alignment of the structure as whole. For
5645 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
5646 normal bit-field, and is of type short.
5647
5648 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
5649 still affect the alignment of the structure:
5650
5651 @smallexample
5652 struct
5653  @{
5654    char foo : 6;
5655    long : 0;
5656  @} t4;
5657 @end smallexample
5658
5659 @noindent
5660 Here, @code{t4} takes up 4 bytes.
5661 @end enumerate
5662
5663 @item Zero-length bit-fields following non-bit-field members are ignored:
5664
5665 @smallexample
5666 struct
5667  @{
5668    char foo;
5669    long : 0;
5670    char bar;
5671  @} t5;
5672 @end smallexample
5673
5674 @noindent
5675 Here, @code{t5} takes up 2 bytes.
5676 @end enumerate
5677 @end table
5678
5679 @subsection Xstormy16 Variable Attributes
5680
5681 One attribute is currently defined for xstormy16 configurations:
5682 @code{below100}.
5683
5684 @table @code
5685 @item below100
5686 @cindex @code{below100} attribute
5687
5688 If a variable has the @code{below100} attribute (@code{BELOW100} is
5689 allowed also), GCC places the variable in the first 0x100 bytes of
5690 memory and use special opcodes to access it.  Such variables are
5691 placed in either the @code{.bss_below100} section or the
5692 @code{.data_below100} section.
5693
5694 @end table
5695
5696 @node Type Attributes
5697 @section Specifying Attributes of Types
5698 @cindex attribute of types
5699 @cindex type attributes
5700
5701 The keyword @code{__attribute__} allows you to specify special
5702 attributes of @code{struct} and @code{union} types when you define
5703 such types.  This keyword is followed by an attribute specification
5704 inside double parentheses.  Eight attributes are currently defined for
5705 types: @code{aligned}, @code{packed}, @code{transparent_union},
5706 @code{unused}, @code{deprecated}, @code{visibility}, @code{may_alias}
5707 and @code{bnd_variable_size}.  Other attributes are defined for
5708 functions (@pxref{Function Attributes}), labels (@pxref{Label 
5709 Attributes}) and for variables (@pxref{Variable Attributes}).
5710
5711 You may also specify any one of these attributes with @samp{__}
5712 preceding and following its keyword.  This allows you to use these
5713 attributes in header files without being concerned about a possible
5714 macro of the same name.  For example, you may use @code{__aligned__}
5715 instead of @code{aligned}.
5716
5717 You may specify type attributes in an enum, struct or union type
5718 declaration or definition, or for other types in a @code{typedef}
5719 declaration.
5720
5721 For an enum, struct or union type, you may specify attributes either
5722 between the enum, struct or union tag and the name of the type, or
5723 just past the closing curly brace of the @emph{definition}.  The
5724 former syntax is preferred.
5725
5726 @xref{Attribute Syntax}, for details of the exact syntax for using
5727 attributes.
5728
5729 @table @code
5730 @cindex @code{aligned} attribute
5731 @item aligned (@var{alignment})
5732 This attribute specifies a minimum alignment (in bytes) for variables
5733 of the specified type.  For example, the declarations:
5734
5735 @smallexample
5736 struct S @{ short f[3]; @} __attribute__ ((aligned (8)));
5737 typedef int more_aligned_int __attribute__ ((aligned (8)));
5738 @end smallexample
5739
5740 @noindent
5741 force the compiler to ensure (as far as it can) that each variable whose
5742 type is @code{struct S} or @code{more_aligned_int} is allocated and
5743 aligned @emph{at least} on a 8-byte boundary.  On a SPARC, having all
5744 variables of type @code{struct S} aligned to 8-byte boundaries allows
5745 the compiler to use the @code{ldd} and @code{std} (doubleword load and
5746 store) instructions when copying one variable of type @code{struct S} to
5747 another, thus improving run-time efficiency.
5748
5749 Note that the alignment of any given @code{struct} or @code{union} type
5750 is required by the ISO C standard to be at least a perfect multiple of
5751 the lowest common multiple of the alignments of all of the members of
5752 the @code{struct} or @code{union} in question.  This means that you @emph{can}
5753 effectively adjust the alignment of a @code{struct} or @code{union}
5754 type by attaching an @code{aligned} attribute to any one of the members
5755 of such a type, but the notation illustrated in the example above is a
5756 more obvious, intuitive, and readable way to request the compiler to
5757 adjust the alignment of an entire @code{struct} or @code{union} type.
5758
5759 As in the preceding example, you can explicitly specify the alignment
5760 (in bytes) that you wish the compiler to use for a given @code{struct}
5761 or @code{union} type.  Alternatively, you can leave out the alignment factor
5762 and just ask the compiler to align a type to the maximum
5763 useful alignment for the target machine you are compiling for.  For
5764 example, you could write:
5765
5766 @smallexample
5767 struct S @{ short f[3]; @} __attribute__ ((aligned));
5768 @end smallexample
5769
5770 Whenever you leave out the alignment factor in an @code{aligned}
5771 attribute specification, the compiler automatically sets the alignment
5772 for the type to the largest alignment that is ever used for any data
5773 type on the target machine you are compiling for.  Doing this can often
5774 make copy operations more efficient, because the compiler can use
5775 whatever instructions copy the biggest chunks of memory when performing
5776 copies to or from the variables that have types that you have aligned
5777 this way.
5778
5779 In the example above, if the size of each @code{short} is 2 bytes, then
5780 the size of the entire @code{struct S} type is 6 bytes.  The smallest
5781 power of two that is greater than or equal to that is 8, so the
5782 compiler sets the alignment for the entire @code{struct S} type to 8
5783 bytes.
5784
5785 Note that although you can ask the compiler to select a time-efficient
5786 alignment for a given type and then declare only individual stand-alone
5787 objects of that type, the compiler's ability to select a time-efficient
5788 alignment is primarily useful only when you plan to create arrays of
5789 variables having the relevant (efficiently aligned) type.  If you
5790 declare or use arrays of variables of an efficiently-aligned type, then
5791 it is likely that your program also does pointer arithmetic (or
5792 subscripting, which amounts to the same thing) on pointers to the
5793 relevant type, and the code that the compiler generates for these
5794 pointer arithmetic operations is often more efficient for
5795 efficiently-aligned types than for other types.
5796
5797 The @code{aligned} attribute can only increase the alignment; but you
5798 can decrease it by specifying @code{packed} as well.  See below.
5799
5800 Note that the effectiveness of @code{aligned} attributes may be limited
5801 by inherent limitations in your linker.  On many systems, the linker is
5802 only able to arrange for variables to be aligned up to a certain maximum
5803 alignment.  (For some linkers, the maximum supported alignment may
5804 be very very small.)  If your linker is only able to align variables
5805 up to a maximum of 8-byte alignment, then specifying @code{aligned(16)}
5806 in an @code{__attribute__} still only provides you with 8-byte
5807 alignment.  See your linker documentation for further information.
5808
5809 @item packed
5810 This attribute, attached to @code{struct} or @code{union} type
5811 definition, specifies that each member (other than zero-width bit-fields)
5812 of the structure or union is placed to minimize the memory required.  When
5813 attached to an @code{enum} definition, it indicates that the smallest
5814 integral type should be used.
5815
5816 @opindex fshort-enums
5817 Specifying this attribute for @code{struct} and @code{union} types is
5818 equivalent to specifying the @code{packed} attribute on each of the
5819 structure or union members.  Specifying the @option{-fshort-enums}
5820 flag on the line is equivalent to specifying the @code{packed}
5821 attribute on all @code{enum} definitions.
5822
5823 In the following example @code{struct my_packed_struct}'s members are
5824 packed closely together, but the internal layout of its @code{s} member
5825 is not packed---to do that, @code{struct my_unpacked_struct} needs to
5826 be packed too.
5827
5828 @smallexample
5829 struct my_unpacked_struct
5830  @{
5831     char c;
5832     int i;
5833  @};
5834
5835 struct __attribute__ ((__packed__)) my_packed_struct
5836   @{
5837      char c;
5838      int  i;
5839      struct my_unpacked_struct s;
5840   @};
5841 @end smallexample
5842
5843 You may only specify this attribute on the definition of an @code{enum},
5844 @code{struct} or @code{union}, not on a @code{typedef} that does not
5845 also define the enumerated type, structure or union.
5846
5847 @item transparent_union
5848 @cindex @code{transparent_union} attribute
5849
5850 This attribute, attached to a @code{union} type definition, indicates
5851 that any function parameter having that union type causes calls to that
5852 function to be treated in a special way.
5853
5854 First, the argument corresponding to a transparent union type can be of
5855 any type in the union; no cast is required.  Also, if the union contains
5856 a pointer type, the corresponding argument can be a null pointer
5857 constant or a void pointer expression; and if the union contains a void
5858 pointer type, the corresponding argument can be any pointer expression.
5859 If the union member type is a pointer, qualifiers like @code{const} on
5860 the referenced type must be respected, just as with normal pointer
5861 conversions.
5862
5863 Second, the argument is passed to the function using the calling
5864 conventions of the first member of the transparent union, not the calling
5865 conventions of the union itself.  All members of the union must have the
5866 same machine representation; this is necessary for this argument passing
5867 to work properly.
5868
5869 Transparent unions are designed for library functions that have multiple
5870 interfaces for compatibility reasons.  For example, suppose the
5871 @code{wait} function must accept either a value of type @code{int *} to
5872 comply with POSIX, or a value of type @code{union wait *} to comply with
5873 the 4.1BSD interface.  If @code{wait}'s parameter were @code{void *},
5874 @code{wait} would accept both kinds of arguments, but it would also
5875 accept any other pointer type and this would make argument type checking
5876 less useful.  Instead, @code{<sys/wait.h>} might define the interface
5877 as follows:
5878
5879 @smallexample
5880 typedef union __attribute__ ((__transparent_union__))
5881   @{
5882     int *__ip;
5883     union wait *__up;
5884   @} wait_status_ptr_t;
5885
5886 pid_t wait (wait_status_ptr_t);
5887 @end smallexample
5888
5889 @noindent
5890 This interface allows either @code{int *} or @code{union wait *}
5891 arguments to be passed, using the @code{int *} calling convention.
5892 The program can call @code{wait} with arguments of either type:
5893
5894 @smallexample
5895 int w1 () @{ int w; return wait (&w); @}
5896 int w2 () @{ union wait w; return wait (&w); @}
5897 @end smallexample
5898
5899 @noindent
5900 With this interface, @code{wait}'s implementation might look like this:
5901
5902 @smallexample
5903 pid_t wait (wait_status_ptr_t p)
5904 @{
5905   return waitpid (-1, p.__ip, 0);
5906 @}
5907 @end smallexample
5908
5909 @item unused
5910 When attached to a type (including a @code{union} or a @code{struct}),
5911 this attribute means that variables of that type are meant to appear
5912 possibly unused.  GCC does not produce a warning for any variables of
5913 that type, even if the variable appears to do nothing.  This is often
5914 the case with lock or thread classes, which are usually defined and then
5915 not referenced, but contain constructors and destructors that have
5916 nontrivial bookkeeping functions.
5917
5918 @item deprecated
5919 @itemx deprecated (@var{msg})
5920 The @code{deprecated} attribute results in a warning if the type
5921 is used anywhere in the source file.  This is useful when identifying
5922 types that are expected to be removed in a future version of a program.
5923 If possible, the warning also includes the location of the declaration
5924 of the deprecated type, to enable users to easily find further
5925 information about why the type is deprecated, or what they should do
5926 instead.  Note that the warnings only occur for uses and then only
5927 if the type is being applied to an identifier that itself is not being
5928 declared as deprecated.
5929
5930 @smallexample
5931 typedef int T1 __attribute__ ((deprecated));
5932 T1 x;
5933 typedef T1 T2;
5934 T2 y;
5935 typedef T1 T3 __attribute__ ((deprecated));
5936 T3 z __attribute__ ((deprecated));
5937 @end smallexample
5938
5939 @noindent
5940 results in a warning on line 2 and 3 but not lines 4, 5, or 6.  No
5941 warning is issued for line 4 because T2 is not explicitly
5942 deprecated.  Line 5 has no warning because T3 is explicitly
5943 deprecated.  Similarly for line 6.  The optional @var{msg}
5944 argument, which must be a string, is printed in the warning if
5945 present.
5946
5947 The @code{deprecated} attribute can also be used for functions and
5948 variables (@pxref{Function Attributes}, @pxref{Variable Attributes}.)
5949
5950 @item may_alias
5951 Accesses through pointers to types with this attribute are not subject
5952 to type-based alias analysis, but are instead assumed to be able to alias
5953 any other type of objects.
5954 In the context of section 6.5 paragraph 7 of the C99 standard,
5955 an lvalue expression
5956 dereferencing such a pointer is treated like having a character type.
5957 See @option{-fstrict-aliasing} for more information on aliasing issues.
5958 This extension exists to support some vector APIs, in which pointers to
5959 one vector type are permitted to alias pointers to a different vector type.
5960
5961 Note that an object of a type with this attribute does not have any
5962 special semantics.
5963
5964 Example of use:
5965
5966 @smallexample
5967 typedef short __attribute__((__may_alias__)) short_a;
5968
5969 int
5970 main (void)
5971 @{
5972   int a = 0x12345678;
5973   short_a *b = (short_a *) &a;
5974
5975   b[1] = 0;
5976
5977   if (a == 0x12345678)
5978     abort();
5979
5980   exit(0);
5981 @}
5982 @end smallexample
5983
5984 @noindent
5985 If you replaced @code{short_a} with @code{short} in the variable
5986 declaration, the above program would abort when compiled with
5987 @option{-fstrict-aliasing}, which is on by default at @option{-O2} or
5988 above in recent GCC versions.
5989
5990 @item visibility
5991 In C++, attribute visibility (@pxref{Function Attributes}) can also be
5992 applied to class, struct, union and enum types.  Unlike other type
5993 attributes, the attribute must appear between the initial keyword and
5994 the name of the type; it cannot appear after the body of the type.
5995
5996 Note that the type visibility is applied to vague linkage entities
5997 associated with the class (vtable, typeinfo node, etc.).  In
5998 particular, if a class is thrown as an exception in one shared object
5999 and caught in another, the class must have default visibility.
6000 Otherwise the two shared objects are unable to use the same
6001 typeinfo node and exception handling will break.
6002
6003 @item designated_init
6004 This attribute may only be applied to structure types.  It indicates
6005 that any initialization of an object of this type must use designated
6006 initializers rather than positional initializers.  The intent of this
6007 attribute is to allow the programmer to indicate that a structure's
6008 layout may change, and that therefore relying on positional
6009 initialization will result in future breakage.
6010
6011 GCC emits warnings based on this attribute by default; use
6012 @option{-Wno-designated-init} to suppress them.
6013
6014 @item bnd_variable_size
6015 When applied to a structure field, this attribute tells Pointer
6016 Bounds Checker that the size of this field should not be computed
6017 using static type information.  It may be used to mark variable
6018 sized static array fields placed at the end of a structure.
6019
6020 @smallexample
6021 struct S
6022 @{
6023   int size;
6024   char data[1];
6025 @}
6026 S *p = (S *)malloc (sizeof(S) + 100);
6027 p->data[10] = 0; //Bounds violation
6028 @end smallexample
6029
6030 By using an attribute for a field we may avoid bound violation
6031 we most probably do not want to see:
6032
6033 @smallexample
6034 struct S
6035 @{
6036   int size;
6037   char data[1] __attribute__((bnd_variable_size));
6038 @}
6039 S *p = (S *)malloc (sizeof(S) + 100);
6040 p->data[10] = 0; //OK
6041 @end smallexample
6042
6043 @end table
6044
6045 To specify multiple attributes, separate them by commas within the
6046 double parentheses: for example, @samp{__attribute__ ((aligned (16),
6047 packed))}.
6048
6049 @subsection ARM Type Attributes
6050
6051 On those ARM targets that support @code{dllimport} (such as Symbian
6052 OS), you can use the @code{notshared} attribute to indicate that the
6053 virtual table and other similar data for a class should not be
6054 exported from a DLL@.  For example:
6055
6056 @smallexample
6057 class __declspec(notshared) C @{
6058 public:
6059   __declspec(dllimport) C();
6060   virtual void f();
6061 @}
6062
6063 __declspec(dllexport)
6064 C::C() @{@}
6065 @end smallexample
6066
6067 @noindent
6068 In this code, @code{C::C} is exported from the current DLL, but the
6069 virtual table for @code{C} is not exported.  (You can use
6070 @code{__attribute__} instead of @code{__declspec} if you prefer, but
6071 most Symbian OS code uses @code{__declspec}.)
6072
6073 @anchor{MeP Type Attributes}
6074 @subsection MeP Type Attributes
6075
6076 Many of the MeP variable attributes may be applied to types as well.
6077 Specifically, the @code{based}, @code{tiny}, @code{near}, and
6078 @code{far} attributes may be applied to either.  The @code{io} and
6079 @code{cb} attributes may not be applied to types.
6080
6081 @anchor{PowerPC Type Attributes}
6082 @subsection PowerPC Type Attributes
6083
6084 Three attributes currently are defined for PowerPC configurations:
6085 @code{altivec}, @code{ms_struct} and @code{gcc_struct}.
6086
6087 For full documentation of the @code{ms_struct} and @code{gcc_struct}
6088 attributes please see the documentation in @ref{x86 Type Attributes}.
6089
6090 The @code{altivec} attribute allows one to declare AltiVec vector data
6091 types supported by the AltiVec Programming Interface Manual.  The
6092 attribute requires an argument to specify one of three vector types:
6093 @code{vector__}, @code{pixel__} (always followed by unsigned short),
6094 and @code{bool__} (always followed by unsigned).
6095
6096 @smallexample
6097 __attribute__((altivec(vector__)))
6098 __attribute__((altivec(pixel__))) unsigned short
6099 __attribute__((altivec(bool__))) unsigned
6100 @end smallexample
6101
6102 These attributes mainly are intended to support the @code{__vector},
6103 @code{__pixel}, and @code{__bool} AltiVec keywords.
6104
6105 @anchor{SPU Type Attributes}
6106 @subsection SPU Type Attributes
6107
6108 The SPU supports the @code{spu_vector} attribute for types.  This attribute
6109 allows one to declare vector data types supported by the Sony/Toshiba/IBM SPU
6110 Language Extensions Specification.  It is intended to support the
6111 @code{__vector} keyword.
6112
6113 @anchor{x86 Type Attributes}
6114 @subsection x86 Type Attributes
6115
6116 Two attributes are currently defined for x86 configurations:
6117 @code{ms_struct} and @code{gcc_struct}.
6118
6119 @table @code
6120
6121 @item ms_struct
6122 @itemx gcc_struct
6123 @cindex @code{ms_struct}
6124 @cindex @code{gcc_struct}
6125
6126 If @code{packed} is used on a structure, or if bit-fields are used
6127 it may be that the Microsoft ABI packs them differently
6128 than GCC normally packs them.  Particularly when moving packed
6129 data between functions compiled with GCC and the native Microsoft compiler
6130 (either via function call or as data in a file), it may be necessary to access
6131 either format.
6132
6133 Currently @option{-m[no-]ms-bitfields} is provided for the Microsoft Windows x86
6134 compilers to match the native Microsoft compiler.
6135 @end table
6136
6137 @node Alignment
6138 @section Inquiring on Alignment of Types or Variables
6139 @cindex alignment
6140 @cindex type alignment
6141 @cindex variable alignment
6142
6143 The keyword @code{__alignof__} allows you to inquire about how an object
6144 is aligned, or the minimum alignment usually required by a type.  Its
6145 syntax is just like @code{sizeof}.
6146
6147 For example, if the target machine requires a @code{double} value to be
6148 aligned on an 8-byte boundary, then @code{__alignof__ (double)} is 8.
6149 This is true on many RISC machines.  On more traditional machine
6150 designs, @code{__alignof__ (double)} is 4 or even 2.
6151
6152 Some machines never actually require alignment; they allow reference to any
6153 data type even at an odd address.  For these machines, @code{__alignof__}
6154 reports the smallest alignment that GCC gives the data type, usually as
6155 mandated by the target ABI.
6156
6157 If the operand of @code{__alignof__} is an lvalue rather than a type,
6158 its value is the required alignment for its type, taking into account
6159 any minimum alignment specified with GCC's @code{__attribute__}
6160 extension (@pxref{Variable Attributes}).  For example, after this
6161 declaration:
6162
6163 @smallexample
6164 struct foo @{ int x; char y; @} foo1;
6165 @end smallexample
6166
6167 @noindent
6168 the value of @code{__alignof__ (foo1.y)} is 1, even though its actual
6169 alignment is probably 2 or 4, the same as @code{__alignof__ (int)}.
6170
6171 It is an error to ask for the alignment of an incomplete type.
6172
6173
6174 @node Inline
6175 @section An Inline Function is As Fast As a Macro
6176 @cindex inline functions
6177 @cindex integrating function code
6178 @cindex open coding
6179 @cindex macros, inline alternative
6180
6181 By declaring a function inline, you can direct GCC to make
6182 calls to that function faster.  One way GCC can achieve this is to
6183 integrate that function's code into the code for its callers.  This
6184 makes execution faster by eliminating the function-call overhead; in
6185 addition, if any of the actual argument values are constant, their
6186 known values may permit simplifications at compile time so that not
6187 all of the inline function's code needs to be included.  The effect on
6188 code size is less predictable; object code may be larger or smaller
6189 with function inlining, depending on the particular case.  You can
6190 also direct GCC to try to integrate all ``simple enough'' functions
6191 into their callers with the option @option{-finline-functions}.
6192
6193 GCC implements three different semantics of declaring a function
6194 inline.  One is available with @option{-std=gnu89} or
6195 @option{-fgnu89-inline} or when @code{gnu_inline} attribute is present
6196 on all inline declarations, another when
6197 @option{-std=c99}, @option{-std=c11},
6198 @option{-std=gnu99} or @option{-std=gnu11}
6199 (without @option{-fgnu89-inline}), and the third
6200 is used when compiling C++.
6201
6202 To declare a function inline, use the @code{inline} keyword in its
6203 declaration, like this:
6204
6205 @smallexample
6206 static inline int
6207 inc (int *a)
6208 @{
6209   return (*a)++;
6210 @}
6211 @end smallexample
6212
6213 If you are writing a header file to be included in ISO C90 programs, write
6214 @code{__inline__} instead of @code{inline}.  @xref{Alternate Keywords}.
6215
6216 The three types of inlining behave similarly in two important cases:
6217 when the @code{inline} keyword is used on a @code{static} function,
6218 like the example above, and when a function is first declared without
6219 using the @code{inline} keyword and then is defined with
6220 @code{inline}, like this:
6221
6222 @smallexample
6223 extern int inc (int *a);
6224 inline int
6225 inc (int *a)
6226 @{
6227   return (*a)++;
6228 @}
6229 @end smallexample
6230
6231 In both of these common cases, the program behaves the same as if you
6232 had not used the @code{inline} keyword, except for its speed.
6233
6234 @cindex inline functions, omission of
6235 @opindex fkeep-inline-functions
6236 When a function is both inline and @code{static}, if all calls to the
6237 function are integrated into the caller, and the function's address is
6238 never used, then the function's own assembler code is never referenced.
6239 In this case, GCC does not actually output assembler code for the
6240 function, unless you specify the option @option{-fkeep-inline-functions}.
6241 Some calls cannot be integrated for various reasons (in particular,
6242 calls that precede the function's definition cannot be integrated, and
6243 neither can recursive calls within the definition).  If there is a
6244 nonintegrated call, then the function is compiled to assembler code as
6245 usual.  The function must also be compiled as usual if the program
6246 refers to its address, because that can't be inlined.
6247
6248 @opindex Winline
6249 Note that certain usages in a function definition can make it unsuitable
6250 for inline substitution.  Among these usages are: variadic functions, use of
6251 @code{alloca}, use of variable-length data types (@pxref{Variable Length}),
6252 use of computed goto (@pxref{Labels as Values}), use of nonlocal goto,
6253 and nested functions (@pxref{Nested Functions}).  Using @option{-Winline}
6254 warns when a function marked @code{inline} could not be substituted,
6255 and gives the reason for the failure.
6256
6257 @cindex automatic @code{inline} for C++ member fns
6258 @cindex @code{inline} automatic for C++ member fns
6259 @cindex member fns, automatically @code{inline}
6260 @cindex C++ member fns, automatically @code{inline}
6261 @opindex fno-default-inline
6262 As required by ISO C++, GCC considers member functions defined within
6263 the body of a class to be marked inline even if they are
6264 not explicitly declared with the @code{inline} keyword.  You can
6265 override this with @option{-fno-default-inline}; @pxref{C++ Dialect
6266 Options,,Options Controlling C++ Dialect}.
6267
6268 GCC does not inline any functions when not optimizing unless you specify
6269 the @samp{always_inline} attribute for the function, like this:
6270
6271 @smallexample
6272 /* @r{Prototype.}  */
6273 inline void foo (const char) __attribute__((always_inline));
6274 @end smallexample
6275
6276 The remainder of this section is specific to GNU C90 inlining.
6277
6278 @cindex non-static inline function
6279 When an inline function is not @code{static}, then the compiler must assume
6280 that there may be calls from other source files; since a global symbol can
6281 be defined only once in any program, the function must not be defined in
6282 the other source files, so the calls therein cannot be integrated.
6283 Therefore, a non-@code{static} inline function is always compiled on its
6284 own in the usual fashion.
6285
6286 If you specify both @code{inline} and @code{extern} in the function
6287 definition, then the definition is used only for inlining.  In no case
6288 is the function compiled on its own, not even if you refer to its
6289 address explicitly.  Such an address becomes an external reference, as
6290 if you had only declared the function, and had not defined it.
6291
6292 This combination of @code{inline} and @code{extern} has almost the
6293 effect of a macro.  The way to use it is to put a function definition in
6294 a header file with these keywords, and put another copy of the
6295 definition (lacking @code{inline} and @code{extern}) in a library file.
6296 The definition in the header file causes most calls to the function
6297 to be inlined.  If any uses of the function remain, they refer to
6298 the single copy in the library.
6299
6300 @node Volatiles
6301 @section When is a Volatile Object Accessed?
6302 @cindex accessing volatiles
6303 @cindex volatile read
6304 @cindex volatile write
6305 @cindex volatile access
6306
6307 C has the concept of volatile objects.  These are normally accessed by
6308 pointers and used for accessing hardware or inter-thread
6309 communication.  The standard encourages compilers to refrain from
6310 optimizations concerning accesses to volatile objects, but leaves it
6311 implementation defined as to what constitutes a volatile access.  The
6312 minimum requirement is that at a sequence point all previous accesses
6313 to volatile objects have stabilized and no subsequent accesses have
6314 occurred.  Thus an implementation is free to reorder and combine
6315 volatile accesses that occur between sequence points, but cannot do
6316 so for accesses across a sequence point.  The use of volatile does
6317 not allow you to violate the restriction on updating objects multiple
6318 times between two sequence points.
6319
6320 Accesses to non-volatile objects are not ordered with respect to
6321 volatile accesses.  You cannot use a volatile object as a memory
6322 barrier to order a sequence of writes to non-volatile memory.  For
6323 instance:
6324
6325 @smallexample
6326 int *ptr = @var{something};
6327 volatile int vobj;
6328 *ptr = @var{something};
6329 vobj = 1;
6330 @end smallexample
6331
6332 @noindent
6333 Unless @var{*ptr} and @var{vobj} can be aliased, it is not guaranteed
6334 that the write to @var{*ptr} occurs by the time the update
6335 of @var{vobj} happens.  If you need this guarantee, you must use
6336 a stronger memory barrier such as:
6337
6338 @smallexample
6339 int *ptr = @var{something};
6340 volatile int vobj;
6341 *ptr = @var{something};
6342 asm volatile ("" : : : "memory");
6343 vobj = 1;
6344 @end smallexample
6345
6346 A scalar volatile object is read when it is accessed in a void context:
6347
6348 @smallexample
6349 volatile int *src = @var{somevalue};
6350 *src;
6351 @end smallexample
6352
6353 Such expressions are rvalues, and GCC implements this as a
6354 read of the volatile object being pointed to.
6355
6356 Assignments are also expressions and have an rvalue.  However when
6357 assigning to a scalar volatile, the volatile object is not reread,
6358 regardless of whether the assignment expression's rvalue is used or
6359 not.  If the assignment's rvalue is used, the value is that assigned
6360 to the volatile object.  For instance, there is no read of @var{vobj}
6361 in all the following cases:
6362
6363 @smallexample
6364 int obj;
6365 volatile int vobj;
6366 vobj = @var{something};
6367 obj = vobj = @var{something};
6368 obj ? vobj = @var{onething} : vobj = @var{anotherthing};
6369 obj = (@var{something}, vobj = @var{anotherthing});
6370 @end smallexample
6371
6372 If you need to read the volatile object after an assignment has
6373 occurred, you must use a separate expression with an intervening
6374 sequence point.
6375
6376 As bit-fields are not individually addressable, volatile bit-fields may
6377 be implicitly read when written to, or when adjacent bit-fields are
6378 accessed.  Bit-field operations may be optimized such that adjacent
6379 bit-fields are only partially accessed, if they straddle a storage unit
6380 boundary.  For these reasons it is unwise to use volatile bit-fields to
6381 access hardware.
6382
6383 @node Using Assembly Language with C
6384 @section How to Use Inline Assembly Language in C Code
6385 @cindex @code{asm} keyword
6386 @cindex assembly language in C
6387 @cindex inline assembly language
6388 @cindex mixing assembly language and C
6389
6390 The @code{asm} keyword allows you to embed assembler instructions
6391 within C code.  GCC provides two forms of inline @code{asm}
6392 statements.  A @dfn{basic @code{asm}} statement is one with no
6393 operands (@pxref{Basic Asm}), while an @dfn{extended @code{asm}}
6394 statement (@pxref{Extended Asm}) includes one or more operands.  
6395 The extended form is preferred for mixing C and assembly language
6396 within a function, but to include assembly language at
6397 top level you must use basic @code{asm}.
6398
6399 You can also use the @code{asm} keyword to override the assembler name
6400 for a C symbol, or to place a C variable in a specific register.
6401
6402 @menu
6403 * Basic Asm::          Inline assembler without operands.
6404 * Extended Asm::       Inline assembler with operands.
6405 * Constraints::        Constraints for @code{asm} operands
6406 * Asm Labels::         Specifying the assembler name to use for a C symbol.
6407 * Explicit Reg Vars::  Defining variables residing in specified registers.
6408 * Size of an asm::     How GCC calculates the size of an @code{asm} block.
6409 @end menu
6410
6411 @node Basic Asm
6412 @subsection Basic Asm --- Assembler Instructions Without Operands
6413 @cindex basic @code{asm}
6414 @cindex assembly language in C, basic
6415
6416 A basic @code{asm} statement has the following syntax:
6417
6418 @example
6419 asm @r{[} volatile @r{]} ( @var{AssemblerInstructions} )
6420 @end example
6421
6422 The @code{asm} keyword is a GNU extension.
6423 When writing code that can be compiled with @option{-ansi} and the
6424 various @option{-std} options, use @code{__asm__} instead of 
6425 @code{asm} (@pxref{Alternate Keywords}).
6426
6427 @subsubheading Qualifiers
6428 @table @code
6429 @item volatile
6430 The optional @code{volatile} qualifier has no effect. 
6431 All basic @code{asm} blocks are implicitly volatile.
6432 @end table
6433
6434 @subsubheading Parameters
6435 @table @var
6436
6437 @item AssemblerInstructions
6438 This is a literal string that specifies the assembler code. The string can 
6439 contain any instructions recognized by the assembler, including directives. 
6440 GCC does not parse the assembler instructions themselves and 
6441 does not know what they mean or even whether they are valid assembler input. 
6442
6443 You may place multiple assembler instructions together in a single @code{asm} 
6444 string, separated by the characters normally used in assembly code for the 
6445 system. A combination that works in most places is a newline to break the 
6446 line, plus a tab character (written as @samp{\n\t}).
6447 Some assemblers allow semicolons as a line separator. However, 
6448 note that some assembler dialects use semicolons to start a comment. 
6449 @end table
6450
6451 @subsubheading Remarks
6452 Using extended @code{asm} typically produces smaller, safer, and more
6453 efficient code, and in most cases it is a better solution than basic
6454 @code{asm}.  However, there are two situations where only basic @code{asm}
6455 can be used:
6456
6457 @itemize @bullet
6458 @item
6459 Extended @code{asm} statements have to be inside a C
6460 function, so to write inline assembly language at file scope (``top-level''),
6461 outside of C functions, you must use basic @code{asm}.
6462 You can use this technique to emit assembler directives,
6463 define assembly language macros that can be invoked elsewhere in the file,
6464 or write entire functions in assembly language.
6465
6466 @item
6467 Functions declared
6468 with the @code{naked} attribute also require basic @code{asm}
6469 (@pxref{Function Attributes}).
6470 @end itemize
6471
6472 Safely accessing C data and calling functions from basic @code{asm} is more 
6473 complex than it may appear. To access C data, it is better to use extended 
6474 @code{asm}.
6475
6476 Do not expect a sequence of @code{asm} statements to remain perfectly 
6477 consecutive after compilation. If certain instructions need to remain 
6478 consecutive in the output, put them in a single multi-instruction @code{asm}
6479 statement. Note that GCC's optimizers can move @code{asm} statements 
6480 relative to other code, including across jumps.
6481
6482 @code{asm} statements may not perform jumps into other @code{asm} statements. 
6483 GCC does not know about these jumps, and therefore cannot take 
6484 account of them when deciding how to optimize. Jumps from @code{asm} to C 
6485 labels are only supported in extended @code{asm}.
6486
6487 Under certain circumstances, GCC may duplicate (or remove duplicates of) your 
6488 assembly code when optimizing. This can lead to unexpected duplicate 
6489 symbol errors during compilation if your assembly code defines symbols or 
6490 labels.
6491
6492 Since GCC does not parse the @var{AssemblerInstructions}, it has no 
6493 visibility of any symbols it references. This may result in GCC discarding 
6494 those symbols as unreferenced.
6495
6496 The compiler copies the assembler instructions in a basic @code{asm} 
6497 verbatim to the assembly language output file, without 
6498 processing dialects or any of the @samp{%} operators that are available with
6499 extended @code{asm}. This results in minor differences between basic 
6500 @code{asm} strings and extended @code{asm} templates. For example, to refer to 
6501 registers you might use @samp{%eax} in basic @code{asm} and
6502 @samp{%%eax} in extended @code{asm}.
6503
6504 On targets such as x86 that support multiple assembler dialects,
6505 all basic @code{asm} blocks use the assembler dialect specified by the 
6506 @option{-masm} command-line option (@pxref{x86 Options}).  
6507 Basic @code{asm} provides no
6508 mechanism to provide different assembler strings for different dialects.
6509
6510 Here is an example of basic @code{asm} for i386:
6511
6512 @example
6513 /* Note that this code will not compile with -masm=intel */
6514 #define DebugBreak() asm("int $3")
6515 @end example
6516
6517 @node Extended Asm
6518 @subsection Extended Asm - Assembler Instructions with C Expression Operands
6519 @cindex extended @code{asm}
6520 @cindex assembly language in C, extended
6521
6522 With extended @code{asm} you can read and write C variables from 
6523 assembler and perform jumps from assembler code to C labels.  
6524 Extended @code{asm} syntax uses colons (@samp{:}) to delimit
6525 the operand parameters after the assembler template:
6526
6527 @example
6528 asm @r{[}volatile@r{]} ( @var{AssemblerTemplate} 
6529                  : @var{OutputOperands} 
6530                  @r{[} : @var{InputOperands}
6531                  @r{[} : @var{Clobbers} @r{]} @r{]})
6532
6533 asm @r{[}volatile@r{]} goto ( @var{AssemblerTemplate} 
6534                       : 
6535                       : @var{InputOperands}
6536                       : @var{Clobbers}
6537                       : @var{GotoLabels})
6538 @end example
6539
6540 The @code{asm} keyword is a GNU extension.
6541 When writing code that can be compiled with @option{-ansi} and the
6542 various @option{-std} options, use @code{__asm__} instead of 
6543 @code{asm} (@pxref{Alternate Keywords}).
6544
6545 @subsubheading Qualifiers
6546 @table @code
6547
6548 @item volatile
6549 The typical use of extended @code{asm} statements is to manipulate input 
6550 values to produce output values. However, your @code{asm} statements may 
6551 also produce side effects. If so, you may need to use the @code{volatile} 
6552 qualifier to disable certain optimizations. @xref{Volatile}.
6553
6554 @item goto
6555 This qualifier informs the compiler that the @code{asm} statement may 
6556 perform a jump to one of the labels listed in the @var{GotoLabels}.
6557 @xref{GotoLabels}.
6558 @end table
6559
6560 @subsubheading Parameters
6561 @table @var
6562 @item AssemblerTemplate
6563 This is a literal string that is the template for the assembler code. It is a 
6564 combination of fixed text and tokens that refer to the input, output, 
6565 and goto parameters. @xref{AssemblerTemplate}.
6566
6567 @item OutputOperands
6568 A comma-separated list of the C variables modified by the instructions in the 
6569 @var{AssemblerTemplate}.  An empty list is permitted.  @xref{OutputOperands}.
6570
6571 @item InputOperands
6572 A comma-separated list of C expressions read by the instructions in the 
6573 @var{AssemblerTemplate}.  An empty list is permitted.  @xref{InputOperands}.
6574
6575 @item Clobbers
6576 A comma-separated list of registers or other values changed by the 
6577 @var{AssemblerTemplate}, beyond those listed as outputs.
6578 An empty list is permitted.  @xref{Clobbers}.
6579
6580 @item GotoLabels
6581 When you are using the @code{goto} form of @code{asm}, this section contains 
6582 the list of all C labels to which the code in the 
6583 @var{AssemblerTemplate} may jump. 
6584 @xref{GotoLabels}.
6585
6586 @code{asm} statements may not perform jumps into other @code{asm} statements,
6587 only to the listed @var{GotoLabels}.
6588 GCC's optimizers do not know about other jumps; therefore they cannot take 
6589 account of them when deciding how to optimize.
6590 @end table
6591
6592 The total number of input + output + goto operands is limited to 30.
6593
6594 @subsubheading Remarks
6595 The @code{asm} statement allows you to include assembly instructions directly 
6596 within C code. This may help you to maximize performance in time-sensitive 
6597 code or to access assembly instructions that are not readily available to C 
6598 programs.
6599
6600 Note that extended @code{asm} statements must be inside a function. Only 
6601 basic @code{asm} may be outside functions (@pxref{Basic Asm}).
6602 Functions declared with the @code{naked} attribute also require basic 
6603 @code{asm} (@pxref{Function Attributes}).
6604
6605 While the uses of @code{asm} are many and varied, it may help to think of an 
6606 @code{asm} statement as a series of low-level instructions that convert input 
6607 parameters to output parameters. So a simple (if not particularly useful) 
6608 example for i386 using @code{asm} might look like this:
6609
6610 @example
6611 int src = 1;
6612 int dst;   
6613
6614 asm ("mov %1, %0\n\t"
6615     "add $1, %0"
6616     : "=r" (dst) 
6617     : "r" (src));
6618
6619 printf("%d\n", dst);
6620 @end example
6621
6622 This code copies @code{src} to @code{dst} and add 1 to @code{dst}.
6623
6624 @anchor{Volatile}
6625 @subsubsection Volatile
6626 @cindex volatile @code{asm}
6627 @cindex @code{asm} volatile
6628
6629 GCC's optimizers sometimes discard @code{asm} statements if they determine 
6630 there is no need for the output variables. Also, the optimizers may move 
6631 code out of loops if they believe that the code will always return the same 
6632 result (i.e. none of its input values change between calls). Using the 
6633 @code{volatile} qualifier disables these optimizations. @code{asm} statements 
6634 that have no output operands, including @code{asm goto} statements, 
6635 are implicitly volatile.
6636
6637 This i386 code demonstrates a case that does not use (or require) the 
6638 @code{volatile} qualifier. If it is performing assertion checking, this code 
6639 uses @code{asm} to perform the validation. Otherwise, @code{dwRes} is 
6640 unreferenced by any code. As a result, the optimizers can discard the 
6641 @code{asm} statement, which in turn removes the need for the entire 
6642 @code{DoCheck} routine. By omitting the @code{volatile} qualifier when it 
6643 isn't needed you allow the optimizers to produce the most efficient code 
6644 possible.
6645
6646 @example
6647 void DoCheck(uint32_t dwSomeValue)
6648 @{
6649    uint32_t dwRes;
6650
6651    // Assumes dwSomeValue is not zero.
6652    asm ("bsfl %1,%0"
6653      : "=r" (dwRes)
6654      : "r" (dwSomeValue)
6655      : "cc");
6656
6657    assert(dwRes > 3);
6658 @}
6659 @end example
6660
6661 The next example shows a case where the optimizers can recognize that the input 
6662 (@code{dwSomeValue}) never changes during the execution of the function and can 
6663 therefore move the @code{asm} outside the loop to produce more efficient code. 
6664 Again, using @code{volatile} disables this type of optimization.
6665
6666 @example
6667 void do_print(uint32_t dwSomeValue)
6668 @{
6669    uint32_t dwRes;
6670
6671    for (uint32_t x=0; x < 5; x++)
6672    @{
6673       // Assumes dwSomeValue is not zero.
6674       asm ("bsfl %1,%0"
6675         : "=r" (dwRes)
6676         : "r" (dwSomeValue)
6677         : "cc");
6678
6679       printf("%u: %u %u\n", x, dwSomeValue, dwRes);
6680    @}
6681 @}
6682 @end example
6683
6684 The following example demonstrates a case where you need to use the 
6685 @code{volatile} qualifier. 
6686 It uses the x86 @code{rdtsc} instruction, which reads 
6687 the computer's time-stamp counter. Without the @code{volatile} qualifier, 
6688 the optimizers might assume that the @code{asm} block will always return the 
6689 same value and therefore optimize away the second call.
6690
6691 @example
6692 uint64_t msr;
6693
6694 asm volatile ( "rdtsc\n\t"    // Returns the time in EDX:EAX.
6695         "shl $32, %%rdx\n\t"  // Shift the upper bits left.
6696         "or %%rdx, %0"        // 'Or' in the lower bits.
6697         : "=a" (msr)
6698         : 
6699         : "rdx");
6700
6701 printf("msr: %llx\n", msr);
6702
6703 // Do other work...
6704
6705 // Reprint the timestamp
6706 asm volatile ( "rdtsc\n\t"    // Returns the time in EDX:EAX.
6707         "shl $32, %%rdx\n\t"  // Shift the upper bits left.
6708         "or %%rdx, %0"        // 'Or' in the lower bits.
6709         : "=a" (msr)
6710         : 
6711         : "rdx");
6712
6713 printf("msr: %llx\n", msr);
6714 @end example
6715
6716 GCC's optimizers do not treat this code like the non-volatile code in the 
6717 earlier examples. They do not move it out of loops or omit it on the 
6718 assumption that the result from a previous call is still valid.
6719
6720 Note that the compiler can move even volatile @code{asm} instructions relative 
6721 to other code, including across jump instructions. For example, on many 
6722 targets there is a system register that controls the rounding mode of 
6723 floating-point operations. Setting it with a volatile @code{asm}, as in the 
6724 following PowerPC example, does not work reliably.
6725
6726 @example
6727 asm volatile("mtfsf 255, %0" : : "f" (fpenv));
6728 sum = x + y;
6729 @end example
6730
6731 The compiler may move the addition back before the volatile @code{asm}. To 
6732 make it work as expected, add an artificial dependency to the @code{asm} by 
6733 referencing a variable in the subsequent code, for example: 
6734
6735 @example
6736 asm volatile ("mtfsf 255,%1" : "=X" (sum) : "f" (fpenv));
6737 sum = x + y;
6738 @end example
6739
6740 Under certain circumstances, GCC may duplicate (or remove duplicates of) your 
6741 assembly code when optimizing. This can lead to unexpected duplicate symbol 
6742 errors during compilation if your asm code defines symbols or labels. 
6743 Using @samp{%=} 
6744 (@pxref{AssemblerTemplate}) may help resolve this problem.
6745
6746 @anchor{AssemblerTemplate}
6747 @subsubsection Assembler Template
6748 @cindex @code{asm} assembler template
6749
6750 An assembler template is a literal string containing assembler instructions.
6751 The compiler replaces tokens in the template that refer 
6752 to inputs, outputs, and goto labels,
6753 and then outputs the resulting string to the assembler. The 
6754 string can contain any instructions recognized by the assembler, including 
6755 directives. GCC does not parse the assembler instructions 
6756 themselves and does not know what they mean or even whether they are valid 
6757 assembler input. However, it does count the statements 
6758 (@pxref{Size of an asm}).
6759
6760 You may place multiple assembler instructions together in a single @code{asm} 
6761 string, separated by the characters normally used in assembly code for the 
6762 system. A combination that works in most places is a newline to break the 
6763 line, plus a tab character to move to the instruction field (written as 
6764 @samp{\n\t}). 
6765 Some assemblers allow semicolons as a line separator. However, note 
6766 that some assembler dialects use semicolons to start a comment. 
6767
6768 Do not expect a sequence of @code{asm} statements to remain perfectly 
6769 consecutive after compilation, even when you are using the @code{volatile} 
6770 qualifier. If certain instructions need to remain consecutive in the output, 
6771 put them in a single multi-instruction asm statement.
6772
6773 Accessing data from C programs without using input/output operands (such as 
6774 by using global symbols directly from the assembler template) may not work as 
6775 expected. Similarly, calling functions directly from an assembler template 
6776 requires a detailed understanding of the target assembler and ABI.
6777
6778 Since GCC does not parse the assembler template,
6779 it has no visibility of any 
6780 symbols it references. This may result in GCC discarding those symbols as 
6781 unreferenced unless they are also listed as input, output, or goto operands.
6782
6783 @subsubheading Special format strings
6784
6785 In addition to the tokens described by the input, output, and goto operands, 
6786 these tokens have special meanings in the assembler template:
6787
6788 @table @samp
6789 @item %% 
6790 Outputs a single @samp{%} into the assembler code.
6791
6792 @item %= 
6793 Outputs a number that is unique to each instance of the @code{asm} 
6794 statement in the entire compilation. This option is useful when creating local 
6795 labels and referring to them multiple times in a single template that 
6796 generates multiple assembler instructions. 
6797
6798 @item %@{
6799 @itemx %|
6800 @itemx %@}
6801 Outputs @samp{@{}, @samp{|}, and @samp{@}} characters (respectively)
6802 into the assembler code.  When unescaped, these characters have special
6803 meaning to indicate multiple assembler dialects, as described below.
6804 @end table
6805
6806 @subsubheading Multiple assembler dialects in @code{asm} templates
6807
6808 On targets such as x86, GCC supports multiple assembler dialects.
6809 The @option{-masm} option controls which dialect GCC uses as its 
6810 default for inline assembler. The target-specific documentation for the 
6811 @option{-masm} option contains the list of supported dialects, as well as the 
6812 default dialect if the option is not specified. This information may be 
6813 important to understand, since assembler code that works correctly when 
6814 compiled using one dialect will likely fail if compiled using another.
6815 @xref{x86 Options}.
6816
6817 If your code needs to support multiple assembler dialects (for example, if 
6818 you are writing public headers that need to support a variety of compilation 
6819 options), use constructs of this form:
6820
6821 @example
6822 @{ dialect0 | dialect1 | dialect2... @}
6823 @end example
6824
6825 This construct outputs @code{dialect0} 
6826 when using dialect #0 to compile the code, 
6827 @code{dialect1} for dialect #1, etc. If there are fewer alternatives within the 
6828 braces than the number of dialects the compiler supports, the construct 
6829 outputs nothing.
6830
6831 For example, if an x86 compiler supports two dialects
6832 (@samp{att}, @samp{intel}), an 
6833 assembler template such as this:
6834
6835 @example
6836 "bt@{l %[Offset],%[Base] | %[Base],%[Offset]@}; jc %l2"
6837 @end example
6838
6839 @noindent
6840 is equivalent to one of
6841
6842 @example
6843 "btl %[Offset],%[Base] ; jc %l2"   @r{/* att dialect */}
6844 "bt %[Base],%[Offset]; jc %l2"     @r{/* intel dialect */}
6845 @end example
6846
6847 Using that same compiler, this code:
6848
6849 @example
6850 "xchg@{l@}\t@{%%@}ebx, %1"
6851 @end example
6852
6853 @noindent
6854 corresponds to either
6855
6856 @example
6857 "xchgl\t%%ebx, %1"                 @r{/* att dialect */}
6858 "xchg\tebx, %1"                    @r{/* intel dialect */}
6859 @end example
6860
6861 There is no support for nesting dialect alternatives.
6862
6863 @anchor{OutputOperands}
6864 @subsubsection Output Operands
6865 @cindex @code{asm} output operands
6866
6867 An @code{asm} statement has zero or more output operands indicating the names
6868 of C variables modified by the assembler code.
6869
6870 In this i386 example, @code{old} (referred to in the template string as 
6871 @code{%0}) and @code{*Base} (as @code{%1}) are outputs and @code{Offset} 
6872 (@code{%2}) is an input:
6873
6874 @example
6875 bool old;
6876
6877 __asm__ ("btsl %2,%1\n\t" // Turn on zero-based bit #Offset in Base.
6878          "sbb %0,%0"      // Use the CF to calculate old.
6879    : "=r" (old), "+rm" (*Base)
6880    : "Ir" (Offset)
6881    : "cc");
6882
6883 return old;
6884 @end example
6885
6886 Operands are separated by commas.  Each operand has this format:
6887
6888 @example
6889 @r{[} [@var{asmSymbolicName}] @r{]} @var{constraint} (@var{cvariablename})
6890 @end example
6891
6892 @table @var
6893 @item asmSymbolicName
6894 Specifies a symbolic name for the operand.
6895 Reference the name in the assembler template 
6896 by enclosing it in square brackets 
6897 (i.e. @samp{%[Value]}). The scope of the name is the @code{asm} statement 
6898 that contains the definition. Any valid C variable name is acceptable, 
6899 including names already defined in the surrounding code. No two operands 
6900 within the same @code{asm} statement can use the same symbolic name.
6901
6902 When not using an @var{asmSymbolicName}, use the (zero-based) position
6903 of the operand 
6904 in the list of operands in the assembler template. For example if there are 
6905 three output operands, use @samp{%0} in the template to refer to the first, 
6906 @samp{%1} for the second, and @samp{%2} for the third. 
6907
6908 @item constraint
6909 A string constant specifying constraints on the placement of the operand; 
6910 @xref{Constraints}, for details.
6911
6912 Output constraints must begin with either @samp{=} (a variable overwriting an 
6913 existing value) or @samp{+} (when reading and writing). When using 
6914 @samp{=}, do not assume the location contains the existing value
6915 on entry to the @code{asm}, except 
6916 when the operand is tied to an input; @pxref{InputOperands,,Input Operands}.
6917
6918 After the prefix, there must be one or more additional constraints 
6919 (@pxref{Constraints}) that describe where the value resides. Common 
6920 constraints include @samp{r} for register and @samp{m} for memory. 
6921 When you list more than one possible location (for example, @code{"=rm"}),
6922 the compiler chooses the most efficient one based on the current context. 
6923 If you list as many alternates as the @code{asm} statement allows, you permit 
6924 the optimizers to produce the best possible code. 
6925 If you must use a specific register, but your Machine Constraints do not
6926 provide sufficient control to select the specific register you want, 
6927 local register variables may provide a solution (@pxref{Local Reg Vars}).
6928
6929 @item cvariablename
6930 Specifies a C lvalue expression to hold the output, typically a variable name.
6931 The enclosing parentheses are a required part of the syntax.
6932
6933 @end table
6934
6935 When the compiler selects the registers to use to 
6936 represent the output operands, it does not use any of the clobbered registers 
6937 (@pxref{Clobbers}).
6938
6939 Output operand expressions must be lvalues. The compiler cannot check whether 
6940 the operands have data types that are reasonable for the instruction being 
6941 executed. For output expressions that are not directly addressable (for 
6942 example a bit-field), the constraint must allow a register. In that case, GCC 
6943 uses the register as the output of the @code{asm}, and then stores that 
6944 register into the output. 
6945
6946 Operands using the @samp{+} constraint modifier count as two operands 
6947 (that is, both as input and output) towards the total maximum of 30 operands
6948 per @code{asm} statement.
6949
6950 Use the @samp{&} constraint modifier (@pxref{Modifiers}) on all output
6951 operands that must not overlap an input.  Otherwise, 
6952 GCC may allocate the output operand in the same register as an unrelated 
6953 input operand, on the assumption that the assembler code consumes its 
6954 inputs before producing outputs. This assumption may be false if the assembler 
6955 code actually consists of more than one instruction.
6956
6957 The same problem can occur if one output parameter (@var{a}) allows a register 
6958 constraint and another output parameter (@var{b}) allows a memory constraint.
6959 The code generated by GCC to access the memory address in @var{b} can contain
6960 registers which @emph{might} be shared by @var{a}, and GCC considers those 
6961 registers to be inputs to the asm. As above, GCC assumes that such input
6962 registers are consumed before any outputs are written. This assumption may 
6963 result in incorrect behavior if the asm writes to @var{a} before using 
6964 @var{b}. Combining the @samp{&} modifier with the register constraint on @var{a}
6965 ensures that modifying @var{a} does not affect the address referenced by 
6966 @var{b}. Otherwise, the location of @var{b} 
6967 is undefined if @var{a} is modified before using @var{b}.
6968
6969 @code{asm} supports operand modifiers on operands (for example @samp{%k2} 
6970 instead of simply @samp{%2}). Typically these qualifiers are hardware 
6971 dependent. The list of supported modifiers for x86 is found at 
6972 @ref{x86Operandmodifiers,x86 Operand modifiers}.
6973
6974 If the C code that follows the @code{asm} makes no use of any of the output 
6975 operands, use @code{volatile} for the @code{asm} statement to prevent the 
6976 optimizers from discarding the @code{asm} statement as unneeded 
6977 (see @ref{Volatile}).
6978
6979 This code makes no use of the optional @var{asmSymbolicName}. Therefore it 
6980 references the first output operand as @code{%0} (were there a second, it 
6981 would be @code{%1}, etc). The number of the first input operand is one greater 
6982 than that of the last output operand. In this i386 example, that makes 
6983 @code{Mask} referenced as @code{%1}:
6984
6985 @example
6986 uint32_t Mask = 1234;
6987 uint32_t Index;
6988
6989   asm ("bsfl %1, %0"
6990      : "=r" (Index)
6991      : "r" (Mask)
6992      : "cc");
6993 @end example
6994
6995 That code overwrites the variable @code{Index} (@samp{=}),
6996 placing the value in a register (@samp{r}).
6997 Using the generic @samp{r} constraint instead of a constraint for a specific 
6998 register allows the compiler to pick the register to use, which can result 
6999 in more efficient code. This may not be possible if an assembler instruction 
7000 requires a specific register.
7001
7002 The following i386 example uses the @var{asmSymbolicName} syntax.
7003 It produces the 
7004 same result as the code above, but some may consider it more readable or more 
7005 maintainable since reordering index numbers is not necessary when adding or 
7006 removing operands. The names @code{aIndex} and @code{aMask}
7007 are only used in this example to emphasize which 
7008 names get used where.
7009 It is acceptable to reuse the names @code{Index} and @code{Mask}.
7010
7011 @example
7012 uint32_t Mask = 1234;
7013 uint32_t Index;
7014
7015   asm ("bsfl %[aMask], %[aIndex]"
7016      : [aIndex] "=r" (Index)
7017      : [aMask] "r" (Mask)
7018      : "cc");
7019 @end example
7020
7021 Here are some more examples of output operands.
7022
7023 @example
7024 uint32_t c = 1;
7025 uint32_t d;
7026 uint32_t *e = &c;
7027
7028 asm ("mov %[e], %[d]"
7029    : [d] "=rm" (d)
7030    : [e] "rm" (*e));
7031 @end example
7032
7033 Here, @code{d} may either be in a register or in memory. Since the compiler 
7034 might already have the current value of the @code{uint32_t} location
7035 pointed to by @code{e}
7036 in a register, you can enable it to choose the best location
7037 for @code{d} by specifying both constraints.
7038
7039 @anchor{InputOperands}
7040 @subsubsection Input Operands
7041 @cindex @code{asm} input operands
7042 @cindex @code{asm} expressions
7043
7044 Input operands make values from C variables and expressions available to the 
7045 assembly code.
7046
7047 Operands are separated by commas.  Each operand has this format:
7048
7049 @example
7050 @r{[} [@var{asmSymbolicName}] @r{]} @var{constraint} (@var{cexpression})
7051 @end example
7052
7053 @table @var
7054 @item asmSymbolicName
7055 Specifies a symbolic name for the operand.
7056 Reference the name in the assembler template 
7057 by enclosing it in square brackets 
7058 (i.e. @samp{%[Value]}). The scope of the name is the @code{asm} statement 
7059 that contains the definition. Any valid C variable name is acceptable, 
7060 including names already defined in the surrounding code. No two operands 
7061 within the same @code{asm} statement can use the same symbolic name.
7062
7063 When not using an @var{asmSymbolicName}, use the (zero-based) position
7064 of the operand 
7065 in the list of operands in the assembler template. For example if there are
7066 two output operands and three inputs,
7067 use @samp{%2} in the template to refer to the first input operand,
7068 @samp{%3} for the second, and @samp{%4} for the third. 
7069
7070 @item constraint
7071 A string constant specifying constraints on the placement of the operand; 
7072 @xref{Constraints}, for details.
7073
7074 Input constraint strings may not begin with either @samp{=} or @samp{+}.
7075 When you list more than one possible location (for example, @samp{"irm"}), 
7076 the compiler chooses the most efficient one based on the current context.
7077 If you must use a specific register, but your Machine Constraints do not
7078 provide sufficient control to select the specific register you want, 
7079 local register variables may provide a solution (@pxref{Local Reg Vars}).
7080
7081 Input constraints can also be digits (for example, @code{"0"}). This indicates 
7082 that the specified input must be in the same place as the output constraint 
7083 at the (zero-based) index in the output constraint list. 
7084 When using @var{asmSymbolicName} syntax for the output operands,
7085 you may use these names (enclosed in brackets @samp{[]}) instead of digits.
7086
7087 @item cexpression
7088 This is the C variable or expression being passed to the @code{asm} statement 
7089 as input.  The enclosing parentheses are a required part of the syntax.
7090
7091 @end table
7092
7093 When the compiler selects the registers to use to represent the input 
7094 operands, it does not use any of the clobbered registers (@pxref{Clobbers}).
7095
7096 If there are no output operands but there are input operands, place two 
7097 consecutive colons where the output operands would go:
7098
7099 @example
7100 __asm__ ("some instructions"
7101    : /* No outputs. */
7102    : "r" (Offset / 8));
7103 @end example
7104
7105 @strong{Warning:} Do @emph{not} modify the contents of input-only operands 
7106 (except for inputs tied to outputs). The compiler assumes that on exit from 
7107 the @code{asm} statement these operands contain the same values as they 
7108 had before executing the statement. 
7109 It is @emph{not} possible to use clobbers
7110 to inform the compiler that the values in these inputs are changing. One 
7111 common work-around is to tie the changing input variable to an output variable 
7112 that never gets used. Note, however, that if the code that follows the 
7113 @code{asm} statement makes no use of any of the output operands, the GCC 
7114 optimizers may discard the @code{asm} statement as unneeded 
7115 (see @ref{Volatile}).
7116
7117 @code{asm} supports operand modifiers on operands (for example @samp{%k2} 
7118 instead of simply @samp{%2}). Typically these qualifiers are hardware 
7119 dependent. The list of supported modifiers for x86 is found at 
7120 @ref{x86Operandmodifiers,x86 Operand modifiers}.
7121
7122 In this example using the fictitious @code{combine} instruction, the 
7123 constraint @code{"0"} for input operand 1 says that it must occupy the same 
7124 location as output operand 0. Only input operands may use numbers in 
7125 constraints, and they must each refer to an output operand. Only a number (or 
7126 the symbolic assembler name) in the constraint can guarantee that one operand 
7127 is in the same place as another. The mere fact that @code{foo} is the value of 
7128 both operands is not enough to guarantee that they are in the same place in 
7129 the generated assembler code.
7130
7131 @example
7132 asm ("combine %2, %0" 
7133    : "=r" (foo) 
7134    : "0" (foo), "g" (bar));
7135 @end example
7136
7137 Here is an example using symbolic names.
7138
7139 @example
7140 asm ("cmoveq %1, %2, %[result]" 
7141    : [result] "=r"(result) 
7142    : "r" (test), "r" (new), "[result]" (old));
7143 @end example
7144
7145 @anchor{Clobbers}
7146 @subsubsection Clobbers
7147 @cindex @code{asm} clobbers
7148
7149 While the compiler is aware of changes to entries listed in the output 
7150 operands, the inline @code{asm} code may modify more than just the outputs. For 
7151 example, calculations may require additional registers, or the processor may 
7152 overwrite a register as a side effect of a particular assembler instruction. 
7153 In order to inform the compiler of these changes, list them in the clobber 
7154 list. Clobber list items are either register names or the special clobbers 
7155 (listed below). Each clobber list item is a string constant 
7156 enclosed in double quotes and separated by commas.
7157
7158 Clobber descriptions may not in any way overlap with an input or output 
7159 operand. For example, you may not have an operand describing a register class 
7160 with one member when listing that register in the clobber list. Variables 
7161 declared to live in specific registers (@pxref{Explicit Reg Vars}) and used 
7162 as @code{asm} input or output operands must have no part mentioned in the 
7163 clobber description. In particular, there is no way to specify that input 
7164 operands get modified without also specifying them as output operands.
7165
7166 When the compiler selects which registers to use to represent input and output 
7167 operands, it does not use any of the clobbered registers. As a result, 
7168 clobbered registers are available for any use in the assembler code.
7169
7170 Here is a realistic example for the VAX showing the use of clobbered 
7171 registers: 
7172
7173 @example
7174 asm volatile ("movc3 %0, %1, %2"
7175                    : /* No outputs. */
7176                    : "g" (from), "g" (to), "g" (count)
7177                    : "r0", "r1", "r2", "r3", "r4", "r5");
7178 @end example
7179
7180 Also, there are two special clobber arguments:
7181
7182 @table @code
7183 @item "cc"
7184 The @code{"cc"} clobber indicates that the assembler code modifies the flags 
7185 register. On some machines, GCC represents the condition codes as a specific 
7186 hardware register; @code{"cc"} serves to name this register.
7187 On other machines, condition code handling is different, 
7188 and specifying @code{"cc"} has no effect. But 
7189 it is valid no matter what the target.
7190
7191 @item "memory"
7192 The @code{"memory"} clobber tells the compiler that the assembly code
7193 performs memory 
7194 reads or writes to items other than those listed in the input and output 
7195 operands (for example, accessing the memory pointed to by one of the input 
7196 parameters). To ensure memory contains correct values, GCC may need to flush 
7197 specific register values to memory before executing the @code{asm}. Further, 
7198 the compiler does not assume that any values read from memory before an 
7199 @code{asm} remain unchanged after that @code{asm}; it reloads them as 
7200 needed.  
7201 Using the @code{"memory"} clobber effectively forms a read/write
7202 memory barrier for the compiler.
7203
7204 Note that this clobber does not prevent the @emph{processor} from doing 
7205 speculative reads past the @code{asm} statement. To prevent that, you need 
7206 processor-specific fence instructions.
7207
7208 Flushing registers to memory has performance implications and may be an issue 
7209 for time-sensitive code.  You can use a trick to avoid this if the size of 
7210 the memory being accessed is known at compile time. For example, if accessing 
7211 ten bytes of a string, use a memory input like: 
7212
7213 @code{@{"m"( (@{ struct @{ char x[10]; @} *p = (void *)ptr ; *p; @}) )@}}.
7214
7215 @end table
7216
7217 @anchor{GotoLabels}
7218 @subsubsection Goto Labels
7219 @cindex @code{asm} goto labels
7220
7221 @code{asm goto} allows assembly code to jump to one or more C labels.  The
7222 @var{GotoLabels} section in an @code{asm goto} statement contains 
7223 a comma-separated 
7224 list of all C labels to which the assembler code may jump. GCC assumes that 
7225 @code{asm} execution falls through to the next statement (if this is not the 
7226 case, consider using the @code{__builtin_unreachable} intrinsic after the 
7227 @code{asm} statement). Optimization of @code{asm goto} may be improved by 
7228 using the @code{hot} and @code{cold} label attributes (@pxref{Label 
7229 Attributes}).
7230
7231 An @code{asm goto} statement cannot have outputs.
7232 This is due to an internal restriction of 
7233 the compiler: control transfer instructions cannot have outputs. 
7234 If the assembler code does modify anything, use the @code{"memory"} clobber 
7235 to force the 
7236 optimizers to flush all register values to memory and reload them if 
7237 necessary after the @code{asm} statement.
7238
7239 Also note that an @code{asm goto} statement is always implicitly
7240 considered volatile.
7241
7242 To reference a label in the assembler template,
7243 prefix it with @samp{%l} (lowercase @samp{L}) followed 
7244 by its (zero-based) position in @var{GotoLabels} plus the number of input 
7245 operands.  For example, if the @code{asm} has three inputs and references two 
7246 labels, refer to the first label as @samp{%l3} and the second as @samp{%l4}).
7247
7248 Alternately, you can reference labels using the actual C label name enclosed
7249 in brackets.  For example, to reference a label named @code{carry}, you can
7250 use @samp{%l[carry]}.  The label must still be listed in the @var{GotoLabels}
7251 section when using this approach.
7252
7253 Here is an example of @code{asm goto} for i386:
7254
7255 @example
7256 asm goto (
7257     "btl %1, %0\n\t"
7258     "jc %l2"
7259     : /* No outputs. */
7260     : "r" (p1), "r" (p2) 
7261     : "cc" 
7262     : carry);
7263
7264 return 0;
7265
7266 carry:
7267 return 1;
7268 @end example
7269
7270 The following example shows an @code{asm goto} that uses a memory clobber.
7271
7272 @example
7273 int frob(int x)
7274 @{
7275   int y;
7276   asm goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5"
7277             : /* No outputs. */
7278             : "r"(x), "r"(&y)
7279             : "r5", "memory" 
7280             : error);
7281   return y;
7282 error:
7283   return -1;
7284 @}
7285 @end example
7286
7287 @anchor{x86Operandmodifiers}
7288 @subsubsection x86 Operand Modifiers
7289
7290 References to input, output, and goto operands in the assembler template
7291 of extended @code{asm} statements can use 
7292 modifiers to affect the way the operands are formatted in 
7293 the code output to the assembler. For example, the 
7294 following code uses the @samp{h} and @samp{b} modifiers for x86:
7295
7296 @example
7297 uint16_t  num;
7298 asm volatile ("xchg %h0, %b0" : "+a" (num) );
7299 @end example
7300
7301 @noindent
7302 These modifiers generate this assembler code:
7303
7304 @example
7305 xchg %ah, %al
7306 @end example
7307
7308 The rest of this discussion uses the following code for illustrative purposes.
7309
7310 @example
7311 int main()
7312 @{
7313    int iInt = 1;
7314
7315 top:
7316
7317    asm volatile goto ("some assembler instructions here"
7318    : /* No outputs. */
7319    : "q" (iInt), "X" (sizeof(unsigned char) + 1)
7320    : /* No clobbers. */
7321    : top);
7322 @}
7323 @end example
7324
7325 With no modifiers, this is what the output from the operands would be for the 
7326 @samp{att} and @samp{intel} dialects of assembler:
7327
7328 @multitable {Operand} {masm=att} {OFFSET FLAT:.L2}
7329 @headitem Operand @tab masm=att @tab masm=intel
7330 @item @code{%0}
7331 @tab @code{%eax}
7332 @tab @code{eax}
7333 @item @code{%1}
7334 @tab @code{$2}
7335 @tab @code{2}
7336 @item @code{%2}
7337 @tab @code{$.L2}
7338 @tab @code{OFFSET FLAT:.L2}
7339 @end multitable
7340
7341 The table below shows the list of supported modifiers and their effects.
7342
7343 @multitable {Modifier} {Print the opcode suffix for the size of th} {Operand} {masm=att} {masm=intel}
7344 @headitem Modifier @tab Description @tab Operand @tab @option{masm=att} @tab @option{masm=intel}
7345 @item @code{z}
7346 @tab Print the opcode suffix for the size of the current integer operand (one of @code{b}/@code{w}/@code{l}/@code{q}).
7347 @tab @code{%z0}
7348 @tab @code{l}
7349 @tab 
7350 @item @code{b}
7351 @tab Print the QImode name of the register.
7352 @tab @code{%b0}
7353 @tab @code{%al}
7354 @tab @code{al}
7355 @item @code{h}
7356 @tab Print the QImode name for a ``high'' register.
7357 @tab @code{%h0}
7358 @tab @code{%ah}
7359 @tab @code{ah}
7360 @item @code{w}
7361 @tab Print the HImode name of the register.
7362 @tab @code{%w0}
7363 @tab @code{%ax}
7364 @tab @code{ax}
7365 @item @code{k}
7366 @tab Print the SImode name of the register.
7367 @tab @code{%k0}
7368 @tab @code{%eax}
7369 @tab @code{eax}
7370 @item @code{q}
7371 @tab Print the DImode name of the register.
7372 @tab @code{%q0}
7373 @tab @code{%rax}
7374 @tab @code{rax}
7375 @item @code{l}
7376 @tab Print the label name with no punctuation.
7377 @tab @code{%l2}
7378 @tab @code{.L2}
7379 @tab @code{.L2}
7380 @item @code{c}
7381 @tab Require a constant operand and print the constant expression with no punctuation.
7382 @tab @code{%c1}
7383 @tab @code{2}
7384 @tab @code{2}
7385 @end multitable
7386
7387 @anchor{x86floatingpointasmoperands}
7388 @subsubsection x86 Floating-Point @code{asm} Operands
7389
7390 On x86 targets, there are several rules on the usage of stack-like registers
7391 in the operands of an @code{asm}.  These rules apply only to the operands
7392 that are stack-like registers:
7393
7394 @enumerate
7395 @item
7396 Given a set of input registers that die in an @code{asm}, it is
7397 necessary to know which are implicitly popped by the @code{asm}, and
7398 which must be explicitly popped by GCC@.
7399
7400 An input register that is implicitly popped by the @code{asm} must be
7401 explicitly clobbered, unless it is constrained to match an
7402 output operand.
7403
7404 @item
7405 For any input register that is implicitly popped by an @code{asm}, it is
7406 necessary to know how to adjust the stack to compensate for the pop.
7407 If any non-popped input is closer to the top of the reg-stack than
7408 the implicitly popped register, it would not be possible to know what the
7409 stack looked like---it's not clear how the rest of the stack ``slides
7410 up''.
7411
7412 All implicitly popped input registers must be closer to the top of
7413 the reg-stack than any input that is not implicitly popped.
7414
7415 It is possible that if an input dies in an @code{asm}, the compiler might
7416 use the input register for an output reload.  Consider this example:
7417
7418 @smallexample
7419 asm ("foo" : "=t" (a) : "f" (b));
7420 @end smallexample
7421
7422 @noindent
7423 This code says that input @code{b} is not popped by the @code{asm}, and that
7424 the @code{asm} pushes a result onto the reg-stack, i.e., the stack is one
7425 deeper after the @code{asm} than it was before.  But, it is possible that
7426 reload may think that it can use the same register for both the input and
7427 the output.
7428
7429 To prevent this from happening,
7430 if any input operand uses the @samp{f} constraint, all output register
7431 constraints must use the @samp{&} early-clobber modifier.
7432
7433 The example above is correctly written as:
7434
7435 @smallexample
7436 asm ("foo" : "=&t" (a) : "f" (b));
7437 @end smallexample
7438
7439 @item
7440 Some operands need to be in particular places on the stack.  All
7441 output operands fall in this category---GCC has no other way to
7442 know which registers the outputs appear in unless you indicate
7443 this in the constraints.
7444
7445 Output operands must specifically indicate which register an output
7446 appears in after an @code{asm}.  @samp{=f} is not allowed: the operand
7447 constraints must select a class with a single register.
7448
7449 @item
7450 Output operands may not be ``inserted'' between existing stack registers.
7451 Since no 387 opcode uses a read/write operand, all output operands
7452 are dead before the @code{asm}, and are pushed by the @code{asm}.
7453 It makes no sense to push anywhere but the top of the reg-stack.
7454
7455 Output operands must start at the top of the reg-stack: output
7456 operands may not ``skip'' a register.
7457
7458 @item
7459 Some @code{asm} statements may need extra stack space for internal
7460 calculations.  This can be guaranteed by clobbering stack registers
7461 unrelated to the inputs and outputs.
7462
7463 @end enumerate
7464
7465 This @code{asm}
7466 takes one input, which is internally popped, and produces two outputs.
7467
7468 @smallexample
7469 asm ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp));
7470 @end smallexample
7471
7472 @noindent
7473 This @code{asm} takes two inputs, which are popped by the @code{fyl2xp1} opcode,
7474 and replaces them with one output.  The @code{st(1)} clobber is necessary 
7475 for the compiler to know that @code{fyl2xp1} pops both inputs.
7476
7477 @smallexample
7478 asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)");
7479 @end smallexample
7480
7481 @lowersections
7482 @include md.texi
7483 @raisesections
7484
7485 @node Asm Labels
7486 @subsection Controlling Names Used in Assembler Code
7487 @cindex assembler names for identifiers
7488 @cindex names used in assembler code
7489 @cindex identifiers, names in assembler code
7490
7491 You can specify the name to be used in the assembler code for a C
7492 function or variable by writing the @code{asm} (or @code{__asm__})
7493 keyword after the declarator as follows:
7494
7495 @smallexample
7496 int foo asm ("myfoo") = 2;
7497 @end smallexample
7498
7499 @noindent
7500 This specifies that the name to be used for the variable @code{foo} in
7501 the assembler code should be @samp{myfoo} rather than the usual
7502 @samp{_foo}.
7503
7504 On systems where an underscore is normally prepended to the name of a C
7505 function or variable, this feature allows you to define names for the
7506 linker that do not start with an underscore.
7507
7508 It does not make sense to use this feature with a non-static local
7509 variable since such variables do not have assembler names.  If you are
7510 trying to put the variable in a particular register, see @ref{Explicit
7511 Reg Vars}.  GCC presently accepts such code with a warning, but will
7512 probably be changed to issue an error, rather than a warning, in the
7513 future.
7514
7515 You cannot use @code{asm} in this way in a function @emph{definition}; but
7516 you can get the same effect by writing a declaration for the function
7517 before its definition and putting @code{asm} there, like this:
7518
7519 @smallexample
7520 extern func () asm ("FUNC");
7521
7522 func (x, y)
7523      int x, y;
7524 /* @r{@dots{}} */
7525 @end smallexample
7526
7527 It is up to you to make sure that the assembler names you choose do not
7528 conflict with any other assembler symbols.  Also, you must not use a
7529 register name; that would produce completely invalid assembler code.  GCC
7530 does not as yet have the ability to store static variables in registers.
7531 Perhaps that will be added.
7532
7533 @node Explicit Reg Vars
7534 @subsection Variables in Specified Registers
7535 @cindex explicit register variables
7536 @cindex variables in specified registers
7537 @cindex specified registers
7538 @cindex registers, global allocation
7539
7540 GNU C allows you to put a few global variables into specified hardware
7541 registers.  You can also specify the register in which an ordinary
7542 register variable should be allocated.
7543
7544 @itemize @bullet
7545 @item
7546 Global register variables reserve registers throughout the program.
7547 This may be useful in programs such as programming language
7548 interpreters that have a couple of global variables that are accessed
7549 very often.
7550
7551 @item
7552 Local register variables in specific registers do not reserve the
7553 registers, except at the point where they are used as input or output
7554 operands in an @code{asm} statement and the @code{asm} statement itself is
7555 not deleted.  The compiler's data flow analysis is capable of determining
7556 where the specified registers contain live values, and where they are
7557 available for other uses.  Stores into local register variables may be deleted
7558 when they appear to be dead according to dataflow analysis.  References
7559 to local register variables may be deleted or moved or simplified.
7560
7561 These local variables are sometimes convenient for use with the extended
7562 @code{asm} feature (@pxref{Extended Asm}), if you want to write one
7563 output of the assembler instruction directly into a particular register.
7564 (This works provided the register you specify fits the constraints
7565 specified for that operand in the @code{asm}.)
7566 @end itemize
7567
7568 @menu
7569 * Global Reg Vars::
7570 * Local Reg Vars::
7571 @end menu
7572
7573 @node Global Reg Vars
7574 @subsubsection Defining Global Register Variables
7575 @cindex global register variables
7576 @cindex registers, global variables in
7577
7578 You can define a global register variable in GNU C like this:
7579
7580 @smallexample
7581 register int *foo asm ("a5");
7582 @end smallexample
7583
7584 @noindent
7585 Here @code{a5} is the name of the register that should be used.  Choose a
7586 register that is normally saved and restored by function calls on your
7587 machine, so that library routines will not clobber it.
7588
7589 Naturally the register name is CPU-dependent, so you need to
7590 conditionalize your program according to CPU type.  The register
7591 @code{a5} is a good choice on a 68000 for a variable of pointer
7592 type.  On machines with register windows, be sure to choose a ``global''
7593 register that is not affected magically by the function call mechanism.
7594
7595 In addition, different operating systems on the same CPU may differ in how they
7596 name the registers; then you need additional conditionals.  For
7597 example, some 68000 operating systems call this register @code{%a5}.
7598
7599 Eventually there may be a way of asking the compiler to choose a register
7600 automatically, but first we need to figure out how it should choose and
7601 how to enable you to guide the choice.  No solution is evident.
7602
7603 Defining a global register variable in a certain register reserves that
7604 register entirely for this use, at least within the current compilation.
7605 The register is not allocated for any other purpose in the functions
7606 in the current compilation, and is not saved and restored by
7607 these functions.  Stores into this register are never deleted even if they
7608 appear to be dead, but references may be deleted or moved or
7609 simplified.
7610
7611 It is not safe to access the global register variables from signal
7612 handlers, or from more than one thread of control, because the system
7613 library routines may temporarily use the register for other things (unless
7614 you recompile them specially for the task at hand).
7615
7616 @cindex @code{qsort}, and global register variables
7617 It is not safe for one function that uses a global register variable to
7618 call another such function @code{foo} by way of a third function
7619 @code{lose} that is compiled without knowledge of this variable (i.e.@: in a
7620 different source file in which the variable isn't declared).  This is
7621 because @code{lose} might save the register and put some other value there.
7622 For example, you can't expect a global register variable to be available in
7623 the comparison-function that you pass to @code{qsort}, since @code{qsort}
7624 might have put something else in that register.  (If you are prepared to
7625 recompile @code{qsort} with the same global register variable, you can
7626 solve this problem.)
7627
7628 If you want to recompile @code{qsort} or other source files that do not
7629 actually use your global register variable, so that they do not use that
7630 register for any other purpose, then it suffices to specify the compiler
7631 option @option{-ffixed-@var{reg}}.  You need not actually add a global
7632 register declaration to their source code.
7633
7634 A function that can alter the value of a global register variable cannot
7635 safely be called from a function compiled without this variable, because it
7636 could clobber the value the caller expects to find there on return.
7637 Therefore, the function that is the entry point into the part of the
7638 program that uses the global register variable must explicitly save and
7639 restore the value that belongs to its caller.
7640
7641 @cindex register variable after @code{longjmp}
7642 @cindex global register after @code{longjmp}
7643 @cindex value after @code{longjmp}
7644 @findex longjmp
7645 @findex setjmp
7646 On most machines, @code{longjmp} restores to each global register
7647 variable the value it had at the time of the @code{setjmp}.  On some
7648 machines, however, @code{longjmp} does not change the value of global
7649 register variables.  To be portable, the function that called @code{setjmp}
7650 should make other arrangements to save the values of the global register
7651 variables, and to restore them in a @code{longjmp}.  This way, the same
7652 thing happens regardless of what @code{longjmp} does.
7653
7654 All global register variable declarations must precede all function
7655 definitions.  If such a declaration could appear after function
7656 definitions, the declaration would be too late to prevent the register from
7657 being used for other purposes in the preceding functions.
7658
7659 Global register variables may not have initial values, because an
7660 executable file has no means to supply initial contents for a register.
7661
7662 On the SPARC, there are reports that g3 @dots{} g7 are suitable
7663 registers, but certain library functions, such as @code{getwd}, as well
7664 as the subroutines for division and remainder, modify g3 and g4.  g1 and
7665 g2 are local temporaries.
7666
7667 On the 68000, a2 @dots{} a5 should be suitable, as should d2 @dots{} d7.
7668 Of course, it does not do to use more than a few of those.
7669
7670 @node Local Reg Vars
7671 @subsubsection Specifying Registers for Local Variables
7672 @cindex local variables, specifying registers
7673 @cindex specifying registers for local variables
7674 @cindex registers for local variables
7675
7676 You can define a local register variable with a specified register
7677 like this:
7678
7679 @smallexample
7680 register int *foo asm ("a5");
7681 @end smallexample
7682
7683 @noindent
7684 Here @code{a5} is the name of the register that should be used.  Note
7685 that this is the same syntax used for defining global register
7686 variables, but for a local variable it appears within a function.
7687
7688 Naturally the register name is CPU-dependent, but this is not a
7689 problem, since specific registers are most often useful with explicit
7690 assembler instructions (@pxref{Extended Asm}).  Both of these things
7691 generally require that you conditionalize your program according to
7692 CPU type.
7693
7694 In addition, operating systems on one type of CPU may differ in how they
7695 name the registers; then you need additional conditionals.  For
7696 example, some 68000 operating systems call this register @code{%a5}.
7697
7698 Defining such a register variable does not reserve the register; it
7699 remains available for other uses in places where flow control determines
7700 the variable's value is not live.
7701
7702 This option does not guarantee that GCC generates code that has
7703 this variable in the register you specify at all times.  You may not
7704 code an explicit reference to this register in the assembler
7705 instruction template part of an @code{asm} statement and assume it
7706 always refers to this variable.
7707 However, using the variable as an input or output operand to the @code{asm}
7708 guarantees that the specified register is used for that operand.  
7709 @xref{Extended Asm}, for more information.
7710
7711 Stores into local register variables may be deleted when they appear to be dead
7712 according to dataflow analysis.  References to local register variables may
7713 be deleted or moved or simplified.
7714
7715 As with global register variables, it is recommended that you choose a
7716 register that is normally saved and restored by function calls on
7717 your machine, so that library routines will not clobber it.  
7718
7719 Sometimes when writing inline @code{asm} code, you need to make an operand be a 
7720 specific register, but there's no matching constraint letter for that 
7721 register. To force the operand into that register, create a local variable 
7722 and specify the register in the variable's declaration. Then use the local 
7723 variable for the asm operand and specify any constraint letter that matches 
7724 the register:
7725
7726 @smallexample
7727 register int *p1 asm ("r0") = @dots{};
7728 register int *p2 asm ("r1") = @dots{};
7729 register int *result asm ("r0");
7730 asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2));
7731 @end smallexample
7732
7733 @emph{Warning:} In the above example, be aware that a register (for example r0) can be 
7734 call-clobbered by subsequent code, including function calls and library calls 
7735 for arithmetic operators on other variables (for example the initialization 
7736 of p2). In this case, use temporary variables for expressions between the 
7737 register assignments:
7738
7739 @smallexample
7740 int t1 = @dots{};
7741 register int *p1 asm ("r0") = @dots{};
7742 register int *p2 asm ("r1") = t1;
7743 register int *result asm ("r0");
7744 asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2));
7745 @end smallexample
7746
7747 @node Size of an asm
7748 @subsection Size of an @code{asm}
7749
7750 Some targets require that GCC track the size of each instruction used
7751 in order to generate correct code.  Because the final length of the
7752 code produced by an @code{asm} statement is only known by the
7753 assembler, GCC must make an estimate as to how big it will be.  It
7754 does this by counting the number of instructions in the pattern of the
7755 @code{asm} and multiplying that by the length of the longest
7756 instruction supported by that processor.  (When working out the number
7757 of instructions, it assumes that any occurrence of a newline or of
7758 whatever statement separator character is supported by the assembler --
7759 typically @samp{;} --- indicates the end of an instruction.)
7760
7761 Normally, GCC's estimate is adequate to ensure that correct
7762 code is generated, but it is possible to confuse the compiler if you use
7763 pseudo instructions or assembler macros that expand into multiple real
7764 instructions, or if you use assembler directives that expand to more
7765 space in the object file than is needed for a single instruction.
7766 If this happens then the assembler may produce a diagnostic saying that
7767 a label is unreachable.
7768
7769 @node Alternate Keywords
7770 @section Alternate Keywords
7771 @cindex alternate keywords
7772 @cindex keywords, alternate
7773
7774 @option{-ansi} and the various @option{-std} options disable certain
7775 keywords.  This causes trouble when you want to use GNU C extensions, or
7776 a general-purpose header file that should be usable by all programs,
7777 including ISO C programs.  The keywords @code{asm}, @code{typeof} and
7778 @code{inline} are not available in programs compiled with
7779 @option{-ansi} or @option{-std} (although @code{inline} can be used in a
7780 program compiled with @option{-std=c99} or @option{-std=c11}).  The
7781 ISO C99 keyword
7782 @code{restrict} is only available when @option{-std=gnu99} (which will
7783 eventually be the default) or @option{-std=c99} (or the equivalent
7784 @option{-std=iso9899:1999}), or an option for a later standard
7785 version, is used.
7786
7787 The way to solve these problems is to put @samp{__} at the beginning and
7788 end of each problematical keyword.  For example, use @code{__asm__}
7789 instead of @code{asm}, and @code{__inline__} instead of @code{inline}.
7790
7791 Other C compilers won't accept these alternative keywords; if you want to
7792 compile with another compiler, you can define the alternate keywords as
7793 macros to replace them with the customary keywords.  It looks like this:
7794
7795 @smallexample
7796 #ifndef __GNUC__
7797 #define __asm__ asm
7798 #endif
7799 @end smallexample
7800
7801 @findex __extension__
7802 @opindex pedantic
7803 @option{-pedantic} and other options cause warnings for many GNU C extensions.
7804 You can
7805 prevent such warnings within one expression by writing
7806 @code{__extension__} before the expression.  @code{__extension__} has no
7807 effect aside from this.
7808
7809 @node Incomplete Enums
7810 @section Incomplete @code{enum} Types
7811
7812 You can define an @code{enum} tag without specifying its possible values.
7813 This results in an incomplete type, much like what you get if you write
7814 @code{struct foo} without describing the elements.  A later declaration
7815 that does specify the possible values completes the type.
7816
7817 You can't allocate variables or storage using the type while it is
7818 incomplete.  However, you can work with pointers to that type.
7819
7820 This extension may not be very useful, but it makes the handling of
7821 @code{enum} more consistent with the way @code{struct} and @code{union}
7822 are handled.
7823
7824 This extension is not supported by GNU C++.
7825
7826 @node Function Names
7827 @section Function Names as Strings
7828 @cindex @code{__func__} identifier
7829 @cindex @code{__FUNCTION__} identifier
7830 @cindex @code{__PRETTY_FUNCTION__} identifier
7831
7832 GCC provides three magic variables that hold the name of the current
7833 function, as a string.  The first of these is @code{__func__}, which
7834 is part of the C99 standard:
7835
7836 The identifier @code{__func__} is implicitly declared by the translator
7837 as if, immediately following the opening brace of each function
7838 definition, the declaration
7839
7840 @smallexample
7841 static const char __func__[] = "function-name";
7842 @end smallexample
7843
7844 @noindent
7845 appeared, where function-name is the name of the lexically-enclosing
7846 function.  This name is the unadorned name of the function.
7847
7848 @code{__FUNCTION__} is another name for @code{__func__}.  Older
7849 versions of GCC recognize only this name.  However, it is not
7850 standardized.  For maximum portability, we recommend you use
7851 @code{__func__}, but provide a fallback definition with the
7852 preprocessor:
7853
7854 @smallexample
7855 #if __STDC_VERSION__ < 199901L
7856 # if __GNUC__ >= 2
7857 #  define __func__ __FUNCTION__
7858 # else
7859 #  define __func__ "<unknown>"
7860 # endif
7861 #endif
7862 @end smallexample
7863
7864 In C, @code{__PRETTY_FUNCTION__} is yet another name for
7865 @code{__func__}.  However, in C++, @code{__PRETTY_FUNCTION__} contains
7866 the type signature of the function as well as its bare name.  For
7867 example, this program:
7868
7869 @smallexample
7870 extern "C" @{
7871 extern int printf (char *, ...);
7872 @}
7873
7874 class a @{
7875  public:
7876   void sub (int i)
7877     @{
7878       printf ("__FUNCTION__ = %s\n", __FUNCTION__);
7879       printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
7880     @}
7881 @};
7882
7883 int
7884 main (void)
7885 @{
7886   a ax;
7887   ax.sub (0);
7888   return 0;
7889 @}
7890 @end smallexample
7891
7892 @noindent
7893 gives this output:
7894
7895 @smallexample
7896 __FUNCTION__ = sub
7897 __PRETTY_FUNCTION__ = void a::sub(int)
7898 @end smallexample
7899
7900 These identifiers are not preprocessor macros.  In GCC 3.3 and
7901 earlier, in C only, @code{__FUNCTION__} and @code{__PRETTY_FUNCTION__}
7902 were treated as string literals; they could be used to initialize
7903 @code{char} arrays, and they could be concatenated with other string
7904 literals.  GCC 3.4 and later treat them as variables, like
7905 @code{__func__}.  In C++, @code{__FUNCTION__} and
7906 @code{__PRETTY_FUNCTION__} have always been variables.
7907
7908 @node Return Address
7909 @section Getting the Return or Frame Address of a Function
7910
7911 These functions may be used to get information about the callers of a
7912 function.
7913
7914 @deftypefn {Built-in Function} {void *} __builtin_return_address (unsigned int @var{level})
7915 This function returns the return address of the current function, or of
7916 one of its callers.  The @var{level} argument is number of frames to
7917 scan up the call stack.  A value of @code{0} yields the return address
7918 of the current function, a value of @code{1} yields the return address
7919 of the caller of the current function, and so forth.  When inlining
7920 the expected behavior is that the function returns the address of
7921 the function that is returned to.  To work around this behavior use
7922 the @code{noinline} function attribute.
7923
7924 The @var{level} argument must be a constant integer.
7925
7926 On some machines it may be impossible to determine the return address of
7927 any function other than the current one; in such cases, or when the top
7928 of the stack has been reached, this function returns @code{0} or a
7929 random value.  In addition, @code{__builtin_frame_address} may be used
7930 to determine if the top of the stack has been reached.
7931
7932 Additional post-processing of the returned value may be needed, see
7933 @code{__builtin_extract_return_addr}.
7934
7935 This function should only be used with a nonzero argument for debugging
7936 purposes.
7937 @end deftypefn
7938
7939 @deftypefn {Built-in Function} {void *} __builtin_extract_return_addr (void *@var{addr})
7940 The address as returned by @code{__builtin_return_address} may have to be fed
7941 through this function to get the actual encoded address.  For example, on the
7942 31-bit S/390 platform the highest bit has to be masked out, or on SPARC
7943 platforms an offset has to be added for the true next instruction to be
7944 executed.
7945
7946 If no fixup is needed, this function simply passes through @var{addr}.
7947 @end deftypefn
7948
7949 @deftypefn {Built-in Function} {void *} __builtin_frob_return_address (void *@var{addr})
7950 This function does the reverse of @code{__builtin_extract_return_addr}.
7951 @end deftypefn
7952
7953 @deftypefn {Built-in Function} {void *} __builtin_frame_address (unsigned int @var{level})
7954 This function is similar to @code{__builtin_return_address}, but it
7955 returns the address of the function frame rather than the return address
7956 of the function.  Calling @code{__builtin_frame_address} with a value of
7957 @code{0} yields the frame address of the current function, a value of
7958 @code{1} yields the frame address of the caller of the current function,
7959 and so forth.
7960
7961 The frame is the area on the stack that holds local variables and saved
7962 registers.  The frame address is normally the address of the first word
7963 pushed on to the stack by the function.  However, the exact definition
7964 depends upon the processor and the calling convention.  If the processor
7965 has a dedicated frame pointer register, and the function has a frame,
7966 then @code{__builtin_frame_address} returns the value of the frame
7967 pointer register.
7968
7969 On some machines it may be impossible to determine the frame address of
7970 any function other than the current one; in such cases, or when the top
7971 of the stack has been reached, this function returns @code{0} if
7972 the first frame pointer is properly initialized by the startup code.
7973
7974 This function should only be used with a nonzero argument for debugging
7975 purposes.
7976 @end deftypefn
7977
7978 @node Vector Extensions
7979 @section Using Vector Instructions through Built-in Functions
7980
7981 On some targets, the instruction set contains SIMD vector instructions which
7982 operate on multiple values contained in one large register at the same time.
7983 For example, on the x86 the MMX, 3DNow!@: and SSE extensions can be used
7984 this way.
7985
7986 The first step in using these extensions is to provide the necessary data
7987 types.  This should be done using an appropriate @code{typedef}:
7988
7989 @smallexample
7990 typedef int v4si __attribute__ ((vector_size (16)));
7991 @end smallexample
7992
7993 @noindent
7994 The @code{int} type specifies the base type, while the attribute specifies
7995 the vector size for the variable, measured in bytes.  For example, the
7996 declaration above causes the compiler to set the mode for the @code{v4si}
7997 type to be 16 bytes wide and divided into @code{int} sized units.  For
7998 a 32-bit @code{int} this means a vector of 4 units of 4 bytes, and the
7999 corresponding mode of @code{foo} is @acronym{V4SI}.
8000
8001 The @code{vector_size} attribute is only applicable to integral and
8002 float scalars, although arrays, pointers, and function return values
8003 are allowed in conjunction with this construct. Only sizes that are
8004 a power of two are currently allowed.
8005
8006 All the basic integer types can be used as base types, both as signed
8007 and as unsigned: @code{char}, @code{short}, @code{int}, @code{long},
8008 @code{long long}.  In addition, @code{float} and @code{double} can be
8009 used to build floating-point vector types.
8010
8011 Specifying a combination that is not valid for the current architecture
8012 causes GCC to synthesize the instructions using a narrower mode.
8013 For example, if you specify a variable of type @code{V4SI} and your
8014 architecture does not allow for this specific SIMD type, GCC
8015 produces code that uses 4 @code{SIs}.
8016
8017 The types defined in this manner can be used with a subset of normal C
8018 operations.  Currently, GCC allows using the following operators
8019 on these types: @code{+, -, *, /, unary minus, ^, |, &, ~, %}@.
8020
8021 The operations behave like C++ @code{valarrays}.  Addition is defined as
8022 the addition of the corresponding elements of the operands.  For
8023 example, in the code below, each of the 4 elements in @var{a} is
8024 added to the corresponding 4 elements in @var{b} and the resulting
8025 vector is stored in @var{c}.
8026
8027 @smallexample
8028 typedef int v4si __attribute__ ((vector_size (16)));
8029
8030 v4si a, b, c;
8031
8032 c = a + b;
8033 @end smallexample
8034
8035 Subtraction, multiplication, division, and the logical operations
8036 operate in a similar manner.  Likewise, the result of using the unary
8037 minus or complement operators on a vector type is a vector whose
8038 elements are the negative or complemented values of the corresponding
8039 elements in the operand.
8040
8041 It is possible to use shifting operators @code{<<}, @code{>>} on
8042 integer-type vectors. The operation is defined as following: @code{@{a0,
8043 a1, @dots{}, an@} >> @{b0, b1, @dots{}, bn@} == @{a0 >> b0, a1 >> b1,
8044 @dots{}, an >> bn@}}@. Vector operands must have the same number of
8045 elements. 
8046
8047 For convenience, it is allowed to use a binary vector operation
8048 where one operand is a scalar. In that case the compiler transforms
8049 the scalar operand into a vector where each element is the scalar from
8050 the operation. The transformation happens only if the scalar could be
8051 safely converted to the vector-element type.
8052 Consider the following code.
8053
8054 @smallexample
8055 typedef int v4si __attribute__ ((vector_size (16)));
8056
8057 v4si a, b, c;
8058 long l;
8059
8060 a = b + 1;    /* a = b + @{1,1,1,1@}; */
8061 a = 2 * b;    /* a = @{2,2,2,2@} * b; */
8062
8063 a = l + a;    /* Error, cannot convert long to int. */
8064 @end smallexample
8065
8066 Vectors can be subscripted as if the vector were an array with
8067 the same number of elements and base type.  Out of bound accesses
8068 invoke undefined behavior at run time.  Warnings for out of bound
8069 accesses for vector subscription can be enabled with
8070 @option{-Warray-bounds}.
8071
8072 Vector comparison is supported with standard comparison
8073 operators: @code{==, !=, <, <=, >, >=}. Comparison operands can be
8074 vector expressions of integer-type or real-type. Comparison between
8075 integer-type vectors and real-type vectors are not supported.  The
8076 result of the comparison is a vector of the same width and number of
8077 elements as the comparison operands with a signed integral element
8078 type.
8079
8080 Vectors are compared element-wise producing 0 when comparison is false
8081 and -1 (constant of the appropriate type where all bits are set)
8082 otherwise. Consider the following example.
8083
8084 @smallexample
8085 typedef int v4si __attribute__ ((vector_size (16)));
8086
8087 v4si a = @{1,2,3,4@};
8088 v4si b = @{3,2,1,4@};
8089 v4si c;
8090
8091 c = a >  b;     /* The result would be @{0, 0,-1, 0@}  */
8092 c = a == b;     /* The result would be @{0,-1, 0,-1@}  */
8093 @end smallexample
8094
8095 In C++, the ternary operator @code{?:} is available. @code{a?b:c}, where
8096 @code{b} and @code{c} are vectors of the same type and @code{a} is an
8097 integer vector with the same number of elements of the same size as @code{b}
8098 and @code{c}, computes all three arguments and creates a vector
8099 @code{@{a[0]?b[0]:c[0], a[1]?b[1]:c[1], @dots{}@}}.  Note that unlike in
8100 OpenCL, @code{a} is thus interpreted as @code{a != 0} and not @code{a < 0}.
8101 As in the case of binary operations, this syntax is also accepted when
8102 one of @code{b} or @code{c} is a scalar that is then transformed into a
8103 vector. If both @code{b} and @code{c} are scalars and the type of
8104 @code{true?b:c} has the same size as the element type of @code{a}, then
8105 @code{b} and @code{c} are converted to a vector type whose elements have
8106 this type and with the same number of elements as @code{a}.
8107
8108 In C++, the logic operators @code{!, &&, ||} are available for vectors.
8109 @code{!v} is equivalent to @code{v == 0}, @code{a && b} is equivalent to
8110 @code{a!=0 & b!=0} and @code{a || b} is equivalent to @code{a!=0 | b!=0}.
8111 For mixed operations between a scalar @code{s} and a vector @code{v},
8112 @code{s && v} is equivalent to @code{s?v!=0:0} (the evaluation is
8113 short-circuit) and @code{v && s} is equivalent to @code{v!=0 & (s?-1:0)}.
8114
8115 Vector shuffling is available using functions
8116 @code{__builtin_shuffle (vec, mask)} and
8117 @code{__builtin_shuffle (vec0, vec1, mask)}.
8118 Both functions construct a permutation of elements from one or two
8119 vectors and return a vector of the same type as the input vector(s).
8120 The @var{mask} is an integral vector with the same width (@var{W})
8121 and element count (@var{N}) as the output vector.
8122
8123 The elements of the input vectors are numbered in memory ordering of
8124 @var{vec0} beginning at 0 and @var{vec1} beginning at @var{N}.  The
8125 elements of @var{mask} are considered modulo @var{N} in the single-operand
8126 case and modulo @math{2*@var{N}} in the two-operand case.
8127
8128 Consider the following example,
8129
8130 @smallexample
8131 typedef int v4si __attribute__ ((vector_size (16)));
8132
8133 v4si a = @{1,2,3,4@};
8134 v4si b = @{5,6,7,8@};
8135 v4si mask1 = @{0,1,1,3@};
8136 v4si mask2 = @{0,4,2,5@};
8137 v4si res;
8138
8139 res = __builtin_shuffle (a, mask1);       /* res is @{1,2,2,4@}  */
8140 res = __builtin_shuffle (a, b, mask2);    /* res is @{1,5,3,6@}  */
8141 @end smallexample
8142
8143 Note that @code{__builtin_shuffle} is intentionally semantically
8144 compatible with the OpenCL @code{shuffle} and @code{shuffle2} functions.
8145
8146 You can declare variables and use them in function calls and returns, as
8147 well as in assignments and some casts.  You can specify a vector type as
8148 a return type for a function.  Vector types can also be used as function
8149 arguments.  It is possible to cast from one vector type to another,
8150 provided they are of the same size (in fact, you can also cast vectors
8151 to and from other datatypes of the same size).
8152
8153 You cannot operate between vectors of different lengths or different
8154 signedness without a cast.
8155
8156 @node Offsetof
8157 @section Offsetof
8158 @findex __builtin_offsetof
8159
8160 GCC implements for both C and C++ a syntactic extension to implement
8161 the @code{offsetof} macro.
8162
8163 @smallexample
8164 primary:
8165         "__builtin_offsetof" "(" @code{typename} "," offsetof_member_designator ")"
8166
8167 offsetof_member_designator:
8168           @code{identifier}
8169         | offsetof_member_designator "." @code{identifier}
8170         | offsetof_member_designator "[" @code{expr} "]"
8171 @end smallexample
8172
8173 This extension is sufficient such that
8174
8175 @smallexample
8176 #define offsetof(@var{type}, @var{member})  __builtin_offsetof (@var{type}, @var{member})
8177 @end smallexample
8178
8179 @noindent
8180 is a suitable definition of the @code{offsetof} macro.  In C++, @var{type}
8181 may be dependent.  In either case, @var{member} may consist of a single
8182 identifier, or a sequence of member accesses and array references.
8183
8184 @node __sync Builtins
8185 @section Legacy __sync Built-in Functions for Atomic Memory Access
8186
8187 The following built-in functions
8188 are intended to be compatible with those described
8189 in the @cite{Intel Itanium Processor-specific Application Binary Interface},
8190 section 7.4.  As such, they depart from the normal GCC practice of using
8191 the @samp{__builtin_} prefix, and further that they are overloaded such that
8192 they work on multiple types.
8193
8194 The definition given in the Intel documentation allows only for the use of
8195 the types @code{int}, @code{long}, @code{long long} as well as their unsigned
8196 counterparts.  GCC allows any integral scalar or pointer type that is
8197 1, 2, 4 or 8 bytes in length.
8198
8199 Not all operations are supported by all target processors.  If a particular
8200 operation cannot be implemented on the target processor, a warning is
8201 generated and a call an external function is generated.  The external
8202 function carries the same name as the built-in version,
8203 with an additional suffix
8204 @samp{_@var{n}} where @var{n} is the size of the data type.
8205
8206 @c ??? Should we have a mechanism to suppress this warning?  This is almost
8207 @c useful for implementing the operation under the control of an external
8208 @c mutex.
8209
8210 In most cases, these built-in functions are considered a @dfn{full barrier}.
8211 That is,
8212 no memory operand is moved across the operation, either forward or
8213 backward.  Further, instructions are issued as necessary to prevent the
8214 processor from speculating loads across the operation and from queuing stores
8215 after the operation.
8216
8217 All of the routines are described in the Intel documentation to take
8218 ``an optional list of variables protected by the memory barrier''.  It's
8219 not clear what is meant by that; it could mean that @emph{only} the
8220 following variables are protected, or it could mean that these variables
8221 should in addition be protected.  At present GCC ignores this list and
8222 protects all variables that are globally accessible.  If in the future
8223 we make some use of this list, an empty list will continue to mean all
8224 globally accessible variables.
8225
8226 @table @code
8227 @item @var{type} __sync_fetch_and_add (@var{type} *ptr, @var{type} value, ...)
8228 @itemx @var{type} __sync_fetch_and_sub (@var{type} *ptr, @var{type} value, ...)
8229 @itemx @var{type} __sync_fetch_and_or (@var{type} *ptr, @var{type} value, ...)
8230 @itemx @var{type} __sync_fetch_and_and (@var{type} *ptr, @var{type} value, ...)
8231 @itemx @var{type} __sync_fetch_and_xor (@var{type} *ptr, @var{type} value, ...)
8232 @itemx @var{type} __sync_fetch_and_nand (@var{type} *ptr, @var{type} value, ...)
8233 @findex __sync_fetch_and_add
8234 @findex __sync_fetch_and_sub
8235 @findex __sync_fetch_and_or
8236 @findex __sync_fetch_and_and
8237 @findex __sync_fetch_and_xor
8238 @findex __sync_fetch_and_nand
8239 These built-in functions perform the operation suggested by the name, and
8240 returns the value that had previously been in memory.  That is,
8241
8242 @smallexample
8243 @{ tmp = *ptr; *ptr @var{op}= value; return tmp; @}
8244 @{ tmp = *ptr; *ptr = ~(tmp & value); return tmp; @}   // nand
8245 @end smallexample
8246
8247 @emph{Note:} GCC 4.4 and later implement @code{__sync_fetch_and_nand}
8248 as @code{*ptr = ~(tmp & value)} instead of @code{*ptr = ~tmp & value}.
8249
8250 @item @var{type} __sync_add_and_fetch (@var{type} *ptr, @var{type} value, ...)
8251 @itemx @var{type} __sync_sub_and_fetch (@var{type} *ptr, @var{type} value, ...)
8252 @itemx @var{type} __sync_or_and_fetch (@var{type} *ptr, @var{type} value, ...)
8253 @itemx @var{type} __sync_and_and_fetch (@var{type} *ptr, @var{type} value, ...)
8254 @itemx @var{type} __sync_xor_and_fetch (@var{type} *ptr, @var{type} value, ...)
8255 @itemx @var{type} __sync_nand_and_fetch (@var{type} *ptr, @var{type} value, ...)
8256 @findex __sync_add_and_fetch
8257 @findex __sync_sub_and_fetch
8258 @findex __sync_or_and_fetch
8259 @findex __sync_and_and_fetch
8260 @findex __sync_xor_and_fetch
8261 @findex __sync_nand_and_fetch
8262 These built-in functions perform the operation suggested by the name, and
8263 return the new value.  That is,
8264
8265 @smallexample
8266 @{ *ptr @var{op}= value; return *ptr; @}
8267 @{ *ptr = ~(*ptr & value); return *ptr; @}   // nand
8268 @end smallexample
8269
8270 @emph{Note:} GCC 4.4 and later implement @code{__sync_nand_and_fetch}
8271 as @code{*ptr = ~(*ptr & value)} instead of
8272 @code{*ptr = ~*ptr & value}.
8273
8274 @item bool __sync_bool_compare_and_swap (@var{type} *ptr, @var{type} oldval, @var{type} newval, ...)
8275 @itemx @var{type} __sync_val_compare_and_swap (@var{type} *ptr, @var{type} oldval, @var{type} newval, ...)
8276 @findex __sync_bool_compare_and_swap
8277 @findex __sync_val_compare_and_swap
8278 These built-in functions perform an atomic compare and swap.
8279 That is, if the current
8280 value of @code{*@var{ptr}} is @var{oldval}, then write @var{newval} into
8281 @code{*@var{ptr}}.
8282
8283 The ``bool'' version returns true if the comparison is successful and
8284 @var{newval} is written.  The ``val'' version returns the contents
8285 of @code{*@var{ptr}} before the operation.
8286
8287 @item __sync_synchronize (...)
8288 @findex __sync_synchronize
8289 This built-in function issues a full memory barrier.
8290
8291 @item @var{type} __sync_lock_test_and_set (@var{type} *ptr, @var{type} value, ...)
8292 @findex __sync_lock_test_and_set
8293 This built-in function, as described by Intel, is not a traditional test-and-set
8294 operation, but rather an atomic exchange operation.  It writes @var{value}
8295 into @code{*@var{ptr}}, and returns the previous contents of
8296 @code{*@var{ptr}}.
8297
8298 Many targets have only minimal support for such locks, and do not support
8299 a full exchange operation.  In this case, a target may support reduced
8300 functionality here by which the @emph{only} valid value to store is the
8301 immediate constant 1.  The exact value actually stored in @code{*@var{ptr}}
8302 is implementation defined.
8303
8304 This built-in function is not a full barrier,
8305 but rather an @dfn{acquire barrier}.
8306 This means that references after the operation cannot move to (or be
8307 speculated to) before the operation, but previous memory stores may not
8308 be globally visible yet, and previous memory loads may not yet be
8309 satisfied.
8310
8311 @item void __sync_lock_release (@var{type} *ptr, ...)
8312 @findex __sync_lock_release
8313 This built-in function releases the lock acquired by
8314 @code{__sync_lock_test_and_set}.
8315 Normally this means writing the constant 0 to @code{*@var{ptr}}.
8316
8317 This built-in function is not a full barrier,
8318 but rather a @dfn{release barrier}.
8319 This means that all previous memory stores are globally visible, and all
8320 previous memory loads have been satisfied, but following memory reads
8321 are not prevented from being speculated to before the barrier.
8322 @end table
8323
8324 @node __atomic Builtins
8325 @section Built-in functions for memory model aware atomic operations
8326
8327 The following built-in functions approximately match the requirements for
8328 C++11 memory model. Many are similar to the @samp{__sync} prefixed built-in
8329 functions, but all also have a memory model parameter.  These are all
8330 identified by being prefixed with @samp{__atomic}, and most are overloaded
8331 such that they work with multiple types.
8332
8333 GCC allows any integral scalar or pointer type that is 1, 2, 4, or 8
8334 bytes in length. 16-byte integral types are also allowed if
8335 @samp{__int128} (@pxref{__int128}) is supported by the architecture.
8336
8337 Target architectures are encouraged to provide their own patterns for
8338 each of these built-in functions.  If no target is provided, the original 
8339 non-memory model set of @samp{__sync} atomic built-in functions are
8340 utilized, along with any required synchronization fences surrounding it in
8341 order to achieve the proper behavior.  Execution in this case is subject
8342 to the same restrictions as those built-in functions.
8343
8344 If there is no pattern or mechanism to provide a lock free instruction
8345 sequence, a call is made to an external routine with the same parameters
8346 to be resolved at run time.
8347
8348 The four non-arithmetic functions (load, store, exchange, and 
8349 compare_exchange) all have a generic version as well.  This generic
8350 version works on any data type.  If the data type size maps to one
8351 of the integral sizes that may have lock free support, the generic
8352 version utilizes the lock free built-in function.  Otherwise an
8353 external call is left to be resolved at run time.  This external call is
8354 the same format with the addition of a @samp{size_t} parameter inserted
8355 as the first parameter indicating the size of the object being pointed to.
8356 All objects must be the same size.
8357
8358 There are 6 different memory models that can be specified.  These map
8359 to the same names in the C++11 standard.  Refer there or to the
8360 @uref{http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync,GCC wiki on
8361 atomic synchronization} for more detailed definitions.  These memory
8362 models integrate both barriers to code motion as well as synchronization
8363 requirements with other threads. These are listed in approximately
8364 ascending order of strength. It is also possible to use target specific
8365 flags for memory model flags, like Hardware Lock Elision.
8366
8367 @table  @code
8368 @item __ATOMIC_RELAXED
8369 No barriers or synchronization.
8370 @item __ATOMIC_CONSUME
8371 Data dependency only for both barrier and synchronization with another
8372 thread.
8373 @item __ATOMIC_ACQUIRE
8374 Barrier to hoisting of code and synchronizes with release (or stronger)
8375 semantic stores from another thread.
8376 @item __ATOMIC_RELEASE
8377 Barrier to sinking of code and synchronizes with acquire (or stronger)
8378 semantic loads from another thread.
8379 @item __ATOMIC_ACQ_REL
8380 Full barrier in both directions and synchronizes with acquire loads and
8381 release stores in another thread.
8382 @item __ATOMIC_SEQ_CST
8383 Full barrier in both directions and synchronizes with acquire loads and
8384 release stores in all threads.
8385 @end table
8386
8387 When implementing patterns for these built-in functions, the memory model
8388 parameter can be ignored as long as the pattern implements the most
8389 restrictive @code{__ATOMIC_SEQ_CST} model.  Any of the other memory models
8390 execute correctly with this memory model but they may not execute as
8391 efficiently as they could with a more appropriate implementation of the
8392 relaxed requirements.
8393
8394 Note that the C++11 standard allows for the memory model parameter to be
8395 determined at run time rather than at compile time.  These built-in
8396 functions map any run-time value to @code{__ATOMIC_SEQ_CST} rather
8397 than invoke a runtime library call or inline a switch statement.  This is
8398 standard compliant, safe, and the simplest approach for now.
8399
8400 The memory model parameter is a signed int, but only the lower 8 bits are
8401 reserved for the memory model.  The remainder of the signed int is reserved
8402 for future use and should be 0.  Use of the predefined atomic values
8403 ensures proper usage.
8404
8405 @deftypefn {Built-in Function} @var{type} __atomic_load_n (@var{type} *ptr, int memmodel)
8406 This built-in function implements an atomic load operation.  It returns the
8407 contents of @code{*@var{ptr}}.
8408
8409 The valid memory model variants are
8410 @code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, @code{__ATOMIC_ACQUIRE},
8411 and @code{__ATOMIC_CONSUME}.
8412
8413 @end deftypefn
8414
8415 @deftypefn {Built-in Function} void __atomic_load (@var{type} *ptr, @var{type} *ret, int memmodel)
8416 This is the generic version of an atomic load.  It returns the
8417 contents of @code{*@var{ptr}} in @code{*@var{ret}}.
8418
8419 @end deftypefn
8420
8421 @deftypefn {Built-in Function} void __atomic_store_n (@var{type} *ptr, @var{type} val, int memmodel)
8422 This built-in function implements an atomic store operation.  It writes 
8423 @code{@var{val}} into @code{*@var{ptr}}.  
8424
8425 The valid memory model variants are
8426 @code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, and @code{__ATOMIC_RELEASE}.
8427
8428 @end deftypefn
8429
8430 @deftypefn {Built-in Function} void __atomic_store (@var{type} *ptr, @var{type} *val, int memmodel)
8431 This is the generic version of an atomic store.  It stores the value
8432 of @code{*@var{val}} into @code{*@var{ptr}}.
8433
8434 @end deftypefn
8435
8436 @deftypefn {Built-in Function} @var{type} __atomic_exchange_n (@var{type} *ptr, @var{type} val, int memmodel)
8437 This built-in function implements an atomic exchange operation.  It writes
8438 @var{val} into @code{*@var{ptr}}, and returns the previous contents of
8439 @code{*@var{ptr}}.
8440
8441 The valid memory model variants are
8442 @code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, @code{__ATOMIC_ACQUIRE},
8443 @code{__ATOMIC_RELEASE}, and @code{__ATOMIC_ACQ_REL}.
8444
8445 @end deftypefn
8446
8447 @deftypefn {Built-in Function} void __atomic_exchange (@var{type} *ptr, @var{type} *val, @var{type} *ret, int memmodel)
8448 This is the generic version of an atomic exchange.  It stores the
8449 contents of @code{*@var{val}} into @code{*@var{ptr}}. The original value
8450 of @code{*@var{ptr}} is copied into @code{*@var{ret}}.
8451
8452 @end deftypefn
8453
8454 @deftypefn {Built-in Function} bool __atomic_compare_exchange_n (@var{type} *ptr, @var{type} *expected, @var{type} desired, bool weak, int success_memmodel, int failure_memmodel)
8455 This built-in function implements an atomic compare and exchange operation.
8456 This compares the contents of @code{*@var{ptr}} with the contents of
8457 @code{*@var{expected}} and if equal, writes @var{desired} into
8458 @code{*@var{ptr}}.  If they are not equal, the current contents of
8459 @code{*@var{ptr}} is written into @code{*@var{expected}}.  @var{weak} is true
8460 for weak compare_exchange, and false for the strong variation.  Many targets 
8461 only offer the strong variation and ignore the parameter.  When in doubt, use
8462 the strong variation.
8463
8464 True is returned if @var{desired} is written into
8465 @code{*@var{ptr}} and the execution is considered to conform to the
8466 memory model specified by @var{success_memmodel}.  There are no
8467 restrictions on what memory model can be used here.
8468
8469 False is returned otherwise, and the execution is considered to conform
8470 to @var{failure_memmodel}. This memory model cannot be
8471 @code{__ATOMIC_RELEASE} nor @code{__ATOMIC_ACQ_REL}.  It also cannot be a
8472 stronger model than that specified by @var{success_memmodel}.
8473
8474 @end deftypefn
8475
8476 @deftypefn {Built-in Function} bool __atomic_compare_exchange (@var{type} *ptr, @var{type} *expected, @var{type} *desired, bool weak, int success_memmodel, int failure_memmodel)
8477 This built-in function implements the generic version of
8478 @code{__atomic_compare_exchange}.  The function is virtually identical to
8479 @code{__atomic_compare_exchange_n}, except the desired value is also a
8480 pointer.
8481
8482 @end deftypefn
8483
8484 @deftypefn {Built-in Function} @var{type} __atomic_add_fetch (@var{type} *ptr, @var{type} val, int memmodel)
8485 @deftypefnx {Built-in Function} @var{type} __atomic_sub_fetch (@var{type} *ptr, @var{type} val, int memmodel)
8486 @deftypefnx {Built-in Function} @var{type} __atomic_and_fetch (@var{type} *ptr, @var{type} val, int memmodel)
8487 @deftypefnx {Built-in Function} @var{type} __atomic_xor_fetch (@var{type} *ptr, @var{type} val, int memmodel)
8488 @deftypefnx {Built-in Function} @var{type} __atomic_or_fetch (@var{type} *ptr, @var{type} val, int memmodel)
8489 @deftypefnx {Built-in Function} @var{type} __atomic_nand_fetch (@var{type} *ptr, @var{type} val, int memmodel)
8490 These built-in functions perform the operation suggested by the name, and
8491 return the result of the operation. That is,
8492
8493 @smallexample
8494 @{ *ptr @var{op}= val; return *ptr; @}
8495 @end smallexample
8496
8497 All memory models are valid.
8498
8499 @end deftypefn
8500
8501 @deftypefn {Built-in Function} @var{type} __atomic_fetch_add (@var{type} *ptr, @var{type} val, int memmodel)
8502 @deftypefnx {Built-in Function} @var{type} __atomic_fetch_sub (@var{type} *ptr, @var{type} val, int memmodel)
8503 @deftypefnx {Built-in Function} @var{type} __atomic_fetch_and (@var{type} *ptr, @var{type} val, int memmodel)
8504 @deftypefnx {Built-in Function} @var{type} __atomic_fetch_xor (@var{type} *ptr, @var{type} val, int memmodel)
8505 @deftypefnx {Built-in Function} @var{type} __atomic_fetch_or (@var{type} *ptr, @var{type} val, int memmodel)
8506 @deftypefnx {Built-in Function} @var{type} __atomic_fetch_nand (@var{type} *ptr, @var{type} val, int memmodel)
8507 These built-in functions perform the operation suggested by the name, and
8508 return the value that had previously been in @code{*@var{ptr}}.  That is,
8509
8510 @smallexample
8511 @{ tmp = *ptr; *ptr @var{op}= val; return tmp; @}
8512 @end smallexample
8513
8514 All memory models are valid.
8515
8516 @end deftypefn
8517
8518 @deftypefn {Built-in Function} bool __atomic_test_and_set (void *ptr, int memmodel)
8519
8520 This built-in function performs an atomic test-and-set operation on
8521 the byte at @code{*@var{ptr}}.  The byte is set to some implementation
8522 defined nonzero ``set'' value and the return value is @code{true} if and only
8523 if the previous contents were ``set''.
8524 It should be only used for operands of type @code{bool} or @code{char}. For 
8525 other types only part of the value may be set.
8526
8527 All memory models are valid.
8528
8529 @end deftypefn
8530
8531 @deftypefn {Built-in Function} void __atomic_clear (bool *ptr, int memmodel)
8532
8533 This built-in function performs an atomic clear operation on
8534 @code{*@var{ptr}}.  After the operation, @code{*@var{ptr}} contains 0.
8535 It should be only used for operands of type @code{bool} or @code{char} and 
8536 in conjunction with @code{__atomic_test_and_set}.
8537 For other types it may only clear partially. If the type is not @code{bool}
8538 prefer using @code{__atomic_store}.
8539
8540 The valid memory model variants are
8541 @code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, and
8542 @code{__ATOMIC_RELEASE}.
8543
8544 @end deftypefn
8545
8546 @deftypefn {Built-in Function} void __atomic_thread_fence (int memmodel)
8547
8548 This built-in function acts as a synchronization fence between threads
8549 based on the specified memory model.
8550
8551 All memory orders are valid.
8552
8553 @end deftypefn
8554
8555 @deftypefn {Built-in Function} void __atomic_signal_fence (int memmodel)
8556
8557 This built-in function acts as a synchronization fence between a thread
8558 and signal handlers based in the same thread.
8559
8560 All memory orders are valid.
8561
8562 @end deftypefn
8563
8564 @deftypefn {Built-in Function} bool __atomic_always_lock_free (size_t size,  void *ptr)
8565
8566 This built-in function returns true if objects of @var{size} bytes always
8567 generate lock free atomic instructions for the target architecture.  
8568 @var{size} must resolve to a compile-time constant and the result also
8569 resolves to a compile-time constant.
8570
8571 @var{ptr} is an optional pointer to the object that may be used to determine
8572 alignment.  A value of 0 indicates typical alignment should be used.  The 
8573 compiler may also ignore this parameter.
8574
8575 @smallexample
8576 if (_atomic_always_lock_free (sizeof (long long), 0))
8577 @end smallexample
8578
8579 @end deftypefn
8580
8581 @deftypefn {Built-in Function} bool __atomic_is_lock_free (size_t size, void *ptr)
8582
8583 This built-in function returns true if objects of @var{size} bytes always
8584 generate lock free atomic instructions for the target architecture.  If
8585 it is not known to be lock free a call is made to a runtime routine named
8586 @code{__atomic_is_lock_free}.
8587
8588 @var{ptr} is an optional pointer to the object that may be used to determine
8589 alignment.  A value of 0 indicates typical alignment should be used.  The 
8590 compiler may also ignore this parameter.
8591 @end deftypefn
8592
8593 @node Integer Overflow Builtins
8594 @section Built-in functions to perform arithmetics and arithmetic overflow checking.
8595
8596 The following built-in functions allow performing simple arithmetic operations
8597 together with checking whether the operations overflowed.
8598
8599 @deftypefn {Built-in Function} bool __builtin_add_overflow (@var{type1} a, @var{type2} b, @var{type3} *res)
8600 @deftypefnx {Built-in Function} bool __builtin_sadd_overflow (int a, int b, int *res)
8601 @deftypefnx {Built-in Function} bool __builtin_saddl_overflow (long int a, long int b, long int *res)
8602 @deftypefnx {Built-in Function} bool __builtin_saddll_overflow (long long int a, long long int b, long int *res)
8603 @deftypefnx {Built-in Function} bool __builtin_uadd_overflow (unsigned int a, unsigned int b, unsigned int *res)
8604 @deftypefnx {Built-in Function} bool __builtin_uaddl_overflow (unsigned long int a, unsigned long int b, unsigned long int *res)
8605 @deftypefnx {Built-in Function} bool __builtin_uaddll_overflow (unsigned long long int a, unsigned long long int b, unsigned long int *res)
8606
8607 These built-in functions promote the first two operands into infinite precision signed
8608 type and perform addition on those promoted operands.  The result is then
8609 cast to the type the third pointer argument points to and stored there.
8610 If the stored result is equal to the infinite precision result, the built-in
8611 functions return false, otherwise they return true.  As the addition is
8612 performed in infinite signed precision, these built-in functions have fully defined
8613 behavior for all argument values.
8614
8615 The first built-in function allows arbitrary integral types for operands and
8616 the result type must be pointer to some integer type, the rest of the built-in
8617 functions have explicit integer types.
8618
8619 The compiler will attempt to use hardware instructions to implement
8620 these built-in functions where possible, like conditional jump on overflow
8621 after addition, conditional jump on carry etc.
8622
8623 @end deftypefn
8624
8625 @deftypefn {Built-in Function} bool __builtin_sub_overflow (@var{type1} a, @var{type2} b, @var{type3} *res)
8626 @deftypefnx {Built-in Function} bool __builtin_ssub_overflow (int a, int b, int *res)
8627 @deftypefnx {Built-in Function} bool __builtin_ssubl_overflow (long int a, long int b, long int *res)
8628 @deftypefnx {Built-in Function} bool __builtin_ssubll_overflow (long long int a, long long int b, long int *res)
8629 @deftypefnx {Built-in Function} bool __builtin_usub_overflow (unsigned int a, unsigned int b, unsigned int *res)
8630 @deftypefnx {Built-in Function} bool __builtin_usubl_overflow (unsigned long int a, unsigned long int b, unsigned long int *res)
8631 @deftypefnx {Built-in Function} bool __builtin_usubll_overflow (unsigned long long int a, unsigned long long int b, unsigned long int *res)
8632
8633 These built-in functions are similar to the add overflow checking built-in
8634 functions above, except they perform subtraction, subtract the second argument
8635 from the first one, instead of addition.
8636
8637 @end deftypefn
8638
8639 @deftypefn {Built-in Function} bool __builtin_mul_overflow (@var{type1} a, @var{type2} b, @var{type3} *res)
8640 @deftypefnx {Built-in Function} bool __builtin_smul_overflow (int a, int b, int *res)
8641 @deftypefnx {Built-in Function} bool __builtin_smull_overflow (long int a, long int b, long int *res)
8642 @deftypefnx {Built-in Function} bool __builtin_smulll_overflow (long long int a, long long int b, long int *res)
8643 @deftypefnx {Built-in Function} bool __builtin_umul_overflow (unsigned int a, unsigned int b, unsigned int *res)
8644 @deftypefnx {Built-in Function} bool __builtin_umull_overflow (unsigned long int a, unsigned long int b, unsigned long int *res)
8645 @deftypefnx {Built-in Function} bool __builtin_umulll_overflow (unsigned long long int a, unsigned long long int b, unsigned long int *res)
8646
8647 These built-in functions are similar to the add overflow checking built-in
8648 functions above, except they perform multiplication, instead of addition.
8649
8650 @end deftypefn
8651
8652 @node x86 specific memory model extensions for transactional memory
8653 @section x86 specific memory model extensions for transactional memory
8654
8655 The x86 architecture supports additional memory ordering flags
8656 to mark lock critical sections for hardware lock elision. 
8657 These must be specified in addition to an existing memory model to 
8658 atomic intrinsics.
8659
8660 @table @code
8661 @item __ATOMIC_HLE_ACQUIRE
8662 Start lock elision on a lock variable.
8663 Memory model must be @code{__ATOMIC_ACQUIRE} or stronger.
8664 @item __ATOMIC_HLE_RELEASE
8665 End lock elision on a lock variable.
8666 Memory model must be @code{__ATOMIC_RELEASE} or stronger.
8667 @end table
8668
8669 When a lock acquire fails it is required for good performance to abort
8670 the transaction quickly. This can be done with a @code{_mm_pause}
8671
8672 @smallexample
8673 #include <immintrin.h> // For _mm_pause
8674
8675 int lockvar;
8676
8677 /* Acquire lock with lock elision */
8678 while (__atomic_exchange_n(&lockvar, 1, __ATOMIC_ACQUIRE|__ATOMIC_HLE_ACQUIRE))
8679     _mm_pause(); /* Abort failed transaction */
8680 ...
8681 /* Free lock with lock elision */
8682 __atomic_store_n(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE);
8683 @end smallexample
8684
8685 @node Object Size Checking
8686 @section Object Size Checking Built-in Functions
8687 @findex __builtin_object_size
8688 @findex __builtin___memcpy_chk
8689 @findex __builtin___mempcpy_chk
8690 @findex __builtin___memmove_chk
8691 @findex __builtin___memset_chk
8692 @findex __builtin___strcpy_chk
8693 @findex __builtin___stpcpy_chk
8694 @findex __builtin___strncpy_chk
8695 @findex __builtin___strcat_chk
8696 @findex __builtin___strncat_chk
8697 @findex __builtin___sprintf_chk
8698 @findex __builtin___snprintf_chk
8699 @findex __builtin___vsprintf_chk
8700 @findex __builtin___vsnprintf_chk
8701 @findex __builtin___printf_chk
8702 @findex __builtin___vprintf_chk
8703 @findex __builtin___fprintf_chk
8704 @findex __builtin___vfprintf_chk
8705
8706 GCC implements a limited buffer overflow protection mechanism
8707 that can prevent some buffer overflow attacks.
8708
8709 @deftypefn {Built-in Function} {size_t} __builtin_object_size (void * @var{ptr}, int @var{type})
8710 is a built-in construct that returns a constant number of bytes from
8711 @var{ptr} to the end of the object @var{ptr} pointer points to
8712 (if known at compile time).  @code{__builtin_object_size} never evaluates
8713 its arguments for side-effects.  If there are any side-effects in them, it
8714 returns @code{(size_t) -1} for @var{type} 0 or 1 and @code{(size_t) 0}
8715 for @var{type} 2 or 3.  If there are multiple objects @var{ptr} can
8716 point to and all of them are known at compile time, the returned number
8717 is the maximum of remaining byte counts in those objects if @var{type} & 2 is
8718 0 and minimum if nonzero.  If it is not possible to determine which objects
8719 @var{ptr} points to at compile time, @code{__builtin_object_size} should
8720 return @code{(size_t) -1} for @var{type} 0 or 1 and @code{(size_t) 0}
8721 for @var{type} 2 or 3.
8722
8723 @var{type} is an integer constant from 0 to 3.  If the least significant
8724 bit is clear, objects are whole variables, if it is set, a closest
8725 surrounding subobject is considered the object a pointer points to.
8726 The second bit determines if maximum or minimum of remaining bytes
8727 is computed.
8728
8729 @smallexample
8730 struct V @{ char buf1[10]; int b; char buf2[10]; @} var;
8731 char *p = &var.buf1[1], *q = &var.b;
8732
8733 /* Here the object p points to is var.  */
8734 assert (__builtin_object_size (p, 0) == sizeof (var) - 1);
8735 /* The subobject p points to is var.buf1.  */
8736 assert (__builtin_object_size (p, 1) == sizeof (var.buf1) - 1);
8737 /* The object q points to is var.  */
8738 assert (__builtin_object_size (q, 0)
8739         == (char *) (&var + 1) - (char *) &var.b);
8740 /* The subobject q points to is var.b.  */
8741 assert (__builtin_object_size (q, 1) == sizeof (var.b));
8742 @end smallexample
8743 @end deftypefn
8744
8745 There are built-in functions added for many common string operation
8746 functions, e.g., for @code{memcpy} @code{__builtin___memcpy_chk}
8747 built-in is provided.  This built-in has an additional last argument,
8748 which is the number of bytes remaining in object the @var{dest}
8749 argument points to or @code{(size_t) -1} if the size is not known.
8750
8751 The built-in functions are optimized into the normal string functions
8752 like @code{memcpy} if the last argument is @code{(size_t) -1} or if
8753 it is known at compile time that the destination object will not
8754 be overflown.  If the compiler can determine at compile time the
8755 object will be always overflown, it issues a warning.
8756
8757 The intended use can be e.g.@:
8758
8759 @smallexample
8760 #undef memcpy
8761 #define bos0(dest) __builtin_object_size (dest, 0)
8762 #define memcpy(dest, src, n) \
8763   __builtin___memcpy_chk (dest, src, n, bos0 (dest))
8764
8765 char *volatile p;
8766 char buf[10];
8767 /* It is unknown what object p points to, so this is optimized
8768    into plain memcpy - no checking is possible.  */
8769 memcpy (p, "abcde", n);
8770 /* Destination is known and length too.  It is known at compile
8771    time there will be no overflow.  */
8772 memcpy (&buf[5], "abcde", 5);
8773 /* Destination is known, but the length is not known at compile time.
8774    This will result in __memcpy_chk call that can check for overflow
8775    at run time.  */
8776 memcpy (&buf[5], "abcde", n);
8777 /* Destination is known and it is known at compile time there will
8778    be overflow.  There will be a warning and __memcpy_chk call that
8779    will abort the program at run time.  */
8780 memcpy (&buf[6], "abcde", 5);
8781 @end smallexample
8782
8783 Such built-in functions are provided for @code{memcpy}, @code{mempcpy},
8784 @code{memmove}, @code{memset}, @code{strcpy}, @code{stpcpy}, @code{strncpy},
8785 @code{strcat} and @code{strncat}.
8786
8787 There are also checking built-in functions for formatted output functions.
8788 @smallexample
8789 int __builtin___sprintf_chk (char *s, int flag, size_t os, const char *fmt, ...);
8790 int __builtin___snprintf_chk (char *s, size_t maxlen, int flag, size_t os,
8791                               const char *fmt, ...);
8792 int __builtin___vsprintf_chk (char *s, int flag, size_t os, const char *fmt,
8793                               va_list ap);
8794 int __builtin___vsnprintf_chk (char *s, size_t maxlen, int flag, size_t os,
8795                                const char *fmt, va_list ap);
8796 @end smallexample
8797
8798 The added @var{flag} argument is passed unchanged to @code{__sprintf_chk}
8799 etc.@: functions and can contain implementation specific flags on what
8800 additional security measures the checking function might take, such as
8801 handling @code{%n} differently.
8802
8803 The @var{os} argument is the object size @var{s} points to, like in the
8804 other built-in functions.  There is a small difference in the behavior
8805 though, if @var{os} is @code{(size_t) -1}, the built-in functions are
8806 optimized into the non-checking functions only if @var{flag} is 0, otherwise
8807 the checking function is called with @var{os} argument set to
8808 @code{(size_t) -1}.
8809
8810 In addition to this, there are checking built-in functions
8811 @code{__builtin___printf_chk}, @code{__builtin___vprintf_chk},
8812 @code{__builtin___fprintf_chk} and @code{__builtin___vfprintf_chk}.
8813 These have just one additional argument, @var{flag}, right before
8814 format string @var{fmt}.  If the compiler is able to optimize them to
8815 @code{fputc} etc.@: functions, it does, otherwise the checking function
8816 is called and the @var{flag} argument passed to it.
8817
8818 @node Pointer Bounds Checker builtins
8819 @section Pointer Bounds Checker Built-in Functions
8820 @findex __builtin___bnd_set_ptr_bounds
8821 @findex __builtin___bnd_narrow_ptr_bounds
8822 @findex __builtin___bnd_copy_ptr_bounds
8823 @findex __builtin___bnd_init_ptr_bounds
8824 @findex __builtin___bnd_null_ptr_bounds
8825 @findex __builtin___bnd_store_ptr_bounds
8826 @findex __builtin___bnd_chk_ptr_lbounds
8827 @findex __builtin___bnd_chk_ptr_ubounds
8828 @findex __builtin___bnd_chk_ptr_bounds
8829 @findex __builtin___bnd_get_ptr_lbound
8830 @findex __builtin___bnd_get_ptr_ubound
8831
8832 GCC provides a set of built-in functions to control Pointer Bounds Checker
8833 instrumentation.  Note that all Pointer Bounds Checker builtins are allowed
8834 to use even if you compile with Pointer Bounds Checker off.  The builtins
8835 behavior may differ in such case as documented below.
8836
8837 @deftypefn {Built-in Function} void * __builtin___bnd_set_ptr_bounds (const void * @var{q}, size_t @var{size})
8838
8839 This built-in function returns a new pointer with the value of @var{q}, and
8840 associate it with the bounds [@var{q}, @var{q}+@var{size}-1].  With Pointer
8841 Bounds Checker off built-in function just returns the first argument.
8842
8843 @smallexample
8844 extern void *__wrap_malloc (size_t n)
8845 @{
8846   void *p = (void *)__real_malloc (n);
8847   if (!p) return __builtin___bnd_null_ptr_bounds (p);
8848   return __builtin___bnd_set_ptr_bounds (p, n);
8849 @}
8850 @end smallexample
8851
8852 @end deftypefn
8853
8854 @deftypefn {Built-in Function} void * __builtin___bnd_narrow_ptr_bounds (const void * @var{p}, const void * @var{q}, size_t  @var{size})
8855
8856 This built-in function returns a new pointer with the value of @var{p}
8857 and associate it with the narrowed bounds formed by the intersection
8858 of bounds associated with @var{q} and the [@var{p}, @var{p} + @var{size} - 1].
8859 With Pointer Bounds Checker off built-in function just returns the first
8860 argument.
8861
8862 @smallexample
8863 void init_objects (object *objs, size_t size)
8864 @{
8865   size_t i;
8866   /* Initialize objects one-by-one passing pointers with bounds of an object,
8867      not the full array of objects.  */
8868   for (i = 0; i < size; i++)
8869     init_object (__builtin___bnd_narrow_ptr_bounds (objs + i, objs, sizeof(object)));
8870 @}
8871 @end smallexample
8872
8873 @end deftypefn
8874
8875 @deftypefn {Built-in Function} void * __builtin___bnd_copy_ptr_bounds (const void * @var{q}, const void * @var{r})
8876
8877 This built-in function returns a new pointer with the value of @var{q},
8878 and associate it with the bounds already associated with pointer @var{r}.
8879 With Pointer Bounds Checker off built-in function just returns the first
8880 argument.
8881
8882 @smallexample
8883 /* Here is a way to get pointer to object's field but
8884    still with the full object's bounds.  */
8885 int *field_ptr = __builtin___bnd_copy_ptr_bounds (&objptr->int_filed, objptr);
8886 @end smallexample
8887
8888 @end deftypefn
8889
8890 @deftypefn {Built-in Function} void * __builtin___bnd_init_ptr_bounds (const void * @var{q})
8891
8892 This built-in function returns a new pointer with the value of @var{q}, and
8893 associate it with INIT (allowing full memory access) bounds. With Pointer
8894 Bounds Checker off built-in function just returns the first argument.
8895
8896 @end deftypefn
8897
8898 @deftypefn {Built-in Function} void * __builtin___bnd_null_ptr_bounds (const void * @var{q})
8899
8900 This built-in function returns a new pointer with the value of @var{q}, and
8901 associate it with NULL (allowing no memory access) bounds. With Pointer
8902 Bounds Checker off built-in function just returns the first argument.
8903
8904 @end deftypefn
8905
8906 @deftypefn {Built-in Function} void __builtin___bnd_store_ptr_bounds (const void ** @var{ptr_addr}, const void * @var{ptr_val})
8907
8908 This built-in function stores the bounds associated with pointer @var{ptr_val}
8909 and location @var{ptr_addr} into Bounds Table.  This can be useful to propagate
8910 bounds from legacy code without touching the associated pointer's memory when
8911 pointers were copied as integers.  With Pointer Bounds Checker off built-in
8912 function call is ignored.
8913
8914 @end deftypefn
8915
8916 @deftypefn {Built-in Function} void __builtin___bnd_chk_ptr_lbounds (const void * @var{q})
8917
8918 This built-in function checks if the pointer @var{q} is within the lower
8919 bound of its associated bounds.  With Pointer Bounds Checker off built-in
8920 function call is ignored.
8921
8922 @smallexample
8923 extern void *__wrap_memset (void *dst, int c, size_t len)
8924 @{
8925   if (len > 0)
8926     @{
8927       __builtin___bnd_chk_ptr_lbounds (dst);
8928       __builtin___bnd_chk_ptr_ubounds ((char *)dst + len - 1);
8929       __real_memset (dst, c, len);
8930     @}
8931   return dst;
8932 @}
8933 @end smallexample
8934
8935 @end deftypefn
8936
8937 @deftypefn {Built-in Function} void __builtin___bnd_chk_ptr_ubounds (const void * @var{q})
8938
8939 This built-in function checks if the pointer @var{q} is within the upper
8940 bound of its associated bounds.  With Pointer Bounds Checker off built-in
8941 function call is ignored.
8942
8943 @end deftypefn
8944
8945 @deftypefn {Built-in Function} void __builtin___bnd_chk_ptr_bounds (const void * @var{q}, size_t @var{size})
8946
8947 This built-in function checks if [@var{q}, @var{q} + @var{size} - 1] is within
8948 the lower and upper bounds associated with @var{q}.  With Pointer Bounds Checker
8949 off built-in function call is ignored.
8950
8951 @smallexample
8952 extern void *__wrap_memcpy (void *dst, const void *src, size_t n)
8953 @{
8954   if (n > 0)
8955     @{
8956       __bnd_chk_ptr_bounds (dst, n);
8957       __bnd_chk_ptr_bounds (src, n);
8958       __real_memcpy (dst, src, n);
8959     @}
8960   return dst;
8961 @}
8962 @end smallexample
8963
8964 @end deftypefn
8965
8966 @deftypefn {Built-in Function} const void * __builtin___bnd_get_ptr_lbound (const void * @var{q})
8967
8968 This built-in function returns the lower bound (which is a pointer) associated
8969 with the pointer @var{q}.  This is at least useful for debugging using printf.
8970 With Pointer Bounds Checker off built-in function returns 0.
8971
8972 @smallexample
8973 void *lb = __builtin___bnd_get_ptr_lbound (q);
8974 void *ub = __builtin___bnd_get_ptr_ubound (q);
8975 printf ("q = %p  lb(q) = %p  ub(q) = %p", q, lb, ub);
8976 @end smallexample
8977
8978 @end deftypefn
8979
8980 @deftypefn {Built-in Function} const void * __builtin___bnd_get_ptr_ubound (const void * @var{q})
8981
8982 This built-in function returns the upper bound (which is a pointer) associated
8983 with the pointer @var{q}.  With Pointer Bounds Checker off built-in function
8984 returns -1.
8985
8986 @end deftypefn
8987
8988 @node Cilk Plus Builtins
8989 @section Cilk Plus C/C++ language extension Built-in Functions.
8990
8991 GCC provides support for the following built-in reduction funtions if Cilk Plus
8992 is enabled. Cilk Plus can be enabled using the @option{-fcilkplus} flag.
8993
8994 @itemize @bullet
8995 @item __sec_implicit_index
8996 @item __sec_reduce
8997 @item __sec_reduce_add
8998 @item __sec_reduce_all_nonzero
8999 @item __sec_reduce_all_zero
9000 @item __sec_reduce_any_nonzero
9001 @item __sec_reduce_any_zero
9002 @item __sec_reduce_max
9003 @item __sec_reduce_min
9004 @item __sec_reduce_max_ind
9005 @item __sec_reduce_min_ind
9006 @item __sec_reduce_mul
9007 @item __sec_reduce_mutating
9008 @end itemize
9009
9010 Further details and examples about these built-in functions are described 
9011 in the Cilk Plus language manual which can be found at 
9012 @uref{http://www.cilkplus.org}.
9013
9014 @node Other Builtins
9015 @section Other Built-in Functions Provided by GCC
9016 @cindex built-in functions
9017 @findex __builtin_call_with_static_chain
9018 @findex __builtin_fpclassify
9019 @findex __builtin_isfinite
9020 @findex __builtin_isnormal
9021 @findex __builtin_isgreater
9022 @findex __builtin_isgreaterequal
9023 @findex __builtin_isinf_sign
9024 @findex __builtin_isless
9025 @findex __builtin_islessequal
9026 @findex __builtin_islessgreater
9027 @findex __builtin_isunordered
9028 @findex __builtin_powi
9029 @findex __builtin_powif
9030 @findex __builtin_powil
9031 @findex _Exit
9032 @findex _exit
9033 @findex abort
9034 @findex abs
9035 @findex acos
9036 @findex acosf
9037 @findex acosh
9038 @findex acoshf
9039 @findex acoshl
9040 @findex acosl
9041 @findex alloca
9042 @findex asin
9043 @findex asinf
9044 @findex asinh
9045 @findex asinhf
9046 @findex asinhl
9047 @findex asinl
9048 @findex atan
9049 @findex atan2
9050 @findex atan2f
9051 @findex atan2l
9052 @findex atanf
9053 @findex atanh
9054 @findex atanhf
9055 @findex atanhl
9056 @findex atanl
9057 @findex bcmp
9058 @findex bzero
9059 @findex cabs
9060 @findex cabsf
9061 @findex cabsl
9062 @findex cacos
9063 @findex cacosf
9064 @findex cacosh
9065 @findex cacoshf
9066 @findex cacoshl
9067 @findex cacosl
9068 @findex calloc
9069 @findex carg
9070 @findex cargf
9071 @findex cargl
9072 @findex casin
9073 @findex casinf
9074 @findex casinh
9075 @findex casinhf
9076 @findex casinhl
9077 @findex casinl
9078 @findex catan
9079 @findex catanf
9080 @findex catanh
9081 @findex catanhf
9082 @findex catanhl
9083 @findex catanl
9084 @findex cbrt
9085 @findex cbrtf
9086 @findex cbrtl
9087 @findex ccos
9088 @findex ccosf
9089 @findex ccosh
9090 @findex ccoshf
9091 @findex ccoshl
9092 @findex ccosl
9093 @findex ceil
9094 @findex ceilf
9095 @findex ceill
9096 @findex cexp
9097 @findex cexpf
9098 @findex cexpl
9099 @findex cimag
9100 @findex cimagf
9101 @findex cimagl
9102 @findex clog
9103 @findex clogf
9104 @findex clogl
9105 @findex conj
9106 @findex conjf
9107 @findex conjl
9108 @findex copysign
9109 @findex copysignf
9110 @findex copysignl
9111 @findex cos
9112 @findex cosf
9113 @findex cosh
9114 @findex coshf
9115 @findex coshl
9116 @findex cosl
9117 @findex cpow
9118 @findex cpowf
9119 @findex cpowl
9120 @findex cproj
9121 @findex cprojf
9122 @findex cprojl
9123 @findex creal
9124 @findex crealf
9125 @findex creall
9126 @findex csin
9127 @findex csinf
9128 @findex csinh
9129 @findex csinhf
9130 @findex csinhl
9131 @findex csinl
9132 @findex csqrt
9133 @findex csqrtf
9134 @findex csqrtl
9135 @findex ctan
9136 @findex ctanf
9137 @findex ctanh
9138 @findex ctanhf
9139 @findex ctanhl
9140 @findex ctanl
9141 @findex dcgettext
9142 @findex dgettext
9143 @findex drem
9144 @findex dremf
9145 @findex dreml
9146 @findex erf
9147 @findex erfc
9148 @findex erfcf
9149 @findex erfcl
9150 @findex erff
9151 @findex erfl
9152 @findex exit
9153 @findex exp
9154 @findex exp10
9155 @findex exp10f
9156 @findex exp10l
9157 @findex exp2
9158 @findex exp2f
9159 @findex exp2l
9160 @findex expf
9161 @findex expl
9162 @findex expm1
9163 @findex expm1f
9164 @findex expm1l
9165 @findex fabs
9166 @findex fabsf
9167 @findex fabsl
9168 @findex fdim
9169 @findex fdimf
9170 @findex fdiml
9171 @findex ffs
9172 @findex floor
9173 @findex floorf
9174 @findex floorl
9175 @findex fma
9176 @findex fmaf
9177 @findex fmal
9178 @findex fmax
9179 @findex fmaxf
9180 @findex fmaxl
9181 @findex fmin
9182 @findex fminf
9183 @findex fminl
9184 @findex fmod
9185 @findex fmodf
9186 @findex fmodl
9187 @findex fprintf
9188 @findex fprintf_unlocked
9189 @findex fputs
9190 @findex fputs_unlocked
9191 @findex frexp
9192 @findex frexpf
9193 @findex frexpl
9194 @findex fscanf
9195 @findex gamma
9196 @findex gammaf
9197 @findex gammal
9198 @findex gamma_r
9199 @findex gammaf_r
9200 @findex gammal_r
9201 @findex gettext
9202 @findex hypot
9203 @findex hypotf
9204 @findex hypotl
9205 @findex ilogb
9206 @findex ilogbf
9207 @findex ilogbl
9208 @findex imaxabs
9209 @findex index
9210 @findex isalnum
9211 @findex isalpha
9212 @findex isascii
9213 @findex isblank
9214 @findex iscntrl
9215 @findex isdigit
9216 @findex isgraph
9217 @findex islower
9218 @findex isprint
9219 @findex ispunct
9220 @findex isspace
9221 @findex isupper
9222 @findex iswalnum
9223 @findex iswalpha
9224 @findex iswblank
9225 @findex iswcntrl
9226 @findex iswdigit
9227 @findex iswgraph
9228 @findex iswlower
9229 @findex iswprint
9230 @findex iswpunct
9231 @findex iswspace
9232 @findex iswupper
9233 @findex iswxdigit
9234 @findex isxdigit
9235 @findex j0
9236 @findex j0f
9237 @findex j0l
9238 @findex j1
9239 @findex j1f
9240 @findex j1l
9241 @findex jn
9242 @findex jnf
9243 @findex jnl
9244 @findex labs
9245 @findex ldexp
9246 @findex ldexpf
9247 @findex ldexpl
9248 @findex lgamma
9249 @findex lgammaf
9250 @findex lgammal
9251 @findex lgamma_r
9252 @findex lgammaf_r
9253 @findex lgammal_r
9254 @findex llabs
9255 @findex llrint
9256 @findex llrintf
9257 @findex llrintl
9258 @findex llround
9259 @findex llroundf
9260 @findex llroundl
9261 @findex log
9262 @findex log10
9263 @findex log10f
9264 @findex log10l
9265 @findex log1p
9266 @findex log1pf
9267 @findex log1pl
9268 @findex log2
9269 @findex log2f
9270 @findex log2l
9271 @findex logb
9272 @findex logbf
9273 @findex logbl
9274 @findex logf
9275 @findex logl
9276 @findex lrint
9277 @findex lrintf
9278 @findex lrintl
9279 @findex lround
9280 @findex lroundf
9281 @findex lroundl
9282 @findex malloc
9283 @findex memchr
9284 @findex memcmp
9285 @findex memcpy
9286 @findex mempcpy
9287 @findex memset
9288 @findex modf
9289 @findex modff
9290 @findex modfl
9291 @findex nearbyint
9292 @findex nearbyintf
9293 @findex nearbyintl
9294 @findex nextafter
9295 @findex nextafterf
9296 @findex nextafterl
9297 @findex nexttoward
9298 @findex nexttowardf
9299 @findex nexttowardl
9300 @findex pow
9301 @findex pow10
9302 @findex pow10f
9303 @findex pow10l
9304 @findex powf
9305 @findex powl
9306 @findex printf
9307 @findex printf_unlocked
9308 @findex putchar
9309 @findex puts
9310 @findex remainder
9311 @findex remainderf
9312 @findex remainderl
9313 @findex remquo
9314 @findex remquof
9315 @findex remquol
9316 @findex rindex
9317 @findex rint
9318 @findex rintf
9319 @findex rintl
9320 @findex round
9321 @findex roundf
9322 @findex roundl
9323 @findex scalb
9324 @findex scalbf
9325 @findex scalbl
9326 @findex scalbln
9327 @findex scalblnf
9328 @findex scalblnf
9329 @findex scalbn
9330 @findex scalbnf
9331 @findex scanfnl
9332 @findex signbit
9333 @findex signbitf
9334 @findex signbitl
9335 @findex signbitd32
9336 @findex signbitd64
9337 @findex signbitd128
9338 @findex significand
9339 @findex significandf
9340 @findex significandl
9341 @findex sin
9342 @findex sincos
9343 @findex sincosf
9344 @findex sincosl
9345 @findex sinf
9346 @findex sinh
9347 @findex sinhf
9348 @findex sinhl
9349 @findex sinl
9350 @findex snprintf
9351 @findex sprintf
9352 @findex sqrt
9353 @findex sqrtf
9354 @findex sqrtl
9355 @findex sscanf
9356 @findex stpcpy
9357 @findex stpncpy
9358 @findex strcasecmp
9359 @findex strcat
9360 @findex strchr
9361 @findex strcmp
9362 @findex strcpy
9363 @findex strcspn
9364 @findex strdup
9365 @findex strfmon
9366 @findex strftime
9367 @findex strlen
9368 @findex strncasecmp
9369 @findex strncat
9370 @findex strncmp
9371 @findex strncpy
9372 @findex strndup
9373 @findex strpbrk
9374 @findex strrchr
9375 @findex strspn
9376 @findex strstr
9377 @findex tan
9378 @findex tanf
9379 @findex tanh
9380 @findex tanhf
9381 @findex tanhl
9382 @findex tanl
9383 @findex tgamma
9384 @findex tgammaf
9385 @findex tgammal
9386 @findex toascii
9387 @findex tolower
9388 @findex toupper
9389 @findex towlower
9390 @findex towupper
9391 @findex trunc
9392 @findex truncf
9393 @findex truncl
9394 @findex vfprintf
9395 @findex vfscanf
9396 @findex vprintf
9397 @findex vscanf
9398 @findex vsnprintf
9399 @findex vsprintf
9400 @findex vsscanf
9401 @findex y0
9402 @findex y0f
9403 @findex y0l
9404 @findex y1
9405 @findex y1f
9406 @findex y1l
9407 @findex yn
9408 @findex ynf
9409 @findex ynl
9410
9411 GCC provides a large number of built-in functions other than the ones
9412 mentioned above.  Some of these are for internal use in the processing
9413 of exceptions or variable-length argument lists and are not
9414 documented here because they may change from time to time; we do not
9415 recommend general use of these functions.
9416
9417 The remaining functions are provided for optimization purposes.
9418
9419 @opindex fno-builtin
9420 GCC includes built-in versions of many of the functions in the standard
9421 C library.  The versions prefixed with @code{__builtin_} are always
9422 treated as having the same meaning as the C library function even if you
9423 specify the @option{-fno-builtin} option.  (@pxref{C Dialect Options})
9424 Many of these functions are only optimized in certain cases; if they are
9425 not optimized in a particular case, a call to the library function is
9426 emitted.
9427
9428 @opindex ansi
9429 @opindex std
9430 Outside strict ISO C mode (@option{-ansi}, @option{-std=c90},
9431 @option{-std=c99} or @option{-std=c11}), the functions
9432 @code{_exit}, @code{alloca}, @code{bcmp}, @code{bzero},
9433 @code{dcgettext}, @code{dgettext}, @code{dremf}, @code{dreml},
9434 @code{drem}, @code{exp10f}, @code{exp10l}, @code{exp10}, @code{ffsll},
9435 @code{ffsl}, @code{ffs}, @code{fprintf_unlocked},
9436 @code{fputs_unlocked}, @code{gammaf}, @code{gammal}, @code{gamma},
9437 @code{gammaf_r}, @code{gammal_r}, @code{gamma_r}, @code{gettext},
9438 @code{index}, @code{isascii}, @code{j0f}, @code{j0l}, @code{j0},
9439 @code{j1f}, @code{j1l}, @code{j1}, @code{jnf}, @code{jnl}, @code{jn},
9440 @code{lgammaf_r}, @code{lgammal_r}, @code{lgamma_r}, @code{mempcpy},
9441 @code{pow10f}, @code{pow10l}, @code{pow10}, @code{printf_unlocked},
9442 @code{rindex}, @code{scalbf}, @code{scalbl}, @code{scalb},
9443 @code{signbit}, @code{signbitf}, @code{signbitl}, @code{signbitd32},
9444 @code{signbitd64}, @code{signbitd128}, @code{significandf},
9445 @code{significandl}, @code{significand}, @code{sincosf},
9446 @code{sincosl}, @code{sincos}, @code{stpcpy}, @code{stpncpy},
9447 @code{strcasecmp}, @code{strdup}, @code{strfmon}, @code{strncasecmp},
9448 @code{strndup}, @code{toascii}, @code{y0f}, @code{y0l}, @code{y0},
9449 @code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and
9450 @code{yn}
9451 may be handled as built-in functions.
9452 All these functions have corresponding versions
9453 prefixed with @code{__builtin_}, which may be used even in strict C90
9454 mode.
9455
9456 The ISO C99 functions
9457 @code{_Exit}, @code{acoshf}, @code{acoshl}, @code{acosh}, @code{asinhf},
9458 @code{asinhl}, @code{asinh}, @code{atanhf}, @code{atanhl}, @code{atanh},
9459 @code{cabsf}, @code{cabsl}, @code{cabs}, @code{cacosf}, @code{cacoshf},
9460 @code{cacoshl}, @code{cacosh}, @code{cacosl}, @code{cacos},
9461 @code{cargf}, @code{cargl}, @code{carg}, @code{casinf}, @code{casinhf},
9462 @code{casinhl}, @code{casinh}, @code{casinl}, @code{casin},
9463 @code{catanf}, @code{catanhf}, @code{catanhl}, @code{catanh},
9464 @code{catanl}, @code{catan}, @code{cbrtf}, @code{cbrtl}, @code{cbrt},
9465 @code{ccosf}, @code{ccoshf}, @code{ccoshl}, @code{ccosh}, @code{ccosl},
9466 @code{ccos}, @code{cexpf}, @code{cexpl}, @code{cexp}, @code{cimagf},
9467 @code{cimagl}, @code{cimag}, @code{clogf}, @code{clogl}, @code{clog},
9468 @code{conjf}, @code{conjl}, @code{conj}, @code{copysignf}, @code{copysignl},
9469 @code{copysign}, @code{cpowf}, @code{cpowl}, @code{cpow}, @code{cprojf},
9470 @code{cprojl}, @code{cproj}, @code{crealf}, @code{creall}, @code{creal},
9471 @code{csinf}, @code{csinhf}, @code{csinhl}, @code{csinh}, @code{csinl},
9472 @code{csin}, @code{csqrtf}, @code{csqrtl}, @code{csqrt}, @code{ctanf},
9473 @code{ctanhf}, @code{ctanhl}, @code{ctanh}, @code{ctanl}, @code{ctan},
9474 @code{erfcf}, @code{erfcl}, @code{erfc}, @code{erff}, @code{erfl},
9475 @code{erf}, @code{exp2f}, @code{exp2l}, @code{exp2}, @code{expm1f},
9476 @code{expm1l}, @code{expm1}, @code{fdimf}, @code{fdiml}, @code{fdim},
9477 @code{fmaf}, @code{fmal}, @code{fmaxf}, @code{fmaxl}, @code{fmax},
9478 @code{fma}, @code{fminf}, @code{fminl}, @code{fmin}, @code{hypotf},
9479 @code{hypotl}, @code{hypot}, @code{ilogbf}, @code{ilogbl}, @code{ilogb},
9480 @code{imaxabs}, @code{isblank}, @code{iswblank}, @code{lgammaf},
9481 @code{lgammal}, @code{lgamma}, @code{llabs}, @code{llrintf}, @code{llrintl},
9482 @code{llrint}, @code{llroundf}, @code{llroundl}, @code{llround},
9483 @code{log1pf}, @code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l},
9484 @code{log2}, @code{logbf}, @code{logbl}, @code{logb}, @code{lrintf},
9485 @code{lrintl}, @code{lrint}, @code{lroundf}, @code{lroundl},
9486 @code{lround}, @code{nearbyintf}, @code{nearbyintl}, @code{nearbyint},
9487 @code{nextafterf}, @code{nextafterl}, @code{nextafter},
9488 @code{nexttowardf}, @code{nexttowardl}, @code{nexttoward},
9489 @code{remainderf}, @code{remainderl}, @code{remainder}, @code{remquof},
9490 @code{remquol}, @code{remquo}, @code{rintf}, @code{rintl}, @code{rint},
9491 @code{roundf}, @code{roundl}, @code{round}, @code{scalblnf},
9492 @code{scalblnl}, @code{scalbln}, @code{scalbnf}, @code{scalbnl},
9493 @code{scalbn}, @code{snprintf}, @code{tgammaf}, @code{tgammal},
9494 @code{tgamma}, @code{truncf}, @code{truncl}, @code{trunc},
9495 @code{vfscanf}, @code{vscanf}, @code{vsnprintf} and @code{vsscanf}
9496 are handled as built-in functions
9497 except in strict ISO C90 mode (@option{-ansi} or @option{-std=c90}).
9498
9499 There are also built-in versions of the ISO C99 functions
9500 @code{acosf}, @code{acosl}, @code{asinf}, @code{asinl}, @code{atan2f},
9501 @code{atan2l}, @code{atanf}, @code{atanl}, @code{ceilf}, @code{ceill},
9502 @code{cosf}, @code{coshf}, @code{coshl}, @code{cosl}, @code{expf},
9503 @code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf}, @code{floorl},
9504 @code{fmodf}, @code{fmodl}, @code{frexpf}, @code{frexpl}, @code{ldexpf},
9505 @code{ldexpl}, @code{log10f}, @code{log10l}, @code{logf}, @code{logl},
9506 @code{modfl}, @code{modf}, @code{powf}, @code{powl}, @code{sinf},
9507 @code{sinhf}, @code{sinhl}, @code{sinl}, @code{sqrtf}, @code{sqrtl},
9508 @code{tanf}, @code{tanhf}, @code{tanhl} and @code{tanl}
9509 that are recognized in any mode since ISO C90 reserves these names for
9510 the purpose to which ISO C99 puts them.  All these functions have
9511 corresponding versions prefixed with @code{__builtin_}.
9512
9513 The ISO C94 functions
9514 @code{iswalnum}, @code{iswalpha}, @code{iswcntrl}, @code{iswdigit},
9515 @code{iswgraph}, @code{iswlower}, @code{iswprint}, @code{iswpunct},
9516 @code{iswspace}, @code{iswupper}, @code{iswxdigit}, @code{towlower} and
9517 @code{towupper}
9518 are handled as built-in functions
9519 except in strict ISO C90 mode (@option{-ansi} or @option{-std=c90}).
9520
9521 The ISO C90 functions
9522 @code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2},
9523 @code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos},
9524 @code{exit}, @code{exp}, @code{fabs}, @code{floor}, @code{fmod},
9525 @code{fprintf}, @code{fputs}, @code{frexp}, @code{fscanf},
9526 @code{isalnum}, @code{isalpha}, @code{iscntrl}, @code{isdigit},
9527 @code{isgraph}, @code{islower}, @code{isprint}, @code{ispunct},
9528 @code{isspace}, @code{isupper}, @code{isxdigit}, @code{tolower},
9529 @code{toupper}, @code{labs}, @code{ldexp}, @code{log10}, @code{log},
9530 @code{malloc}, @code{memchr}, @code{memcmp}, @code{memcpy},
9531 @code{memset}, @code{modf}, @code{pow}, @code{printf}, @code{putchar},
9532 @code{puts}, @code{scanf}, @code{sinh}, @code{sin}, @code{snprintf},
9533 @code{sprintf}, @code{sqrt}, @code{sscanf}, @code{strcat},
9534 @code{strchr}, @code{strcmp}, @code{strcpy}, @code{strcspn},
9535 @code{strlen}, @code{strncat}, @code{strncmp}, @code{strncpy},
9536 @code{strpbrk}, @code{strrchr}, @code{strspn}, @code{strstr},
9537 @code{tanh}, @code{tan}, @code{vfprintf}, @code{vprintf} and @code{vsprintf}
9538 are all recognized as built-in functions unless
9539 @option{-fno-builtin} is specified (or @option{-fno-builtin-@var{function}}
9540 is specified for an individual function).  All of these functions have
9541 corresponding versions prefixed with @code{__builtin_}.
9542
9543 GCC provides built-in versions of the ISO C99 floating-point comparison
9544 macros that avoid raising exceptions for unordered operands.  They have
9545 the same names as the standard macros ( @code{isgreater},
9546 @code{isgreaterequal}, @code{isless}, @code{islessequal},
9547 @code{islessgreater}, and @code{isunordered}) , with @code{__builtin_}
9548 prefixed.  We intend for a library implementor to be able to simply
9549 @code{#define} each standard macro to its built-in equivalent.
9550 In the same fashion, GCC provides @code{fpclassify}, @code{isfinite},
9551 @code{isinf_sign} and @code{isnormal} built-ins used with
9552 @code{__builtin_} prefixed.  The @code{isinf} and @code{isnan}
9553 built-in functions appear both with and without the @code{__builtin_} prefix.
9554
9555 @deftypefn {Built-in Function} int __builtin_types_compatible_p (@var{type1}, @var{type2})
9556
9557 You can use the built-in function @code{__builtin_types_compatible_p} to
9558 determine whether two types are the same.
9559
9560 This built-in function returns 1 if the unqualified versions of the
9561 types @var{type1} and @var{type2} (which are types, not expressions) are
9562 compatible, 0 otherwise.  The result of this built-in function can be
9563 used in integer constant expressions.
9564
9565 This built-in function ignores top level qualifiers (e.g., @code{const},
9566 @code{volatile}).  For example, @code{int} is equivalent to @code{const
9567 int}.
9568
9569 The type @code{int[]} and @code{int[5]} are compatible.  On the other
9570 hand, @code{int} and @code{char *} are not compatible, even if the size
9571 of their types, on the particular architecture are the same.  Also, the
9572 amount of pointer indirection is taken into account when determining
9573 similarity.  Consequently, @code{short *} is not similar to
9574 @code{short **}.  Furthermore, two types that are typedefed are
9575 considered compatible if their underlying types are compatible.
9576
9577 An @code{enum} type is not considered to be compatible with another
9578 @code{enum} type even if both are compatible with the same integer
9579 type; this is what the C standard specifies.
9580 For example, @code{enum @{foo, bar@}} is not similar to
9581 @code{enum @{hot, dog@}}.
9582
9583 You typically use this function in code whose execution varies
9584 depending on the arguments' types.  For example:
9585
9586 @smallexample
9587 #define foo(x)                                                  \
9588   (@{                                                           \
9589     typeof (x) tmp = (x);                                       \
9590     if (__builtin_types_compatible_p (typeof (x), long double)) \
9591       tmp = foo_long_double (tmp);                              \
9592     else if (__builtin_types_compatible_p (typeof (x), double)) \
9593       tmp = foo_double (tmp);                                   \
9594     else if (__builtin_types_compatible_p (typeof (x), float))  \
9595       tmp = foo_float (tmp);                                    \
9596     else                                                        \
9597       abort ();                                                 \
9598     tmp;                                                        \
9599   @})
9600 @end smallexample
9601
9602 @emph{Note:} This construct is only available for C@.
9603
9604 @end deftypefn
9605
9606 @deftypefn {Built-in Function} @var{type} __builtin_call_with_static_chain (@var{call_exp}, @var{pointer_exp})
9607
9608 The @var{call_exp} expression must be a function call, and the
9609 @var{pointer_exp} expression must be a pointer.  The @var{pointer_exp}
9610 is passed to the function call in the target's static chain location.
9611 The result of builtin is the result of the function call.
9612
9613 @emph{Note:} This builtin is only available for C@.
9614 This builtin can be used to call Go closures from C.
9615
9616 @end deftypefn
9617
9618 @deftypefn {Built-in Function} @var{type} __builtin_choose_expr (@var{const_exp}, @var{exp1}, @var{exp2})
9619
9620 You can use the built-in function @code{__builtin_choose_expr} to
9621 evaluate code depending on the value of a constant expression.  This
9622 built-in function returns @var{exp1} if @var{const_exp}, which is an
9623 integer constant expression, is nonzero.  Otherwise it returns @var{exp2}.
9624
9625 This built-in function is analogous to the @samp{? :} operator in C,
9626 except that the expression returned has its type unaltered by promotion
9627 rules.  Also, the built-in function does not evaluate the expression
9628 that is not chosen.  For example, if @var{const_exp} evaluates to true,
9629 @var{exp2} is not evaluated even if it has side-effects.
9630
9631 This built-in function can return an lvalue if the chosen argument is an
9632 lvalue.
9633
9634 If @var{exp1} is returned, the return type is the same as @var{exp1}'s
9635 type.  Similarly, if @var{exp2} is returned, its return type is the same
9636 as @var{exp2}.
9637
9638 Example:
9639
9640 @smallexample
9641 #define foo(x)                                                    \
9642   __builtin_choose_expr (                                         \
9643     __builtin_types_compatible_p (typeof (x), double),            \
9644     foo_double (x),                                               \
9645     __builtin_choose_expr (                                       \
9646       __builtin_types_compatible_p (typeof (x), float),           \
9647       foo_float (x),                                              \
9648       /* @r{The void expression results in a compile-time error}  \
9649          @r{when assigning the result to something.}  */          \
9650       (void)0))
9651 @end smallexample
9652
9653 @emph{Note:} This construct is only available for C@.  Furthermore, the
9654 unused expression (@var{exp1} or @var{exp2} depending on the value of
9655 @var{const_exp}) may still generate syntax errors.  This may change in
9656 future revisions.
9657
9658 @end deftypefn
9659
9660 @deftypefn {Built-in Function} @var{type} __builtin_complex (@var{real}, @var{imag})
9661
9662 The built-in function @code{__builtin_complex} is provided for use in
9663 implementing the ISO C11 macros @code{CMPLXF}, @code{CMPLX} and
9664 @code{CMPLXL}.  @var{real} and @var{imag} must have the same type, a
9665 real binary floating-point type, and the result has the corresponding
9666 complex type with real and imaginary parts @var{real} and @var{imag}.
9667 Unlike @samp{@var{real} + I * @var{imag}}, this works even when
9668 infinities, NaNs and negative zeros are involved.
9669
9670 @end deftypefn
9671
9672 @deftypefn {Built-in Function} int __builtin_constant_p (@var{exp})
9673 You can use the built-in function @code{__builtin_constant_p} to
9674 determine if a value is known to be constant at compile time and hence
9675 that GCC can perform constant-folding on expressions involving that
9676 value.  The argument of the function is the value to test.  The function
9677 returns the integer 1 if the argument is known to be a compile-time
9678 constant and 0 if it is not known to be a compile-time constant.  A
9679 return of 0 does not indicate that the value is @emph{not} a constant,
9680 but merely that GCC cannot prove it is a constant with the specified
9681 value of the @option{-O} option.
9682
9683 You typically use this function in an embedded application where
9684 memory is a critical resource.  If you have some complex calculation,
9685 you may want it to be folded if it involves constants, but need to call
9686 a function if it does not.  For example:
9687
9688 @smallexample
9689 #define Scale_Value(X)      \
9690   (__builtin_constant_p (X) \
9691   ? ((X) * SCALE + OFFSET) : Scale (X))
9692 @end smallexample
9693
9694 You may use this built-in function in either a macro or an inline
9695 function.  However, if you use it in an inlined function and pass an
9696 argument of the function as the argument to the built-in, GCC 
9697 never returns 1 when you call the inline function with a string constant
9698 or compound literal (@pxref{Compound Literals}) and does not return 1
9699 when you pass a constant numeric value to the inline function unless you
9700 specify the @option{-O} option.
9701
9702 You may also use @code{__builtin_constant_p} in initializers for static
9703 data.  For instance, you can write
9704
9705 @smallexample
9706 static const int table[] = @{
9707    __builtin_constant_p (EXPRESSION) ? (EXPRESSION) : -1,
9708    /* @r{@dots{}} */
9709 @};
9710 @end smallexample
9711
9712 @noindent
9713 This is an acceptable initializer even if @var{EXPRESSION} is not a
9714 constant expression, including the case where
9715 @code{__builtin_constant_p} returns 1 because @var{EXPRESSION} can be
9716 folded to a constant but @var{EXPRESSION} contains operands that are
9717 not otherwise permitted in a static initializer (for example,
9718 @code{0 && foo ()}).  GCC must be more conservative about evaluating the
9719 built-in in this case, because it has no opportunity to perform
9720 optimization.
9721
9722 Previous versions of GCC did not accept this built-in in data
9723 initializers.  The earliest version where it is completely safe is
9724 3.0.1.
9725 @end deftypefn
9726
9727 @deftypefn {Built-in Function} long __builtin_expect (long @var{exp}, long @var{c})
9728 @opindex fprofile-arcs
9729 You may use @code{__builtin_expect} to provide the compiler with
9730 branch prediction information.  In general, you should prefer to
9731 use actual profile feedback for this (@option{-fprofile-arcs}), as
9732 programmers are notoriously bad at predicting how their programs
9733 actually perform.  However, there are applications in which this
9734 data is hard to collect.
9735
9736 The return value is the value of @var{exp}, which should be an integral
9737 expression.  The semantics of the built-in are that it is expected that
9738 @var{exp} == @var{c}.  For example:
9739
9740 @smallexample
9741 if (__builtin_expect (x, 0))
9742   foo ();
9743 @end smallexample
9744
9745 @noindent
9746 indicates that we do not expect to call @code{foo}, since
9747 we expect @code{x} to be zero.  Since you are limited to integral
9748 expressions for @var{exp}, you should use constructions such as
9749
9750 @smallexample
9751 if (__builtin_expect (ptr != NULL, 1))
9752   foo (*ptr);
9753 @end smallexample
9754
9755 @noindent
9756 when testing pointer or floating-point values.
9757 @end deftypefn
9758
9759 @deftypefn {Built-in Function} void __builtin_trap (void)
9760 This function causes the program to exit abnormally.  GCC implements
9761 this function by using a target-dependent mechanism (such as
9762 intentionally executing an illegal instruction) or by calling
9763 @code{abort}.  The mechanism used may vary from release to release so
9764 you should not rely on any particular implementation.
9765 @end deftypefn
9766
9767 @deftypefn {Built-in Function} void __builtin_unreachable (void)
9768 If control flow reaches the point of the @code{__builtin_unreachable},
9769 the program is undefined.  It is useful in situations where the
9770 compiler cannot deduce the unreachability of the code.
9771
9772 One such case is immediately following an @code{asm} statement that
9773 either never terminates, or one that transfers control elsewhere
9774 and never returns.  In this example, without the
9775 @code{__builtin_unreachable}, GCC issues a warning that control
9776 reaches the end of a non-void function.  It also generates code
9777 to return after the @code{asm}.
9778
9779 @smallexample
9780 int f (int c, int v)
9781 @{
9782   if (c)
9783     @{
9784       return v;
9785     @}
9786   else
9787     @{
9788       asm("jmp error_handler");
9789       __builtin_unreachable ();
9790     @}
9791 @}
9792 @end smallexample
9793
9794 @noindent
9795 Because the @code{asm} statement unconditionally transfers control out
9796 of the function, control never reaches the end of the function
9797 body.  The @code{__builtin_unreachable} is in fact unreachable and
9798 communicates this fact to the compiler.
9799
9800 Another use for @code{__builtin_unreachable} is following a call a
9801 function that never returns but that is not declared
9802 @code{__attribute__((noreturn))}, as in this example:
9803
9804 @smallexample
9805 void function_that_never_returns (void);
9806
9807 int g (int c)
9808 @{
9809   if (c)
9810     @{
9811       return 1;
9812     @}
9813   else
9814     @{
9815       function_that_never_returns ();
9816       __builtin_unreachable ();
9817     @}
9818 @}
9819 @end smallexample
9820
9821 @end deftypefn
9822
9823 @deftypefn {Built-in Function} void *__builtin_assume_aligned (const void *@var{exp}, size_t @var{align}, ...)
9824 This function returns its first argument, and allows the compiler
9825 to assume that the returned pointer is at least @var{align} bytes
9826 aligned.  This built-in can have either two or three arguments,
9827 if it has three, the third argument should have integer type, and
9828 if it is nonzero means misalignment offset.  For example:
9829
9830 @smallexample
9831 void *x = __builtin_assume_aligned (arg, 16);
9832 @end smallexample
9833
9834 @noindent
9835 means that the compiler can assume @code{x}, set to @code{arg}, is at least
9836 16-byte aligned, while:
9837
9838 @smallexample
9839 void *x = __builtin_assume_aligned (arg, 32, 8);
9840 @end smallexample
9841
9842 @noindent
9843 means that the compiler can assume for @code{x}, set to @code{arg}, that
9844 @code{(char *) x - 8} is 32-byte aligned.
9845 @end deftypefn
9846
9847 @deftypefn {Built-in Function} int __builtin_LINE ()
9848 This function is the equivalent to the preprocessor @code{__LINE__}
9849 macro and returns the line number of the invocation of the built-in.
9850 In a C++ default argument for a function @var{F}, it gets the line number of
9851 the call to @var{F}.
9852 @end deftypefn
9853
9854 @deftypefn {Built-in Function} {const char *} __builtin_FUNCTION ()
9855 This function is the equivalent to the preprocessor @code{__FUNCTION__}
9856 macro and returns the function name the invocation of the built-in is in.
9857 @end deftypefn
9858
9859 @deftypefn {Built-in Function} {const char *} __builtin_FILE ()
9860 This function is the equivalent to the preprocessor @code{__FILE__}
9861 macro and returns the file name the invocation of the built-in is in.
9862 In a C++ default argument for a function @var{F}, it gets the file name of
9863 the call to @var{F}.
9864 @end deftypefn
9865
9866 @deftypefn {Built-in Function} void __builtin___clear_cache (char *@var{begin}, char *@var{end})
9867 This function is used to flush the processor's instruction cache for
9868 the region of memory between @var{begin} inclusive and @var{end}
9869 exclusive.  Some targets require that the instruction cache be
9870 flushed, after modifying memory containing code, in order to obtain
9871 deterministic behavior.
9872
9873 If the target does not require instruction cache flushes,
9874 @code{__builtin___clear_cache} has no effect.  Otherwise either
9875 instructions are emitted in-line to clear the instruction cache or a
9876 call to the @code{__clear_cache} function in libgcc is made.
9877 @end deftypefn
9878
9879 @deftypefn {Built-in Function} void __builtin_prefetch (const void *@var{addr}, ...)
9880 This function is used to minimize cache-miss latency by moving data into
9881 a cache before it is accessed.
9882 You can insert calls to @code{__builtin_prefetch} into code for which
9883 you know addresses of data in memory that is likely to be accessed soon.
9884 If the target supports them, data prefetch instructions are generated.
9885 If the prefetch is done early enough before the access then the data will
9886 be in the cache by the time it is accessed.
9887
9888 The value of @var{addr} is the address of the memory to prefetch.
9889 There are two optional arguments, @var{rw} and @var{locality}.
9890 The value of @var{rw} is a compile-time constant one or zero; one
9891 means that the prefetch is preparing for a write to the memory address
9892 and zero, the default, means that the prefetch is preparing for a read.
9893 The value @var{locality} must be a compile-time constant integer between
9894 zero and three.  A value of zero means that the data has no temporal
9895 locality, so it need not be left in the cache after the access.  A value
9896 of three means that the data has a high degree of temporal locality and
9897 should be left in all levels of cache possible.  Values of one and two
9898 mean, respectively, a low or moderate degree of temporal locality.  The
9899 default is three.
9900
9901 @smallexample
9902 for (i = 0; i < n; i++)
9903   @{
9904     a[i] = a[i] + b[i];
9905     __builtin_prefetch (&a[i+j], 1, 1);
9906     __builtin_prefetch (&b[i+j], 0, 1);
9907     /* @r{@dots{}} */
9908   @}
9909 @end smallexample
9910
9911 Data prefetch does not generate faults if @var{addr} is invalid, but
9912 the address expression itself must be valid.  For example, a prefetch
9913 of @code{p->next} does not fault if @code{p->next} is not a valid
9914 address, but evaluation faults if @code{p} is not a valid address.
9915
9916 If the target does not support data prefetch, the address expression
9917 is evaluated if it includes side effects but no other code is generated
9918 and GCC does not issue a warning.
9919 @end deftypefn
9920
9921 @deftypefn {Built-in Function} double __builtin_huge_val (void)
9922 Returns a positive infinity, if supported by the floating-point format,
9923 else @code{DBL_MAX}.  This function is suitable for implementing the
9924 ISO C macro @code{HUGE_VAL}.
9925 @end deftypefn
9926
9927 @deftypefn {Built-in Function} float __builtin_huge_valf (void)
9928 Similar to @code{__builtin_huge_val}, except the return type is @code{float}.
9929 @end deftypefn
9930
9931 @deftypefn {Built-in Function} {long double} __builtin_huge_vall (void)
9932 Similar to @code{__builtin_huge_val}, except the return
9933 type is @code{long double}.
9934 @end deftypefn
9935
9936 @deftypefn {Built-in Function} int __builtin_fpclassify (int, int, int, int, int, ...)
9937 This built-in implements the C99 fpclassify functionality.  The first
9938 five int arguments should be the target library's notion of the
9939 possible FP classes and are used for return values.  They must be
9940 constant values and they must appear in this order: @code{FP_NAN},
9941 @code{FP_INFINITE}, @code{FP_NORMAL}, @code{FP_SUBNORMAL} and
9942 @code{FP_ZERO}.  The ellipsis is for exactly one floating-point value
9943 to classify.  GCC treats the last argument as type-generic, which
9944 means it does not do default promotion from float to double.
9945 @end deftypefn
9946
9947 @deftypefn {Built-in Function} double __builtin_inf (void)
9948 Similar to @code{__builtin_huge_val}, except a warning is generated
9949 if the target floating-point format does not support infinities.
9950 @end deftypefn
9951
9952 @deftypefn {Built-in Function} _Decimal32 __builtin_infd32 (void)
9953 Similar to @code{__builtin_inf}, except the return type is @code{_Decimal32}.
9954 @end deftypefn
9955
9956 @deftypefn {Built-in Function} _Decimal64 __builtin_infd64 (void)
9957 Similar to @code{__builtin_inf}, except the return type is @code{_Decimal64}.
9958 @end deftypefn
9959
9960 @deftypefn {Built-in Function} _Decimal128 __builtin_infd128 (void)
9961 Similar to @code{__builtin_inf}, except the return type is @code{_Decimal128}.
9962 @end deftypefn
9963
9964 @deftypefn {Built-in Function} float __builtin_inff (void)
9965 Similar to @code{__builtin_inf}, except the return type is @code{float}.
9966 This function is suitable for implementing the ISO C99 macro @code{INFINITY}.
9967 @end deftypefn
9968
9969 @deftypefn {Built-in Function} {long double} __builtin_infl (void)
9970 Similar to @code{__builtin_inf}, except the return
9971 type is @code{long double}.
9972 @end deftypefn
9973
9974 @deftypefn {Built-in Function} int __builtin_isinf_sign (...)
9975 Similar to @code{isinf}, except the return value is -1 for
9976 an argument of @code{-Inf} and 1 for an argument of @code{+Inf}.
9977 Note while the parameter list is an
9978 ellipsis, this function only accepts exactly one floating-point
9979 argument.  GCC treats this parameter as type-generic, which means it
9980 does not do default promotion from float to double.
9981 @end deftypefn
9982
9983 @deftypefn {Built-in Function} double __builtin_nan (const char *str)
9984 This is an implementation of the ISO C99 function @code{nan}.
9985
9986 Since ISO C99 defines this function in terms of @code{strtod}, which we
9987 do not implement, a description of the parsing is in order.  The string
9988 is parsed as by @code{strtol}; that is, the base is recognized by
9989 leading @samp{0} or @samp{0x} prefixes.  The number parsed is placed
9990 in the significand such that the least significant bit of the number
9991 is at the least significant bit of the significand.  The number is
9992 truncated to fit the significand field provided.  The significand is
9993 forced to be a quiet NaN@.
9994
9995 This function, if given a string literal all of which would have been
9996 consumed by @code{strtol}, is evaluated early enough that it is considered a
9997 compile-time constant.
9998 @end deftypefn
9999
10000 @deftypefn {Built-in Function} _Decimal32 __builtin_nand32 (const char *str)
10001 Similar to @code{__builtin_nan}, except the return type is @code{_Decimal32}.
10002 @end deftypefn
10003
10004 @deftypefn {Built-in Function} _Decimal64 __builtin_nand64 (const char *str)
10005 Similar to @code{__builtin_nan}, except the return type is @code{_Decimal64}.
10006 @end deftypefn
10007
10008 @deftypefn {Built-in Function} _Decimal128 __builtin_nand128 (const char *str)
10009 Similar to @code{__builtin_nan}, except the return type is @code{_Decimal128}.
10010 @end deftypefn
10011
10012 @deftypefn {Built-in Function} float __builtin_nanf (const char *str)
10013 Similar to @code{__builtin_nan}, except the return type is @code{float}.
10014 @end deftypefn
10015
10016 @deftypefn {Built-in Function} {long double} __builtin_nanl (const char *str)
10017 Similar to @code{__builtin_nan}, except the return type is @code{long double}.
10018 @end deftypefn
10019
10020 @deftypefn {Built-in Function} double __builtin_nans (const char *str)
10021 Similar to @code{__builtin_nan}, except the significand is forced
10022 to be a signaling NaN@.  The @code{nans} function is proposed by
10023 @uref{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n965.htm,,WG14 N965}.
10024 @end deftypefn
10025
10026 @deftypefn {Built-in Function} float __builtin_nansf (const char *str)
10027 Similar to @code{__builtin_nans}, except the return type is @code{float}.
10028 @end deftypefn
10029
10030 @deftypefn {Built-in Function} {long double} __builtin_nansl (const char *str)
10031 Similar to @code{__builtin_nans}, except the return type is @code{long double}.
10032 @end deftypefn
10033
10034 @deftypefn {Built-in Function} int __builtin_ffs (int x)
10035 Returns one plus the index of the least significant 1-bit of @var{x}, or
10036 if @var{x} is zero, returns zero.
10037 @end deftypefn
10038
10039 @deftypefn {Built-in Function} int __builtin_clz (unsigned int x)
10040 Returns the number of leading 0-bits in @var{x}, starting at the most
10041 significant bit position.  If @var{x} is 0, the result is undefined.
10042 @end deftypefn
10043
10044 @deftypefn {Built-in Function} int __builtin_ctz (unsigned int x)
10045 Returns the number of trailing 0-bits in @var{x}, starting at the least
10046 significant bit position.  If @var{x} is 0, the result is undefined.
10047 @end deftypefn
10048
10049 @deftypefn {Built-in Function} int __builtin_clrsb (int x)
10050 Returns the number of leading redundant sign bits in @var{x}, i.e.@: the
10051 number of bits following the most significant bit that are identical
10052 to it.  There are no special cases for 0 or other values. 
10053 @end deftypefn
10054
10055 @deftypefn {Built-in Function} int __builtin_popcount (unsigned int x)
10056 Returns the number of 1-bits in @var{x}.
10057 @end deftypefn
10058
10059 @deftypefn {Built-in Function} int __builtin_parity (unsigned int x)
10060 Returns the parity of @var{x}, i.e.@: the number of 1-bits in @var{x}
10061 modulo 2.
10062 @end deftypefn
10063
10064 @deftypefn {Built-in Function} int __builtin_ffsl (long)
10065 Similar to @code{__builtin_ffs}, except the argument type is
10066 @code{long}.
10067 @end deftypefn
10068
10069 @deftypefn {Built-in Function} int __builtin_clzl (unsigned long)
10070 Similar to @code{__builtin_clz}, except the argument type is
10071 @code{unsigned long}.
10072 @end deftypefn
10073
10074 @deftypefn {Built-in Function} int __builtin_ctzl (unsigned long)
10075 Similar to @code{__builtin_ctz}, except the argument type is
10076 @code{unsigned long}.
10077 @end deftypefn
10078
10079 @deftypefn {Built-in Function} int __builtin_clrsbl (long)
10080 Similar to @code{__builtin_clrsb}, except the argument type is
10081 @code{long}.
10082 @end deftypefn
10083
10084 @deftypefn {Built-in Function} int __builtin_popcountl (unsigned long)
10085 Similar to @code{__builtin_popcount}, except the argument type is
10086 @code{unsigned long}.
10087 @end deftypefn
10088
10089 @deftypefn {Built-in Function} int __builtin_parityl (unsigned long)
10090 Similar to @code{__builtin_parity}, except the argument type is
10091 @code{unsigned long}.
10092 @end deftypefn
10093
10094 @deftypefn {Built-in Function} int __builtin_ffsll (long long)
10095 Similar to @code{__builtin_ffs}, except the argument type is
10096 @code{long long}.
10097 @end deftypefn
10098
10099 @deftypefn {Built-in Function} int __builtin_clzll (unsigned long long)
10100 Similar to @code{__builtin_clz}, except the argument type is
10101 @code{unsigned long long}.
10102 @end deftypefn
10103
10104 @deftypefn {Built-in Function} int __builtin_ctzll (unsigned long long)
10105 Similar to @code{__builtin_ctz}, except the argument type is
10106 @code{unsigned long long}.
10107 @end deftypefn
10108
10109 @deftypefn {Built-in Function} int __builtin_clrsbll (long long)
10110 Similar to @code{__builtin_clrsb}, except the argument type is
10111 @code{long long}.
10112 @end deftypefn
10113
10114 @deftypefn {Built-in Function} int __builtin_popcountll (unsigned long long)
10115 Similar to @code{__builtin_popcount}, except the argument type is
10116 @code{unsigned long long}.
10117 @end deftypefn
10118
10119 @deftypefn {Built-in Function} int __builtin_parityll (unsigned long long)
10120 Similar to @code{__builtin_parity}, except the argument type is
10121 @code{unsigned long long}.
10122 @end deftypefn
10123
10124 @deftypefn {Built-in Function} double __builtin_powi (double, int)
10125 Returns the first argument raised to the power of the second.  Unlike the
10126 @code{pow} function no guarantees about precision and rounding are made.
10127 @end deftypefn
10128
10129 @deftypefn {Built-in Function} float __builtin_powif (float, int)
10130 Similar to @code{__builtin_powi}, except the argument and return types
10131 are @code{float}.
10132 @end deftypefn
10133
10134 @deftypefn {Built-in Function} {long double} __builtin_powil (long double, int)
10135 Similar to @code{__builtin_powi}, except the argument and return types
10136 are @code{long double}.
10137 @end deftypefn
10138
10139 @deftypefn {Built-in Function} uint16_t __builtin_bswap16 (uint16_t x)
10140 Returns @var{x} with the order of the bytes reversed; for example,
10141 @code{0xaabb} becomes @code{0xbbaa}.  Byte here always means
10142 exactly 8 bits.
10143 @end deftypefn
10144
10145 @deftypefn {Built-in Function} uint32_t __builtin_bswap32 (uint32_t x)
10146 Similar to @code{__builtin_bswap16}, except the argument and return types
10147 are 32 bit.
10148 @end deftypefn
10149
10150 @deftypefn {Built-in Function} uint64_t __builtin_bswap64 (uint64_t x)
10151 Similar to @code{__builtin_bswap32}, except the argument and return types
10152 are 64 bit.
10153 @end deftypefn
10154
10155 @node Target Builtins
10156 @section Built-in Functions Specific to Particular Target Machines
10157
10158 On some target machines, GCC supports many built-in functions specific
10159 to those machines.  Generally these generate calls to specific machine
10160 instructions, but allow the compiler to schedule those calls.
10161
10162 @menu
10163 * AArch64 Built-in Functions::
10164 * Alpha Built-in Functions::
10165 * Altera Nios II Built-in Functions::
10166 * ARC Built-in Functions::
10167 * ARC SIMD Built-in Functions::
10168 * ARM iWMMXt Built-in Functions::
10169 * ARM C Language Extensions (ACLE)::
10170 * ARM Floating Point Status and Control Intrinsics::
10171 * AVR Built-in Functions::
10172 * Blackfin Built-in Functions::
10173 * FR-V Built-in Functions::
10174 * MIPS DSP Built-in Functions::
10175 * MIPS Paired-Single Support::
10176 * MIPS Loongson Built-in Functions::
10177 * Other MIPS Built-in Functions::
10178 * MSP430 Built-in Functions::
10179 * NDS32 Built-in Functions::
10180 * picoChip Built-in Functions::
10181 * PowerPC Built-in Functions::
10182 * PowerPC AltiVec/VSX Built-in Functions::
10183 * PowerPC Hardware Transactional Memory Built-in Functions::
10184 * RX Built-in Functions::
10185 * S/390 System z Built-in Functions::
10186 * SH Built-in Functions::
10187 * SPARC VIS Built-in Functions::
10188 * SPU Built-in Functions::
10189 * TI C6X Built-in Functions::
10190 * TILE-Gx Built-in Functions::
10191 * TILEPro Built-in Functions::
10192 * x86 Built-in Functions::
10193 * x86 transactional memory intrinsics::
10194 @end menu
10195
10196 @node AArch64 Built-in Functions
10197 @subsection AArch64 Built-in Functions
10198
10199 These built-in functions are available for the AArch64 family of
10200 processors.
10201 @smallexample
10202 unsigned int __builtin_aarch64_get_fpcr ()
10203 void __builtin_aarch64_set_fpcr (unsigned int)
10204 unsigned int __builtin_aarch64_get_fpsr ()
10205 void __builtin_aarch64_set_fpsr (unsigned int)
10206 @end smallexample
10207
10208 @node Alpha Built-in Functions
10209 @subsection Alpha Built-in Functions
10210
10211 These built-in functions are available for the Alpha family of
10212 processors, depending on the command-line switches used.
10213
10214 The following built-in functions are always available.  They
10215 all generate the machine instruction that is part of the name.
10216
10217 @smallexample
10218 long __builtin_alpha_implver (void)
10219 long __builtin_alpha_rpcc (void)
10220 long __builtin_alpha_amask (long)
10221 long __builtin_alpha_cmpbge (long, long)
10222 long __builtin_alpha_extbl (long, long)
10223 long __builtin_alpha_extwl (long, long)
10224 long __builtin_alpha_extll (long, long)
10225 long __builtin_alpha_extql (long, long)
10226 long __builtin_alpha_extwh (long, long)
10227 long __builtin_alpha_extlh (long, long)
10228 long __builtin_alpha_extqh (long, long)
10229 long __builtin_alpha_insbl (long, long)
10230 long __builtin_alpha_inswl (long, long)
10231 long __builtin_alpha_insll (long, long)
10232 long __builtin_alpha_insql (long, long)
10233 long __builtin_alpha_inswh (long, long)
10234 long __builtin_alpha_inslh (long, long)
10235 long __builtin_alpha_insqh (long, long)
10236 long __builtin_alpha_mskbl (long, long)
10237 long __builtin_alpha_mskwl (long, long)
10238 long __builtin_alpha_mskll (long, long)
10239 long __builtin_alpha_mskql (long, long)
10240 long __builtin_alpha_mskwh (long, long)
10241 long __builtin_alpha_msklh (long, long)
10242 long __builtin_alpha_mskqh (long, long)
10243 long __builtin_alpha_umulh (long, long)
10244 long __builtin_alpha_zap (long, long)
10245 long __builtin_alpha_zapnot (long, long)
10246 @end smallexample
10247
10248 The following built-in functions are always with @option{-mmax}
10249 or @option{-mcpu=@var{cpu}} where @var{cpu} is @code{pca56} or
10250 later.  They all generate the machine instruction that is part
10251 of the name.
10252
10253 @smallexample
10254 long __builtin_alpha_pklb (long)
10255 long __builtin_alpha_pkwb (long)
10256 long __builtin_alpha_unpkbl (long)
10257 long __builtin_alpha_unpkbw (long)
10258 long __builtin_alpha_minub8 (long, long)
10259 long __builtin_alpha_minsb8 (long, long)
10260 long __builtin_alpha_minuw4 (long, long)
10261 long __builtin_alpha_minsw4 (long, long)
10262 long __builtin_alpha_maxub8 (long, long)
10263 long __builtin_alpha_maxsb8 (long, long)
10264 long __builtin_alpha_maxuw4 (long, long)
10265 long __builtin_alpha_maxsw4 (long, long)
10266 long __builtin_alpha_perr (long, long)
10267 @end smallexample
10268
10269 The following built-in functions are always with @option{-mcix}
10270 or @option{-mcpu=@var{cpu}} where @var{cpu} is @code{ev67} or
10271 later.  They all generate the machine instruction that is part
10272 of the name.
10273
10274 @smallexample
10275 long __builtin_alpha_cttz (long)
10276 long __builtin_alpha_ctlz (long)
10277 long __builtin_alpha_ctpop (long)
10278 @end smallexample
10279
10280 The following built-in functions are available on systems that use the OSF/1
10281 PALcode.  Normally they invoke the @code{rduniq} and @code{wruniq}
10282 PAL calls, but when invoked with @option{-mtls-kernel}, they invoke
10283 @code{rdval} and @code{wrval}.
10284
10285 @smallexample
10286 void *__builtin_thread_pointer (void)
10287 void __builtin_set_thread_pointer (void *)
10288 @end smallexample
10289
10290 @node Altera Nios II Built-in Functions
10291 @subsection Altera Nios II Built-in Functions
10292
10293 These built-in functions are available for the Altera Nios II
10294 family of processors.
10295
10296 The following built-in functions are always available.  They
10297 all generate the machine instruction that is part of the name.
10298
10299 @example
10300 int __builtin_ldbio (volatile const void *)
10301 int __builtin_ldbuio (volatile const void *)
10302 int __builtin_ldhio (volatile const void *)
10303 int __builtin_ldhuio (volatile const void *)
10304 int __builtin_ldwio (volatile const void *)
10305 void __builtin_stbio (volatile void *, int)
10306 void __builtin_sthio (volatile void *, int)
10307 void __builtin_stwio (volatile void *, int)
10308 void __builtin_sync (void)
10309 int __builtin_rdctl (int) 
10310 void __builtin_wrctl (int, int)
10311 @end example
10312
10313 The following built-in functions are always available.  They
10314 all generate a Nios II Custom Instruction. The name of the
10315 function represents the types that the function takes and
10316 returns. The letter before the @code{n} is the return type
10317 or void if absent. The @code{n} represents the first parameter
10318 to all the custom instructions, the custom instruction number.
10319 The two letters after the @code{n} represent the up to two
10320 parameters to the function.
10321
10322 The letters represent the following data types:
10323 @table @code
10324 @item <no letter>
10325 @code{void} for return type and no parameter for parameter types.
10326
10327 @item i
10328 @code{int} for return type and parameter type
10329
10330 @item f
10331 @code{float} for return type and parameter type
10332
10333 @item p
10334 @code{void *} for return type and parameter type
10335
10336 @end table
10337
10338 And the function names are:
10339 @example
10340 void __builtin_custom_n (void)
10341 void __builtin_custom_ni (int)
10342 void __builtin_custom_nf (float)
10343 void __builtin_custom_np (void *)
10344 void __builtin_custom_nii (int, int)
10345 void __builtin_custom_nif (int, float)
10346 void __builtin_custom_nip (int, void *)
10347 void __builtin_custom_nfi (float, int)
10348 void __builtin_custom_nff (float, float)
10349 void __builtin_custom_nfp (float, void *)
10350 void __builtin_custom_npi (void *, int)
10351 void __builtin_custom_npf (void *, float)
10352 void __builtin_custom_npp (void *, void *)
10353 int __builtin_custom_in (void)
10354 int __builtin_custom_ini (int)
10355 int __builtin_custom_inf (float)
10356 int __builtin_custom_inp (void *)
10357 int __builtin_custom_inii (int, int)
10358 int __builtin_custom_inif (int, float)
10359 int __builtin_custom_inip (int, void *)
10360 int __builtin_custom_infi (float, int)
10361 int __builtin_custom_inff (float, float)
10362 int __builtin_custom_infp (float, void *)
10363 int __builtin_custom_inpi (void *, int)
10364 int __builtin_custom_inpf (void *, float)
10365 int __builtin_custom_inpp (void *, void *)
10366 float __builtin_custom_fn (void)
10367 float __builtin_custom_fni (int)
10368 float __builtin_custom_fnf (float)
10369 float __builtin_custom_fnp (void *)
10370 float __builtin_custom_fnii (int, int)
10371 float __builtin_custom_fnif (int, float)
10372 float __builtin_custom_fnip (int, void *)
10373 float __builtin_custom_fnfi (float, int)
10374 float __builtin_custom_fnff (float, float)
10375 float __builtin_custom_fnfp (float, void *)
10376 float __builtin_custom_fnpi (void *, int)
10377 float __builtin_custom_fnpf (void *, float)
10378 float __builtin_custom_fnpp (void *, void *)
10379 void * __builtin_custom_pn (void)
10380 void * __builtin_custom_pni (int)
10381 void * __builtin_custom_pnf (float)
10382 void * __builtin_custom_pnp (void *)
10383 void * __builtin_custom_pnii (int, int)
10384 void * __builtin_custom_pnif (int, float)
10385 void * __builtin_custom_pnip (int, void *)
10386 void * __builtin_custom_pnfi (float, int)
10387 void * __builtin_custom_pnff (float, float)
10388 void * __builtin_custom_pnfp (float, void *)
10389 void * __builtin_custom_pnpi (void *, int)
10390 void * __builtin_custom_pnpf (void *, float)
10391 void * __builtin_custom_pnpp (void *, void *)
10392 @end example
10393
10394 @node ARC Built-in Functions
10395 @subsection ARC Built-in Functions
10396
10397 The following built-in functions are provided for ARC targets.  The
10398 built-ins generate the corresponding assembly instructions.  In the
10399 examples given below, the generated code often requires an operand or
10400 result to be in a register.  Where necessary further code will be
10401 generated to ensure this is true, but for brevity this is not
10402 described in each case.
10403
10404 @emph{Note:} Using a built-in to generate an instruction not supported
10405 by a target may cause problems. At present the compiler is not
10406 guaranteed to detect such misuse, and as a result an internal compiler
10407 error may be generated.
10408
10409 @deftypefn {Built-in Function} int __builtin_arc_aligned (void *@var{val}, int @var{alignval})
10410 Return 1 if @var{val} is known to have the byte alignment given
10411 by @var{alignval}, otherwise return 0.
10412 Note that this is different from
10413 @smallexample
10414 __alignof__(*(char *)@var{val}) >= alignval
10415 @end smallexample
10416 because __alignof__ sees only the type of the dereference, whereas
10417 __builtin_arc_align uses alignment information from the pointer
10418 as well as from the pointed-to type.
10419 The information available will depend on optimization level.
10420 @end deftypefn
10421
10422 @deftypefn {Built-in Function} void __builtin_arc_brk (void)
10423 Generates
10424 @example
10425 brk
10426 @end example
10427 @end deftypefn
10428
10429 @deftypefn {Built-in Function} {unsigned int} __builtin_arc_core_read (unsigned int @var{regno})
10430 The operand is the number of a register to be read.  Generates:
10431 @example
10432 mov  @var{dest}, r@var{regno}
10433 @end example
10434 where the value in @var{dest} will be the result returned from the
10435 built-in.
10436 @end deftypefn
10437
10438 @deftypefn {Built-in Function} void __builtin_arc_core_write (unsigned int @var{regno}, unsigned int @var{val})
10439 The first operand is the number of a register to be written, the
10440 second operand is a compile time constant to write into that
10441 register.  Generates:
10442 @example
10443 mov  r@var{regno}, @var{val}
10444 @end example
10445 @end deftypefn
10446
10447 @deftypefn {Built-in Function} int __builtin_arc_divaw (int @var{a}, int @var{b})
10448 Only available if either @option{-mcpu=ARC700} or @option{-meA} is set.
10449 Generates:
10450 @example
10451 divaw  @var{dest}, @var{a}, @var{b}
10452 @end example
10453 where the value in @var{dest} will be the result returned from the
10454 built-in.
10455 @end deftypefn
10456
10457 @deftypefn {Built-in Function} void __builtin_arc_flag (unsigned int @var{a})
10458 Generates
10459 @example
10460 flag  @var{a}
10461 @end example
10462 @end deftypefn
10463
10464 @deftypefn {Built-in Function} {unsigned int} __builtin_arc_lr (unsigned int @var{auxr})
10465 The operand, @var{auxv}, is the address of an auxiliary register and
10466 must be a compile time constant.  Generates:
10467 @example
10468 lr  @var{dest}, [@var{auxr}]
10469 @end example
10470 Where the value in @var{dest} will be the result returned from the
10471 built-in.
10472 @end deftypefn
10473
10474 @deftypefn {Built-in Function} void __builtin_arc_mul64 (int @var{a}, int @var{b})
10475 Only available with @option{-mmul64}.  Generates:
10476 @example
10477 mul64  @var{a}, @var{b}
10478 @end example
10479 @end deftypefn
10480
10481 @deftypefn {Built-in Function} void __builtin_arc_mulu64 (unsigned int @var{a}, unsigned int @var{b})
10482 Only available with @option{-mmul64}.  Generates:
10483 @example
10484 mulu64  @var{a}, @var{b}
10485 @end example
10486 @end deftypefn
10487
10488 @deftypefn {Built-in Function} void __builtin_arc_nop (void)
10489 Generates:
10490 @example
10491 nop
10492 @end example
10493 @end deftypefn
10494
10495 @deftypefn {Built-in Function} int __builtin_arc_norm (int @var{src})
10496 Only valid if the @samp{norm} instruction is available through the
10497 @option{-mnorm} option or by default with @option{-mcpu=ARC700}.
10498 Generates:
10499 @example
10500 norm  @var{dest}, @var{src}
10501 @end example
10502 Where the value in @var{dest} will be the result returned from the
10503 built-in.
10504 @end deftypefn
10505
10506 @deftypefn {Built-in Function}  {short int} __builtin_arc_normw (short int @var{src})
10507 Only valid if the @samp{normw} instruction is available through the
10508 @option{-mnorm} option or by default with @option{-mcpu=ARC700}.
10509 Generates:
10510 @example
10511 normw  @var{dest}, @var{src}
10512 @end example
10513 Where the value in @var{dest} will be the result returned from the
10514 built-in.
10515 @end deftypefn
10516
10517 @deftypefn {Built-in Function}  void __builtin_arc_rtie (void)
10518 Generates:
10519 @example
10520 rtie
10521 @end example
10522 @end deftypefn
10523
10524 @deftypefn {Built-in Function}  void __builtin_arc_sleep (int @var{a}
10525 Generates:
10526 @example
10527 sleep  @var{a}
10528 @end example
10529 @end deftypefn
10530
10531 @deftypefn {Built-in Function}  void __builtin_arc_sr (unsigned int @var{auxr}, unsigned int @var{val})
10532 The first argument, @var{auxv}, is the address of an auxiliary
10533 register, the second argument, @var{val}, is a compile time constant
10534 to be written to the register.  Generates:
10535 @example
10536 sr  @var{auxr}, [@var{val}]
10537 @end example
10538 @end deftypefn
10539
10540 @deftypefn {Built-in Function}  int __builtin_arc_swap (int @var{src})
10541 Only valid with @option{-mswap}.  Generates:
10542 @example
10543 swap  @var{dest}, @var{src}
10544 @end example
10545 Where the value in @var{dest} will be the result returned from the
10546 built-in.
10547 @end deftypefn
10548
10549 @deftypefn {Built-in Function}  void __builtin_arc_swi (void)
10550 Generates:
10551 @example
10552 swi
10553 @end example
10554 @end deftypefn
10555
10556 @deftypefn {Built-in Function}  void __builtin_arc_sync (void)
10557 Only available with @option{-mcpu=ARC700}.  Generates:
10558 @example
10559 sync
10560 @end example
10561 @end deftypefn
10562
10563 @deftypefn {Built-in Function}  void __builtin_arc_trap_s (unsigned int @var{c})
10564 Only available with @option{-mcpu=ARC700}.  Generates:
10565 @example
10566 trap_s  @var{c}
10567 @end example
10568 @end deftypefn
10569
10570 @deftypefn {Built-in Function}  void __builtin_arc_unimp_s (void)
10571 Only available with @option{-mcpu=ARC700}.  Generates:
10572 @example
10573 unimp_s
10574 @end example
10575 @end deftypefn
10576
10577 The instructions generated by the following builtins are not
10578 considered as candidates for scheduling.  They are not moved around by
10579 the compiler during scheduling, and thus can be expected to appear
10580 where they are put in the C code:
10581 @example
10582 __builtin_arc_brk()
10583 __builtin_arc_core_read()
10584 __builtin_arc_core_write()
10585 __builtin_arc_flag()
10586 __builtin_arc_lr()
10587 __builtin_arc_sleep()
10588 __builtin_arc_sr()
10589 __builtin_arc_swi()
10590 @end example
10591
10592 @node ARC SIMD Built-in Functions
10593 @subsection ARC SIMD Built-in Functions
10594
10595 SIMD builtins provided by the compiler can be used to generate the
10596 vector instructions.  This section describes the available builtins
10597 and their usage in programs.  With the @option{-msimd} option, the
10598 compiler provides 128-bit vector types, which can be specified using
10599 the @code{vector_size} attribute.  The header file @file{arc-simd.h}
10600 can be included to use the following predefined types:
10601 @example
10602 typedef int __v4si   __attribute__((vector_size(16)));
10603 typedef short __v8hi __attribute__((vector_size(16)));
10604 @end example
10605
10606 These types can be used to define 128-bit variables.  The built-in
10607 functions listed in the following section can be used on these
10608 variables to generate the vector operations.
10609
10610 For all builtins, @code{__builtin_arc_@var{someinsn}}, the header file
10611 @file{arc-simd.h} also provides equivalent macros called
10612 @code{_@var{someinsn}} that can be used for programming ease and
10613 improved readability.  The following macros for DMA control are also
10614 provided:
10615 @example
10616 #define _setup_dma_in_channel_reg _vdiwr
10617 #define _setup_dma_out_channel_reg _vdowr
10618 @end example
10619
10620 The following is a complete list of all the SIMD built-ins provided
10621 for ARC, grouped by calling signature.
10622
10623 The following take two @code{__v8hi} arguments and return a
10624 @code{__v8hi} result:
10625 @example
10626 __v8hi __builtin_arc_vaddaw (__v8hi, __v8hi)
10627 __v8hi __builtin_arc_vaddw (__v8hi, __v8hi)
10628 __v8hi __builtin_arc_vand (__v8hi, __v8hi)
10629 __v8hi __builtin_arc_vandaw (__v8hi, __v8hi)
10630 __v8hi __builtin_arc_vavb (__v8hi, __v8hi)
10631 __v8hi __builtin_arc_vavrb (__v8hi, __v8hi)
10632 __v8hi __builtin_arc_vbic (__v8hi, __v8hi)
10633 __v8hi __builtin_arc_vbicaw (__v8hi, __v8hi)
10634 __v8hi __builtin_arc_vdifaw (__v8hi, __v8hi)
10635 __v8hi __builtin_arc_vdifw (__v8hi, __v8hi)
10636 __v8hi __builtin_arc_veqw (__v8hi, __v8hi)
10637 __v8hi __builtin_arc_vh264f (__v8hi, __v8hi)
10638 __v8hi __builtin_arc_vh264ft (__v8hi, __v8hi)
10639 __v8hi __builtin_arc_vh264fw (__v8hi, __v8hi)
10640 __v8hi __builtin_arc_vlew (__v8hi, __v8hi)
10641 __v8hi __builtin_arc_vltw (__v8hi, __v8hi)
10642 __v8hi __builtin_arc_vmaxaw (__v8hi, __v8hi)
10643 __v8hi __builtin_arc_vmaxw (__v8hi, __v8hi)
10644 __v8hi __builtin_arc_vminaw (__v8hi, __v8hi)
10645 __v8hi __builtin_arc_vminw (__v8hi, __v8hi)
10646 __v8hi __builtin_arc_vmr1aw (__v8hi, __v8hi)
10647 __v8hi __builtin_arc_vmr1w (__v8hi, __v8hi)
10648 __v8hi __builtin_arc_vmr2aw (__v8hi, __v8hi)
10649 __v8hi __builtin_arc_vmr2w (__v8hi, __v8hi)
10650 __v8hi __builtin_arc_vmr3aw (__v8hi, __v8hi)
10651 __v8hi __builtin_arc_vmr3w (__v8hi, __v8hi)
10652 __v8hi __builtin_arc_vmr4aw (__v8hi, __v8hi)
10653 __v8hi __builtin_arc_vmr4w (__v8hi, __v8hi)
10654 __v8hi __builtin_arc_vmr5aw (__v8hi, __v8hi)
10655 __v8hi __builtin_arc_vmr5w (__v8hi, __v8hi)
10656 __v8hi __builtin_arc_vmr6aw (__v8hi, __v8hi)
10657 __v8hi __builtin_arc_vmr6w (__v8hi, __v8hi)
10658 __v8hi __builtin_arc_vmr7aw (__v8hi, __v8hi)
10659 __v8hi __builtin_arc_vmr7w (__v8hi, __v8hi)
10660 __v8hi __builtin_arc_vmrb (__v8hi, __v8hi)
10661 __v8hi __builtin_arc_vmulaw (__v8hi, __v8hi)
10662 __v8hi __builtin_arc_vmulfaw (__v8hi, __v8hi)
10663 __v8hi __builtin_arc_vmulfw (__v8hi, __v8hi)
10664 __v8hi __builtin_arc_vmulw (__v8hi, __v8hi)
10665 __v8hi __builtin_arc_vnew (__v8hi, __v8hi)
10666 __v8hi __builtin_arc_vor (__v8hi, __v8hi)
10667 __v8hi __builtin_arc_vsubaw (__v8hi, __v8hi)
10668 __v8hi __builtin_arc_vsubw (__v8hi, __v8hi)
10669 __v8hi __builtin_arc_vsummw (__v8hi, __v8hi)
10670 __v8hi __builtin_arc_vvc1f (__v8hi, __v8hi)
10671 __v8hi __builtin_arc_vvc1ft (__v8hi, __v8hi)
10672 __v8hi __builtin_arc_vxor (__v8hi, __v8hi)
10673 __v8hi __builtin_arc_vxoraw (__v8hi, __v8hi)
10674 @end example
10675
10676 The following take one @code{__v8hi} and one @code{int} argument and return a
10677 @code{__v8hi} result:
10678
10679 @example
10680 __v8hi __builtin_arc_vbaddw (__v8hi, int)
10681 __v8hi __builtin_arc_vbmaxw (__v8hi, int)
10682 __v8hi __builtin_arc_vbminw (__v8hi, int)
10683 __v8hi __builtin_arc_vbmulaw (__v8hi, int)
10684 __v8hi __builtin_arc_vbmulfw (__v8hi, int)
10685 __v8hi __builtin_arc_vbmulw (__v8hi, int)
10686 __v8hi __builtin_arc_vbrsubw (__v8hi, int)
10687 __v8hi __builtin_arc_vbsubw (__v8hi, int)
10688 @end example
10689
10690 The following take one @code{__v8hi} argument and one @code{int} argument which
10691 must be a 3-bit compile time constant indicating a register number
10692 I0-I7.  They return a @code{__v8hi} result.
10693 @example
10694 __v8hi __builtin_arc_vasrw (__v8hi, const int)
10695 __v8hi __builtin_arc_vsr8 (__v8hi, const int)
10696 __v8hi __builtin_arc_vsr8aw (__v8hi, const int)
10697 @end example
10698
10699 The following take one @code{__v8hi} argument and one @code{int}
10700 argument which must be a 6-bit compile time constant.  They return a
10701 @code{__v8hi} result.
10702 @example
10703 __v8hi __builtin_arc_vasrpwbi (__v8hi, const int)
10704 __v8hi __builtin_arc_vasrrpwbi (__v8hi, const int)
10705 __v8hi __builtin_arc_vasrrwi (__v8hi, const int)
10706 __v8hi __builtin_arc_vasrsrwi (__v8hi, const int)
10707 __v8hi __builtin_arc_vasrwi (__v8hi, const int)
10708 __v8hi __builtin_arc_vsr8awi (__v8hi, const int)
10709 __v8hi __builtin_arc_vsr8i (__v8hi, const int)
10710 @end example
10711
10712 The following take one @code{__v8hi} argument and one @code{int} argument which
10713 must be a 8-bit compile time constant.  They return a @code{__v8hi}
10714 result.
10715 @example
10716 __v8hi __builtin_arc_vd6tapf (__v8hi, const int)
10717 __v8hi __builtin_arc_vmvaw (__v8hi, const int)
10718 __v8hi __builtin_arc_vmvw (__v8hi, const int)
10719 __v8hi __builtin_arc_vmvzw (__v8hi, const int)
10720 @end example
10721
10722 The following take two @code{int} arguments, the second of which which
10723 must be a 8-bit compile time constant.  They return a @code{__v8hi}
10724 result:
10725 @example
10726 __v8hi __builtin_arc_vmovaw (int, const int)
10727 __v8hi __builtin_arc_vmovw (int, const int)
10728 __v8hi __builtin_arc_vmovzw (int, const int)
10729 @end example
10730
10731 The following take a single @code{__v8hi} argument and return a
10732 @code{__v8hi} result:
10733 @example
10734 __v8hi __builtin_arc_vabsaw (__v8hi)
10735 __v8hi __builtin_arc_vabsw (__v8hi)
10736 __v8hi __builtin_arc_vaddsuw (__v8hi)
10737 __v8hi __builtin_arc_vexch1 (__v8hi)
10738 __v8hi __builtin_arc_vexch2 (__v8hi)
10739 __v8hi __builtin_arc_vexch4 (__v8hi)
10740 __v8hi __builtin_arc_vsignw (__v8hi)
10741 __v8hi __builtin_arc_vupbaw (__v8hi)
10742 __v8hi __builtin_arc_vupbw (__v8hi)
10743 __v8hi __builtin_arc_vupsbaw (__v8hi)
10744 __v8hi __builtin_arc_vupsbw (__v8hi)
10745 @end example
10746
10747 The followign take two @code{int} arguments and return no result:
10748 @example
10749 void __builtin_arc_vdirun (int, int)
10750 void __builtin_arc_vdorun (int, int)
10751 @end example
10752
10753 The following take two @code{int} arguments and return no result.  The
10754 first argument must a 3-bit compile time constant indicating one of
10755 the DR0-DR7 DMA setup channels:
10756 @example
10757 void __builtin_arc_vdiwr (const int, int)
10758 void __builtin_arc_vdowr (const int, int)
10759 @end example
10760
10761 The following take an @code{int} argument and return no result:
10762 @example
10763 void __builtin_arc_vendrec (int)
10764 void __builtin_arc_vrec (int)
10765 void __builtin_arc_vrecrun (int)
10766 void __builtin_arc_vrun (int)
10767 @end example
10768
10769 The following take a @code{__v8hi} argument and two @code{int}
10770 arguments and return a @code{__v8hi} result.  The second argument must
10771 be a 3-bit compile time constants, indicating one the registers I0-I7,
10772 and the third argument must be an 8-bit compile time constant.
10773
10774 @emph{Note:} Although the equivalent hardware instructions do not take
10775 an SIMD register as an operand, these builtins overwrite the relevant
10776 bits of the @code{__v8hi} register provided as the first argument with
10777 the value loaded from the @code{[Ib, u8]} location in the SDM.
10778
10779 @example
10780 __v8hi __builtin_arc_vld32 (__v8hi, const int, const int)
10781 __v8hi __builtin_arc_vld32wh (__v8hi, const int, const int)
10782 __v8hi __builtin_arc_vld32wl (__v8hi, const int, const int)
10783 __v8hi __builtin_arc_vld64 (__v8hi, const int, const int)
10784 @end example
10785
10786 The following take two @code{int} arguments and return a @code{__v8hi}
10787 result.  The first argument must be a 3-bit compile time constants,
10788 indicating one the registers I0-I7, and the second argument must be an
10789 8-bit compile time constant.
10790
10791 @example
10792 __v8hi __builtin_arc_vld128 (const int, const int)
10793 __v8hi __builtin_arc_vld64w (const int, const int)
10794 @end example
10795
10796 The following take a @code{__v8hi} argument and two @code{int}
10797 arguments and return no result.  The second argument must be a 3-bit
10798 compile time constants, indicating one the registers I0-I7, and the
10799 third argument must be an 8-bit compile time constant.
10800
10801 @example
10802 void __builtin_arc_vst128 (__v8hi, const int, const int)
10803 void __builtin_arc_vst64 (__v8hi, const int, const int)
10804 @end example
10805
10806 The following take a @code{__v8hi} argument and three @code{int}
10807 arguments and return no result.  The second argument must be a 3-bit
10808 compile-time constant, identifying the 16-bit sub-register to be
10809 stored, the third argument must be a 3-bit compile time constants,
10810 indicating one the registers I0-I7, and the fourth argument must be an
10811 8-bit compile time constant.
10812
10813 @example
10814 void __builtin_arc_vst16_n (__v8hi, const int, const int, const int)
10815 void __builtin_arc_vst32_n (__v8hi, const int, const int, const int)
10816 @end example
10817
10818 @node ARM iWMMXt Built-in Functions
10819 @subsection ARM iWMMXt Built-in Functions
10820
10821 These built-in functions are available for the ARM family of
10822 processors when the @option{-mcpu=iwmmxt} switch is used:
10823
10824 @smallexample
10825 typedef int v2si __attribute__ ((vector_size (8)));
10826 typedef short v4hi __attribute__ ((vector_size (8)));
10827 typedef char v8qi __attribute__ ((vector_size (8)));
10828
10829 int __builtin_arm_getwcgr0 (void)
10830 void __builtin_arm_setwcgr0 (int)
10831 int __builtin_arm_getwcgr1 (void)
10832 void __builtin_arm_setwcgr1 (int)
10833 int __builtin_arm_getwcgr2 (void)
10834 void __builtin_arm_setwcgr2 (int)
10835 int __builtin_arm_getwcgr3 (void)
10836 void __builtin_arm_setwcgr3 (int)
10837 int __builtin_arm_textrmsb (v8qi, int)
10838 int __builtin_arm_textrmsh (v4hi, int)
10839 int __builtin_arm_textrmsw (v2si, int)
10840 int __builtin_arm_textrmub (v8qi, int)
10841 int __builtin_arm_textrmuh (v4hi, int)
10842 int __builtin_arm_textrmuw (v2si, int)
10843 v8qi __builtin_arm_tinsrb (v8qi, int, int)
10844 v4hi __builtin_arm_tinsrh (v4hi, int, int)
10845 v2si __builtin_arm_tinsrw (v2si, int, int)
10846 long long __builtin_arm_tmia (long long, int, int)
10847 long long __builtin_arm_tmiabb (long long, int, int)
10848 long long __builtin_arm_tmiabt (long long, int, int)
10849 long long __builtin_arm_tmiaph (long long, int, int)
10850 long long __builtin_arm_tmiatb (long long, int, int)
10851 long long __builtin_arm_tmiatt (long long, int, int)
10852 int __builtin_arm_tmovmskb (v8qi)
10853 int __builtin_arm_tmovmskh (v4hi)
10854 int __builtin_arm_tmovmskw (v2si)
10855 long long __builtin_arm_waccb (v8qi)
10856 long long __builtin_arm_wacch (v4hi)
10857 long long __builtin_arm_waccw (v2si)
10858 v8qi __builtin_arm_waddb (v8qi, v8qi)
10859 v8qi __builtin_arm_waddbss (v8qi, v8qi)
10860 v8qi __builtin_arm_waddbus (v8qi, v8qi)
10861 v4hi __builtin_arm_waddh (v4hi, v4hi)
10862 v4hi __builtin_arm_waddhss (v4hi, v4hi)
10863 v4hi __builtin_arm_waddhus (v4hi, v4hi)
10864 v2si __builtin_arm_waddw (v2si, v2si)
10865 v2si __builtin_arm_waddwss (v2si, v2si)
10866 v2si __builtin_arm_waddwus (v2si, v2si)
10867 v8qi __builtin_arm_walign (v8qi, v8qi, int)
10868 long long __builtin_arm_wand(long long, long long)
10869 long long __builtin_arm_wandn (long long, long long)
10870 v8qi __builtin_arm_wavg2b (v8qi, v8qi)
10871 v8qi __builtin_arm_wavg2br (v8qi, v8qi)
10872 v4hi __builtin_arm_wavg2h (v4hi, v4hi)
10873 v4hi __builtin_arm_wavg2hr (v4hi, v4hi)
10874 v8qi __builtin_arm_wcmpeqb (v8qi, v8qi)
10875 v4hi __builtin_arm_wcmpeqh (v4hi, v4hi)
10876 v2si __builtin_arm_wcmpeqw (v2si, v2si)
10877 v8qi __builtin_arm_wcmpgtsb (v8qi, v8qi)
10878 v4hi __builtin_arm_wcmpgtsh (v4hi, v4hi)
10879 v2si __builtin_arm_wcmpgtsw (v2si, v2si)
10880 v8qi __builtin_arm_wcmpgtub (v8qi, v8qi)
10881 v4hi __builtin_arm_wcmpgtuh (v4hi, v4hi)
10882 v2si __builtin_arm_wcmpgtuw (v2si, v2si)
10883 long long __builtin_arm_wmacs (long long, v4hi, v4hi)
10884 long long __builtin_arm_wmacsz (v4hi, v4hi)
10885 long long __builtin_arm_wmacu (long long, v4hi, v4hi)
10886 long long __builtin_arm_wmacuz (v4hi, v4hi)
10887 v4hi __builtin_arm_wmadds (v4hi, v4hi)
10888 v4hi __builtin_arm_wmaddu (v4hi, v4hi)
10889 v8qi __builtin_arm_wmaxsb (v8qi, v8qi)
10890 v4hi __builtin_arm_wmaxsh (v4hi, v4hi)
10891 v2si __builtin_arm_wmaxsw (v2si, v2si)
10892 v8qi __builtin_arm_wmaxub (v8qi, v8qi)
10893 v4hi __builtin_arm_wmaxuh (v4hi, v4hi)
10894 v2si __builtin_arm_wmaxuw (v2si, v2si)
10895 v8qi __builtin_arm_wminsb (v8qi, v8qi)
10896 v4hi __builtin_arm_wminsh (v4hi, v4hi)
10897 v2si __builtin_arm_wminsw (v2si, v2si)
10898 v8qi __builtin_arm_wminub (v8qi, v8qi)
10899 v4hi __builtin_arm_wminuh (v4hi, v4hi)
10900 v2si __builtin_arm_wminuw (v2si, v2si)
10901 v4hi __builtin_arm_wmulsm (v4hi, v4hi)
10902 v4hi __builtin_arm_wmulul (v4hi, v4hi)
10903 v4hi __builtin_arm_wmulum (v4hi, v4hi)
10904 long long __builtin_arm_wor (long long, long long)
10905 v2si __builtin_arm_wpackdss (long long, long long)
10906 v2si __builtin_arm_wpackdus (long long, long long)
10907 v8qi __builtin_arm_wpackhss (v4hi, v4hi)
10908 v8qi __builtin_arm_wpackhus (v4hi, v4hi)
10909 v4hi __builtin_arm_wpackwss (v2si, v2si)
10910 v4hi __builtin_arm_wpackwus (v2si, v2si)
10911 long long __builtin_arm_wrord (long long, long long)
10912 long long __builtin_arm_wrordi (long long, int)
10913 v4hi __builtin_arm_wrorh (v4hi, long long)
10914 v4hi __builtin_arm_wrorhi (v4hi, int)
10915 v2si __builtin_arm_wrorw (v2si, long long)
10916 v2si __builtin_arm_wrorwi (v2si, int)
10917 v2si __builtin_arm_wsadb (v2si, v8qi, v8qi)
10918 v2si __builtin_arm_wsadbz (v8qi, v8qi)
10919 v2si __builtin_arm_wsadh (v2si, v4hi, v4hi)
10920 v2si __builtin_arm_wsadhz (v4hi, v4hi)
10921 v4hi __builtin_arm_wshufh (v4hi, int)
10922 long long __builtin_arm_wslld (long long, long long)
10923 long long __builtin_arm_wslldi (long long, int)
10924 v4hi __builtin_arm_wsllh (v4hi, long long)
10925 v4hi __builtin_arm_wsllhi (v4hi, int)
10926 v2si __builtin_arm_wsllw (v2si, long long)
10927 v2si __builtin_arm_wsllwi (v2si, int)
10928 long long __builtin_arm_wsrad (long long, long long)
10929 long long __builtin_arm_wsradi (long long, int)
10930 v4hi __builtin_arm_wsrah (v4hi, long long)
10931 v4hi __builtin_arm_wsrahi (v4hi, int)
10932 v2si __builtin_arm_wsraw (v2si, long long)
10933 v2si __builtin_arm_wsrawi (v2si, int)
10934 long long __builtin_arm_wsrld (long long, long long)
10935 long long __builtin_arm_wsrldi (long long, int)
10936 v4hi __builtin_arm_wsrlh (v4hi, long long)
10937 v4hi __builtin_arm_wsrlhi (v4hi, int)
10938 v2si __builtin_arm_wsrlw (v2si, long long)
10939 v2si __builtin_arm_wsrlwi (v2si, int)
10940 v8qi __builtin_arm_wsubb (v8qi, v8qi)
10941 v8qi __builtin_arm_wsubbss (v8qi, v8qi)
10942 v8qi __builtin_arm_wsubbus (v8qi, v8qi)
10943 v4hi __builtin_arm_wsubh (v4hi, v4hi)
10944 v4hi __builtin_arm_wsubhss (v4hi, v4hi)
10945 v4hi __builtin_arm_wsubhus (v4hi, v4hi)
10946 v2si __builtin_arm_wsubw (v2si, v2si)
10947 v2si __builtin_arm_wsubwss (v2si, v2si)
10948 v2si __builtin_arm_wsubwus (v2si, v2si)
10949 v4hi __builtin_arm_wunpckehsb (v8qi)
10950 v2si __builtin_arm_wunpckehsh (v4hi)
10951 long long __builtin_arm_wunpckehsw (v2si)
10952 v4hi __builtin_arm_wunpckehub (v8qi)
10953 v2si __builtin_arm_wunpckehuh (v4hi)
10954 long long __builtin_arm_wunpckehuw (v2si)
10955 v4hi __builtin_arm_wunpckelsb (v8qi)
10956 v2si __builtin_arm_wunpckelsh (v4hi)
10957 long long __builtin_arm_wunpckelsw (v2si)
10958 v4hi __builtin_arm_wunpckelub (v8qi)
10959 v2si __builtin_arm_wunpckeluh (v4hi)
10960 long long __builtin_arm_wunpckeluw (v2si)
10961 v8qi __builtin_arm_wunpckihb (v8qi, v8qi)
10962 v4hi __builtin_arm_wunpckihh (v4hi, v4hi)
10963 v2si __builtin_arm_wunpckihw (v2si, v2si)
10964 v8qi __builtin_arm_wunpckilb (v8qi, v8qi)
10965 v4hi __builtin_arm_wunpckilh (v4hi, v4hi)
10966 v2si __builtin_arm_wunpckilw (v2si, v2si)
10967 long long __builtin_arm_wxor (long long, long long)
10968 long long __builtin_arm_wzero ()
10969 @end smallexample
10970
10971
10972 @node ARM C Language Extensions (ACLE)
10973 @subsection ARM C Language Extensions (ACLE)
10974
10975 GCC implements extensions for C as described in the ARM C Language
10976 Extensions (ACLE) specification, which can be found at
10977 @uref{http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/IHI0053C_acle_2_0.pdf}.
10978
10979 As a part of ACLE, GCC implements extensions for Advanced SIMD as described in
10980 the ARM C Language Extensions Specification.  The complete list of Advanced SIMD
10981 intrinsics can be found at
10982 @uref{http://infocenter.arm.com/help/topic/com.arm.doc.ihi0073a/IHI0073A_arm_neon_intrinsics_ref.pdf}.
10983 The built-in intrinsics for the Advanced SIMD extension are available when
10984 NEON is enabled.
10985
10986 Currently, ARM and AArch64 back-ends do not support ACLE 2.0 fully.  Both
10987 back-ends support CRC32 intrinsics from @file{arm_acle.h}.  The ARM backend's
10988 16-bit floating-point Advanded SIMD Intrinsics currently comply to ACLE v1.1.
10989 AArch64's backend does not have support for 16-bit floating point Advanced SIMD
10990 Intrinsics yet.
10991
10992 See @ref{ARM Options} and @ref{AArch64 Options} for more information on the
10993 availability of extensions.
10994
10995 @node ARM Floating Point Status and Control Intrinsics
10996 @subsection ARM Floating Point Status and Control Intrinsics
10997
10998 These built-in functions are available for the ARM family of
10999 processors with floating-point unit.
11000
11001 @smallexample
11002 unsigned int __builtin_arm_get_fpscr ()
11003 void __builtin_arm_set_fpscr (unsigned int)
11004 @end smallexample
11005
11006 @node AVR Built-in Functions
11007 @subsection AVR Built-in Functions
11008
11009 For each built-in function for AVR, there is an equally named,
11010 uppercase built-in macro defined. That way users can easily query if
11011 or if not a specific built-in is implemented or not. For example, if
11012 @code{__builtin_avr_nop} is available the macro
11013 @code{__BUILTIN_AVR_NOP} is defined to @code{1} and undefined otherwise.
11014
11015 The following built-in functions map to the respective machine
11016 instruction, i.e.@: @code{nop}, @code{sei}, @code{cli}, @code{sleep},
11017 @code{wdr}, @code{swap}, @code{fmul}, @code{fmuls}
11018 resp. @code{fmulsu}. The three @code{fmul*} built-ins are implemented
11019 as library call if no hardware multiplier is available.
11020
11021 @smallexample
11022 void __builtin_avr_nop (void)
11023 void __builtin_avr_sei (void)
11024 void __builtin_avr_cli (void)
11025 void __builtin_avr_sleep (void)
11026 void __builtin_avr_wdr (void)
11027 unsigned char __builtin_avr_swap (unsigned char)
11028 unsigned int __builtin_avr_fmul (unsigned char, unsigned char)
11029 int __builtin_avr_fmuls (char, char)
11030 int __builtin_avr_fmulsu (char, unsigned char)
11031 @end smallexample
11032
11033 In order to delay execution for a specific number of cycles, GCC
11034 implements
11035 @smallexample
11036 void __builtin_avr_delay_cycles (unsigned long ticks)
11037 @end smallexample
11038
11039 @noindent
11040 @code{ticks} is the number of ticks to delay execution. Note that this
11041 built-in does not take into account the effect of interrupts that
11042 might increase delay time. @code{ticks} must be a compile-time
11043 integer constant; delays with a variable number of cycles are not supported.
11044
11045 @smallexample
11046 char __builtin_avr_flash_segment (const __memx void*)
11047 @end smallexample
11048
11049 @noindent
11050 This built-in takes a byte address to the 24-bit
11051 @ref{AVR Named Address Spaces,address space} @code{__memx} and returns
11052 the number of the flash segment (the 64 KiB chunk) where the address
11053 points to.  Counting starts at @code{0}.
11054 If the address does not point to flash memory, return @code{-1}.
11055
11056 @smallexample
11057 unsigned char __builtin_avr_insert_bits (unsigned long map, unsigned char bits, unsigned char val)
11058 @end smallexample
11059
11060 @noindent
11061 Insert bits from @var{bits} into @var{val} and return the resulting
11062 value. The nibbles of @var{map} determine how the insertion is
11063 performed: Let @var{X} be the @var{n}-th nibble of @var{map}
11064 @enumerate
11065 @item If @var{X} is @code{0xf},
11066 then the @var{n}-th bit of @var{val} is returned unaltered.
11067
11068 @item If X is in the range 0@dots{}7,
11069 then the @var{n}-th result bit is set to the @var{X}-th bit of @var{bits}
11070
11071 @item If X is in the range 8@dots{}@code{0xe},
11072 then the @var{n}-th result bit is undefined.
11073 @end enumerate
11074
11075 @noindent
11076 One typical use case for this built-in is adjusting input and
11077 output values to non-contiguous port layouts. Some examples:
11078
11079 @smallexample
11080 // same as val, bits is unused
11081 __builtin_avr_insert_bits (0xffffffff, bits, val)
11082 @end smallexample
11083
11084 @smallexample
11085 // same as bits, val is unused
11086 __builtin_avr_insert_bits (0x76543210, bits, val)
11087 @end smallexample
11088
11089 @smallexample
11090 // same as rotating bits by 4
11091 __builtin_avr_insert_bits (0x32107654, bits, 0)
11092 @end smallexample
11093
11094 @smallexample
11095 // high nibble of result is the high nibble of val
11096 // low nibble of result is the low nibble of bits
11097 __builtin_avr_insert_bits (0xffff3210, bits, val)
11098 @end smallexample
11099
11100 @smallexample
11101 // reverse the bit order of bits
11102 __builtin_avr_insert_bits (0x01234567, bits, 0)
11103 @end smallexample
11104
11105 @node Blackfin Built-in Functions
11106 @subsection Blackfin Built-in Functions
11107
11108 Currently, there are two Blackfin-specific built-in functions.  These are
11109 used for generating @code{CSYNC} and @code{SSYNC} machine insns without
11110 using inline assembly; by using these built-in functions the compiler can
11111 automatically add workarounds for hardware errata involving these
11112 instructions.  These functions are named as follows:
11113
11114 @smallexample
11115 void __builtin_bfin_csync (void)
11116 void __builtin_bfin_ssync (void)
11117 @end smallexample
11118
11119 @node FR-V Built-in Functions
11120 @subsection FR-V Built-in Functions
11121
11122 GCC provides many FR-V-specific built-in functions.  In general,
11123 these functions are intended to be compatible with those described
11124 by @cite{FR-V Family, Softune C/C++ Compiler Manual (V6), Fujitsu
11125 Semiconductor}.  The two exceptions are @code{__MDUNPACKH} and
11126 @code{__MBTOHE}, the GCC forms of which pass 128-bit values by
11127 pointer rather than by value.
11128
11129 Most of the functions are named after specific FR-V instructions.
11130 Such functions are said to be ``directly mapped'' and are summarized
11131 here in tabular form.
11132
11133 @menu
11134 * Argument Types::
11135 * Directly-mapped Integer Functions::
11136 * Directly-mapped Media Functions::
11137 * Raw read/write Functions::
11138 * Other Built-in Functions::
11139 @end menu
11140
11141 @node Argument Types
11142 @subsubsection Argument Types
11143
11144 The arguments to the built-in functions can be divided into three groups:
11145 register numbers, compile-time constants and run-time values.  In order
11146 to make this classification clear at a glance, the arguments and return
11147 values are given the following pseudo types:
11148
11149 @multitable @columnfractions .20 .30 .15 .35
11150 @item Pseudo type @tab Real C type @tab Constant? @tab Description
11151 @item @code{uh} @tab @code{unsigned short} @tab No @tab an unsigned halfword
11152 @item @code{uw1} @tab @code{unsigned int} @tab No @tab an unsigned word
11153 @item @code{sw1} @tab @code{int} @tab No @tab a signed word
11154 @item @code{uw2} @tab @code{unsigned long long} @tab No
11155 @tab an unsigned doubleword
11156 @item @code{sw2} @tab @code{long long} @tab No @tab a signed doubleword
11157 @item @code{const} @tab @code{int} @tab Yes @tab an integer constant
11158 @item @code{acc} @tab @code{int} @tab Yes @tab an ACC register number
11159 @item @code{iacc} @tab @code{int} @tab Yes @tab an IACC register number
11160 @end multitable
11161
11162 These pseudo types are not defined by GCC, they are simply a notational
11163 convenience used in this manual.
11164
11165 Arguments of type @code{uh}, @code{uw1}, @code{sw1}, @code{uw2}
11166 and @code{sw2} are evaluated at run time.  They correspond to
11167 register operands in the underlying FR-V instructions.
11168
11169 @code{const} arguments represent immediate operands in the underlying
11170 FR-V instructions.  They must be compile-time constants.
11171
11172 @code{acc} arguments are evaluated at compile time and specify the number
11173 of an accumulator register.  For example, an @code{acc} argument of 2
11174 selects the ACC2 register.
11175
11176 @code{iacc} arguments are similar to @code{acc} arguments but specify the
11177 number of an IACC register.  See @pxref{Other Built-in Functions}
11178 for more details.
11179
11180 @node Directly-mapped Integer Functions
11181 @subsubsection Directly-mapped Integer Functions
11182
11183 The functions listed below map directly to FR-V I-type instructions.
11184
11185 @multitable @columnfractions .45 .32 .23
11186 @item Function prototype @tab Example usage @tab Assembly output
11187 @item @code{sw1 __ADDSS (sw1, sw1)}
11188 @tab @code{@var{c} = __ADDSS (@var{a}, @var{b})}
11189 @tab @code{ADDSS @var{a},@var{b},@var{c}}
11190 @item @code{sw1 __SCAN (sw1, sw1)}
11191 @tab @code{@var{c} = __SCAN (@var{a}, @var{b})}
11192 @tab @code{SCAN @var{a},@var{b},@var{c}}
11193 @item @code{sw1 __SCUTSS (sw1)}
11194 @tab @code{@var{b} = __SCUTSS (@var{a})}
11195 @tab @code{SCUTSS @var{a},@var{b}}
11196 @item @code{sw1 __SLASS (sw1, sw1)}
11197 @tab @code{@var{c} = __SLASS (@var{a}, @var{b})}
11198 @tab @code{SLASS @var{a},@var{b},@var{c}}
11199 @item @code{void __SMASS (sw1, sw1)}
11200 @tab @code{__SMASS (@var{a}, @var{b})}
11201 @tab @code{SMASS @var{a},@var{b}}
11202 @item @code{void __SMSSS (sw1, sw1)}
11203 @tab @code{__SMSSS (@var{a}, @var{b})}
11204 @tab @code{SMSSS @var{a},@var{b}}
11205 @item @code{void __SMU (sw1, sw1)}
11206 @tab @code{__SMU (@var{a}, @var{b})}
11207 @tab @code{SMU @var{a},@var{b}}
11208 @item @code{sw2 __SMUL (sw1, sw1)}
11209 @tab @code{@var{c} = __SMUL (@var{a}, @var{b})}
11210 @tab @code{SMUL @var{a},@var{b},@var{c}}
11211 @item @code{sw1 __SUBSS (sw1, sw1)}
11212 @tab @code{@var{c} = __SUBSS (@var{a}, @var{b})}
11213 @tab @code{SUBSS @var{a},@var{b},@var{c}}
11214 @item @code{uw2 __UMUL (uw1, uw1)}
11215 @tab @code{@var{c} = __UMUL (@var{a}, @var{b})}
11216 @tab @code{UMUL @var{a},@var{b},@var{c}}
11217 @end multitable
11218
11219 @node Directly-mapped Media Functions
11220 @subsubsection Directly-mapped Media Functions
11221
11222 The functions listed below map directly to FR-V M-type instructions.
11223
11224 @multitable @columnfractions .45 .32 .23
11225 @item Function prototype @tab Example usage @tab Assembly output
11226 @item @code{uw1 __MABSHS (sw1)}
11227 @tab @code{@var{b} = __MABSHS (@var{a})}
11228 @tab @code{MABSHS @var{a},@var{b}}
11229 @item @code{void __MADDACCS (acc, acc)}
11230 @tab @code{__MADDACCS (@var{b}, @var{a})}
11231 @tab @code{MADDACCS @var{a},@var{b}}
11232 @item @code{sw1 __MADDHSS (sw1, sw1)}
11233 @tab @code{@var{c} = __MADDHSS (@var{a}, @var{b})}
11234 @tab @code{MADDHSS @var{a},@var{b},@var{c}}
11235 @item @code{uw1 __MADDHUS (uw1, uw1)}
11236 @tab @code{@var{c} = __MADDHUS (@var{a}, @var{b})}
11237 @tab @code{MADDHUS @var{a},@var{b},@var{c}}
11238 @item @code{uw1 __MAND (uw1, uw1)}
11239 @tab @code{@var{c} = __MAND (@var{a}, @var{b})}
11240 @tab @code{MAND @var{a},@var{b},@var{c}}
11241 @item @code{void __MASACCS (acc, acc)}
11242 @tab @code{__MASACCS (@var{b}, @var{a})}
11243 @tab @code{MASACCS @var{a},@var{b}}
11244 @item @code{uw1 __MAVEH (uw1, uw1)}
11245 @tab @code{@var{c} = __MAVEH (@var{a}, @var{b})}
11246 @tab @code{MAVEH @var{a},@var{b},@var{c}}
11247 @item @code{uw2 __MBTOH (uw1)}
11248 @tab @code{@var{b} = __MBTOH (@var{a})}
11249 @tab @code{MBTOH @var{a},@var{b}}
11250 @item @code{void __MBTOHE (uw1 *, uw1)}
11251 @tab @code{__MBTOHE (&@var{b}, @var{a})}
11252 @tab @code{MBTOHE @var{a},@var{b}}
11253 @item @code{void __MCLRACC (acc)}
11254 @tab @code{__MCLRACC (@var{a})}
11255 @tab @code{MCLRACC @var{a}}
11256 @item @code{void __MCLRACCA (void)}
11257 @tab @code{__MCLRACCA ()}
11258 @tab @code{MCLRACCA}
11259 @item @code{uw1 __Mcop1 (uw1, uw1)}
11260 @tab @code{@var{c} = __Mcop1 (@var{a}, @var{b})}
11261 @tab @code{Mcop1 @var{a},@var{b},@var{c}}
11262 @item @code{uw1 __Mcop2 (uw1, uw1)}
11263 @tab @code{@var{c} = __Mcop2 (@var{a}, @var{b})}
11264 @tab @code{Mcop2 @var{a},@var{b},@var{c}}
11265 @item @code{uw1 __MCPLHI (uw2, const)}
11266 @tab @code{@var{c} = __MCPLHI (@var{a}, @var{b})}
11267 @tab @code{MCPLHI @var{a},#@var{b},@var{c}}
11268 @item @code{uw1 __MCPLI (uw2, const)}
11269 @tab @code{@var{c} = __MCPLI (@var{a}, @var{b})}
11270 @tab @code{MCPLI @var{a},#@var{b},@var{c}}
11271 @item @code{void __MCPXIS (acc, sw1, sw1)}
11272 @tab @code{__MCPXIS (@var{c}, @var{a}, @var{b})}
11273 @tab @code{MCPXIS @var{a},@var{b},@var{c}}
11274 @item @code{void __MCPXIU (acc, uw1, uw1)}
11275 @tab @code{__MCPXIU (@var{c}, @var{a}, @var{b})}
11276 @tab @code{MCPXIU @var{a},@var{b},@var{c}}
11277 @item @code{void __MCPXRS (acc, sw1, sw1)}
11278 @tab @code{__MCPXRS (@var{c}, @var{a}, @var{b})}
11279 @tab @code{MCPXRS @var{a},@var{b},@var{c}}
11280 @item @code{void __MCPXRU (acc, uw1, uw1)}
11281 @tab @code{__MCPXRU (@var{c}, @var{a}, @var{b})}
11282 @tab @code{MCPXRU @var{a},@var{b},@var{c}}
11283 @item @code{uw1 __MCUT (acc, uw1)}
11284 @tab @code{@var{c} = __MCUT (@var{a}, @var{b})}
11285 @tab @code{MCUT @var{a},@var{b},@var{c}}
11286 @item @code{uw1 __MCUTSS (acc, sw1)}
11287 @tab @code{@var{c} = __MCUTSS (@var{a}, @var{b})}
11288 @tab @code{MCUTSS @var{a},@var{b},@var{c}}
11289 @item @code{void __MDADDACCS (acc, acc)}
11290 @tab @code{__MDADDACCS (@var{b}, @var{a})}
11291 @tab @code{MDADDACCS @var{a},@var{b}}
11292 @item @code{void __MDASACCS (acc, acc)}
11293 @tab @code{__MDASACCS (@var{b}, @var{a})}
11294 @tab @code{MDASACCS @var{a},@var{b}}
11295 @item @code{uw2 __MDCUTSSI (acc, const)}
11296 @tab @code{@var{c} = __MDCUTSSI (@var{a}, @var{b})}
11297 @tab @code{MDCUTSSI @var{a},#@var{b},@var{c}}
11298 @item @code{uw2 __MDPACKH (uw2, uw2)}
11299 @tab @code{@var{c} = __MDPACKH (@var{a}, @var{b})}
11300 @tab @code{MDPACKH @var{a},@var{b},@var{c}}
11301 @item @code{uw2 __MDROTLI (uw2, const)}
11302 @tab @code{@var{c} = __MDROTLI (@var{a}, @var{b})}
11303 @tab @code{MDROTLI @var{a},#@var{b},@var{c}}
11304 @item @code{void __MDSUBACCS (acc, acc)}
11305 @tab @code{__MDSUBACCS (@var{b}, @var{a})}
11306 @tab @code{MDSUBACCS @var{a},@var{b}}
11307 @item @code{void __MDUNPACKH (uw1 *, uw2)}
11308 @tab @code{__MDUNPACKH (&@var{b}, @var{a})}
11309 @tab @code{MDUNPACKH @var{a},@var{b}}
11310 @item @code{uw2 __MEXPDHD (uw1, const)}
11311 @tab @code{@var{c} = __MEXPDHD (@var{a}, @var{b})}
11312 @tab @code{MEXPDHD @var{a},#@var{b},@var{c}}
11313 @item @code{uw1 __MEXPDHW (uw1, const)}
11314 @tab @code{@var{c} = __MEXPDHW (@var{a}, @var{b})}
11315 @tab @code{MEXPDHW @var{a},#@var{b},@var{c}}
11316 @item @code{uw1 __MHDSETH (uw1, const)}
11317 @tab @code{@var{c} = __MHDSETH (@var{a}, @var{b})}
11318 @tab @code{MHDSETH @var{a},#@var{b},@var{c}}
11319 @item @code{sw1 __MHDSETS (const)}
11320 @tab @code{@var{b} = __MHDSETS (@var{a})}
11321 @tab @code{MHDSETS #@var{a},@var{b}}
11322 @item @code{uw1 __MHSETHIH (uw1, const)}
11323 @tab @code{@var{b} = __MHSETHIH (@var{b}, @var{a})}
11324 @tab @code{MHSETHIH #@var{a},@var{b}}
11325 @item @code{sw1 __MHSETHIS (sw1, const)}
11326 @tab @code{@var{b} = __MHSETHIS (@var{b}, @var{a})}
11327 @tab @code{MHSETHIS #@var{a},@var{b}}
11328 @item @code{uw1 __MHSETLOH (uw1, const)}
11329 @tab @code{@var{b} = __MHSETLOH (@var{b}, @var{a})}
11330 @tab @code{MHSETLOH #@var{a},@var{b}}
11331 @item @code{sw1 __MHSETLOS (sw1, const)}
11332 @tab @code{@var{b} = __MHSETLOS (@var{b}, @var{a})}
11333 @tab @code{MHSETLOS #@var{a},@var{b}}
11334 @item @code{uw1 __MHTOB (uw2)}
11335 @tab @code{@var{b} = __MHTOB (@var{a})}
11336 @tab @code{MHTOB @var{a},@var{b}}
11337 @item @code{void __MMACHS (acc, sw1, sw1)}
11338 @tab @code{__MMACHS (@var{c}, @var{a}, @var{b})}
11339 @tab @code{MMACHS @var{a},@var{b},@var{c}}
11340 @item @code{void __MMACHU (acc, uw1, uw1)}
11341 @tab @code{__MMACHU (@var{c}, @var{a}, @var{b})}
11342 @tab @code{MMACHU @var{a},@var{b},@var{c}}
11343 @item @code{void __MMRDHS (acc, sw1, sw1)}
11344 @tab @code{__MMRDHS (@var{c}, @var{a}, @var{b})}
11345 @tab @code{MMRDHS @var{a},@var{b},@var{c}}
11346 @item @code{void __MMRDHU (acc, uw1, uw1)}
11347 @tab @code{__MMRDHU (@var{c}, @var{a}, @var{b})}
11348 @tab @code{MMRDHU @var{a},@var{b},@var{c}}
11349 @item @code{void __MMULHS (acc, sw1, sw1)}
11350 @tab @code{__MMULHS (@var{c}, @var{a}, @var{b})}
11351 @tab @code{MMULHS @var{a},@var{b},@var{c}}
11352 @item @code{void __MMULHU (acc, uw1, uw1)}
11353 @tab @code{__MMULHU (@var{c}, @var{a}, @var{b})}
11354 @tab @code{MMULHU @var{a},@var{b},@var{c}}
11355 @item @code{void __MMULXHS (acc, sw1, sw1)}
11356 @tab @code{__MMULXHS (@var{c}, @var{a}, @var{b})}
11357 @tab @code{MMULXHS @var{a},@var{b},@var{c}}
11358 @item @code{void __MMULXHU (acc, uw1, uw1)}
11359 @tab @code{__MMULXHU (@var{c}, @var{a}, @var{b})}
11360 @tab @code{MMULXHU @var{a},@var{b},@var{c}}
11361 @item @code{uw1 __MNOT (uw1)}
11362 @tab @code{@var{b} = __MNOT (@var{a})}
11363 @tab @code{MNOT @var{a},@var{b}}
11364 @item @code{uw1 __MOR (uw1, uw1)}
11365 @tab @code{@var{c} = __MOR (@var{a}, @var{b})}
11366 @tab @code{MOR @var{a},@var{b},@var{c}}
11367 @item @code{uw1 __MPACKH (uh, uh)}
11368 @tab @code{@var{c} = __MPACKH (@var{a}, @var{b})}
11369 @tab @code{MPACKH @var{a},@var{b},@var{c}}
11370 @item @code{sw2 __MQADDHSS (sw2, sw2)}
11371 @tab @code{@var{c} = __MQADDHSS (@var{a}, @var{b})}
11372 @tab @code{MQADDHSS @var{a},@var{b},@var{c}}
11373 @item @code{uw2 __MQADDHUS (uw2, uw2)}
11374 @tab @code{@var{c} = __MQADDHUS (@var{a}, @var{b})}
11375 @tab @code{MQADDHUS @var{a},@var{b},@var{c}}
11376 @item @code{void __MQCPXIS (acc, sw2, sw2)}
11377 @tab @code{__MQCPXIS (@var{c}, @var{a}, @var{b})}
11378 @tab @code{MQCPXIS @var{a},@var{b},@var{c}}
11379 @item @code{void __MQCPXIU (acc, uw2, uw2)}
11380 @tab @code{__MQCPXIU (@var{c}, @var{a}, @var{b})}
11381 @tab @code{MQCPXIU @var{a},@var{b},@var{c}}
11382 @item @code{void __MQCPXRS (acc, sw2, sw2)}
11383 @tab @code{__MQCPXRS (@var{c}, @var{a}, @var{b})}
11384 @tab @code{MQCPXRS @var{a},@var{b},@var{c}}
11385 @item @code{void __MQCPXRU (acc, uw2, uw2)}
11386 @tab @code{__MQCPXRU (@var{c}, @var{a}, @var{b})}
11387 @tab @code{MQCPXRU @var{a},@var{b},@var{c}}
11388 @item @code{sw2 __MQLCLRHS (sw2, sw2)}
11389 @tab @code{@var{c} = __MQLCLRHS (@var{a}, @var{b})}
11390 @tab @code{MQLCLRHS @var{a},@var{b},@var{c}}
11391 @item @code{sw2 __MQLMTHS (sw2, sw2)}
11392 @tab @code{@var{c} = __MQLMTHS (@var{a}, @var{b})}
11393 @tab @code{MQLMTHS @var{a},@var{b},@var{c}}
11394 @item @code{void __MQMACHS (acc, sw2, sw2)}
11395 @tab @code{__MQMACHS (@var{c}, @var{a}, @var{b})}
11396 @tab @code{MQMACHS @var{a},@var{b},@var{c}}
11397 @item @code{void __MQMACHU (acc, uw2, uw2)}
11398 @tab @code{__MQMACHU (@var{c}, @var{a}, @var{b})}
11399 @tab @code{MQMACHU @var{a},@var{b},@var{c}}
11400 @item @code{void __MQMACXHS (acc, sw2, sw2)}
11401 @tab @code{__MQMACXHS (@var{c}, @var{a}, @var{b})}
11402 @tab @code{MQMACXHS @var{a},@var{b},@var{c}}
11403 @item @code{void __MQMULHS (acc, sw2, sw2)}
11404 @tab @code{__MQMULHS (@var{c}, @var{a}, @var{b})}
11405 @tab @code{MQMULHS @var{a},@var{b},@var{c}}
11406 @item @code{void __MQMULHU (acc, uw2, uw2)}
11407 @tab @code{__MQMULHU (@var{c}, @var{a}, @var{b})}
11408 @tab @code{MQMULHU @var{a},@var{b},@var{c}}
11409 @item @code{void __MQMULXHS (acc, sw2, sw2)}
11410 @tab @code{__MQMULXHS (@var{c}, @var{a}, @var{b})}
11411 @tab @code{MQMULXHS @var{a},@var{b},@var{c}}
11412 @item @code{void __MQMULXHU (acc, uw2, uw2)}
11413 @tab @code{__MQMULXHU (@var{c}, @var{a}, @var{b})}
11414 @tab @code{MQMULXHU @var{a},@var{b},@var{c}}
11415 @item @code{sw2 __MQSATHS (sw2, sw2)}
11416 @tab @code{@var{c} = __MQSATHS (@var{a}, @var{b})}
11417 @tab @code{MQSATHS @var{a},@var{b},@var{c}}
11418 @item @code{uw2 __MQSLLHI (uw2, int)}
11419 @tab @code{@var{c} = __MQSLLHI (@var{a}, @var{b})}
11420 @tab @code{MQSLLHI @var{a},@var{b},@var{c}}
11421 @item @code{sw2 __MQSRAHI (sw2, int)}
11422 @tab @code{@var{c} = __MQSRAHI (@var{a}, @var{b})}
11423 @tab @code{MQSRAHI @var{a},@var{b},@var{c}}
11424 @item @code{sw2 __MQSUBHSS (sw2, sw2)}
11425 @tab @code{@var{c} = __MQSUBHSS (@var{a}, @var{b})}
11426 @tab @code{MQSUBHSS @var{a},@var{b},@var{c}}
11427 @item @code{uw2 __MQSUBHUS (uw2, uw2)}
11428 @tab @code{@var{c} = __MQSUBHUS (@var{a}, @var{b})}
11429 @tab @code{MQSUBHUS @var{a},@var{b},@var{c}}
11430 @item @code{void __MQXMACHS (acc, sw2, sw2)}
11431 @tab @code{__MQXMACHS (@var{c}, @var{a}, @var{b})}
11432 @tab @code{MQXMACHS @var{a},@var{b},@var{c}}
11433 @item @code{void __MQXMACXHS (acc, sw2, sw2)}
11434 @tab @code{__MQXMACXHS (@var{c}, @var{a}, @var{b})}
11435 @tab @code{MQXMACXHS @var{a},@var{b},@var{c}}
11436 @item @code{uw1 __MRDACC (acc)}
11437 @tab @code{@var{b} = __MRDACC (@var{a})}
11438 @tab @code{MRDACC @var{a},@var{b}}
11439 @item @code{uw1 __MRDACCG (acc)}
11440 @tab @code{@var{b} = __MRDACCG (@var{a})}
11441 @tab @code{MRDACCG @var{a},@var{b}}
11442 @item @code{uw1 __MROTLI (uw1, const)}
11443 @tab @code{@var{c} = __MROTLI (@var{a}, @var{b})}
11444 @tab @code{MROTLI @var{a},#@var{b},@var{c}}
11445 @item @code{uw1 __MROTRI (uw1, const)}
11446 @tab @code{@var{c} = __MROTRI (@var{a}, @var{b})}
11447 @tab @code{MROTRI @var{a},#@var{b},@var{c}}
11448 @item @code{sw1 __MSATHS (sw1, sw1)}
11449 @tab @code{@var{c} = __MSATHS (@var{a}, @var{b})}
11450 @tab @code{MSATHS @var{a},@var{b},@var{c}}
11451 @item @code{uw1 __MSATHU (uw1, uw1)}
11452 @tab @code{@var{c} = __MSATHU (@var{a}, @var{b})}
11453 @tab @code{MSATHU @var{a},@var{b},@var{c}}
11454 @item @code{uw1 __MSLLHI (uw1, const)}
11455 @tab @code{@var{c} = __MSLLHI (@var{a}, @var{b})}
11456 @tab @code{MSLLHI @var{a},#@var{b},@var{c}}
11457 @item @code{sw1 __MSRAHI (sw1, const)}
11458 @tab @code{@var{c} = __MSRAHI (@var{a}, @var{b})}
11459 @tab @code{MSRAHI @var{a},#@var{b},@var{c}}
11460 @item @code{uw1 __MSRLHI (uw1, const)}
11461 @tab @code{@var{c} = __MSRLHI (@var{a}, @var{b})}
11462 @tab @code{MSRLHI @var{a},#@var{b},@var{c}}
11463 @item @code{void __MSUBACCS (acc, acc)}
11464 @tab @code{__MSUBACCS (@var{b}, @var{a})}
11465 @tab @code{MSUBACCS @var{a},@var{b}}
11466 @item @code{sw1 __MSUBHSS (sw1, sw1)}
11467 @tab @code{@var{c} = __MSUBHSS (@var{a}, @var{b})}
11468 @tab @code{MSUBHSS @var{a},@var{b},@var{c}}
11469 @item @code{uw1 __MSUBHUS (uw1, uw1)}
11470 @tab @code{@var{c} = __MSUBHUS (@var{a}, @var{b})}
11471 @tab @code{MSUBHUS @var{a},@var{b},@var{c}}
11472 @item @code{void __MTRAP (void)}
11473 @tab @code{__MTRAP ()}
11474 @tab @code{MTRAP}
11475 @item @code{uw2 __MUNPACKH (uw1)}
11476 @tab @code{@var{b} = __MUNPACKH (@var{a})}
11477 @tab @code{MUNPACKH @var{a},@var{b}}
11478 @item @code{uw1 __MWCUT (uw2, uw1)}
11479 @tab @code{@var{c} = __MWCUT (@var{a}, @var{b})}
11480 @tab @code{MWCUT @var{a},@var{b},@var{c}}
11481 @item @code{void __MWTACC (acc, uw1)}
11482 @tab @code{__MWTACC (@var{b}, @var{a})}
11483 @tab @code{MWTACC @var{a},@var{b}}
11484 @item @code{void __MWTACCG (acc, uw1)}
11485 @tab @code{__MWTACCG (@var{b}, @var{a})}
11486 @tab @code{MWTACCG @var{a},@var{b}}
11487 @item @code{uw1 __MXOR (uw1, uw1)}
11488 @tab @code{@var{c} = __MXOR (@var{a}, @var{b})}
11489 @tab @code{MXOR @var{a},@var{b},@var{c}}
11490 @end multitable
11491
11492 @node Raw read/write Functions
11493 @subsubsection Raw read/write Functions
11494
11495 This sections describes built-in functions related to read and write
11496 instructions to access memory.  These functions generate
11497 @code{membar} instructions to flush the I/O load and stores where
11498 appropriate, as described in Fujitsu's manual described above.
11499
11500 @table @code
11501
11502 @item unsigned char __builtin_read8 (void *@var{data})
11503 @item unsigned short __builtin_read16 (void *@var{data})
11504 @item unsigned long __builtin_read32 (void *@var{data})
11505 @item unsigned long long __builtin_read64 (void *@var{data})
11506
11507 @item void __builtin_write8 (void *@var{data}, unsigned char @var{datum})
11508 @item void __builtin_write16 (void *@var{data}, unsigned short @var{datum})
11509 @item void __builtin_write32 (void *@var{data}, unsigned long @var{datum})
11510 @item void __builtin_write64 (void *@var{data}, unsigned long long @var{datum})
11511 @end table
11512
11513 @node Other Built-in Functions
11514 @subsubsection Other Built-in Functions
11515
11516 This section describes built-in functions that are not named after
11517 a specific FR-V instruction.
11518
11519 @table @code
11520 @item sw2 __IACCreadll (iacc @var{reg})
11521 Return the full 64-bit value of IACC0@.  The @var{reg} argument is reserved
11522 for future expansion and must be 0.
11523
11524 @item sw1 __IACCreadl (iacc @var{reg})
11525 Return the value of IACC0H if @var{reg} is 0 and IACC0L if @var{reg} is 1.
11526 Other values of @var{reg} are rejected as invalid.
11527
11528 @item void __IACCsetll (iacc @var{reg}, sw2 @var{x})
11529 Set the full 64-bit value of IACC0 to @var{x}.  The @var{reg} argument
11530 is reserved for future expansion and must be 0.
11531
11532 @item void __IACCsetl (iacc @var{reg}, sw1 @var{x})
11533 Set IACC0H to @var{x} if @var{reg} is 0 and IACC0L to @var{x} if @var{reg}
11534 is 1.  Other values of @var{reg} are rejected as invalid.
11535
11536 @item void __data_prefetch0 (const void *@var{x})
11537 Use the @code{dcpl} instruction to load the contents of address @var{x}
11538 into the data cache.
11539
11540 @item void __data_prefetch (const void *@var{x})
11541 Use the @code{nldub} instruction to load the contents of address @var{x}
11542 into the data cache.  The instruction is issued in slot I1@.
11543 @end table
11544
11545 @node MIPS DSP Built-in Functions
11546 @subsection MIPS DSP Built-in Functions
11547
11548 The MIPS DSP Application-Specific Extension (ASE) includes new
11549 instructions that are designed to improve the performance of DSP and
11550 media applications.  It provides instructions that operate on packed
11551 8-bit/16-bit integer data, Q7, Q15 and Q31 fractional data.
11552
11553 GCC supports MIPS DSP operations using both the generic
11554 vector extensions (@pxref{Vector Extensions}) and a collection of
11555 MIPS-specific built-in functions.  Both kinds of support are
11556 enabled by the @option{-mdsp} command-line option.
11557
11558 Revision 2 of the ASE was introduced in the second half of 2006.
11559 This revision adds extra instructions to the original ASE, but is
11560 otherwise backwards-compatible with it.  You can select revision 2
11561 using the command-line option @option{-mdspr2}; this option implies
11562 @option{-mdsp}.
11563
11564 The SCOUNT and POS bits of the DSP control register are global.  The
11565 WRDSP, EXTPDP, EXTPDPV and MTHLIP instructions modify the SCOUNT and
11566 POS bits.  During optimization, the compiler does not delete these
11567 instructions and it does not delete calls to functions containing
11568 these instructions.
11569
11570 At present, GCC only provides support for operations on 32-bit
11571 vectors.  The vector type associated with 8-bit integer data is
11572 usually called @code{v4i8}, the vector type associated with Q7
11573 is usually called @code{v4q7}, the vector type associated with 16-bit
11574 integer data is usually called @code{v2i16}, and the vector type
11575 associated with Q15 is usually called @code{v2q15}.  They can be
11576 defined in C as follows:
11577
11578 @smallexample
11579 typedef signed char v4i8 __attribute__ ((vector_size(4)));
11580 typedef signed char v4q7 __attribute__ ((vector_size(4)));
11581 typedef short v2i16 __attribute__ ((vector_size(4)));
11582 typedef short v2q15 __attribute__ ((vector_size(4)));
11583 @end smallexample
11584
11585 @code{v4i8}, @code{v4q7}, @code{v2i16} and @code{v2q15} values are
11586 initialized in the same way as aggregates.  For example:
11587
11588 @smallexample
11589 v4i8 a = @{1, 2, 3, 4@};
11590 v4i8 b;
11591 b = (v4i8) @{5, 6, 7, 8@};
11592
11593 v2q15 c = @{0x0fcb, 0x3a75@};
11594 v2q15 d;
11595 d = (v2q15) @{0.1234 * 0x1.0p15, 0.4567 * 0x1.0p15@};
11596 @end smallexample
11597
11598 @emph{Note:} The CPU's endianness determines the order in which values
11599 are packed.  On little-endian targets, the first value is the least
11600 significant and the last value is the most significant.  The opposite
11601 order applies to big-endian targets.  For example, the code above
11602 sets the lowest byte of @code{a} to @code{1} on little-endian targets
11603 and @code{4} on big-endian targets.
11604
11605 @emph{Note:} Q7, Q15 and Q31 values must be initialized with their integer
11606 representation.  As shown in this example, the integer representation
11607 of a Q7 value can be obtained by multiplying the fractional value by
11608 @code{0x1.0p7}.  The equivalent for Q15 values is to multiply by
11609 @code{0x1.0p15}.  The equivalent for Q31 values is to multiply by
11610 @code{0x1.0p31}.
11611
11612 The table below lists the @code{v4i8} and @code{v2q15} operations for which
11613 hardware support exists.  @code{a} and @code{b} are @code{v4i8} values,
11614 and @code{c} and @code{d} are @code{v2q15} values.
11615
11616 @multitable @columnfractions .50 .50
11617 @item C code @tab MIPS instruction
11618 @item @code{a + b} @tab @code{addu.qb}
11619 @item @code{c + d} @tab @code{addq.ph}
11620 @item @code{a - b} @tab @code{subu.qb}
11621 @item @code{c - d} @tab @code{subq.ph}
11622 @end multitable
11623
11624 The table below lists the @code{v2i16} operation for which
11625 hardware support exists for the DSP ASE REV 2.  @code{e} and @code{f} are
11626 @code{v2i16} values.
11627
11628 @multitable @columnfractions .50 .50
11629 @item C code @tab MIPS instruction
11630 @item @code{e * f} @tab @code{mul.ph}
11631 @end multitable
11632
11633 It is easier to describe the DSP built-in functions if we first define
11634 the following types:
11635
11636 @smallexample
11637 typedef int q31;
11638 typedef int i32;
11639 typedef unsigned int ui32;
11640 typedef long long a64;
11641 @end smallexample
11642
11643 @code{q31} and @code{i32} are actually the same as @code{int}, but we
11644 use @code{q31} to indicate a Q31 fractional value and @code{i32} to
11645 indicate a 32-bit integer value.  Similarly, @code{a64} is the same as
11646 @code{long long}, but we use @code{a64} to indicate values that are
11647 placed in one of the four DSP accumulators (@code{$ac0},
11648 @code{$ac1}, @code{$ac2} or @code{$ac3}).
11649
11650 Also, some built-in functions prefer or require immediate numbers as
11651 parameters, because the corresponding DSP instructions accept both immediate
11652 numbers and register operands, or accept immediate numbers only.  The
11653 immediate parameters are listed as follows.
11654
11655 @smallexample
11656 imm0_3: 0 to 3.
11657 imm0_7: 0 to 7.
11658 imm0_15: 0 to 15.
11659 imm0_31: 0 to 31.
11660 imm0_63: 0 to 63.
11661 imm0_255: 0 to 255.
11662 imm_n32_31: -32 to 31.
11663 imm_n512_511: -512 to 511.
11664 @end smallexample
11665
11666 The following built-in functions map directly to a particular MIPS DSP
11667 instruction.  Please refer to the architecture specification
11668 for details on what each instruction does.
11669
11670 @smallexample
11671 v2q15 __builtin_mips_addq_ph (v2q15, v2q15)
11672 v2q15 __builtin_mips_addq_s_ph (v2q15, v2q15)
11673 q31 __builtin_mips_addq_s_w (q31, q31)
11674 v4i8 __builtin_mips_addu_qb (v4i8, v4i8)
11675 v4i8 __builtin_mips_addu_s_qb (v4i8, v4i8)
11676 v2q15 __builtin_mips_subq_ph (v2q15, v2q15)
11677 v2q15 __builtin_mips_subq_s_ph (v2q15, v2q15)
11678 q31 __builtin_mips_subq_s_w (q31, q31)
11679 v4i8 __builtin_mips_subu_qb (v4i8, v4i8)
11680 v4i8 __builtin_mips_subu_s_qb (v4i8, v4i8)
11681 i32 __builtin_mips_addsc (i32, i32)
11682 i32 __builtin_mips_addwc (i32, i32)
11683 i32 __builtin_mips_modsub (i32, i32)
11684 i32 __builtin_mips_raddu_w_qb (v4i8)
11685 v2q15 __builtin_mips_absq_s_ph (v2q15)
11686 q31 __builtin_mips_absq_s_w (q31)
11687 v4i8 __builtin_mips_precrq_qb_ph (v2q15, v2q15)
11688 v2q15 __builtin_mips_precrq_ph_w (q31, q31)
11689 v2q15 __builtin_mips_precrq_rs_ph_w (q31, q31)
11690 v4i8 __builtin_mips_precrqu_s_qb_ph (v2q15, v2q15)
11691 q31 __builtin_mips_preceq_w_phl (v2q15)
11692 q31 __builtin_mips_preceq_w_phr (v2q15)
11693 v2q15 __builtin_mips_precequ_ph_qbl (v4i8)
11694 v2q15 __builtin_mips_precequ_ph_qbr (v4i8)
11695 v2q15 __builtin_mips_precequ_ph_qbla (v4i8)
11696 v2q15 __builtin_mips_precequ_ph_qbra (v4i8)
11697 v2q15 __builtin_mips_preceu_ph_qbl (v4i8)
11698 v2q15 __builtin_mips_preceu_ph_qbr (v4i8)
11699 v2q15 __builtin_mips_preceu_ph_qbla (v4i8)
11700 v2q15 __builtin_mips_preceu_ph_qbra (v4i8)
11701 v4i8 __builtin_mips_shll_qb (v4i8, imm0_7)
11702 v4i8 __builtin_mips_shll_qb (v4i8, i32)
11703 v2q15 __builtin_mips_shll_ph (v2q15, imm0_15)
11704 v2q15 __builtin_mips_shll_ph (v2q15, i32)
11705 v2q15 __builtin_mips_shll_s_ph (v2q15, imm0_15)
11706 v2q15 __builtin_mips_shll_s_ph (v2q15, i32)
11707 q31 __builtin_mips_shll_s_w (q31, imm0_31)
11708 q31 __builtin_mips_shll_s_w (q31, i32)
11709 v4i8 __builtin_mips_shrl_qb (v4i8, imm0_7)
11710 v4i8 __builtin_mips_shrl_qb (v4i8, i32)
11711 v2q15 __builtin_mips_shra_ph (v2q15, imm0_15)
11712 v2q15 __builtin_mips_shra_ph (v2q15, i32)
11713 v2q15 __builtin_mips_shra_r_ph (v2q15, imm0_15)
11714 v2q15 __builtin_mips_shra_r_ph (v2q15, i32)
11715 q31 __builtin_mips_shra_r_w (q31, imm0_31)
11716 q31 __builtin_mips_shra_r_w (q31, i32)
11717 v2q15 __builtin_mips_muleu_s_ph_qbl (v4i8, v2q15)
11718 v2q15 __builtin_mips_muleu_s_ph_qbr (v4i8, v2q15)
11719 v2q15 __builtin_mips_mulq_rs_ph (v2q15, v2q15)
11720 q31 __builtin_mips_muleq_s_w_phl (v2q15, v2q15)
11721 q31 __builtin_mips_muleq_s_w_phr (v2q15, v2q15)
11722 a64 __builtin_mips_dpau_h_qbl (a64, v4i8, v4i8)
11723 a64 __builtin_mips_dpau_h_qbr (a64, v4i8, v4i8)
11724 a64 __builtin_mips_dpsu_h_qbl (a64, v4i8, v4i8)
11725 a64 __builtin_mips_dpsu_h_qbr (a64, v4i8, v4i8)
11726 a64 __builtin_mips_dpaq_s_w_ph (a64, v2q15, v2q15)
11727 a64 __builtin_mips_dpaq_sa_l_w (a64, q31, q31)
11728 a64 __builtin_mips_dpsq_s_w_ph (a64, v2q15, v2q15)
11729 a64 __builtin_mips_dpsq_sa_l_w (a64, q31, q31)
11730 a64 __builtin_mips_mulsaq_s_w_ph (a64, v2q15, v2q15)
11731 a64 __builtin_mips_maq_s_w_phl (a64, v2q15, v2q15)
11732 a64 __builtin_mips_maq_s_w_phr (a64, v2q15, v2q15)
11733 a64 __builtin_mips_maq_sa_w_phl (a64, v2q15, v2q15)
11734 a64 __builtin_mips_maq_sa_w_phr (a64, v2q15, v2q15)
11735 i32 __builtin_mips_bitrev (i32)
11736 i32 __builtin_mips_insv (i32, i32)
11737 v4i8 __builtin_mips_repl_qb (imm0_255)
11738 v4i8 __builtin_mips_repl_qb (i32)
11739 v2q15 __builtin_mips_repl_ph (imm_n512_511)
11740 v2q15 __builtin_mips_repl_ph (i32)
11741 void __builtin_mips_cmpu_eq_qb (v4i8, v4i8)
11742 void __builtin_mips_cmpu_lt_qb (v4i8, v4i8)
11743 void __builtin_mips_cmpu_le_qb (v4i8, v4i8)
11744 i32 __builtin_mips_cmpgu_eq_qb (v4i8, v4i8)
11745 i32 __builtin_mips_cmpgu_lt_qb (v4i8, v4i8)
11746 i32 __builtin_mips_cmpgu_le_qb (v4i8, v4i8)
11747 void __builtin_mips_cmp_eq_ph (v2q15, v2q15)
11748 void __builtin_mips_cmp_lt_ph (v2q15, v2q15)
11749 void __builtin_mips_cmp_le_ph (v2q15, v2q15)
11750 v4i8 __builtin_mips_pick_qb (v4i8, v4i8)
11751 v2q15 __builtin_mips_pick_ph (v2q15, v2q15)
11752 v2q15 __builtin_mips_packrl_ph (v2q15, v2q15)
11753 i32 __builtin_mips_extr_w (a64, imm0_31)
11754 i32 __builtin_mips_extr_w (a64, i32)
11755 i32 __builtin_mips_extr_r_w (a64, imm0_31)
11756 i32 __builtin_mips_extr_s_h (a64, i32)
11757 i32 __builtin_mips_extr_rs_w (a64, imm0_31)
11758 i32 __builtin_mips_extr_rs_w (a64, i32)
11759 i32 __builtin_mips_extr_s_h (a64, imm0_31)
11760 i32 __builtin_mips_extr_r_w (a64, i32)
11761 i32 __builtin_mips_extp (a64, imm0_31)
11762 i32 __builtin_mips_extp (a64, i32)
11763 i32 __builtin_mips_extpdp (a64, imm0_31)
11764 i32 __builtin_mips_extpdp (a64, i32)
11765 a64 __builtin_mips_shilo (a64, imm_n32_31)
11766 a64 __builtin_mips_shilo (a64, i32)
11767 a64 __builtin_mips_mthlip (a64, i32)
11768 void __builtin_mips_wrdsp (i32, imm0_63)
11769 i32 __builtin_mips_rddsp (imm0_63)
11770 i32 __builtin_mips_lbux (void *, i32)
11771 i32 __builtin_mips_lhx (void *, i32)
11772 i32 __builtin_mips_lwx (void *, i32)
11773 a64 __builtin_mips_ldx (void *, i32) [MIPS64 only]
11774 i32 __builtin_mips_bposge32 (void)
11775 a64 __builtin_mips_madd (a64, i32, i32);
11776 a64 __builtin_mips_maddu (a64, ui32, ui32);
11777 a64 __builtin_mips_msub (a64, i32, i32);
11778 a64 __builtin_mips_msubu (a64, ui32, ui32);
11779 a64 __builtin_mips_mult (i32, i32);
11780 a64 __builtin_mips_multu (ui32, ui32);
11781 @end smallexample
11782
11783 The following built-in functions map directly to a particular MIPS DSP REV 2
11784 instruction.  Please refer to the architecture specification
11785 for details on what each instruction does.
11786
11787 @smallexample
11788 v4q7 __builtin_mips_absq_s_qb (v4q7);
11789 v2i16 __builtin_mips_addu_ph (v2i16, v2i16);
11790 v2i16 __builtin_mips_addu_s_ph (v2i16, v2i16);
11791 v4i8 __builtin_mips_adduh_qb (v4i8, v4i8);
11792 v4i8 __builtin_mips_adduh_r_qb (v4i8, v4i8);
11793 i32 __builtin_mips_append (i32, i32, imm0_31);
11794 i32 __builtin_mips_balign (i32, i32, imm0_3);
11795 i32 __builtin_mips_cmpgdu_eq_qb (v4i8, v4i8);
11796 i32 __builtin_mips_cmpgdu_lt_qb (v4i8, v4i8);
11797 i32 __builtin_mips_cmpgdu_le_qb (v4i8, v4i8);
11798 a64 __builtin_mips_dpa_w_ph (a64, v2i16, v2i16);
11799 a64 __builtin_mips_dps_w_ph (a64, v2i16, v2i16);
11800 v2i16 __builtin_mips_mul_ph (v2i16, v2i16);
11801 v2i16 __builtin_mips_mul_s_ph (v2i16, v2i16);
11802 q31 __builtin_mips_mulq_rs_w (q31, q31);
11803 v2q15 __builtin_mips_mulq_s_ph (v2q15, v2q15);
11804 q31 __builtin_mips_mulq_s_w (q31, q31);
11805 a64 __builtin_mips_mulsa_w_ph (a64, v2i16, v2i16);
11806 v4i8 __builtin_mips_precr_qb_ph (v2i16, v2i16);
11807 v2i16 __builtin_mips_precr_sra_ph_w (i32, i32, imm0_31);
11808 v2i16 __builtin_mips_precr_sra_r_ph_w (i32, i32, imm0_31);
11809 i32 __builtin_mips_prepend (i32, i32, imm0_31);
11810 v4i8 __builtin_mips_shra_qb (v4i8, imm0_7);
11811 v4i8 __builtin_mips_shra_r_qb (v4i8, imm0_7);
11812 v4i8 __builtin_mips_shra_qb (v4i8, i32);
11813 v4i8 __builtin_mips_shra_r_qb (v4i8, i32);
11814 v2i16 __builtin_mips_shrl_ph (v2i16, imm0_15);
11815 v2i16 __builtin_mips_shrl_ph (v2i16, i32);
11816 v2i16 __builtin_mips_subu_ph (v2i16, v2i16);
11817 v2i16 __builtin_mips_subu_s_ph (v2i16, v2i16);
11818 v4i8 __builtin_mips_subuh_qb (v4i8, v4i8);
11819 v4i8 __builtin_mips_subuh_r_qb (v4i8, v4i8);
11820 v2q15 __builtin_mips_addqh_ph (v2q15, v2q15);
11821 v2q15 __builtin_mips_addqh_r_ph (v2q15, v2q15);
11822 q31 __builtin_mips_addqh_w (q31, q31);
11823 q31 __builtin_mips_addqh_r_w (q31, q31);
11824 v2q15 __builtin_mips_subqh_ph (v2q15, v2q15);
11825 v2q15 __builtin_mips_subqh_r_ph (v2q15, v2q15);
11826 q31 __builtin_mips_subqh_w (q31, q31);
11827 q31 __builtin_mips_subqh_r_w (q31, q31);
11828 a64 __builtin_mips_dpax_w_ph (a64, v2i16, v2i16);
11829 a64 __builtin_mips_dpsx_w_ph (a64, v2i16, v2i16);
11830 a64 __builtin_mips_dpaqx_s_w_ph (a64, v2q15, v2q15);
11831 a64 __builtin_mips_dpaqx_sa_w_ph (a64, v2q15, v2q15);
11832 a64 __builtin_mips_dpsqx_s_w_ph (a64, v2q15, v2q15);
11833 a64 __builtin_mips_dpsqx_sa_w_ph (a64, v2q15, v2q15);
11834 @end smallexample
11835
11836
11837 @node MIPS Paired-Single Support
11838 @subsection MIPS Paired-Single Support
11839
11840 The MIPS64 architecture includes a number of instructions that
11841 operate on pairs of single-precision floating-point values.
11842 Each pair is packed into a 64-bit floating-point register,
11843 with one element being designated the ``upper half'' and
11844 the other being designated the ``lower half''.
11845
11846 GCC supports paired-single operations using both the generic
11847 vector extensions (@pxref{Vector Extensions}) and a collection of
11848 MIPS-specific built-in functions.  Both kinds of support are
11849 enabled by the @option{-mpaired-single} command-line option.
11850
11851 The vector type associated with paired-single values is usually
11852 called @code{v2sf}.  It can be defined in C as follows:
11853
11854 @smallexample
11855 typedef float v2sf __attribute__ ((vector_size (8)));
11856 @end smallexample
11857
11858 @code{v2sf} values are initialized in the same way as aggregates.
11859 For example:
11860
11861 @smallexample
11862 v2sf a = @{1.5, 9.1@};
11863 v2sf b;
11864 float e, f;
11865 b = (v2sf) @{e, f@};
11866 @end smallexample
11867
11868 @emph{Note:} The CPU's endianness determines which value is stored in
11869 the upper half of a register and which value is stored in the lower half.
11870 On little-endian targets, the first value is the lower one and the second
11871 value is the upper one.  The opposite order applies to big-endian targets.
11872 For example, the code above sets the lower half of @code{a} to
11873 @code{1.5} on little-endian targets and @code{9.1} on big-endian targets.
11874
11875 @node MIPS Loongson Built-in Functions
11876 @subsection MIPS Loongson Built-in Functions
11877
11878 GCC provides intrinsics to access the SIMD instructions provided by the
11879 ST Microelectronics Loongson-2E and -2F processors.  These intrinsics,
11880 available after inclusion of the @code{loongson.h} header file,
11881 operate on the following 64-bit vector types:
11882
11883 @itemize
11884 @item @code{uint8x8_t}, a vector of eight unsigned 8-bit integers;
11885 @item @code{uint16x4_t}, a vector of four unsigned 16-bit integers;
11886 @item @code{uint32x2_t}, a vector of two unsigned 32-bit integers;
11887 @item @code{int8x8_t}, a vector of eight signed 8-bit integers;
11888 @item @code{int16x4_t}, a vector of four signed 16-bit integers;
11889 @item @code{int32x2_t}, a vector of two signed 32-bit integers.
11890 @end itemize
11891
11892 The intrinsics provided are listed below; each is named after the
11893 machine instruction to which it corresponds, with suffixes added as
11894 appropriate to distinguish intrinsics that expand to the same machine
11895 instruction yet have different argument types.  Refer to the architecture
11896 documentation for a description of the functionality of each
11897 instruction.
11898
11899 @smallexample
11900 int16x4_t packsswh (int32x2_t s, int32x2_t t);
11901 int8x8_t packsshb (int16x4_t s, int16x4_t t);
11902 uint8x8_t packushb (uint16x4_t s, uint16x4_t t);
11903 uint32x2_t paddw_u (uint32x2_t s, uint32x2_t t);
11904 uint16x4_t paddh_u (uint16x4_t s, uint16x4_t t);
11905 uint8x8_t paddb_u (uint8x8_t s, uint8x8_t t);
11906 int32x2_t paddw_s (int32x2_t s, int32x2_t t);
11907 int16x4_t paddh_s (int16x4_t s, int16x4_t t);
11908 int8x8_t paddb_s (int8x8_t s, int8x8_t t);
11909 uint64_t paddd_u (uint64_t s, uint64_t t);
11910 int64_t paddd_s (int64_t s, int64_t t);
11911 int16x4_t paddsh (int16x4_t s, int16x4_t t);
11912 int8x8_t paddsb (int8x8_t s, int8x8_t t);
11913 uint16x4_t paddush (uint16x4_t s, uint16x4_t t);
11914 uint8x8_t paddusb (uint8x8_t s, uint8x8_t t);
11915 uint64_t pandn_ud (uint64_t s, uint64_t t);
11916 uint32x2_t pandn_uw (uint32x2_t s, uint32x2_t t);
11917 uint16x4_t pandn_uh (uint16x4_t s, uint16x4_t t);
11918 uint8x8_t pandn_ub (uint8x8_t s, uint8x8_t t);
11919 int64_t pandn_sd (int64_t s, int64_t t);
11920 int32x2_t pandn_sw (int32x2_t s, int32x2_t t);
11921 int16x4_t pandn_sh (int16x4_t s, int16x4_t t);
11922 int8x8_t pandn_sb (int8x8_t s, int8x8_t t);
11923 uint16x4_t pavgh (uint16x4_t s, uint16x4_t t);
11924 uint8x8_t pavgb (uint8x8_t s, uint8x8_t t);
11925 uint32x2_t pcmpeqw_u (uint32x2_t s, uint32x2_t t);
11926 uint16x4_t pcmpeqh_u (uint16x4_t s, uint16x4_t t);
11927 uint8x8_t pcmpeqb_u (uint8x8_t s, uint8x8_t t);
11928 int32x2_t pcmpeqw_s (int32x2_t s, int32x2_t t);
11929 int16x4_t pcmpeqh_s (int16x4_t s, int16x4_t t);
11930 int8x8_t pcmpeqb_s (int8x8_t s, int8x8_t t);
11931 uint32x2_t pcmpgtw_u (uint32x2_t s, uint32x2_t t);
11932 uint16x4_t pcmpgth_u (uint16x4_t s, uint16x4_t t);
11933 uint8x8_t pcmpgtb_u (uint8x8_t s, uint8x8_t t);
11934 int32x2_t pcmpgtw_s (int32x2_t s, int32x2_t t);
11935 int16x4_t pcmpgth_s (int16x4_t s, int16x4_t t);
11936 int8x8_t pcmpgtb_s (int8x8_t s, int8x8_t t);
11937 uint16x4_t pextrh_u (uint16x4_t s, int field);
11938 int16x4_t pextrh_s (int16x4_t s, int field);
11939 uint16x4_t pinsrh_0_u (uint16x4_t s, uint16x4_t t);
11940 uint16x4_t pinsrh_1_u (uint16x4_t s, uint16x4_t t);
11941 uint16x4_t pinsrh_2_u (uint16x4_t s, uint16x4_t t);
11942 uint16x4_t pinsrh_3_u (uint16x4_t s, uint16x4_t t);
11943 int16x4_t pinsrh_0_s (int16x4_t s, int16x4_t t);
11944 int16x4_t pinsrh_1_s (int16x4_t s, int16x4_t t);
11945 int16x4_t pinsrh_2_s (int16x4_t s, int16x4_t t);
11946 int16x4_t pinsrh_3_s (int16x4_t s, int16x4_t t);
11947 int32x2_t pmaddhw (int16x4_t s, int16x4_t t);
11948 int16x4_t pmaxsh (int16x4_t s, int16x4_t t);
11949 uint8x8_t pmaxub (uint8x8_t s, uint8x8_t t);
11950 int16x4_t pminsh (int16x4_t s, int16x4_t t);
11951 uint8x8_t pminub (uint8x8_t s, uint8x8_t t);
11952 uint8x8_t pmovmskb_u (uint8x8_t s);
11953 int8x8_t pmovmskb_s (int8x8_t s);
11954 uint16x4_t pmulhuh (uint16x4_t s, uint16x4_t t);
11955 int16x4_t pmulhh (int16x4_t s, int16x4_t t);
11956 int16x4_t pmullh (int16x4_t s, int16x4_t t);
11957 int64_t pmuluw (uint32x2_t s, uint32x2_t t);
11958 uint8x8_t pasubub (uint8x8_t s, uint8x8_t t);
11959 uint16x4_t biadd (uint8x8_t s);
11960 uint16x4_t psadbh (uint8x8_t s, uint8x8_t t);
11961 uint16x4_t pshufh_u (uint16x4_t dest, uint16x4_t s, uint8_t order);
11962 int16x4_t pshufh_s (int16x4_t dest, int16x4_t s, uint8_t order);
11963 uint16x4_t psllh_u (uint16x4_t s, uint8_t amount);
11964 int16x4_t psllh_s (int16x4_t s, uint8_t amount);
11965 uint32x2_t psllw_u (uint32x2_t s, uint8_t amount);
11966 int32x2_t psllw_s (int32x2_t s, uint8_t amount);
11967 uint16x4_t psrlh_u (uint16x4_t s, uint8_t amount);
11968 int16x4_t psrlh_s (int16x4_t s, uint8_t amount);
11969 uint32x2_t psrlw_u (uint32x2_t s, uint8_t amount);
11970 int32x2_t psrlw_s (int32x2_t s, uint8_t amount);
11971 uint16x4_t psrah_u (uint16x4_t s, uint8_t amount);
11972 int16x4_t psrah_s (int16x4_t s, uint8_t amount);
11973 uint32x2_t psraw_u (uint32x2_t s, uint8_t amount);
11974 int32x2_t psraw_s (int32x2_t s, uint8_t amount);
11975 uint32x2_t psubw_u (uint32x2_t s, uint32x2_t t);
11976 uint16x4_t psubh_u (uint16x4_t s, uint16x4_t t);
11977 uint8x8_t psubb_u (uint8x8_t s, uint8x8_t t);
11978 int32x2_t psubw_s (int32x2_t s, int32x2_t t);
11979 int16x4_t psubh_s (int16x4_t s, int16x4_t t);
11980 int8x8_t psubb_s (int8x8_t s, int8x8_t t);
11981 uint64_t psubd_u (uint64_t s, uint64_t t);
11982 int64_t psubd_s (int64_t s, int64_t t);
11983 int16x4_t psubsh (int16x4_t s, int16x4_t t);
11984 int8x8_t psubsb (int8x8_t s, int8x8_t t);
11985 uint16x4_t psubush (uint16x4_t s, uint16x4_t t);
11986 uint8x8_t psubusb (uint8x8_t s, uint8x8_t t);
11987 uint32x2_t punpckhwd_u (uint32x2_t s, uint32x2_t t);
11988 uint16x4_t punpckhhw_u (uint16x4_t s, uint16x4_t t);
11989 uint8x8_t punpckhbh_u (uint8x8_t s, uint8x8_t t);
11990 int32x2_t punpckhwd_s (int32x2_t s, int32x2_t t);
11991 int16x4_t punpckhhw_s (int16x4_t s, int16x4_t t);
11992 int8x8_t punpckhbh_s (int8x8_t s, int8x8_t t);
11993 uint32x2_t punpcklwd_u (uint32x2_t s, uint32x2_t t);
11994 uint16x4_t punpcklhw_u (uint16x4_t s, uint16x4_t t);
11995 uint8x8_t punpcklbh_u (uint8x8_t s, uint8x8_t t);
11996 int32x2_t punpcklwd_s (int32x2_t s, int32x2_t t);
11997 int16x4_t punpcklhw_s (int16x4_t s, int16x4_t t);
11998 int8x8_t punpcklbh_s (int8x8_t s, int8x8_t t);
11999 @end smallexample
12000
12001 @menu
12002 * Paired-Single Arithmetic::
12003 * Paired-Single Built-in Functions::
12004 * MIPS-3D Built-in Functions::
12005 @end menu
12006
12007 @node Paired-Single Arithmetic
12008 @subsubsection Paired-Single Arithmetic
12009
12010 The table below lists the @code{v2sf} operations for which hardware
12011 support exists.  @code{a}, @code{b} and @code{c} are @code{v2sf}
12012 values and @code{x} is an integral value.
12013
12014 @multitable @columnfractions .50 .50
12015 @item C code @tab MIPS instruction
12016 @item @code{a + b} @tab @code{add.ps}
12017 @item @code{a - b} @tab @code{sub.ps}
12018 @item @code{-a} @tab @code{neg.ps}
12019 @item @code{a * b} @tab @code{mul.ps}
12020 @item @code{a * b + c} @tab @code{madd.ps}
12021 @item @code{a * b - c} @tab @code{msub.ps}
12022 @item @code{-(a * b + c)} @tab @code{nmadd.ps}
12023 @item @code{-(a * b - c)} @tab @code{nmsub.ps}
12024 @item @code{x ? a : b} @tab @code{movn.ps}/@code{movz.ps}
12025 @end multitable
12026
12027 Note that the multiply-accumulate instructions can be disabled
12028 using the command-line option @code{-mno-fused-madd}.
12029
12030 @node Paired-Single Built-in Functions
12031 @subsubsection Paired-Single Built-in Functions
12032
12033 The following paired-single functions map directly to a particular
12034 MIPS instruction.  Please refer to the architecture specification
12035 for details on what each instruction does.
12036
12037 @table @code
12038 @item v2sf __builtin_mips_pll_ps (v2sf, v2sf)
12039 Pair lower lower (@code{pll.ps}).
12040
12041 @item v2sf __builtin_mips_pul_ps (v2sf, v2sf)
12042 Pair upper lower (@code{pul.ps}).
12043
12044 @item v2sf __builtin_mips_plu_ps (v2sf, v2sf)
12045 Pair lower upper (@code{plu.ps}).
12046
12047 @item v2sf __builtin_mips_puu_ps (v2sf, v2sf)
12048 Pair upper upper (@code{puu.ps}).
12049
12050 @item v2sf __builtin_mips_cvt_ps_s (float, float)
12051 Convert pair to paired single (@code{cvt.ps.s}).
12052
12053 @item float __builtin_mips_cvt_s_pl (v2sf)
12054 Convert pair lower to single (@code{cvt.s.pl}).
12055
12056 @item float __builtin_mips_cvt_s_pu (v2sf)
12057 Convert pair upper to single (@code{cvt.s.pu}).
12058
12059 @item v2sf __builtin_mips_abs_ps (v2sf)
12060 Absolute value (@code{abs.ps}).
12061
12062 @item v2sf __builtin_mips_alnv_ps (v2sf, v2sf, int)
12063 Align variable (@code{alnv.ps}).
12064
12065 @emph{Note:} The value of the third parameter must be 0 or 4
12066 modulo 8, otherwise the result is unpredictable.  Please read the
12067 instruction description for details.
12068 @end table
12069
12070 The following multi-instruction functions are also available.
12071 In each case, @var{cond} can be any of the 16 floating-point conditions:
12072 @code{f}, @code{un}, @code{eq}, @code{ueq}, @code{olt}, @code{ult},
12073 @code{ole}, @code{ule}, @code{sf}, @code{ngle}, @code{seq}, @code{ngl},
12074 @code{lt}, @code{nge}, @code{le} or @code{ngt}.
12075
12076 @table @code
12077 @item v2sf __builtin_mips_movt_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12078 @itemx v2sf __builtin_mips_movf_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12079 Conditional move based on floating-point comparison (@code{c.@var{cond}.ps},
12080 @code{movt.ps}/@code{movf.ps}).
12081
12082 The @code{movt} functions return the value @var{x} computed by:
12083
12084 @smallexample
12085 c.@var{cond}.ps @var{cc},@var{a},@var{b}
12086 mov.ps @var{x},@var{c}
12087 movt.ps @var{x},@var{d},@var{cc}
12088 @end smallexample
12089
12090 The @code{movf} functions are similar but use @code{movf.ps} instead
12091 of @code{movt.ps}.
12092
12093 @item int __builtin_mips_upper_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12094 @itemx int __builtin_mips_lower_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12095 Comparison of two paired-single values (@code{c.@var{cond}.ps},
12096 @code{bc1t}/@code{bc1f}).
12097
12098 These functions compare @var{a} and @var{b} using @code{c.@var{cond}.ps}
12099 and return either the upper or lower half of the result.  For example:
12100
12101 @smallexample
12102 v2sf a, b;
12103 if (__builtin_mips_upper_c_eq_ps (a, b))
12104   upper_halves_are_equal ();
12105 else
12106   upper_halves_are_unequal ();
12107
12108 if (__builtin_mips_lower_c_eq_ps (a, b))
12109   lower_halves_are_equal ();
12110 else
12111   lower_halves_are_unequal ();
12112 @end smallexample
12113 @end table
12114
12115 @node MIPS-3D Built-in Functions
12116 @subsubsection MIPS-3D Built-in Functions
12117
12118 The MIPS-3D Application-Specific Extension (ASE) includes additional
12119 paired-single instructions that are designed to improve the performance
12120 of 3D graphics operations.  Support for these instructions is controlled
12121 by the @option{-mips3d} command-line option.
12122
12123 The functions listed below map directly to a particular MIPS-3D
12124 instruction.  Please refer to the architecture specification for
12125 more details on what each instruction does.
12126
12127 @table @code
12128 @item v2sf __builtin_mips_addr_ps (v2sf, v2sf)
12129 Reduction add (@code{addr.ps}).
12130
12131 @item v2sf __builtin_mips_mulr_ps (v2sf, v2sf)
12132 Reduction multiply (@code{mulr.ps}).
12133
12134 @item v2sf __builtin_mips_cvt_pw_ps (v2sf)
12135 Convert paired single to paired word (@code{cvt.pw.ps}).
12136
12137 @item v2sf __builtin_mips_cvt_ps_pw (v2sf)
12138 Convert paired word to paired single (@code{cvt.ps.pw}).
12139
12140 @item float __builtin_mips_recip1_s (float)
12141 @itemx double __builtin_mips_recip1_d (double)
12142 @itemx v2sf __builtin_mips_recip1_ps (v2sf)
12143 Reduced-precision reciprocal (sequence step 1) (@code{recip1.@var{fmt}}).
12144
12145 @item float __builtin_mips_recip2_s (float, float)
12146 @itemx double __builtin_mips_recip2_d (double, double)
12147 @itemx v2sf __builtin_mips_recip2_ps (v2sf, v2sf)
12148 Reduced-precision reciprocal (sequence step 2) (@code{recip2.@var{fmt}}).
12149
12150 @item float __builtin_mips_rsqrt1_s (float)
12151 @itemx double __builtin_mips_rsqrt1_d (double)
12152 @itemx v2sf __builtin_mips_rsqrt1_ps (v2sf)
12153 Reduced-precision reciprocal square root (sequence step 1)
12154 (@code{rsqrt1.@var{fmt}}).
12155
12156 @item float __builtin_mips_rsqrt2_s (float, float)
12157 @itemx double __builtin_mips_rsqrt2_d (double, double)
12158 @itemx v2sf __builtin_mips_rsqrt2_ps (v2sf, v2sf)
12159 Reduced-precision reciprocal square root (sequence step 2)
12160 (@code{rsqrt2.@var{fmt}}).
12161 @end table
12162
12163 The following multi-instruction functions are also available.
12164 In each case, @var{cond} can be any of the 16 floating-point conditions:
12165 @code{f}, @code{un}, @code{eq}, @code{ueq}, @code{olt}, @code{ult},
12166 @code{ole}, @code{ule}, @code{sf}, @code{ngle}, @code{seq},
12167 @code{ngl}, @code{lt}, @code{nge}, @code{le} or @code{ngt}.
12168
12169 @table @code
12170 @item int __builtin_mips_cabs_@var{cond}_s (float @var{a}, float @var{b})
12171 @itemx int __builtin_mips_cabs_@var{cond}_d (double @var{a}, double @var{b})
12172 Absolute comparison of two scalar values (@code{cabs.@var{cond}.@var{fmt}},
12173 @code{bc1t}/@code{bc1f}).
12174
12175 These functions compare @var{a} and @var{b} using @code{cabs.@var{cond}.s}
12176 or @code{cabs.@var{cond}.d} and return the result as a boolean value.
12177 For example:
12178
12179 @smallexample
12180 float a, b;
12181 if (__builtin_mips_cabs_eq_s (a, b))
12182   true ();
12183 else
12184   false ();
12185 @end smallexample
12186
12187 @item int __builtin_mips_upper_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12188 @itemx int __builtin_mips_lower_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12189 Absolute comparison of two paired-single values (@code{cabs.@var{cond}.ps},
12190 @code{bc1t}/@code{bc1f}).
12191
12192 These functions compare @var{a} and @var{b} using @code{cabs.@var{cond}.ps}
12193 and return either the upper or lower half of the result.  For example:
12194
12195 @smallexample
12196 v2sf a, b;
12197 if (__builtin_mips_upper_cabs_eq_ps (a, b))
12198   upper_halves_are_equal ();
12199 else
12200   upper_halves_are_unequal ();
12201
12202 if (__builtin_mips_lower_cabs_eq_ps (a, b))
12203   lower_halves_are_equal ();
12204 else
12205   lower_halves_are_unequal ();
12206 @end smallexample
12207
12208 @item v2sf __builtin_mips_movt_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12209 @itemx v2sf __builtin_mips_movf_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12210 Conditional move based on absolute comparison (@code{cabs.@var{cond}.ps},
12211 @code{movt.ps}/@code{movf.ps}).
12212
12213 The @code{movt} functions return the value @var{x} computed by:
12214
12215 @smallexample
12216 cabs.@var{cond}.ps @var{cc},@var{a},@var{b}
12217 mov.ps @var{x},@var{c}
12218 movt.ps @var{x},@var{d},@var{cc}
12219 @end smallexample
12220
12221 The @code{movf} functions are similar but use @code{movf.ps} instead
12222 of @code{movt.ps}.
12223
12224 @item int __builtin_mips_any_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12225 @itemx int __builtin_mips_all_c_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12226 @itemx int __builtin_mips_any_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12227 @itemx int __builtin_mips_all_cabs_@var{cond}_ps (v2sf @var{a}, v2sf @var{b})
12228 Comparison of two paired-single values
12229 (@code{c.@var{cond}.ps}/@code{cabs.@var{cond}.ps},
12230 @code{bc1any2t}/@code{bc1any2f}).
12231
12232 These functions compare @var{a} and @var{b} using @code{c.@var{cond}.ps}
12233 or @code{cabs.@var{cond}.ps}.  The @code{any} forms return true if either
12234 result is true and the @code{all} forms return true if both results are true.
12235 For example:
12236
12237 @smallexample
12238 v2sf a, b;
12239 if (__builtin_mips_any_c_eq_ps (a, b))
12240   one_is_true ();
12241 else
12242   both_are_false ();
12243
12244 if (__builtin_mips_all_c_eq_ps (a, b))
12245   both_are_true ();
12246 else
12247   one_is_false ();
12248 @end smallexample
12249
12250 @item int __builtin_mips_any_c_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12251 @itemx int __builtin_mips_all_c_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12252 @itemx int __builtin_mips_any_cabs_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12253 @itemx int __builtin_mips_all_cabs_@var{cond}_4s (v2sf @var{a}, v2sf @var{b}, v2sf @var{c}, v2sf @var{d})
12254 Comparison of four paired-single values
12255 (@code{c.@var{cond}.ps}/@code{cabs.@var{cond}.ps},
12256 @code{bc1any4t}/@code{bc1any4f}).
12257
12258 These functions use @code{c.@var{cond}.ps} or @code{cabs.@var{cond}.ps}
12259 to compare @var{a} with @var{b} and to compare @var{c} with @var{d}.
12260 The @code{any} forms return true if any of the four results are true
12261 and the @code{all} forms return true if all four results are true.
12262 For example:
12263
12264 @smallexample
12265 v2sf a, b, c, d;
12266 if (__builtin_mips_any_c_eq_4s (a, b, c, d))
12267   some_are_true ();
12268 else
12269   all_are_false ();
12270
12271 if (__builtin_mips_all_c_eq_4s (a, b, c, d))
12272   all_are_true ();
12273 else
12274   some_are_false ();
12275 @end smallexample
12276 @end table
12277
12278 @node Other MIPS Built-in Functions
12279 @subsection Other MIPS Built-in Functions
12280
12281 GCC provides other MIPS-specific built-in functions:
12282
12283 @table @code
12284 @item void __builtin_mips_cache (int @var{op}, const volatile void *@var{addr})
12285 Insert a @samp{cache} instruction with operands @var{op} and @var{addr}.
12286 GCC defines the preprocessor macro @code{___GCC_HAVE_BUILTIN_MIPS_CACHE}
12287 when this function is available.
12288
12289 @item unsigned int __builtin_mips_get_fcsr (void)
12290 @itemx void __builtin_mips_set_fcsr (unsigned int @var{value})
12291 Get and set the contents of the floating-point control and status register
12292 (FPU control register 31).  These functions are only available in hard-float
12293 code but can be called in both MIPS16 and non-MIPS16 contexts.
12294
12295 @code{__builtin_mips_set_fcsr} can be used to change any bit of the
12296 register except the condition codes, which GCC assumes are preserved.
12297 @end table
12298
12299 @node MSP430 Built-in Functions
12300 @subsection MSP430 Built-in Functions
12301
12302 GCC provides a couple of special builtin functions to aid in the
12303 writing of interrupt handlers in C.
12304
12305 @table @code
12306 @item __bic_SR_register_on_exit (int @var{mask})
12307 This clears the indicated bits in the saved copy of the status register
12308 currently residing on the stack.  This only works inside interrupt
12309 handlers and the changes to the status register will only take affect
12310 once the handler returns.
12311
12312 @item __bis_SR_register_on_exit (int @var{mask})
12313 This sets the indicated bits in the saved copy of the status register
12314 currently residing on the stack.  This only works inside interrupt
12315 handlers and the changes to the status register will only take affect
12316 once the handler returns.
12317
12318 @item __delay_cycles (long long @var{cycles})
12319 This inserts an instruction sequence that takes exactly @var{cycles}
12320 cycles (between 0 and about 17E9) to complete.  The inserted sequence
12321 may use jumps, loops, or no-ops, and does not interfere with any other
12322 instructions.  Note that @var{cycles} must be a compile-time constant
12323 integer - that is, you must pass a number, not a variable that may be
12324 optimized to a constant later.  The number of cycles delayed by this
12325 builtin is exact.
12326 @end table
12327
12328 @node NDS32 Built-in Functions
12329 @subsection NDS32 Built-in Functions
12330
12331 These built-in functions are available for the NDS32 target:
12332
12333 @deftypefn {Built-in Function} void __builtin_nds32_isync (int *@var{addr})
12334 Insert an ISYNC instruction into the instruction stream where
12335 @var{addr} is an instruction address for serialization.
12336 @end deftypefn
12337
12338 @deftypefn {Built-in Function} void __builtin_nds32_isb (void)
12339 Insert an ISB instruction into the instruction stream.
12340 @end deftypefn
12341
12342 @deftypefn {Built-in Function} int __builtin_nds32_mfsr (int @var{sr})
12343 Return the content of a system register which is mapped by @var{sr}.
12344 @end deftypefn
12345
12346 @deftypefn {Built-in Function} int __builtin_nds32_mfusr (int @var{usr})
12347 Return the content of a user space register which is mapped by @var{usr}.
12348 @end deftypefn
12349
12350 @deftypefn {Built-in Function} void __builtin_nds32_mtsr (int @var{value}, int @var{sr})
12351 Move the @var{value} to a system register which is mapped by @var{sr}.
12352 @end deftypefn
12353
12354 @deftypefn {Built-in Function} void __builtin_nds32_mtusr (int @var{value}, int @var{usr})
12355 Move the @var{value} to a user space register which is mapped by @var{usr}.
12356 @end deftypefn
12357
12358 @deftypefn {Built-in Function} void __builtin_nds32_setgie_en (void)
12359 Enable global interrupt.
12360 @end deftypefn
12361
12362 @deftypefn {Built-in Function} void __builtin_nds32_setgie_dis (void)
12363 Disable global interrupt.
12364 @end deftypefn
12365
12366 @node picoChip Built-in Functions
12367 @subsection picoChip Built-in Functions
12368
12369 GCC provides an interface to selected machine instructions from the
12370 picoChip instruction set.
12371
12372 @table @code
12373 @item int __builtin_sbc (int @var{value})
12374 Sign bit count.  Return the number of consecutive bits in @var{value}
12375 that have the same value as the sign bit.  The result is the number of
12376 leading sign bits minus one, giving the number of redundant sign bits in
12377 @var{value}.
12378
12379 @item int __builtin_byteswap (int @var{value})
12380 Byte swap.  Return the result of swapping the upper and lower bytes of
12381 @var{value}.
12382
12383 @item int __builtin_brev (int @var{value})
12384 Bit reversal.  Return the result of reversing the bits in
12385 @var{value}.  Bit 15 is swapped with bit 0, bit 14 is swapped with bit 1,
12386 and so on.
12387
12388 @item int __builtin_adds (int @var{x}, int @var{y})
12389 Saturating addition.  Return the result of adding @var{x} and @var{y},
12390 storing the value 32767 if the result overflows.
12391
12392 @item int __builtin_subs (int @var{x}, int @var{y})
12393 Saturating subtraction.  Return the result of subtracting @var{y} from
12394 @var{x}, storing the value @minus{}32768 if the result overflows.
12395
12396 @item void __builtin_halt (void)
12397 Halt.  The processor stops execution.  This built-in is useful for
12398 implementing assertions.
12399
12400 @end table
12401
12402 @node PowerPC Built-in Functions
12403 @subsection PowerPC Built-in Functions
12404
12405 These built-in functions are available for the PowerPC family of
12406 processors:
12407 @smallexample
12408 float __builtin_recipdivf (float, float);
12409 float __builtin_rsqrtf (float);
12410 double __builtin_recipdiv (double, double);
12411 double __builtin_rsqrt (double);
12412 uint64_t __builtin_ppc_get_timebase ();
12413 unsigned long __builtin_ppc_mftb ();
12414 double __builtin_unpack_longdouble (long double, int);
12415 long double __builtin_pack_longdouble (double, double);
12416 @end smallexample
12417
12418 The @code{vec_rsqrt}, @code{__builtin_rsqrt}, and
12419 @code{__builtin_rsqrtf} functions generate multiple instructions to
12420 implement the reciprocal sqrt functionality using reciprocal sqrt
12421 estimate instructions.
12422
12423 The @code{__builtin_recipdiv}, and @code{__builtin_recipdivf}
12424 functions generate multiple instructions to implement division using
12425 the reciprocal estimate instructions.
12426
12427 The @code{__builtin_ppc_get_timebase} and @code{__builtin_ppc_mftb}
12428 functions generate instructions to read the Time Base Register.  The
12429 @code{__builtin_ppc_get_timebase} function may generate multiple
12430 instructions and always returns the 64 bits of the Time Base Register.
12431 The @code{__builtin_ppc_mftb} function always generates one instruction and
12432 returns the Time Base Register value as an unsigned long, throwing away
12433 the most significant word on 32-bit environments.
12434
12435 The following built-in functions are available for the PowerPC family
12436 of processors, starting with ISA 2.06 or later (@option{-mcpu=power7}
12437 or @option{-mpopcntd}):
12438 @smallexample
12439 long __builtin_bpermd (long, long);
12440 int __builtin_divwe (int, int);
12441 int __builtin_divweo (int, int);
12442 unsigned int __builtin_divweu (unsigned int, unsigned int);
12443 unsigned int __builtin_divweuo (unsigned int, unsigned int);
12444 long __builtin_divde (long, long);
12445 long __builtin_divdeo (long, long);
12446 unsigned long __builtin_divdeu (unsigned long, unsigned long);
12447 unsigned long __builtin_divdeuo (unsigned long, unsigned long);
12448 unsigned int cdtbcd (unsigned int);
12449 unsigned int cbcdtd (unsigned int);
12450 unsigned int addg6s (unsigned int, unsigned int);
12451 @end smallexample
12452
12453 The @code{__builtin_divde}, @code{__builtin_divdeo},
12454 @code{__builitin_divdeu}, @code{__builtin_divdeou} functions require a
12455 64-bit environment support ISA 2.06 or later.
12456
12457 The following built-in functions are available for the PowerPC family
12458 of processors when hardware decimal floating point
12459 (@option{-mhard-dfp}) is available:
12460 @smallexample
12461 _Decimal64 __builtin_dxex (_Decimal64);
12462 _Decimal128 __builtin_dxexq (_Decimal128);
12463 _Decimal64 __builtin_ddedpd (int, _Decimal64);
12464 _Decimal128 __builtin_ddedpdq (int, _Decimal128);
12465 _Decimal64 __builtin_denbcd (int, _Decimal64);
12466 _Decimal128 __builtin_denbcdq (int, _Decimal128);
12467 _Decimal64 __builtin_diex (_Decimal64, _Decimal64);
12468 _Decimal128 _builtin_diexq (_Decimal128, _Decimal128);
12469 _Decimal64 __builtin_dscli (_Decimal64, int);
12470 _Decimal128 __builitn_dscliq (_Decimal128, int);
12471 _Decimal64 __builtin_dscri (_Decimal64, int);
12472 _Decimal128 __builitn_dscriq (_Decimal128, int);
12473 unsigned long long __builtin_unpack_dec128 (_Decimal128, int);
12474 _Decimal128 __builtin_pack_dec128 (unsigned long long, unsigned long long);
12475 @end smallexample
12476
12477 The following built-in functions are available for the PowerPC family
12478 of processors when the Vector Scalar (vsx) instruction set is
12479 available:
12480 @smallexample
12481 unsigned long long __builtin_unpack_vector_int128 (vector __int128_t, int);
12482 vector __int128_t __builtin_pack_vector_int128 (unsigned long long,
12483                                                 unsigned long long);
12484 @end smallexample
12485
12486 @node PowerPC AltiVec/VSX Built-in Functions
12487 @subsection PowerPC AltiVec Built-in Functions
12488
12489 GCC provides an interface for the PowerPC family of processors to access
12490 the AltiVec operations described in Motorola's AltiVec Programming
12491 Interface Manual.  The interface is made available by including
12492 @code{<altivec.h>} and using @option{-maltivec} and
12493 @option{-mabi=altivec}.  The interface supports the following vector
12494 types.
12495
12496 @smallexample
12497 vector unsigned char
12498 vector signed char
12499 vector bool char
12500
12501 vector unsigned short
12502 vector signed short
12503 vector bool short
12504 vector pixel
12505
12506 vector unsigned int
12507 vector signed int
12508 vector bool int
12509 vector float
12510 @end smallexample
12511
12512 If @option{-mvsx} is used the following additional vector types are
12513 implemented.
12514
12515 @smallexample
12516 vector unsigned long
12517 vector signed long
12518 vector double
12519 @end smallexample
12520
12521 The long types are only implemented for 64-bit code generation, and
12522 the long type is only used in the floating point/integer conversion
12523 instructions.
12524
12525 GCC's implementation of the high-level language interface available from
12526 C and C++ code differs from Motorola's documentation in several ways.
12527
12528 @itemize @bullet
12529
12530 @item
12531 A vector constant is a list of constant expressions within curly braces.
12532
12533 @item
12534 A vector initializer requires no cast if the vector constant is of the
12535 same type as the variable it is initializing.
12536
12537 @item
12538 If @code{signed} or @code{unsigned} is omitted, the signedness of the
12539 vector type is the default signedness of the base type.  The default
12540 varies depending on the operating system, so a portable program should
12541 always specify the signedness.
12542
12543 @item
12544 Compiling with @option{-maltivec} adds keywords @code{__vector},
12545 @code{vector}, @code{__pixel}, @code{pixel}, @code{__bool} and
12546 @code{bool}.  When compiling ISO C, the context-sensitive substitution
12547 of the keywords @code{vector}, @code{pixel} and @code{bool} is
12548 disabled.  To use them, you must include @code{<altivec.h>} instead.
12549
12550 @item
12551 GCC allows using a @code{typedef} name as the type specifier for a
12552 vector type.
12553
12554 @item
12555 For C, overloaded functions are implemented with macros so the following
12556 does not work:
12557
12558 @smallexample
12559   vec_add ((vector signed int)@{1, 2, 3, 4@}, foo);
12560 @end smallexample
12561
12562 @noindent
12563 Since @code{vec_add} is a macro, the vector constant in the example
12564 is treated as four separate arguments.  Wrap the entire argument in
12565 parentheses for this to work.
12566 @end itemize
12567
12568 @emph{Note:} Only the @code{<altivec.h>} interface is supported.
12569 Internally, GCC uses built-in functions to achieve the functionality in
12570 the aforementioned header file, but they are not supported and are
12571 subject to change without notice.
12572
12573 The following interfaces are supported for the generic and specific
12574 AltiVec operations and the AltiVec predicates.  In cases where there
12575 is a direct mapping between generic and specific operations, only the
12576 generic names are shown here, although the specific operations can also
12577 be used.
12578
12579 Arguments that are documented as @code{const int} require literal
12580 integral values within the range required for that operation.
12581
12582 @smallexample
12583 vector signed char vec_abs (vector signed char);
12584 vector signed short vec_abs (vector signed short);
12585 vector signed int vec_abs (vector signed int);
12586 vector float vec_abs (vector float);
12587
12588 vector signed char vec_abss (vector signed char);
12589 vector signed short vec_abss (vector signed short);
12590 vector signed int vec_abss (vector signed int);
12591
12592 vector signed char vec_add (vector bool char, vector signed char);
12593 vector signed char vec_add (vector signed char, vector bool char);
12594 vector signed char vec_add (vector signed char, vector signed char);
12595 vector unsigned char vec_add (vector bool char, vector unsigned char);
12596 vector unsigned char vec_add (vector unsigned char, vector bool char);
12597 vector unsigned char vec_add (vector unsigned char,
12598                               vector unsigned char);
12599 vector signed short vec_add (vector bool short, vector signed short);
12600 vector signed short vec_add (vector signed short, vector bool short);
12601 vector signed short vec_add (vector signed short, vector signed short);
12602 vector unsigned short vec_add (vector bool short,
12603                                vector unsigned short);
12604 vector unsigned short vec_add (vector unsigned short,
12605                                vector bool short);
12606 vector unsigned short vec_add (vector unsigned short,
12607                                vector unsigned short);
12608 vector signed int vec_add (vector bool int, vector signed int);
12609 vector signed int vec_add (vector signed int, vector bool int);
12610 vector signed int vec_add (vector signed int, vector signed int);
12611 vector unsigned int vec_add (vector bool int, vector unsigned int);
12612 vector unsigned int vec_add (vector unsigned int, vector bool int);
12613 vector unsigned int vec_add (vector unsigned int, vector unsigned int);
12614 vector float vec_add (vector float, vector float);
12615
12616 vector float vec_vaddfp (vector float, vector float);
12617
12618 vector signed int vec_vadduwm (vector bool int, vector signed int);
12619 vector signed int vec_vadduwm (vector signed int, vector bool int);
12620 vector signed int vec_vadduwm (vector signed int, vector signed int);
12621 vector unsigned int vec_vadduwm (vector bool int, vector unsigned int);
12622 vector unsigned int vec_vadduwm (vector unsigned int, vector bool int);
12623 vector unsigned int vec_vadduwm (vector unsigned int,
12624                                  vector unsigned int);
12625
12626 vector signed short vec_vadduhm (vector bool short,
12627                                  vector signed short);
12628 vector signed short vec_vadduhm (vector signed short,
12629                                  vector bool short);
12630 vector signed short vec_vadduhm (vector signed short,
12631                                  vector signed short);
12632 vector unsigned short vec_vadduhm (vector bool short,
12633                                    vector unsigned short);
12634 vector unsigned short vec_vadduhm (vector unsigned short,
12635                                    vector bool short);
12636 vector unsigned short vec_vadduhm (vector unsigned short,
12637                                    vector unsigned short);
12638
12639 vector signed char vec_vaddubm (vector bool char, vector signed char);
12640 vector signed char vec_vaddubm (vector signed char, vector bool char);
12641 vector signed char vec_vaddubm (vector signed char, vector signed char);
12642 vector unsigned char vec_vaddubm (vector bool char,
12643                                   vector unsigned char);
12644 vector unsigned char vec_vaddubm (vector unsigned char,
12645                                   vector bool char);
12646 vector unsigned char vec_vaddubm (vector unsigned char,
12647                                   vector unsigned char);
12648
12649 vector unsigned int vec_addc (vector unsigned int, vector unsigned int);
12650
12651 vector unsigned char vec_adds (vector bool char, vector unsigned char);
12652 vector unsigned char vec_adds (vector unsigned char, vector bool char);
12653 vector unsigned char vec_adds (vector unsigned char,
12654                                vector unsigned char);
12655 vector signed char vec_adds (vector bool char, vector signed char);
12656 vector signed char vec_adds (vector signed char, vector bool char);
12657 vector signed char vec_adds (vector signed char, vector signed char);
12658 vector unsigned short vec_adds (vector bool short,
12659                                 vector unsigned short);
12660 vector unsigned short vec_adds (vector unsigned short,
12661                                 vector bool short);
12662 vector unsigned short vec_adds (vector unsigned short,
12663                                 vector unsigned short);
12664 vector signed short vec_adds (vector bool short, vector signed short);
12665 vector signed short vec_adds (vector signed short, vector bool short);
12666 vector signed short vec_adds (vector signed short, vector signed short);
12667 vector unsigned int vec_adds (vector bool int, vector unsigned int);
12668 vector unsigned int vec_adds (vector unsigned int, vector bool int);
12669 vector unsigned int vec_adds (vector unsigned int, vector unsigned int);
12670 vector signed int vec_adds (vector bool int, vector signed int);
12671 vector signed int vec_adds (vector signed int, vector bool int);
12672 vector signed int vec_adds (vector signed int, vector signed int);
12673
12674 vector signed int vec_vaddsws (vector bool int, vector signed int);
12675 vector signed int vec_vaddsws (vector signed int, vector bool int);
12676 vector signed int vec_vaddsws (vector signed int, vector signed int);
12677
12678 vector unsigned int vec_vadduws (vector bool int, vector unsigned int);
12679 vector unsigned int vec_vadduws (vector unsigned int, vector bool int);
12680 vector unsigned int vec_vadduws (vector unsigned int,
12681                                  vector unsigned int);
12682
12683 vector signed short vec_vaddshs (vector bool short,
12684                                  vector signed short);
12685 vector signed short vec_vaddshs (vector signed short,
12686                                  vector bool short);
12687 vector signed short vec_vaddshs (vector signed short,
12688                                  vector signed short);
12689
12690 vector unsigned short vec_vadduhs (vector bool short,
12691                                    vector unsigned short);
12692 vector unsigned short vec_vadduhs (vector unsigned short,
12693                                    vector bool short);
12694 vector unsigned short vec_vadduhs (vector unsigned short,
12695                                    vector unsigned short);
12696
12697 vector signed char vec_vaddsbs (vector bool char, vector signed char);
12698 vector signed char vec_vaddsbs (vector signed char, vector bool char);
12699 vector signed char vec_vaddsbs (vector signed char, vector signed char);
12700
12701 vector unsigned char vec_vaddubs (vector bool char,
12702                                   vector unsigned char);
12703 vector unsigned char vec_vaddubs (vector unsigned char,
12704                                   vector bool char);
12705 vector unsigned char vec_vaddubs (vector unsigned char,
12706                                   vector unsigned char);
12707
12708 vector float vec_and (vector float, vector float);
12709 vector float vec_and (vector float, vector bool int);
12710 vector float vec_and (vector bool int, vector float);
12711 vector bool int vec_and (vector bool int, vector bool int);
12712 vector signed int vec_and (vector bool int, vector signed int);
12713 vector signed int vec_and (vector signed int, vector bool int);
12714 vector signed int vec_and (vector signed int, vector signed int);
12715 vector unsigned int vec_and (vector bool int, vector unsigned int);
12716 vector unsigned int vec_and (vector unsigned int, vector bool int);
12717 vector unsigned int vec_and (vector unsigned int, vector unsigned int);
12718 vector bool short vec_and (vector bool short, vector bool short);
12719 vector signed short vec_and (vector bool short, vector signed short);
12720 vector signed short vec_and (vector signed short, vector bool short);
12721 vector signed short vec_and (vector signed short, vector signed short);
12722 vector unsigned short vec_and (vector bool short,
12723                                vector unsigned short);
12724 vector unsigned short vec_and (vector unsigned short,
12725                                vector bool short);
12726 vector unsigned short vec_and (vector unsigned short,
12727                                vector unsigned short);
12728 vector signed char vec_and (vector bool char, vector signed char);
12729 vector bool char vec_and (vector bool char, vector bool char);
12730 vector signed char vec_and (vector signed char, vector bool char);
12731 vector signed char vec_and (vector signed char, vector signed char);
12732 vector unsigned char vec_and (vector bool char, vector unsigned char);
12733 vector unsigned char vec_and (vector unsigned char, vector bool char);
12734 vector unsigned char vec_and (vector unsigned char,
12735                               vector unsigned char);
12736
12737 vector float vec_andc (vector float, vector float);
12738 vector float vec_andc (vector float, vector bool int);
12739 vector float vec_andc (vector bool int, vector float);
12740 vector bool int vec_andc (vector bool int, vector bool int);
12741 vector signed int vec_andc (vector bool int, vector signed int);
12742 vector signed int vec_andc (vector signed int, vector bool int);
12743 vector signed int vec_andc (vector signed int, vector signed int);
12744 vector unsigned int vec_andc (vector bool int, vector unsigned int);
12745 vector unsigned int vec_andc (vector unsigned int, vector bool int);
12746 vector unsigned int vec_andc (vector unsigned int, vector unsigned int);
12747 vector bool short vec_andc (vector bool short, vector bool short);
12748 vector signed short vec_andc (vector bool short, vector signed short);
12749 vector signed short vec_andc (vector signed short, vector bool short);
12750 vector signed short vec_andc (vector signed short, vector signed short);
12751 vector unsigned short vec_andc (vector bool short,
12752                                 vector unsigned short);
12753 vector unsigned short vec_andc (vector unsigned short,
12754                                 vector bool short);
12755 vector unsigned short vec_andc (vector unsigned short,
12756                                 vector unsigned short);
12757 vector signed char vec_andc (vector bool char, vector signed char);
12758 vector bool char vec_andc (vector bool char, vector bool char);
12759 vector signed char vec_andc (vector signed char, vector bool char);
12760 vector signed char vec_andc (vector signed char, vector signed char);
12761 vector unsigned char vec_andc (vector bool char, vector unsigned char);
12762 vector unsigned char vec_andc (vector unsigned char, vector bool char);
12763 vector unsigned char vec_andc (vector unsigned char,
12764                                vector unsigned char);
12765
12766 vector unsigned char vec_avg (vector unsigned char,
12767                               vector unsigned char);
12768 vector signed char vec_avg (vector signed char, vector signed char);
12769 vector unsigned short vec_avg (vector unsigned short,
12770                                vector unsigned short);
12771 vector signed short vec_avg (vector signed short, vector signed short);
12772 vector unsigned int vec_avg (vector unsigned int, vector unsigned int);
12773 vector signed int vec_avg (vector signed int, vector signed int);
12774
12775 vector signed int vec_vavgsw (vector signed int, vector signed int);
12776
12777 vector unsigned int vec_vavguw (vector unsigned int,
12778                                 vector unsigned int);
12779
12780 vector signed short vec_vavgsh (vector signed short,
12781                                 vector signed short);
12782
12783 vector unsigned short vec_vavguh (vector unsigned short,
12784                                   vector unsigned short);
12785
12786 vector signed char vec_vavgsb (vector signed char, vector signed char);
12787
12788 vector unsigned char vec_vavgub (vector unsigned char,
12789                                  vector unsigned char);
12790
12791 vector float vec_copysign (vector float);
12792
12793 vector float vec_ceil (vector float);
12794
12795 vector signed int vec_cmpb (vector float, vector float);
12796
12797 vector bool char vec_cmpeq (vector signed char, vector signed char);
12798 vector bool char vec_cmpeq (vector unsigned char, vector unsigned char);
12799 vector bool short vec_cmpeq (vector signed short, vector signed short);
12800 vector bool short vec_cmpeq (vector unsigned short,
12801                              vector unsigned short);
12802 vector bool int vec_cmpeq (vector signed int, vector signed int);
12803 vector bool int vec_cmpeq (vector unsigned int, vector unsigned int);
12804 vector bool int vec_cmpeq (vector float, vector float);
12805
12806 vector bool int vec_vcmpeqfp (vector float, vector float);
12807
12808 vector bool int vec_vcmpequw (vector signed int, vector signed int);
12809 vector bool int vec_vcmpequw (vector unsigned int, vector unsigned int);
12810
12811 vector bool short vec_vcmpequh (vector signed short,
12812                                 vector signed short);
12813 vector bool short vec_vcmpequh (vector unsigned short,
12814                                 vector unsigned short);
12815
12816 vector bool char vec_vcmpequb (vector signed char, vector signed char);
12817 vector bool char vec_vcmpequb (vector unsigned char,
12818                                vector unsigned char);
12819
12820 vector bool int vec_cmpge (vector float, vector float);
12821
12822 vector bool char vec_cmpgt (vector unsigned char, vector unsigned char);
12823 vector bool char vec_cmpgt (vector signed char, vector signed char);
12824 vector bool short vec_cmpgt (vector unsigned short,
12825                              vector unsigned short);
12826 vector bool short vec_cmpgt (vector signed short, vector signed short);
12827 vector bool int vec_cmpgt (vector unsigned int, vector unsigned int);
12828 vector bool int vec_cmpgt (vector signed int, vector signed int);
12829 vector bool int vec_cmpgt (vector float, vector float);
12830
12831 vector bool int vec_vcmpgtfp (vector float, vector float);
12832
12833 vector bool int vec_vcmpgtsw (vector signed int, vector signed int);
12834
12835 vector bool int vec_vcmpgtuw (vector unsigned int, vector unsigned int);
12836
12837 vector bool short vec_vcmpgtsh (vector signed short,
12838                                 vector signed short);
12839
12840 vector bool short vec_vcmpgtuh (vector unsigned short,
12841                                 vector unsigned short);
12842
12843 vector bool char vec_vcmpgtsb (vector signed char, vector signed char);
12844
12845 vector bool char vec_vcmpgtub (vector unsigned char,
12846                                vector unsigned char);
12847
12848 vector bool int vec_cmple (vector float, vector float);
12849
12850 vector bool char vec_cmplt (vector unsigned char, vector unsigned char);
12851 vector bool char vec_cmplt (vector signed char, vector signed char);
12852 vector bool short vec_cmplt (vector unsigned short,
12853                              vector unsigned short);
12854 vector bool short vec_cmplt (vector signed short, vector signed short);
12855 vector bool int vec_cmplt (vector unsigned int, vector unsigned int);
12856 vector bool int vec_cmplt (vector signed int, vector signed int);
12857 vector bool int vec_cmplt (vector float, vector float);
12858
12859 vector float vec_cpsgn (vector float, vector float);
12860
12861 vector float vec_ctf (vector unsigned int, const int);
12862 vector float vec_ctf (vector signed int, const int);
12863 vector double vec_ctf (vector unsigned long, const int);
12864 vector double vec_ctf (vector signed long, const int);
12865
12866 vector float vec_vcfsx (vector signed int, const int);
12867
12868 vector float vec_vcfux (vector unsigned int, const int);
12869
12870 vector signed int vec_cts (vector float, const int);
12871 vector signed long vec_cts (vector double, const int);
12872
12873 vector unsigned int vec_ctu (vector float, const int);
12874 vector unsigned long vec_ctu (vector double, const int);
12875
12876 void vec_dss (const int);
12877
12878 void vec_dssall (void);
12879
12880 void vec_dst (const vector unsigned char *, int, const int);
12881 void vec_dst (const vector signed char *, int, const int);
12882 void vec_dst (const vector bool char *, int, const int);
12883 void vec_dst (const vector unsigned short *, int, const int);
12884 void vec_dst (const vector signed short *, int, const int);
12885 void vec_dst (const vector bool short *, int, const int);
12886 void vec_dst (const vector pixel *, int, const int);
12887 void vec_dst (const vector unsigned int *, int, const int);
12888 void vec_dst (const vector signed int *, int, const int);
12889 void vec_dst (const vector bool int *, int, const int);
12890 void vec_dst (const vector float *, int, const int);
12891 void vec_dst (const unsigned char *, int, const int);
12892 void vec_dst (const signed char *, int, const int);
12893 void vec_dst (const unsigned short *, int, const int);
12894 void vec_dst (const short *, int, const int);
12895 void vec_dst (const unsigned int *, int, const int);
12896 void vec_dst (const int *, int, const int);
12897 void vec_dst (const unsigned long *, int, const int);
12898 void vec_dst (const long *, int, const int);
12899 void vec_dst (const float *, int, const int);
12900
12901 void vec_dstst (const vector unsigned char *, int, const int);
12902 void vec_dstst (const vector signed char *, int, const int);
12903 void vec_dstst (const vector bool char *, int, const int);
12904 void vec_dstst (const vector unsigned short *, int, const int);
12905 void vec_dstst (const vector signed short *, int, const int);
12906 void vec_dstst (const vector bool short *, int, const int);
12907 void vec_dstst (const vector pixel *, int, const int);
12908 void vec_dstst (const vector unsigned int *, int, const int);
12909 void vec_dstst (const vector signed int *, int, const int);
12910 void vec_dstst (const vector bool int *, int, const int);
12911 void vec_dstst (const vector float *, int, const int);
12912 void vec_dstst (const unsigned char *, int, const int);
12913 void vec_dstst (const signed char *, int, const int);
12914 void vec_dstst (const unsigned short *, int, const int);
12915 void vec_dstst (const short *, int, const int);
12916 void vec_dstst (const unsigned int *, int, const int);
12917 void vec_dstst (const int *, int, const int);
12918 void vec_dstst (const unsigned long *, int, const int);
12919 void vec_dstst (const long *, int, const int);
12920 void vec_dstst (const float *, int, const int);
12921
12922 void vec_dststt (const vector unsigned char *, int, const int);
12923 void vec_dststt (const vector signed char *, int, const int);
12924 void vec_dststt (const vector bool char *, int, const int);
12925 void vec_dststt (const vector unsigned short *, int, const int);
12926 void vec_dststt (const vector signed short *, int, const int);
12927 void vec_dststt (const vector bool short *, int, const int);
12928 void vec_dststt (const vector pixel *, int, const int);
12929 void vec_dststt (const vector unsigned int *, int, const int);
12930 void vec_dststt (const vector signed int *, int, const int);
12931 void vec_dststt (const vector bool int *, int, const int);
12932 void vec_dststt (const vector float *, int, const int);
12933 void vec_dststt (const unsigned char *, int, const int);
12934 void vec_dststt (const signed char *, int, const int);
12935 void vec_dststt (const unsigned short *, int, const int);
12936 void vec_dststt (const short *, int, const int);
12937 void vec_dststt (const unsigned int *, int, const int);
12938 void vec_dststt (const int *, int, const int);
12939 void vec_dststt (const unsigned long *, int, const int);
12940 void vec_dststt (const long *, int, const int);
12941 void vec_dststt (const float *, int, const int);
12942
12943 void vec_dstt (const vector unsigned char *, int, const int);
12944 void vec_dstt (const vector signed char *, int, const int);
12945 void vec_dstt (const vector bool char *, int, const int);
12946 void vec_dstt (const vector unsigned short *, int, const int);
12947 void vec_dstt (const vector signed short *, int, const int);
12948 void vec_dstt (const vector bool short *, int, const int);
12949 void vec_dstt (const vector pixel *, int, const int);
12950 void vec_dstt (const vector unsigned int *, int, const int);
12951 void vec_dstt (const vector signed int *, int, const int);
12952 void vec_dstt (const vector bool int *, int, const int);
12953 void vec_dstt (const vector float *, int, const int);
12954 void vec_dstt (const unsigned char *, int, const int);
12955 void vec_dstt (const signed char *, int, const int);
12956 void vec_dstt (const unsigned short *, int, const int);
12957 void vec_dstt (const short *, int, const int);
12958 void vec_dstt (const unsigned int *, int, const int);
12959 void vec_dstt (const int *, int, const int);
12960 void vec_dstt (const unsigned long *, int, const int);
12961 void vec_dstt (const long *, int, const int);
12962 void vec_dstt (const float *, int, const int);
12963
12964 vector float vec_expte (vector float);
12965
12966 vector float vec_floor (vector float);
12967
12968 vector float vec_ld (int, const vector float *);
12969 vector float vec_ld (int, const float *);
12970 vector bool int vec_ld (int, const vector bool int *);
12971 vector signed int vec_ld (int, const vector signed int *);
12972 vector signed int vec_ld (int, const int *);
12973 vector signed int vec_ld (int, const long *);
12974 vector unsigned int vec_ld (int, const vector unsigned int *);
12975 vector unsigned int vec_ld (int, const unsigned int *);
12976 vector unsigned int vec_ld (int, const unsigned long *);
12977 vector bool short vec_ld (int, const vector bool short *);
12978 vector pixel vec_ld (int, const vector pixel *);
12979 vector signed short vec_ld (int, const vector signed short *);
12980 vector signed short vec_ld (int, const short *);
12981 vector unsigned short vec_ld (int, const vector unsigned short *);
12982 vector unsigned short vec_ld (int, const unsigned short *);
12983 vector bool char vec_ld (int, const vector bool char *);
12984 vector signed char vec_ld (int, const vector signed char *);
12985 vector signed char vec_ld (int, const signed char *);
12986 vector unsigned char vec_ld (int, const vector unsigned char *);
12987 vector unsigned char vec_ld (int, const unsigned char *);
12988
12989 vector signed char vec_lde (int, const signed char *);
12990 vector unsigned char vec_lde (int, const unsigned char *);
12991 vector signed short vec_lde (int, const short *);
12992 vector unsigned short vec_lde (int, const unsigned short *);
12993 vector float vec_lde (int, const float *);
12994 vector signed int vec_lde (int, const int *);
12995 vector unsigned int vec_lde (int, const unsigned int *);
12996 vector signed int vec_lde (int, const long *);
12997 vector unsigned int vec_lde (int, const unsigned long *);
12998
12999 vector float vec_lvewx (int, float *);
13000 vector signed int vec_lvewx (int, int *);
13001 vector unsigned int vec_lvewx (int, unsigned int *);
13002 vector signed int vec_lvewx (int, long *);
13003 vector unsigned int vec_lvewx (int, unsigned long *);
13004
13005 vector signed short vec_lvehx (int, short *);
13006 vector unsigned short vec_lvehx (int, unsigned short *);
13007
13008 vector signed char vec_lvebx (int, char *);
13009 vector unsigned char vec_lvebx (int, unsigned char *);
13010
13011 vector float vec_ldl (int, const vector float *);
13012 vector float vec_ldl (int, const float *);
13013 vector bool int vec_ldl (int, const vector bool int *);
13014 vector signed int vec_ldl (int, const vector signed int *);
13015 vector signed int vec_ldl (int, const int *);
13016 vector signed int vec_ldl (int, const long *);
13017 vector unsigned int vec_ldl (int, const vector unsigned int *);
13018 vector unsigned int vec_ldl (int, const unsigned int *);
13019 vector unsigned int vec_ldl (int, const unsigned long *);
13020 vector bool short vec_ldl (int, const vector bool short *);
13021 vector pixel vec_ldl (int, const vector pixel *);
13022 vector signed short vec_ldl (int, const vector signed short *);
13023 vector signed short vec_ldl (int, const short *);
13024 vector unsigned short vec_ldl (int, const vector unsigned short *);
13025 vector unsigned short vec_ldl (int, const unsigned short *);
13026 vector bool char vec_ldl (int, const vector bool char *);
13027 vector signed char vec_ldl (int, const vector signed char *);
13028 vector signed char vec_ldl (int, const signed char *);
13029 vector unsigned char vec_ldl (int, const vector unsigned char *);
13030 vector unsigned char vec_ldl (int, const unsigned char *);
13031
13032 vector float vec_loge (vector float);
13033
13034 vector unsigned char vec_lvsl (int, const volatile unsigned char *);
13035 vector unsigned char vec_lvsl (int, const volatile signed char *);
13036 vector unsigned char vec_lvsl (int, const volatile unsigned short *);
13037 vector unsigned char vec_lvsl (int, const volatile short *);
13038 vector unsigned char vec_lvsl (int, const volatile unsigned int *);
13039 vector unsigned char vec_lvsl (int, const volatile int *);
13040 vector unsigned char vec_lvsl (int, const volatile unsigned long *);
13041 vector unsigned char vec_lvsl (int, const volatile long *);
13042 vector unsigned char vec_lvsl (int, const volatile float *);
13043
13044 vector unsigned char vec_lvsr (int, const volatile unsigned char *);
13045 vector unsigned char vec_lvsr (int, const volatile signed char *);
13046 vector unsigned char vec_lvsr (int, const volatile unsigned short *);
13047 vector unsigned char vec_lvsr (int, const volatile short *);
13048 vector unsigned char vec_lvsr (int, const volatile unsigned int *);
13049 vector unsigned char vec_lvsr (int, const volatile int *);
13050 vector unsigned char vec_lvsr (int, const volatile unsigned long *);
13051 vector unsigned char vec_lvsr (int, const volatile long *);
13052 vector unsigned char vec_lvsr (int, const volatile float *);
13053
13054 vector float vec_madd (vector float, vector float, vector float);
13055
13056 vector signed short vec_madds (vector signed short,
13057                                vector signed short,
13058                                vector signed short);
13059
13060 vector unsigned char vec_max (vector bool char, vector unsigned char);
13061 vector unsigned char vec_max (vector unsigned char, vector bool char);
13062 vector unsigned char vec_max (vector unsigned char,
13063                               vector unsigned char);
13064 vector signed char vec_max (vector bool char, vector signed char);
13065 vector signed char vec_max (vector signed char, vector bool char);
13066 vector signed char vec_max (vector signed char, vector signed char);
13067 vector unsigned short vec_max (vector bool short,
13068                                vector unsigned short);
13069 vector unsigned short vec_max (vector unsigned short,
13070                                vector bool short);
13071 vector unsigned short vec_max (vector unsigned short,
13072                                vector unsigned short);
13073 vector signed short vec_max (vector bool short, vector signed short);
13074 vector signed short vec_max (vector signed short, vector bool short);
13075 vector signed short vec_max (vector signed short, vector signed short);
13076 vector unsigned int vec_max (vector bool int, vector unsigned int);
13077 vector unsigned int vec_max (vector unsigned int, vector bool int);
13078 vector unsigned int vec_max (vector unsigned int, vector unsigned int);
13079 vector signed int vec_max (vector bool int, vector signed int);
13080 vector signed int vec_max (vector signed int, vector bool int);
13081 vector signed int vec_max (vector signed int, vector signed int);
13082 vector float vec_max (vector float, vector float);
13083
13084 vector float vec_vmaxfp (vector float, vector float);
13085
13086 vector signed int vec_vmaxsw (vector bool int, vector signed int);
13087 vector signed int vec_vmaxsw (vector signed int, vector bool int);
13088 vector signed int vec_vmaxsw (vector signed int, vector signed int);
13089
13090 vector unsigned int vec_vmaxuw (vector bool int, vector unsigned int);
13091 vector unsigned int vec_vmaxuw (vector unsigned int, vector bool int);
13092 vector unsigned int vec_vmaxuw (vector unsigned int,
13093                                 vector unsigned int);
13094
13095 vector signed short vec_vmaxsh (vector bool short, vector signed short);
13096 vector signed short vec_vmaxsh (vector signed short, vector bool short);
13097 vector signed short vec_vmaxsh (vector signed short,
13098                                 vector signed short);
13099
13100 vector unsigned short vec_vmaxuh (vector bool short,
13101                                   vector unsigned short);
13102 vector unsigned short vec_vmaxuh (vector unsigned short,
13103                                   vector bool short);
13104 vector unsigned short vec_vmaxuh (vector unsigned short,
13105                                   vector unsigned short);
13106
13107 vector signed char vec_vmaxsb (vector bool char, vector signed char);
13108 vector signed char vec_vmaxsb (vector signed char, vector bool char);
13109 vector signed char vec_vmaxsb (vector signed char, vector signed char);
13110
13111 vector unsigned char vec_vmaxub (vector bool char,
13112                                  vector unsigned char);
13113 vector unsigned char vec_vmaxub (vector unsigned char,
13114                                  vector bool char);
13115 vector unsigned char vec_vmaxub (vector unsigned char,
13116                                  vector unsigned char);
13117
13118 vector bool char vec_mergeh (vector bool char, vector bool char);
13119 vector signed char vec_mergeh (vector signed char, vector signed char);
13120 vector unsigned char vec_mergeh (vector unsigned char,
13121                                  vector unsigned char);
13122 vector bool short vec_mergeh (vector bool short, vector bool short);
13123 vector pixel vec_mergeh (vector pixel, vector pixel);
13124 vector signed short vec_mergeh (vector signed short,
13125                                 vector signed short);
13126 vector unsigned short vec_mergeh (vector unsigned short,
13127                                   vector unsigned short);
13128 vector float vec_mergeh (vector float, vector float);
13129 vector bool int vec_mergeh (vector bool int, vector bool int);
13130 vector signed int vec_mergeh (vector signed int, vector signed int);
13131 vector unsigned int vec_mergeh (vector unsigned int,
13132                                 vector unsigned int);
13133
13134 vector float vec_vmrghw (vector float, vector float);
13135 vector bool int vec_vmrghw (vector bool int, vector bool int);
13136 vector signed int vec_vmrghw (vector signed int, vector signed int);
13137 vector unsigned int vec_vmrghw (vector unsigned int,
13138                                 vector unsigned int);
13139
13140 vector bool short vec_vmrghh (vector bool short, vector bool short);
13141 vector signed short vec_vmrghh (vector signed short,
13142                                 vector signed short);
13143 vector unsigned short vec_vmrghh (vector unsigned short,
13144                                   vector unsigned short);
13145 vector pixel vec_vmrghh (vector pixel, vector pixel);
13146
13147 vector bool char vec_vmrghb (vector bool char, vector bool char);
13148 vector signed char vec_vmrghb (vector signed char, vector signed char);
13149 vector unsigned char vec_vmrghb (vector unsigned char,
13150                                  vector unsigned char);
13151
13152 vector bool char vec_mergel (vector bool char, vector bool char);
13153 vector signed char vec_mergel (vector signed char, vector signed char);
13154 vector unsigned char vec_mergel (vector unsigned char,
13155                                  vector unsigned char);
13156 vector bool short vec_mergel (vector bool short, vector bool short);
13157 vector pixel vec_mergel (vector pixel, vector pixel);
13158 vector signed short vec_mergel (vector signed short,
13159                                 vector signed short);
13160 vector unsigned short vec_mergel (vector unsigned short,
13161                                   vector unsigned short);
13162 vector float vec_mergel (vector float, vector float);
13163 vector bool int vec_mergel (vector bool int, vector bool int);
13164 vector signed int vec_mergel (vector signed int, vector signed int);
13165 vector unsigned int vec_mergel (vector unsigned int,
13166                                 vector unsigned int);
13167
13168 vector float vec_vmrglw (vector float, vector float);
13169 vector signed int vec_vmrglw (vector signed int, vector signed int);
13170 vector unsigned int vec_vmrglw (vector unsigned int,
13171                                 vector unsigned int);
13172 vector bool int vec_vmrglw (vector bool int, vector bool int);
13173
13174 vector bool short vec_vmrglh (vector bool short, vector bool short);
13175 vector signed short vec_vmrglh (vector signed short,
13176                                 vector signed short);
13177 vector unsigned short vec_vmrglh (vector unsigned short,
13178                                   vector unsigned short);
13179 vector pixel vec_vmrglh (vector pixel, vector pixel);
13180
13181 vector bool char vec_vmrglb (vector bool char, vector bool char);
13182 vector signed char vec_vmrglb (vector signed char, vector signed char);
13183 vector unsigned char vec_vmrglb (vector unsigned char,
13184                                  vector unsigned char);
13185
13186 vector unsigned short vec_mfvscr (void);
13187
13188 vector unsigned char vec_min (vector bool char, vector unsigned char);
13189 vector unsigned char vec_min (vector unsigned char, vector bool char);
13190 vector unsigned char vec_min (vector unsigned char,
13191                               vector unsigned char);
13192 vector signed char vec_min (vector bool char, vector signed char);
13193 vector signed char vec_min (vector signed char, vector bool char);
13194 vector signed char vec_min (vector signed char, vector signed char);
13195 vector unsigned short vec_min (vector bool short,
13196                                vector unsigned short);
13197 vector unsigned short vec_min (vector unsigned short,
13198                                vector bool short);
13199 vector unsigned short vec_min (vector unsigned short,
13200                                vector unsigned short);
13201 vector signed short vec_min (vector bool short, vector signed short);
13202 vector signed short vec_min (vector signed short, vector bool short);
13203 vector signed short vec_min (vector signed short, vector signed short);
13204 vector unsigned int vec_min (vector bool int, vector unsigned int);
13205 vector unsigned int vec_min (vector unsigned int, vector bool int);
13206 vector unsigned int vec_min (vector unsigned int, vector unsigned int);
13207 vector signed int vec_min (vector bool int, vector signed int);
13208 vector signed int vec_min (vector signed int, vector bool int);
13209 vector signed int vec_min (vector signed int, vector signed int);
13210 vector float vec_min (vector float, vector float);
13211
13212 vector float vec_vminfp (vector float, vector float);
13213
13214 vector signed int vec_vminsw (vector bool int, vector signed int);
13215 vector signed int vec_vminsw (vector signed int, vector bool int);
13216 vector signed int vec_vminsw (vector signed int, vector signed int);
13217
13218 vector unsigned int vec_vminuw (vector bool int, vector unsigned int);
13219 vector unsigned int vec_vminuw (vector unsigned int, vector bool int);
13220 vector unsigned int vec_vminuw (vector unsigned int,
13221                                 vector unsigned int);
13222
13223 vector signed short vec_vminsh (vector bool short, vector signed short);
13224 vector signed short vec_vminsh (vector signed short, vector bool short);
13225 vector signed short vec_vminsh (vector signed short,
13226                                 vector signed short);
13227
13228 vector unsigned short vec_vminuh (vector bool short,
13229                                   vector unsigned short);
13230 vector unsigned short vec_vminuh (vector unsigned short,
13231                                   vector bool short);
13232 vector unsigned short vec_vminuh (vector unsigned short,
13233                                   vector unsigned short);
13234
13235 vector signed char vec_vminsb (vector bool char, vector signed char);
13236 vector signed char vec_vminsb (vector signed char, vector bool char);
13237 vector signed char vec_vminsb (vector signed char, vector signed char);
13238
13239 vector unsigned char vec_vminub (vector bool char,
13240                                  vector unsigned char);
13241 vector unsigned char vec_vminub (vector unsigned char,
13242                                  vector bool char);
13243 vector unsigned char vec_vminub (vector unsigned char,
13244                                  vector unsigned char);
13245
13246 vector signed short vec_mladd (vector signed short,
13247                                vector signed short,
13248                                vector signed short);
13249 vector signed short vec_mladd (vector signed short,
13250                                vector unsigned short,
13251                                vector unsigned short);
13252 vector signed short vec_mladd (vector unsigned short,
13253                                vector signed short,
13254                                vector signed short);
13255 vector unsigned short vec_mladd (vector unsigned short,
13256                                  vector unsigned short,
13257                                  vector unsigned short);
13258
13259 vector signed short vec_mradds (vector signed short,
13260                                 vector signed short,
13261                                 vector signed short);
13262
13263 vector unsigned int vec_msum (vector unsigned char,
13264                               vector unsigned char,
13265                               vector unsigned int);
13266 vector signed int vec_msum (vector signed char,
13267                             vector unsigned char,
13268                             vector signed int);
13269 vector unsigned int vec_msum (vector unsigned short,
13270                               vector unsigned short,
13271                               vector unsigned int);
13272 vector signed int vec_msum (vector signed short,
13273                             vector signed short,
13274                             vector signed int);
13275
13276 vector signed int vec_vmsumshm (vector signed short,
13277                                 vector signed short,
13278                                 vector signed int);
13279
13280 vector unsigned int vec_vmsumuhm (vector unsigned short,
13281                                   vector unsigned short,
13282                                   vector unsigned int);
13283
13284 vector signed int vec_vmsummbm (vector signed char,
13285                                 vector unsigned char,
13286                                 vector signed int);
13287
13288 vector unsigned int vec_vmsumubm (vector unsigned char,
13289                                   vector unsigned char,
13290                                   vector unsigned int);
13291
13292 vector unsigned int vec_msums (vector unsigned short,
13293                                vector unsigned short,
13294                                vector unsigned int);
13295 vector signed int vec_msums (vector signed short,
13296                              vector signed short,
13297                              vector signed int);
13298
13299 vector signed int vec_vmsumshs (vector signed short,
13300                                 vector signed short,
13301                                 vector signed int);
13302
13303 vector unsigned int vec_vmsumuhs (vector unsigned short,
13304                                   vector unsigned short,
13305                                   vector unsigned int);
13306
13307 void vec_mtvscr (vector signed int);
13308 void vec_mtvscr (vector unsigned int);
13309 void vec_mtvscr (vector bool int);
13310 void vec_mtvscr (vector signed short);
13311 void vec_mtvscr (vector unsigned short);
13312 void vec_mtvscr (vector bool short);
13313 void vec_mtvscr (vector pixel);
13314 void vec_mtvscr (vector signed char);
13315 void vec_mtvscr (vector unsigned char);
13316 void vec_mtvscr (vector bool char);
13317
13318 vector unsigned short vec_mule (vector unsigned char,
13319                                 vector unsigned char);
13320 vector signed short vec_mule (vector signed char,
13321                               vector signed char);
13322 vector unsigned int vec_mule (vector unsigned short,
13323                               vector unsigned short);
13324 vector signed int vec_mule (vector signed short, vector signed short);
13325
13326 vector signed int vec_vmulesh (vector signed short,
13327                                vector signed short);
13328
13329 vector unsigned int vec_vmuleuh (vector unsigned short,
13330                                  vector unsigned short);
13331
13332 vector signed short vec_vmulesb (vector signed char,
13333                                  vector signed char);
13334
13335 vector unsigned short vec_vmuleub (vector unsigned char,
13336                                   vector unsigned char);
13337
13338 vector unsigned short vec_mulo (vector unsigned char,
13339                                 vector unsigned char);
13340 vector signed short vec_mulo (vector signed char, vector signed char);
13341 vector unsigned int vec_mulo (vector unsigned short,
13342                               vector unsigned short);
13343 vector signed int vec_mulo (vector signed short, vector signed short);
13344
13345 vector signed int vec_vmulosh (vector signed short,
13346                                vector signed short);
13347
13348 vector unsigned int vec_vmulouh (vector unsigned short,
13349                                  vector unsigned short);
13350
13351 vector signed short vec_vmulosb (vector signed char,
13352                                  vector signed char);
13353
13354 vector unsigned short vec_vmuloub (vector unsigned char,
13355                                    vector unsigned char);
13356
13357 vector float vec_nmsub (vector float, vector float, vector float);
13358
13359 vector float vec_nor (vector float, vector float);
13360 vector signed int vec_nor (vector signed int, vector signed int);
13361 vector unsigned int vec_nor (vector unsigned int, vector unsigned int);
13362 vector bool int vec_nor (vector bool int, vector bool int);
13363 vector signed short vec_nor (vector signed short, vector signed short);
13364 vector unsigned short vec_nor (vector unsigned short,
13365                                vector unsigned short);
13366 vector bool short vec_nor (vector bool short, vector bool short);
13367 vector signed char vec_nor (vector signed char, vector signed char);
13368 vector unsigned char vec_nor (vector unsigned char,
13369                               vector unsigned char);
13370 vector bool char vec_nor (vector bool char, vector bool char);
13371
13372 vector float vec_or (vector float, vector float);
13373 vector float vec_or (vector float, vector bool int);
13374 vector float vec_or (vector bool int, vector float);
13375 vector bool int vec_or (vector bool int, vector bool int);
13376 vector signed int vec_or (vector bool int, vector signed int);
13377 vector signed int vec_or (vector signed int, vector bool int);
13378 vector signed int vec_or (vector signed int, vector signed int);
13379 vector unsigned int vec_or (vector bool int, vector unsigned int);
13380 vector unsigned int vec_or (vector unsigned int, vector bool int);
13381 vector unsigned int vec_or (vector unsigned int, vector unsigned int);
13382 vector bool short vec_or (vector bool short, vector bool short);
13383 vector signed short vec_or (vector bool short, vector signed short);
13384 vector signed short vec_or (vector signed short, vector bool short);
13385 vector signed short vec_or (vector signed short, vector signed short);
13386 vector unsigned short vec_or (vector bool short, vector unsigned short);
13387 vector unsigned short vec_or (vector unsigned short, vector bool short);
13388 vector unsigned short vec_or (vector unsigned short,
13389                               vector unsigned short);
13390 vector signed char vec_or (vector bool char, vector signed char);
13391 vector bool char vec_or (vector bool char, vector bool char);
13392 vector signed char vec_or (vector signed char, vector bool char);
13393 vector signed char vec_or (vector signed char, vector signed char);
13394 vector unsigned char vec_or (vector bool char, vector unsigned char);
13395 vector unsigned char vec_or (vector unsigned char, vector bool char);
13396 vector unsigned char vec_or (vector unsigned char,
13397                              vector unsigned char);
13398
13399 vector signed char vec_pack (vector signed short, vector signed short);
13400 vector unsigned char vec_pack (vector unsigned short,
13401                                vector unsigned short);
13402 vector bool char vec_pack (vector bool short, vector bool short);
13403 vector signed short vec_pack (vector signed int, vector signed int);
13404 vector unsigned short vec_pack (vector unsigned int,
13405                                 vector unsigned int);
13406 vector bool short vec_pack (vector bool int, vector bool int);
13407
13408 vector bool short vec_vpkuwum (vector bool int, vector bool int);
13409 vector signed short vec_vpkuwum (vector signed int, vector signed int);
13410 vector unsigned short vec_vpkuwum (vector unsigned int,
13411                                    vector unsigned int);
13412
13413 vector bool char vec_vpkuhum (vector bool short, vector bool short);
13414 vector signed char vec_vpkuhum (vector signed short,
13415                                 vector signed short);
13416 vector unsigned char vec_vpkuhum (vector unsigned short,
13417                                   vector unsigned short);
13418
13419 vector pixel vec_packpx (vector unsigned int, vector unsigned int);
13420
13421 vector unsigned char vec_packs (vector unsigned short,
13422                                 vector unsigned short);
13423 vector signed char vec_packs (vector signed short, vector signed short);
13424 vector unsigned short vec_packs (vector unsigned int,
13425                                  vector unsigned int);
13426 vector signed short vec_packs (vector signed int, vector signed int);
13427
13428 vector signed short vec_vpkswss (vector signed int, vector signed int);
13429
13430 vector unsigned short vec_vpkuwus (vector unsigned int,
13431                                    vector unsigned int);
13432
13433 vector signed char vec_vpkshss (vector signed short,
13434                                 vector signed short);
13435
13436 vector unsigned char vec_vpkuhus (vector unsigned short,
13437                                   vector unsigned short);
13438
13439 vector unsigned char vec_packsu (vector unsigned short,
13440                                  vector unsigned short);
13441 vector unsigned char vec_packsu (vector signed short,
13442                                  vector signed short);
13443 vector unsigned short vec_packsu (vector unsigned int,
13444                                   vector unsigned int);
13445 vector unsigned short vec_packsu (vector signed int, vector signed int);
13446
13447 vector unsigned short vec_vpkswus (vector signed int,
13448                                    vector signed int);
13449
13450 vector unsigned char vec_vpkshus (vector signed short,
13451                                   vector signed short);
13452
13453 vector float vec_perm (vector float,
13454                        vector float,
13455                        vector unsigned char);
13456 vector signed int vec_perm (vector signed int,
13457                             vector signed int,
13458                             vector unsigned char);
13459 vector unsigned int vec_perm (vector unsigned int,
13460                               vector unsigned int,
13461                               vector unsigned char);
13462 vector bool int vec_perm (vector bool int,
13463                           vector bool int,
13464                           vector unsigned char);
13465 vector signed short vec_perm (vector signed short,
13466                               vector signed short,
13467                               vector unsigned char);
13468 vector unsigned short vec_perm (vector unsigned short,
13469                                 vector unsigned short,
13470                                 vector unsigned char);
13471 vector bool short vec_perm (vector bool short,
13472                             vector bool short,
13473                             vector unsigned char);
13474 vector pixel vec_perm (vector pixel,
13475                        vector pixel,
13476                        vector unsigned char);
13477 vector signed char vec_perm (vector signed char,
13478                              vector signed char,
13479                              vector unsigned char);
13480 vector unsigned char vec_perm (vector unsigned char,
13481                                vector unsigned char,
13482                                vector unsigned char);
13483 vector bool char vec_perm (vector bool char,
13484                            vector bool char,
13485                            vector unsigned char);
13486
13487 vector float vec_re (vector float);
13488
13489 vector signed char vec_rl (vector signed char,
13490                            vector unsigned char);
13491 vector unsigned char vec_rl (vector unsigned char,
13492                              vector unsigned char);
13493 vector signed short vec_rl (vector signed short, vector unsigned short);
13494 vector unsigned short vec_rl (vector unsigned short,
13495                               vector unsigned short);
13496 vector signed int vec_rl (vector signed int, vector unsigned int);
13497 vector unsigned int vec_rl (vector unsigned int, vector unsigned int);
13498
13499 vector signed int vec_vrlw (vector signed int, vector unsigned int);
13500 vector unsigned int vec_vrlw (vector unsigned int, vector unsigned int);
13501
13502 vector signed short vec_vrlh (vector signed short,
13503                               vector unsigned short);
13504 vector unsigned short vec_vrlh (vector unsigned short,
13505                                 vector unsigned short);
13506
13507 vector signed char vec_vrlb (vector signed char, vector unsigned char);
13508 vector unsigned char vec_vrlb (vector unsigned char,
13509                                vector unsigned char);
13510
13511 vector float vec_round (vector float);
13512
13513 vector float vec_recip (vector float, vector float);
13514
13515 vector float vec_rsqrt (vector float);
13516
13517 vector float vec_rsqrte (vector float);
13518
13519 vector float vec_sel (vector float, vector float, vector bool int);
13520 vector float vec_sel (vector float, vector float, vector unsigned int);
13521 vector signed int vec_sel (vector signed int,
13522                            vector signed int,
13523                            vector bool int);
13524 vector signed int vec_sel (vector signed int,
13525                            vector signed int,
13526                            vector unsigned int);
13527 vector unsigned int vec_sel (vector unsigned int,
13528                              vector unsigned int,
13529                              vector bool int);
13530 vector unsigned int vec_sel (vector unsigned int,
13531                              vector unsigned int,
13532                              vector unsigned int);
13533 vector bool int vec_sel (vector bool int,
13534                          vector bool int,
13535                          vector bool int);
13536 vector bool int vec_sel (vector bool int,
13537                          vector bool int,
13538                          vector unsigned int);
13539 vector signed short vec_sel (vector signed short,
13540                              vector signed short,
13541                              vector bool short);
13542 vector signed short vec_sel (vector signed short,
13543                              vector signed short,
13544                              vector unsigned short);
13545 vector unsigned short vec_sel (vector unsigned short,
13546                                vector unsigned short,
13547                                vector bool short);
13548 vector unsigned short vec_sel (vector unsigned short,
13549                                vector unsigned short,
13550                                vector unsigned short);
13551 vector bool short vec_sel (vector bool short,
13552                            vector bool short,
13553                            vector bool short);
13554 vector bool short vec_sel (vector bool short,
13555                            vector bool short,
13556                            vector unsigned short);
13557 vector signed char vec_sel (vector signed char,
13558                             vector signed char,
13559                             vector bool char);
13560 vector signed char vec_sel (vector signed char,
13561                             vector signed char,
13562                             vector unsigned char);
13563 vector unsigned char vec_sel (vector unsigned char,
13564                               vector unsigned char,
13565                               vector bool char);
13566 vector unsigned char vec_sel (vector unsigned char,
13567                               vector unsigned char,
13568                               vector unsigned char);
13569 vector bool char vec_sel (vector bool char,
13570                           vector bool char,
13571                           vector bool char);
13572 vector bool char vec_sel (vector bool char,
13573                           vector bool char,
13574                           vector unsigned char);
13575
13576 vector signed char vec_sl (vector signed char,
13577                            vector unsigned char);
13578 vector unsigned char vec_sl (vector unsigned char,
13579                              vector unsigned char);
13580 vector signed short vec_sl (vector signed short, vector unsigned short);
13581 vector unsigned short vec_sl (vector unsigned short,
13582                               vector unsigned short);
13583 vector signed int vec_sl (vector signed int, vector unsigned int);
13584 vector unsigned int vec_sl (vector unsigned int, vector unsigned int);
13585
13586 vector signed int vec_vslw (vector signed int, vector unsigned int);
13587 vector unsigned int vec_vslw (vector unsigned int, vector unsigned int);
13588
13589 vector signed short vec_vslh (vector signed short,
13590                               vector unsigned short);
13591 vector unsigned short vec_vslh (vector unsigned short,
13592                                 vector unsigned short);
13593
13594 vector signed char vec_vslb (vector signed char, vector unsigned char);
13595 vector unsigned char vec_vslb (vector unsigned char,
13596                                vector unsigned char);
13597
13598 vector float vec_sld (vector float, vector float, const int);
13599 vector signed int vec_sld (vector signed int,
13600                            vector signed int,
13601                            const int);
13602 vector unsigned int vec_sld (vector unsigned int,
13603                              vector unsigned int,
13604                              const int);
13605 vector bool int vec_sld (vector bool int,
13606                          vector bool int,
13607                          const int);
13608 vector signed short vec_sld (vector signed short,
13609                              vector signed short,
13610                              const int);
13611 vector unsigned short vec_sld (vector unsigned short,
13612                                vector unsigned short,
13613                                const int);
13614 vector bool short vec_sld (vector bool short,
13615                            vector bool short,
13616                            const int);
13617 vector pixel vec_sld (vector pixel,
13618                       vector pixel,
13619                       const int);
13620 vector signed char vec_sld (vector signed char,
13621                             vector signed char,
13622                             const int);
13623 vector unsigned char vec_sld (vector unsigned char,
13624                               vector unsigned char,
13625                               const int);
13626 vector bool char vec_sld (vector bool char,
13627                           vector bool char,
13628                           const int);
13629
13630 vector signed int vec_sll (vector signed int,
13631                            vector unsigned int);
13632 vector signed int vec_sll (vector signed int,
13633                            vector unsigned short);
13634 vector signed int vec_sll (vector signed int,
13635                            vector unsigned char);
13636 vector unsigned int vec_sll (vector unsigned int,
13637                              vector unsigned int);
13638 vector unsigned int vec_sll (vector unsigned int,
13639                              vector unsigned short);
13640 vector unsigned int vec_sll (vector unsigned int,
13641                              vector unsigned char);
13642 vector bool int vec_sll (vector bool int,
13643                          vector unsigned int);
13644 vector bool int vec_sll (vector bool int,
13645                          vector unsigned short);
13646 vector bool int vec_sll (vector bool int,
13647                          vector unsigned char);
13648 vector signed short vec_sll (vector signed short,
13649                              vector unsigned int);
13650 vector signed short vec_sll (vector signed short,
13651                              vector unsigned short);
13652 vector signed short vec_sll (vector signed short,
13653                              vector unsigned char);
13654 vector unsigned short vec_sll (vector unsigned short,
13655                                vector unsigned int);
13656 vector unsigned short vec_sll (vector unsigned short,
13657                                vector unsigned short);
13658 vector unsigned short vec_sll (vector unsigned short,
13659                                vector unsigned char);
13660 vector bool short vec_sll (vector bool short, vector unsigned int);
13661 vector bool short vec_sll (vector bool short, vector unsigned short);
13662 vector bool short vec_sll (vector bool short, vector unsigned char);
13663 vector pixel vec_sll (vector pixel, vector unsigned int);
13664 vector pixel vec_sll (vector pixel, vector unsigned short);
13665 vector pixel vec_sll (vector pixel, vector unsigned char);
13666 vector signed char vec_sll (vector signed char, vector unsigned int);
13667 vector signed char vec_sll (vector signed char, vector unsigned short);
13668 vector signed char vec_sll (vector signed char, vector unsigned char);
13669 vector unsigned char vec_sll (vector unsigned char,
13670                               vector unsigned int);
13671 vector unsigned char vec_sll (vector unsigned char,
13672                               vector unsigned short);
13673 vector unsigned char vec_sll (vector unsigned char,
13674                               vector unsigned char);
13675 vector bool char vec_sll (vector bool char, vector unsigned int);
13676 vector bool char vec_sll (vector bool char, vector unsigned short);
13677 vector bool char vec_sll (vector bool char, vector unsigned char);
13678
13679 vector float vec_slo (vector float, vector signed char);
13680 vector float vec_slo (vector float, vector unsigned char);
13681 vector signed int vec_slo (vector signed int, vector signed char);
13682 vector signed int vec_slo (vector signed int, vector unsigned char);
13683 vector unsigned int vec_slo (vector unsigned int, vector signed char);
13684 vector unsigned int vec_slo (vector unsigned int, vector unsigned char);
13685 vector signed short vec_slo (vector signed short, vector signed char);
13686 vector signed short vec_slo (vector signed short, vector unsigned char);
13687 vector unsigned short vec_slo (vector unsigned short,
13688                                vector signed char);
13689 vector unsigned short vec_slo (vector unsigned short,
13690                                vector unsigned char);
13691 vector pixel vec_slo (vector pixel, vector signed char);
13692 vector pixel vec_slo (vector pixel, vector unsigned char);
13693 vector signed char vec_slo (vector signed char, vector signed char);
13694 vector signed char vec_slo (vector signed char, vector unsigned char);
13695 vector unsigned char vec_slo (vector unsigned char, vector signed char);
13696 vector unsigned char vec_slo (vector unsigned char,
13697                               vector unsigned char);
13698
13699 vector signed char vec_splat (vector signed char, const int);
13700 vector unsigned char vec_splat (vector unsigned char, const int);
13701 vector bool char vec_splat (vector bool char, const int);
13702 vector signed short vec_splat (vector signed short, const int);
13703 vector unsigned short vec_splat (vector unsigned short, const int);
13704 vector bool short vec_splat (vector bool short, const int);
13705 vector pixel vec_splat (vector pixel, const int);
13706 vector float vec_splat (vector float, const int);
13707 vector signed int vec_splat (vector signed int, const int);
13708 vector unsigned int vec_splat (vector unsigned int, const int);
13709 vector bool int vec_splat (vector bool int, const int);
13710 vector signed long vec_splat (vector signed long, const int);
13711 vector unsigned long vec_splat (vector unsigned long, const int);
13712
13713 vector signed char vec_splats (signed char);
13714 vector unsigned char vec_splats (unsigned char);
13715 vector signed short vec_splats (signed short);
13716 vector unsigned short vec_splats (unsigned short);
13717 vector signed int vec_splats (signed int);
13718 vector unsigned int vec_splats (unsigned int);
13719 vector float vec_splats (float);
13720
13721 vector float vec_vspltw (vector float, const int);
13722 vector signed int vec_vspltw (vector signed int, const int);
13723 vector unsigned int vec_vspltw (vector unsigned int, const int);
13724 vector bool int vec_vspltw (vector bool int, const int);
13725
13726 vector bool short vec_vsplth (vector bool short, const int);
13727 vector signed short vec_vsplth (vector signed short, const int);
13728 vector unsigned short vec_vsplth (vector unsigned short, const int);
13729 vector pixel vec_vsplth (vector pixel, const int);
13730
13731 vector signed char vec_vspltb (vector signed char, const int);
13732 vector unsigned char vec_vspltb (vector unsigned char, const int);
13733 vector bool char vec_vspltb (vector bool char, const int);
13734
13735 vector signed char vec_splat_s8 (const int);
13736
13737 vector signed short vec_splat_s16 (const int);
13738
13739 vector signed int vec_splat_s32 (const int);
13740
13741 vector unsigned char vec_splat_u8 (const int);
13742
13743 vector unsigned short vec_splat_u16 (const int);
13744
13745 vector unsigned int vec_splat_u32 (const int);
13746
13747 vector signed char vec_sr (vector signed char, vector unsigned char);
13748 vector unsigned char vec_sr (vector unsigned char,
13749                              vector unsigned char);
13750 vector signed short vec_sr (vector signed short,
13751                             vector unsigned short);
13752 vector unsigned short vec_sr (vector unsigned short,
13753                               vector unsigned short);
13754 vector signed int vec_sr (vector signed int, vector unsigned int);
13755 vector unsigned int vec_sr (vector unsigned int, vector unsigned int);
13756
13757 vector signed int vec_vsrw (vector signed int, vector unsigned int);
13758 vector unsigned int vec_vsrw (vector unsigned int, vector unsigned int);
13759
13760 vector signed short vec_vsrh (vector signed short,
13761                               vector unsigned short);
13762 vector unsigned short vec_vsrh (vector unsigned short,
13763                                 vector unsigned short);
13764
13765 vector signed char vec_vsrb (vector signed char, vector unsigned char);
13766 vector unsigned char vec_vsrb (vector unsigned char,
13767                                vector unsigned char);
13768
13769 vector signed char vec_sra (vector signed char, vector unsigned char);
13770 vector unsigned char vec_sra (vector unsigned char,
13771                               vector unsigned char);
13772 vector signed short vec_sra (vector signed short,
13773                              vector unsigned short);
13774 vector unsigned short vec_sra (vector unsigned short,
13775                                vector unsigned short);
13776 vector signed int vec_sra (vector signed int, vector unsigned int);
13777 vector unsigned int vec_sra (vector unsigned int, vector unsigned int);
13778
13779 vector signed int vec_vsraw (vector signed int, vector unsigned int);
13780 vector unsigned int vec_vsraw (vector unsigned int,
13781                                vector unsigned int);
13782
13783 vector signed short vec_vsrah (vector signed short,
13784                                vector unsigned short);
13785 vector unsigned short vec_vsrah (vector unsigned short,
13786                                  vector unsigned short);
13787
13788 vector signed char vec_vsrab (vector signed char, vector unsigned char);
13789 vector unsigned char vec_vsrab (vector unsigned char,
13790                                 vector unsigned char);
13791
13792 vector signed int vec_srl (vector signed int, vector unsigned int);
13793 vector signed int vec_srl (vector signed int, vector unsigned short);
13794 vector signed int vec_srl (vector signed int, vector unsigned char);
13795 vector unsigned int vec_srl (vector unsigned int, vector unsigned int);
13796 vector unsigned int vec_srl (vector unsigned int,
13797                              vector unsigned short);
13798 vector unsigned int vec_srl (vector unsigned int, vector unsigned char);
13799 vector bool int vec_srl (vector bool int, vector unsigned int);
13800 vector bool int vec_srl (vector bool int, vector unsigned short);
13801 vector bool int vec_srl (vector bool int, vector unsigned char);
13802 vector signed short vec_srl (vector signed short, vector unsigned int);
13803 vector signed short vec_srl (vector signed short,
13804                              vector unsigned short);
13805 vector signed short vec_srl (vector signed short, vector unsigned char);
13806 vector unsigned short vec_srl (vector unsigned short,
13807                                vector unsigned int);
13808 vector unsigned short vec_srl (vector unsigned short,
13809                                vector unsigned short);
13810 vector unsigned short vec_srl (vector unsigned short,
13811                                vector unsigned char);
13812 vector bool short vec_srl (vector bool short, vector unsigned int);
13813 vector bool short vec_srl (vector bool short, vector unsigned short);
13814 vector bool short vec_srl (vector bool short, vector unsigned char);
13815 vector pixel vec_srl (vector pixel, vector unsigned int);
13816 vector pixel vec_srl (vector pixel, vector unsigned short);
13817 vector pixel vec_srl (vector pixel, vector unsigned char);
13818 vector signed char vec_srl (vector signed char, vector unsigned int);
13819 vector signed char vec_srl (vector signed char, vector unsigned short);
13820 vector signed char vec_srl (vector signed char, vector unsigned char);
13821 vector unsigned char vec_srl (vector unsigned char,
13822                               vector unsigned int);
13823 vector unsigned char vec_srl (vector unsigned char,
13824                               vector unsigned short);
13825 vector unsigned char vec_srl (vector unsigned char,
13826                               vector unsigned char);
13827 vector bool char vec_srl (vector bool char, vector unsigned int);
13828 vector bool char vec_srl (vector bool char, vector unsigned short);
13829 vector bool char vec_srl (vector bool char, vector unsigned char);
13830
13831 vector float vec_sro (vector float, vector signed char);
13832 vector float vec_sro (vector float, vector unsigned char);
13833 vector signed int vec_sro (vector signed int, vector signed char);
13834 vector signed int vec_sro (vector signed int, vector unsigned char);
13835 vector unsigned int vec_sro (vector unsigned int, vector signed char);
13836 vector unsigned int vec_sro (vector unsigned int, vector unsigned char);
13837 vector signed short vec_sro (vector signed short, vector signed char);
13838 vector signed short vec_sro (vector signed short, vector unsigned char);
13839 vector unsigned short vec_sro (vector unsigned short,
13840                                vector signed char);
13841 vector unsigned short vec_sro (vector unsigned short,
13842                                vector unsigned char);
13843 vector pixel vec_sro (vector pixel, vector signed char);
13844 vector pixel vec_sro (vector pixel, vector unsigned char);
13845 vector signed char vec_sro (vector signed char, vector signed char);
13846 vector signed char vec_sro (vector signed char, vector unsigned char);
13847 vector unsigned char vec_sro (vector unsigned char, vector signed char);
13848 vector unsigned char vec_sro (vector unsigned char,
13849                               vector unsigned char);
13850
13851 void vec_st (vector float, int, vector float *);
13852 void vec_st (vector float, int, float *);
13853 void vec_st (vector signed int, int, vector signed int *);
13854 void vec_st (vector signed int, int, int *);
13855 void vec_st (vector unsigned int, int, vector unsigned int *);
13856 void vec_st (vector unsigned int, int, unsigned int *);
13857 void vec_st (vector bool int, int, vector bool int *);
13858 void vec_st (vector bool int, int, unsigned int *);
13859 void vec_st (vector bool int, int, int *);
13860 void vec_st (vector signed short, int, vector signed short *);
13861 void vec_st (vector signed short, int, short *);
13862 void vec_st (vector unsigned short, int, vector unsigned short *);
13863 void vec_st (vector unsigned short, int, unsigned short *);
13864 void vec_st (vector bool short, int, vector bool short *);
13865 void vec_st (vector bool short, int, unsigned short *);
13866 void vec_st (vector pixel, int, vector pixel *);
13867 void vec_st (vector pixel, int, unsigned short *);
13868 void vec_st (vector pixel, int, short *);
13869 void vec_st (vector bool short, int, short *);
13870 void vec_st (vector signed char, int, vector signed char *);
13871 void vec_st (vector signed char, int, signed char *);
13872 void vec_st (vector unsigned char, int, vector unsigned char *);
13873 void vec_st (vector unsigned char, int, unsigned char *);
13874 void vec_st (vector bool char, int, vector bool char *);
13875 void vec_st (vector bool char, int, unsigned char *);
13876 void vec_st (vector bool char, int, signed char *);
13877
13878 void vec_ste (vector signed char, int, signed char *);
13879 void vec_ste (vector unsigned char, int, unsigned char *);
13880 void vec_ste (vector bool char, int, signed char *);
13881 void vec_ste (vector bool char, int, unsigned char *);
13882 void vec_ste (vector signed short, int, short *);
13883 void vec_ste (vector unsigned short, int, unsigned short *);
13884 void vec_ste (vector bool short, int, short *);
13885 void vec_ste (vector bool short, int, unsigned short *);
13886 void vec_ste (vector pixel, int, short *);
13887 void vec_ste (vector pixel, int, unsigned short *);
13888 void vec_ste (vector float, int, float *);
13889 void vec_ste (vector signed int, int, int *);
13890 void vec_ste (vector unsigned int, int, unsigned int *);
13891 void vec_ste (vector bool int, int, int *);
13892 void vec_ste (vector bool int, int, unsigned int *);
13893
13894 void vec_stvewx (vector float, int, float *);
13895 void vec_stvewx (vector signed int, int, int *);
13896 void vec_stvewx (vector unsigned int, int, unsigned int *);
13897 void vec_stvewx (vector bool int, int, int *);
13898 void vec_stvewx (vector bool int, int, unsigned int *);
13899
13900 void vec_stvehx (vector signed short, int, short *);
13901 void vec_stvehx (vector unsigned short, int, unsigned short *);
13902 void vec_stvehx (vector bool short, int, short *);
13903 void vec_stvehx (vector bool short, int, unsigned short *);
13904 void vec_stvehx (vector pixel, int, short *);
13905 void vec_stvehx (vector pixel, int, unsigned short *);
13906
13907 void vec_stvebx (vector signed char, int, signed char *);
13908 void vec_stvebx (vector unsigned char, int, unsigned char *);
13909 void vec_stvebx (vector bool char, int, signed char *);
13910 void vec_stvebx (vector bool char, int, unsigned char *);
13911
13912 void vec_stl (vector float, int, vector float *);
13913 void vec_stl (vector float, int, float *);
13914 void vec_stl (vector signed int, int, vector signed int *);
13915 void vec_stl (vector signed int, int, int *);
13916 void vec_stl (vector unsigned int, int, vector unsigned int *);
13917 void vec_stl (vector unsigned int, int, unsigned int *);
13918 void vec_stl (vector bool int, int, vector bool int *);
13919 void vec_stl (vector bool int, int, unsigned int *);
13920 void vec_stl (vector bool int, int, int *);
13921 void vec_stl (vector signed short, int, vector signed short *);
13922 void vec_stl (vector signed short, int, short *);
13923 void vec_stl (vector unsigned short, int, vector unsigned short *);
13924 void vec_stl (vector unsigned short, int, unsigned short *);
13925 void vec_stl (vector bool short, int, vector bool short *);
13926 void vec_stl (vector bool short, int, unsigned short *);
13927 void vec_stl (vector bool short, int, short *);
13928 void vec_stl (vector pixel, int, vector pixel *);
13929 void vec_stl (vector pixel, int, unsigned short *);
13930 void vec_stl (vector pixel, int, short *);
13931 void vec_stl (vector signed char, int, vector signed char *);
13932 void vec_stl (vector signed char, int, signed char *);
13933 void vec_stl (vector unsigned char, int, vector unsigned char *);
13934 void vec_stl (vector unsigned char, int, unsigned char *);
13935 void vec_stl (vector bool char, int, vector bool char *);
13936 void vec_stl (vector bool char, int, unsigned char *);
13937 void vec_stl (vector bool char, int, signed char *);
13938
13939 vector signed char vec_sub (vector bool char, vector signed char);
13940 vector signed char vec_sub (vector signed char, vector bool char);
13941 vector signed char vec_sub (vector signed char, vector signed char);
13942 vector unsigned char vec_sub (vector bool char, vector unsigned char);
13943 vector unsigned char vec_sub (vector unsigned char, vector bool char);
13944 vector unsigned char vec_sub (vector unsigned char,
13945                               vector unsigned char);
13946 vector signed short vec_sub (vector bool short, vector signed short);
13947 vector signed short vec_sub (vector signed short, vector bool short);
13948 vector signed short vec_sub (vector signed short, vector signed short);
13949 vector unsigned short vec_sub (vector bool short,
13950                                vector unsigned short);
13951 vector unsigned short vec_sub (vector unsigned short,
13952                                vector bool short);
13953 vector unsigned short vec_sub (vector unsigned short,
13954                                vector unsigned short);
13955 vector signed int vec_sub (vector bool int, vector signed int);
13956 vector signed int vec_sub (vector signed int, vector bool int);
13957 vector signed int vec_sub (vector signed int, vector signed int);
13958 vector unsigned int vec_sub (vector bool int, vector unsigned int);
13959 vector unsigned int vec_sub (vector unsigned int, vector bool int);
13960 vector unsigned int vec_sub (vector unsigned int, vector unsigned int);
13961 vector float vec_sub (vector float, vector float);
13962
13963 vector float vec_vsubfp (vector float, vector float);
13964
13965 vector signed int vec_vsubuwm (vector bool int, vector signed int);
13966 vector signed int vec_vsubuwm (vector signed int, vector bool int);
13967 vector signed int vec_vsubuwm (vector signed int, vector signed int);
13968 vector unsigned int vec_vsubuwm (vector bool int, vector unsigned int);
13969 vector unsigned int vec_vsubuwm (vector unsigned int, vector bool int);
13970 vector unsigned int vec_vsubuwm (vector unsigned int,
13971                                  vector unsigned int);
13972
13973 vector signed short vec_vsubuhm (vector bool short,
13974                                  vector signed short);
13975 vector signed short vec_vsubuhm (vector signed short,
13976                                  vector bool short);
13977 vector signed short vec_vsubuhm (vector signed short,
13978                                  vector signed short);
13979 vector unsigned short vec_vsubuhm (vector bool short,
13980                                    vector unsigned short);
13981 vector unsigned short vec_vsubuhm (vector unsigned short,
13982                                    vector bool short);
13983 vector unsigned short vec_vsubuhm (vector unsigned short,
13984                                    vector unsigned short);
13985
13986 vector signed char vec_vsububm (vector bool char, vector signed char);
13987 vector signed char vec_vsububm (vector signed char, vector bool char);
13988 vector signed char vec_vsububm (vector signed char, vector signed char);
13989 vector unsigned char vec_vsububm (vector bool char,
13990                                   vector unsigned char);
13991 vector unsigned char vec_vsububm (vector unsigned char,
13992                                   vector bool char);
13993 vector unsigned char vec_vsububm (vector unsigned char,
13994                                   vector unsigned char);
13995
13996 vector unsigned int vec_subc (vector unsigned int, vector unsigned int);
13997
13998 vector unsigned char vec_subs (vector bool char, vector unsigned char);
13999 vector unsigned char vec_subs (vector unsigned char, vector bool char);
14000 vector unsigned char vec_subs (vector unsigned char,
14001                                vector unsigned char);
14002 vector signed char vec_subs (vector bool char, vector signed char);
14003 vector signed char vec_subs (vector signed char, vector bool char);
14004 vector signed char vec_subs (vector signed char, vector signed char);
14005 vector unsigned short vec_subs (vector bool short,
14006                                 vector unsigned short);
14007 vector unsigned short vec_subs (vector unsigned short,
14008                                 vector bool short);
14009 vector unsigned short vec_subs (vector unsigned short,
14010                                 vector unsigned short);
14011 vector signed short vec_subs (vector bool short, vector signed short);
14012 vector signed short vec_subs (vector signed short, vector bool short);
14013 vector signed short vec_subs (vector signed short, vector signed short);
14014 vector unsigned int vec_subs (vector bool int, vector unsigned int);
14015 vector unsigned int vec_subs (vector unsigned int, vector bool int);
14016 vector unsigned int vec_subs (vector unsigned int, vector unsigned int);
14017 vector signed int vec_subs (vector bool int, vector signed int);
14018 vector signed int vec_subs (vector signed int, vector bool int);
14019 vector signed int vec_subs (vector signed int, vector signed int);
14020
14021 vector signed int vec_vsubsws (vector bool int, vector signed int);
14022 vector signed int vec_vsubsws (vector signed int, vector bool int);
14023 vector signed int vec_vsubsws (vector signed int, vector signed int);
14024
14025 vector unsigned int vec_vsubuws (vector bool int, vector unsigned int);
14026 vector unsigned int vec_vsubuws (vector unsigned int, vector bool int);
14027 vector unsigned int vec_vsubuws (vector unsigned int,
14028                                  vector unsigned int);
14029
14030 vector signed short vec_vsubshs (vector bool short,
14031                                  vector signed short);
14032 vector signed short vec_vsubshs (vector signed short,
14033                                  vector bool short);
14034 vector signed short vec_vsubshs (vector signed short,
14035                                  vector signed short);
14036
14037 vector unsigned short vec_vsubuhs (vector bool short,
14038                                    vector unsigned short);
14039 vector unsigned short vec_vsubuhs (vector unsigned short,
14040                                    vector bool short);
14041 vector unsigned short vec_vsubuhs (vector unsigned short,
14042                                    vector unsigned short);
14043
14044 vector signed char vec_vsubsbs (vector bool char, vector signed char);
14045 vector signed char vec_vsubsbs (vector signed char, vector bool char);
14046 vector signed char vec_vsubsbs (vector signed char, vector signed char);
14047
14048 vector unsigned char vec_vsububs (vector bool char,
14049                                   vector unsigned char);
14050 vector unsigned char vec_vsububs (vector unsigned char,
14051                                   vector bool char);
14052 vector unsigned char vec_vsububs (vector unsigned char,
14053                                   vector unsigned char);
14054
14055 vector unsigned int vec_sum4s (vector unsigned char,
14056                                vector unsigned int);
14057 vector signed int vec_sum4s (vector signed char, vector signed int);
14058 vector signed int vec_sum4s (vector signed short, vector signed int);
14059
14060 vector signed int vec_vsum4shs (vector signed short, vector signed int);
14061
14062 vector signed int vec_vsum4sbs (vector signed char, vector signed int);
14063
14064 vector unsigned int vec_vsum4ubs (vector unsigned char,
14065                                   vector unsigned int);
14066
14067 vector signed int vec_sum2s (vector signed int, vector signed int);
14068
14069 vector signed int vec_sums (vector signed int, vector signed int);
14070
14071 vector float vec_trunc (vector float);
14072
14073 vector signed short vec_unpackh (vector signed char);
14074 vector bool short vec_unpackh (vector bool char);
14075 vector signed int vec_unpackh (vector signed short);
14076 vector bool int vec_unpackh (vector bool short);
14077 vector unsigned int vec_unpackh (vector pixel);
14078
14079 vector bool int vec_vupkhsh (vector bool short);
14080 vector signed int vec_vupkhsh (vector signed short);
14081
14082 vector unsigned int vec_vupkhpx (vector pixel);
14083
14084 vector bool short vec_vupkhsb (vector bool char);
14085 vector signed short vec_vupkhsb (vector signed char);
14086
14087 vector signed short vec_unpackl (vector signed char);
14088 vector bool short vec_unpackl (vector bool char);
14089 vector unsigned int vec_unpackl (vector pixel);
14090 vector signed int vec_unpackl (vector signed short);
14091 vector bool int vec_unpackl (vector bool short);
14092
14093 vector unsigned int vec_vupklpx (vector pixel);
14094
14095 vector bool int vec_vupklsh (vector bool short);
14096 vector signed int vec_vupklsh (vector signed short);
14097
14098 vector bool short vec_vupklsb (vector bool char);
14099 vector signed short vec_vupklsb (vector signed char);
14100
14101 vector float vec_xor (vector float, vector float);
14102 vector float vec_xor (vector float, vector bool int);
14103 vector float vec_xor (vector bool int, vector float);
14104 vector bool int vec_xor (vector bool int, vector bool int);
14105 vector signed int vec_xor (vector bool int, vector signed int);
14106 vector signed int vec_xor (vector signed int, vector bool int);
14107 vector signed int vec_xor (vector signed int, vector signed int);
14108 vector unsigned int vec_xor (vector bool int, vector unsigned int);
14109 vector unsigned int vec_xor (vector unsigned int, vector bool int);
14110 vector unsigned int vec_xor (vector unsigned int, vector unsigned int);
14111 vector bool short vec_xor (vector bool short, vector bool short);
14112 vector signed short vec_xor (vector bool short, vector signed short);
14113 vector signed short vec_xor (vector signed short, vector bool short);
14114 vector signed short vec_xor (vector signed short, vector signed short);
14115 vector unsigned short vec_xor (vector bool short,
14116                                vector unsigned short);
14117 vector unsigned short vec_xor (vector unsigned short,
14118                                vector bool short);
14119 vector unsigned short vec_xor (vector unsigned short,
14120                                vector unsigned short);
14121 vector signed char vec_xor (vector bool char, vector signed char);
14122 vector bool char vec_xor (vector bool char, vector bool char);
14123 vector signed char vec_xor (vector signed char, vector bool char);
14124 vector signed char vec_xor (vector signed char, vector signed char);
14125 vector unsigned char vec_xor (vector bool char, vector unsigned char);
14126 vector unsigned char vec_xor (vector unsigned char, vector bool char);
14127 vector unsigned char vec_xor (vector unsigned char,
14128                               vector unsigned char);
14129
14130 int vec_all_eq (vector signed char, vector bool char);
14131 int vec_all_eq (vector signed char, vector signed char);
14132 int vec_all_eq (vector unsigned char, vector bool char);
14133 int vec_all_eq (vector unsigned char, vector unsigned char);
14134 int vec_all_eq (vector bool char, vector bool char);
14135 int vec_all_eq (vector bool char, vector unsigned char);
14136 int vec_all_eq (vector bool char, vector signed char);
14137 int vec_all_eq (vector signed short, vector bool short);
14138 int vec_all_eq (vector signed short, vector signed short);
14139 int vec_all_eq (vector unsigned short, vector bool short);
14140 int vec_all_eq (vector unsigned short, vector unsigned short);
14141 int vec_all_eq (vector bool short, vector bool short);
14142 int vec_all_eq (vector bool short, vector unsigned short);
14143 int vec_all_eq (vector bool short, vector signed short);
14144 int vec_all_eq (vector pixel, vector pixel);
14145 int vec_all_eq (vector signed int, vector bool int);
14146 int vec_all_eq (vector signed int, vector signed int);
14147 int vec_all_eq (vector unsigned int, vector bool int);
14148 int vec_all_eq (vector unsigned int, vector unsigned int);
14149 int vec_all_eq (vector bool int, vector bool int);
14150 int vec_all_eq (vector bool int, vector unsigned int);
14151 int vec_all_eq (vector bool int, vector signed int);
14152 int vec_all_eq (vector float, vector float);
14153
14154 int vec_all_ge (vector bool char, vector unsigned char);
14155 int vec_all_ge (vector unsigned char, vector bool char);
14156 int vec_all_ge (vector unsigned char, vector unsigned char);
14157 int vec_all_ge (vector bool char, vector signed char);
14158 int vec_all_ge (vector signed char, vector bool char);
14159 int vec_all_ge (vector signed char, vector signed char);
14160 int vec_all_ge (vector bool short, vector unsigned short);
14161 int vec_all_ge (vector unsigned short, vector bool short);
14162 int vec_all_ge (vector unsigned short, vector unsigned short);
14163 int vec_all_ge (vector signed short, vector signed short);
14164 int vec_all_ge (vector bool short, vector signed short);
14165 int vec_all_ge (vector signed short, vector bool short);
14166 int vec_all_ge (vector bool int, vector unsigned int);
14167 int vec_all_ge (vector unsigned int, vector bool int);
14168 int vec_all_ge (vector unsigned int, vector unsigned int);
14169 int vec_all_ge (vector bool int, vector signed int);
14170 int vec_all_ge (vector signed int, vector bool int);
14171 int vec_all_ge (vector signed int, vector signed int);
14172 int vec_all_ge (vector float, vector float);
14173
14174 int vec_all_gt (vector bool char, vector unsigned char);
14175 int vec_all_gt (vector unsigned char, vector bool char);
14176 int vec_all_gt (vector unsigned char, vector unsigned char);
14177 int vec_all_gt (vector bool char, vector signed char);
14178 int vec_all_gt (vector signed char, vector bool char);
14179 int vec_all_gt (vector signed char, vector signed char);
14180 int vec_all_gt (vector bool short, vector unsigned short);
14181 int vec_all_gt (vector unsigned short, vector bool short);
14182 int vec_all_gt (vector unsigned short, vector unsigned short);
14183 int vec_all_gt (vector bool short, vector signed short);
14184 int vec_all_gt (vector signed short, vector bool short);
14185 int vec_all_gt (vector signed short, vector signed short);
14186 int vec_all_gt (vector bool int, vector unsigned int);
14187 int vec_all_gt (vector unsigned int, vector bool int);
14188 int vec_all_gt (vector unsigned int, vector unsigned int);
14189 int vec_all_gt (vector bool int, vector signed int);
14190 int vec_all_gt (vector signed int, vector bool int);
14191 int vec_all_gt (vector signed int, vector signed int);
14192 int vec_all_gt (vector float, vector float);
14193
14194 int vec_all_in (vector float, vector float);
14195
14196 int vec_all_le (vector bool char, vector unsigned char);
14197 int vec_all_le (vector unsigned char, vector bool char);
14198 int vec_all_le (vector unsigned char, vector unsigned char);
14199 int vec_all_le (vector bool char, vector signed char);
14200 int vec_all_le (vector signed char, vector bool char);
14201 int vec_all_le (vector signed char, vector signed char);
14202 int vec_all_le (vector bool short, vector unsigned short);
14203 int vec_all_le (vector unsigned short, vector bool short);
14204 int vec_all_le (vector unsigned short, vector unsigned short);
14205 int vec_all_le (vector bool short, vector signed short);
14206 int vec_all_le (vector signed short, vector bool short);
14207 int vec_all_le (vector signed short, vector signed short);
14208 int vec_all_le (vector bool int, vector unsigned int);
14209 int vec_all_le (vector unsigned int, vector bool int);
14210 int vec_all_le (vector unsigned int, vector unsigned int);
14211 int vec_all_le (vector bool int, vector signed int);
14212 int vec_all_le (vector signed int, vector bool int);
14213 int vec_all_le (vector signed int, vector signed int);
14214 int vec_all_le (vector float, vector float);
14215
14216 int vec_all_lt (vector bool char, vector unsigned char);
14217 int vec_all_lt (vector unsigned char, vector bool char);
14218 int vec_all_lt (vector unsigned char, vector unsigned char);
14219 int vec_all_lt (vector bool char, vector signed char);
14220 int vec_all_lt (vector signed char, vector bool char);
14221 int vec_all_lt (vector signed char, vector signed char);
14222 int vec_all_lt (vector bool short, vector unsigned short);
14223 int vec_all_lt (vector unsigned short, vector bool short);
14224 int vec_all_lt (vector unsigned short, vector unsigned short);
14225 int vec_all_lt (vector bool short, vector signed short);
14226 int vec_all_lt (vector signed short, vector bool short);
14227 int vec_all_lt (vector signed short, vector signed short);
14228 int vec_all_lt (vector bool int, vector unsigned int);
14229 int vec_all_lt (vector unsigned int, vector bool int);
14230 int vec_all_lt (vector unsigned int, vector unsigned int);
14231 int vec_all_lt (vector bool int, vector signed int);
14232 int vec_all_lt (vector signed int, vector bool int);
14233 int vec_all_lt (vector signed int, vector signed int);
14234 int vec_all_lt (vector float, vector float);
14235
14236 int vec_all_nan (vector float);
14237
14238 int vec_all_ne (vector signed char, vector bool char);
14239 int vec_all_ne (vector signed char, vector signed char);
14240 int vec_all_ne (vector unsigned char, vector bool char);
14241 int vec_all_ne (vector unsigned char, vector unsigned char);
14242 int vec_all_ne (vector bool char, vector bool char);
14243 int vec_all_ne (vector bool char, vector unsigned char);
14244 int vec_all_ne (vector bool char, vector signed char);
14245 int vec_all_ne (vector signed short, vector bool short);
14246 int vec_all_ne (vector signed short, vector signed short);
14247 int vec_all_ne (vector unsigned short, vector bool short);
14248 int vec_all_ne (vector unsigned short, vector unsigned short);
14249 int vec_all_ne (vector bool short, vector bool short);
14250 int vec_all_ne (vector bool short, vector unsigned short);
14251 int vec_all_ne (vector bool short, vector signed short);
14252 int vec_all_ne (vector pixel, vector pixel);
14253 int vec_all_ne (vector signed int, vector bool int);
14254 int vec_all_ne (vector signed int, vector signed int);
14255 int vec_all_ne (vector unsigned int, vector bool int);
14256 int vec_all_ne (vector unsigned int, vector unsigned int);
14257 int vec_all_ne (vector bool int, vector bool int);
14258 int vec_all_ne (vector bool int, vector unsigned int);
14259 int vec_all_ne (vector bool int, vector signed int);
14260 int vec_all_ne (vector float, vector float);
14261
14262 int vec_all_nge (vector float, vector float);
14263
14264 int vec_all_ngt (vector float, vector float);
14265
14266 int vec_all_nle (vector float, vector float);
14267
14268 int vec_all_nlt (vector float, vector float);
14269
14270 int vec_all_numeric (vector float);
14271
14272 int vec_any_eq (vector signed char, vector bool char);
14273 int vec_any_eq (vector signed char, vector signed char);
14274 int vec_any_eq (vector unsigned char, vector bool char);
14275 int vec_any_eq (vector unsigned char, vector unsigned char);
14276 int vec_any_eq (vector bool char, vector bool char);
14277 int vec_any_eq (vector bool char, vector unsigned char);
14278 int vec_any_eq (vector bool char, vector signed char);
14279 int vec_any_eq (vector signed short, vector bool short);
14280 int vec_any_eq (vector signed short, vector signed short);
14281 int vec_any_eq (vector unsigned short, vector bool short);
14282 int vec_any_eq (vector unsigned short, vector unsigned short);
14283 int vec_any_eq (vector bool short, vector bool short);
14284 int vec_any_eq (vector bool short, vector unsigned short);
14285 int vec_any_eq (vector bool short, vector signed short);
14286 int vec_any_eq (vector pixel, vector pixel);
14287 int vec_any_eq (vector signed int, vector bool int);
14288 int vec_any_eq (vector signed int, vector signed int);
14289 int vec_any_eq (vector unsigned int, vector bool int);
14290 int vec_any_eq (vector unsigned int, vector unsigned int);
14291 int vec_any_eq (vector bool int, vector bool int);
14292 int vec_any_eq (vector bool int, vector unsigned int);
14293 int vec_any_eq (vector bool int, vector signed int);
14294 int vec_any_eq (vector float, vector float);
14295
14296 int vec_any_ge (vector signed char, vector bool char);
14297 int vec_any_ge (vector unsigned char, vector bool char);
14298 int vec_any_ge (vector unsigned char, vector unsigned char);
14299 int vec_any_ge (vector signed char, vector signed char);
14300 int vec_any_ge (vector bool char, vector unsigned char);
14301 int vec_any_ge (vector bool char, vector signed char);
14302 int vec_any_ge (vector unsigned short, vector bool short);
14303 int vec_any_ge (vector unsigned short, vector unsigned short);
14304 int vec_any_ge (vector signed short, vector signed short);
14305 int vec_any_ge (vector signed short, vector bool short);
14306 int vec_any_ge (vector bool short, vector unsigned short);
14307 int vec_any_ge (vector bool short, vector signed short);
14308 int vec_any_ge (vector signed int, vector bool int);
14309 int vec_any_ge (vector unsigned int, vector bool int);
14310 int vec_any_ge (vector unsigned int, vector unsigned int);
14311 int vec_any_ge (vector signed int, vector signed int);
14312 int vec_any_ge (vector bool int, vector unsigned int);
14313 int vec_any_ge (vector bool int, vector signed int);
14314 int vec_any_ge (vector float, vector float);
14315
14316 int vec_any_gt (vector bool char, vector unsigned char);
14317 int vec_any_gt (vector unsigned char, vector bool char);
14318 int vec_any_gt (vector unsigned char, vector unsigned char);
14319 int vec_any_gt (vector bool char, vector signed char);
14320 int vec_any_gt (vector signed char, vector bool char);
14321 int vec_any_gt (vector signed char, vector signed char);
14322 int vec_any_gt (vector bool short, vector unsigned short);
14323 int vec_any_gt (vector unsigned short, vector bool short);
14324 int vec_any_gt (vector unsigned short, vector unsigned short);
14325 int vec_any_gt (vector bool short, vector signed short);
14326 int vec_any_gt (vector signed short, vector bool short);
14327 int vec_any_gt (vector signed short, vector signed short);
14328 int vec_any_gt (vector bool int, vector unsigned int);
14329 int vec_any_gt (vector unsigned int, vector bool int);
14330 int vec_any_gt (vector unsigned int, vector unsigned int);
14331 int vec_any_gt (vector bool int, vector signed int);
14332 int vec_any_gt (vector signed int, vector bool int);
14333 int vec_any_gt (vector signed int, vector signed int);
14334 int vec_any_gt (vector float, vector float);
14335
14336 int vec_any_le (vector bool char, vector unsigned char);
14337 int vec_any_le (vector unsigned char, vector bool char);
14338 int vec_any_le (vector unsigned char, vector unsigned char);
14339 int vec_any_le (vector bool char, vector signed char);
14340 int vec_any_le (vector signed char, vector bool char);
14341 int vec_any_le (vector signed char, vector signed char);
14342 int vec_any_le (vector bool short, vector unsigned short);
14343 int vec_any_le (vector unsigned short, vector bool short);
14344 int vec_any_le (vector unsigned short, vector unsigned short);
14345 int vec_any_le (vector bool short, vector signed short);
14346 int vec_any_le (vector signed short, vector bool short);
14347 int vec_any_le (vector signed short, vector signed short);
14348 int vec_any_le (vector bool int, vector unsigned int);
14349 int vec_any_le (vector unsigned int, vector bool int);
14350 int vec_any_le (vector unsigned int, vector unsigned int);
14351 int vec_any_le (vector bool int, vector signed int);
14352 int vec_any_le (vector signed int, vector bool int);
14353 int vec_any_le (vector signed int, vector signed int);
14354 int vec_any_le (vector float, vector float);
14355
14356 int vec_any_lt (vector bool char, vector unsigned char);
14357 int vec_any_lt (vector unsigned char, vector bool char);
14358 int vec_any_lt (vector unsigned char, vector unsigned char);
14359 int vec_any_lt (vector bool char, vector signed char);
14360 int vec_any_lt (vector signed char, vector bool char);
14361 int vec_any_lt (vector signed char, vector signed char);
14362 int vec_any_lt (vector bool short, vector unsigned short);
14363 int vec_any_lt (vector unsigned short, vector bool short);
14364 int vec_any_lt (vector unsigned short, vector unsigned short);
14365 int vec_any_lt (vector bool short, vector signed short);
14366 int vec_any_lt (vector signed short, vector bool short);
14367 int vec_any_lt (vector signed short, vector signed short);
14368 int vec_any_lt (vector bool int, vector unsigned int);
14369 int vec_any_lt (vector unsigned int, vector bool int);
14370 int vec_any_lt (vector unsigned int, vector unsigned int);
14371 int vec_any_lt (vector bool int, vector signed int);
14372 int vec_any_lt (vector signed int, vector bool int);
14373 int vec_any_lt (vector signed int, vector signed int);
14374 int vec_any_lt (vector float, vector float);
14375
14376 int vec_any_nan (vector float);
14377
14378 int vec_any_ne (vector signed char, vector bool char);
14379 int vec_any_ne (vector signed char, vector signed char);
14380 int vec_any_ne (vector unsigned char, vector bool char);
14381 int vec_any_ne (vector unsigned char, vector unsigned char);
14382 int vec_any_ne (vector bool char, vector bool char);
14383 int vec_any_ne (vector bool char, vector unsigned char);
14384 int vec_any_ne (vector bool char, vector signed char);
14385 int vec_any_ne (vector signed short, vector bool short);
14386 int vec_any_ne (vector signed short, vector signed short);
14387 int vec_any_ne (vector unsigned short, vector bool short);
14388 int vec_any_ne (vector unsigned short, vector unsigned short);
14389 int vec_any_ne (vector bool short, vector bool short);
14390 int vec_any_ne (vector bool short, vector unsigned short);
14391 int vec_any_ne (vector bool short, vector signed short);
14392 int vec_any_ne (vector pixel, vector pixel);
14393 int vec_any_ne (vector signed int, vector bool int);
14394 int vec_any_ne (vector signed int, vector signed int);
14395 int vec_any_ne (vector unsigned int, vector bool int);
14396 int vec_any_ne (vector unsigned int, vector unsigned int);
14397 int vec_any_ne (vector bool int, vector bool int);
14398 int vec_any_ne (vector bool int, vector unsigned int);
14399 int vec_any_ne (vector bool int, vector signed int);
14400 int vec_any_ne (vector float, vector float);
14401
14402 int vec_any_nge (vector float, vector float);
14403
14404 int vec_any_ngt (vector float, vector float);
14405
14406 int vec_any_nle (vector float, vector float);
14407
14408 int vec_any_nlt (vector float, vector float);
14409
14410 int vec_any_numeric (vector float);
14411
14412 int vec_any_out (vector float, vector float);
14413 @end smallexample
14414
14415 If the vector/scalar (VSX) instruction set is available, the following
14416 additional functions are available:
14417
14418 @smallexample
14419 vector double vec_abs (vector double);
14420 vector double vec_add (vector double, vector double);
14421 vector double vec_and (vector double, vector double);
14422 vector double vec_and (vector double, vector bool long);
14423 vector double vec_and (vector bool long, vector double);
14424 vector long vec_and (vector long, vector long);
14425 vector long vec_and (vector long, vector bool long);
14426 vector long vec_and (vector bool long, vector long);
14427 vector unsigned long vec_and (vector unsigned long, vector unsigned long);
14428 vector unsigned long vec_and (vector unsigned long, vector bool long);
14429 vector unsigned long vec_and (vector bool long, vector unsigned long);
14430 vector double vec_andc (vector double, vector double);
14431 vector double vec_andc (vector double, vector bool long);
14432 vector double vec_andc (vector bool long, vector double);
14433 vector long vec_andc (vector long, vector long);
14434 vector long vec_andc (vector long, vector bool long);
14435 vector long vec_andc (vector bool long, vector long);
14436 vector unsigned long vec_andc (vector unsigned long, vector unsigned long);
14437 vector unsigned long vec_andc (vector unsigned long, vector bool long);
14438 vector unsigned long vec_andc (vector bool long, vector unsigned long);
14439 vector double vec_ceil (vector double);
14440 vector bool long vec_cmpeq (vector double, vector double);
14441 vector bool long vec_cmpge (vector double, vector double);
14442 vector bool long vec_cmpgt (vector double, vector double);
14443 vector bool long vec_cmple (vector double, vector double);
14444 vector bool long vec_cmplt (vector double, vector double);
14445 vector double vec_cpsgn (vector double, vector double);
14446 vector float vec_div (vector float, vector float);
14447 vector double vec_div (vector double, vector double);
14448 vector long vec_div (vector long, vector long);
14449 vector unsigned long vec_div (vector unsigned long, vector unsigned long);
14450 vector double vec_floor (vector double);
14451 vector double vec_ld (int, const vector double *);
14452 vector double vec_ld (int, const double *);
14453 vector double vec_ldl (int, const vector double *);
14454 vector double vec_ldl (int, const double *);
14455 vector unsigned char vec_lvsl (int, const volatile double *);
14456 vector unsigned char vec_lvsr (int, const volatile double *);
14457 vector double vec_madd (vector double, vector double, vector double);
14458 vector double vec_max (vector double, vector double);
14459 vector signed long vec_mergeh (vector signed long, vector signed long);
14460 vector signed long vec_mergeh (vector signed long, vector bool long);
14461 vector signed long vec_mergeh (vector bool long, vector signed long);
14462 vector unsigned long vec_mergeh (vector unsigned long, vector unsigned long);
14463 vector unsigned long vec_mergeh (vector unsigned long, vector bool long);
14464 vector unsigned long vec_mergeh (vector bool long, vector unsigned long);
14465 vector signed long vec_mergel (vector signed long, vector signed long);
14466 vector signed long vec_mergel (vector signed long, vector bool long);
14467 vector signed long vec_mergel (vector bool long, vector signed long);
14468 vector unsigned long vec_mergel (vector unsigned long, vector unsigned long);
14469 vector unsigned long vec_mergel (vector unsigned long, vector bool long);
14470 vector unsigned long vec_mergel (vector bool long, vector unsigned long);
14471 vector double vec_min (vector double, vector double);
14472 vector float vec_msub (vector float, vector float, vector float);
14473 vector double vec_msub (vector double, vector double, vector double);
14474 vector float vec_mul (vector float, vector float);
14475 vector double vec_mul (vector double, vector double);
14476 vector long vec_mul (vector long, vector long);
14477 vector unsigned long vec_mul (vector unsigned long, vector unsigned long);
14478 vector float vec_nearbyint (vector float);
14479 vector double vec_nearbyint (vector double);
14480 vector float vec_nmadd (vector float, vector float, vector float);
14481 vector double vec_nmadd (vector double, vector double, vector double);
14482 vector double vec_nmsub (vector double, vector double, vector double);
14483 vector double vec_nor (vector double, vector double);
14484 vector long vec_nor (vector long, vector long);
14485 vector long vec_nor (vector long, vector bool long);
14486 vector long vec_nor (vector bool long, vector long);
14487 vector unsigned long vec_nor (vector unsigned long, vector unsigned long);
14488 vector unsigned long vec_nor (vector unsigned long, vector bool long);
14489 vector unsigned long vec_nor (vector bool long, vector unsigned long);
14490 vector double vec_or (vector double, vector double);
14491 vector double vec_or (vector double, vector bool long);
14492 vector double vec_or (vector bool long, vector double);
14493 vector long vec_or (vector long, vector long);
14494 vector long vec_or (vector long, vector bool long);
14495 vector long vec_or (vector bool long, vector long);
14496 vector unsigned long vec_or (vector unsigned long, vector unsigned long);
14497 vector unsigned long vec_or (vector unsigned long, vector bool long);
14498 vector unsigned long vec_or (vector bool long, vector unsigned long);
14499 vector double vec_perm (vector double, vector double, vector unsigned char);
14500 vector long vec_perm (vector long, vector long, vector unsigned char);
14501 vector unsigned long vec_perm (vector unsigned long, vector unsigned long,
14502                                vector unsigned char);
14503 vector double vec_rint (vector double);
14504 vector double vec_recip (vector double, vector double);
14505 vector double vec_rsqrt (vector double);
14506 vector double vec_rsqrte (vector double);
14507 vector double vec_sel (vector double, vector double, vector bool long);
14508 vector double vec_sel (vector double, vector double, vector unsigned long);
14509 vector long vec_sel (vector long, vector long, vector long);
14510 vector long vec_sel (vector long, vector long, vector unsigned long);
14511 vector long vec_sel (vector long, vector long, vector bool long);
14512 vector unsigned long vec_sel (vector unsigned long, vector unsigned long,
14513                               vector long);
14514 vector unsigned long vec_sel (vector unsigned long, vector unsigned long,
14515                               vector unsigned long);
14516 vector unsigned long vec_sel (vector unsigned long, vector unsigned long,
14517                               vector bool long);
14518 vector double vec_splats (double);
14519 vector signed long vec_splats (signed long);
14520 vector unsigned long vec_splats (unsigned long);
14521 vector float vec_sqrt (vector float);
14522 vector double vec_sqrt (vector double);
14523 void vec_st (vector double, int, vector double *);
14524 void vec_st (vector double, int, double *);
14525 vector double vec_sub (vector double, vector double);
14526 vector double vec_trunc (vector double);
14527 vector double vec_xor (vector double, vector double);
14528 vector double vec_xor (vector double, vector bool long);
14529 vector double vec_xor (vector bool long, vector double);
14530 vector long vec_xor (vector long, vector long);
14531 vector long vec_xor (vector long, vector bool long);
14532 vector long vec_xor (vector bool long, vector long);
14533 vector unsigned long vec_xor (vector unsigned long, vector unsigned long);
14534 vector unsigned long vec_xor (vector unsigned long, vector bool long);
14535 vector unsigned long vec_xor (vector bool long, vector unsigned long);
14536 int vec_all_eq (vector double, vector double);
14537 int vec_all_ge (vector double, vector double);
14538 int vec_all_gt (vector double, vector double);
14539 int vec_all_le (vector double, vector double);
14540 int vec_all_lt (vector double, vector double);
14541 int vec_all_nan (vector double);
14542 int vec_all_ne (vector double, vector double);
14543 int vec_all_nge (vector double, vector double);
14544 int vec_all_ngt (vector double, vector double);
14545 int vec_all_nle (vector double, vector double);
14546 int vec_all_nlt (vector double, vector double);
14547 int vec_all_numeric (vector double);
14548 int vec_any_eq (vector double, vector double);
14549 int vec_any_ge (vector double, vector double);
14550 int vec_any_gt (vector double, vector double);
14551 int vec_any_le (vector double, vector double);
14552 int vec_any_lt (vector double, vector double);
14553 int vec_any_nan (vector double);
14554 int vec_any_ne (vector double, vector double);
14555 int vec_any_nge (vector double, vector double);
14556 int vec_any_ngt (vector double, vector double);
14557 int vec_any_nle (vector double, vector double);
14558 int vec_any_nlt (vector double, vector double);
14559 int vec_any_numeric (vector double);
14560
14561 vector double vec_vsx_ld (int, const vector double *);
14562 vector double vec_vsx_ld (int, const double *);
14563 vector float vec_vsx_ld (int, const vector float *);
14564 vector float vec_vsx_ld (int, const float *);
14565 vector bool int vec_vsx_ld (int, const vector bool int *);
14566 vector signed int vec_vsx_ld (int, const vector signed int *);
14567 vector signed int vec_vsx_ld (int, const int *);
14568 vector signed int vec_vsx_ld (int, const long *);
14569 vector unsigned int vec_vsx_ld (int, const vector unsigned int *);
14570 vector unsigned int vec_vsx_ld (int, const unsigned int *);
14571 vector unsigned int vec_vsx_ld (int, const unsigned long *);
14572 vector bool short vec_vsx_ld (int, const vector bool short *);
14573 vector pixel vec_vsx_ld (int, const vector pixel *);
14574 vector signed short vec_vsx_ld (int, const vector signed short *);
14575 vector signed short vec_vsx_ld (int, const short *);
14576 vector unsigned short vec_vsx_ld (int, const vector unsigned short *);
14577 vector unsigned short vec_vsx_ld (int, const unsigned short *);
14578 vector bool char vec_vsx_ld (int, const vector bool char *);
14579 vector signed char vec_vsx_ld (int, const vector signed char *);
14580 vector signed char vec_vsx_ld (int, const signed char *);
14581 vector unsigned char vec_vsx_ld (int, const vector unsigned char *);
14582 vector unsigned char vec_vsx_ld (int, const unsigned char *);
14583
14584 void vec_vsx_st (vector double, int, vector double *);
14585 void vec_vsx_st (vector double, int, double *);
14586 void vec_vsx_st (vector float, int, vector float *);
14587 void vec_vsx_st (vector float, int, float *);
14588 void vec_vsx_st (vector signed int, int, vector signed int *);
14589 void vec_vsx_st (vector signed int, int, int *);
14590 void vec_vsx_st (vector unsigned int, int, vector unsigned int *);
14591 void vec_vsx_st (vector unsigned int, int, unsigned int *);
14592 void vec_vsx_st (vector bool int, int, vector bool int *);
14593 void vec_vsx_st (vector bool int, int, unsigned int *);
14594 void vec_vsx_st (vector bool int, int, int *);
14595 void vec_vsx_st (vector signed short, int, vector signed short *);
14596 void vec_vsx_st (vector signed short, int, short *);
14597 void vec_vsx_st (vector unsigned short, int, vector unsigned short *);
14598 void vec_vsx_st (vector unsigned short, int, unsigned short *);
14599 void vec_vsx_st (vector bool short, int, vector bool short *);
14600 void vec_vsx_st (vector bool short, int, unsigned short *);
14601 void vec_vsx_st (vector pixel, int, vector pixel *);
14602 void vec_vsx_st (vector pixel, int, unsigned short *);
14603 void vec_vsx_st (vector pixel, int, short *);
14604 void vec_vsx_st (vector bool short, int, short *);
14605 void vec_vsx_st (vector signed char, int, vector signed char *);
14606 void vec_vsx_st (vector signed char, int, signed char *);
14607 void vec_vsx_st (vector unsigned char, int, vector unsigned char *);
14608 void vec_vsx_st (vector unsigned char, int, unsigned char *);
14609 void vec_vsx_st (vector bool char, int, vector bool char *);
14610 void vec_vsx_st (vector bool char, int, unsigned char *);
14611 void vec_vsx_st (vector bool char, int, signed char *);
14612
14613 vector double vec_xxpermdi (vector double, vector double, int);
14614 vector float vec_xxpermdi (vector float, vector float, int);
14615 vector long long vec_xxpermdi (vector long long, vector long long, int);
14616 vector unsigned long long vec_xxpermdi (vector unsigned long long,
14617                                         vector unsigned long long, int);
14618 vector int vec_xxpermdi (vector int, vector int, int);
14619 vector unsigned int vec_xxpermdi (vector unsigned int,
14620                                   vector unsigned int, int);
14621 vector short vec_xxpermdi (vector short, vector short, int);
14622 vector unsigned short vec_xxpermdi (vector unsigned short,
14623                                     vector unsigned short, int);
14624 vector signed char vec_xxpermdi (vector signed char, vector signed char, int);
14625 vector unsigned char vec_xxpermdi (vector unsigned char,
14626                                    vector unsigned char, int);
14627
14628 vector double vec_xxsldi (vector double, vector double, int);
14629 vector float vec_xxsldi (vector float, vector float, int);
14630 vector long long vec_xxsldi (vector long long, vector long long, int);
14631 vector unsigned long long vec_xxsldi (vector unsigned long long,
14632                                       vector unsigned long long, int);
14633 vector int vec_xxsldi (vector int, vector int, int);
14634 vector unsigned int vec_xxsldi (vector unsigned int, vector unsigned int, int);
14635 vector short vec_xxsldi (vector short, vector short, int);
14636 vector unsigned short vec_xxsldi (vector unsigned short,
14637                                   vector unsigned short, int);
14638 vector signed char vec_xxsldi (vector signed char, vector signed char, int);
14639 vector unsigned char vec_xxsldi (vector unsigned char,
14640                                  vector unsigned char, int);
14641 @end smallexample
14642
14643 Note that the @samp{vec_ld} and @samp{vec_st} built-in functions always
14644 generate the AltiVec @samp{LVX} and @samp{STVX} instructions even
14645 if the VSX instruction set is available.  The @samp{vec_vsx_ld} and
14646 @samp{vec_vsx_st} built-in functions always generate the VSX @samp{LXVD2X},
14647 @samp{LXVW4X}, @samp{STXVD2X}, and @samp{STXVW4X} instructions.
14648
14649 If the ISA 2.07 additions to the vector/scalar (power8-vector)
14650 instruction set is available, the following additional functions are
14651 available for both 32-bit and 64-bit targets.  For 64-bit targets, you
14652 can use @var{vector long} instead of @var{vector long long},
14653 @var{vector bool long} instead of @var{vector bool long long}, and
14654 @var{vector unsigned long} instead of @var{vector unsigned long long}.
14655
14656 @smallexample
14657 vector long long vec_abs (vector long long);
14658
14659 vector long long vec_add (vector long long, vector long long);
14660 vector unsigned long long vec_add (vector unsigned long long,
14661                                    vector unsigned long long);
14662
14663 int vec_all_eq (vector long long, vector long long);
14664 int vec_all_eq (vector unsigned long long, vector unsigned long long);
14665 int vec_all_ge (vector long long, vector long long);
14666 int vec_all_ge (vector unsigned long long, vector unsigned long long);
14667 int vec_all_gt (vector long long, vector long long);
14668 int vec_all_gt (vector unsigned long long, vector unsigned long long);
14669 int vec_all_le (vector long long, vector long long);
14670 int vec_all_le (vector unsigned long long, vector unsigned long long);
14671 int vec_all_lt (vector long long, vector long long);
14672 int vec_all_lt (vector unsigned long long, vector unsigned long long);
14673 int vec_all_ne (vector long long, vector long long);
14674 int vec_all_ne (vector unsigned long long, vector unsigned long long);
14675
14676 int vec_any_eq (vector long long, vector long long);
14677 int vec_any_eq (vector unsigned long long, vector unsigned long long);
14678 int vec_any_ge (vector long long, vector long long);
14679 int vec_any_ge (vector unsigned long long, vector unsigned long long);
14680 int vec_any_gt (vector long long, vector long long);
14681 int vec_any_gt (vector unsigned long long, vector unsigned long long);
14682 int vec_any_le (vector long long, vector long long);
14683 int vec_any_le (vector unsigned long long, vector unsigned long long);
14684 int vec_any_lt (vector long long, vector long long);
14685 int vec_any_lt (vector unsigned long long, vector unsigned long long);
14686 int vec_any_ne (vector long long, vector long long);
14687 int vec_any_ne (vector unsigned long long, vector unsigned long long);
14688
14689 vector long long vec_eqv (vector long long, vector long long);
14690 vector long long vec_eqv (vector bool long long, vector long long);
14691 vector long long vec_eqv (vector long long, vector bool long long);
14692 vector unsigned long long vec_eqv (vector unsigned long long,
14693                                    vector unsigned long long);
14694 vector unsigned long long vec_eqv (vector bool long long,
14695                                    vector unsigned long long);
14696 vector unsigned long long vec_eqv (vector unsigned long long,
14697                                    vector bool long long);
14698 vector int vec_eqv (vector int, vector int);
14699 vector int vec_eqv (vector bool int, vector int);
14700 vector int vec_eqv (vector int, vector bool int);
14701 vector unsigned int vec_eqv (vector unsigned int, vector unsigned int);
14702 vector unsigned int vec_eqv (vector bool unsigned int,
14703                              vector unsigned int);
14704 vector unsigned int vec_eqv (vector unsigned int,
14705                              vector bool unsigned int);
14706 vector short vec_eqv (vector short, vector short);
14707 vector short vec_eqv (vector bool short, vector short);
14708 vector short vec_eqv (vector short, vector bool short);
14709 vector unsigned short vec_eqv (vector unsigned short, vector unsigned short);
14710 vector unsigned short vec_eqv (vector bool unsigned short,
14711                                vector unsigned short);
14712 vector unsigned short vec_eqv (vector unsigned short,
14713                                vector bool unsigned short);
14714 vector signed char vec_eqv (vector signed char, vector signed char);
14715 vector signed char vec_eqv (vector bool signed char, vector signed char);
14716 vector signed char vec_eqv (vector signed char, vector bool signed char);
14717 vector unsigned char vec_eqv (vector unsigned char, vector unsigned char);
14718 vector unsigned char vec_eqv (vector bool unsigned char, vector unsigned char);
14719 vector unsigned char vec_eqv (vector unsigned char, vector bool unsigned char);
14720
14721 vector long long vec_max (vector long long, vector long long);
14722 vector unsigned long long vec_max (vector unsigned long long,
14723                                    vector unsigned long long);
14724
14725 vector signed int vec_mergee (vector signed int, vector signed int);
14726 vector unsigned int vec_mergee (vector unsigned int, vector unsigned int);
14727 vector bool int vec_mergee (vector bool int, vector bool int);
14728
14729 vector signed int vec_mergeo (vector signed int, vector signed int);
14730 vector unsigned int vec_mergeo (vector unsigned int, vector unsigned int);
14731 vector bool int vec_mergeo (vector bool int, vector bool int);
14732
14733 vector long long vec_min (vector long long, vector long long);
14734 vector unsigned long long vec_min (vector unsigned long long,
14735                                    vector unsigned long long);
14736
14737 vector long long vec_nand (vector long long, vector long long);
14738 vector long long vec_nand (vector bool long long, vector long long);
14739 vector long long vec_nand (vector long long, vector bool long long);
14740 vector unsigned long long vec_nand (vector unsigned long long,
14741                                     vector unsigned long long);
14742 vector unsigned long long vec_nand (vector bool long long,
14743                                    vector unsigned long long);
14744 vector unsigned long long vec_nand (vector unsigned long long,
14745                                     vector bool long long);
14746 vector int vec_nand (vector int, vector int);
14747 vector int vec_nand (vector bool int, vector int);
14748 vector int vec_nand (vector int, vector bool int);
14749 vector unsigned int vec_nand (vector unsigned int, vector unsigned int);
14750 vector unsigned int vec_nand (vector bool unsigned int,
14751                               vector unsigned int);
14752 vector unsigned int vec_nand (vector unsigned int,
14753                               vector bool unsigned int);
14754 vector short vec_nand (vector short, vector short);
14755 vector short vec_nand (vector bool short, vector short);
14756 vector short vec_nand (vector short, vector bool short);
14757 vector unsigned short vec_nand (vector unsigned short, vector unsigned short);
14758 vector unsigned short vec_nand (vector bool unsigned short,
14759                                 vector unsigned short);
14760 vector unsigned short vec_nand (vector unsigned short,
14761                                 vector bool unsigned short);
14762 vector signed char vec_nand (vector signed char, vector signed char);
14763 vector signed char vec_nand (vector bool signed char, vector signed char);
14764 vector signed char vec_nand (vector signed char, vector bool signed char);
14765 vector unsigned char vec_nand (vector unsigned char, vector unsigned char);
14766 vector unsigned char vec_nand (vector bool unsigned char, vector unsigned char);
14767 vector unsigned char vec_nand (vector unsigned char, vector bool unsigned char);
14768
14769 vector long long vec_orc (vector long long, vector long long);
14770 vector long long vec_orc (vector bool long long, vector long long);
14771 vector long long vec_orc (vector long long, vector bool long long);
14772 vector unsigned long long vec_orc (vector unsigned long long,
14773                                    vector unsigned long long);
14774 vector unsigned long long vec_orc (vector bool long long,
14775                                    vector unsigned long long);
14776 vector unsigned long long vec_orc (vector unsigned long long,
14777                                    vector bool long long);
14778 vector int vec_orc (vector int, vector int);
14779 vector int vec_orc (vector bool int, vector int);
14780 vector int vec_orc (vector int, vector bool int);
14781 vector unsigned int vec_orc (vector unsigned int, vector unsigned int);
14782 vector unsigned int vec_orc (vector bool unsigned int,
14783                              vector unsigned int);
14784 vector unsigned int vec_orc (vector unsigned int,
14785                              vector bool unsigned int);
14786 vector short vec_orc (vector short, vector short);
14787 vector short vec_orc (vector bool short, vector short);
14788 vector short vec_orc (vector short, vector bool short);
14789 vector unsigned short vec_orc (vector unsigned short, vector unsigned short);
14790 vector unsigned short vec_orc (vector bool unsigned short,
14791                                vector unsigned short);
14792 vector unsigned short vec_orc (vector unsigned short,
14793                                vector bool unsigned short);
14794 vector signed char vec_orc (vector signed char, vector signed char);
14795 vector signed char vec_orc (vector bool signed char, vector signed char);
14796 vector signed char vec_orc (vector signed char, vector bool signed char);
14797 vector unsigned char vec_orc (vector unsigned char, vector unsigned char);
14798 vector unsigned char vec_orc (vector bool unsigned char, vector unsigned char);
14799 vector unsigned char vec_orc (vector unsigned char, vector bool unsigned char);
14800
14801 vector int vec_pack (vector long long, vector long long);
14802 vector unsigned int vec_pack (vector unsigned long long,
14803                               vector unsigned long long);
14804 vector bool int vec_pack (vector bool long long, vector bool long long);
14805
14806 vector int vec_packs (vector long long, vector long long);
14807 vector unsigned int vec_packs (vector unsigned long long,
14808                                vector unsigned long long);
14809
14810 vector unsigned int vec_packsu (vector long long, vector long long);
14811 vector unsigned int vec_packsu (vector unsigned long long,
14812                                 vector unsigned long long);
14813
14814 vector long long vec_rl (vector long long,
14815                          vector unsigned long long);
14816 vector long long vec_rl (vector unsigned long long,
14817                          vector unsigned long long);
14818
14819 vector long long vec_sl (vector long long, vector unsigned long long);
14820 vector long long vec_sl (vector unsigned long long,
14821                          vector unsigned long long);
14822
14823 vector long long vec_sr (vector long long, vector unsigned long long);
14824 vector unsigned long long char vec_sr (vector unsigned long long,
14825                                        vector unsigned long long);
14826
14827 vector long long vec_sra (vector long long, vector unsigned long long);
14828 vector unsigned long long vec_sra (vector unsigned long long,
14829                                    vector unsigned long long);
14830
14831 vector long long vec_sub (vector long long, vector long long);
14832 vector unsigned long long vec_sub (vector unsigned long long,
14833                                    vector unsigned long long);
14834
14835 vector long long vec_unpackh (vector int);
14836 vector unsigned long long vec_unpackh (vector unsigned int);
14837
14838 vector long long vec_unpackl (vector int);
14839 vector unsigned long long vec_unpackl (vector unsigned int);
14840
14841 vector long long vec_vaddudm (vector long long, vector long long);
14842 vector long long vec_vaddudm (vector bool long long, vector long long);
14843 vector long long vec_vaddudm (vector long long, vector bool long long);
14844 vector unsigned long long vec_vaddudm (vector unsigned long long,
14845                                        vector unsigned long long);
14846 vector unsigned long long vec_vaddudm (vector bool unsigned long long,
14847                                        vector unsigned long long);
14848 vector unsigned long long vec_vaddudm (vector unsigned long long,
14849                                        vector bool unsigned long long);
14850
14851 vector long long vec_vbpermq (vector signed char, vector signed char);
14852 vector long long vec_vbpermq (vector unsigned char, vector unsigned char);
14853
14854 vector long long vec_cntlz (vector long long);
14855 vector unsigned long long vec_cntlz (vector unsigned long long);
14856 vector int vec_cntlz (vector int);
14857 vector unsigned int vec_cntlz (vector int);
14858 vector short vec_cntlz (vector short);
14859 vector unsigned short vec_cntlz (vector unsigned short);
14860 vector signed char vec_cntlz (vector signed char);
14861 vector unsigned char vec_cntlz (vector unsigned char);
14862
14863 vector long long vec_vclz (vector long long);
14864 vector unsigned long long vec_vclz (vector unsigned long long);
14865 vector int vec_vclz (vector int);
14866 vector unsigned int vec_vclz (vector int);
14867 vector short vec_vclz (vector short);
14868 vector unsigned short vec_vclz (vector unsigned short);
14869 vector signed char vec_vclz (vector signed char);
14870 vector unsigned char vec_vclz (vector unsigned char);
14871
14872 vector signed char vec_vclzb (vector signed char);
14873 vector unsigned char vec_vclzb (vector unsigned char);
14874
14875 vector long long vec_vclzd (vector long long);
14876 vector unsigned long long vec_vclzd (vector unsigned long long);
14877
14878 vector short vec_vclzh (vector short);
14879 vector unsigned short vec_vclzh (vector unsigned short);
14880
14881 vector int vec_vclzw (vector int);
14882 vector unsigned int vec_vclzw (vector int);
14883
14884 vector signed char vec_vgbbd (vector signed char);
14885 vector unsigned char vec_vgbbd (vector unsigned char);
14886
14887 vector long long vec_vmaxsd (vector long long, vector long long);
14888
14889 vector unsigned long long vec_vmaxud (vector unsigned long long,
14890                                       unsigned vector long long);
14891
14892 vector long long vec_vminsd (vector long long, vector long long);
14893
14894 vector unsigned long long vec_vminud (vector long long,
14895                                       vector long long);
14896
14897 vector int vec_vpksdss (vector long long, vector long long);
14898 vector unsigned int vec_vpksdss (vector long long, vector long long);
14899
14900 vector unsigned int vec_vpkudus (vector unsigned long long,
14901                                  vector unsigned long long);
14902
14903 vector int vec_vpkudum (vector long long, vector long long);
14904 vector unsigned int vec_vpkudum (vector unsigned long long,
14905                                  vector unsigned long long);
14906 vector bool int vec_vpkudum (vector bool long long, vector bool long long);
14907
14908 vector long long vec_vpopcnt (vector long long);
14909 vector unsigned long long vec_vpopcnt (vector unsigned long long);
14910 vector int vec_vpopcnt (vector int);
14911 vector unsigned int vec_vpopcnt (vector int);
14912 vector short vec_vpopcnt (vector short);
14913 vector unsigned short vec_vpopcnt (vector unsigned short);
14914 vector signed char vec_vpopcnt (vector signed char);
14915 vector unsigned char vec_vpopcnt (vector unsigned char);
14916
14917 vector signed char vec_vpopcntb (vector signed char);
14918 vector unsigned char vec_vpopcntb (vector unsigned char);
14919
14920 vector long long vec_vpopcntd (vector long long);
14921 vector unsigned long long vec_vpopcntd (vector unsigned long long);
14922
14923 vector short vec_vpopcnth (vector short);
14924 vector unsigned short vec_vpopcnth (vector unsigned short);
14925
14926 vector int vec_vpopcntw (vector int);
14927 vector unsigned int vec_vpopcntw (vector int);
14928
14929 vector long long vec_vrld (vector long long, vector unsigned long long);
14930 vector unsigned long long vec_vrld (vector unsigned long long,
14931                                     vector unsigned long long);
14932
14933 vector long long vec_vsld (vector long long, vector unsigned long long);
14934 vector long long vec_vsld (vector unsigned long long,
14935                            vector unsigned long long);
14936
14937 vector long long vec_vsrad (vector long long, vector unsigned long long);
14938 vector unsigned long long vec_vsrad (vector unsigned long long,
14939                                      vector unsigned long long);
14940
14941 vector long long vec_vsrd (vector long long, vector unsigned long long);
14942 vector unsigned long long char vec_vsrd (vector unsigned long long,
14943                                          vector unsigned long long);
14944
14945 vector long long vec_vsubudm (vector long long, vector long long);
14946 vector long long vec_vsubudm (vector bool long long, vector long long);
14947 vector long long vec_vsubudm (vector long long, vector bool long long);
14948 vector unsigned long long vec_vsubudm (vector unsigned long long,
14949                                        vector unsigned long long);
14950 vector unsigned long long vec_vsubudm (vector bool long long,
14951                                        vector unsigned long long);
14952 vector unsigned long long vec_vsubudm (vector unsigned long long,
14953                                        vector bool long long);
14954
14955 vector long long vec_vupkhsw (vector int);
14956 vector unsigned long long vec_vupkhsw (vector unsigned int);
14957
14958 vector long long vec_vupklsw (vector int);
14959 vector unsigned long long vec_vupklsw (vector int);
14960 @end smallexample
14961
14962 If the ISA 2.07 additions to the vector/scalar (power8-vector)
14963 instruction set is available, the following additional functions are
14964 available for 64-bit targets.  New vector types
14965 (@var{vector __int128_t} and @var{vector __uint128_t}) are available
14966 to hold the @var{__int128_t} and @var{__uint128_t} types to use these
14967 builtins.
14968
14969 The normal vector extract, and set operations work on
14970 @var{vector __int128_t} and @var{vector __uint128_t} types,
14971 but the index value must be 0.
14972
14973 @smallexample
14974 vector __int128_t vec_vaddcuq (vector __int128_t, vector __int128_t);
14975 vector __uint128_t vec_vaddcuq (vector __uint128_t, vector __uint128_t);
14976
14977 vector __int128_t vec_vadduqm (vector __int128_t, vector __int128_t);
14978 vector __uint128_t vec_vadduqm (vector __uint128_t, vector __uint128_t);
14979
14980 vector __int128_t vec_vaddecuq (vector __int128_t, vector __int128_t,
14981                                 vector __int128_t);
14982 vector __uint128_t vec_vaddecuq (vector __uint128_t, vector __uint128_t, 
14983                                  vector __uint128_t);
14984
14985 vector __int128_t vec_vaddeuqm (vector __int128_t, vector __int128_t,
14986                                 vector __int128_t);
14987 vector __uint128_t vec_vaddeuqm (vector __uint128_t, vector __uint128_t, 
14988                                  vector __uint128_t);
14989
14990 vector __int128_t vec_vsubecuq (vector __int128_t, vector __int128_t,
14991                                 vector __int128_t);
14992 vector __uint128_t vec_vsubecuq (vector __uint128_t, vector __uint128_t, 
14993                                  vector __uint128_t);
14994
14995 vector __int128_t vec_vsubeuqm (vector __int128_t, vector __int128_t,
14996                                 vector __int128_t);
14997 vector __uint128_t vec_vsubeuqm (vector __uint128_t, vector __uint128_t,
14998                                  vector __uint128_t);
14999
15000 vector __int128_t vec_vsubcuq (vector __int128_t, vector __int128_t);
15001 vector __uint128_t vec_vsubcuq (vector __uint128_t, vector __uint128_t);
15002
15003 __int128_t vec_vsubuqm (__int128_t, __int128_t);
15004 __uint128_t vec_vsubuqm (__uint128_t, __uint128_t);
15005
15006 vector __int128_t __builtin_bcdadd (vector __int128_t, vector__int128_t);
15007 int __builtin_bcdadd_lt (vector __int128_t, vector__int128_t);
15008 int __builtin_bcdadd_eq (vector __int128_t, vector__int128_t);
15009 int __builtin_bcdadd_gt (vector __int128_t, vector__int128_t);
15010 int __builtin_bcdadd_ov (vector __int128_t, vector__int128_t);
15011 vector __int128_t bcdsub (vector __int128_t, vector__int128_t);
15012 int __builtin_bcdsub_lt (vector __int128_t, vector__int128_t);
15013 int __builtin_bcdsub_eq (vector __int128_t, vector__int128_t);
15014 int __builtin_bcdsub_gt (vector __int128_t, vector__int128_t);
15015 int __builtin_bcdsub_ov (vector __int128_t, vector__int128_t);
15016 @end smallexample
15017
15018 If the cryptographic instructions are enabled (@option{-mcrypto} or
15019 @option{-mcpu=power8}), the following builtins are enabled.
15020
15021 @smallexample
15022 vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long);
15023
15024 vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long,
15025                                                     vector unsigned long long);
15026
15027 vector unsigned long long __builtin_crypto_vcipherlast
15028                                      (vector unsigned long long,
15029                                       vector unsigned long long);
15030
15031 vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long,
15032                                                      vector unsigned long long);
15033
15034 vector unsigned long long __builtin_crypto_vncipherlast
15035                                      (vector unsigned long long,
15036                                       vector unsigned long long);
15037
15038 vector unsigned char __builtin_crypto_vpermxor (vector unsigned char,
15039                                                 vector unsigned char,
15040                                                 vector unsigned char);
15041
15042 vector unsigned short __builtin_crypto_vpermxor (vector unsigned short,
15043                                                  vector unsigned short,
15044                                                  vector unsigned short);
15045
15046 vector unsigned int __builtin_crypto_vpermxor (vector unsigned int,
15047                                                vector unsigned int,
15048                                                vector unsigned int);
15049
15050 vector unsigned long long __builtin_crypto_vpermxor (vector unsigned long long,
15051                                                      vector unsigned long long,
15052                                                      vector unsigned long long);
15053
15054 vector unsigned char __builtin_crypto_vpmsumb (vector unsigned char,
15055                                                vector unsigned char);
15056
15057 vector unsigned short __builtin_crypto_vpmsumb (vector unsigned short,
15058                                                 vector unsigned short);
15059
15060 vector unsigned int __builtin_crypto_vpmsumb (vector unsigned int,
15061                                               vector unsigned int);
15062
15063 vector unsigned long long __builtin_crypto_vpmsumb (vector unsigned long long,
15064                                                     vector unsigned long long);
15065
15066 vector unsigned long long __builtin_crypto_vshasigmad
15067                                (vector unsigned long long, int, int);
15068
15069 vector unsigned int __builtin_crypto_vshasigmaw (vector unsigned int,
15070                                                  int, int);
15071 @end smallexample
15072
15073 The second argument to the @var{__builtin_crypto_vshasigmad} and
15074 @var{__builtin_crypto_vshasigmaw} builtin functions must be a constant
15075 integer that is 0 or 1.  The third argument to these builtin functions
15076 must be a constant integer in the range of 0 to 15.
15077
15078 @node PowerPC Hardware Transactional Memory Built-in Functions
15079 @subsection PowerPC Hardware Transactional Memory Built-in Functions
15080 GCC provides two interfaces for accessing the Hardware Transactional
15081 Memory (HTM) instructions available on some of the PowerPC family
15082 of prcoessors (eg, POWER8).  The two interfaces come in a low level
15083 interface, consisting of built-in functions specific to PowerPC and a
15084 higher level interface consisting of inline functions that are common
15085 between PowerPC and S/390.
15086
15087 @subsubsection PowerPC HTM Low Level Built-in Functions
15088
15089 The following low level built-in functions are available with
15090 @option{-mhtm} or @option{-mcpu=CPU} where CPU is `power8' or later.
15091 They all generate the machine instruction that is part of the name.
15092
15093 The HTM built-ins return true or false depending on their success and
15094 their arguments match exactly the type and order of the associated
15095 hardware instruction's operands.  Refer to the ISA manual for a
15096 description of each instruction's operands.
15097
15098 @smallexample
15099 unsigned int __builtin_tbegin (unsigned int)
15100 unsigned int __builtin_tend (unsigned int)
15101
15102 unsigned int __builtin_tabort (unsigned int)
15103 unsigned int __builtin_tabortdc (unsigned int, unsigned int, unsigned int)
15104 unsigned int __builtin_tabortdci (unsigned int, unsigned int, int)
15105 unsigned int __builtin_tabortwc (unsigned int, unsigned int, unsigned int)
15106 unsigned int __builtin_tabortwci (unsigned int, unsigned int, int)
15107
15108 unsigned int __builtin_tcheck (unsigned int)
15109 unsigned int __builtin_treclaim (unsigned int)
15110 unsigned int __builtin_trechkpt (void)
15111 unsigned int __builtin_tsr (unsigned int)
15112 @end smallexample
15113
15114 In addition to the above HTM built-ins, we have added built-ins for
15115 some common extended mnemonics of the HTM instructions:
15116
15117 @smallexample
15118 unsigned int __builtin_tendall (void)
15119 unsigned int __builtin_tresume (void)
15120 unsigned int __builtin_tsuspend (void)
15121 @end smallexample
15122
15123 The following set of built-in functions are available to gain access
15124 to the HTM specific special purpose registers.
15125
15126 @smallexample
15127 unsigned long __builtin_get_texasr (void)
15128 unsigned long __builtin_get_texasru (void)
15129 unsigned long __builtin_get_tfhar (void)
15130 unsigned long __builtin_get_tfiar (void)
15131
15132 void __builtin_set_texasr (unsigned long);
15133 void __builtin_set_texasru (unsigned long);
15134 void __builtin_set_tfhar (unsigned long);
15135 void __builtin_set_tfiar (unsigned long);
15136 @end smallexample
15137
15138 Example usage of these low level built-in functions may look like:
15139
15140 @smallexample
15141 #include <htmintrin.h>
15142
15143 int num_retries = 10;
15144
15145 while (1)
15146   @{
15147     if (__builtin_tbegin (0))
15148       @{
15149         /* Transaction State Initiated.  */
15150         if (is_locked (lock))
15151           __builtin_tabort (0);
15152         ... transaction code...
15153         __builtin_tend (0);
15154         break;
15155       @}
15156     else
15157       @{
15158         /* Transaction State Failed.  Use locks if the transaction
15159            failure is "persistent" or we've tried too many times.  */
15160         if (num_retries-- <= 0
15161             || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
15162           @{
15163             acquire_lock (lock);
15164             ... non transactional fallback path...
15165             release_lock (lock);
15166             break;
15167           @}
15168       @}
15169   @}
15170 @end smallexample
15171
15172 One final built-in function has been added that returns the value of
15173 the 2-bit Transaction State field of the Machine Status Register (MSR)
15174 as stored in @code{CR0}.
15175
15176 @smallexample
15177 unsigned long __builtin_ttest (void)
15178 @end smallexample
15179
15180 This built-in can be used to determine the current transaction state
15181 using the following code example:
15182
15183 @smallexample
15184 #include <htmintrin.h>
15185
15186 unsigned char tx_state = _HTM_STATE (__builtin_ttest ());
15187
15188 if (tx_state == _HTM_TRANSACTIONAL)
15189   @{
15190     /* Code to use in transactional state.  */
15191   @}
15192 else if (tx_state == _HTM_NONTRANSACTIONAL)
15193   @{
15194     /* Code to use in non-transactional state.  */
15195   @}
15196 else if (tx_state == _HTM_SUSPENDED)
15197   @{
15198     /* Code to use in transaction suspended state.  */
15199   @}
15200 @end smallexample
15201
15202 @subsubsection PowerPC HTM High Level Inline Functions
15203
15204 The following high level HTM interface is made available by including
15205 @code{<htmxlintrin.h>} and using @option{-mhtm} or @option{-mcpu=CPU}
15206 where CPU is `power8' or later.  This interface is common between PowerPC
15207 and S/390, allowing users to write one HTM source implementation that
15208 can be compiled and executed on either system.
15209
15210 @smallexample
15211 long __TM_simple_begin (void)
15212 long __TM_begin (void* const TM_buff)
15213 long __TM_end (void)
15214 void __TM_abort (void)
15215 void __TM_named_abort (unsigned char const code)
15216 void __TM_resume (void)
15217 void __TM_suspend (void)
15218
15219 long __TM_is_user_abort (void* const TM_buff)
15220 long __TM_is_named_user_abort (void* const TM_buff, unsigned char *code)
15221 long __TM_is_illegal (void* const TM_buff)
15222 long __TM_is_footprint_exceeded (void* const TM_buff)
15223 long __TM_nesting_depth (void* const TM_buff)
15224 long __TM_is_nested_too_deep(void* const TM_buff)
15225 long __TM_is_conflict(void* const TM_buff)
15226 long __TM_is_failure_persistent(void* const TM_buff)
15227 long __TM_failure_address(void* const TM_buff)
15228 long long __TM_failure_code(void* const TM_buff)
15229 @end smallexample
15230
15231 Using these common set of HTM inline functions, we can create
15232 a more portable version of the HTM example in the previous
15233 section that will work on either PowerPC or S/390:
15234
15235 @smallexample
15236 #include <htmxlintrin.h>
15237
15238 int num_retries = 10;
15239 TM_buff_type TM_buff;
15240
15241 while (1)
15242   @{
15243     if (__TM_begin (TM_buff))
15244       @{
15245         /* Transaction State Initiated.  */
15246         if (is_locked (lock))
15247           __TM_abort ();
15248         ... transaction code...
15249         __TM_end ();
15250         break;
15251       @}
15252     else
15253       @{
15254         /* Transaction State Failed.  Use locks if the transaction
15255            failure is "persistent" or we've tried too many times.  */
15256         if (num_retries-- <= 0
15257             || __TM_is_failure_persistent (TM_buff))
15258           @{
15259             acquire_lock (lock);
15260             ... non transactional fallback path...
15261             release_lock (lock);
15262             break;
15263           @}
15264       @}
15265   @}
15266 @end smallexample
15267
15268 @node RX Built-in Functions
15269 @subsection RX Built-in Functions
15270 GCC supports some of the RX instructions which cannot be expressed in
15271 the C programming language via the use of built-in functions.  The
15272 following functions are supported:
15273
15274 @deftypefn {Built-in Function}  void __builtin_rx_brk (void)
15275 Generates the @code{brk} machine instruction.
15276 @end deftypefn
15277
15278 @deftypefn {Built-in Function}  void __builtin_rx_clrpsw (int)
15279 Generates the @code{clrpsw} machine instruction to clear the specified
15280 bit in the processor status word.
15281 @end deftypefn
15282
15283 @deftypefn {Built-in Function}  void __builtin_rx_int (int)
15284 Generates the @code{int} machine instruction to generate an interrupt
15285 with the specified value.
15286 @end deftypefn
15287
15288 @deftypefn {Built-in Function}  void __builtin_rx_machi (int, int)
15289 Generates the @code{machi} machine instruction to add the result of
15290 multiplying the top 16 bits of the two arguments into the
15291 accumulator.
15292 @end deftypefn
15293
15294 @deftypefn {Built-in Function}  void __builtin_rx_maclo (int, int)
15295 Generates the @code{maclo} machine instruction to add the result of
15296 multiplying the bottom 16 bits of the two arguments into the
15297 accumulator.
15298 @end deftypefn
15299
15300 @deftypefn {Built-in Function}  void __builtin_rx_mulhi (int, int)
15301 Generates the @code{mulhi} machine instruction to place the result of
15302 multiplying the top 16 bits of the two arguments into the
15303 accumulator.
15304 @end deftypefn
15305
15306 @deftypefn {Built-in Function}  void __builtin_rx_mullo (int, int)
15307 Generates the @code{mullo} machine instruction to place the result of
15308 multiplying the bottom 16 bits of the two arguments into the
15309 accumulator.
15310 @end deftypefn
15311
15312 @deftypefn {Built-in Function}  int  __builtin_rx_mvfachi (void)
15313 Generates the @code{mvfachi} machine instruction to read the top
15314 32 bits of the accumulator.
15315 @end deftypefn
15316
15317 @deftypefn {Built-in Function}  int  __builtin_rx_mvfacmi (void)
15318 Generates the @code{mvfacmi} machine instruction to read the middle
15319 32 bits of the accumulator.
15320 @end deftypefn
15321
15322 @deftypefn {Built-in Function}  int __builtin_rx_mvfc (int)
15323 Generates the @code{mvfc} machine instruction which reads the control
15324 register specified in its argument and returns its value.
15325 @end deftypefn
15326
15327 @deftypefn {Built-in Function}  void __builtin_rx_mvtachi (int)
15328 Generates the @code{mvtachi} machine instruction to set the top
15329 32 bits of the accumulator.
15330 @end deftypefn
15331
15332 @deftypefn {Built-in Function}  void __builtin_rx_mvtaclo (int)
15333 Generates the @code{mvtaclo} machine instruction to set the bottom
15334 32 bits of the accumulator.
15335 @end deftypefn
15336
15337 @deftypefn {Built-in Function}  void __builtin_rx_mvtc (int reg, int val)
15338 Generates the @code{mvtc} machine instruction which sets control
15339 register number @code{reg} to @code{val}.
15340 @end deftypefn
15341
15342 @deftypefn {Built-in Function}  void __builtin_rx_mvtipl (int)
15343 Generates the @code{mvtipl} machine instruction set the interrupt
15344 priority level.
15345 @end deftypefn
15346
15347 @deftypefn {Built-in Function}  void __builtin_rx_racw (int)
15348 Generates the @code{racw} machine instruction to round the accumulator
15349 according to the specified mode.
15350 @end deftypefn
15351
15352 @deftypefn {Built-in Function}  int __builtin_rx_revw (int)
15353 Generates the @code{revw} machine instruction which swaps the bytes in
15354 the argument so that bits 0--7 now occupy bits 8--15 and vice versa,
15355 and also bits 16--23 occupy bits 24--31 and vice versa.
15356 @end deftypefn
15357
15358 @deftypefn {Built-in Function}  void __builtin_rx_rmpa (void)
15359 Generates the @code{rmpa} machine instruction which initiates a
15360 repeated multiply and accumulate sequence.
15361 @end deftypefn
15362
15363 @deftypefn {Built-in Function}  void __builtin_rx_round (float)
15364 Generates the @code{round} machine instruction which returns the
15365 floating-point argument rounded according to the current rounding mode
15366 set in the floating-point status word register.
15367 @end deftypefn
15368
15369 @deftypefn {Built-in Function}  int __builtin_rx_sat (int)
15370 Generates the @code{sat} machine instruction which returns the
15371 saturated value of the argument.
15372 @end deftypefn
15373
15374 @deftypefn {Built-in Function}  void __builtin_rx_setpsw (int)
15375 Generates the @code{setpsw} machine instruction to set the specified
15376 bit in the processor status word.
15377 @end deftypefn
15378
15379 @deftypefn {Built-in Function}  void __builtin_rx_wait (void)
15380 Generates the @code{wait} machine instruction.
15381 @end deftypefn
15382
15383 @node S/390 System z Built-in Functions
15384 @subsection S/390 System z Built-in Functions
15385 @deftypefn {Built-in Function} int __builtin_tbegin (void*)
15386 Generates the @code{tbegin} machine instruction starting a
15387 non-constraint hardware transaction.  If the parameter is non-NULL the
15388 memory area is used to store the transaction diagnostic buffer and
15389 will be passed as first operand to @code{tbegin}.  This buffer can be
15390 defined using the @code{struct __htm_tdb} C struct defined in
15391 @code{htmintrin.h} and must reside on a double-word boundary.  The
15392 second tbegin operand is set to @code{0xff0c}. This enables
15393 save/restore of all GPRs and disables aborts for FPR and AR
15394 manipulations inside the transaction body.  The condition code set by
15395 the tbegin instruction is returned as integer value.  The tbegin
15396 instruction by definition overwrites the content of all FPRs.  The
15397 compiler will generate code which saves and restores the FPRs.  For
15398 soft-float code it is recommended to used the @code{*_nofloat}
15399 variant.  In order to prevent a TDB from being written it is required
15400 to pass an constant zero value as parameter.  Passing the zero value
15401 through a variable is not sufficient.  Although modifications of
15402 access registers inside the transaction will not trigger an
15403 transaction abort it is not supported to actually modify them.  Access
15404 registers do not get saved when entering a transaction. They will have
15405 undefined state when reaching the abort code.
15406 @end deftypefn
15407
15408 Macros for the possible return codes of tbegin are defined in the
15409 @code{htmintrin.h} header file:
15410
15411 @table @code
15412 @item _HTM_TBEGIN_STARTED
15413 @code{tbegin} has been executed as part of normal processing.  The
15414 transaction body is supposed to be executed.
15415 @item _HTM_TBEGIN_INDETERMINATE
15416 The transaction was aborted due to an indeterminate condition which
15417 might be persistent.
15418 @item _HTM_TBEGIN_TRANSIENT
15419 The transaction aborted due to a transient failure.  The transaction
15420 should be re-executed in that case.
15421 @item _HTM_TBEGIN_PERSISTENT
15422 The transaction aborted due to a persistent failure.  Re-execution
15423 under same circumstances will not be productive.
15424 @end table
15425
15426 @defmac _HTM_FIRST_USER_ABORT_CODE
15427 The @code{_HTM_FIRST_USER_ABORT_CODE} defined in @code{htmintrin.h}
15428 specifies the first abort code which can be used for
15429 @code{__builtin_tabort}.  Values below this threshold are reserved for
15430 machine use.
15431 @end defmac
15432
15433 @deftp {Data type} {struct __htm_tdb}
15434 The @code{struct __htm_tdb} defined in @code{htmintrin.h} describes
15435 the structure of the transaction diagnostic block as specified in the
15436 Principles of Operation manual chapter 5-91.
15437 @end deftp
15438
15439 @deftypefn {Built-in Function} int __builtin_tbegin_nofloat (void*)
15440 Same as @code{__builtin_tbegin} but without FPR saves and restores.
15441 Using this variant in code making use of FPRs will leave the FPRs in
15442 undefined state when entering the transaction abort handler code.
15443 @end deftypefn
15444
15445 @deftypefn {Built-in Function} int __builtin_tbegin_retry (void*, int)
15446 In addition to @code{__builtin_tbegin} a loop for transient failures
15447 is generated.  If tbegin returns a condition code of 2 the transaction
15448 will be retried as often as specified in the second argument.  The
15449 perform processor assist instruction is used to tell the CPU about the
15450 number of fails so far.
15451 @end deftypefn
15452
15453 @deftypefn {Built-in Function} int __builtin_tbegin_retry_nofloat (void*, int)
15454 Same as @code{__builtin_tbegin_retry} but without FPR saves and
15455 restores.  Using this variant in code making use of FPRs will leave
15456 the FPRs in undefined state when entering the transaction abort
15457 handler code.
15458 @end deftypefn
15459
15460 @deftypefn {Built-in Function} void __builtin_tbeginc (void)
15461 Generates the @code{tbeginc} machine instruction starting a constraint
15462 hardware transaction.  The second operand is set to @code{0xff08}.
15463 @end deftypefn
15464
15465 @deftypefn {Built-in Function} int __builtin_tend (void)
15466 Generates the @code{tend} machine instruction finishing a transaction
15467 and making the changes visible to other threads.  The condition code
15468 generated by tend is returned as integer value.
15469 @end deftypefn
15470
15471 @deftypefn {Built-in Function} void __builtin_tabort (int)
15472 Generates the @code{tabort} machine instruction with the specified
15473 abort code.  Abort codes from 0 through 255 are reserved and will
15474 result in an error message.
15475 @end deftypefn
15476
15477 @deftypefn {Built-in Function} void __builtin_tx_assist (int)
15478 Generates the @code{ppa rX,rY,1} machine instruction.  Where the
15479 integer parameter is loaded into rX and a value of zero is loaded into
15480 rY.  The integer parameter specifies the number of times the
15481 transaction repeatedly aborted.
15482 @end deftypefn
15483
15484 @deftypefn {Built-in Function} int __builtin_tx_nesting_depth (void)
15485 Generates the @code{etnd} machine instruction.  The current nesting
15486 depth is returned as integer value.  For a nesting depth of 0 the code
15487 is not executed as part of an transaction.
15488 @end deftypefn
15489
15490 @deftypefn {Built-in Function} void __builtin_non_tx_store (uint64_t *, uint64_t)
15491
15492 Generates the @code{ntstg} machine instruction.  The second argument
15493 is written to the first arguments location.  The store operation will
15494 not be rolled-back in case of an transaction abort.
15495 @end deftypefn
15496
15497 @node SH Built-in Functions
15498 @subsection SH Built-in Functions
15499 The following built-in functions are supported on the SH1, SH2, SH3 and SH4
15500 families of processors:
15501
15502 @deftypefn {Built-in Function} {void} __builtin_set_thread_pointer (void *@var{ptr})
15503 Sets the @samp{GBR} register to the specified value @var{ptr}.  This is usually
15504 used by system code that manages threads and execution contexts.  The compiler
15505 normally does not generate code that modifies the contents of @samp{GBR} and
15506 thus the value is preserved across function calls.  Changing the @samp{GBR}
15507 value in user code must be done with caution, since the compiler might use
15508 @samp{GBR} in order to access thread local variables.
15509
15510 @end deftypefn
15511
15512 @deftypefn {Built-in Function} {void *} __builtin_thread_pointer (void)
15513 Returns the value that is currently set in the @samp{GBR} register.
15514 Memory loads and stores that use the thread pointer as a base address are
15515 turned into @samp{GBR} based displacement loads and stores, if possible.
15516 For example:
15517 @smallexample
15518 struct my_tcb
15519 @{
15520    int a, b, c, d, e;
15521 @};
15522
15523 int get_tcb_value (void)
15524 @{
15525   // Generate @samp{mov.l @@(8,gbr),r0} instruction
15526   return ((my_tcb*)__builtin_thread_pointer ())->c;
15527 @}
15528
15529 @end smallexample
15530 @end deftypefn
15531
15532 @deftypefn {Built-in Function} {unsigned int} __builtin_sh_get_fpscr (void)
15533 Returns the value that is currently set in the @samp{FPSCR} register.
15534 @end deftypefn
15535
15536 @deftypefn {Built-in Function} {void} __builtin_sh_set_fpscr (unsigned int @var{val})
15537 Sets the @samp{FPSCR} register to the specified value @var{val}, while
15538 preserving the current values of the FR, SZ and PR bits.
15539 @end deftypefn
15540
15541 @node SPARC VIS Built-in Functions
15542 @subsection SPARC VIS Built-in Functions
15543
15544 GCC supports SIMD operations on the SPARC using both the generic vector
15545 extensions (@pxref{Vector Extensions}) as well as built-in functions for
15546 the SPARC Visual Instruction Set (VIS).  When you use the @option{-mvis}
15547 switch, the VIS extension is exposed as the following built-in functions:
15548
15549 @smallexample
15550 typedef int v1si __attribute__ ((vector_size (4)));
15551 typedef int v2si __attribute__ ((vector_size (8)));
15552 typedef short v4hi __attribute__ ((vector_size (8)));
15553 typedef short v2hi __attribute__ ((vector_size (4)));
15554 typedef unsigned char v8qi __attribute__ ((vector_size (8)));
15555 typedef unsigned char v4qi __attribute__ ((vector_size (4)));
15556
15557 void __builtin_vis_write_gsr (int64_t);
15558 int64_t __builtin_vis_read_gsr (void);
15559
15560 void * __builtin_vis_alignaddr (void *, long);
15561 void * __builtin_vis_alignaddrl (void *, long);
15562 int64_t __builtin_vis_faligndatadi (int64_t, int64_t);
15563 v2si __builtin_vis_faligndatav2si (v2si, v2si);
15564 v4hi __builtin_vis_faligndatav4hi (v4si, v4si);
15565 v8qi __builtin_vis_faligndatav8qi (v8qi, v8qi);
15566
15567 v4hi __builtin_vis_fexpand (v4qi);
15568
15569 v4hi __builtin_vis_fmul8x16 (v4qi, v4hi);
15570 v4hi __builtin_vis_fmul8x16au (v4qi, v2hi);
15571 v4hi __builtin_vis_fmul8x16al (v4qi, v2hi);
15572 v4hi __builtin_vis_fmul8sux16 (v8qi, v4hi);
15573 v4hi __builtin_vis_fmul8ulx16 (v8qi, v4hi);
15574 v2si __builtin_vis_fmuld8sux16 (v4qi, v2hi);
15575 v2si __builtin_vis_fmuld8ulx16 (v4qi, v2hi);
15576
15577 v4qi __builtin_vis_fpack16 (v4hi);
15578 v8qi __builtin_vis_fpack32 (v2si, v8qi);
15579 v2hi __builtin_vis_fpackfix (v2si);
15580 v8qi __builtin_vis_fpmerge (v4qi, v4qi);
15581
15582 int64_t __builtin_vis_pdist (v8qi, v8qi, int64_t);
15583
15584 long __builtin_vis_edge8 (void *, void *);
15585 long __builtin_vis_edge8l (void *, void *);
15586 long __builtin_vis_edge16 (void *, void *);
15587 long __builtin_vis_edge16l (void *, void *);
15588 long __builtin_vis_edge32 (void *, void *);
15589 long __builtin_vis_edge32l (void *, void *);
15590
15591 long __builtin_vis_fcmple16 (v4hi, v4hi);
15592 long __builtin_vis_fcmple32 (v2si, v2si);
15593 long __builtin_vis_fcmpne16 (v4hi, v4hi);
15594 long __builtin_vis_fcmpne32 (v2si, v2si);
15595 long __builtin_vis_fcmpgt16 (v4hi, v4hi);
15596 long __builtin_vis_fcmpgt32 (v2si, v2si);
15597 long __builtin_vis_fcmpeq16 (v4hi, v4hi);
15598 long __builtin_vis_fcmpeq32 (v2si, v2si);
15599
15600 v4hi __builtin_vis_fpadd16 (v4hi, v4hi);
15601 v2hi __builtin_vis_fpadd16s (v2hi, v2hi);
15602 v2si __builtin_vis_fpadd32 (v2si, v2si);
15603 v1si __builtin_vis_fpadd32s (v1si, v1si);
15604 v4hi __builtin_vis_fpsub16 (v4hi, v4hi);
15605 v2hi __builtin_vis_fpsub16s (v2hi, v2hi);
15606 v2si __builtin_vis_fpsub32 (v2si, v2si);
15607 v1si __builtin_vis_fpsub32s (v1si, v1si);
15608
15609 long __builtin_vis_array8 (long, long);
15610 long __builtin_vis_array16 (long, long);
15611 long __builtin_vis_array32 (long, long);
15612 @end smallexample
15613
15614 When you use the @option{-mvis2} switch, the VIS version 2.0 built-in
15615 functions also become available:
15616
15617 @smallexample
15618 long __builtin_vis_bmask (long, long);
15619 int64_t __builtin_vis_bshuffledi (int64_t, int64_t);
15620 v2si __builtin_vis_bshufflev2si (v2si, v2si);
15621 v4hi __builtin_vis_bshufflev2si (v4hi, v4hi);
15622 v8qi __builtin_vis_bshufflev2si (v8qi, v8qi);
15623
15624 long __builtin_vis_edge8n (void *, void *);
15625 long __builtin_vis_edge8ln (void *, void *);
15626 long __builtin_vis_edge16n (void *, void *);
15627 long __builtin_vis_edge16ln (void *, void *);
15628 long __builtin_vis_edge32n (void *, void *);
15629 long __builtin_vis_edge32ln (void *, void *);
15630 @end smallexample
15631
15632 When you use the @option{-mvis3} switch, the VIS version 3.0 built-in
15633 functions also become available:
15634
15635 @smallexample
15636 void __builtin_vis_cmask8 (long);
15637 void __builtin_vis_cmask16 (long);
15638 void __builtin_vis_cmask32 (long);
15639
15640 v4hi __builtin_vis_fchksm16 (v4hi, v4hi);
15641
15642 v4hi __builtin_vis_fsll16 (v4hi, v4hi);
15643 v4hi __builtin_vis_fslas16 (v4hi, v4hi);
15644 v4hi __builtin_vis_fsrl16 (v4hi, v4hi);
15645 v4hi __builtin_vis_fsra16 (v4hi, v4hi);
15646 v2si __builtin_vis_fsll16 (v2si, v2si);
15647 v2si __builtin_vis_fslas16 (v2si, v2si);
15648 v2si __builtin_vis_fsrl16 (v2si, v2si);
15649 v2si __builtin_vis_fsra16 (v2si, v2si);
15650
15651 long __builtin_vis_pdistn (v8qi, v8qi);
15652
15653 v4hi __builtin_vis_fmean16 (v4hi, v4hi);
15654
15655 int64_t __builtin_vis_fpadd64 (int64_t, int64_t);
15656 int64_t __builtin_vis_fpsub64 (int64_t, int64_t);
15657
15658 v4hi __builtin_vis_fpadds16 (v4hi, v4hi);
15659 v2hi __builtin_vis_fpadds16s (v2hi, v2hi);
15660 v4hi __builtin_vis_fpsubs16 (v4hi, v4hi);
15661 v2hi __builtin_vis_fpsubs16s (v2hi, v2hi);
15662 v2si __builtin_vis_fpadds32 (v2si, v2si);
15663 v1si __builtin_vis_fpadds32s (v1si, v1si);
15664 v2si __builtin_vis_fpsubs32 (v2si, v2si);
15665 v1si __builtin_vis_fpsubs32s (v1si, v1si);
15666
15667 long __builtin_vis_fucmple8 (v8qi, v8qi);
15668 long __builtin_vis_fucmpne8 (v8qi, v8qi);
15669 long __builtin_vis_fucmpgt8 (v8qi, v8qi);
15670 long __builtin_vis_fucmpeq8 (v8qi, v8qi);
15671
15672 float __builtin_vis_fhadds (float, float);
15673 double __builtin_vis_fhaddd (double, double);
15674 float __builtin_vis_fhsubs (float, float);
15675 double __builtin_vis_fhsubd (double, double);
15676 float __builtin_vis_fnhadds (float, float);
15677 double __builtin_vis_fnhaddd (double, double);
15678
15679 int64_t __builtin_vis_umulxhi (int64_t, int64_t);
15680 int64_t __builtin_vis_xmulx (int64_t, int64_t);
15681 int64_t __builtin_vis_xmulxhi (int64_t, int64_t);
15682 @end smallexample
15683
15684 @node SPU Built-in Functions
15685 @subsection SPU Built-in Functions
15686
15687 GCC provides extensions for the SPU processor as described in the
15688 Sony/Toshiba/IBM SPU Language Extensions Specification, which can be
15689 found at @uref{http://cell.scei.co.jp/} or
15690 @uref{http://www.ibm.com/developerworks/power/cell/}.  GCC's
15691 implementation differs in several ways.
15692
15693 @itemize @bullet
15694
15695 @item
15696 The optional extension of specifying vector constants in parentheses is
15697 not supported.
15698
15699 @item
15700 A vector initializer requires no cast if the vector constant is of the
15701 same type as the variable it is initializing.
15702
15703 @item
15704 If @code{signed} or @code{unsigned} is omitted, the signedness of the
15705 vector type is the default signedness of the base type.  The default
15706 varies depending on the operating system, so a portable program should
15707 always specify the signedness.
15708
15709 @item
15710 By default, the keyword @code{__vector} is added. The macro
15711 @code{vector} is defined in @code{<spu_intrinsics.h>} and can be
15712 undefined.
15713
15714 @item
15715 GCC allows using a @code{typedef} name as the type specifier for a
15716 vector type.
15717
15718 @item
15719 For C, overloaded functions are implemented with macros so the following
15720 does not work:
15721
15722 @smallexample
15723   spu_add ((vector signed int)@{1, 2, 3, 4@}, foo);
15724 @end smallexample
15725
15726 @noindent
15727 Since @code{spu_add} is a macro, the vector constant in the example
15728 is treated as four separate arguments.  Wrap the entire argument in
15729 parentheses for this to work.
15730
15731 @item
15732 The extended version of @code{__builtin_expect} is not supported.
15733
15734 @end itemize
15735
15736 @emph{Note:} Only the interface described in the aforementioned
15737 specification is supported. Internally, GCC uses built-in functions to
15738 implement the required functionality, but these are not supported and
15739 are subject to change without notice.
15740
15741 @node TI C6X Built-in Functions
15742 @subsection TI C6X Built-in Functions
15743
15744 GCC provides intrinsics to access certain instructions of the TI C6X
15745 processors.  These intrinsics, listed below, are available after
15746 inclusion of the @code{c6x_intrinsics.h} header file.  They map directly
15747 to C6X instructions.
15748
15749 @smallexample
15750
15751 int _sadd (int, int)
15752 int _ssub (int, int)
15753 int _sadd2 (int, int)
15754 int _ssub2 (int, int)
15755 long long _mpy2 (int, int)
15756 long long _smpy2 (int, int)
15757 int _add4 (int, int)
15758 int _sub4 (int, int)
15759 int _saddu4 (int, int)
15760
15761 int _smpy (int, int)
15762 int _smpyh (int, int)
15763 int _smpyhl (int, int)
15764 int _smpylh (int, int)
15765
15766 int _sshl (int, int)
15767 int _subc (int, int)
15768
15769 int _avg2 (int, int)
15770 int _avgu4 (int, int)
15771
15772 int _clrr (int, int)
15773 int _extr (int, int)
15774 int _extru (int, int)
15775 int _abs (int)
15776 int _abs2 (int)
15777
15778 @end smallexample
15779
15780 @node TILE-Gx Built-in Functions
15781 @subsection TILE-Gx Built-in Functions
15782
15783 GCC provides intrinsics to access every instruction of the TILE-Gx
15784 processor.  The intrinsics are of the form:
15785
15786 @smallexample
15787
15788 unsigned long long __insn_@var{op} (...)
15789
15790 @end smallexample
15791
15792 Where @var{op} is the name of the instruction.  Refer to the ISA manual
15793 for the complete list of instructions.
15794
15795 GCC also provides intrinsics to directly access the network registers.
15796 The intrinsics are:
15797
15798 @smallexample
15799
15800 unsigned long long __tile_idn0_receive (void)
15801 unsigned long long __tile_idn1_receive (void)
15802 unsigned long long __tile_udn0_receive (void)
15803 unsigned long long __tile_udn1_receive (void)
15804 unsigned long long __tile_udn2_receive (void)
15805 unsigned long long __tile_udn3_receive (void)
15806 void __tile_idn_send (unsigned long long)
15807 void __tile_udn_send (unsigned long long)
15808
15809 @end smallexample
15810
15811 The intrinsic @code{void __tile_network_barrier (void)} is used to
15812 guarantee that no network operations before it are reordered with
15813 those after it.
15814
15815 @node TILEPro Built-in Functions
15816 @subsection TILEPro Built-in Functions
15817
15818 GCC provides intrinsics to access every instruction of the TILEPro
15819 processor.  The intrinsics are of the form:
15820
15821 @smallexample
15822
15823 unsigned __insn_@var{op} (...)
15824
15825 @end smallexample
15826
15827 @noindent
15828 where @var{op} is the name of the instruction.  Refer to the ISA manual
15829 for the complete list of instructions.
15830
15831 GCC also provides intrinsics to directly access the network registers.
15832 The intrinsics are:
15833
15834 @smallexample
15835
15836 unsigned __tile_idn0_receive (void)
15837 unsigned __tile_idn1_receive (void)
15838 unsigned __tile_sn_receive (void)
15839 unsigned __tile_udn0_receive (void)
15840 unsigned __tile_udn1_receive (void)
15841 unsigned __tile_udn2_receive (void)
15842 unsigned __tile_udn3_receive (void)
15843 void __tile_idn_send (unsigned)
15844 void __tile_sn_send (unsigned)
15845 void __tile_udn_send (unsigned)
15846
15847 @end smallexample
15848
15849 The intrinsic @code{void __tile_network_barrier (void)} is used to
15850 guarantee that no network operations before it are reordered with
15851 those after it.
15852
15853 @node x86 Built-in Functions
15854 @subsection x86 Built-in Functions
15855
15856 These built-in functions are available for the x86-32 and x86-64 family
15857 of computers, depending on the command-line switches used.
15858
15859 If you specify command-line switches such as @option{-msse},
15860 the compiler could use the extended instruction sets even if the built-ins
15861 are not used explicitly in the program.  For this reason, applications
15862 that perform run-time CPU detection must compile separate files for each
15863 supported architecture, using the appropriate flags.  In particular,
15864 the file containing the CPU detection code should be compiled without
15865 these options.
15866
15867 The following machine modes are available for use with MMX built-in functions
15868 (@pxref{Vector Extensions}): @code{V2SI} for a vector of two 32-bit integers,
15869 @code{V4HI} for a vector of four 16-bit integers, and @code{V8QI} for a
15870 vector of eight 8-bit integers.  Some of the built-in functions operate on
15871 MMX registers as a whole 64-bit entity, these use @code{V1DI} as their mode.
15872
15873 If 3DNow!@: extensions are enabled, @code{V2SF} is used as a mode for a vector
15874 of two 32-bit floating-point values.
15875
15876 If SSE extensions are enabled, @code{V4SF} is used for a vector of four 32-bit
15877 floating-point values.  Some instructions use a vector of four 32-bit
15878 integers, these use @code{V4SI}.  Finally, some instructions operate on an
15879 entire vector register, interpreting it as a 128-bit integer, these use mode
15880 @code{TI}.
15881
15882 In 64-bit mode, the x86-64 family of processors uses additional built-in
15883 functions for efficient use of @code{TF} (@code{__float128}) 128-bit
15884 floating point and @code{TC} 128-bit complex floating-point values.
15885
15886 The following floating-point built-in functions are available in 64-bit
15887 mode.  All of them implement the function that is part of the name.
15888
15889 @smallexample
15890 __float128 __builtin_fabsq (__float128)
15891 __float128 __builtin_copysignq (__float128, __float128)
15892 @end smallexample
15893
15894 The following built-in function is always available.
15895
15896 @table @code
15897 @item void __builtin_ia32_pause (void)
15898 Generates the @code{pause} machine instruction with a compiler memory
15899 barrier.
15900 @end table
15901
15902 The following floating-point built-in functions are made available in the
15903 64-bit mode.
15904
15905 @table @code
15906 @item __float128 __builtin_infq (void)
15907 Similar to @code{__builtin_inf}, except the return type is @code{__float128}.
15908 @findex __builtin_infq
15909
15910 @item __float128 __builtin_huge_valq (void)
15911 Similar to @code{__builtin_huge_val}, except the return type is @code{__float128}.
15912 @findex __builtin_huge_valq
15913 @end table
15914
15915 The following built-in functions are always available and can be used to
15916 check the target platform type.
15917
15918 @deftypefn {Built-in Function} void __builtin_cpu_init (void)
15919 This function runs the CPU detection code to check the type of CPU and the
15920 features supported.  This built-in function needs to be invoked along with the built-in functions
15921 to check CPU type and features, @code{__builtin_cpu_is} and
15922 @code{__builtin_cpu_supports}, only when used in a function that is
15923 executed before any constructors are called.  The CPU detection code is
15924 automatically executed in a very high priority constructor.
15925
15926 For example, this function has to be used in @code{ifunc} resolvers that
15927 check for CPU type using the built-in functions @code{__builtin_cpu_is}
15928 and @code{__builtin_cpu_supports}, or in constructors on targets that
15929 don't support constructor priority.
15930 @smallexample
15931
15932 static void (*resolve_memcpy (void)) (void)
15933 @{
15934   // ifunc resolvers fire before constructors, explicitly call the init
15935   // function.
15936   __builtin_cpu_init ();
15937   if (__builtin_cpu_supports ("ssse3"))
15938     return ssse3_memcpy; // super fast memcpy with ssse3 instructions.
15939   else
15940     return default_memcpy;
15941 @}
15942
15943 void *memcpy (void *, const void *, size_t)
15944      __attribute__ ((ifunc ("resolve_memcpy")));
15945 @end smallexample
15946
15947 @end deftypefn
15948
15949 @deftypefn {Built-in Function} int __builtin_cpu_is (const char *@var{cpuname})
15950 This function returns a positive integer if the run-time CPU
15951 is of type @var{cpuname}
15952 and returns @code{0} otherwise. The following CPU names can be detected:
15953
15954 @table @samp
15955 @item intel
15956 Intel CPU.
15957
15958 @item atom
15959 Intel Atom CPU.
15960
15961 @item core2
15962 Intel Core 2 CPU.
15963
15964 @item corei7
15965 Intel Core i7 CPU.
15966
15967 @item nehalem
15968 Intel Core i7 Nehalem CPU.
15969
15970 @item westmere
15971 Intel Core i7 Westmere CPU.
15972
15973 @item sandybridge
15974 Intel Core i7 Sandy Bridge CPU.
15975
15976 @item amd
15977 AMD CPU.
15978
15979 @item amdfam10h
15980 AMD Family 10h CPU.
15981
15982 @item barcelona
15983 AMD Family 10h Barcelona CPU.
15984
15985 @item shanghai
15986 AMD Family 10h Shanghai CPU.
15987
15988 @item istanbul
15989 AMD Family 10h Istanbul CPU.
15990
15991 @item btver1
15992 AMD Family 14h CPU.
15993
15994 @item amdfam15h
15995 AMD Family 15h CPU.
15996
15997 @item bdver1
15998 AMD Family 15h Bulldozer version 1.
15999
16000 @item bdver2
16001 AMD Family 15h Bulldozer version 2.
16002
16003 @item bdver3
16004 AMD Family 15h Bulldozer version 3.
16005
16006 @item bdver4
16007 AMD Family 15h Bulldozer version 4.
16008
16009 @item btver2
16010 AMD Family 16h CPU.
16011 @end table
16012
16013 Here is an example:
16014 @smallexample
16015 if (__builtin_cpu_is ("corei7"))
16016   @{
16017      do_corei7 (); // Core i7 specific implementation.
16018   @}
16019 else
16020   @{
16021      do_generic (); // Generic implementation.
16022   @}
16023 @end smallexample
16024 @end deftypefn
16025
16026 @deftypefn {Built-in Function} int __builtin_cpu_supports (const char *@var{feature})
16027 This function returns a positive integer if the run-time CPU
16028 supports @var{feature}
16029 and returns @code{0} otherwise. The following features can be detected:
16030
16031 @table @samp
16032 @item cmov
16033 CMOV instruction.
16034 @item mmx
16035 MMX instructions.
16036 @item popcnt
16037 POPCNT instruction.
16038 @item sse
16039 SSE instructions.
16040 @item sse2
16041 SSE2 instructions.
16042 @item sse3
16043 SSE3 instructions.
16044 @item ssse3
16045 SSSE3 instructions.
16046 @item sse4.1
16047 SSE4.1 instructions.
16048 @item sse4.2
16049 SSE4.2 instructions.
16050 @item avx
16051 AVX instructions.
16052 @item avx2
16053 AVX2 instructions.
16054 @item avx512f
16055 AVX512F instructions.
16056 @end table
16057
16058 Here is an example:
16059 @smallexample
16060 if (__builtin_cpu_supports ("popcnt"))
16061   @{
16062      asm("popcnt %1,%0" : "=r"(count) : "rm"(n) : "cc");
16063   @}
16064 else
16065   @{
16066      count = generic_countbits (n); //generic implementation.
16067   @}
16068 @end smallexample
16069 @end deftypefn
16070
16071
16072 The following built-in functions are made available by @option{-mmmx}.
16073 All of them generate the machine instruction that is part of the name.
16074
16075 @smallexample
16076 v8qi __builtin_ia32_paddb (v8qi, v8qi)
16077 v4hi __builtin_ia32_paddw (v4hi, v4hi)
16078 v2si __builtin_ia32_paddd (v2si, v2si)
16079 v8qi __builtin_ia32_psubb (v8qi, v8qi)
16080 v4hi __builtin_ia32_psubw (v4hi, v4hi)
16081 v2si __builtin_ia32_psubd (v2si, v2si)
16082 v8qi __builtin_ia32_paddsb (v8qi, v8qi)
16083 v4hi __builtin_ia32_paddsw (v4hi, v4hi)
16084 v8qi __builtin_ia32_psubsb (v8qi, v8qi)
16085 v4hi __builtin_ia32_psubsw (v4hi, v4hi)
16086 v8qi __builtin_ia32_paddusb (v8qi, v8qi)
16087 v4hi __builtin_ia32_paddusw (v4hi, v4hi)
16088 v8qi __builtin_ia32_psubusb (v8qi, v8qi)
16089 v4hi __builtin_ia32_psubusw (v4hi, v4hi)
16090 v4hi __builtin_ia32_pmullw (v4hi, v4hi)
16091 v4hi __builtin_ia32_pmulhw (v4hi, v4hi)
16092 di __builtin_ia32_pand (di, di)
16093 di __builtin_ia32_pandn (di,di)
16094 di __builtin_ia32_por (di, di)
16095 di __builtin_ia32_pxor (di, di)
16096 v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi)
16097 v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi)
16098 v2si __builtin_ia32_pcmpeqd (v2si, v2si)
16099 v8qi __builtin_ia32_pcmpgtb (v8qi, v8qi)
16100 v4hi __builtin_ia32_pcmpgtw (v4hi, v4hi)
16101 v2si __builtin_ia32_pcmpgtd (v2si, v2si)
16102 v8qi __builtin_ia32_punpckhbw (v8qi, v8qi)
16103 v4hi __builtin_ia32_punpckhwd (v4hi, v4hi)
16104 v2si __builtin_ia32_punpckhdq (v2si, v2si)
16105 v8qi __builtin_ia32_punpcklbw (v8qi, v8qi)
16106 v4hi __builtin_ia32_punpcklwd (v4hi, v4hi)
16107 v2si __builtin_ia32_punpckldq (v2si, v2si)
16108 v8qi __builtin_ia32_packsswb (v4hi, v4hi)
16109 v4hi __builtin_ia32_packssdw (v2si, v2si)
16110 v8qi __builtin_ia32_packuswb (v4hi, v4hi)
16111
16112 v4hi __builtin_ia32_psllw (v4hi, v4hi)
16113 v2si __builtin_ia32_pslld (v2si, v2si)
16114 v1di __builtin_ia32_psllq (v1di, v1di)
16115 v4hi __builtin_ia32_psrlw (v4hi, v4hi)
16116 v2si __builtin_ia32_psrld (v2si, v2si)
16117 v1di __builtin_ia32_psrlq (v1di, v1di)
16118 v4hi __builtin_ia32_psraw (v4hi, v4hi)
16119 v2si __builtin_ia32_psrad (v2si, v2si)
16120 v4hi __builtin_ia32_psllwi (v4hi, int)
16121 v2si __builtin_ia32_pslldi (v2si, int)
16122 v1di __builtin_ia32_psllqi (v1di, int)
16123 v4hi __builtin_ia32_psrlwi (v4hi, int)
16124 v2si __builtin_ia32_psrldi (v2si, int)
16125 v1di __builtin_ia32_psrlqi (v1di, int)
16126 v4hi __builtin_ia32_psrawi (v4hi, int)
16127 v2si __builtin_ia32_psradi (v2si, int)
16128
16129 @end smallexample
16130
16131 The following built-in functions are made available either with
16132 @option{-msse}, or with a combination of @option{-m3dnow} and
16133 @option{-march=athlon}.  All of them generate the machine
16134 instruction that is part of the name.
16135
16136 @smallexample
16137 v4hi __builtin_ia32_pmulhuw (v4hi, v4hi)
16138 v8qi __builtin_ia32_pavgb (v8qi, v8qi)
16139 v4hi __builtin_ia32_pavgw (v4hi, v4hi)
16140 v1di __builtin_ia32_psadbw (v8qi, v8qi)
16141 v8qi __builtin_ia32_pmaxub (v8qi, v8qi)
16142 v4hi __builtin_ia32_pmaxsw (v4hi, v4hi)
16143 v8qi __builtin_ia32_pminub (v8qi, v8qi)
16144 v4hi __builtin_ia32_pminsw (v4hi, v4hi)
16145 int __builtin_ia32_pmovmskb (v8qi)
16146 void __builtin_ia32_maskmovq (v8qi, v8qi, char *)
16147 void __builtin_ia32_movntq (di *, di)
16148 void __builtin_ia32_sfence (void)
16149 @end smallexample
16150
16151 The following built-in functions are available when @option{-msse} is used.
16152 All of them generate the machine instruction that is part of the name.
16153
16154 @smallexample
16155 int __builtin_ia32_comieq (v4sf, v4sf)
16156 int __builtin_ia32_comineq (v4sf, v4sf)
16157 int __builtin_ia32_comilt (v4sf, v4sf)
16158 int __builtin_ia32_comile (v4sf, v4sf)
16159 int __builtin_ia32_comigt (v4sf, v4sf)
16160 int __builtin_ia32_comige (v4sf, v4sf)
16161 int __builtin_ia32_ucomieq (v4sf, v4sf)
16162 int __builtin_ia32_ucomineq (v4sf, v4sf)
16163 int __builtin_ia32_ucomilt (v4sf, v4sf)
16164 int __builtin_ia32_ucomile (v4sf, v4sf)
16165 int __builtin_ia32_ucomigt (v4sf, v4sf)
16166 int __builtin_ia32_ucomige (v4sf, v4sf)
16167 v4sf __builtin_ia32_addps (v4sf, v4sf)
16168 v4sf __builtin_ia32_subps (v4sf, v4sf)
16169 v4sf __builtin_ia32_mulps (v4sf, v4sf)
16170 v4sf __builtin_ia32_divps (v4sf, v4sf)
16171 v4sf __builtin_ia32_addss (v4sf, v4sf)
16172 v4sf __builtin_ia32_subss (v4sf, v4sf)
16173 v4sf __builtin_ia32_mulss (v4sf, v4sf)
16174 v4sf __builtin_ia32_divss (v4sf, v4sf)
16175 v4sf __builtin_ia32_cmpeqps (v4sf, v4sf)
16176 v4sf __builtin_ia32_cmpltps (v4sf, v4sf)
16177 v4sf __builtin_ia32_cmpleps (v4sf, v4sf)
16178 v4sf __builtin_ia32_cmpgtps (v4sf, v4sf)
16179 v4sf __builtin_ia32_cmpgeps (v4sf, v4sf)
16180 v4sf __builtin_ia32_cmpunordps (v4sf, v4sf)
16181 v4sf __builtin_ia32_cmpneqps (v4sf, v4sf)
16182 v4sf __builtin_ia32_cmpnltps (v4sf, v4sf)
16183 v4sf __builtin_ia32_cmpnleps (v4sf, v4sf)
16184 v4sf __builtin_ia32_cmpngtps (v4sf, v4sf)
16185 v4sf __builtin_ia32_cmpngeps (v4sf, v4sf)
16186 v4sf __builtin_ia32_cmpordps (v4sf, v4sf)
16187 v4sf __builtin_ia32_cmpeqss (v4sf, v4sf)
16188 v4sf __builtin_ia32_cmpltss (v4sf, v4sf)
16189 v4sf __builtin_ia32_cmpless (v4sf, v4sf)
16190 v4sf __builtin_ia32_cmpunordss (v4sf, v4sf)
16191 v4sf __builtin_ia32_cmpneqss (v4sf, v4sf)
16192 v4sf __builtin_ia32_cmpnltss (v4sf, v4sf)
16193 v4sf __builtin_ia32_cmpnless (v4sf, v4sf)
16194 v4sf __builtin_ia32_cmpordss (v4sf, v4sf)
16195 v4sf __builtin_ia32_maxps (v4sf, v4sf)
16196 v4sf __builtin_ia32_maxss (v4sf, v4sf)
16197 v4sf __builtin_ia32_minps (v4sf, v4sf)
16198 v4sf __builtin_ia32_minss (v4sf, v4sf)
16199 v4sf __builtin_ia32_andps (v4sf, v4sf)
16200 v4sf __builtin_ia32_andnps (v4sf, v4sf)
16201 v4sf __builtin_ia32_orps (v4sf, v4sf)
16202 v4sf __builtin_ia32_xorps (v4sf, v4sf)
16203 v4sf __builtin_ia32_movss (v4sf, v4sf)
16204 v4sf __builtin_ia32_movhlps (v4sf, v4sf)
16205 v4sf __builtin_ia32_movlhps (v4sf, v4sf)
16206 v4sf __builtin_ia32_unpckhps (v4sf, v4sf)
16207 v4sf __builtin_ia32_unpcklps (v4sf, v4sf)
16208 v4sf __builtin_ia32_cvtpi2ps (v4sf, v2si)
16209 v4sf __builtin_ia32_cvtsi2ss (v4sf, int)
16210 v2si __builtin_ia32_cvtps2pi (v4sf)
16211 int __builtin_ia32_cvtss2si (v4sf)
16212 v2si __builtin_ia32_cvttps2pi (v4sf)
16213 int __builtin_ia32_cvttss2si (v4sf)
16214 v4sf __builtin_ia32_rcpps (v4sf)
16215 v4sf __builtin_ia32_rsqrtps (v4sf)
16216 v4sf __builtin_ia32_sqrtps (v4sf)
16217 v4sf __builtin_ia32_rcpss (v4sf)
16218 v4sf __builtin_ia32_rsqrtss (v4sf)
16219 v4sf __builtin_ia32_sqrtss (v4sf)
16220 v4sf __builtin_ia32_shufps (v4sf, v4sf, int)
16221 void __builtin_ia32_movntps (float *, v4sf)
16222 int __builtin_ia32_movmskps (v4sf)
16223 @end smallexample
16224
16225 The following built-in functions are available when @option{-msse} is used.
16226
16227 @table @code
16228 @item v4sf __builtin_ia32_loadups (float *)
16229 Generates the @code{movups} machine instruction as a load from memory.
16230 @item void __builtin_ia32_storeups (float *, v4sf)
16231 Generates the @code{movups} machine instruction as a store to memory.
16232 @item v4sf __builtin_ia32_loadss (float *)
16233 Generates the @code{movss} machine instruction as a load from memory.
16234 @item v4sf __builtin_ia32_loadhps (v4sf, const v2sf *)
16235 Generates the @code{movhps} machine instruction as a load from memory.
16236 @item v4sf __builtin_ia32_loadlps (v4sf, const v2sf *)
16237 Generates the @code{movlps} machine instruction as a load from memory
16238 @item void __builtin_ia32_storehps (v2sf *, v4sf)
16239 Generates the @code{movhps} machine instruction as a store to memory.
16240 @item void __builtin_ia32_storelps (v2sf *, v4sf)
16241 Generates the @code{movlps} machine instruction as a store to memory.
16242 @end table
16243
16244 The following built-in functions are available when @option{-msse2} is used.
16245 All of them generate the machine instruction that is part of the name.
16246
16247 @smallexample
16248 int __builtin_ia32_comisdeq (v2df, v2df)
16249 int __builtin_ia32_comisdlt (v2df, v2df)
16250 int __builtin_ia32_comisdle (v2df, v2df)
16251 int __builtin_ia32_comisdgt (v2df, v2df)
16252 int __builtin_ia32_comisdge (v2df, v2df)
16253 int __builtin_ia32_comisdneq (v2df, v2df)
16254 int __builtin_ia32_ucomisdeq (v2df, v2df)
16255 int __builtin_ia32_ucomisdlt (v2df, v2df)
16256 int __builtin_ia32_ucomisdle (v2df, v2df)
16257 int __builtin_ia32_ucomisdgt (v2df, v2df)
16258 int __builtin_ia32_ucomisdge (v2df, v2df)
16259 int __builtin_ia32_ucomisdneq (v2df, v2df)
16260 v2df __builtin_ia32_cmpeqpd (v2df, v2df)
16261 v2df __builtin_ia32_cmpltpd (v2df, v2df)
16262 v2df __builtin_ia32_cmplepd (v2df, v2df)
16263 v2df __builtin_ia32_cmpgtpd (v2df, v2df)
16264 v2df __builtin_ia32_cmpgepd (v2df, v2df)
16265 v2df __builtin_ia32_cmpunordpd (v2df, v2df)
16266 v2df __builtin_ia32_cmpneqpd (v2df, v2df)
16267 v2df __builtin_ia32_cmpnltpd (v2df, v2df)
16268 v2df __builtin_ia32_cmpnlepd (v2df, v2df)
16269 v2df __builtin_ia32_cmpngtpd (v2df, v2df)
16270 v2df __builtin_ia32_cmpngepd (v2df, v2df)
16271 v2df __builtin_ia32_cmpordpd (v2df, v2df)
16272 v2df __builtin_ia32_cmpeqsd (v2df, v2df)
16273 v2df __builtin_ia32_cmpltsd (v2df, v2df)
16274 v2df __builtin_ia32_cmplesd (v2df, v2df)
16275 v2df __builtin_ia32_cmpunordsd (v2df, v2df)
16276 v2df __builtin_ia32_cmpneqsd (v2df, v2df)
16277 v2df __builtin_ia32_cmpnltsd (v2df, v2df)
16278 v2df __builtin_ia32_cmpnlesd (v2df, v2df)
16279 v2df __builtin_ia32_cmpordsd (v2df, v2df)
16280 v2di __builtin_ia32_paddq (v2di, v2di)
16281 v2di __builtin_ia32_psubq (v2di, v2di)
16282 v2df __builtin_ia32_addpd (v2df, v2df)
16283 v2df __builtin_ia32_subpd (v2df, v2df)
16284 v2df __builtin_ia32_mulpd (v2df, v2df)
16285 v2df __builtin_ia32_divpd (v2df, v2df)
16286 v2df __builtin_ia32_addsd (v2df, v2df)
16287 v2df __builtin_ia32_subsd (v2df, v2df)
16288 v2df __builtin_ia32_mulsd (v2df, v2df)
16289 v2df __builtin_ia32_divsd (v2df, v2df)
16290 v2df __builtin_ia32_minpd (v2df, v2df)
16291 v2df __builtin_ia32_maxpd (v2df, v2df)
16292 v2df __builtin_ia32_minsd (v2df, v2df)
16293 v2df __builtin_ia32_maxsd (v2df, v2df)
16294 v2df __builtin_ia32_andpd (v2df, v2df)
16295 v2df __builtin_ia32_andnpd (v2df, v2df)
16296 v2df __builtin_ia32_orpd (v2df, v2df)
16297 v2df __builtin_ia32_xorpd (v2df, v2df)
16298 v2df __builtin_ia32_movsd (v2df, v2df)
16299 v2df __builtin_ia32_unpckhpd (v2df, v2df)
16300 v2df __builtin_ia32_unpcklpd (v2df, v2df)
16301 v16qi __builtin_ia32_paddb128 (v16qi, v16qi)
16302 v8hi __builtin_ia32_paddw128 (v8hi, v8hi)
16303 v4si __builtin_ia32_paddd128 (v4si, v4si)
16304 v2di __builtin_ia32_paddq128 (v2di, v2di)
16305 v16qi __builtin_ia32_psubb128 (v16qi, v16qi)
16306 v8hi __builtin_ia32_psubw128 (v8hi, v8hi)
16307 v4si __builtin_ia32_psubd128 (v4si, v4si)
16308 v2di __builtin_ia32_psubq128 (v2di, v2di)
16309 v8hi __builtin_ia32_pmullw128 (v8hi, v8hi)
16310 v8hi __builtin_ia32_pmulhw128 (v8hi, v8hi)
16311 v2di __builtin_ia32_pand128 (v2di, v2di)
16312 v2di __builtin_ia32_pandn128 (v2di, v2di)
16313 v2di __builtin_ia32_por128 (v2di, v2di)
16314 v2di __builtin_ia32_pxor128 (v2di, v2di)
16315 v16qi __builtin_ia32_pavgb128 (v16qi, v16qi)
16316 v8hi __builtin_ia32_pavgw128 (v8hi, v8hi)
16317 v16qi __builtin_ia32_pcmpeqb128 (v16qi, v16qi)
16318 v8hi __builtin_ia32_pcmpeqw128 (v8hi, v8hi)
16319 v4si __builtin_ia32_pcmpeqd128 (v4si, v4si)
16320 v16qi __builtin_ia32_pcmpgtb128 (v16qi, v16qi)
16321 v8hi __builtin_ia32_pcmpgtw128 (v8hi, v8hi)
16322 v4si __builtin_ia32_pcmpgtd128 (v4si, v4si)
16323 v16qi __builtin_ia32_pmaxub128 (v16qi, v16qi)
16324 v8hi __builtin_ia32_pmaxsw128 (v8hi, v8hi)
16325 v16qi __builtin_ia32_pminub128 (v16qi, v16qi)
16326 v8hi __builtin_ia32_pminsw128 (v8hi, v8hi)
16327 v16qi __builtin_ia32_punpckhbw128 (v16qi, v16qi)
16328 v8hi __builtin_ia32_punpckhwd128 (v8hi, v8hi)
16329 v4si __builtin_ia32_punpckhdq128 (v4si, v4si)
16330 v2di __builtin_ia32_punpckhqdq128 (v2di, v2di)
16331 v16qi __builtin_ia32_punpcklbw128 (v16qi, v16qi)
16332 v8hi __builtin_ia32_punpcklwd128 (v8hi, v8hi)
16333 v4si __builtin_ia32_punpckldq128 (v4si, v4si)
16334 v2di __builtin_ia32_punpcklqdq128 (v2di, v2di)
16335 v16qi __builtin_ia32_packsswb128 (v8hi, v8hi)
16336 v8hi __builtin_ia32_packssdw128 (v4si, v4si)
16337 v16qi __builtin_ia32_packuswb128 (v8hi, v8hi)
16338 v8hi __builtin_ia32_pmulhuw128 (v8hi, v8hi)
16339 void __builtin_ia32_maskmovdqu (v16qi, v16qi)
16340 v2df __builtin_ia32_loadupd (double *)
16341 void __builtin_ia32_storeupd (double *, v2df)
16342 v2df __builtin_ia32_loadhpd (v2df, double const *)
16343 v2df __builtin_ia32_loadlpd (v2df, double const *)
16344 int __builtin_ia32_movmskpd (v2df)
16345 int __builtin_ia32_pmovmskb128 (v16qi)
16346 void __builtin_ia32_movnti (int *, int)
16347 void __builtin_ia32_movnti64 (long long int *, long long int)
16348 void __builtin_ia32_movntpd (double *, v2df)
16349 void __builtin_ia32_movntdq (v2df *, v2df)
16350 v4si __builtin_ia32_pshufd (v4si, int)
16351 v8hi __builtin_ia32_pshuflw (v8hi, int)
16352 v8hi __builtin_ia32_pshufhw (v8hi, int)
16353 v2di __builtin_ia32_psadbw128 (v16qi, v16qi)
16354 v2df __builtin_ia32_sqrtpd (v2df)
16355 v2df __builtin_ia32_sqrtsd (v2df)
16356 v2df __builtin_ia32_shufpd (v2df, v2df, int)
16357 v2df __builtin_ia32_cvtdq2pd (v4si)
16358 v4sf __builtin_ia32_cvtdq2ps (v4si)
16359 v4si __builtin_ia32_cvtpd2dq (v2df)
16360 v2si __builtin_ia32_cvtpd2pi (v2df)
16361 v4sf __builtin_ia32_cvtpd2ps (v2df)
16362 v4si __builtin_ia32_cvttpd2dq (v2df)
16363 v2si __builtin_ia32_cvttpd2pi (v2df)
16364 v2df __builtin_ia32_cvtpi2pd (v2si)
16365 int __builtin_ia32_cvtsd2si (v2df)
16366 int __builtin_ia32_cvttsd2si (v2df)
16367 long long __builtin_ia32_cvtsd2si64 (v2df)
16368 long long __builtin_ia32_cvttsd2si64 (v2df)
16369 v4si __builtin_ia32_cvtps2dq (v4sf)
16370 v2df __builtin_ia32_cvtps2pd (v4sf)
16371 v4si __builtin_ia32_cvttps2dq (v4sf)
16372 v2df __builtin_ia32_cvtsi2sd (v2df, int)
16373 v2df __builtin_ia32_cvtsi642sd (v2df, long long)
16374 v4sf __builtin_ia32_cvtsd2ss (v4sf, v2df)
16375 v2df __builtin_ia32_cvtss2sd (v2df, v4sf)
16376 void __builtin_ia32_clflush (const void *)
16377 void __builtin_ia32_lfence (void)
16378 void __builtin_ia32_mfence (void)
16379 v16qi __builtin_ia32_loaddqu (const char *)
16380 void __builtin_ia32_storedqu (char *, v16qi)
16381 v1di __builtin_ia32_pmuludq (v2si, v2si)
16382 v2di __builtin_ia32_pmuludq128 (v4si, v4si)
16383 v8hi __builtin_ia32_psllw128 (v8hi, v8hi)
16384 v4si __builtin_ia32_pslld128 (v4si, v4si)
16385 v2di __builtin_ia32_psllq128 (v2di, v2di)
16386 v8hi __builtin_ia32_psrlw128 (v8hi, v8hi)
16387 v4si __builtin_ia32_psrld128 (v4si, v4si)
16388 v2di __builtin_ia32_psrlq128 (v2di, v2di)
16389 v8hi __builtin_ia32_psraw128 (v8hi, v8hi)
16390 v4si __builtin_ia32_psrad128 (v4si, v4si)
16391 v2di __builtin_ia32_pslldqi128 (v2di, int)
16392 v8hi __builtin_ia32_psllwi128 (v8hi, int)
16393 v4si __builtin_ia32_pslldi128 (v4si, int)
16394 v2di __builtin_ia32_psllqi128 (v2di, int)
16395 v2di __builtin_ia32_psrldqi128 (v2di, int)
16396 v8hi __builtin_ia32_psrlwi128 (v8hi, int)
16397 v4si __builtin_ia32_psrldi128 (v4si, int)
16398 v2di __builtin_ia32_psrlqi128 (v2di, int)
16399 v8hi __builtin_ia32_psrawi128 (v8hi, int)
16400 v4si __builtin_ia32_psradi128 (v4si, int)
16401 v4si __builtin_ia32_pmaddwd128 (v8hi, v8hi)
16402 v2di __builtin_ia32_movq128 (v2di)
16403 @end smallexample
16404
16405 The following built-in functions are available when @option{-msse3} is used.
16406 All of them generate the machine instruction that is part of the name.
16407
16408 @smallexample
16409 v2df __builtin_ia32_addsubpd (v2df, v2df)
16410 v4sf __builtin_ia32_addsubps (v4sf, v4sf)
16411 v2df __builtin_ia32_haddpd (v2df, v2df)
16412 v4sf __builtin_ia32_haddps (v4sf, v4sf)
16413 v2df __builtin_ia32_hsubpd (v2df, v2df)
16414 v4sf __builtin_ia32_hsubps (v4sf, v4sf)
16415 v16qi __builtin_ia32_lddqu (char const *)
16416 void __builtin_ia32_monitor (void *, unsigned int, unsigned int)
16417 v4sf __builtin_ia32_movshdup (v4sf)
16418 v4sf __builtin_ia32_movsldup (v4sf)
16419 void __builtin_ia32_mwait (unsigned int, unsigned int)
16420 @end smallexample
16421
16422 The following built-in functions are available when @option{-mssse3} is used.
16423 All of them generate the machine instruction that is part of the name.
16424
16425 @smallexample
16426 v2si __builtin_ia32_phaddd (v2si, v2si)
16427 v4hi __builtin_ia32_phaddw (v4hi, v4hi)
16428 v4hi __builtin_ia32_phaddsw (v4hi, v4hi)
16429 v2si __builtin_ia32_phsubd (v2si, v2si)
16430 v4hi __builtin_ia32_phsubw (v4hi, v4hi)
16431 v4hi __builtin_ia32_phsubsw (v4hi, v4hi)
16432 v4hi __builtin_ia32_pmaddubsw (v8qi, v8qi)
16433 v4hi __builtin_ia32_pmulhrsw (v4hi, v4hi)
16434 v8qi __builtin_ia32_pshufb (v8qi, v8qi)
16435 v8qi __builtin_ia32_psignb (v8qi, v8qi)
16436 v2si __builtin_ia32_psignd (v2si, v2si)
16437 v4hi __builtin_ia32_psignw (v4hi, v4hi)
16438 v1di __builtin_ia32_palignr (v1di, v1di, int)
16439 v8qi __builtin_ia32_pabsb (v8qi)
16440 v2si __builtin_ia32_pabsd (v2si)
16441 v4hi __builtin_ia32_pabsw (v4hi)
16442 @end smallexample
16443
16444 The following built-in functions are available when @option{-mssse3} is used.
16445 All of them generate the machine instruction that is part of the name.
16446
16447 @smallexample
16448 v4si __builtin_ia32_phaddd128 (v4si, v4si)
16449 v8hi __builtin_ia32_phaddw128 (v8hi, v8hi)
16450 v8hi __builtin_ia32_phaddsw128 (v8hi, v8hi)
16451 v4si __builtin_ia32_phsubd128 (v4si, v4si)
16452 v8hi __builtin_ia32_phsubw128 (v8hi, v8hi)
16453 v8hi __builtin_ia32_phsubsw128 (v8hi, v8hi)
16454 v8hi __builtin_ia32_pmaddubsw128 (v16qi, v16qi)
16455 v8hi __builtin_ia32_pmulhrsw128 (v8hi, v8hi)
16456 v16qi __builtin_ia32_pshufb128 (v16qi, v16qi)
16457 v16qi __builtin_ia32_psignb128 (v16qi, v16qi)
16458 v4si __builtin_ia32_psignd128 (v4si, v4si)
16459 v8hi __builtin_ia32_psignw128 (v8hi, v8hi)
16460 v2di __builtin_ia32_palignr128 (v2di, v2di, int)
16461 v16qi __builtin_ia32_pabsb128 (v16qi)
16462 v4si __builtin_ia32_pabsd128 (v4si)
16463 v8hi __builtin_ia32_pabsw128 (v8hi)
16464 @end smallexample
16465
16466 The following built-in functions are available when @option{-msse4.1} is
16467 used.  All of them generate the machine instruction that is part of the
16468 name.
16469
16470 @smallexample
16471 v2df __builtin_ia32_blendpd (v2df, v2df, const int)
16472 v4sf __builtin_ia32_blendps (v4sf, v4sf, const int)
16473 v2df __builtin_ia32_blendvpd (v2df, v2df, v2df)
16474 v4sf __builtin_ia32_blendvps (v4sf, v4sf, v4sf)
16475 v2df __builtin_ia32_dppd (v2df, v2df, const int)
16476 v4sf __builtin_ia32_dpps (v4sf, v4sf, const int)
16477 v4sf __builtin_ia32_insertps128 (v4sf, v4sf, const int)
16478 v2di __builtin_ia32_movntdqa (v2di *);
16479 v16qi __builtin_ia32_mpsadbw128 (v16qi, v16qi, const int)
16480 v8hi __builtin_ia32_packusdw128 (v4si, v4si)
16481 v16qi __builtin_ia32_pblendvb128 (v16qi, v16qi, v16qi)
16482 v8hi __builtin_ia32_pblendw128 (v8hi, v8hi, const int)
16483 v2di __builtin_ia32_pcmpeqq (v2di, v2di)
16484 v8hi __builtin_ia32_phminposuw128 (v8hi)
16485 v16qi __builtin_ia32_pmaxsb128 (v16qi, v16qi)
16486 v4si __builtin_ia32_pmaxsd128 (v4si, v4si)
16487 v4si __builtin_ia32_pmaxud128 (v4si, v4si)
16488 v8hi __builtin_ia32_pmaxuw128 (v8hi, v8hi)
16489 v16qi __builtin_ia32_pminsb128 (v16qi, v16qi)
16490 v4si __builtin_ia32_pminsd128 (v4si, v4si)
16491 v4si __builtin_ia32_pminud128 (v4si, v4si)
16492 v8hi __builtin_ia32_pminuw128 (v8hi, v8hi)
16493 v4si __builtin_ia32_pmovsxbd128 (v16qi)
16494 v2di __builtin_ia32_pmovsxbq128 (v16qi)
16495 v8hi __builtin_ia32_pmovsxbw128 (v16qi)
16496 v2di __builtin_ia32_pmovsxdq128 (v4si)
16497 v4si __builtin_ia32_pmovsxwd128 (v8hi)
16498 v2di __builtin_ia32_pmovsxwq128 (v8hi)
16499 v4si __builtin_ia32_pmovzxbd128 (v16qi)
16500 v2di __builtin_ia32_pmovzxbq128 (v16qi)
16501 v8hi __builtin_ia32_pmovzxbw128 (v16qi)
16502 v2di __builtin_ia32_pmovzxdq128 (v4si)
16503 v4si __builtin_ia32_pmovzxwd128 (v8hi)
16504 v2di __builtin_ia32_pmovzxwq128 (v8hi)
16505 v2di __builtin_ia32_pmuldq128 (v4si, v4si)
16506 v4si __builtin_ia32_pmulld128 (v4si, v4si)
16507 int __builtin_ia32_ptestc128 (v2di, v2di)
16508 int __builtin_ia32_ptestnzc128 (v2di, v2di)
16509 int __builtin_ia32_ptestz128 (v2di, v2di)
16510 v2df __builtin_ia32_roundpd (v2df, const int)
16511 v4sf __builtin_ia32_roundps (v4sf, const int)
16512 v2df __builtin_ia32_roundsd (v2df, v2df, const int)
16513 v4sf __builtin_ia32_roundss (v4sf, v4sf, const int)
16514 @end smallexample
16515
16516 The following built-in functions are available when @option{-msse4.1} is
16517 used.
16518
16519 @table @code
16520 @item v4sf __builtin_ia32_vec_set_v4sf (v4sf, float, const int)
16521 Generates the @code{insertps} machine instruction.
16522 @item int __builtin_ia32_vec_ext_v16qi (v16qi, const int)
16523 Generates the @code{pextrb} machine instruction.
16524 @item v16qi __builtin_ia32_vec_set_v16qi (v16qi, int, const int)
16525 Generates the @code{pinsrb} machine instruction.
16526 @item v4si __builtin_ia32_vec_set_v4si (v4si, int, const int)
16527 Generates the @code{pinsrd} machine instruction.
16528 @item v2di __builtin_ia32_vec_set_v2di (v2di, long long, const int)
16529 Generates the @code{pinsrq} machine instruction in 64bit mode.
16530 @end table
16531
16532 The following built-in functions are changed to generate new SSE4.1
16533 instructions when @option{-msse4.1} is used.
16534
16535 @table @code
16536 @item float __builtin_ia32_vec_ext_v4sf (v4sf, const int)
16537 Generates the @code{extractps} machine instruction.
16538 @item int __builtin_ia32_vec_ext_v4si (v4si, const int)
16539 Generates the @code{pextrd} machine instruction.
16540 @item long long __builtin_ia32_vec_ext_v2di (v2di, const int)
16541 Generates the @code{pextrq} machine instruction in 64bit mode.
16542 @end table
16543
16544 The following built-in functions are available when @option{-msse4.2} is
16545 used.  All of them generate the machine instruction that is part of the
16546 name.
16547
16548 @smallexample
16549 v16qi __builtin_ia32_pcmpestrm128 (v16qi, int, v16qi, int, const int)
16550 int __builtin_ia32_pcmpestri128 (v16qi, int, v16qi, int, const int)
16551 int __builtin_ia32_pcmpestria128 (v16qi, int, v16qi, int, const int)
16552 int __builtin_ia32_pcmpestric128 (v16qi, int, v16qi, int, const int)
16553 int __builtin_ia32_pcmpestrio128 (v16qi, int, v16qi, int, const int)
16554 int __builtin_ia32_pcmpestris128 (v16qi, int, v16qi, int, const int)
16555 int __builtin_ia32_pcmpestriz128 (v16qi, int, v16qi, int, const int)
16556 v16qi __builtin_ia32_pcmpistrm128 (v16qi, v16qi, const int)
16557 int __builtin_ia32_pcmpistri128 (v16qi, v16qi, const int)
16558 int __builtin_ia32_pcmpistria128 (v16qi, v16qi, const int)
16559 int __builtin_ia32_pcmpistric128 (v16qi, v16qi, const int)
16560 int __builtin_ia32_pcmpistrio128 (v16qi, v16qi, const int)
16561 int __builtin_ia32_pcmpistris128 (v16qi, v16qi, const int)
16562 int __builtin_ia32_pcmpistriz128 (v16qi, v16qi, const int)
16563 v2di __builtin_ia32_pcmpgtq (v2di, v2di)
16564 @end smallexample
16565
16566 The following built-in functions are available when @option{-msse4.2} is
16567 used.
16568
16569 @table @code
16570 @item unsigned int __builtin_ia32_crc32qi (unsigned int, unsigned char)
16571 Generates the @code{crc32b} machine instruction.
16572 @item unsigned int __builtin_ia32_crc32hi (unsigned int, unsigned short)
16573 Generates the @code{crc32w} machine instruction.
16574 @item unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int)
16575 Generates the @code{crc32l} machine instruction.
16576 @item unsigned long long __builtin_ia32_crc32di (unsigned long long, unsigned long long)
16577 Generates the @code{crc32q} machine instruction.
16578 @end table
16579
16580 The following built-in functions are changed to generate new SSE4.2
16581 instructions when @option{-msse4.2} is used.
16582
16583 @table @code
16584 @item int __builtin_popcount (unsigned int)
16585 Generates the @code{popcntl} machine instruction.
16586 @item int __builtin_popcountl (unsigned long)
16587 Generates the @code{popcntl} or @code{popcntq} machine instruction,
16588 depending on the size of @code{unsigned long}.
16589 @item int __builtin_popcountll (unsigned long long)
16590 Generates the @code{popcntq} machine instruction.
16591 @end table
16592
16593 The following built-in functions are available when @option{-mavx} is
16594 used. All of them generate the machine instruction that is part of the
16595 name.
16596
16597 @smallexample
16598 v4df __builtin_ia32_addpd256 (v4df,v4df)
16599 v8sf __builtin_ia32_addps256 (v8sf,v8sf)
16600 v4df __builtin_ia32_addsubpd256 (v4df,v4df)
16601 v8sf __builtin_ia32_addsubps256 (v8sf,v8sf)
16602 v4df __builtin_ia32_andnpd256 (v4df,v4df)
16603 v8sf __builtin_ia32_andnps256 (v8sf,v8sf)
16604 v4df __builtin_ia32_andpd256 (v4df,v4df)
16605 v8sf __builtin_ia32_andps256 (v8sf,v8sf)
16606 v4df __builtin_ia32_blendpd256 (v4df,v4df,int)
16607 v8sf __builtin_ia32_blendps256 (v8sf,v8sf,int)
16608 v4df __builtin_ia32_blendvpd256 (v4df,v4df,v4df)
16609 v8sf __builtin_ia32_blendvps256 (v8sf,v8sf,v8sf)
16610 v2df __builtin_ia32_cmppd (v2df,v2df,int)
16611 v4df __builtin_ia32_cmppd256 (v4df,v4df,int)
16612 v4sf __builtin_ia32_cmpps (v4sf,v4sf,int)
16613 v8sf __builtin_ia32_cmpps256 (v8sf,v8sf,int)
16614 v2df __builtin_ia32_cmpsd (v2df,v2df,int)
16615 v4sf __builtin_ia32_cmpss (v4sf,v4sf,int)
16616 v4df __builtin_ia32_cvtdq2pd256 (v4si)
16617 v8sf __builtin_ia32_cvtdq2ps256 (v8si)
16618 v4si __builtin_ia32_cvtpd2dq256 (v4df)
16619 v4sf __builtin_ia32_cvtpd2ps256 (v4df)
16620 v8si __builtin_ia32_cvtps2dq256 (v8sf)
16621 v4df __builtin_ia32_cvtps2pd256 (v4sf)
16622 v4si __builtin_ia32_cvttpd2dq256 (v4df)
16623 v8si __builtin_ia32_cvttps2dq256 (v8sf)
16624 v4df __builtin_ia32_divpd256 (v4df,v4df)
16625 v8sf __builtin_ia32_divps256 (v8sf,v8sf)
16626 v8sf __builtin_ia32_dpps256 (v8sf,v8sf,int)
16627 v4df __builtin_ia32_haddpd256 (v4df,v4df)
16628 v8sf __builtin_ia32_haddps256 (v8sf,v8sf)
16629 v4df __builtin_ia32_hsubpd256 (v4df,v4df)
16630 v8sf __builtin_ia32_hsubps256 (v8sf,v8sf)
16631 v32qi __builtin_ia32_lddqu256 (pcchar)
16632 v32qi __builtin_ia32_loaddqu256 (pcchar)
16633 v4df __builtin_ia32_loadupd256 (pcdouble)
16634 v8sf __builtin_ia32_loadups256 (pcfloat)
16635 v2df __builtin_ia32_maskloadpd (pcv2df,v2df)
16636 v4df __builtin_ia32_maskloadpd256 (pcv4df,v4df)
16637 v4sf __builtin_ia32_maskloadps (pcv4sf,v4sf)
16638 v8sf __builtin_ia32_maskloadps256 (pcv8sf,v8sf)
16639 void __builtin_ia32_maskstorepd (pv2df,v2df,v2df)
16640 void __builtin_ia32_maskstorepd256 (pv4df,v4df,v4df)
16641 void __builtin_ia32_maskstoreps (pv4sf,v4sf,v4sf)
16642 void __builtin_ia32_maskstoreps256 (pv8sf,v8sf,v8sf)
16643 v4df __builtin_ia32_maxpd256 (v4df,v4df)
16644 v8sf __builtin_ia32_maxps256 (v8sf,v8sf)
16645 v4df __builtin_ia32_minpd256 (v4df,v4df)
16646 v8sf __builtin_ia32_minps256 (v8sf,v8sf)
16647 v4df __builtin_ia32_movddup256 (v4df)
16648 int __builtin_ia32_movmskpd256 (v4df)
16649 int __builtin_ia32_movmskps256 (v8sf)
16650 v8sf __builtin_ia32_movshdup256 (v8sf)
16651 v8sf __builtin_ia32_movsldup256 (v8sf)
16652 v4df __builtin_ia32_mulpd256 (v4df,v4df)
16653 v8sf __builtin_ia32_mulps256 (v8sf,v8sf)
16654 v4df __builtin_ia32_orpd256 (v4df,v4df)
16655 v8sf __builtin_ia32_orps256 (v8sf,v8sf)
16656 v2df __builtin_ia32_pd_pd256 (v4df)
16657 v4df __builtin_ia32_pd256_pd (v2df)
16658 v4sf __builtin_ia32_ps_ps256 (v8sf)
16659 v8sf __builtin_ia32_ps256_ps (v4sf)
16660 int __builtin_ia32_ptestc256 (v4di,v4di,ptest)
16661 int __builtin_ia32_ptestnzc256 (v4di,v4di,ptest)
16662 int __builtin_ia32_ptestz256 (v4di,v4di,ptest)
16663 v8sf __builtin_ia32_rcpps256 (v8sf)
16664 v4df __builtin_ia32_roundpd256 (v4df,int)
16665 v8sf __builtin_ia32_roundps256 (v8sf,int)
16666 v8sf __builtin_ia32_rsqrtps_nr256 (v8sf)
16667 v8sf __builtin_ia32_rsqrtps256 (v8sf)
16668 v4df __builtin_ia32_shufpd256 (v4df,v4df,int)
16669 v8sf __builtin_ia32_shufps256 (v8sf,v8sf,int)
16670 v4si __builtin_ia32_si_si256 (v8si)
16671 v8si __builtin_ia32_si256_si (v4si)
16672 v4df __builtin_ia32_sqrtpd256 (v4df)
16673 v8sf __builtin_ia32_sqrtps_nr256 (v8sf)
16674 v8sf __builtin_ia32_sqrtps256 (v8sf)
16675 void __builtin_ia32_storedqu256 (pchar,v32qi)
16676 void __builtin_ia32_storeupd256 (pdouble,v4df)
16677 void __builtin_ia32_storeups256 (pfloat,v8sf)
16678 v4df __builtin_ia32_subpd256 (v4df,v4df)
16679 v8sf __builtin_ia32_subps256 (v8sf,v8sf)
16680 v4df __builtin_ia32_unpckhpd256 (v4df,v4df)
16681 v8sf __builtin_ia32_unpckhps256 (v8sf,v8sf)
16682 v4df __builtin_ia32_unpcklpd256 (v4df,v4df)
16683 v8sf __builtin_ia32_unpcklps256 (v8sf,v8sf)
16684 v4df __builtin_ia32_vbroadcastf128_pd256 (pcv2df)
16685 v8sf __builtin_ia32_vbroadcastf128_ps256 (pcv4sf)
16686 v4df __builtin_ia32_vbroadcastsd256 (pcdouble)
16687 v4sf __builtin_ia32_vbroadcastss (pcfloat)
16688 v8sf __builtin_ia32_vbroadcastss256 (pcfloat)
16689 v2df __builtin_ia32_vextractf128_pd256 (v4df,int)
16690 v4sf __builtin_ia32_vextractf128_ps256 (v8sf,int)
16691 v4si __builtin_ia32_vextractf128_si256 (v8si,int)
16692 v4df __builtin_ia32_vinsertf128_pd256 (v4df,v2df,int)
16693 v8sf __builtin_ia32_vinsertf128_ps256 (v8sf,v4sf,int)
16694 v8si __builtin_ia32_vinsertf128_si256 (v8si,v4si,int)
16695 v4df __builtin_ia32_vperm2f128_pd256 (v4df,v4df,int)
16696 v8sf __builtin_ia32_vperm2f128_ps256 (v8sf,v8sf,int)
16697 v8si __builtin_ia32_vperm2f128_si256 (v8si,v8si,int)
16698 v2df __builtin_ia32_vpermil2pd (v2df,v2df,v2di,int)
16699 v4df __builtin_ia32_vpermil2pd256 (v4df,v4df,v4di,int)
16700 v4sf __builtin_ia32_vpermil2ps (v4sf,v4sf,v4si,int)
16701 v8sf __builtin_ia32_vpermil2ps256 (v8sf,v8sf,v8si,int)
16702 v2df __builtin_ia32_vpermilpd (v2df,int)
16703 v4df __builtin_ia32_vpermilpd256 (v4df,int)
16704 v4sf __builtin_ia32_vpermilps (v4sf,int)
16705 v8sf __builtin_ia32_vpermilps256 (v8sf,int)
16706 v2df __builtin_ia32_vpermilvarpd (v2df,v2di)
16707 v4df __builtin_ia32_vpermilvarpd256 (v4df,v4di)
16708 v4sf __builtin_ia32_vpermilvarps (v4sf,v4si)
16709 v8sf __builtin_ia32_vpermilvarps256 (v8sf,v8si)
16710 int __builtin_ia32_vtestcpd (v2df,v2df,ptest)
16711 int __builtin_ia32_vtestcpd256 (v4df,v4df,ptest)
16712 int __builtin_ia32_vtestcps (v4sf,v4sf,ptest)
16713 int __builtin_ia32_vtestcps256 (v8sf,v8sf,ptest)
16714 int __builtin_ia32_vtestnzcpd (v2df,v2df,ptest)
16715 int __builtin_ia32_vtestnzcpd256 (v4df,v4df,ptest)
16716 int __builtin_ia32_vtestnzcps (v4sf,v4sf,ptest)
16717 int __builtin_ia32_vtestnzcps256 (v8sf,v8sf,ptest)
16718 int __builtin_ia32_vtestzpd (v2df,v2df,ptest)
16719 int __builtin_ia32_vtestzpd256 (v4df,v4df,ptest)
16720 int __builtin_ia32_vtestzps (v4sf,v4sf,ptest)
16721 int __builtin_ia32_vtestzps256 (v8sf,v8sf,ptest)
16722 void __builtin_ia32_vzeroall (void)
16723 void __builtin_ia32_vzeroupper (void)
16724 v4df __builtin_ia32_xorpd256 (v4df,v4df)
16725 v8sf __builtin_ia32_xorps256 (v8sf,v8sf)
16726 @end smallexample
16727
16728 The following built-in functions are available when @option{-mavx2} is
16729 used. All of them generate the machine instruction that is part of the
16730 name.
16731
16732 @smallexample
16733 v32qi __builtin_ia32_mpsadbw256 (v32qi,v32qi,int)
16734 v32qi __builtin_ia32_pabsb256 (v32qi)
16735 v16hi __builtin_ia32_pabsw256 (v16hi)
16736 v8si __builtin_ia32_pabsd256 (v8si)
16737 v16hi __builtin_ia32_packssdw256 (v8si,v8si)
16738 v32qi __builtin_ia32_packsswb256 (v16hi,v16hi)
16739 v16hi __builtin_ia32_packusdw256 (v8si,v8si)
16740 v32qi __builtin_ia32_packuswb256 (v16hi,v16hi)
16741 v32qi __builtin_ia32_paddb256 (v32qi,v32qi)
16742 v16hi __builtin_ia32_paddw256 (v16hi,v16hi)
16743 v8si __builtin_ia32_paddd256 (v8si,v8si)
16744 v4di __builtin_ia32_paddq256 (v4di,v4di)
16745 v32qi __builtin_ia32_paddsb256 (v32qi,v32qi)
16746 v16hi __builtin_ia32_paddsw256 (v16hi,v16hi)
16747 v32qi __builtin_ia32_paddusb256 (v32qi,v32qi)
16748 v16hi __builtin_ia32_paddusw256 (v16hi,v16hi)
16749 v4di __builtin_ia32_palignr256 (v4di,v4di,int)
16750 v4di __builtin_ia32_andsi256 (v4di,v4di)
16751 v4di __builtin_ia32_andnotsi256 (v4di,v4di)
16752 v32qi __builtin_ia32_pavgb256 (v32qi,v32qi)
16753 v16hi __builtin_ia32_pavgw256 (v16hi,v16hi)
16754 v32qi __builtin_ia32_pblendvb256 (v32qi,v32qi,v32qi)
16755 v16hi __builtin_ia32_pblendw256 (v16hi,v16hi,int)
16756 v32qi __builtin_ia32_pcmpeqb256 (v32qi,v32qi)
16757 v16hi __builtin_ia32_pcmpeqw256 (v16hi,v16hi)
16758 v8si __builtin_ia32_pcmpeqd256 (c8si,v8si)
16759 v4di __builtin_ia32_pcmpeqq256 (v4di,v4di)
16760 v32qi __builtin_ia32_pcmpgtb256 (v32qi,v32qi)
16761 v16hi __builtin_ia32_pcmpgtw256 (16hi,v16hi)
16762 v8si __builtin_ia32_pcmpgtd256 (v8si,v8si)
16763 v4di __builtin_ia32_pcmpgtq256 (v4di,v4di)
16764 v16hi __builtin_ia32_phaddw256 (v16hi,v16hi)
16765 v8si __builtin_ia32_phaddd256 (v8si,v8si)
16766 v16hi __builtin_ia32_phaddsw256 (v16hi,v16hi)
16767 v16hi __builtin_ia32_phsubw256 (v16hi,v16hi)
16768 v8si __builtin_ia32_phsubd256 (v8si,v8si)
16769 v16hi __builtin_ia32_phsubsw256 (v16hi,v16hi)
16770 v32qi __builtin_ia32_pmaddubsw256 (v32qi,v32qi)
16771 v16hi __builtin_ia32_pmaddwd256 (v16hi,v16hi)
16772 v32qi __builtin_ia32_pmaxsb256 (v32qi,v32qi)
16773 v16hi __builtin_ia32_pmaxsw256 (v16hi,v16hi)
16774 v8si __builtin_ia32_pmaxsd256 (v8si,v8si)
16775 v32qi __builtin_ia32_pmaxub256 (v32qi,v32qi)
16776 v16hi __builtin_ia32_pmaxuw256 (v16hi,v16hi)
16777 v8si __builtin_ia32_pmaxud256 (v8si,v8si)
16778 v32qi __builtin_ia32_pminsb256 (v32qi,v32qi)
16779 v16hi __builtin_ia32_pminsw256 (v16hi,v16hi)
16780 v8si __builtin_ia32_pminsd256 (v8si,v8si)
16781 v32qi __builtin_ia32_pminub256 (v32qi,v32qi)
16782 v16hi __builtin_ia32_pminuw256 (v16hi,v16hi)
16783 v8si __builtin_ia32_pminud256 (v8si,v8si)
16784 int __builtin_ia32_pmovmskb256 (v32qi)
16785 v16hi __builtin_ia32_pmovsxbw256 (v16qi)
16786 v8si __builtin_ia32_pmovsxbd256 (v16qi)
16787 v4di __builtin_ia32_pmovsxbq256 (v16qi)
16788 v8si __builtin_ia32_pmovsxwd256 (v8hi)
16789 v4di __builtin_ia32_pmovsxwq256 (v8hi)
16790 v4di __builtin_ia32_pmovsxdq256 (v4si)
16791 v16hi __builtin_ia32_pmovzxbw256 (v16qi)
16792 v8si __builtin_ia32_pmovzxbd256 (v16qi)
16793 v4di __builtin_ia32_pmovzxbq256 (v16qi)
16794 v8si __builtin_ia32_pmovzxwd256 (v8hi)
16795 v4di __builtin_ia32_pmovzxwq256 (v8hi)
16796 v4di __builtin_ia32_pmovzxdq256 (v4si)
16797 v4di __builtin_ia32_pmuldq256 (v8si,v8si)
16798 v16hi __builtin_ia32_pmulhrsw256 (v16hi, v16hi)
16799 v16hi __builtin_ia32_pmulhuw256 (v16hi,v16hi)
16800 v16hi __builtin_ia32_pmulhw256 (v16hi,v16hi)
16801 v16hi __builtin_ia32_pmullw256 (v16hi,v16hi)
16802 v8si __builtin_ia32_pmulld256 (v8si,v8si)
16803 v4di __builtin_ia32_pmuludq256 (v8si,v8si)
16804 v4di __builtin_ia32_por256 (v4di,v4di)
16805 v16hi __builtin_ia32_psadbw256 (v32qi,v32qi)
16806 v32qi __builtin_ia32_pshufb256 (v32qi,v32qi)
16807 v8si __builtin_ia32_pshufd256 (v8si,int)
16808 v16hi __builtin_ia32_pshufhw256 (v16hi,int)
16809 v16hi __builtin_ia32_pshuflw256 (v16hi,int)
16810 v32qi __builtin_ia32_psignb256 (v32qi,v32qi)
16811 v16hi __builtin_ia32_psignw256 (v16hi,v16hi)
16812 v8si __builtin_ia32_psignd256 (v8si,v8si)
16813 v4di __builtin_ia32_pslldqi256 (v4di,int)
16814 v16hi __builtin_ia32_psllwi256 (16hi,int)
16815 v16hi __builtin_ia32_psllw256(v16hi,v8hi)
16816 v8si __builtin_ia32_pslldi256 (v8si,int)
16817 v8si __builtin_ia32_pslld256(v8si,v4si)
16818 v4di __builtin_ia32_psllqi256 (v4di,int)
16819 v4di __builtin_ia32_psllq256(v4di,v2di)
16820 v16hi __builtin_ia32_psrawi256 (v16hi,int)
16821 v16hi __builtin_ia32_psraw256 (v16hi,v8hi)
16822 v8si __builtin_ia32_psradi256 (v8si,int)
16823 v8si __builtin_ia32_psrad256 (v8si,v4si)
16824 v4di __builtin_ia32_psrldqi256 (v4di, int)
16825 v16hi __builtin_ia32_psrlwi256 (v16hi,int)
16826 v16hi __builtin_ia32_psrlw256 (v16hi,v8hi)
16827 v8si __builtin_ia32_psrldi256 (v8si,int)
16828 v8si __builtin_ia32_psrld256 (v8si,v4si)
16829 v4di __builtin_ia32_psrlqi256 (v4di,int)
16830 v4di __builtin_ia32_psrlq256(v4di,v2di)
16831 v32qi __builtin_ia32_psubb256 (v32qi,v32qi)
16832 v32hi __builtin_ia32_psubw256 (v16hi,v16hi)
16833 v8si __builtin_ia32_psubd256 (v8si,v8si)
16834 v4di __builtin_ia32_psubq256 (v4di,v4di)
16835 v32qi __builtin_ia32_psubsb256 (v32qi,v32qi)
16836 v16hi __builtin_ia32_psubsw256 (v16hi,v16hi)
16837 v32qi __builtin_ia32_psubusb256 (v32qi,v32qi)
16838 v16hi __builtin_ia32_psubusw256 (v16hi,v16hi)
16839 v32qi __builtin_ia32_punpckhbw256 (v32qi,v32qi)
16840 v16hi __builtin_ia32_punpckhwd256 (v16hi,v16hi)
16841 v8si __builtin_ia32_punpckhdq256 (v8si,v8si)
16842 v4di __builtin_ia32_punpckhqdq256 (v4di,v4di)
16843 v32qi __builtin_ia32_punpcklbw256 (v32qi,v32qi)
16844 v16hi __builtin_ia32_punpcklwd256 (v16hi,v16hi)
16845 v8si __builtin_ia32_punpckldq256 (v8si,v8si)
16846 v4di __builtin_ia32_punpcklqdq256 (v4di,v4di)
16847 v4di __builtin_ia32_pxor256 (v4di,v4di)
16848 v4di __builtin_ia32_movntdqa256 (pv4di)
16849 v4sf __builtin_ia32_vbroadcastss_ps (v4sf)
16850 v8sf __builtin_ia32_vbroadcastss_ps256 (v4sf)
16851 v4df __builtin_ia32_vbroadcastsd_pd256 (v2df)
16852 v4di __builtin_ia32_vbroadcastsi256 (v2di)
16853 v4si __builtin_ia32_pblendd128 (v4si,v4si)
16854 v8si __builtin_ia32_pblendd256 (v8si,v8si)
16855 v32qi __builtin_ia32_pbroadcastb256 (v16qi)
16856 v16hi __builtin_ia32_pbroadcastw256 (v8hi)
16857 v8si __builtin_ia32_pbroadcastd256 (v4si)
16858 v4di __builtin_ia32_pbroadcastq256 (v2di)
16859 v16qi __builtin_ia32_pbroadcastb128 (v16qi)
16860 v8hi __builtin_ia32_pbroadcastw128 (v8hi)
16861 v4si __builtin_ia32_pbroadcastd128 (v4si)
16862 v2di __builtin_ia32_pbroadcastq128 (v2di)
16863 v8si __builtin_ia32_permvarsi256 (v8si,v8si)
16864 v4df __builtin_ia32_permdf256 (v4df,int)
16865 v8sf __builtin_ia32_permvarsf256 (v8sf,v8sf)
16866 v4di __builtin_ia32_permdi256 (v4di,int)
16867 v4di __builtin_ia32_permti256 (v4di,v4di,int)
16868 v4di __builtin_ia32_extract128i256 (v4di,int)
16869 v4di __builtin_ia32_insert128i256 (v4di,v2di,int)
16870 v8si __builtin_ia32_maskloadd256 (pcv8si,v8si)
16871 v4di __builtin_ia32_maskloadq256 (pcv4di,v4di)
16872 v4si __builtin_ia32_maskloadd (pcv4si,v4si)
16873 v2di __builtin_ia32_maskloadq (pcv2di,v2di)
16874 void __builtin_ia32_maskstored256 (pv8si,v8si,v8si)
16875 void __builtin_ia32_maskstoreq256 (pv4di,v4di,v4di)
16876 void __builtin_ia32_maskstored (pv4si,v4si,v4si)
16877 void __builtin_ia32_maskstoreq (pv2di,v2di,v2di)
16878 v8si __builtin_ia32_psllv8si (v8si,v8si)
16879 v4si __builtin_ia32_psllv4si (v4si,v4si)
16880 v4di __builtin_ia32_psllv4di (v4di,v4di)
16881 v2di __builtin_ia32_psllv2di (v2di,v2di)
16882 v8si __builtin_ia32_psrav8si (v8si,v8si)
16883 v4si __builtin_ia32_psrav4si (v4si,v4si)
16884 v8si __builtin_ia32_psrlv8si (v8si,v8si)
16885 v4si __builtin_ia32_psrlv4si (v4si,v4si)
16886 v4di __builtin_ia32_psrlv4di (v4di,v4di)
16887 v2di __builtin_ia32_psrlv2di (v2di,v2di)
16888 v2df __builtin_ia32_gathersiv2df (v2df, pcdouble,v4si,v2df,int)
16889 v4df __builtin_ia32_gathersiv4df (v4df, pcdouble,v4si,v4df,int)
16890 v2df __builtin_ia32_gatherdiv2df (v2df, pcdouble,v2di,v2df,int)
16891 v4df __builtin_ia32_gatherdiv4df (v4df, pcdouble,v4di,v4df,int)
16892 v4sf __builtin_ia32_gathersiv4sf (v4sf, pcfloat,v4si,v4sf,int)
16893 v8sf __builtin_ia32_gathersiv8sf (v8sf, pcfloat,v8si,v8sf,int)
16894 v4sf __builtin_ia32_gatherdiv4sf (v4sf, pcfloat,v2di,v4sf,int)
16895 v4sf __builtin_ia32_gatherdiv4sf256 (v4sf, pcfloat,v4di,v4sf,int)
16896 v2di __builtin_ia32_gathersiv2di (v2di, pcint64,v4si,v2di,int)
16897 v4di __builtin_ia32_gathersiv4di (v4di, pcint64,v4si,v4di,int)
16898 v2di __builtin_ia32_gatherdiv2di (v2di, pcint64,v2di,v2di,int)
16899 v4di __builtin_ia32_gatherdiv4di (v4di, pcint64,v4di,v4di,int)
16900 v4si __builtin_ia32_gathersiv4si (v4si, pcint,v4si,v4si,int)
16901 v8si __builtin_ia32_gathersiv8si (v8si, pcint,v8si,v8si,int)
16902 v4si __builtin_ia32_gatherdiv4si (v4si, pcint,v2di,v4si,int)
16903 v4si __builtin_ia32_gatherdiv4si256 (v4si, pcint,v4di,v4si,int)
16904 @end smallexample
16905
16906 The following built-in functions are available when @option{-maes} is
16907 used.  All of them generate the machine instruction that is part of the
16908 name.
16909
16910 @smallexample
16911 v2di __builtin_ia32_aesenc128 (v2di, v2di)
16912 v2di __builtin_ia32_aesenclast128 (v2di, v2di)
16913 v2di __builtin_ia32_aesdec128 (v2di, v2di)
16914 v2di __builtin_ia32_aesdeclast128 (v2di, v2di)
16915 v2di __builtin_ia32_aeskeygenassist128 (v2di, const int)
16916 v2di __builtin_ia32_aesimc128 (v2di)
16917 @end smallexample
16918
16919 The following built-in function is available when @option{-mpclmul} is
16920 used.
16921
16922 @table @code
16923 @item v2di __builtin_ia32_pclmulqdq128 (v2di, v2di, const int)
16924 Generates the @code{pclmulqdq} machine instruction.
16925 @end table
16926
16927 The following built-in function is available when @option{-mfsgsbase} is
16928 used.  All of them generate the machine instruction that is part of the
16929 name.
16930
16931 @smallexample
16932 unsigned int __builtin_ia32_rdfsbase32 (void)
16933 unsigned long long __builtin_ia32_rdfsbase64 (void)
16934 unsigned int __builtin_ia32_rdgsbase32 (void)
16935 unsigned long long __builtin_ia32_rdgsbase64 (void)
16936 void _writefsbase_u32 (unsigned int)
16937 void _writefsbase_u64 (unsigned long long)
16938 void _writegsbase_u32 (unsigned int)
16939 void _writegsbase_u64 (unsigned long long)
16940 @end smallexample
16941
16942 The following built-in function is available when @option{-mrdrnd} is
16943 used.  All of them generate the machine instruction that is part of the
16944 name.
16945
16946 @smallexample
16947 unsigned int __builtin_ia32_rdrand16_step (unsigned short *)
16948 unsigned int __builtin_ia32_rdrand32_step (unsigned int *)
16949 unsigned int __builtin_ia32_rdrand64_step (unsigned long long *)
16950 @end smallexample
16951
16952 The following built-in functions are available when @option{-msse4a} is used.
16953 All of them generate the machine instruction that is part of the name.
16954
16955 @smallexample
16956 void __builtin_ia32_movntsd (double *, v2df)
16957 void __builtin_ia32_movntss (float *, v4sf)
16958 v2di __builtin_ia32_extrq  (v2di, v16qi)
16959 v2di __builtin_ia32_extrqi (v2di, const unsigned int, const unsigned int)
16960 v2di __builtin_ia32_insertq (v2di, v2di)
16961 v2di __builtin_ia32_insertqi (v2di, v2di, const unsigned int, const unsigned int)
16962 @end smallexample
16963
16964 The following built-in functions are available when @option{-mxop} is used.
16965 @smallexample
16966 v2df __builtin_ia32_vfrczpd (v2df)
16967 v4sf __builtin_ia32_vfrczps (v4sf)
16968 v2df __builtin_ia32_vfrczsd (v2df)
16969 v4sf __builtin_ia32_vfrczss (v4sf)
16970 v4df __builtin_ia32_vfrczpd256 (v4df)
16971 v8sf __builtin_ia32_vfrczps256 (v8sf)
16972 v2di __builtin_ia32_vpcmov (v2di, v2di, v2di)
16973 v2di __builtin_ia32_vpcmov_v2di (v2di, v2di, v2di)
16974 v4si __builtin_ia32_vpcmov_v4si (v4si, v4si, v4si)
16975 v8hi __builtin_ia32_vpcmov_v8hi (v8hi, v8hi, v8hi)
16976 v16qi __builtin_ia32_vpcmov_v16qi (v16qi, v16qi, v16qi)
16977 v2df __builtin_ia32_vpcmov_v2df (v2df, v2df, v2df)
16978 v4sf __builtin_ia32_vpcmov_v4sf (v4sf, v4sf, v4sf)
16979 v4di __builtin_ia32_vpcmov_v4di256 (v4di, v4di, v4di)
16980 v8si __builtin_ia32_vpcmov_v8si256 (v8si, v8si, v8si)
16981 v16hi __builtin_ia32_vpcmov_v16hi256 (v16hi, v16hi, v16hi)
16982 v32qi __builtin_ia32_vpcmov_v32qi256 (v32qi, v32qi, v32qi)
16983 v4df __builtin_ia32_vpcmov_v4df256 (v4df, v4df, v4df)
16984 v8sf __builtin_ia32_vpcmov_v8sf256 (v8sf, v8sf, v8sf)
16985 v16qi __builtin_ia32_vpcomeqb (v16qi, v16qi)
16986 v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi)
16987 v4si __builtin_ia32_vpcomeqd (v4si, v4si)
16988 v2di __builtin_ia32_vpcomeqq (v2di, v2di)
16989 v16qi __builtin_ia32_vpcomequb (v16qi, v16qi)
16990 v4si __builtin_ia32_vpcomequd (v4si, v4si)
16991 v2di __builtin_ia32_vpcomequq (v2di, v2di)
16992 v8hi __builtin_ia32_vpcomequw (v8hi, v8hi)
16993 v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi)
16994 v16qi __builtin_ia32_vpcomfalseb (v16qi, v16qi)
16995 v4si __builtin_ia32_vpcomfalsed (v4si, v4si)
16996 v2di __builtin_ia32_vpcomfalseq (v2di, v2di)
16997 v16qi __builtin_ia32_vpcomfalseub (v16qi, v16qi)
16998 v4si __builtin_ia32_vpcomfalseud (v4si, v4si)
16999 v2di __builtin_ia32_vpcomfalseuq (v2di, v2di)
17000 v8hi __builtin_ia32_vpcomfalseuw (v8hi, v8hi)
17001 v8hi __builtin_ia32_vpcomfalsew (v8hi, v8hi)
17002 v16qi __builtin_ia32_vpcomgeb (v16qi, v16qi)
17003 v4si __builtin_ia32_vpcomged (v4si, v4si)
17004 v2di __builtin_ia32_vpcomgeq (v2di, v2di)
17005 v16qi __builtin_ia32_vpcomgeub (v16qi, v16qi)
17006 v4si __builtin_ia32_vpcomgeud (v4si, v4si)
17007 v2di __builtin_ia32_vpcomgeuq (v2di, v2di)
17008 v8hi __builtin_ia32_vpcomgeuw (v8hi, v8hi)
17009 v8hi __builtin_ia32_vpcomgew (v8hi, v8hi)
17010 v16qi __builtin_ia32_vpcomgtb (v16qi, v16qi)
17011 v4si __builtin_ia32_vpcomgtd (v4si, v4si)
17012 v2di __builtin_ia32_vpcomgtq (v2di, v2di)
17013 v16qi __builtin_ia32_vpcomgtub (v16qi, v16qi)
17014 v4si __builtin_ia32_vpcomgtud (v4si, v4si)
17015 v2di __builtin_ia32_vpcomgtuq (v2di, v2di)
17016 v8hi __builtin_ia32_vpcomgtuw (v8hi, v8hi)
17017 v8hi __builtin_ia32_vpcomgtw (v8hi, v8hi)
17018 v16qi __builtin_ia32_vpcomleb (v16qi, v16qi)
17019 v4si __builtin_ia32_vpcomled (v4si, v4si)
17020 v2di __builtin_ia32_vpcomleq (v2di, v2di)
17021 v16qi __builtin_ia32_vpcomleub (v16qi, v16qi)
17022 v4si __builtin_ia32_vpcomleud (v4si, v4si)
17023 v2di __builtin_ia32_vpcomleuq (v2di, v2di)
17024 v8hi __builtin_ia32_vpcomleuw (v8hi, v8hi)
17025 v8hi __builtin_ia32_vpcomlew (v8hi, v8hi)
17026 v16qi __builtin_ia32_vpcomltb (v16qi, v16qi)
17027 v4si __builtin_ia32_vpcomltd (v4si, v4si)
17028 v2di __builtin_ia32_vpcomltq (v2di, v2di)
17029 v16qi __builtin_ia32_vpcomltub (v16qi, v16qi)
17030 v4si __builtin_ia32_vpcomltud (v4si, v4si)
17031 v2di __builtin_ia32_vpcomltuq (v2di, v2di)
17032 v8hi __builtin_ia32_vpcomltuw (v8hi, v8hi)
17033 v8hi __builtin_ia32_vpcomltw (v8hi, v8hi)
17034 v16qi __builtin_ia32_vpcomneb (v16qi, v16qi)
17035 v4si __builtin_ia32_vpcomned (v4si, v4si)
17036 v2di __builtin_ia32_vpcomneq (v2di, v2di)
17037 v16qi __builtin_ia32_vpcomneub (v16qi, v16qi)
17038 v4si __builtin_ia32_vpcomneud (v4si, v4si)
17039 v2di __builtin_ia32_vpcomneuq (v2di, v2di)
17040 v8hi __builtin_ia32_vpcomneuw (v8hi, v8hi)
17041 v8hi __builtin_ia32_vpcomnew (v8hi, v8hi)
17042 v16qi __builtin_ia32_vpcomtrueb (v16qi, v16qi)
17043 v4si __builtin_ia32_vpcomtrued (v4si, v4si)
17044 v2di __builtin_ia32_vpcomtrueq (v2di, v2di)
17045 v16qi __builtin_ia32_vpcomtrueub (v16qi, v16qi)
17046 v4si __builtin_ia32_vpcomtrueud (v4si, v4si)
17047 v2di __builtin_ia32_vpcomtrueuq (v2di, v2di)
17048 v8hi __builtin_ia32_vpcomtrueuw (v8hi, v8hi)
17049 v8hi __builtin_ia32_vpcomtruew (v8hi, v8hi)
17050 v4si __builtin_ia32_vphaddbd (v16qi)
17051 v2di __builtin_ia32_vphaddbq (v16qi)
17052 v8hi __builtin_ia32_vphaddbw (v16qi)
17053 v2di __builtin_ia32_vphadddq (v4si)
17054 v4si __builtin_ia32_vphaddubd (v16qi)
17055 v2di __builtin_ia32_vphaddubq (v16qi)
17056 v8hi __builtin_ia32_vphaddubw (v16qi)
17057 v2di __builtin_ia32_vphaddudq (v4si)
17058 v4si __builtin_ia32_vphadduwd (v8hi)
17059 v2di __builtin_ia32_vphadduwq (v8hi)
17060 v4si __builtin_ia32_vphaddwd (v8hi)
17061 v2di __builtin_ia32_vphaddwq (v8hi)
17062 v8hi __builtin_ia32_vphsubbw (v16qi)
17063 v2di __builtin_ia32_vphsubdq (v4si)
17064 v4si __builtin_ia32_vphsubwd (v8hi)
17065 v4si __builtin_ia32_vpmacsdd (v4si, v4si, v4si)
17066 v2di __builtin_ia32_vpmacsdqh (v4si, v4si, v2di)
17067 v2di __builtin_ia32_vpmacsdql (v4si, v4si, v2di)
17068 v4si __builtin_ia32_vpmacssdd (v4si, v4si, v4si)
17069 v2di __builtin_ia32_vpmacssdqh (v4si, v4si, v2di)
17070 v2di __builtin_ia32_vpmacssdql (v4si, v4si, v2di)
17071 v4si __builtin_ia32_vpmacsswd (v8hi, v8hi, v4si)
17072 v8hi __builtin_ia32_vpmacssww (v8hi, v8hi, v8hi)
17073 v4si __builtin_ia32_vpmacswd (v8hi, v8hi, v4si)
17074 v8hi __builtin_ia32_vpmacsww (v8hi, v8hi, v8hi)
17075 v4si __builtin_ia32_vpmadcsswd (v8hi, v8hi, v4si)
17076 v4si __builtin_ia32_vpmadcswd (v8hi, v8hi, v4si)
17077 v16qi __builtin_ia32_vpperm (v16qi, v16qi, v16qi)
17078 v16qi __builtin_ia32_vprotb (v16qi, v16qi)
17079 v4si __builtin_ia32_vprotd (v4si, v4si)
17080 v2di __builtin_ia32_vprotq (v2di, v2di)
17081 v8hi __builtin_ia32_vprotw (v8hi, v8hi)
17082 v16qi __builtin_ia32_vpshab (v16qi, v16qi)
17083 v4si __builtin_ia32_vpshad (v4si, v4si)
17084 v2di __builtin_ia32_vpshaq (v2di, v2di)
17085 v8hi __builtin_ia32_vpshaw (v8hi, v8hi)
17086 v16qi __builtin_ia32_vpshlb (v16qi, v16qi)
17087 v4si __builtin_ia32_vpshld (v4si, v4si)
17088 v2di __builtin_ia32_vpshlq (v2di, v2di)
17089 v8hi __builtin_ia32_vpshlw (v8hi, v8hi)
17090 @end smallexample
17091
17092 The following built-in functions are available when @option{-mfma4} is used.
17093 All of them generate the machine instruction that is part of the name.
17094
17095 @smallexample
17096 v2df __builtin_ia32_vfmaddpd (v2df, v2df, v2df)
17097 v4sf __builtin_ia32_vfmaddps (v4sf, v4sf, v4sf)
17098 v2df __builtin_ia32_vfmaddsd (v2df, v2df, v2df)
17099 v4sf __builtin_ia32_vfmaddss (v4sf, v4sf, v4sf)
17100 v2df __builtin_ia32_vfmsubpd (v2df, v2df, v2df)
17101 v4sf __builtin_ia32_vfmsubps (v4sf, v4sf, v4sf)
17102 v2df __builtin_ia32_vfmsubsd (v2df, v2df, v2df)
17103 v4sf __builtin_ia32_vfmsubss (v4sf, v4sf, v4sf)
17104 v2df __builtin_ia32_vfnmaddpd (v2df, v2df, v2df)
17105 v4sf __builtin_ia32_vfnmaddps (v4sf, v4sf, v4sf)
17106 v2df __builtin_ia32_vfnmaddsd (v2df, v2df, v2df)
17107 v4sf __builtin_ia32_vfnmaddss (v4sf, v4sf, v4sf)
17108 v2df __builtin_ia32_vfnmsubpd (v2df, v2df, v2df)
17109 v4sf __builtin_ia32_vfnmsubps (v4sf, v4sf, v4sf)
17110 v2df __builtin_ia32_vfnmsubsd (v2df, v2df, v2df)
17111 v4sf __builtin_ia32_vfnmsubss (v4sf, v4sf, v4sf)
17112 v2df __builtin_ia32_vfmaddsubpd  (v2df, v2df, v2df)
17113 v4sf __builtin_ia32_vfmaddsubps  (v4sf, v4sf, v4sf)
17114 v2df __builtin_ia32_vfmsubaddpd  (v2df, v2df, v2df)
17115 v4sf __builtin_ia32_vfmsubaddps  (v4sf, v4sf, v4sf)
17116 v4df __builtin_ia32_vfmaddpd256 (v4df, v4df, v4df)
17117 v8sf __builtin_ia32_vfmaddps256 (v8sf, v8sf, v8sf)
17118 v4df __builtin_ia32_vfmsubpd256 (v4df, v4df, v4df)
17119 v8sf __builtin_ia32_vfmsubps256 (v8sf, v8sf, v8sf)
17120 v4df __builtin_ia32_vfnmaddpd256 (v4df, v4df, v4df)
17121 v8sf __builtin_ia32_vfnmaddps256 (v8sf, v8sf, v8sf)
17122 v4df __builtin_ia32_vfnmsubpd256 (v4df, v4df, v4df)
17123 v8sf __builtin_ia32_vfnmsubps256 (v8sf, v8sf, v8sf)
17124 v4df __builtin_ia32_vfmaddsubpd256 (v4df, v4df, v4df)
17125 v8sf __builtin_ia32_vfmaddsubps256 (v8sf, v8sf, v8sf)
17126 v4df __builtin_ia32_vfmsubaddpd256 (v4df, v4df, v4df)
17127 v8sf __builtin_ia32_vfmsubaddps256 (v8sf, v8sf, v8sf)
17128
17129 @end smallexample
17130
17131 The following built-in functions are available when @option{-mlwp} is used.
17132
17133 @smallexample
17134 void __builtin_ia32_llwpcb16 (void *);
17135 void __builtin_ia32_llwpcb32 (void *);
17136 void __builtin_ia32_llwpcb64 (void *);
17137 void * __builtin_ia32_llwpcb16 (void);
17138 void * __builtin_ia32_llwpcb32 (void);
17139 void * __builtin_ia32_llwpcb64 (void);
17140 void __builtin_ia32_lwpval16 (unsigned short, unsigned int, unsigned short)
17141 void __builtin_ia32_lwpval32 (unsigned int, unsigned int, unsigned int)
17142 void __builtin_ia32_lwpval64 (unsigned __int64, unsigned int, unsigned int)
17143 unsigned char __builtin_ia32_lwpins16 (unsigned short, unsigned int, unsigned short)
17144 unsigned char __builtin_ia32_lwpins32 (unsigned int, unsigned int, unsigned int)
17145 unsigned char __builtin_ia32_lwpins64 (unsigned __int64, unsigned int, unsigned int)
17146 @end smallexample
17147
17148 The following built-in functions are available when @option{-mbmi} is used.
17149 All of them generate the machine instruction that is part of the name.
17150 @smallexample
17151 unsigned int __builtin_ia32_bextr_u32(unsigned int, unsigned int);
17152 unsigned long long __builtin_ia32_bextr_u64 (unsigned long long, unsigned long long);
17153 @end smallexample
17154
17155 The following built-in functions are available when @option{-mbmi2} is used.
17156 All of them generate the machine instruction that is part of the name.
17157 @smallexample
17158 unsigned int _bzhi_u32 (unsigned int, unsigned int)
17159 unsigned int _pdep_u32 (unsigned int, unsigned int)
17160 unsigned int _pext_u32 (unsigned int, unsigned int)
17161 unsigned long long _bzhi_u64 (unsigned long long, unsigned long long)
17162 unsigned long long _pdep_u64 (unsigned long long, unsigned long long)
17163 unsigned long long _pext_u64 (unsigned long long, unsigned long long)
17164 @end smallexample
17165
17166 The following built-in functions are available when @option{-mlzcnt} is used.
17167 All of them generate the machine instruction that is part of the name.
17168 @smallexample
17169 unsigned short __builtin_ia32_lzcnt_16(unsigned short);
17170 unsigned int __builtin_ia32_lzcnt_u32(unsigned int);
17171 unsigned long long __builtin_ia32_lzcnt_u64 (unsigned long long);
17172 @end smallexample
17173
17174 The following built-in functions are available when @option{-mfxsr} is used.
17175 All of them generate the machine instruction that is part of the name.
17176 @smallexample
17177 void __builtin_ia32_fxsave (void *)
17178 void __builtin_ia32_fxrstor (void *)
17179 void __builtin_ia32_fxsave64 (void *)
17180 void __builtin_ia32_fxrstor64 (void *)
17181 @end smallexample
17182
17183 The following built-in functions are available when @option{-mxsave} is used.
17184 All of them generate the machine instruction that is part of the name.
17185 @smallexample
17186 void __builtin_ia32_xsave (void *, long long)
17187 void __builtin_ia32_xrstor (void *, long long)
17188 void __builtin_ia32_xsave64 (void *, long long)
17189 void __builtin_ia32_xrstor64 (void *, long long)
17190 @end smallexample
17191
17192 The following built-in functions are available when @option{-mxsaveopt} is used.
17193 All of them generate the machine instruction that is part of the name.
17194 @smallexample
17195 void __builtin_ia32_xsaveopt (void *, long long)
17196 void __builtin_ia32_xsaveopt64 (void *, long long)
17197 @end smallexample
17198
17199 The following built-in functions are available when @option{-mtbm} is used.
17200 Both of them generate the immediate form of the bextr machine instruction.
17201 @smallexample
17202 unsigned int __builtin_ia32_bextri_u32 (unsigned int, const unsigned int);
17203 unsigned long long __builtin_ia32_bextri_u64 (unsigned long long, const unsigned long long);
17204 @end smallexample
17205
17206
17207 The following built-in functions are available when @option{-m3dnow} is used.
17208 All of them generate the machine instruction that is part of the name.
17209
17210 @smallexample
17211 void __builtin_ia32_femms (void)
17212 v8qi __builtin_ia32_pavgusb (v8qi, v8qi)
17213 v2si __builtin_ia32_pf2id (v2sf)
17214 v2sf __builtin_ia32_pfacc (v2sf, v2sf)
17215 v2sf __builtin_ia32_pfadd (v2sf, v2sf)
17216 v2si __builtin_ia32_pfcmpeq (v2sf, v2sf)
17217 v2si __builtin_ia32_pfcmpge (v2sf, v2sf)
17218 v2si __builtin_ia32_pfcmpgt (v2sf, v2sf)
17219 v2sf __builtin_ia32_pfmax (v2sf, v2sf)
17220 v2sf __builtin_ia32_pfmin (v2sf, v2sf)
17221 v2sf __builtin_ia32_pfmul (v2sf, v2sf)
17222 v2sf __builtin_ia32_pfrcp (v2sf)
17223 v2sf __builtin_ia32_pfrcpit1 (v2sf, v2sf)
17224 v2sf __builtin_ia32_pfrcpit2 (v2sf, v2sf)
17225 v2sf __builtin_ia32_pfrsqrt (v2sf)
17226 v2sf __builtin_ia32_pfsub (v2sf, v2sf)
17227 v2sf __builtin_ia32_pfsubr (v2sf, v2sf)
17228 v2sf __builtin_ia32_pi2fd (v2si)
17229 v4hi __builtin_ia32_pmulhrw (v4hi, v4hi)
17230 @end smallexample
17231
17232 The following built-in functions are available when both @option{-m3dnow}
17233 and @option{-march=athlon} are used.  All of them generate the machine
17234 instruction that is part of the name.
17235
17236 @smallexample
17237 v2si __builtin_ia32_pf2iw (v2sf)
17238 v2sf __builtin_ia32_pfnacc (v2sf, v2sf)
17239 v2sf __builtin_ia32_pfpnacc (v2sf, v2sf)
17240 v2sf __builtin_ia32_pi2fw (v2si)
17241 v2sf __builtin_ia32_pswapdsf (v2sf)
17242 v2si __builtin_ia32_pswapdsi (v2si)
17243 @end smallexample
17244
17245 The following built-in functions are available when @option{-mrtm} is used
17246 They are used for restricted transactional memory. These are the internal
17247 low level functions. Normally the functions in 
17248 @ref{x86 transactional memory intrinsics} should be used instead.
17249
17250 @smallexample
17251 int __builtin_ia32_xbegin ()
17252 void __builtin_ia32_xend ()
17253 void __builtin_ia32_xabort (status)
17254 int __builtin_ia32_xtest ()
17255 @end smallexample
17256
17257 @node x86 transactional memory intrinsics
17258 @subsection x86 transaction memory intrinsics
17259
17260 Hardware transactional memory intrinsics for x86. These allow to use
17261 memory transactions with RTM (Restricted Transactional Memory).
17262 For using HLE (Hardware Lock Elision) see @ref{x86 specific memory model extensions for transactional memory} instead.
17263 This support is enabled with the @option{-mrtm} option.
17264
17265 A memory transaction commits all changes to memory in an atomic way,
17266 as visible to other threads. If the transaction fails it is rolled back
17267 and all side effects discarded.
17268
17269 Generally there is no guarantee that a memory transaction ever succeeds
17270 and suitable fallback code always needs to be supplied.
17271
17272 @deftypefn {RTM Function} {unsigned} _xbegin ()
17273 Start a RTM (Restricted Transactional Memory) transaction. 
17274 Returns _XBEGIN_STARTED when the transaction
17275 started successfully (note this is not 0, so the constant has to be 
17276 explicitely tested). When the transaction aborts all side effects
17277 are undone and an abort code is returned. There is no guarantee
17278 any transaction ever succeeds, so there always needs to be a valid
17279 tested fallback path.
17280 @end deftypefn
17281
17282 @smallexample
17283 #include <immintrin.h>
17284
17285 if ((status = _xbegin ()) == _XBEGIN_STARTED) @{
17286     ... transaction code...
17287     _xend ();
17288 @} else @{
17289     ... non transactional fallback path...
17290 @}
17291 @end smallexample
17292
17293 Valid abort status bits (when the value is not @code{_XBEGIN_STARTED}) are:
17294
17295 @table @code
17296 @item _XABORT_EXPLICIT
17297 Transaction explicitely aborted with @code{_xabort}. The parameter passed
17298 to @code{_xabort} is available with @code{_XABORT_CODE(status)}
17299 @item _XABORT_RETRY
17300 Transaction retry is possible.
17301 @item _XABORT_CONFLICT
17302 Transaction abort due to a memory conflict with another thread
17303 @item _XABORT_CAPACITY
17304 Transaction abort due to the transaction using too much memory
17305 @item _XABORT_DEBUG
17306 Transaction abort due to a debug trap
17307 @item _XABORT_NESTED
17308 Transaction abort in a inner nested transaction
17309 @end table
17310
17311 @deftypefn {RTM Function} {void} _xend ()
17312 Commit the current transaction. When no transaction is active this will
17313 fault. All memory side effects of the transactions will become visible
17314 to other threads in an atomic matter.
17315 @end deftypefn
17316
17317 @deftypefn {RTM Function} {int} _xtest ()
17318 Return a value not zero when a transaction is currently active, otherwise 0.
17319 @end deftypefn
17320
17321 @deftypefn {RTM Function} {void} _xabort (status)
17322 Abort the current transaction. When no transaction is active this is a no-op.
17323 status must be a 8bit constant, that is included in the status code returned
17324 by @code{_xbegin}
17325 @end deftypefn
17326
17327 @node Target Format Checks
17328 @section Format Checks Specific to Particular Target Machines
17329
17330 For some target machines, GCC supports additional options to the
17331 format attribute
17332 (@pxref{Function Attributes,,Declaring Attributes of Functions}).
17333
17334 @menu
17335 * Solaris Format Checks::
17336 * Darwin Format Checks::
17337 @end menu
17338
17339 @node Solaris Format Checks
17340 @subsection Solaris Format Checks
17341
17342 Solaris targets support the @code{cmn_err} (or @code{__cmn_err__}) format
17343 check.  @code{cmn_err} accepts a subset of the standard @code{printf}
17344 conversions, and the two-argument @code{%b} conversion for displaying
17345 bit-fields.  See the Solaris man page for @code{cmn_err} for more information.
17346
17347 @node Darwin Format Checks
17348 @subsection Darwin Format Checks
17349
17350 Darwin targets support the @code{CFString} (or @code{__CFString__}) in the format
17351 attribute context.  Declarations made with such attribution are parsed for correct syntax
17352 and format argument types.  However, parsing of the format string itself is currently undefined
17353 and is not carried out by this version of the compiler.
17354
17355 Additionally, @code{CFStringRefs} (defined by the @code{CoreFoundation} headers) may
17356 also be used as format arguments.  Note that the relevant headers are only likely to be
17357 available on Darwin (OSX) installations.  On such installations, the XCode and system
17358 documentation provide descriptions of @code{CFString}, @code{CFStringRefs} and
17359 associated functions.
17360
17361 @node Pragmas
17362 @section Pragmas Accepted by GCC
17363 @cindex pragmas
17364 @cindex @code{#pragma}
17365
17366 GCC supports several types of pragmas, primarily in order to compile
17367 code originally written for other compilers.  Note that in general
17368 we do not recommend the use of pragmas; @xref{Function Attributes},
17369 for further explanation.
17370
17371 @menu
17372 * ARM Pragmas::
17373 * M32C Pragmas::
17374 * MeP Pragmas::
17375 * RS/6000 and PowerPC Pragmas::
17376 * Darwin Pragmas::
17377 * Solaris Pragmas::
17378 * Symbol-Renaming Pragmas::
17379 * Structure-Packing Pragmas::
17380 * Weak Pragmas::
17381 * Diagnostic Pragmas::
17382 * Visibility Pragmas::
17383 * Push/Pop Macro Pragmas::
17384 * Function Specific Option Pragmas::
17385 * Loop-Specific Pragmas::
17386 @end menu
17387
17388 @node ARM Pragmas
17389 @subsection ARM Pragmas
17390
17391 The ARM target defines pragmas for controlling the default addition of
17392 @code{long_call} and @code{short_call} attributes to functions.
17393 @xref{Function Attributes}, for information about the effects of these
17394 attributes.
17395
17396 @table @code
17397 @item long_calls
17398 @cindex pragma, long_calls
17399 Set all subsequent functions to have the @code{long_call} attribute.
17400
17401 @item no_long_calls
17402 @cindex pragma, no_long_calls
17403 Set all subsequent functions to have the @code{short_call} attribute.
17404
17405 @item long_calls_off
17406 @cindex pragma, long_calls_off
17407 Do not affect the @code{long_call} or @code{short_call} attributes of
17408 subsequent functions.
17409 @end table
17410
17411 @node M32C Pragmas
17412 @subsection M32C Pragmas
17413
17414 @table @code
17415 @item GCC memregs @var{number}
17416 @cindex pragma, memregs
17417 Overrides the command-line option @code{-memregs=} for the current
17418 file.  Use with care!  This pragma must be before any function in the
17419 file, and mixing different memregs values in different objects may
17420 make them incompatible.  This pragma is useful when a
17421 performance-critical function uses a memreg for temporary values,
17422 as it may allow you to reduce the number of memregs used.
17423
17424 @item ADDRESS @var{name} @var{address}
17425 @cindex pragma, address
17426 For any declared symbols matching @var{name}, this does three things
17427 to that symbol: it forces the symbol to be located at the given
17428 address (a number), it forces the symbol to be volatile, and it
17429 changes the symbol's scope to be static.  This pragma exists for
17430 compatibility with other compilers, but note that the common
17431 @code{1234H} numeric syntax is not supported (use @code{0x1234}
17432 instead).  Example:
17433
17434 @smallexample
17435 #pragma ADDRESS port3 0x103
17436 char port3;
17437 @end smallexample
17438
17439 @end table
17440
17441 @node MeP Pragmas
17442 @subsection MeP Pragmas
17443
17444 @table @code
17445
17446 @item custom io_volatile (on|off)
17447 @cindex pragma, custom io_volatile
17448 Overrides the command-line option @code{-mio-volatile} for the current
17449 file.  Note that for compatibility with future GCC releases, this
17450 option should only be used once before any @code{io} variables in each
17451 file.
17452
17453 @item GCC coprocessor available @var{registers}
17454 @cindex pragma, coprocessor available
17455 Specifies which coprocessor registers are available to the register
17456 allocator.  @var{registers} may be a single register, register range
17457 separated by ellipses, or comma-separated list of those.  Example:
17458
17459 @smallexample
17460 #pragma GCC coprocessor available $c0...$c10, $c28
17461 @end smallexample
17462
17463 @item GCC coprocessor call_saved @var{registers}
17464 @cindex pragma, coprocessor call_saved
17465 Specifies which coprocessor registers are to be saved and restored by
17466 any function using them.  @var{registers} may be a single register,
17467 register range separated by ellipses, or comma-separated list of
17468 those.  Example:
17469
17470 @smallexample
17471 #pragma GCC coprocessor call_saved $c4...$c6, $c31
17472 @end smallexample
17473
17474 @item GCC coprocessor subclass '(A|B|C|D)' = @var{registers}
17475 @cindex pragma, coprocessor subclass
17476 Creates and defines a register class.  These register classes can be
17477 used by inline @code{asm} constructs.  @var{registers} may be a single
17478 register, register range separated by ellipses, or comma-separated
17479 list of those.  Example:
17480
17481 @smallexample
17482 #pragma GCC coprocessor subclass 'B' = $c2, $c4, $c6
17483
17484 asm ("cpfoo %0" : "=B" (x));
17485 @end smallexample
17486
17487 @item GCC disinterrupt @var{name} , @var{name} @dots{}
17488 @cindex pragma, disinterrupt
17489 For the named functions, the compiler adds code to disable interrupts
17490 for the duration of those functions.  If any functions so named 
17491 are not encountered in the source, a warning is emitted that the pragma is
17492 not used.  Examples:
17493
17494 @smallexample
17495 #pragma disinterrupt foo
17496 #pragma disinterrupt bar, grill
17497 int foo () @{ @dots{} @}
17498 @end smallexample
17499
17500 @item GCC call @var{name} , @var{name} @dots{}
17501 @cindex pragma, call
17502 For the named functions, the compiler always uses a register-indirect
17503 call model when calling the named functions.  Examples:
17504
17505 @smallexample
17506 extern int foo ();
17507 #pragma call foo
17508 @end smallexample
17509
17510 @end table
17511
17512 @node RS/6000 and PowerPC Pragmas
17513 @subsection RS/6000 and PowerPC Pragmas
17514
17515 The RS/6000 and PowerPC targets define one pragma for controlling
17516 whether or not the @code{longcall} attribute is added to function
17517 declarations by default.  This pragma overrides the @option{-mlongcall}
17518 option, but not the @code{longcall} and @code{shortcall} attributes.
17519 @xref{RS/6000 and PowerPC Options}, for more information about when long
17520 calls are and are not necessary.
17521
17522 @table @code
17523 @item longcall (1)
17524 @cindex pragma, longcall
17525 Apply the @code{longcall} attribute to all subsequent function
17526 declarations.
17527
17528 @item longcall (0)
17529 Do not apply the @code{longcall} attribute to subsequent function
17530 declarations.
17531 @end table
17532
17533 @c Describe h8300 pragmas here.
17534 @c Describe sh pragmas here.
17535 @c Describe v850 pragmas here.
17536
17537 @node Darwin Pragmas
17538 @subsection Darwin Pragmas
17539
17540 The following pragmas are available for all architectures running the
17541 Darwin operating system.  These are useful for compatibility with other
17542 Mac OS compilers.
17543
17544 @table @code
17545 @item mark @var{tokens}@dots{}
17546 @cindex pragma, mark
17547 This pragma is accepted, but has no effect.
17548
17549 @item options align=@var{alignment}
17550 @cindex pragma, options align
17551 This pragma sets the alignment of fields in structures.  The values of
17552 @var{alignment} may be @code{mac68k}, to emulate m68k alignment, or
17553 @code{power}, to emulate PowerPC alignment.  Uses of this pragma nest
17554 properly; to restore the previous setting, use @code{reset} for the
17555 @var{alignment}.
17556
17557 @item segment @var{tokens}@dots{}
17558 @cindex pragma, segment
17559 This pragma is accepted, but has no effect.
17560
17561 @item unused (@var{var} [, @var{var}]@dots{})
17562 @cindex pragma, unused
17563 This pragma declares variables to be possibly unused.  GCC does not
17564 produce warnings for the listed variables.  The effect is similar to
17565 that of the @code{unused} attribute, except that this pragma may appear
17566 anywhere within the variables' scopes.
17567 @end table
17568
17569 @node Solaris Pragmas
17570 @subsection Solaris Pragmas
17571
17572 The Solaris target supports @code{#pragma redefine_extname}
17573 (@pxref{Symbol-Renaming Pragmas}).  It also supports additional
17574 @code{#pragma} directives for compatibility with the system compiler.
17575
17576 @table @code
17577 @item align @var{alignment} (@var{variable} [, @var{variable}]...)
17578 @cindex pragma, align
17579
17580 Increase the minimum alignment of each @var{variable} to @var{alignment}.
17581 This is the same as GCC's @code{aligned} attribute @pxref{Variable
17582 Attributes}).  Macro expansion occurs on the arguments to this pragma
17583 when compiling C and Objective-C@.  It does not currently occur when
17584 compiling C++, but this is a bug which may be fixed in a future
17585 release.
17586
17587 @item fini (@var{function} [, @var{function}]...)
17588 @cindex pragma, fini
17589
17590 This pragma causes each listed @var{function} to be called after
17591 main, or during shared module unloading, by adding a call to the
17592 @code{.fini} section.
17593
17594 @item init (@var{function} [, @var{function}]...)
17595 @cindex pragma, init
17596
17597 This pragma causes each listed @var{function} to be called during
17598 initialization (before @code{main}) or during shared module loading, by
17599 adding a call to the @code{.init} section.
17600
17601 @end table
17602
17603 @node Symbol-Renaming Pragmas
17604 @subsection Symbol-Renaming Pragmas
17605
17606 GCC supports a @code{#pragma} directive that changes the name used in
17607 assembly for a given declaration. While this pragma is supported on all
17608 platforms, it is intended primarily to provide compatibility with the
17609 Solaris system headers. This effect can also be achieved using the asm
17610 labels extension (@pxref{Asm Labels}).
17611
17612 @table @code
17613 @item redefine_extname @var{oldname} @var{newname}
17614 @cindex pragma, redefine_extname
17615
17616 This pragma gives the C function @var{oldname} the assembly symbol
17617 @var{newname}.  The preprocessor macro @code{__PRAGMA_REDEFINE_EXTNAME}
17618 is defined if this pragma is available (currently on all platforms).
17619 @end table
17620
17621 This pragma and the asm labels extension interact in a complicated
17622 manner.  Here are some corner cases you may want to be aware of:
17623
17624 @enumerate
17625 @item This pragma silently applies only to declarations with external
17626 linkage.  Asm labels do not have this restriction.
17627
17628 @item In C++, this pragma silently applies only to declarations with
17629 ``C'' linkage.  Again, asm labels do not have this restriction.
17630
17631 @item If either of the ways of changing the assembly name of a
17632 declaration are applied to a declaration whose assembly name has
17633 already been determined (either by a previous use of one of these
17634 features, or because the compiler needed the assembly name in order to
17635 generate code), and the new name is different, a warning issues and
17636 the name does not change.
17637
17638 @item The @var{oldname} used by @code{#pragma redefine_extname} is
17639 always the C-language name.
17640 @end enumerate
17641
17642 @node Structure-Packing Pragmas
17643 @subsection Structure-Packing Pragmas
17644
17645 For compatibility with Microsoft Windows compilers, GCC supports a
17646 set of @code{#pragma} directives that change the maximum alignment of
17647 members of structures (other than zero-width bit-fields), unions, and
17648 classes subsequently defined. The @var{n} value below always is required
17649 to be a small power of two and specifies the new alignment in bytes.
17650
17651 @enumerate
17652 @item @code{#pragma pack(@var{n})} simply sets the new alignment.
17653 @item @code{#pragma pack()} sets the alignment to the one that was in
17654 effect when compilation started (see also command-line option
17655 @option{-fpack-struct[=@var{n}]} @pxref{Code Gen Options}).
17656 @item @code{#pragma pack(push[,@var{n}])} pushes the current alignment
17657 setting on an internal stack and then optionally sets the new alignment.
17658 @item @code{#pragma pack(pop)} restores the alignment setting to the one
17659 saved at the top of the internal stack (and removes that stack entry).
17660 Note that @code{#pragma pack([@var{n}])} does not influence this internal
17661 stack; thus it is possible to have @code{#pragma pack(push)} followed by
17662 multiple @code{#pragma pack(@var{n})} instances and finalized by a single
17663 @code{#pragma pack(pop)}.
17664 @end enumerate
17665
17666 Some targets, e.g.@: x86 and PowerPC, support the @code{ms_struct}
17667 @code{#pragma} which lays out a structure as the documented
17668 @code{__attribute__ ((ms_struct))}.
17669 @enumerate
17670 @item @code{#pragma ms_struct on} turns on the layout for structures
17671 declared.
17672 @item @code{#pragma ms_struct off} turns off the layout for structures
17673 declared.
17674 @item @code{#pragma ms_struct reset} goes back to the default layout.
17675 @end enumerate
17676
17677 @node Weak Pragmas
17678 @subsection Weak Pragmas
17679
17680 For compatibility with SVR4, GCC supports a set of @code{#pragma}
17681 directives for declaring symbols to be weak, and defining weak
17682 aliases.
17683
17684 @table @code
17685 @item #pragma weak @var{symbol}
17686 @cindex pragma, weak
17687 This pragma declares @var{symbol} to be weak, as if the declaration
17688 had the attribute of the same name.  The pragma may appear before
17689 or after the declaration of @var{symbol}.  It is not an error for
17690 @var{symbol} to never be defined at all.
17691
17692 @item #pragma weak @var{symbol1} = @var{symbol2}
17693 This pragma declares @var{symbol1} to be a weak alias of @var{symbol2}.
17694 It is an error if @var{symbol2} is not defined in the current
17695 translation unit.
17696 @end table
17697
17698 @node Diagnostic Pragmas
17699 @subsection Diagnostic Pragmas
17700
17701 GCC allows the user to selectively enable or disable certain types of
17702 diagnostics, and change the kind of the diagnostic.  For example, a
17703 project's policy might require that all sources compile with
17704 @option{-Werror} but certain files might have exceptions allowing
17705 specific types of warnings.  Or, a project might selectively enable
17706 diagnostics and treat them as errors depending on which preprocessor
17707 macros are defined.
17708
17709 @table @code
17710 @item #pragma GCC diagnostic @var{kind} @var{option}
17711 @cindex pragma, diagnostic
17712
17713 Modifies the disposition of a diagnostic.  Note that not all
17714 diagnostics are modifiable; at the moment only warnings (normally
17715 controlled by @samp{-W@dots{}}) can be controlled, and not all of them.
17716 Use @option{-fdiagnostics-show-option} to determine which diagnostics
17717 are controllable and which option controls them.
17718
17719 @var{kind} is @samp{error} to treat this diagnostic as an error,
17720 @samp{warning} to treat it like a warning (even if @option{-Werror} is
17721 in effect), or @samp{ignored} if the diagnostic is to be ignored.
17722 @var{option} is a double quoted string that matches the command-line
17723 option.
17724
17725 @smallexample
17726 #pragma GCC diagnostic warning "-Wformat"
17727 #pragma GCC diagnostic error "-Wformat"
17728 #pragma GCC diagnostic ignored "-Wformat"
17729 @end smallexample
17730
17731 Note that these pragmas override any command-line options.  GCC keeps
17732 track of the location of each pragma, and issues diagnostics according
17733 to the state as of that point in the source file.  Thus, pragmas occurring
17734 after a line do not affect diagnostics caused by that line.
17735
17736 @item #pragma GCC diagnostic push
17737 @itemx #pragma GCC diagnostic pop
17738
17739 Causes GCC to remember the state of the diagnostics as of each
17740 @code{push}, and restore to that point at each @code{pop}.  If a
17741 @code{pop} has no matching @code{push}, the command-line options are
17742 restored.
17743
17744 @smallexample
17745 #pragma GCC diagnostic error "-Wuninitialized"
17746   foo(a);                       /* error is given for this one */
17747 #pragma GCC diagnostic push
17748 #pragma GCC diagnostic ignored "-Wuninitialized"
17749   foo(b);                       /* no diagnostic for this one */
17750 #pragma GCC diagnostic pop
17751   foo(c);                       /* error is given for this one */
17752 #pragma GCC diagnostic pop
17753   foo(d);                       /* depends on command-line options */
17754 @end smallexample
17755
17756 @end table
17757
17758 GCC also offers a simple mechanism for printing messages during
17759 compilation.
17760
17761 @table @code
17762 @item #pragma message @var{string}
17763 @cindex pragma, diagnostic
17764
17765 Prints @var{string} as a compiler message on compilation.  The message
17766 is informational only, and is neither a compilation warning nor an error.
17767
17768 @smallexample
17769 #pragma message "Compiling " __FILE__ "..."
17770 @end smallexample
17771
17772 @var{string} may be parenthesized, and is printed with location
17773 information.  For example,
17774
17775 @smallexample
17776 #define DO_PRAGMA(x) _Pragma (#x)
17777 #define TODO(x) DO_PRAGMA(message ("TODO - " #x))
17778
17779 TODO(Remember to fix this)
17780 @end smallexample
17781
17782 @noindent
17783 prints @samp{/tmp/file.c:4: note: #pragma message:
17784 TODO - Remember to fix this}.
17785
17786 @end table
17787
17788 @node Visibility Pragmas
17789 @subsection Visibility Pragmas
17790
17791 @table @code
17792 @item #pragma GCC visibility push(@var{visibility})
17793 @itemx #pragma GCC visibility pop
17794 @cindex pragma, visibility
17795
17796 This pragma allows the user to set the visibility for multiple
17797 declarations without having to give each a visibility attribute
17798 (@pxref{Function Attributes}).
17799
17800 In C++, @samp{#pragma GCC visibility} affects only namespace-scope
17801 declarations.  Class members and template specializations are not
17802 affected; if you want to override the visibility for a particular
17803 member or instantiation, you must use an attribute.
17804
17805 @end table
17806
17807
17808 @node Push/Pop Macro Pragmas
17809 @subsection Push/Pop Macro Pragmas
17810
17811 For compatibility with Microsoft Windows compilers, GCC supports
17812 @samp{#pragma push_macro(@var{"macro_name"})}
17813 and @samp{#pragma pop_macro(@var{"macro_name"})}.
17814
17815 @table @code
17816 @item #pragma push_macro(@var{"macro_name"})
17817 @cindex pragma, push_macro
17818 This pragma saves the value of the macro named as @var{macro_name} to
17819 the top of the stack for this macro.
17820
17821 @item #pragma pop_macro(@var{"macro_name"})
17822 @cindex pragma, pop_macro
17823 This pragma sets the value of the macro named as @var{macro_name} to
17824 the value on top of the stack for this macro. If the stack for
17825 @var{macro_name} is empty, the value of the macro remains unchanged.
17826 @end table
17827
17828 For example:
17829
17830 @smallexample
17831 #define X  1
17832 #pragma push_macro("X")
17833 #undef X
17834 #define X -1
17835 #pragma pop_macro("X")
17836 int x [X];
17837 @end smallexample
17838
17839 @noindent
17840 In this example, the definition of X as 1 is saved by @code{#pragma
17841 push_macro} and restored by @code{#pragma pop_macro}.
17842
17843 @node Function Specific Option Pragmas
17844 @subsection Function Specific Option Pragmas
17845
17846 @table @code
17847 @item #pragma GCC target (@var{"string"}...)
17848 @cindex pragma GCC target
17849
17850 This pragma allows you to set target specific options for functions
17851 defined later in the source file.  One or more strings can be
17852 specified.  Each function that is defined after this point is as
17853 if @code{attribute((target("STRING")))} was specified for that
17854 function.  The parenthesis around the options is optional.
17855 @xref{Function Attributes}, for more information about the
17856 @code{target} attribute and the attribute syntax.
17857
17858 The @code{#pragma GCC target} pragma is presently implemented for
17859 x86, PowerPC, and Nios II targets only.
17860 @end table
17861
17862 @table @code
17863 @item #pragma GCC optimize (@var{"string"}...)
17864 @cindex pragma GCC optimize
17865
17866 This pragma allows you to set global optimization options for functions
17867 defined later in the source file.  One or more strings can be
17868 specified.  Each function that is defined after this point is as
17869 if @code{attribute((optimize("STRING")))} was specified for that
17870 function.  The parenthesis around the options is optional.
17871 @xref{Function Attributes}, for more information about the
17872 @code{optimize} attribute and the attribute syntax.
17873
17874 The @samp{#pragma GCC optimize} pragma is not implemented in GCC
17875 versions earlier than 4.4.
17876 @end table
17877
17878 @table @code
17879 @item #pragma GCC push_options
17880 @itemx #pragma GCC pop_options
17881 @cindex pragma GCC push_options
17882 @cindex pragma GCC pop_options
17883
17884 These pragmas maintain a stack of the current target and optimization
17885 options.  It is intended for include files where you temporarily want
17886 to switch to using a different @samp{#pragma GCC target} or
17887 @samp{#pragma GCC optimize} and then to pop back to the previous
17888 options.
17889
17890 The @samp{#pragma GCC push_options} and @samp{#pragma GCC pop_options}
17891 pragmas are not implemented in GCC versions earlier than 4.4.
17892 @end table
17893
17894 @table @code
17895 @item #pragma GCC reset_options
17896 @cindex pragma GCC reset_options
17897
17898 This pragma clears the current @code{#pragma GCC target} and
17899 @code{#pragma GCC optimize} to use the default switches as specified
17900 on the command line.
17901
17902 The @samp{#pragma GCC reset_options} pragma is not implemented in GCC
17903 versions earlier than 4.4.
17904 @end table
17905
17906 @node Loop-Specific Pragmas
17907 @subsection Loop-Specific Pragmas
17908
17909 @table @code
17910 @item #pragma GCC ivdep
17911 @cindex pragma GCC ivdep
17912 @end table
17913
17914 With this pragma, the programmer asserts that there are no loop-carried
17915 dependencies which would prevent consecutive iterations of
17916 the following loop from executing concurrently with SIMD
17917 (single instruction multiple data) instructions.
17918
17919 For example, the compiler can only unconditionally vectorize the following
17920 loop with the pragma:
17921
17922 @smallexample
17923 void foo (int n, int *a, int *b, int *c)
17924 @{
17925   int i, j;
17926 #pragma GCC ivdep
17927   for (i = 0; i < n; ++i)
17928     a[i] = b[i] + c[i];
17929 @}
17930 @end smallexample
17931
17932 @noindent
17933 In this example, using the @code{restrict} qualifier had the same
17934 effect. In the following example, that would not be possible. Assume
17935 @math{k < -m} or @math{k >= m}. Only with the pragma, the compiler knows
17936 that it can unconditionally vectorize the following loop:
17937
17938 @smallexample
17939 void ignore_vec_dep (int *a, int k, int c, int m)
17940 @{
17941 #pragma GCC ivdep
17942   for (int i = 0; i < m; i++)
17943     a[i] = a[i + k] * c;
17944 @}
17945 @end smallexample
17946
17947
17948 @node Unnamed Fields
17949 @section Unnamed struct/union fields within structs/unions
17950 @cindex @code{struct}
17951 @cindex @code{union}
17952
17953 As permitted by ISO C11 and for compatibility with other compilers,
17954 GCC allows you to define
17955 a structure or union that contains, as fields, structures and unions
17956 without names.  For example:
17957
17958 @smallexample
17959 struct @{
17960   int a;
17961   union @{
17962     int b;
17963     float c;
17964   @};
17965   int d;
17966 @} foo;
17967 @end smallexample
17968
17969 @noindent
17970 In this example, you are able to access members of the unnamed
17971 union with code like @samp{foo.b}.  Note that only unnamed structs and
17972 unions are allowed, you may not have, for example, an unnamed
17973 @code{int}.
17974
17975 You must never create such structures that cause ambiguous field definitions.
17976 For example, in this structure:
17977
17978 @smallexample
17979 struct @{
17980   int a;
17981   struct @{
17982     int a;
17983   @};
17984 @} foo;
17985 @end smallexample
17986
17987 @noindent
17988 it is ambiguous which @code{a} is being referred to with @samp{foo.a}.
17989 The compiler gives errors for such constructs.
17990
17991 @opindex fms-extensions
17992 Unless @option{-fms-extensions} is used, the unnamed field must be a
17993 structure or union definition without a tag (for example, @samp{struct
17994 @{ int a; @};}).  If @option{-fms-extensions} is used, the field may
17995 also be a definition with a tag such as @samp{struct foo @{ int a;
17996 @};}, a reference to a previously defined structure or union such as
17997 @samp{struct foo;}, or a reference to a @code{typedef} name for a
17998 previously defined structure or union type.
17999
18000 @opindex fplan9-extensions
18001 The option @option{-fplan9-extensions} enables
18002 @option{-fms-extensions} as well as two other extensions.  First, a
18003 pointer to a structure is automatically converted to a pointer to an
18004 anonymous field for assignments and function calls.  For example:
18005
18006 @smallexample
18007 struct s1 @{ int a; @};
18008 struct s2 @{ struct s1; @};
18009 extern void f1 (struct s1 *);
18010 void f2 (struct s2 *p) @{ f1 (p); @}
18011 @end smallexample
18012
18013 @noindent
18014 In the call to @code{f1} inside @code{f2}, the pointer @code{p} is
18015 converted into a pointer to the anonymous field.
18016
18017 Second, when the type of an anonymous field is a @code{typedef} for a
18018 @code{struct} or @code{union}, code may refer to the field using the
18019 name of the @code{typedef}.
18020
18021 @smallexample
18022 typedef struct @{ int a; @} s1;
18023 struct s2 @{ s1; @};
18024 s1 f1 (struct s2 *p) @{ return p->s1; @}
18025 @end smallexample
18026
18027 These usages are only permitted when they are not ambiguous.
18028
18029 @node Thread-Local
18030 @section Thread-Local Storage
18031 @cindex Thread-Local Storage
18032 @cindex @acronym{TLS}
18033 @cindex @code{__thread}
18034
18035 Thread-local storage (@acronym{TLS}) is a mechanism by which variables
18036 are allocated such that there is one instance of the variable per extant
18037 thread.  The runtime model GCC uses to implement this originates
18038 in the IA-64 processor-specific ABI, but has since been migrated
18039 to other processors as well.  It requires significant support from
18040 the linker (@command{ld}), dynamic linker (@command{ld.so}), and
18041 system libraries (@file{libc.so} and @file{libpthread.so}), so it
18042 is not available everywhere.
18043
18044 At the user level, the extension is visible with a new storage
18045 class keyword: @code{__thread}.  For example:
18046
18047 @smallexample
18048 __thread int i;
18049 extern __thread struct state s;
18050 static __thread char *p;
18051 @end smallexample
18052
18053 The @code{__thread} specifier may be used alone, with the @code{extern}
18054 or @code{static} specifiers, but with no other storage class specifier.
18055 When used with @code{extern} or @code{static}, @code{__thread} must appear
18056 immediately after the other storage class specifier.
18057
18058 The @code{__thread} specifier may be applied to any global, file-scoped
18059 static, function-scoped static, or static data member of a class.  It may
18060 not be applied to block-scoped automatic or non-static data member.
18061
18062 When the address-of operator is applied to a thread-local variable, it is
18063 evaluated at run time and returns the address of the current thread's
18064 instance of that variable.  An address so obtained may be used by any
18065 thread.  When a thread terminates, any pointers to thread-local variables
18066 in that thread become invalid.
18067
18068 No static initialization may refer to the address of a thread-local variable.
18069
18070 In C++, if an initializer is present for a thread-local variable, it must
18071 be a @var{constant-expression}, as defined in 5.19.2 of the ANSI/ISO C++
18072 standard.
18073
18074 See @uref{http://www.akkadia.org/drepper/tls.pdf,
18075 ELF Handling For Thread-Local Storage} for a detailed explanation of
18076 the four thread-local storage addressing models, and how the runtime
18077 is expected to function.
18078
18079 @menu
18080 * C99 Thread-Local Edits::
18081 * C++98 Thread-Local Edits::
18082 @end menu
18083
18084 @node C99 Thread-Local Edits
18085 @subsection ISO/IEC 9899:1999 Edits for Thread-Local Storage
18086
18087 The following are a set of changes to ISO/IEC 9899:1999 (aka C99)
18088 that document the exact semantics of the language extension.
18089
18090 @itemize @bullet
18091 @item
18092 @cite{5.1.2  Execution environments}
18093
18094 Add new text after paragraph 1
18095
18096 @quotation
18097 Within either execution environment, a @dfn{thread} is a flow of
18098 control within a program.  It is implementation defined whether
18099 or not there may be more than one thread associated with a program.
18100 It is implementation defined how threads beyond the first are
18101 created, the name and type of the function called at thread
18102 startup, and how threads may be terminated.  However, objects
18103 with thread storage duration shall be initialized before thread
18104 startup.
18105 @end quotation
18106
18107 @item
18108 @cite{6.2.4  Storage durations of objects}
18109
18110 Add new text before paragraph 3
18111
18112 @quotation
18113 An object whose identifier is declared with the storage-class
18114 specifier @w{@code{__thread}} has @dfn{thread storage duration}.
18115 Its lifetime is the entire execution of the thread, and its
18116 stored value is initialized only once, prior to thread startup.
18117 @end quotation
18118
18119 @item
18120 @cite{6.4.1  Keywords}
18121
18122 Add @code{__thread}.
18123
18124 @item
18125 @cite{6.7.1  Storage-class specifiers}
18126
18127 Add @code{__thread} to the list of storage class specifiers in
18128 paragraph 1.
18129
18130 Change paragraph 2 to
18131
18132 @quotation
18133 With the exception of @code{__thread}, at most one storage-class
18134 specifier may be given [@dots{}].  The @code{__thread} specifier may
18135 be used alone, or immediately following @code{extern} or
18136 @code{static}.
18137 @end quotation
18138
18139 Add new text after paragraph 6
18140
18141 @quotation
18142 The declaration of an identifier for a variable that has
18143 block scope that specifies @code{__thread} shall also
18144 specify either @code{extern} or @code{static}.
18145
18146 The @code{__thread} specifier shall be used only with
18147 variables.
18148 @end quotation
18149 @end itemize
18150
18151 @node C++98 Thread-Local Edits
18152 @subsection ISO/IEC 14882:1998 Edits for Thread-Local Storage
18153
18154 The following are a set of changes to ISO/IEC 14882:1998 (aka C++98)
18155 that document the exact semantics of the language extension.
18156
18157 @itemize @bullet
18158 @item
18159 @b{[intro.execution]}
18160
18161 New text after paragraph 4
18162
18163 @quotation
18164 A @dfn{thread} is a flow of control within the abstract machine.
18165 It is implementation defined whether or not there may be more than
18166 one thread.
18167 @end quotation
18168
18169 New text after paragraph 7
18170
18171 @quotation
18172 It is unspecified whether additional action must be taken to
18173 ensure when and whether side effects are visible to other threads.
18174 @end quotation
18175
18176 @item
18177 @b{[lex.key]}
18178
18179 Add @code{__thread}.
18180
18181 @item
18182 @b{[basic.start.main]}
18183
18184 Add after paragraph 5
18185
18186 @quotation
18187 The thread that begins execution at the @code{main} function is called
18188 the @dfn{main thread}.  It is implementation defined how functions
18189 beginning threads other than the main thread are designated or typed.
18190 A function so designated, as well as the @code{main} function, is called
18191 a @dfn{thread startup function}.  It is implementation defined what
18192 happens if a thread startup function returns.  It is implementation
18193 defined what happens to other threads when any thread calls @code{exit}.
18194 @end quotation
18195
18196 @item
18197 @b{[basic.start.init]}
18198
18199 Add after paragraph 4
18200
18201 @quotation
18202 The storage for an object of thread storage duration shall be
18203 statically initialized before the first statement of the thread startup
18204 function.  An object of thread storage duration shall not require
18205 dynamic initialization.
18206 @end quotation
18207
18208 @item
18209 @b{[basic.start.term]}
18210
18211 Add after paragraph 3
18212
18213 @quotation
18214 The type of an object with thread storage duration shall not have a
18215 non-trivial destructor, nor shall it be an array type whose elements
18216 (directly or indirectly) have non-trivial destructors.
18217 @end quotation
18218
18219 @item
18220 @b{[basic.stc]}
18221
18222 Add ``thread storage duration'' to the list in paragraph 1.
18223
18224 Change paragraph 2
18225
18226 @quotation
18227 Thread, static, and automatic storage durations are associated with
18228 objects introduced by declarations [@dots{}].
18229 @end quotation
18230
18231 Add @code{__thread} to the list of specifiers in paragraph 3.
18232
18233 @item
18234 @b{[basic.stc.thread]}
18235
18236 New section before @b{[basic.stc.static]}
18237
18238 @quotation
18239 The keyword @code{__thread} applied to a non-local object gives the
18240 object thread storage duration.
18241
18242 A local variable or class data member declared both @code{static}
18243 and @code{__thread} gives the variable or member thread storage
18244 duration.
18245 @end quotation
18246
18247 @item
18248 @b{[basic.stc.static]}
18249
18250 Change paragraph 1
18251
18252 @quotation
18253 All objects that have neither thread storage duration, dynamic
18254 storage duration nor are local [@dots{}].
18255 @end quotation
18256
18257 @item
18258 @b{[dcl.stc]}
18259
18260 Add @code{__thread} to the list in paragraph 1.
18261
18262 Change paragraph 1
18263
18264 @quotation
18265 With the exception of @code{__thread}, at most one
18266 @var{storage-class-specifier} shall appear in a given
18267 @var{decl-specifier-seq}.  The @code{__thread} specifier may
18268 be used alone, or immediately following the @code{extern} or
18269 @code{static} specifiers.  [@dots{}]
18270 @end quotation
18271
18272 Add after paragraph 5
18273
18274 @quotation
18275 The @code{__thread} specifier can be applied only to the names of objects
18276 and to anonymous unions.
18277 @end quotation
18278
18279 @item
18280 @b{[class.mem]}
18281
18282 Add after paragraph 6
18283
18284 @quotation
18285 Non-@code{static} members shall not be @code{__thread}.
18286 @end quotation
18287 @end itemize
18288
18289 @node Binary constants
18290 @section Binary constants using the @samp{0b} prefix
18291 @cindex Binary constants using the @samp{0b} prefix
18292
18293 Integer constants can be written as binary constants, consisting of a
18294 sequence of @samp{0} and @samp{1} digits, prefixed by @samp{0b} or
18295 @samp{0B}.  This is particularly useful in environments that operate a
18296 lot on the bit level (like microcontrollers).
18297
18298 The following statements are identical:
18299
18300 @smallexample
18301 i =       42;
18302 i =     0x2a;
18303 i =      052;
18304 i = 0b101010;
18305 @end smallexample
18306
18307 The type of these constants follows the same rules as for octal or
18308 hexadecimal integer constants, so suffixes like @samp{L} or @samp{UL}
18309 can be applied.
18310
18311 @node C++ Extensions
18312 @chapter Extensions to the C++ Language
18313 @cindex extensions, C++ language
18314 @cindex C++ language extensions
18315
18316 The GNU compiler provides these extensions to the C++ language (and you
18317 can also use most of the C language extensions in your C++ programs).  If you
18318 want to write code that checks whether these features are available, you can
18319 test for the GNU compiler the same way as for C programs: check for a
18320 predefined macro @code{__GNUC__}.  You can also use @code{__GNUG__} to
18321 test specifically for GNU C++ (@pxref{Common Predefined Macros,,
18322 Predefined Macros,cpp,The GNU C Preprocessor}).
18323
18324 @menu
18325 * C++ Volatiles::       What constitutes an access to a volatile object.
18326 * Restricted Pointers:: C99 restricted pointers and references.
18327 * Vague Linkage::       Where G++ puts inlines, vtables and such.
18328 * C++ Interface::       You can use a single C++ header file for both
18329                         declarations and definitions.
18330 * Template Instantiation:: Methods for ensuring that exactly one copy of
18331                         each needed template instantiation is emitted.
18332 * Bound member functions:: You can extract a function pointer to the
18333                         method denoted by a @samp{->*} or @samp{.*} expression.
18334 * C++ Attributes::      Variable, function, and type attributes for C++ only.
18335 * Function Multiversioning::   Declaring multiple function versions.
18336 * Namespace Association:: Strong using-directives for namespace association.
18337 * Type Traits::         Compiler support for type traits
18338 * Java Exceptions::     Tweaking exception handling to work with Java.
18339 * Deprecated Features:: Things will disappear from G++.
18340 * Backwards Compatibility:: Compatibilities with earlier definitions of C++.
18341 @end menu
18342
18343 @node C++ Volatiles
18344 @section When is a Volatile C++ Object Accessed?
18345 @cindex accessing volatiles
18346 @cindex volatile read
18347 @cindex volatile write
18348 @cindex volatile access
18349
18350 The C++ standard differs from the C standard in its treatment of
18351 volatile objects.  It fails to specify what constitutes a volatile
18352 access, except to say that C++ should behave in a similar manner to C
18353 with respect to volatiles, where possible.  However, the different
18354 lvalueness of expressions between C and C++ complicate the behavior.
18355 G++ behaves the same as GCC for volatile access, @xref{C
18356 Extensions,,Volatiles}, for a description of GCC's behavior.
18357
18358 The C and C++ language specifications differ when an object is
18359 accessed in a void context:
18360
18361 @smallexample
18362 volatile int *src = @var{somevalue};
18363 *src;
18364 @end smallexample
18365
18366 The C++ standard specifies that such expressions do not undergo lvalue
18367 to rvalue conversion, and that the type of the dereferenced object may
18368 be incomplete.  The C++ standard does not specify explicitly that it
18369 is lvalue to rvalue conversion that is responsible for causing an
18370 access.  There is reason to believe that it is, because otherwise
18371 certain simple expressions become undefined.  However, because it
18372 would surprise most programmers, G++ treats dereferencing a pointer to
18373 volatile object of complete type as GCC would do for an equivalent
18374 type in C@.  When the object has incomplete type, G++ issues a
18375 warning; if you wish to force an error, you must force a conversion to
18376 rvalue with, for instance, a static cast.
18377
18378 When using a reference to volatile, G++ does not treat equivalent
18379 expressions as accesses to volatiles, but instead issues a warning that
18380 no volatile is accessed.  The rationale for this is that otherwise it
18381 becomes difficult to determine where volatile access occur, and not
18382 possible to ignore the return value from functions returning volatile
18383 references.  Again, if you wish to force a read, cast the reference to
18384 an rvalue.
18385
18386 G++ implements the same behavior as GCC does when assigning to a
18387 volatile object---there is no reread of the assigned-to object, the
18388 assigned rvalue is reused.  Note that in C++ assignment expressions
18389 are lvalues, and if used as an lvalue, the volatile object is
18390 referred to.  For instance, @var{vref} refers to @var{vobj}, as
18391 expected, in the following example:
18392
18393 @smallexample
18394 volatile int vobj;
18395 volatile int &vref = vobj = @var{something};
18396 @end smallexample
18397
18398 @node Restricted Pointers
18399 @section Restricting Pointer Aliasing
18400 @cindex restricted pointers
18401 @cindex restricted references
18402 @cindex restricted this pointer
18403
18404 As with the C front end, G++ understands the C99 feature of restricted pointers,
18405 specified with the @code{__restrict__}, or @code{__restrict} type
18406 qualifier.  Because you cannot compile C++ by specifying the @option{-std=c99}
18407 language flag, @code{restrict} is not a keyword in C++.
18408
18409 In addition to allowing restricted pointers, you can specify restricted
18410 references, which indicate that the reference is not aliased in the local
18411 context.
18412
18413 @smallexample
18414 void fn (int *__restrict__ rptr, int &__restrict__ rref)
18415 @{
18416   /* @r{@dots{}} */
18417 @}
18418 @end smallexample
18419
18420 @noindent
18421 In the body of @code{fn}, @var{rptr} points to an unaliased integer and
18422 @var{rref} refers to a (different) unaliased integer.
18423
18424 You may also specify whether a member function's @var{this} pointer is
18425 unaliased by using @code{__restrict__} as a member function qualifier.
18426
18427 @smallexample
18428 void T::fn () __restrict__
18429 @{
18430   /* @r{@dots{}} */
18431 @}
18432 @end smallexample
18433
18434 @noindent
18435 Within the body of @code{T::fn}, @var{this} has the effective
18436 definition @code{T *__restrict__ const this}.  Notice that the
18437 interpretation of a @code{__restrict__} member function qualifier is
18438 different to that of @code{const} or @code{volatile} qualifier, in that it
18439 is applied to the pointer rather than the object.  This is consistent with
18440 other compilers that implement restricted pointers.
18441
18442 As with all outermost parameter qualifiers, @code{__restrict__} is
18443 ignored in function definition matching.  This means you only need to
18444 specify @code{__restrict__} in a function definition, rather than
18445 in a function prototype as well.
18446
18447 @node Vague Linkage
18448 @section Vague Linkage
18449 @cindex vague linkage
18450
18451 There are several constructs in C++ that require space in the object
18452 file but are not clearly tied to a single translation unit.  We say that
18453 these constructs have ``vague linkage''.  Typically such constructs are
18454 emitted wherever they are needed, though sometimes we can be more
18455 clever.
18456
18457 @table @asis
18458 @item Inline Functions
18459 Inline functions are typically defined in a header file which can be
18460 included in many different compilations.  Hopefully they can usually be
18461 inlined, but sometimes an out-of-line copy is necessary, if the address
18462 of the function is taken or if inlining fails.  In general, we emit an
18463 out-of-line copy in all translation units where one is needed.  As an
18464 exception, we only emit inline virtual functions with the vtable, since
18465 it always requires a copy.
18466
18467 Local static variables and string constants used in an inline function
18468 are also considered to have vague linkage, since they must be shared
18469 between all inlined and out-of-line instances of the function.
18470
18471 @item VTables
18472 @cindex vtable
18473 C++ virtual functions are implemented in most compilers using a lookup
18474 table, known as a vtable.  The vtable contains pointers to the virtual
18475 functions provided by a class, and each object of the class contains a
18476 pointer to its vtable (or vtables, in some multiple-inheritance
18477 situations).  If the class declares any non-inline, non-pure virtual
18478 functions, the first one is chosen as the ``key method'' for the class,
18479 and the vtable is only emitted in the translation unit where the key
18480 method is defined.
18481
18482 @emph{Note:} If the chosen key method is later defined as inline, the
18483 vtable is still emitted in every translation unit that defines it.
18484 Make sure that any inline virtuals are declared inline in the class
18485 body, even if they are not defined there.
18486
18487 @item @code{type_info} objects
18488 @cindex @code{type_info}
18489 @cindex RTTI
18490 C++ requires information about types to be written out in order to
18491 implement @samp{dynamic_cast}, @samp{typeid} and exception handling.
18492 For polymorphic classes (classes with virtual functions), the @samp{type_info}
18493 object is written out along with the vtable so that @samp{dynamic_cast}
18494 can determine the dynamic type of a class object at run time.  For all
18495 other types, we write out the @samp{type_info} object when it is used: when
18496 applying @samp{typeid} to an expression, throwing an object, or
18497 referring to a type in a catch clause or exception specification.
18498
18499 @item Template Instantiations
18500 Most everything in this section also applies to template instantiations,
18501 but there are other options as well.
18502 @xref{Template Instantiation,,Where's the Template?}.
18503
18504 @end table
18505
18506 When used with GNU ld version 2.8 or later on an ELF system such as
18507 GNU/Linux or Solaris 2, or on Microsoft Windows, duplicate copies of
18508 these constructs will be discarded at link time.  This is known as
18509 COMDAT support.
18510
18511 On targets that don't support COMDAT, but do support weak symbols, GCC
18512 uses them.  This way one copy overrides all the others, but
18513 the unused copies still take up space in the executable.
18514
18515 For targets that do not support either COMDAT or weak symbols,
18516 most entities with vague linkage are emitted as local symbols to
18517 avoid duplicate definition errors from the linker.  This does not happen
18518 for local statics in inlines, however, as having multiple copies
18519 almost certainly breaks things.
18520
18521 @xref{C++ Interface,,Declarations and Definitions in One Header}, for
18522 another way to control placement of these constructs.
18523
18524 @node C++ Interface
18525 @section #pragma interface and implementation
18526
18527 @cindex interface and implementation headers, C++
18528 @cindex C++ interface and implementation headers
18529 @cindex pragmas, interface and implementation
18530
18531 @code{#pragma interface} and @code{#pragma implementation} provide the
18532 user with a way of explicitly directing the compiler to emit entities
18533 with vague linkage (and debugging information) in a particular
18534 translation unit.
18535
18536 @emph{Note:} As of GCC 2.7.2, these @code{#pragma}s are not useful in
18537 most cases, because of COMDAT support and the ``key method'' heuristic
18538 mentioned in @ref{Vague Linkage}.  Using them can actually cause your
18539 program to grow due to unnecessary out-of-line copies of inline
18540 functions.  Currently (3.4) the only benefit of these
18541 @code{#pragma}s is reduced duplication of debugging information, and
18542 that should be addressed soon on DWARF 2 targets with the use of
18543 COMDAT groups.
18544
18545 @table @code
18546 @item #pragma interface
18547 @itemx #pragma interface "@var{subdir}/@var{objects}.h"
18548 @kindex #pragma interface
18549 Use this directive in @emph{header files} that define object classes, to save
18550 space in most of the object files that use those classes.  Normally,
18551 local copies of certain information (backup copies of inline member
18552 functions, debugging information, and the internal tables that implement
18553 virtual functions) must be kept in each object file that includes class
18554 definitions.  You can use this pragma to avoid such duplication.  When a
18555 header file containing @samp{#pragma interface} is included in a
18556 compilation, this auxiliary information is not generated (unless
18557 the main input source file itself uses @samp{#pragma implementation}).
18558 Instead, the object files contain references to be resolved at link
18559 time.
18560
18561 The second form of this directive is useful for the case where you have
18562 multiple headers with the same name in different directories.  If you
18563 use this form, you must specify the same string to @samp{#pragma
18564 implementation}.
18565
18566 @item #pragma implementation
18567 @itemx #pragma implementation "@var{objects}.h"
18568 @kindex #pragma implementation
18569 Use this pragma in a @emph{main input file}, when you want full output from
18570 included header files to be generated (and made globally visible).  The
18571 included header file, in turn, should use @samp{#pragma interface}.
18572 Backup copies of inline member functions, debugging information, and the
18573 internal tables used to implement virtual functions are all generated in
18574 implementation files.
18575
18576 @cindex implied @code{#pragma implementation}
18577 @cindex @code{#pragma implementation}, implied
18578 @cindex naming convention, implementation headers
18579 If you use @samp{#pragma implementation} with no argument, it applies to
18580 an include file with the same basename@footnote{A file's @dfn{basename}
18581 is the name stripped of all leading path information and of trailing
18582 suffixes, such as @samp{.h} or @samp{.C} or @samp{.cc}.} as your source
18583 file.  For example, in @file{allclass.cc}, giving just
18584 @samp{#pragma implementation}
18585 by itself is equivalent to @samp{#pragma implementation "allclass.h"}.
18586
18587 In versions of GNU C++ prior to 2.6.0 @file{allclass.h} was treated as
18588 an implementation file whenever you would include it from
18589 @file{allclass.cc} even if you never specified @samp{#pragma
18590 implementation}.  This was deemed to be more trouble than it was worth,
18591 however, and disabled.
18592
18593 Use the string argument if you want a single implementation file to
18594 include code from multiple header files.  (You must also use
18595 @samp{#include} to include the header file; @samp{#pragma
18596 implementation} only specifies how to use the file---it doesn't actually
18597 include it.)
18598
18599 There is no way to split up the contents of a single header file into
18600 multiple implementation files.
18601 @end table
18602
18603 @cindex inlining and C++ pragmas
18604 @cindex C++ pragmas, effect on inlining
18605 @cindex pragmas in C++, effect on inlining
18606 @samp{#pragma implementation} and @samp{#pragma interface} also have an
18607 effect on function inlining.
18608
18609 If you define a class in a header file marked with @samp{#pragma
18610 interface}, the effect on an inline function defined in that class is
18611 similar to an explicit @code{extern} declaration---the compiler emits
18612 no code at all to define an independent version of the function.  Its
18613 definition is used only for inlining with its callers.
18614
18615 @opindex fno-implement-inlines
18616 Conversely, when you include the same header file in a main source file
18617 that declares it as @samp{#pragma implementation}, the compiler emits
18618 code for the function itself; this defines a version of the function
18619 that can be found via pointers (or by callers compiled without
18620 inlining).  If all calls to the function can be inlined, you can avoid
18621 emitting the function by compiling with @option{-fno-implement-inlines}.
18622 If any calls are not inlined, you will get linker errors.
18623
18624 @node Template Instantiation
18625 @section Where's the Template?
18626 @cindex template instantiation
18627
18628 C++ templates are the first language feature to require more
18629 intelligence from the environment than one usually finds on a UNIX
18630 system.  Somehow the compiler and linker have to make sure that each
18631 template instance occurs exactly once in the executable if it is needed,
18632 and not at all otherwise.  There are two basic approaches to this
18633 problem, which are referred to as the Borland model and the Cfront model.
18634
18635 @table @asis
18636 @item Borland model
18637 Borland C++ solved the template instantiation problem by adding the code
18638 equivalent of common blocks to their linker; the compiler emits template
18639 instances in each translation unit that uses them, and the linker
18640 collapses them together.  The advantage of this model is that the linker
18641 only has to consider the object files themselves; there is no external
18642 complexity to worry about.  This disadvantage is that compilation time
18643 is increased because the template code is being compiled repeatedly.
18644 Code written for this model tends to include definitions of all
18645 templates in the header file, since they must be seen to be
18646 instantiated.
18647
18648 @item Cfront model
18649 The AT&T C++ translator, Cfront, solved the template instantiation
18650 problem by creating the notion of a template repository, an
18651 automatically maintained place where template instances are stored.  A
18652 more modern version of the repository works as follows: As individual
18653 object files are built, the compiler places any template definitions and
18654 instantiations encountered in the repository.  At link time, the link
18655 wrapper adds in the objects in the repository and compiles any needed
18656 instances that were not previously emitted.  The advantages of this
18657 model are more optimal compilation speed and the ability to use the
18658 system linker; to implement the Borland model a compiler vendor also
18659 needs to replace the linker.  The disadvantages are vastly increased
18660 complexity, and thus potential for error; for some code this can be
18661 just as transparent, but in practice it can been very difficult to build
18662 multiple programs in one directory and one program in multiple
18663 directories.  Code written for this model tends to separate definitions
18664 of non-inline member templates into a separate file, which should be
18665 compiled separately.
18666 @end table
18667
18668 When used with GNU ld version 2.8 or later on an ELF system such as
18669 GNU/Linux or Solaris 2, or on Microsoft Windows, G++ supports the
18670 Borland model.  On other systems, G++ implements neither automatic
18671 model.
18672
18673 You have the following options for dealing with template instantiations:
18674
18675 @enumerate
18676 @item
18677 @opindex frepo
18678 Compile your template-using code with @option{-frepo}.  The compiler
18679 generates files with the extension @samp{.rpo} listing all of the
18680 template instantiations used in the corresponding object files that
18681 could be instantiated there; the link wrapper, @samp{collect2},
18682 then updates the @samp{.rpo} files to tell the compiler where to place
18683 those instantiations and rebuild any affected object files.  The
18684 link-time overhead is negligible after the first pass, as the compiler
18685 continues to place the instantiations in the same files.
18686
18687 This is your best option for application code written for the Borland
18688 model, as it just works.  Code written for the Cfront model 
18689 needs to be modified so that the template definitions are available at
18690 one or more points of instantiation; usually this is as simple as adding
18691 @code{#include <tmethods.cc>} to the end of each template header.
18692
18693 For library code, if you want the library to provide all of the template
18694 instantiations it needs, just try to link all of its object files
18695 together; the link will fail, but cause the instantiations to be
18696 generated as a side effect.  Be warned, however, that this may cause
18697 conflicts if multiple libraries try to provide the same instantiations.
18698 For greater control, use explicit instantiation as described in the next
18699 option.
18700
18701 @item
18702 @opindex fno-implicit-templates
18703 Compile your code with @option{-fno-implicit-templates} to disable the
18704 implicit generation of template instances, and explicitly instantiate
18705 all the ones you use.  This approach requires more knowledge of exactly
18706 which instances you need than do the others, but it's less
18707 mysterious and allows greater control.  You can scatter the explicit
18708 instantiations throughout your program, perhaps putting them in the
18709 translation units where the instances are used or the translation units
18710 that define the templates themselves; you can put all of the explicit
18711 instantiations you need into one big file; or you can create small files
18712 like
18713
18714 @smallexample
18715 #include "Foo.h"
18716 #include "Foo.cc"
18717
18718 template class Foo<int>;
18719 template ostream& operator <<
18720                 (ostream&, const Foo<int>&);
18721 @end smallexample
18722
18723 @noindent
18724 for each of the instances you need, and create a template instantiation
18725 library from those.
18726
18727 If you are using Cfront-model code, you can probably get away with not
18728 using @option{-fno-implicit-templates} when compiling files that don't
18729 @samp{#include} the member template definitions.
18730
18731 If you use one big file to do the instantiations, you may want to
18732 compile it without @option{-fno-implicit-templates} so you get all of the
18733 instances required by your explicit instantiations (but not by any
18734 other files) without having to specify them as well.
18735
18736 The ISO C++ 2011 standard allows forward declaration of explicit
18737 instantiations (with @code{extern}). G++ supports explicit instantiation
18738 declarations in C++98 mode and has extended the template instantiation
18739 syntax to support instantiation of the compiler support data for a
18740 template class (i.e.@: the vtable) without instantiating any of its
18741 members (with @code{inline}), and instantiation of only the static data
18742 members of a template class, without the support data or member
18743 functions (with @code{static}):
18744
18745 @smallexample
18746 extern template int max (int, int);
18747 inline template class Foo<int>;
18748 static template class Foo<int>;
18749 @end smallexample
18750
18751 @item
18752 Do nothing.  Pretend G++ does implement automatic instantiation
18753 management.  Code written for the Borland model works fine, but
18754 each translation unit contains instances of each of the templates it
18755 uses.  In a large program, this can lead to an unacceptable amount of code
18756 duplication.
18757 @end enumerate
18758
18759 @node Bound member functions
18760 @section Extracting the function pointer from a bound pointer to member function
18761 @cindex pmf
18762 @cindex pointer to member function
18763 @cindex bound pointer to member function
18764
18765 In C++, pointer to member functions (PMFs) are implemented using a wide
18766 pointer of sorts to handle all the possible call mechanisms; the PMF
18767 needs to store information about how to adjust the @samp{this} pointer,
18768 and if the function pointed to is virtual, where to find the vtable, and
18769 where in the vtable to look for the member function.  If you are using
18770 PMFs in an inner loop, you should really reconsider that decision.  If
18771 that is not an option, you can extract the pointer to the function that
18772 would be called for a given object/PMF pair and call it directly inside
18773 the inner loop, to save a bit of time.
18774
18775 Note that you still pay the penalty for the call through a
18776 function pointer; on most modern architectures, such a call defeats the
18777 branch prediction features of the CPU@.  This is also true of normal
18778 virtual function calls.
18779
18780 The syntax for this extension is
18781
18782 @smallexample
18783 extern A a;
18784 extern int (A::*fp)();
18785 typedef int (*fptr)(A *);
18786
18787 fptr p = (fptr)(a.*fp);
18788 @end smallexample
18789
18790 For PMF constants (i.e.@: expressions of the form @samp{&Klasse::Member}),
18791 no object is needed to obtain the address of the function.  They can be
18792 converted to function pointers directly:
18793
18794 @smallexample
18795 fptr p1 = (fptr)(&A::foo);
18796 @end smallexample
18797
18798 @opindex Wno-pmf-conversions
18799 You must specify @option{-Wno-pmf-conversions} to use this extension.
18800
18801 @node C++ Attributes
18802 @section C++-Specific Variable, Function, and Type Attributes
18803
18804 Some attributes only make sense for C++ programs.
18805
18806 @table @code
18807 @item abi_tag ("@var{tag}", ...)
18808 @cindex @code{abi_tag} attribute
18809 The @code{abi_tag} attribute can be applied to a function or class
18810 declaration.  It modifies the mangled name of the function or class to
18811 incorporate the tag name, in order to distinguish the function or
18812 class from an earlier version with a different ABI; perhaps the class
18813 has changed size, or the function has a different return type that is
18814 not encoded in the mangled name.
18815
18816 The argument can be a list of strings of arbitrary length.  The
18817 strings are sorted on output, so the order of the list is
18818 unimportant.
18819
18820 A redeclaration of a function or class must not add new ABI tags,
18821 since doing so would change the mangled name.
18822
18823 The ABI tags apply to a name, so all instantiations and
18824 specializations of a template have the same tags.  The attribute will
18825 be ignored if applied to an explicit specialization or instantiation.
18826
18827 The @option{-Wabi-tag} flag enables a warning about a class which does
18828 not have all the ABI tags used by its subobjects and virtual functions; for users with code
18829 that needs to coexist with an earlier ABI, using this option can help
18830 to find all affected types that need to be tagged.
18831
18832 @item init_priority (@var{priority})
18833 @cindex @code{init_priority} attribute
18834
18835
18836 In Standard C++, objects defined at namespace scope are guaranteed to be
18837 initialized in an order in strict accordance with that of their definitions
18838 @emph{in a given translation unit}.  No guarantee is made for initializations
18839 across translation units.  However, GNU C++ allows users to control the
18840 order of initialization of objects defined at namespace scope with the
18841 @code{init_priority} attribute by specifying a relative @var{priority},
18842 a constant integral expression currently bounded between 101 and 65535
18843 inclusive.  Lower numbers indicate a higher priority.
18844
18845 In the following example, @code{A} would normally be created before
18846 @code{B}, but the @code{init_priority} attribute reverses that order:
18847
18848 @smallexample
18849 Some_Class  A  __attribute__ ((init_priority (2000)));
18850 Some_Class  B  __attribute__ ((init_priority (543)));
18851 @end smallexample
18852
18853 @noindent
18854 Note that the particular values of @var{priority} do not matter; only their
18855 relative ordering.
18856
18857 @item java_interface
18858 @cindex @code{java_interface} attribute
18859
18860 This type attribute informs C++ that the class is a Java interface.  It may
18861 only be applied to classes declared within an @code{extern "Java"} block.
18862 Calls to methods declared in this interface are dispatched using GCJ's
18863 interface table mechanism, instead of regular virtual table dispatch.
18864
18865 @item warn_unused
18866 @cindex @code{warn_unused} attribute
18867
18868 For C++ types with non-trivial constructors and/or destructors it is
18869 impossible for the compiler to determine whether a variable of this
18870 type is truly unused if it is not referenced. This type attribute
18871 informs the compiler that variables of this type should be warned
18872 about if they appear to be unused, just like variables of fundamental
18873 types.
18874
18875 This attribute is appropriate for types which just represent a value,
18876 such as @code{std::string}; it is not appropriate for types which
18877 control a resource, such as @code{std::mutex}.
18878
18879 This attribute is also accepted in C, but it is unnecessary because C
18880 does not have constructors or destructors.
18881
18882 @end table
18883
18884 See also @ref{Namespace Association}.
18885
18886 @node Function Multiversioning
18887 @section Function Multiversioning
18888 @cindex function versions
18889
18890 With the GNU C++ front end, for x86 targets, you may specify multiple
18891 versions of a function, where each function is specialized for a
18892 specific target feature.  At runtime, the appropriate version of the
18893 function is automatically executed depending on the characteristics of
18894 the execution platform.  Here is an example.
18895
18896 @smallexample
18897 __attribute__ ((target ("default")))
18898 int foo ()
18899 @{
18900   // The default version of foo.
18901   return 0;
18902 @}
18903
18904 __attribute__ ((target ("sse4.2")))
18905 int foo ()
18906 @{
18907   // foo version for SSE4.2
18908   return 1;
18909 @}
18910
18911 __attribute__ ((target ("arch=atom")))
18912 int foo ()
18913 @{
18914   // foo version for the Intel ATOM processor
18915   return 2;
18916 @}
18917
18918 __attribute__ ((target ("arch=amdfam10")))
18919 int foo ()
18920 @{
18921   // foo version for the AMD Family 0x10 processors.
18922   return 3;
18923 @}
18924
18925 int main ()
18926 @{
18927   int (*p)() = &foo;
18928   assert ((*p) () == foo ());
18929   return 0;
18930 @}
18931 @end smallexample
18932
18933 In the above example, four versions of function foo are created. The
18934 first version of foo with the target attribute "default" is the default
18935 version.  This version gets executed when no other target specific
18936 version qualifies for execution on a particular platform. A new version
18937 of foo is created by using the same function signature but with a
18938 different target string.  Function foo is called or a pointer to it is
18939 taken just like a regular function.  GCC takes care of doing the
18940 dispatching to call the right version at runtime.  Refer to the
18941 @uref{http://gcc.gnu.org/wiki/FunctionMultiVersioning, GCC wiki on
18942 Function Multiversioning} for more details.
18943
18944 @node Namespace Association
18945 @section Namespace Association
18946
18947 @strong{Caution:} The semantics of this extension are equivalent
18948 to C++ 2011 inline namespaces.  Users should use inline namespaces
18949 instead as this extension will be removed in future versions of G++.
18950
18951 A using-directive with @code{__attribute ((strong))} is stronger
18952 than a normal using-directive in two ways:
18953
18954 @itemize @bullet
18955 @item
18956 Templates from the used namespace can be specialized and explicitly
18957 instantiated as though they were members of the using namespace.
18958
18959 @item
18960 The using namespace is considered an associated namespace of all
18961 templates in the used namespace for purposes of argument-dependent
18962 name lookup.
18963 @end itemize
18964
18965 The used namespace must be nested within the using namespace so that
18966 normal unqualified lookup works properly.
18967
18968 This is useful for composing a namespace transparently from
18969 implementation namespaces.  For example:
18970
18971 @smallexample
18972 namespace std @{
18973   namespace debug @{
18974     template <class T> struct A @{ @};
18975   @}
18976   using namespace debug __attribute ((__strong__));
18977   template <> struct A<int> @{ @};   // @r{OK to specialize}
18978
18979   template <class T> void f (A<T>);
18980 @}
18981
18982 int main()
18983 @{
18984   f (std::A<float>());             // @r{lookup finds} std::f
18985   f (std::A<int>());
18986 @}
18987 @end smallexample
18988
18989 @node Type Traits
18990 @section Type Traits
18991
18992 The C++ front end implements syntactic extensions that allow
18993 compile-time determination of 
18994 various characteristics of a type (or of a
18995 pair of types).
18996
18997 @table @code
18998 @item __has_nothrow_assign (type)
18999 If @code{type} is const qualified or is a reference type then the trait is
19000 false.  Otherwise if @code{__has_trivial_assign (type)} is true then the trait
19001 is true, else if @code{type} is a cv class or union type with copy assignment
19002 operators that are known not to throw an exception then the trait is true,
19003 else it is false.  Requires: @code{type} shall be a complete type,
19004 (possibly cv-qualified) @code{void}, or an array of unknown bound.
19005
19006 @item __has_nothrow_copy (type)
19007 If @code{__has_trivial_copy (type)} is true then the trait is true, else if
19008 @code{type} is a cv class or union type with copy constructors that
19009 are known not to throw an exception then the trait is true, else it is false.
19010 Requires: @code{type} shall be a complete type, (possibly cv-qualified)
19011 @code{void}, or an array of unknown bound.
19012
19013 @item __has_nothrow_constructor (type)
19014 If @code{__has_trivial_constructor (type)} is true then the trait is
19015 true, else if @code{type} is a cv class or union type (or array
19016 thereof) with a default constructor that is known not to throw an
19017 exception then the trait is true, else it is false.  Requires:
19018 @code{type} shall be a complete type, (possibly cv-qualified)
19019 @code{void}, or an array of unknown bound.
19020
19021 @item __has_trivial_assign (type)
19022 If @code{type} is const qualified or is a reference type then the trait is
19023 false.  Otherwise if @code{__is_pod (type)} is true then the trait is
19024 true, else if @code{type} is a cv class or union type with a trivial
19025 copy assignment ([class.copy]) then the trait is true, else it is
19026 false.  Requires: @code{type} shall be a complete type, (possibly
19027 cv-qualified) @code{void}, or an array of unknown bound.
19028
19029 @item __has_trivial_copy (type)
19030 If @code{__is_pod (type)} is true or @code{type} is a reference type
19031 then the trait is true, else if @code{type} is a cv class or union type
19032 with a trivial copy constructor ([class.copy]) then the trait
19033 is true, else it is false.  Requires: @code{type} shall be a complete
19034 type, (possibly cv-qualified) @code{void}, or an array of unknown bound.
19035
19036 @item __has_trivial_constructor (type)
19037 If @code{__is_pod (type)} is true then the trait is true, else if
19038 @code{type} is a cv class or union type (or array thereof) with a
19039 trivial default constructor ([class.ctor]) then the trait is true,
19040 else it is false.  Requires: @code{type} shall be a complete
19041 type, (possibly cv-qualified) @code{void}, or an array of unknown bound.
19042
19043 @item __has_trivial_destructor (type)
19044 If @code{__is_pod (type)} is true or @code{type} is a reference type then
19045 the trait is true, else if @code{type} is a cv class or union type (or
19046 array thereof) with a trivial destructor ([class.dtor]) then the trait
19047 is true, else it is false.  Requires: @code{type} shall be a complete
19048 type, (possibly cv-qualified) @code{void}, or an array of unknown bound.
19049
19050 @item __has_virtual_destructor (type)
19051 If @code{type} is a class type with a virtual destructor
19052 ([class.dtor]) then the trait is true, else it is false.  Requires:
19053 @code{type} shall be a complete type, (possibly cv-qualified)
19054 @code{void}, or an array of unknown bound.
19055
19056 @item __is_abstract (type)
19057 If @code{type} is an abstract class ([class.abstract]) then the trait
19058 is true, else it is false.  Requires: @code{type} shall be a complete
19059 type, (possibly cv-qualified) @code{void}, or an array of unknown bound.
19060
19061 @item __is_base_of (base_type, derived_type)
19062 If @code{base_type} is a base class of @code{derived_type}
19063 ([class.derived]) then the trait is true, otherwise it is false.
19064 Top-level cv qualifications of @code{base_type} and
19065 @code{derived_type} are ignored.  For the purposes of this trait, a
19066 class type is considered is own base.  Requires: if @code{__is_class
19067 (base_type)} and @code{__is_class (derived_type)} are true and
19068 @code{base_type} and @code{derived_type} are not the same type
19069 (disregarding cv-qualifiers), @code{derived_type} shall be a complete
19070 type.  Diagnostic is produced if this requirement is not met.
19071
19072 @item __is_class (type)
19073 If @code{type} is a cv class type, and not a union type
19074 ([basic.compound]) the trait is true, else it is false.
19075
19076 @item __is_empty (type)
19077 If @code{__is_class (type)} is false then the trait is false.
19078 Otherwise @code{type} is considered empty if and only if: @code{type}
19079 has no non-static data members, or all non-static data members, if
19080 any, are bit-fields of length 0, and @code{type} has no virtual
19081 members, and @code{type} has no virtual base classes, and @code{type}
19082 has no base classes @code{base_type} for which
19083 @code{__is_empty (base_type)} is false.  Requires: @code{type} shall
19084 be a complete type, (possibly cv-qualified) @code{void}, or an array
19085 of unknown bound.
19086
19087 @item __is_enum (type)
19088 If @code{type} is a cv enumeration type ([basic.compound]) the trait is
19089 true, else it is false.
19090
19091 @item __is_literal_type (type)
19092 If @code{type} is a literal type ([basic.types]) the trait is
19093 true, else it is false.  Requires: @code{type} shall be a complete type,
19094 (possibly cv-qualified) @code{void}, or an array of unknown bound.
19095
19096 @item __is_pod (type)
19097 If @code{type} is a cv POD type ([basic.types]) then the trait is true,
19098 else it is false.  Requires: @code{type} shall be a complete type,
19099 (possibly cv-qualified) @code{void}, or an array of unknown bound.
19100
19101 @item __is_polymorphic (type)
19102 If @code{type} is a polymorphic class ([class.virtual]) then the trait
19103 is true, else it is false.  Requires: @code{type} shall be a complete
19104 type, (possibly cv-qualified) @code{void}, or an array of unknown bound.
19105
19106 @item __is_standard_layout (type)
19107 If @code{type} is a standard-layout type ([basic.types]) the trait is
19108 true, else it is false.  Requires: @code{type} shall be a complete
19109 type, (possibly cv-qualified) @code{void}, or an array of unknown bound.
19110
19111 @item __is_trivial (type)
19112 If @code{type} is a trivial type ([basic.types]) the trait is
19113 true, else it is false.  Requires: @code{type} shall be a complete
19114 type, (possibly cv-qualified) @code{void}, or an array of unknown bound.
19115
19116 @item __is_union (type)
19117 If @code{type} is a cv union type ([basic.compound]) the trait is
19118 true, else it is false.
19119
19120 @item __underlying_type (type)
19121 The underlying type of @code{type}.  Requires: @code{type} shall be
19122 an enumeration type ([dcl.enum]).
19123
19124 @end table
19125
19126 @node Java Exceptions
19127 @section Java Exceptions
19128
19129 The Java language uses a slightly different exception handling model
19130 from C++.  Normally, GNU C++ automatically detects when you are
19131 writing C++ code that uses Java exceptions, and handle them
19132 appropriately.  However, if C++ code only needs to execute destructors
19133 when Java exceptions are thrown through it, GCC guesses incorrectly.
19134 Sample problematic code is:
19135
19136 @smallexample
19137   struct S @{ ~S(); @};
19138   extern void bar();    // @r{is written in Java, and may throw exceptions}
19139   void foo()
19140   @{
19141     S s;
19142     bar();
19143   @}
19144 @end smallexample
19145
19146 @noindent
19147 The usual effect of an incorrect guess is a link failure, complaining of
19148 a missing routine called @samp{__gxx_personality_v0}.
19149
19150 You can inform the compiler that Java exceptions are to be used in a
19151 translation unit, irrespective of what it might think, by writing
19152 @samp{@w{#pragma GCC java_exceptions}} at the head of the file.  This
19153 @samp{#pragma} must appear before any functions that throw or catch
19154 exceptions, or run destructors when exceptions are thrown through them.
19155
19156 You cannot mix Java and C++ exceptions in the same translation unit.  It
19157 is believed to be safe to throw a C++ exception from one file through
19158 another file compiled for the Java exception model, or vice versa, but
19159 there may be bugs in this area.
19160
19161 @node Deprecated Features
19162 @section Deprecated Features
19163
19164 In the past, the GNU C++ compiler was extended to experiment with new
19165 features, at a time when the C++ language was still evolving.  Now that
19166 the C++ standard is complete, some of those features are superseded by
19167 superior alternatives.  Using the old features might cause a warning in
19168 some cases that the feature will be dropped in the future.  In other
19169 cases, the feature might be gone already.
19170
19171 While the list below is not exhaustive, it documents some of the options
19172 that are now deprecated:
19173
19174 @table @code
19175 @item -fexternal-templates
19176 @itemx -falt-external-templates
19177 These are two of the many ways for G++ to implement template
19178 instantiation.  @xref{Template Instantiation}.  The C++ standard clearly
19179 defines how template definitions have to be organized across
19180 implementation units.  G++ has an implicit instantiation mechanism that
19181 should work just fine for standard-conforming code.
19182
19183 @item -fstrict-prototype
19184 @itemx -fno-strict-prototype
19185 Previously it was possible to use an empty prototype parameter list to
19186 indicate an unspecified number of parameters (like C), rather than no
19187 parameters, as C++ demands.  This feature has been removed, except where
19188 it is required for backwards compatibility.   @xref{Backwards Compatibility}.
19189 @end table
19190
19191 G++ allows a virtual function returning @samp{void *} to be overridden
19192 by one returning a different pointer type.  This extension to the
19193 covariant return type rules is now deprecated and will be removed from a
19194 future version.
19195
19196 The G++ minimum and maximum operators (@samp{<?} and @samp{>?}) and
19197 their compound forms (@samp{<?=}) and @samp{>?=}) have been deprecated
19198 and are now removed from G++.  Code using these operators should be
19199 modified to use @code{std::min} and @code{std::max} instead.
19200
19201 The named return value extension has been deprecated, and is now
19202 removed from G++.
19203
19204 The use of initializer lists with new expressions has been deprecated,
19205 and is now removed from G++.
19206
19207 Floating and complex non-type template parameters have been deprecated,
19208 and are now removed from G++.
19209
19210 The implicit typename extension has been deprecated and is now
19211 removed from G++.
19212
19213 The use of default arguments in function pointers, function typedefs
19214 and other places where they are not permitted by the standard is
19215 deprecated and will be removed from a future version of G++.
19216
19217 G++ allows floating-point literals to appear in integral constant expressions,
19218 e.g.@: @samp{ enum E @{ e = int(2.2 * 3.7) @} }
19219 This extension is deprecated and will be removed from a future version.
19220
19221 G++ allows static data members of const floating-point type to be declared
19222 with an initializer in a class definition. The standard only allows
19223 initializers for static members of const integral types and const
19224 enumeration types so this extension has been deprecated and will be removed
19225 from a future version.
19226
19227 @node Backwards Compatibility
19228 @section Backwards Compatibility
19229 @cindex Backwards Compatibility
19230 @cindex ARM [Annotated C++ Reference Manual]
19231
19232 Now that there is a definitive ISO standard C++, G++ has a specification
19233 to adhere to.  The C++ language evolved over time, and features that
19234 used to be acceptable in previous drafts of the standard, such as the ARM
19235 [Annotated C++ Reference Manual], are no longer accepted.  In order to allow
19236 compilation of C++ written to such drafts, G++ contains some backwards
19237 compatibilities.  @emph{All such backwards compatibility features are
19238 liable to disappear in future versions of G++.} They should be considered
19239 deprecated.   @xref{Deprecated Features}.
19240
19241 @table @code
19242 @item For scope
19243 If a variable is declared at for scope, it used to remain in scope until
19244 the end of the scope that contained the for statement (rather than just
19245 within the for scope).  G++ retains this, but issues a warning, if such a
19246 variable is accessed outside the for scope.
19247
19248 @item Implicit C language
19249 Old C system header files did not contain an @code{extern "C" @{@dots{}@}}
19250 scope to set the language.  On such systems, all header files are
19251 implicitly scoped inside a C language scope.  Also, an empty prototype
19252 @code{()} is treated as an unspecified number of arguments, rather
19253 than no arguments, as C++ demands.
19254 @end table
19255
19256 @c  LocalWords:  emph deftypefn builtin ARCv2EM SIMD builtins msimd
19257 @c  LocalWords:  typedef v4si v8hi DMA dma vdiwr vdowr followign