1*ec02198aSmrg@c Copyright (C) 2002-2020 Free Software Foundation, Inc.
210d565efSmrg@c This is part of the GCC manual.
310d565efSmrg@c For copying conditions, see the file gcc.texi.
410d565efSmrg
510d565efSmrg@node Source Tree
610d565efSmrg@chapter Source Tree Structure and Build System
710d565efSmrg
810d565efSmrgThis chapter describes the structure of the GCC source tree, and how
910d565efSmrgGCC is built.  The user documentation for building and installing GCC
1010d565efSmrgis in a separate manual (@uref{http://gcc.gnu.org/install/}), with
1110d565efSmrgwhich it is presumed that you are familiar.
1210d565efSmrg
1310d565efSmrg@menu
1410d565efSmrg* Configure Terms:: Configuration terminology and history.
1510d565efSmrg* Top Level::       The top level source directory.
1610d565efSmrg* gcc Directory::   The @file{gcc} subdirectory.
1710d565efSmrg@end menu
1810d565efSmrg
1910d565efSmrg@include configterms.texi
2010d565efSmrg
2110d565efSmrg@node Top Level
2210d565efSmrg@section Top Level Source Directory
2310d565efSmrg
2410d565efSmrgThe top level source directory in a GCC distribution contains several
2510d565efSmrgfiles and directories that are shared with other software
2610d565efSmrgdistributions such as that of GNU Binutils.  It also contains several
2710d565efSmrgsubdirectories that contain parts of GCC and its runtime libraries:
2810d565efSmrg
2910d565efSmrg@table @file
3010d565efSmrg@item boehm-gc
3110d565efSmrgThe Boehm conservative garbage collector, optionally used as part of
3210d565efSmrgthe ObjC runtime library when configured with @option{--enable-objc-gc}.
3310d565efSmrg
3410d565efSmrg@item config
3510d565efSmrgAutoconf macros and Makefile fragments used throughout the tree.
3610d565efSmrg
3710d565efSmrg@item contrib
3810d565efSmrgContributed scripts that may be found useful in conjunction with GCC@.
3910d565efSmrgOne of these, @file{contrib/texi2pod.pl}, is used to generate man
4010d565efSmrgpages from Texinfo manuals as part of the GCC build process.
4110d565efSmrg
4210d565efSmrg@item fixincludes
4310d565efSmrgThe support for fixing system headers to work with GCC@.  See
4410d565efSmrg@file{fixincludes/README} for more information.  The headers fixed by
4510d565efSmrgthis mechanism are installed in @file{@var{libsubdir}/include-fixed}.
4610d565efSmrgAlong with those headers, @file{README-fixinc} is also installed, as
4710d565efSmrg@file{@var{libsubdir}/include-fixed/README}.
4810d565efSmrg
4910d565efSmrg@item gcc
5010d565efSmrgThe main sources of GCC itself (except for runtime libraries),
5110d565efSmrgincluding optimizers, support for different target architectures,
5210d565efSmrglanguage front ends, and testsuites.  @xref{gcc Directory, , The
5310d565efSmrg@file{gcc} Subdirectory}, for details.
5410d565efSmrg
5510d565efSmrg@item gnattools
5610d565efSmrgSupport tools for GNAT.
5710d565efSmrg
5810d565efSmrg@item include
5910d565efSmrgHeaders for the @code{libiberty} library.
6010d565efSmrg
6110d565efSmrg@item intl
6210d565efSmrgGNU @code{libintl}, from GNU @code{gettext}, for systems which do not
6310d565efSmrginclude it in @code{libc}.
6410d565efSmrg
6510d565efSmrg@item libada
6610d565efSmrgThe Ada runtime library.
6710d565efSmrg
6810d565efSmrg@item libatomic
690fc04c29SmrgThe runtime support library for atomic operations (e.g.@: for @code{__sync}
7010d565efSmrgand @code{__atomic}).
7110d565efSmrg
7210d565efSmrg@item libcpp
7310d565efSmrgThe C preprocessor library.
7410d565efSmrg
7510d565efSmrg@item libdecnumber
7610d565efSmrgThe Decimal Float support library.
7710d565efSmrg
7810d565efSmrg@item libffi
7910d565efSmrgThe @code{libffi} library, used as part of the Go runtime library.
8010d565efSmrg
8110d565efSmrg@item libgcc
8210d565efSmrgThe GCC runtime library.
8310d565efSmrg
8410d565efSmrg@item libgfortran
8510d565efSmrgThe Fortran runtime library.
8610d565efSmrg
8710d565efSmrg@item libgo
8810d565efSmrgThe Go runtime library.  The bulk of this library is mirrored from the
8910d565efSmrg@uref{https://github.com/@/golang/go, master Go repository}.
9010d565efSmrg
9110d565efSmrg@item libgomp
9210d565efSmrgThe GNU Offloading and Multi Processing Runtime Library.
9310d565efSmrg
9410d565efSmrg@item libiberty
9510d565efSmrgThe @code{libiberty} library, used for portability and for some
9610d565efSmrggenerally useful data structures and algorithms.  @xref{Top, ,
9710d565efSmrgIntroduction, libiberty, @sc{gnu} libiberty}, for more information
9810d565efSmrgabout this library.
9910d565efSmrg
10010d565efSmrg@item libitm
10110d565efSmrgThe runtime support library for transactional memory.
10210d565efSmrg
10310d565efSmrg@item libobjc
10410d565efSmrgThe Objective-C and Objective-C++ runtime library.
10510d565efSmrg
10610d565efSmrg@item libquadmath
10710d565efSmrgThe runtime support library for quad-precision math operations.
10810d565efSmrg
1090fc04c29Smrg@item libphobos
1100fc04c29SmrgThe D standard and runtime library.  The bulk of this library is mirrored
1110fc04c29Smrgfrom the @uref{https://github.com/@/dlang, master D repositories}.
1120fc04c29Smrg
11310d565efSmrg@item libssp
11410d565efSmrgThe Stack protector runtime library.
11510d565efSmrg
11610d565efSmrg@item libstdc++-v3
11710d565efSmrgThe C++ runtime library.
11810d565efSmrg
11910d565efSmrg@item lto-plugin
12010d565efSmrgPlugin used by the linker if link-time optimizations are enabled.
12110d565efSmrg
12210d565efSmrg@item maintainer-scripts
12310d565efSmrgScripts used by the @code{gccadmin} account on @code{gcc.gnu.org}.
12410d565efSmrg
12510d565efSmrg@item zlib
12610d565efSmrgThe @code{zlib} compression library, used for compressing and
12710d565efSmrguncompressing GCC's intermediate language in LTO object files.
12810d565efSmrg@end table
12910d565efSmrg
13010d565efSmrgThe build system in the top level directory, including how recursion
13110d565efSmrginto subdirectories works and how building runtime libraries for
13210d565efSmrgmultilibs is handled, is documented in a separate manual, included
13310d565efSmrgwith GNU Binutils.  @xref{Top, , GNU configure and build system,
13410d565efSmrgconfigure, The GNU configure and build system}, for details.
13510d565efSmrg
13610d565efSmrg@node gcc Directory
13710d565efSmrg@section The @file{gcc} Subdirectory
13810d565efSmrg
13910d565efSmrgThe @file{gcc} directory contains many files that are part of the C
14010d565efSmrgsources of GCC, other files used as part of the configuration and
14110d565efSmrgbuild process, and subdirectories including documentation and a
14210d565efSmrgtestsuite.  The files that are sources of GCC are documented in a
14310d565efSmrgseparate chapter.  @xref{Passes, , Passes and Files of the Compiler}.
14410d565efSmrg
14510d565efSmrg@menu
14610d565efSmrg* Subdirectories:: Subdirectories of @file{gcc}.
14710d565efSmrg* Configuration::  The configuration process, and the files it uses.
14810d565efSmrg* Build::          The build system in the @file{gcc} directory.
14910d565efSmrg* Makefile::       Targets in @file{gcc/Makefile}.
15010d565efSmrg* Library Files::  Library source files and headers under @file{gcc/}.
15110d565efSmrg* Headers::        Headers installed by GCC.
15210d565efSmrg* Documentation::  Building documentation in GCC.
15310d565efSmrg* Front End::      Anatomy of a language front end.
15410d565efSmrg* Back End::       Anatomy of a target back end.
15510d565efSmrg@end menu
15610d565efSmrg
15710d565efSmrg@node Subdirectories
15810d565efSmrg@subsection Subdirectories of @file{gcc}
15910d565efSmrg
16010d565efSmrgThe @file{gcc} directory contains the following subdirectories:
16110d565efSmrg
16210d565efSmrg@table @file
16310d565efSmrg@item @var{language}
16410d565efSmrgSubdirectories for various languages.  Directories containing a file
16510d565efSmrg@file{config-lang.in} are language subdirectories.  The contents of
16610d565efSmrgthe subdirectories @file{c} (for C), @file{cp} (for C++),
16710d565efSmrg@file{objc} (for Objective-C), @file{objcp} (for Objective-C++),
16810d565efSmrgand @file{lto} (for LTO) are documented in this
16910d565efSmrgmanual (@pxref{Passes, , Passes and Files of the Compiler});
17010d565efSmrgthose for other languages are not.  @xref{Front End, ,
17110d565efSmrgAnatomy of a Language Front End}, for details of the files in these
17210d565efSmrgdirectories.
17310d565efSmrg
17410d565efSmrg@item common
17510d565efSmrgSource files shared between the compiler drivers (such as
17610d565efSmrg@command{gcc}) and the compilers proper (such as @file{cc1}).  If an
17710d565efSmrgarchitecture defines target hooks shared between those places, it also
17810d565efSmrghas a subdirectory in @file{common/config}.  @xref{Target Structure}.
17910d565efSmrg
18010d565efSmrg@item config
18110d565efSmrgConfiguration files for supported architectures and operating
18210d565efSmrgsystems.  @xref{Back End, , Anatomy of a Target Back End}, for
18310d565efSmrgdetails of the files in this directory.
18410d565efSmrg
18510d565efSmrg@item doc
18610d565efSmrgTexinfo documentation for GCC, together with automatically generated
18710d565efSmrgman pages and support for converting the installation manual to
18810d565efSmrgHTML@.  @xref{Documentation}.
18910d565efSmrg
19010d565efSmrg@item ginclude
19110d565efSmrgSystem headers installed by GCC, mainly those required by the C
19210d565efSmrgstandard of freestanding implementations.  @xref{Headers, , Headers
19310d565efSmrgInstalled by GCC}, for details of when these and other headers are
19410d565efSmrginstalled.
19510d565efSmrg
19610d565efSmrg@item po
19710d565efSmrgMessage catalogs with translations of messages produced by GCC into
19810d565efSmrgvarious languages, @file{@var{language}.po}.  This directory also
19910d565efSmrgcontains @file{gcc.pot}, the template for these message catalogues,
20010d565efSmrg@file{exgettext}, a wrapper around @command{gettext} to extract the
20110d565efSmrgmessages from the GCC sources and create @file{gcc.pot}, which is run
20210d565efSmrgby @samp{make gcc.pot}, and @file{EXCLUDES}, a list of files from
20310d565efSmrgwhich messages should not be extracted.
20410d565efSmrg
20510d565efSmrg@item testsuite
20610d565efSmrgThe GCC testsuites (except for those for runtime libraries).
20710d565efSmrg@xref{Testsuites}.
20810d565efSmrg@end table
20910d565efSmrg
21010d565efSmrg@node Configuration
21110d565efSmrg@subsection Configuration in the @file{gcc} Directory
21210d565efSmrg
21310d565efSmrgThe @file{gcc} directory is configured with an Autoconf-generated
21410d565efSmrgscript @file{configure}.  The @file{configure} script is generated
21510d565efSmrgfrom @file{configure.ac} and @file{aclocal.m4}.  From the files
21610d565efSmrg@file{configure.ac} and @file{acconfig.h}, Autoheader generates the
21710d565efSmrgfile @file{config.in}.  The file @file{cstamp-h.in} is used as a
21810d565efSmrgtimestamp.
21910d565efSmrg
22010d565efSmrg@menu
22110d565efSmrg* Config Fragments::     Scripts used by @file{configure}.
22210d565efSmrg* System Config::        The @file{config.build}, @file{config.host}, and
22310d565efSmrg                         @file{config.gcc} files.
22410d565efSmrg* Configuration Files::  Files created by running @file{configure}.
22510d565efSmrg@end menu
22610d565efSmrg
22710d565efSmrg@node Config Fragments
22810d565efSmrg@subsubsection Scripts Used by @file{configure}
22910d565efSmrg
23010d565efSmrg@file{configure} uses some other scripts to help in its work:
23110d565efSmrg
23210d565efSmrg@itemize @bullet
23310d565efSmrg@item The standard GNU @file{config.sub} and @file{config.guess}
23410d565efSmrgfiles, kept in the top level directory, are used.
23510d565efSmrg
23610d565efSmrg@item The file @file{config.gcc} is used to handle configuration
23710d565efSmrgspecific to the particular target machine.  The file
23810d565efSmrg@file{config.build} is used to handle configuration specific to the
23910d565efSmrgparticular build machine.  The file @file{config.host} is used to handle
24010d565efSmrgconfiguration specific to the particular host machine.  (In general,
24110d565efSmrgthese should only be used for features that cannot reasonably be tested in
24210d565efSmrgAutoconf feature tests.)
24310d565efSmrg@xref{System Config, , The @file{config.build}; @file{config.host};
24410d565efSmrgand @file{config.gcc} Files}, for details of the contents of these files.
24510d565efSmrg
24610d565efSmrg@item Each language subdirectory has a file
24710d565efSmrg@file{@var{language}/config-lang.in} that is used for
24810d565efSmrgfront-end-specific configuration.  @xref{Front End Config, , The Front
24910d565efSmrgEnd @file{config-lang.in} File}, for details of this file.
25010d565efSmrg
25110d565efSmrg@item A helper script @file{configure.frag} is used as part of
25210d565efSmrgcreating the output of @file{configure}.
25310d565efSmrg@end itemize
25410d565efSmrg
25510d565efSmrg@node System Config
25610d565efSmrg@subsubsection The @file{config.build}; @file{config.host}; and @file{config.gcc} Files
25710d565efSmrg
25810d565efSmrgThe @file{config.build} file contains specific rules for particular systems
25910d565efSmrgwhich GCC is built on.  This should be used as rarely as possible, as the
26010d565efSmrgbehavior of the build system can always be detected by autoconf.
26110d565efSmrg
26210d565efSmrgThe @file{config.host} file contains specific rules for particular systems
26310d565efSmrgwhich GCC will run on.  This is rarely needed.
26410d565efSmrg
26510d565efSmrgThe @file{config.gcc} file contains specific rules for particular systems
26610d565efSmrgwhich GCC will generate code for.  This is usually needed.
26710d565efSmrg
26810d565efSmrgEach file has a list of the shell variables it sets, with descriptions, at the
26910d565efSmrgtop of the file.
27010d565efSmrg
27110d565efSmrgFIXME: document the contents of these files, and what variables should
27210d565efSmrgbe set to control build, host and target configuration.
27310d565efSmrg
27410d565efSmrg@include configfiles.texi
27510d565efSmrg
27610d565efSmrg@node Build
27710d565efSmrg@subsection Build System in the @file{gcc} Directory
27810d565efSmrg
27910d565efSmrgFIXME: describe the build system, including what is built in what
28010d565efSmrgstages.  Also list the various source files that are used in the build
28110d565efSmrgprocess but aren't source files of GCC itself and so aren't documented
28210d565efSmrgbelow (@pxref{Passes}).
28310d565efSmrg
28410d565efSmrg@include makefile.texi
28510d565efSmrg
28610d565efSmrg@node Library Files
28710d565efSmrg@subsection Library Source Files and Headers under the @file{gcc} Directory
28810d565efSmrg
28910d565efSmrgFIXME: list here, with explanation, all the C source files and headers
29010d565efSmrgunder the @file{gcc} directory that aren't built into the GCC
29110d565efSmrgexecutable but rather are part of runtime libraries and object files,
29210d565efSmrgsuch as @file{crtstuff.c} and @file{unwind-dw2.c}.  @xref{Headers, ,
29310d565efSmrgHeaders Installed by GCC}, for more information about the
29410d565efSmrg@file{ginclude} directory.
29510d565efSmrg
29610d565efSmrg@node Headers
29710d565efSmrg@subsection Headers Installed by GCC
29810d565efSmrg
29910d565efSmrgIn general, GCC expects the system C library to provide most of the
30010d565efSmrgheaders to be used with it.  However, GCC will fix those headers if
30110d565efSmrgnecessary to make them work with GCC, and will install some headers
30210d565efSmrgrequired of freestanding implementations.  These headers are installed
30310d565efSmrgin @file{@var{libsubdir}/include}.  Headers for non-C runtime
30410d565efSmrglibraries are also installed by GCC; these are not documented here.
30510d565efSmrg(FIXME: document them somewhere.)
30610d565efSmrg
30710d565efSmrgSeveral of the headers GCC installs are in the @file{ginclude}
30810d565efSmrgdirectory.  These headers, @file{iso646.h},
30910d565efSmrg@file{stdarg.h}, @file{stdbool.h}, and @file{stddef.h},
31010d565efSmrgare installed in @file{@var{libsubdir}/include},
31110d565efSmrgunless the target Makefile fragment (@pxref{Target Fragment})
31210d565efSmrgoverrides this by setting @code{USER_H}.
31310d565efSmrg
31410d565efSmrgIn addition to these headers and those generated by fixing system
31510d565efSmrgheaders to work with GCC, some other headers may also be installed in
31610d565efSmrg@file{@var{libsubdir}/include}.  @file{config.gcc} may set
31710d565efSmrg@code{extra_headers}; this specifies additional headers under
31810d565efSmrg@file{config} to be installed on some systems.
31910d565efSmrg
32010d565efSmrgGCC installs its own version of @code{<float.h>}, from @file{ginclude/float.h}.
32110d565efSmrgThis is done to cope with command-line options that change the
32210d565efSmrgrepresentation of floating point numbers.
32310d565efSmrg
32410d565efSmrgGCC also installs its own version of @code{<limits.h>}; this is generated
32510d565efSmrgfrom @file{glimits.h}, together with @file{limitx.h} and
32610d565efSmrg@file{limity.h} if the system also has its own version of
32710d565efSmrg@code{<limits.h>}.  (GCC provides its own header because it is
32810d565efSmrgrequired of ISO C freestanding implementations, but needs to include
32910d565efSmrgthe system header from its own header as well because other standards
33010d565efSmrgsuch as POSIX specify additional values to be defined in
33110d565efSmrg@code{<limits.h>}.)  The system's @code{<limits.h>} header is used via
33210d565efSmrg@file{@var{libsubdir}/include/syslimits.h}, which is copied from
33310d565efSmrg@file{gsyslimits.h} if it does not need fixing to work with GCC; if it
33410d565efSmrgneeds fixing, @file{syslimits.h} is the fixed copy.
33510d565efSmrg
33610d565efSmrgGCC can also install @code{<tgmath.h>}.  It will do this when
33710d565efSmrg@file{config.gcc} sets @code{use_gcc_tgmath} to @code{yes}.
33810d565efSmrg
33910d565efSmrg@node Documentation
34010d565efSmrg@subsection Building Documentation
34110d565efSmrg
34210d565efSmrgThe main GCC documentation is in the form of manuals in Texinfo
34310d565efSmrgformat.  These are installed in Info format; DVI versions may be
34410d565efSmrggenerated by @samp{make dvi}, PDF versions by @samp{make pdf}, and
34510d565efSmrgHTML versions by @samp{make html}.  In addition, some man pages are
34610d565efSmrggenerated from the Texinfo manuals, there are some other text files
34710d565efSmrgwith miscellaneous documentation, and runtime libraries have their own
34810d565efSmrgdocumentation outside the @file{gcc} directory.  FIXME: document the
34910d565efSmrgdocumentation for runtime libraries somewhere.
35010d565efSmrg
35110d565efSmrg@menu
35210d565efSmrg* Texinfo Manuals::      GCC manuals in Texinfo format.
35310d565efSmrg* Man Page Generation::  Generating man pages from Texinfo manuals.
35410d565efSmrg* Miscellaneous Docs::   Miscellaneous text files with documentation.
35510d565efSmrg@end menu
35610d565efSmrg
35710d565efSmrg@node Texinfo Manuals
35810d565efSmrg@subsubsection Texinfo Manuals
35910d565efSmrg
36010d565efSmrgThe manuals for GCC as a whole, and the C and C++ front ends, are in
36110d565efSmrgfiles @file{doc/*.texi}.  Other front ends have their own manuals in
36210d565efSmrgfiles @file{@var{language}/*.texi}.  Common files
36310d565efSmrg@file{doc/include/*.texi} are provided which may be included in
36410d565efSmrgmultiple manuals; the following files are in @file{doc/include}:
36510d565efSmrg
36610d565efSmrg@table @file
36710d565efSmrg@item fdl.texi
36810d565efSmrgThe GNU Free Documentation License.
36910d565efSmrg@item funding.texi
37010d565efSmrgThe section ``Funding Free Software''.
37110d565efSmrg@item gcc-common.texi
37210d565efSmrgCommon definitions for manuals.
37310d565efSmrg@item gpl_v3.texi
37410d565efSmrgThe GNU General Public License.
37510d565efSmrg@item texinfo.tex
37610d565efSmrgA copy of @file{texinfo.tex} known to work with the GCC manuals.
37710d565efSmrg@end table
37810d565efSmrg
37910d565efSmrgDVI-formatted manuals are generated by @samp{make dvi}, which uses
38010d565efSmrg@command{texi2dvi} (via the Makefile macro @code{$(TEXI2DVI)}).
38110d565efSmrgPDF-formatted manuals are generated by @samp{make pdf}, which uses
38210d565efSmrg@command{texi2pdf} (via the Makefile macro @code{$(TEXI2PDF)}).  HTML
38310d565efSmrgformatted manuals are generated by @samp{make html}.  Info
38410d565efSmrgmanuals are generated by @samp{make info} (which is run as part of
38510d565efSmrga bootstrap); this generates the manuals in the source directory,
38610d565efSmrgusing @command{makeinfo} via the Makefile macro @code{$(MAKEINFO)},
38710d565efSmrgand they are included in release distributions.
38810d565efSmrg
38910d565efSmrgManuals are also provided on the GCC web site, in both HTML and
39010d565efSmrgPostScript forms.  This is done via the script
391*ec02198aSmrg@file{maintainer-scripts/update_web_docs_git}.  Each manual to be
39210d565efSmrgprovided online must be listed in the definition of @code{MANUALS} in
39310d565efSmrgthat file; a file @file{@var{name}.texi} must only appear once in the
39410d565efSmrgsource tree, and the output manual must have the same name as the
39510d565efSmrgsource file.  (However, other Texinfo files, included in manuals but
39610d565efSmrgnot themselves the root files of manuals, may have names that appear
39710d565efSmrgmore than once in the source tree.)  The manual file
39810d565efSmrg@file{@var{name}.texi} should only include other files in its own
39910d565efSmrgdirectory or in @file{doc/include}.  HTML manuals will be generated by
40010d565efSmrg@samp{makeinfo --html}, PostScript manuals by @command{texi2dvi}
40110d565efSmrgand @command{dvips}, and PDF manuals by @command{texi2pdf}.
40210d565efSmrgAll Texinfo files that are parts of manuals must
40310d565efSmrgbe version-controlled, even if they are generated files, for the
40410d565efSmrggeneration of online manuals to work.
40510d565efSmrg
40610d565efSmrgThe installation manual, @file{doc/install.texi}, is also provided on
40710d565efSmrgthe GCC web site.  The HTML version is generated by the script
40810d565efSmrg@file{doc/install.texi2html}.
40910d565efSmrg
41010d565efSmrg@node Man Page Generation
41110d565efSmrg@subsubsection Man Page Generation
41210d565efSmrg
41310d565efSmrgBecause of user demand, in addition to full Texinfo manuals, man pages
41410d565efSmrgare provided which contain extracts from those manuals.  These man
41510d565efSmrgpages are generated from the Texinfo manuals using
41610d565efSmrg@file{contrib/texi2pod.pl} and @command{pod2man}.  (The man page for
41710d565efSmrg@command{g++}, @file{cp/g++.1}, just contains a @samp{.so} reference
41810d565efSmrgto @file{gcc.1}, but all the other man pages are generated from
41910d565efSmrgTexinfo manuals.)
42010d565efSmrg
42110d565efSmrgBecause many systems may not have the necessary tools installed to
42210d565efSmrggenerate the man pages, they are only generated if the
42310d565efSmrg@file{configure} script detects that recent enough tools are
42410d565efSmrginstalled, and the Makefiles allow generating man pages to fail
42510d565efSmrgwithout aborting the build.  Man pages are also included in release
42610d565efSmrgdistributions.  They are generated in the source directory.
42710d565efSmrg
42810d565efSmrgMagic comments in Texinfo files starting @samp{@@c man} control what
42910d565efSmrgparts of a Texinfo file go into a man page.  Only a subset of Texinfo
43010d565efSmrgis supported by @file{texi2pod.pl}, and it may be necessary to add
43110d565efSmrgsupport for more Texinfo features to this script when generating new
43210d565efSmrgman pages.  To improve the man page output, some special Texinfo
43310d565efSmrgmacros are provided in @file{doc/include/gcc-common.texi} which
43410d565efSmrg@file{texi2pod.pl} understands:
43510d565efSmrg
43610d565efSmrg@table @code
43710d565efSmrg@item @@gcctabopt
43810d565efSmrgUse in the form @samp{@@table @@gcctabopt} for tables of options,
43910d565efSmrgwhere for printed output the effect of @samp{@@code} is better than
44010d565efSmrgthat of @samp{@@option} but for man page output a different effect is
44110d565efSmrgwanted.
44210d565efSmrg@item @@gccoptlist
44310d565efSmrgUse for summary lists of options in manuals.
44410d565efSmrg@item @@gol
44510d565efSmrgUse at the end of each line inside @samp{@@gccoptlist}.  This is
44610d565efSmrgnecessary to avoid problems with differences in how the
44710d565efSmrg@samp{@@gccoptlist} macro is handled by different Texinfo formatters.
44810d565efSmrg@end table
44910d565efSmrg
45010d565efSmrgFIXME: describe the @file{texi2pod.pl} input language and magic
45110d565efSmrgcomments in more detail.
45210d565efSmrg
45310d565efSmrg@node Miscellaneous Docs
45410d565efSmrg@subsubsection Miscellaneous Documentation
45510d565efSmrg
45610d565efSmrgIn addition to the formal documentation that is installed by GCC,
45710d565efSmrgthere are several other text files in the @file{gcc} subdirectory
45810d565efSmrgwith miscellaneous documentation:
45910d565efSmrg
46010d565efSmrg@table @file
46110d565efSmrg@item ABOUT-GCC-NLS
46210d565efSmrgNotes on GCC's Native Language Support.  FIXME: this should be part of
46310d565efSmrgthis manual rather than a separate file.
46410d565efSmrg@item ABOUT-NLS
46510d565efSmrgNotes on the Free Translation Project.
46610d565efSmrg@item COPYING
46710d565efSmrg@itemx COPYING3
46810d565efSmrgThe GNU General Public License, Versions 2 and 3.
46910d565efSmrg@item COPYING.LIB
47010d565efSmrg@itemx COPYING3.LIB
47110d565efSmrgThe GNU Lesser General Public License, Versions 2.1 and 3.
47210d565efSmrg@item *ChangeLog*
47310d565efSmrg@itemx */ChangeLog*
47410d565efSmrgChange log files for various parts of GCC@.
47510d565efSmrg@item LANGUAGES
47610d565efSmrgDetails of a few changes to the GCC front-end interface.  FIXME: the
47710d565efSmrginformation in this file should be part of general documentation of
47810d565efSmrgthe front-end interface in this manual.
47910d565efSmrg@item ONEWS
48010d565efSmrgInformation about new features in old versions of GCC@.  (For recent
48110d565efSmrgversions, the information is on the GCC web site.)
48210d565efSmrg@item README.Portability
48310d565efSmrgInformation about portability issues when writing code in GCC@.  FIXME:
48410d565efSmrgwhy isn't this part of this manual or of the GCC Coding Conventions?
48510d565efSmrg@end table
48610d565efSmrg
48710d565efSmrgFIXME: document such files in subdirectories, at least @file{config},
48810d565efSmrg@file{c}, @file{cp}, @file{objc}, @file{testsuite}.
48910d565efSmrg
49010d565efSmrg@node Front End
49110d565efSmrg@subsection Anatomy of a Language Front End
49210d565efSmrg
49310d565efSmrgA front end for a language in GCC has the following parts:
49410d565efSmrg
49510d565efSmrg@itemize @bullet
49610d565efSmrg@item
49710d565efSmrgA directory @file{@var{language}} under @file{gcc} containing source
49810d565efSmrgfiles for that front end.  @xref{Front End Directory, , The Front End
49910d565efSmrg@file{@var{language}} Directory}, for details.
50010d565efSmrg@item
50110d565efSmrgA mention of the language in the list of supported languages in
50210d565efSmrg@file{gcc/doc/install.texi}.
50310d565efSmrg@item
50410d565efSmrgA mention of the name under which the language's runtime library is
50510d565efSmrgrecognized by @option{--enable-shared=@var{package}} in the
50610d565efSmrgdocumentation of that option in @file{gcc/doc/install.texi}.
50710d565efSmrg@item
50810d565efSmrgA mention of any special prerequisites for building the front end in
50910d565efSmrgthe documentation of prerequisites in @file{gcc/doc/install.texi}.
51010d565efSmrg@item
51110d565efSmrgDetails of contributors to that front end in
51210d565efSmrg@file{gcc/doc/contrib.texi}.  If the details are in that front end's
51310d565efSmrgown manual then there should be a link to that manual's list in
51410d565efSmrg@file{contrib.texi}.
51510d565efSmrg@item
51610d565efSmrgInformation about support for that language in
51710d565efSmrg@file{gcc/doc/frontends.texi}.
51810d565efSmrg@item
51910d565efSmrgInformation about standards for that language, and the front end's
52010d565efSmrgsupport for them, in @file{gcc/doc/standards.texi}.  This may be a
52110d565efSmrglink to such information in the front end's own manual.
52210d565efSmrg@item
52310d565efSmrgDetails of source file suffixes for that language and @option{-x
52410d565efSmrg@var{lang}} options supported, in @file{gcc/doc/invoke.texi}.
52510d565efSmrg@item
52610d565efSmrgEntries in @code{default_compilers} in @file{gcc.c} for source file
52710d565efSmrgsuffixes for that language.
52810d565efSmrg@item
52910d565efSmrgPreferably testsuites, which may be under @file{gcc/testsuite} or
53010d565efSmrgruntime library directories.  FIXME: document somewhere how to write
53110d565efSmrgtestsuite harnesses.
53210d565efSmrg@item
53310d565efSmrgProbably a runtime library for the language, outside the @file{gcc}
53410d565efSmrgdirectory.  FIXME: document this further.
53510d565efSmrg@item
53610d565efSmrgDetails of the directories of any runtime libraries in
53710d565efSmrg@file{gcc/doc/sourcebuild.texi}.
53810d565efSmrg@item
53910d565efSmrgCheck targets in @file{Makefile.def} for the top-level @file{Makefile}
54010d565efSmrgto check just the compiler or the compiler and runtime library for the
54110d565efSmrglanguage.
54210d565efSmrg@end itemize
54310d565efSmrg
54410d565efSmrgIf the front end is added to the official GCC source repository, the
54510d565efSmrgfollowing are also necessary:
54610d565efSmrg
54710d565efSmrg@itemize @bullet
54810d565efSmrg@item
54910d565efSmrgAt least one Bugzilla component for bugs in that front end and runtime
55010d565efSmrglibraries.  This category needs to be added to the Bugzilla database.
55110d565efSmrg@item
55210d565efSmrgNormally, one or more maintainers of that front end listed in
55310d565efSmrg@file{MAINTAINERS}.
55410d565efSmrg@item
55510d565efSmrgMentions on the GCC web site in @file{index.html} and
55610d565efSmrg@file{frontends.html}, with any relevant links on
55710d565efSmrg@file{readings.html}.  (Front ends that are not an official part of
55810d565efSmrgGCC may also be listed on @file{frontends.html}, with relevant links.)
55910d565efSmrg@item
56010d565efSmrgA news item on @file{index.html}, and possibly an announcement on the
56110d565efSmrg@email{gcc-announce@@gcc.gnu.org} mailing list.
56210d565efSmrg@item
56310d565efSmrgThe front end's manuals should be mentioned in
564*ec02198aSmrg@file{maintainer-scripts/update_web_docs_git} (@pxref{Texinfo Manuals})
56510d565efSmrgand the online manuals should be linked to from
56610d565efSmrg@file{onlinedocs/index.html}.
56710d565efSmrg@item
56810d565efSmrgAny old releases or CVS repositories of the front end, before its
569*ec02198aSmrginclusion in GCC, should be made available on the GCC web site at
570*ec02198aSmrg@uref{https://gcc.gnu.org/pub/gcc/old-releases/}.
57110d565efSmrg@item
57210d565efSmrgThe release and snapshot script @file{maintainer-scripts/gcc_release}
57310d565efSmrgshould be updated to generate appropriate tarballs for this front end.
57410d565efSmrg@item
57510d565efSmrgIf this front end includes its own version files that include the
57610d565efSmrgcurrent date, @file{maintainer-scripts/update_version} should be
57710d565efSmrgupdated accordingly.
57810d565efSmrg@end itemize
57910d565efSmrg
58010d565efSmrg@menu
58110d565efSmrg* Front End Directory::  The front end @file{@var{language}} directory.
58210d565efSmrg* Front End Config::     The front end @file{config-lang.in} file.
58310d565efSmrg* Front End Makefile::   The front end @file{Make-lang.in} file.
58410d565efSmrg@end menu
58510d565efSmrg
58610d565efSmrg@node Front End Directory
58710d565efSmrg@subsubsection The Front End @file{@var{language}} Directory
58810d565efSmrg
58910d565efSmrgA front end @file{@var{language}} directory contains the source files
59010d565efSmrgof that front end (but not of any runtime libraries, which should be
59110d565efSmrgoutside the @file{gcc} directory).  This includes documentation, and
59210d565efSmrgpossibly some subsidiary programs built alongside the front end.
59310d565efSmrgCertain files are special and other parts of the compiler depend on
59410d565efSmrgtheir names:
59510d565efSmrg
59610d565efSmrg@table @file
59710d565efSmrg@item config-lang.in
59810d565efSmrgThis file is required in all language subdirectories.  @xref{Front End
59910d565efSmrgConfig, , The Front End @file{config-lang.in} File}, for details of
60010d565efSmrgits contents
60110d565efSmrg@item Make-lang.in
60210d565efSmrgThis file is required in all language subdirectories.  @xref{Front End
60310d565efSmrgMakefile, , The Front End @file{Make-lang.in} File}, for details of its
60410d565efSmrgcontents.
60510d565efSmrg@item lang.opt
60610d565efSmrgThis file registers the set of switches that the front end accepts on
60710d565efSmrgthe command line, and their @option{--help} text.  @xref{Options}.
60810d565efSmrg@item lang-specs.h
60910d565efSmrgThis file provides entries for @code{default_compilers} in
61010d565efSmrg@file{gcc.c} which override the default of giving an error that a
61110d565efSmrgcompiler for that language is not installed.
61210d565efSmrg@item @var{language}-tree.def
61310d565efSmrgThis file, which need not exist, defines any language-specific tree
61410d565efSmrgcodes.
61510d565efSmrg@end table
61610d565efSmrg
61710d565efSmrg@node Front End Config
61810d565efSmrg@subsubsection The Front End @file{config-lang.in} File
61910d565efSmrg
62010d565efSmrgEach language subdirectory contains a @file{config-lang.in} file.
62110d565efSmrgThis file is a shell script that may define some variables describing
62210d565efSmrgthe language:
62310d565efSmrg
62410d565efSmrg@table @code
62510d565efSmrg@item language
62610d565efSmrgThis definition must be present, and gives the name of the language
62710d565efSmrgfor some purposes such as arguments to @option{--enable-languages}.
62810d565efSmrg@item lang_requires
62910d565efSmrgIf defined, this variable lists (space-separated) language front ends
63010d565efSmrgother than C that this front end requires to be enabled (with the
63110d565efSmrgnames given being their @code{language} settings).  For example, the
63210d565efSmrgObj-C++ front end depends on the C++ and ObjC front ends, so sets
63310d565efSmrg@samp{lang_requires="objc c++"}.
63410d565efSmrg@item subdir_requires
63510d565efSmrgIf defined, this variable lists (space-separated) front end directories
63610d565efSmrgother than C that this front end requires to be present.  For example,
63710d565efSmrgthe Objective-C++ front end uses source files from the C++ and
63810d565efSmrgObjective-C front ends, so sets @samp{subdir_requires="cp objc"}.
63910d565efSmrg@item target_libs
64010d565efSmrgIf defined, this variable lists (space-separated) targets in the top
64110d565efSmrglevel @file{Makefile} to build the runtime libraries for this
64210d565efSmrglanguage, such as @code{target-libobjc}.
64310d565efSmrg@item lang_dirs
64410d565efSmrgIf defined, this variable lists (space-separated) top level
64510d565efSmrgdirectories (parallel to @file{gcc}), apart from the runtime libraries,
64610d565efSmrgthat should not be configured if this front end is not built.
64710d565efSmrg@item build_by_default
64810d565efSmrgIf defined to @samp{no}, this language front end is not built unless
64910d565efSmrgenabled in a @option{--enable-languages} argument.  Otherwise, front
65010d565efSmrgends are built by default, subject to any special logic in
65110d565efSmrg@file{configure.ac} (as is present to disable the Ada front end if the
65210d565efSmrgAda compiler is not already installed).
65310d565efSmrg@item boot_language
65410d565efSmrgIf defined to @samp{yes}, this front end is built in stage1 of the
65510d565efSmrgbootstrap.  This is only relevant to front ends written in their own
65610d565efSmrglanguages.
65710d565efSmrg@item compilers
65810d565efSmrgIf defined, a space-separated list of compiler executables that will
65910d565efSmrgbe run by the driver.  The names here will each end
66010d565efSmrgwith @samp{\$(exeext)}.
66110d565efSmrg@item outputs
66210d565efSmrgIf defined, a space-separated list of files that should be generated
66310d565efSmrgby @file{configure} substituting values in them.  This mechanism can
66410d565efSmrgbe used to create a file @file{@var{language}/Makefile} from
66510d565efSmrg@file{@var{language}/Makefile.in}, but this is deprecated, building
66610d565efSmrgeverything from the single @file{gcc/Makefile} is preferred.
66710d565efSmrg@item gtfiles
66810d565efSmrgIf defined, a space-separated list of files that should be scanned by
66910d565efSmrg@file{gengtype.c} to generate the garbage collection tables and routines for
67010d565efSmrgthis language.  This excludes the files that are common to all front
67110d565efSmrgends.  @xref{Type Information}.
67210d565efSmrg
67310d565efSmrg@end table
67410d565efSmrg
67510d565efSmrg@node Front End Makefile
67610d565efSmrg@subsubsection The Front End @file{Make-lang.in} File
67710d565efSmrg
67810d565efSmrgEach language subdirectory contains a @file{Make-lang.in} file.  It contains
67910d565efSmrgtargets @code{@var{lang}.@var{hook}} (where @code{@var{lang}} is the
68010d565efSmrgsetting of @code{language} in @file{config-lang.in}) for the following
68110d565efSmrgvalues of @code{@var{hook}}, and any other Makefile rules required to
68210d565efSmrgbuild those targets (which may if necessary use other Makefiles
68310d565efSmrgspecified in @code{outputs} in @file{config-lang.in}, although this is
68410d565efSmrgdeprecated).  It also adds any testsuite targets that can use the
68510d565efSmrgstandard rule in @file{gcc/Makefile.in} to the variable
68610d565efSmrg@code{lang_checks}.
68710d565efSmrg
68810d565efSmrg@table @code
68910d565efSmrg@item all.cross
69010d565efSmrg@itemx start.encap
69110d565efSmrg@itemx rest.encap
69210d565efSmrgFIXME: exactly what goes in each of these targets?
69310d565efSmrg@item tags
69410d565efSmrgBuild an @command{etags} @file{TAGS} file in the language subdirectory
69510d565efSmrgin the source tree.
69610d565efSmrg@item info
69710d565efSmrgBuild info documentation for the front end, in the build directory.
69810d565efSmrgThis target is only called by @samp{make bootstrap} if a suitable
69910d565efSmrgversion of @command{makeinfo} is available, so does not need to check
70010d565efSmrgfor this, and should fail if an error occurs.
70110d565efSmrg@item dvi
70210d565efSmrgBuild DVI documentation for the front end, in the build directory.
70310d565efSmrgThis should be done using @code{$(TEXI2DVI)}, with appropriate
70410d565efSmrg@option{-I} arguments pointing to directories of included files.
70510d565efSmrg@item pdf
70610d565efSmrgBuild PDF documentation for the front end, in the build directory.
70710d565efSmrgThis should be done using @code{$(TEXI2PDF)}, with appropriate
70810d565efSmrg@option{-I} arguments pointing to directories of included files.
70910d565efSmrg@item html
71010d565efSmrgBuild HTML documentation for the front end, in the build directory.
71110d565efSmrg@item man
71210d565efSmrgBuild generated man pages for the front end from Texinfo manuals
71310d565efSmrg(@pxref{Man Page Generation}), in the build directory.  This target
71410d565efSmrgis only called if the necessary tools are available, but should ignore
71510d565efSmrgerrors so as not to stop the build if errors occur; man pages are
71610d565efSmrgoptional and the tools involved may be installed in a broken way.
71710d565efSmrg@item install-common
71810d565efSmrgInstall everything that is part of the front end, apart from the
71910d565efSmrgcompiler executables listed in @code{compilers} in
72010d565efSmrg@file{config-lang.in}.
72110d565efSmrg@item install-info
72210d565efSmrgInstall info documentation for the front end, if it is present in the
72310d565efSmrgsource directory.  This target should have dependencies on info files
72410d565efSmrgthat should be installed.
72510d565efSmrg@item install-man
72610d565efSmrgInstall man pages for the front end.  This target should ignore
72710d565efSmrgerrors.
72810d565efSmrg@item install-plugin
72910d565efSmrgInstall headers needed for plugins.
73010d565efSmrg@item srcextra
73110d565efSmrgCopies its dependencies into the source directory.  This generally should
73210d565efSmrgbe used for generated files such as Bison output files which are not
73310d565efSmrgversion-controlled, but should be included in any release tarballs.  This
73410d565efSmrgtarget will be executed during a bootstrap if
73510d565efSmrg@samp{--enable-generated-files-in-srcdir} was specified as a
73610d565efSmrg@file{configure} option.
73710d565efSmrg@item srcinfo
73810d565efSmrg@itemx srcman
73910d565efSmrgCopies its dependencies into the source directory.  These targets will be
74010d565efSmrgexecuted during a bootstrap if @samp{--enable-generated-files-in-srcdir}
74110d565efSmrgwas specified as a @file{configure} option.
74210d565efSmrg@item uninstall
74310d565efSmrgUninstall files installed by installing the compiler.  This is
74410d565efSmrgcurrently documented not to be supported, so the hook need not do
74510d565efSmrganything.
74610d565efSmrg@item mostlyclean
74710d565efSmrg@itemx clean
74810d565efSmrg@itemx distclean
74910d565efSmrg@itemx maintainer-clean
75010d565efSmrgThe language parts of the standard GNU
75110d565efSmrg@samp{*clean} targets.  @xref{Standard Targets, , Standard Targets for
75210d565efSmrgUsers, standards, GNU Coding Standards}, for details of the standard
75310d565efSmrgtargets.  For GCC, @code{maintainer-clean} should delete
75410d565efSmrgall generated files in the source directory that are not version-controlled,
75510d565efSmrgbut should not delete anything that is.
75610d565efSmrg@end table
75710d565efSmrg
75810d565efSmrg@file{Make-lang.in} must also define a variable @code{@var{lang}_OBJS}
75910d565efSmrgto a list of host object files that are used by that language.
76010d565efSmrg
76110d565efSmrg@node Back End
76210d565efSmrg@subsection Anatomy of a Target Back End
76310d565efSmrg
76410d565efSmrgA back end for a target architecture in GCC has the following parts:
76510d565efSmrg
76610d565efSmrg@itemize @bullet
76710d565efSmrg@item
76810d565efSmrgA directory @file{@var{machine}} under @file{gcc/config}, containing a
76910d565efSmrgmachine description @file{@var{machine}.md} file (@pxref{Machine Desc,
77010d565efSmrg, Machine Descriptions}), header files @file{@var{machine}.h} and
77110d565efSmrg@file{@var{machine}-protos.h} and a source file @file{@var{machine}.c}
77210d565efSmrg(@pxref{Target Macros, , Target Description Macros and Functions}),
77310d565efSmrgpossibly a target Makefile fragment @file{t-@var{machine}}
77410d565efSmrg(@pxref{Target Fragment, , The Target Makefile Fragment}), and maybe
77510d565efSmrgsome other files.  The names of these files may be changed from the
77610d565efSmrgdefaults given by explicit specifications in @file{config.gcc}.
77710d565efSmrg@item
77810d565efSmrgIf necessary, a file @file{@var{machine}-modes.def} in the
77910d565efSmrg@file{@var{machine}} directory, containing additional machine modes to
78010d565efSmrgrepresent condition codes.  @xref{Condition Code}, for further details.
78110d565efSmrg@item
78210d565efSmrgAn optional @file{@var{machine}.opt} file in the @file{@var{machine}}
78310d565efSmrgdirectory, containing a list of target-specific options.  You can also
78410d565efSmrgadd other option files using the @code{extra_options} variable in
78510d565efSmrg@file{config.gcc}.  @xref{Options}.
78610d565efSmrg@item
78710d565efSmrgEntries in @file{config.gcc} (@pxref{System Config, , The
78810d565efSmrg@file{config.gcc} File}) for the systems with this target
78910d565efSmrgarchitecture.
79010d565efSmrg@item
79110d565efSmrgDocumentation in @file{gcc/doc/invoke.texi} for any command-line
79210d565efSmrgoptions supported by this target (@pxref{Run-time Target, , Run-time
79310d565efSmrgTarget Specification}).  This means both entries in the summary table
79410d565efSmrgof options and details of the individual options.
79510d565efSmrg@item
79610d565efSmrgDocumentation in @file{gcc/doc/extend.texi} for any target-specific
79710d565efSmrgattributes supported (@pxref{Target Attributes, , Defining
79810d565efSmrgtarget-specific uses of @code{__attribute__}}), including where the
79910d565efSmrgsame attribute is already supported on some targets, which are
80010d565efSmrgenumerated in the manual.
80110d565efSmrg@item
80210d565efSmrgDocumentation in @file{gcc/doc/extend.texi} for any target-specific
80310d565efSmrgpragmas supported.
80410d565efSmrg@item
80510d565efSmrgDocumentation in @file{gcc/doc/extend.texi} of any target-specific
80610d565efSmrgbuilt-in functions supported.
80710d565efSmrg@item
80810d565efSmrgDocumentation in @file{gcc/doc/extend.texi} of any target-specific
80910d565efSmrgformat checking styles supported.
81010d565efSmrg@item
81110d565efSmrgDocumentation in @file{gcc/doc/md.texi} of any target-specific
81210d565efSmrgconstraint letters (@pxref{Machine Constraints, , Constraints for
81310d565efSmrgParticular Machines}).
81410d565efSmrg@item
81510d565efSmrgA note in @file{gcc/doc/contrib.texi} under the person or people who
81610d565efSmrgcontributed the target support.
81710d565efSmrg@item
81810d565efSmrgEntries in @file{gcc/doc/install.texi} for all target triplets
81910d565efSmrgsupported with this target architecture, giving details of any special
82010d565efSmrgnotes about installation for this target, or saying that there are no
82110d565efSmrgspecial notes if there are none.
82210d565efSmrg@item
82310d565efSmrgPossibly other support outside the @file{gcc} directory for runtime
82410d565efSmrglibraries.  FIXME: reference docs for this.  The @code{libstdc++} porting
82510d565efSmrgmanual needs to be installed as info for this to work, or to be a
82610d565efSmrgchapter of this manual.
82710d565efSmrg@end itemize
82810d565efSmrg
829c7a68eb7SmrgThe @file{@var{machine}.h} header is included very early in GCC's
830c7a68eb7Smrgstandard sequence of header files, while @file{@var{machine}-protos.h}
831c7a68eb7Smrgis included late in the sequence.  Thus @file{@var{machine}-protos.h}
832c7a68eb7Smrgcan include declarations referencing types that are not defined when
833c7a68eb7Smrg@file{@var{machine}.h} is included, specifically including those from
834c7a68eb7Smrg@file{rtl.h} and @file{tree.h}.  Since both RTL and tree types may not
835c7a68eb7Smrgbe available in every context where @file{@var{machine}-protos.h} is
836c7a68eb7Smrgincluded, in this file you should guard declarations using these types
837c7a68eb7Smrginside appropriate @code{#ifdef RTX_CODE} or @code{#ifdef TREE_CODE}
838c7a68eb7Smrgconditional code segments.
839c7a68eb7Smrg
840c7a68eb7SmrgIf the backend uses shared data structures that require @code{GTY} markers
841c7a68eb7Smrgfor garbage collection (@pxref{Type Information}), you must declare those
842c7a68eb7Smrgin @file{@var{machine}.h} rather than @file{@var{machine}-protos.h}.
843c7a68eb7SmrgAny definitions required for building libgcc must also go in
844c7a68eb7Smrg@file{@var{machine}.h}.
845c7a68eb7Smrg
846c7a68eb7SmrgGCC uses the macro @code{IN_TARGET_CODE} to distinguish between
847c7a68eb7Smrgmachine-specific @file{.c} and @file{.cc} files and
848c7a68eb7Smrgmachine-independent @file{.c} and @file{.cc} files.  Machine-specific
849c7a68eb7Smrgfiles should use the directive:
850c7a68eb7Smrg
851c7a68eb7Smrg@example
852c7a68eb7Smrg#define IN_TARGET_CODE 1
853c7a68eb7Smrg@end example
854c7a68eb7Smrg
855c7a68eb7Smrgbefore including @code{config.h}.
856c7a68eb7Smrg
85710d565efSmrgIf the back end is added to the official GCC source repository, the
85810d565efSmrgfollowing are also necessary:
85910d565efSmrg
86010d565efSmrg@itemize @bullet
86110d565efSmrg@item
86210d565efSmrgAn entry for the target architecture in @file{readings.html} on the
86310d565efSmrgGCC web site, with any relevant links.
86410d565efSmrg@item
86510d565efSmrgDetails of the properties of the back end and target architecture in
86610d565efSmrg@file{backends.html} on the GCC web site.
86710d565efSmrg@item
86810d565efSmrgA news item about the contribution of support for that target
86910d565efSmrgarchitecture, in @file{index.html} on the GCC web site.
87010d565efSmrg@item
87110d565efSmrgNormally, one or more maintainers of that target listed in
87210d565efSmrg@file{MAINTAINERS}.  Some existing architectures may be unmaintained,
87310d565efSmrgbut it would be unusual to add support for a target that does not have
87410d565efSmrga maintainer when support is added.
87510d565efSmrg@item
87610d565efSmrgTarget triplets covering all @file{config.gcc} stanzas for the target,
87710d565efSmrgin the list in @file{contrib/config-list.mk}.
87810d565efSmrg@end itemize
87910d565efSmrg
88010d565efSmrg@node Testsuites
88110d565efSmrg@chapter Testsuites
88210d565efSmrg
88310d565efSmrgGCC contains several testsuites to help maintain compiler quality.
88410d565efSmrgMost of the runtime libraries and language front ends in GCC have
88510d565efSmrgtestsuites.  Currently only the C language testsuites are documented
88610d565efSmrghere; FIXME: document the others.
88710d565efSmrg
88810d565efSmrg@menu
88910d565efSmrg* Test Idioms::     Idioms used in testsuite code.
89010d565efSmrg* Test Directives:: Directives used within DejaGnu tests.
89110d565efSmrg* Ada Tests::       The Ada language testsuites.
89210d565efSmrg* C Tests::         The C language testsuites.
89310d565efSmrg* LTO Testing::     Support for testing link-time optimizations.
89410d565efSmrg* gcov Testing::    Support for testing gcov.
89510d565efSmrg* profopt Testing:: Support for testing profile-directed optimizations.
89610d565efSmrg* compat Testing::  Support for testing binary compatibility.
89710d565efSmrg* Torture Tests::   Support for torture testing using multiple options.
89810d565efSmrg* GIMPLE Tests::    Support for testing GIMPLE passes.
89910d565efSmrg* RTL Tests::       Support for testing RTL passes.
90010d565efSmrg@end menu
90110d565efSmrg
90210d565efSmrg@node Test Idioms
90310d565efSmrg@section Idioms Used in Testsuite Code
90410d565efSmrg
90510d565efSmrgIn general, C testcases have a trailing @file{-@var{n}.c}, starting
90610d565efSmrgwith @file{-1.c}, in case other testcases with similar names are added
90710d565efSmrglater.  If the test is a test of some well-defined feature, it should
90810d565efSmrghave a name referring to that feature such as
90910d565efSmrg@file{@var{feature}-1.c}.  If it does not test a well-defined feature
91010d565efSmrgbut just happens to exercise a bug somewhere in the compiler, and a
91110d565efSmrgbug report has been filed for this bug in the GCC bug database,
91210d565efSmrg@file{pr@var{bug-number}-1.c} is the appropriate form of name.
91310d565efSmrgOtherwise (for miscellaneous bugs not filed in the GCC bug database),
91410d565efSmrgand previously more generally, test cases are named after the date on
91510d565efSmrgwhich they were added.  This allows people to tell at a glance whether
91610d565efSmrga test failure is because of a recently found bug that has not yet
91710d565efSmrgbeen fixed, or whether it may be a regression, but does not give any
91810d565efSmrgother information about the bug or where discussion of it may be
91910d565efSmrgfound.  Some other language testsuites follow similar conventions.
92010d565efSmrg
92110d565efSmrgIn the @file{gcc.dg} testsuite, it is often necessary to test that an
92210d565efSmrgerror is indeed a hard error and not just a warning---for example,
92310d565efSmrgwhere it is a constraint violation in the C standard, which must
92410d565efSmrgbecome an error with @option{-pedantic-errors}.  The following idiom,
92510d565efSmrgwhere the first line shown is line @var{line} of the file and the line
92610d565efSmrgthat generates the error, is used for this:
92710d565efSmrg
92810d565efSmrg@smallexample
92910d565efSmrg/* @{ dg-bogus "warning" "warning in place of error" @} */
93010d565efSmrg/* @{ dg-error "@var{regexp}" "@var{message}" @{ target *-*-* @} @var{line} @} */
93110d565efSmrg@end smallexample
93210d565efSmrg
93310d565efSmrgIt may be necessary to check that an expression is an integer constant
93410d565efSmrgexpression and has a certain value.  To check that @code{@var{E}} has
93510d565efSmrgvalue @code{@var{V}}, an idiom similar to the following is used:
93610d565efSmrg
93710d565efSmrg@smallexample
93810d565efSmrgchar x[((E) == (V) ? 1 : -1)];
93910d565efSmrg@end smallexample
94010d565efSmrg
94110d565efSmrgIn @file{gcc.dg} tests, @code{__typeof__} is sometimes used to make
94210d565efSmrgassertions about the types of expressions.  See, for example,
94310d565efSmrg@file{gcc.dg/c99-condexpr-1.c}.  The more subtle uses depend on the
94410d565efSmrgexact rules for the types of conditional expressions in the C
94510d565efSmrgstandard; see, for example, @file{gcc.dg/c99-intconst-1.c}.
94610d565efSmrg
94710d565efSmrgIt is useful to be able to test that optimizations are being made
94810d565efSmrgproperly.  This cannot be done in all cases, but it can be done where
94910d565efSmrgthe optimization will lead to code being optimized away (for example,
95010d565efSmrgwhere flow analysis or alias analysis should show that certain code
95110d565efSmrgcannot be called) or to functions not being called because they have
95210d565efSmrgbeen expanded as built-in functions.  Such tests go in
95310d565efSmrg@file{gcc.c-torture/execute}.  Where code should be optimized away, a
95410d565efSmrgcall to a nonexistent function such as @code{link_failure ()} may be
95510d565efSmrginserted; a definition
95610d565efSmrg
95710d565efSmrg@smallexample
95810d565efSmrg#ifndef __OPTIMIZE__
95910d565efSmrgvoid
96010d565efSmrglink_failure (void)
96110d565efSmrg@{
96210d565efSmrg  abort ();
96310d565efSmrg@}
96410d565efSmrg#endif
96510d565efSmrg@end smallexample
96610d565efSmrg
96710d565efSmrg@noindent
96810d565efSmrgwill also be needed so that linking still succeeds when the test is
96910d565efSmrgrun without optimization.  When all calls to a built-in function
97010d565efSmrgshould have been optimized and no calls to the non-built-in version of
97110d565efSmrgthe function should remain, that function may be defined as
97210d565efSmrg@code{static} to call @code{abort ()} (although redeclaring a function
97310d565efSmrgas static may not work on all targets).
97410d565efSmrg
97510d565efSmrgAll testcases must be portable.  Target-specific testcases must have
97610d565efSmrgappropriate code to avoid causing failures on unsupported systems;
97710d565efSmrgunfortunately, the mechanisms for this differ by directory.
97810d565efSmrg
97910d565efSmrgFIXME: discuss non-C testsuites here.
98010d565efSmrg
98110d565efSmrg@node Test Directives
98210d565efSmrg@section Directives used within DejaGnu tests
98310d565efSmrg
98410d565efSmrg@menu
98510d565efSmrg* Directives::  Syntax and descriptions of test directives.
98610d565efSmrg* Selectors:: Selecting targets to which a test applies.
98710d565efSmrg* Effective-Target Keywords:: Keywords describing target attributes.
98810d565efSmrg* Add Options:: Features for @code{dg-add-options}
98910d565efSmrg* Require Support:: Variants of @code{dg-require-@var{support}}
99010d565efSmrg* Final Actions:: Commands for use in @code{dg-final}
99110d565efSmrg@end menu
99210d565efSmrg
99310d565efSmrg@node Directives
99410d565efSmrg@subsection Syntax and Descriptions of test directives
99510d565efSmrg
99610d565efSmrgTest directives appear within comments in a test source file and begin
99710d565efSmrgwith @code{dg-}.  Some of these are defined within DejaGnu and others
99810d565efSmrgare local to the GCC testsuite.
99910d565efSmrg
100010d565efSmrgThe order in which test directives appear in a test can be important:
100110d565efSmrgdirectives local to GCC sometimes override information used by the
100210d565efSmrgDejaGnu directives, which know nothing about the GCC directives, so the
100310d565efSmrgDejaGnu directives must precede GCC directives.
100410d565efSmrg
100510d565efSmrgSeveral test directives include selectors (@pxref{Selectors, , })
100610d565efSmrgwhich are usually preceded by the keyword @code{target} or @code{xfail}.
100710d565efSmrg
100810d565efSmrg@subsubsection Specify how to build the test
100910d565efSmrg
101010d565efSmrg@table @code
101110d565efSmrg@item @{ dg-do @var{do-what-keyword} [@{ target/xfail @var{selector} @}] @}
101210d565efSmrg@var{do-what-keyword} specifies how the test is compiled and whether
101310d565efSmrgit is executed.  It is one of:
101410d565efSmrg
101510d565efSmrg@table @code
101610d565efSmrg@item preprocess
101710d565efSmrgCompile with @option{-E} to run only the preprocessor.
101810d565efSmrg@item compile
101910d565efSmrgCompile with @option{-S} to produce an assembly code file.
102010d565efSmrg@item assemble
102110d565efSmrgCompile with @option{-c} to produce a relocatable object file.
102210d565efSmrg@item link
102310d565efSmrgCompile, assemble, and link to produce an executable file.
102410d565efSmrg@item run
102510d565efSmrgProduce and run an executable file, which is expected to return
102610d565efSmrgan exit code of 0.
102710d565efSmrg@end table
102810d565efSmrg
102910d565efSmrgThe default is @code{compile}.  That can be overridden for a set of
103010d565efSmrgtests by redefining @code{dg-do-what-default} within the @code{.exp}
103110d565efSmrgfile for those tests.
103210d565efSmrg
103310d565efSmrgIf the directive includes the optional @samp{@{ target @var{selector} @}}
103410d565efSmrgthen the test is skipped unless the target system matches the
103510d565efSmrg@var{selector}.
103610d565efSmrg
103710d565efSmrgIf @var{do-what-keyword} is @code{run} and the directive includes
103810d565efSmrgthe optional @samp{@{ xfail @var{selector} @}} and the selector is met
103910d565efSmrgthen the test is expected to fail.  The @code{xfail} clause is ignored
104010d565efSmrgfor other values of @var{do-what-keyword}; those tests can use
104110d565efSmrgdirective @code{dg-xfail-if}.
104210d565efSmrg@end table
104310d565efSmrg
104410d565efSmrg@subsubsection Specify additional compiler options
104510d565efSmrg
104610d565efSmrg@table @code
104710d565efSmrg@item @{ dg-options @var{options} [@{ target @var{selector} @}] @}
104810d565efSmrgThis DejaGnu directive provides a list of compiler options, to be used
104910d565efSmrgif the target system matches @var{selector}, that replace the default
105010d565efSmrgoptions used for this set of tests.
105110d565efSmrg
105210d565efSmrg@item @{ dg-add-options @var{feature} @dots{} @}
105310d565efSmrgAdd any compiler options that are needed to access certain features.
105410d565efSmrgThis directive does nothing on targets that enable the features by
105510d565efSmrgdefault, or that don't provide them at all.  It must come after
105610d565efSmrgall @code{dg-options} directives.
105710d565efSmrgFor supported values of @var{feature} see @ref{Add Options, ,}.
105810d565efSmrg
105910d565efSmrg@item @{ dg-additional-options @var{options} [@{ target @var{selector} @}] @}
106010d565efSmrgThis directive provides a list of compiler options, to be used
106110d565efSmrgif the target system matches @var{selector}, that are added to the default
106210d565efSmrgoptions used for this set of tests.
106310d565efSmrg@end table
106410d565efSmrg
106510d565efSmrg@subsubsection Modify the test timeout value
106610d565efSmrg
106710d565efSmrgThe normal timeout limit, in seconds, is found by searching the
106810d565efSmrgfollowing in order:
106910d565efSmrg
107010d565efSmrg@itemize @bullet
107110d565efSmrg@item the value defined by an earlier @code{dg-timeout} directive in
107210d565efSmrgthe test
107310d565efSmrg
107410d565efSmrg@item variable @var{tool_timeout} defined by the set of tests
107510d565efSmrg
107610d565efSmrg@item @var{gcc},@var{timeout} set in the target board
107710d565efSmrg
107810d565efSmrg@item 300
107910d565efSmrg@end itemize
108010d565efSmrg
108110d565efSmrg@table @code
108210d565efSmrg@item @{ dg-timeout @var{n} [@{target @var{selector} @}] @}
108310d565efSmrgSet the time limit for the compilation and for the execution of the test
108410d565efSmrgto the specified number of seconds.
108510d565efSmrg
108610d565efSmrg@item @{ dg-timeout-factor @var{x} [@{ target @var{selector} @}] @}
108710d565efSmrgMultiply the normal time limit for compilation and execution of the test
108810d565efSmrgby the specified floating-point factor.
108910d565efSmrg@end table
109010d565efSmrg
109110d565efSmrg@subsubsection Skip a test for some targets
109210d565efSmrg
109310d565efSmrg@table @code
109410d565efSmrg@item @{ dg-skip-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
109510d565efSmrgArguments @var{include-opts} and @var{exclude-opts} are lists in which
109610d565efSmrgeach element is a string of zero or more GCC options.
109710d565efSmrgSkip the test if all of the following conditions are met:
109810d565efSmrg@itemize @bullet
109910d565efSmrg@item the test system is included in @var{selector}
110010d565efSmrg
110110d565efSmrg@item for at least one of the option strings in @var{include-opts},
110210d565efSmrgevery option from that string is in the set of options with which
110310d565efSmrgthe test would be compiled; use @samp{"*"} for an @var{include-opts} list
110410d565efSmrgthat matches any options; that is the default if @var{include-opts} is
110510d565efSmrgnot specified
110610d565efSmrg
110710d565efSmrg@item for each of the option strings in @var{exclude-opts}, at least one
110810d565efSmrgoption from that string is not in the set of options with which the test
110910d565efSmrgwould be compiled; use @samp{""} for an empty @var{exclude-opts} list;
111010d565efSmrgthat is the default if @var{exclude-opts} is not specified
111110d565efSmrg@end itemize
111210d565efSmrg
111310d565efSmrgFor example, to skip a test if option @code{-Os} is present:
111410d565efSmrg
111510d565efSmrg@smallexample
111610d565efSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-Os" @} @{ "" @} @} */
111710d565efSmrg@end smallexample
111810d565efSmrg
111910d565efSmrgTo skip a test if both options @code{-O2} and @code{-g} are present:
112010d565efSmrg
112110d565efSmrg@smallexample
112210d565efSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2 -g" @} @{ "" @} @} */
112310d565efSmrg@end smallexample
112410d565efSmrg
112510d565efSmrgTo skip a test if either @code{-O2} or @code{-O3} is present:
112610d565efSmrg
112710d565efSmrg@smallexample
112810d565efSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2" "-O3" @} @{ "" @} @} */
112910d565efSmrg@end smallexample
113010d565efSmrg
113110d565efSmrgTo skip a test unless option @code{-Os} is present:
113210d565efSmrg
113310d565efSmrg@smallexample
113410d565efSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "*" @} @{ "-Os" @} @} */
113510d565efSmrg@end smallexample
113610d565efSmrg
113710d565efSmrgTo skip a test if either @code{-O2} or @code{-O3} is used with @code{-g}
113810d565efSmrgbut not if @code{-fpic} is also present:
113910d565efSmrg
114010d565efSmrg@smallexample
114110d565efSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2 -g" "-O3 -g" @} @{ "-fpic" @} @} */
114210d565efSmrg@end smallexample
114310d565efSmrg
114410d565efSmrg@item @{ dg-require-effective-target @var{keyword} [@{ @var{selector} @}] @}
114510d565efSmrgSkip the test if the test target, including current multilib flags,
114610d565efSmrgis not covered by the effective-target keyword.
114710d565efSmrgIf the directive includes the optional @samp{@{ @var{selector} @}}
114810d565efSmrgthen the effective-target test is only performed if the target system
114910d565efSmrgmatches the @var{selector}.
115010d565efSmrgThis directive must appear after any @code{dg-do} directive in the test
115110d565efSmrgand before any @code{dg-additional-sources} directive.
115210d565efSmrg@xref{Effective-Target Keywords, , }.
115310d565efSmrg
115410d565efSmrg@item @{ dg-require-@var{support} args @}
115510d565efSmrgSkip the test if the target does not provide the required support.
115610d565efSmrgThese directives must appear after any @code{dg-do} directive in the test
115710d565efSmrgand before any @code{dg-additional-sources} directive.
115810d565efSmrgThey require at least one argument, which can be an empty string if the
115910d565efSmrgspecific procedure does not examine the argument.
116010d565efSmrg@xref{Require Support, , }, for a complete list of these directives.
116110d565efSmrg@end table
116210d565efSmrg
116310d565efSmrg@subsubsection Expect a test to fail for some targets
116410d565efSmrg
116510d565efSmrg@table @code
116610d565efSmrg@item  @{ dg-xfail-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
116710d565efSmrgExpect the test to fail if the conditions (which are the same as for
116810d565efSmrg@code{dg-skip-if}) are met.  This does not affect the execute step.
116910d565efSmrg
117010d565efSmrg@item  @{ dg-xfail-run-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
117110d565efSmrgExpect the execute step of a test to fail if the conditions (which are
117210d565efSmrgthe same as for @code{dg-skip-if}) are met.
117310d565efSmrg@end table
117410d565efSmrg
117510d565efSmrg@subsubsection Expect the test executable to fail
117610d565efSmrg
117710d565efSmrg@table @code
117810d565efSmrg@item  @{ dg-shouldfail @var{comment} [@{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]]] @}
117910d565efSmrgExpect the test executable to return a nonzero exit status if the
118010d565efSmrgconditions (which are the same as for @code{dg-skip-if}) are met.
118110d565efSmrg@end table
118210d565efSmrg
118310d565efSmrg@subsubsection Verify compiler messages
11840fc04c29SmrgWhere @var{line} is an accepted argument for these commands, a value of @samp{0}
11850fc04c29Smrgcan be used if there is no line associated with the message.
118610d565efSmrg
118710d565efSmrg@table @code
118810d565efSmrg@item @{ dg-error @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
118910d565efSmrgThis DejaGnu directive appears on a source line that is expected to get
119010d565efSmrgan error message, or else specifies the source line associated with the
119110d565efSmrgmessage.  If there is no message for that line or if the text of that
119210d565efSmrgmessage is not matched by @var{regexp} then the check fails and
119310d565efSmrg@var{comment} is included in the @code{FAIL} message.  The check does
119410d565efSmrgnot look for the string @samp{error} unless it is part of @var{regexp}.
119510d565efSmrg
119610d565efSmrg@item @{ dg-warning @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
119710d565efSmrgThis DejaGnu directive appears on a source line that is expected to get
119810d565efSmrga warning message, or else specifies the source line associated with the
119910d565efSmrgmessage.  If there is no message for that line or if the text of that
120010d565efSmrgmessage is not matched by @var{regexp} then the check fails and
120110d565efSmrg@var{comment} is included in the @code{FAIL} message.  The check does
120210d565efSmrgnot look for the string @samp{warning} unless it is part of @var{regexp}.
120310d565efSmrg
120410d565efSmrg@item @{ dg-message @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
120510d565efSmrgThe line is expected to get a message other than an error or warning.
120610d565efSmrgIf there is no message for that line or if the text of that message is
120710d565efSmrgnot matched by @var{regexp} then the check fails and @var{comment} is
120810d565efSmrgincluded in the @code{FAIL} message.
120910d565efSmrg
121010d565efSmrg@item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
121110d565efSmrgThis DejaGnu directive appears on a source line that should not get a
121210d565efSmrgmessage matching @var{regexp}, or else specifies the source line
121310d565efSmrgassociated with the bogus message.  It is usually used with @samp{xfail}
121410d565efSmrgto indicate that the message is a known problem for a particular set of
121510d565efSmrgtargets.
121610d565efSmrg
1217c7a68eb7Smrg@item @{ dg-line @var{linenumvar} @}
1218c7a68eb7SmrgThis DejaGnu directive sets the variable @var{linenumvar} to the line number of
1219c7a68eb7Smrgthe source line.  The variable @var{linenumvar} can then be used in subsequent
1220c7a68eb7Smrg@code{dg-error}, @code{dg-warning}, @code{dg-message} and @code{dg-bogus}
1221c7a68eb7Smrgdirectives.  For example:
1222c7a68eb7Smrg
1223c7a68eb7Smrg@smallexample
1224c7a68eb7Smrgint a;   /* @{ dg-line first_def_a @} */
1225c7a68eb7Smrgfloat a; /* @{ dg-error "conflicting types of" @} */
1226c7a68eb7Smrg/* @{ dg-message "previous declaration of" "" @{ target *-*-* @} first_def_a @} */
1227c7a68eb7Smrg@end smallexample
1228c7a68eb7Smrg
122910d565efSmrg@item @{ dg-excess-errors @var{comment} [@{ target/xfail @var{selector} @}] @}
123010d565efSmrgThis DejaGnu directive indicates that the test is expected to fail due
123110d565efSmrgto compiler messages that are not handled by @samp{dg-error},
123210d565efSmrg@samp{dg-warning} or @samp{dg-bogus}.  For this directive @samp{xfail}
123310d565efSmrghas the same effect as @samp{target}.
123410d565efSmrg
123510d565efSmrg@item @{ dg-prune-output @var{regexp} @}
123610d565efSmrgPrune messages matching @var{regexp} from the test output.
123710d565efSmrg@end table
123810d565efSmrg
123910d565efSmrg@subsubsection Verify output of the test executable
124010d565efSmrg
124110d565efSmrg@table @code
124210d565efSmrg@item @{ dg-output @var{regexp} [@{ target/xfail @var{selector} @}] @}
124310d565efSmrgThis DejaGnu directive compares @var{regexp} to the combined output
124410d565efSmrgthat the test executable writes to @file{stdout} and @file{stderr}.
124510d565efSmrg@end table
124610d565efSmrg
1247*ec02198aSmrg@subsubsection Specify environment variables for a test
1248*ec02198aSmrg
1249*ec02198aSmrg@table @code
1250*ec02198aSmrg@item @{ dg-set-compiler-env-var @var{var_name} "@var{var_value}" @}
1251*ec02198aSmrgSpecify that the environment variable @var{var_name} needs to be set
1252*ec02198aSmrgto @var{var_value} before invoking the compiler on the test file.
1253*ec02198aSmrg
1254*ec02198aSmrg@item @{ dg-set-target-env-var @var{var_name} "@var{var_value}" @}
1255*ec02198aSmrgSpecify that the environment variable @var{var_name} needs to be set
1256*ec02198aSmrgto @var{var_value} before execution of the program created by the test.
1257*ec02198aSmrg@end table
1258*ec02198aSmrg
125910d565efSmrg@subsubsection Specify additional files for a test
126010d565efSmrg
126110d565efSmrg@table @code
126210d565efSmrg@item @{ dg-additional-files "@var{filelist}" @}
126310d565efSmrgSpecify additional files, other than source files, that must be copied
126410d565efSmrgto the system where the compiler runs.
126510d565efSmrg
126610d565efSmrg@item @{ dg-additional-sources "@var{filelist}" @}
126710d565efSmrgSpecify additional source files to appear in the compile line
126810d565efSmrgfollowing the main test file.
126910d565efSmrg@end table
127010d565efSmrg
127110d565efSmrg@subsubsection Add checks at the end of a test
127210d565efSmrg
127310d565efSmrg@table @code
127410d565efSmrg@item @{ dg-final @{ @var{local-directive} @} @}
127510d565efSmrgThis DejaGnu directive is placed within a comment anywhere in the
127610d565efSmrgsource file and is processed after the test has been compiled and run.
127710d565efSmrgMultiple @samp{dg-final} commands are processed in the order in which
127810d565efSmrgthey appear in the source file.  @xref{Final Actions, , }, for a list
127910d565efSmrgof directives that can be used within @code{dg-final}.
128010d565efSmrg@end table
128110d565efSmrg
128210d565efSmrg@node Selectors
128310d565efSmrg@subsection Selecting targets to which a test applies
128410d565efSmrg
128510d565efSmrgSeveral test directives include @var{selector}s to limit the targets
128610d565efSmrgfor which a test is run or to declare that a test is expected to fail
128710d565efSmrgon particular targets.
128810d565efSmrg
128910d565efSmrgA selector is:
129010d565efSmrg@itemize @bullet
129110d565efSmrg@item one or more target triplets, possibly including wildcard characters;
129210d565efSmrguse @samp{*-*-*} to match any target
129310d565efSmrg@item a single effective-target keyword (@pxref{Effective-Target Keywords})
129410d565efSmrg@item a logical expression
129510d565efSmrg@end itemize
129610d565efSmrg
129710d565efSmrgDepending on the context, the selector specifies whether a test is
129810d565efSmrgskipped and reported as unsupported or is expected to fail.  A context
129910d565efSmrgthat allows either @samp{target} or @samp{xfail} also allows
130010d565efSmrg@samp{@{ target @var{selector1} xfail @var{selector2} @}}
130110d565efSmrgto skip the test for targets that don't match @var{selector1} and the
130210d565efSmrgtest to fail for targets that match @var{selector2}.
130310d565efSmrg
130410d565efSmrgA selector expression appears within curly braces and uses a single
130510d565efSmrglogical operator: one of @samp{!}, @samp{&&}, or @samp{||}.  An
130610d565efSmrgoperand is another selector expression, an effective-target keyword,
130710d565efSmrga single target triplet, or a list of target triplets within quotes or
130810d565efSmrgcurly braces.  For example:
130910d565efSmrg
131010d565efSmrg@smallexample
131110d565efSmrg@{ target @{ ! "hppa*-*-* ia64*-*-*" @} @}
131210d565efSmrg@{ target @{ powerpc*-*-* && lp64 @} @}
131310d565efSmrg@{ xfail @{ lp64 || vect_no_align @} @}
131410d565efSmrg@end smallexample
131510d565efSmrg
131610d565efSmrg@node Effective-Target Keywords
131710d565efSmrg@subsection Keywords describing target attributes
131810d565efSmrg
131910d565efSmrgEffective-target keywords identify sets of targets that support
132010d565efSmrgparticular functionality.  They are used to limit tests to be run only
132110d565efSmrgfor particular targets, or to specify that particular sets of targets
132210d565efSmrgare expected to fail some tests.
132310d565efSmrg
132410d565efSmrgEffective-target keywords are defined in @file{lib/target-supports.exp} in
132510d565efSmrgthe GCC testsuite, with the exception of those that are documented as
132610d565efSmrgbeing local to a particular test directory.
132710d565efSmrg
132810d565efSmrgThe @samp{effective target} takes into account all of the compiler options
132910d565efSmrgwith which the test will be compiled, including the multilib options.
133010d565efSmrgBy convention, keywords ending in @code{_nocache} can also include options
133110d565efSmrgspecified for the particular test in an earlier @code{dg-options} or
133210d565efSmrg@code{dg-add-options} directive.
133310d565efSmrg
1334c7a68eb7Smrg@subsubsection Endianness
1335c7a68eb7Smrg
1336c7a68eb7Smrg@table @code
1337c7a68eb7Smrg@item be
1338c7a68eb7SmrgTarget uses big-endian memory order for multi-byte and multi-word data.
1339c7a68eb7Smrg
1340c7a68eb7Smrg@item le
1341c7a68eb7SmrgTarget uses little-endian memory order for multi-byte and multi-word data.
1342c7a68eb7Smrg@end table
1343c7a68eb7Smrg
134410d565efSmrg@subsubsection Data type sizes
134510d565efSmrg
134610d565efSmrg@table @code
134710d565efSmrg@item ilp32
134810d565efSmrgTarget has 32-bit @code{int}, @code{long}, and pointers.
134910d565efSmrg
135010d565efSmrg@item lp64
135110d565efSmrgTarget has 32-bit @code{int}, 64-bit @code{long} and pointers.
135210d565efSmrg
135310d565efSmrg@item llp64
135410d565efSmrgTarget has 32-bit @code{int} and @code{long}, 64-bit @code{long long}
135510d565efSmrgand pointers.
135610d565efSmrg
135710d565efSmrg@item double64
135810d565efSmrgTarget has 64-bit @code{double}.
135910d565efSmrg
136010d565efSmrg@item double64plus
136110d565efSmrgTarget has @code{double} that is 64 bits or longer.
136210d565efSmrg
136310d565efSmrg@item longdouble128
136410d565efSmrgTarget has 128-bit @code{long double}.
136510d565efSmrg
136610d565efSmrg@item int32plus
136710d565efSmrgTarget has @code{int} that is at 32 bits or longer.
136810d565efSmrg
136910d565efSmrg@item int16
137010d565efSmrgTarget has @code{int} that is 16 bits or shorter.
137110d565efSmrg
1372*ec02198aSmrg@item longlong64
1373*ec02198aSmrgTarget has 64-bit @code{long long}.
1374*ec02198aSmrg
137510d565efSmrg@item long_neq_int
137610d565efSmrgTarget has @code{int} and @code{long} with different sizes.
137710d565efSmrg
13780fc04c29Smrg@item int_eq_float
13790fc04c29SmrgTarget has @code{int} and @code{float} with the same size.
13800fc04c29Smrg
13810fc04c29Smrg@item ptr_eq_long
13820fc04c29SmrgTarget has pointers (@code{void *}) and @code{long} with the same size.
13830fc04c29Smrg
138410d565efSmrg@item large_double
138510d565efSmrgTarget supports @code{double} that is longer than @code{float}.
138610d565efSmrg
138710d565efSmrg@item large_long_double
138810d565efSmrgTarget supports @code{long double} that is longer than @code{double}.
138910d565efSmrg
139010d565efSmrg@item ptr32plus
139110d565efSmrgTarget has pointers that are 32 bits or longer.
139210d565efSmrg
13930fc04c29Smrg@item size20plus
13940fc04c29SmrgTarget has a 20-bit or larger address space, so at least supports
13950fc04c29Smrg16-bit array and structure sizes.
13960fc04c29Smrg
139710d565efSmrg@item size32plus
13980fc04c29SmrgTarget has a 32-bit or larger address space, so at least supports
13990fc04c29Smrg24-bit array and structure sizes.
140010d565efSmrg
140110d565efSmrg@item 4byte_wchar_t
140210d565efSmrgTarget has @code{wchar_t} that is at least 4 bytes.
140310d565efSmrg
140410d565efSmrg@item float@var{n}
140510d565efSmrgTarget has the @code{_Float@var{n}} type.
140610d565efSmrg
140710d565efSmrg@item float@var{n}x
140810d565efSmrgTarget has the @code{_Float@var{n}x} type.
140910d565efSmrg
141010d565efSmrg@item float@var{n}_runtime
141110d565efSmrgTarget has the @code{_Float@var{n}} type, including runtime support
141210d565efSmrgfor any options added with @code{dg-add-options}.
141310d565efSmrg
141410d565efSmrg@item float@var{n}x_runtime
141510d565efSmrgTarget has the @code{_Float@var{n}x} type, including runtime support
141610d565efSmrgfor any options added with @code{dg-add-options}.
141710d565efSmrg
141810d565efSmrg@item floatn_nx_runtime
141910d565efSmrgTarget has runtime support for any options added with
142010d565efSmrg@code{dg-add-options} for any @code{_Float@var{n}} or
142110d565efSmrg@code{_Float@var{n}x} type.
142210d565efSmrg
14230fc04c29Smrg@item inf
14240fc04c29SmrgTarget supports floating point infinite (@code{inf}) for type
14250fc04c29Smrg@code{double}.
14260fc04c29Smrg@end table
142710d565efSmrg@subsubsection Fortran-specific attributes
142810d565efSmrg
142910d565efSmrg@table @code
143010d565efSmrg@item fortran_integer_16
143110d565efSmrgTarget supports Fortran @code{integer} that is 16 bytes or longer.
143210d565efSmrg
1433c7a68eb7Smrg@item fortran_real_10
1434c7a68eb7SmrgTarget supports Fortran @code{real} that is 10 bytes or longer.
1435c7a68eb7Smrg
1436c7a68eb7Smrg@item fortran_real_16
1437c7a68eb7SmrgTarget supports Fortran @code{real} that is 16 bytes or longer.
1438c7a68eb7Smrg
143910d565efSmrg@item fortran_large_int
144010d565efSmrgTarget supports Fortran @code{integer} kinds larger than @code{integer(8)}.
144110d565efSmrg
144210d565efSmrg@item fortran_large_real
144310d565efSmrgTarget supports Fortran @code{real} kinds larger than @code{real(8)}.
144410d565efSmrg@end table
144510d565efSmrg
144610d565efSmrg@subsubsection Vector-specific attributes
144710d565efSmrg
144810d565efSmrg@table @code
1449c7a68eb7Smrg@item vect_align_stack_vars
1450c7a68eb7SmrgThe target's ABI allows stack variables to be aligned to the preferred
1451c7a68eb7Smrgvector alignment.
1452c7a68eb7Smrg
14530fc04c29Smrg@item vect_avg_qi
14540fc04c29SmrgTarget supports both signed and unsigned averaging operations on vectors
14550fc04c29Smrgof bytes.
14560fc04c29Smrg
1457*ec02198aSmrg@item vect_mulhrs_hi
1458*ec02198aSmrgTarget supports both signed and unsigned multiply-high-with-round-and-scale
1459*ec02198aSmrgoperations on vectors of half-words.
1460*ec02198aSmrg
1461*ec02198aSmrg@item vect_sdiv_pow2_si
1462*ec02198aSmrgTarget supports signed division by constant power-of-2 operations
1463*ec02198aSmrgon vectors of 4-byte integers.
1464*ec02198aSmrg
146510d565efSmrg@item vect_condition
146610d565efSmrgTarget supports vector conditional operations.
146710d565efSmrg
146810d565efSmrg@item vect_cond_mixed
146910d565efSmrgTarget supports vector conditional operations where comparison operands
147010d565efSmrghave different type from the value operands.
147110d565efSmrg
147210d565efSmrg@item vect_double
147310d565efSmrgTarget supports hardware vectors of @code{double}.
147410d565efSmrg
14750fc04c29Smrg@item vect_double_cond_arith
14760fc04c29SmrgTarget supports conditional addition, subtraction, multiplication,
14770fc04c29Smrgdivision, minimum and maximum on vectors of @code{double}, via the
14780fc04c29Smrg@code{cond_} optabs.
14790fc04c29Smrg
1480c7a68eb7Smrg@item vect_element_align_preferred
1481c7a68eb7SmrgThe target's preferred vector alignment is the same as the element
1482c7a68eb7Smrgalignment.
1483c7a68eb7Smrg
148410d565efSmrg@item vect_float
1485c7a68eb7SmrgTarget supports hardware vectors of @code{float} when
1486c7a68eb7Smrg@option{-funsafe-math-optimizations} is in effect.
1487c7a68eb7Smrg
1488c7a68eb7Smrg@item vect_float_strict
1489c7a68eb7SmrgTarget supports hardware vectors of @code{float} when
1490c7a68eb7Smrg@option{-funsafe-math-optimizations} is not in effect.
1491c7a68eb7SmrgThis implies @code{vect_float}.
149210d565efSmrg
149310d565efSmrg@item vect_int
149410d565efSmrgTarget supports hardware vectors of @code{int}.
149510d565efSmrg
149610d565efSmrg@item vect_long
149710d565efSmrgTarget supports hardware vectors of @code{long}.
149810d565efSmrg
149910d565efSmrg@item vect_long_long
150010d565efSmrgTarget supports hardware vectors of @code{long long}.
150110d565efSmrg
1502*ec02198aSmrg@item vect_check_ptrs
1503*ec02198aSmrgTarget supports the @code{check_raw_ptrs} and @code{check_war_ptrs}
1504*ec02198aSmrgoptabs on vectors.
1505*ec02198aSmrg
1506c7a68eb7Smrg@item vect_fully_masked
1507c7a68eb7SmrgTarget supports fully-masked (also known as fully-predicated) loops,
1508c7a68eb7Smrgso that vector loops can handle partial as well as full vectors.
1509c7a68eb7Smrg
1510c7a68eb7Smrg@item vect_masked_store
1511c7a68eb7SmrgTarget supports vector masked stores.
1512c7a68eb7Smrg
1513c7a68eb7Smrg@item vect_scatter_store
1514c7a68eb7SmrgTarget supports vector scatter stores.
1515c7a68eb7Smrg
151610d565efSmrg@item vect_aligned_arrays
151710d565efSmrgTarget aligns arrays to vector alignment boundary.
151810d565efSmrg
151910d565efSmrg@item vect_hw_misalign
152010d565efSmrgTarget supports a vector misalign access.
152110d565efSmrg
152210d565efSmrg@item vect_no_align
152310d565efSmrgTarget does not support a vector alignment mechanism.
152410d565efSmrg
1525c7a68eb7Smrg@item vect_peeling_profitable
1526c7a68eb7SmrgTarget might require to peel loops for alignment purposes.
1527c7a68eb7Smrg
152810d565efSmrg@item vect_no_int_min_max
152910d565efSmrgTarget does not support a vector min and max instruction on @code{int}.
153010d565efSmrg
153110d565efSmrg@item vect_no_int_add
153210d565efSmrgTarget does not support a vector add instruction on @code{int}.
153310d565efSmrg
153410d565efSmrg@item vect_no_bitwise
153510d565efSmrgTarget does not support vector bitwise instructions.
153610d565efSmrg
1537*ec02198aSmrg@item vect_bool_cmp
1538*ec02198aSmrgTarget supports comparison of @code{bool} vectors for at least one
1539*ec02198aSmrgvector length.
1540*ec02198aSmrg
1541*ec02198aSmrg@item vect_char_add
1542*ec02198aSmrgTarget supports addition of @code{char} vectors for at least one
1543*ec02198aSmrgvector length.
1544*ec02198aSmrg
154510d565efSmrg@item vect_char_mult
154610d565efSmrgTarget supports @code{vector char} multiplication.
154710d565efSmrg
154810d565efSmrg@item vect_short_mult
154910d565efSmrgTarget supports @code{vector short} multiplication.
155010d565efSmrg
155110d565efSmrg@item vect_int_mult
155210d565efSmrgTarget supports @code{vector int} multiplication.
155310d565efSmrg
1554c7a68eb7Smrg@item vect_long_mult
1555c7a68eb7SmrgTarget supports 64 bit @code{vector long} multiplication.
1556c7a68eb7Smrg
155710d565efSmrg@item vect_extract_even_odd
155810d565efSmrgTarget supports vector even/odd element extraction.
155910d565efSmrg
156010d565efSmrg@item vect_extract_even_odd_wide
156110d565efSmrgTarget supports vector even/odd element extraction of vectors with elements
156210d565efSmrg@code{SImode} or larger.
156310d565efSmrg
156410d565efSmrg@item vect_interleave
156510d565efSmrgTarget supports vector interleaving.
156610d565efSmrg
156710d565efSmrg@item vect_strided
156810d565efSmrgTarget supports vector interleaving and extract even/odd.
156910d565efSmrg
157010d565efSmrg@item vect_strided_wide
157110d565efSmrgTarget supports vector interleaving and extract even/odd for wide
157210d565efSmrgelement types.
157310d565efSmrg
157410d565efSmrg@item vect_perm
157510d565efSmrgTarget supports vector permutation.
157610d565efSmrg
1577c7a68eb7Smrg@item vect_perm_byte
1578c7a68eb7SmrgTarget supports permutation of vectors with 8-bit elements.
1579c7a68eb7Smrg
1580c7a68eb7Smrg@item vect_perm_short
1581c7a68eb7SmrgTarget supports permutation of vectors with 16-bit elements.
1582c7a68eb7Smrg
1583c7a68eb7Smrg@item vect_perm3_byte
1584c7a68eb7SmrgTarget supports permutation of vectors with 8-bit elements, and for the
1585c7a68eb7Smrgdefault vector length it is possible to permute:
1586c7a68eb7Smrg@example
1587c7a68eb7Smrg@{ a0, a1, a2, b0, b1, b2, @dots{} @}
1588c7a68eb7Smrg@end example
1589c7a68eb7Smrgto:
1590c7a68eb7Smrg@example
1591c7a68eb7Smrg@{ a0, a0, a0, b0, b0, b0, @dots{} @}
1592c7a68eb7Smrg@{ a1, a1, a1, b1, b1, b1, @dots{} @}
1593c7a68eb7Smrg@{ a2, a2, a2, b2, b2, b2, @dots{} @}
1594c7a68eb7Smrg@end example
1595c7a68eb7Smrgusing only two-vector permutes, regardless of how long the sequence is.
1596c7a68eb7Smrg
1597c7a68eb7Smrg@item vect_perm3_int
1598c7a68eb7SmrgLike @code{vect_perm3_byte}, but for 32-bit elements.
1599c7a68eb7Smrg
1600c7a68eb7Smrg@item vect_perm3_short
1601c7a68eb7SmrgLike @code{vect_perm3_byte}, but for 16-bit elements.
1602c7a68eb7Smrg
160310d565efSmrg@item vect_shift
160410d565efSmrgTarget supports a hardware vector shift operation.
160510d565efSmrg
1606c7a68eb7Smrg@item vect_unaligned_possible
1607c7a68eb7SmrgTarget prefers vectors to have an alignment greater than element
1608c7a68eb7Smrgalignment, but also allows unaligned vector accesses in some
1609c7a68eb7Smrgcircumstances.
1610c7a68eb7Smrg
1611c7a68eb7Smrg@item vect_variable_length
1612c7a68eb7SmrgTarget has variable-length vectors.
1613c7a68eb7Smrg
161410d565efSmrg@item vect_widen_sum_hi_to_si
161510d565efSmrgTarget supports a vector widening summation of @code{short} operands
161610d565efSmrginto @code{int} results, or can promote (unpack) from @code{short}
161710d565efSmrgto @code{int}.
161810d565efSmrg
161910d565efSmrg@item vect_widen_sum_qi_to_hi
162010d565efSmrgTarget supports a vector widening summation of @code{char} operands
162110d565efSmrginto @code{short} results, or can promote (unpack) from @code{char}
162210d565efSmrgto @code{short}.
162310d565efSmrg
162410d565efSmrg@item vect_widen_sum_qi_to_si
162510d565efSmrgTarget supports a vector widening summation of @code{char} operands
162610d565efSmrginto @code{int} results.
162710d565efSmrg
162810d565efSmrg@item vect_widen_mult_qi_to_hi
162910d565efSmrgTarget supports a vector widening multiplication of @code{char} operands
163010d565efSmrginto @code{short} results, or can promote (unpack) from @code{char} to
163110d565efSmrg@code{short} and perform non-widening multiplication of @code{short}.
163210d565efSmrg
163310d565efSmrg@item vect_widen_mult_hi_to_si
163410d565efSmrgTarget supports a vector widening multiplication of @code{short} operands
163510d565efSmrginto @code{int} results, or can promote (unpack) from @code{short} to
163610d565efSmrg@code{int} and perform non-widening multiplication of @code{int}.
163710d565efSmrg
163810d565efSmrg@item vect_widen_mult_si_to_di_pattern
163910d565efSmrgTarget supports a vector widening multiplication of @code{int} operands
164010d565efSmrginto @code{long} results.
164110d565efSmrg
164210d565efSmrg@item vect_sdot_qi
164310d565efSmrgTarget supports a vector dot-product of @code{signed char}.
164410d565efSmrg
164510d565efSmrg@item vect_udot_qi
164610d565efSmrgTarget supports a vector dot-product of @code{unsigned char}.
164710d565efSmrg
164810d565efSmrg@item vect_sdot_hi
164910d565efSmrgTarget supports a vector dot-product of @code{signed short}.
165010d565efSmrg
165110d565efSmrg@item vect_udot_hi
165210d565efSmrgTarget supports a vector dot-product of @code{unsigned short}.
165310d565efSmrg
165410d565efSmrg@item vect_pack_trunc
165510d565efSmrgTarget supports a vector demotion (packing) of @code{short} to @code{char}
165610d565efSmrgand from @code{int} to @code{short} using modulo arithmetic.
165710d565efSmrg
165810d565efSmrg@item vect_unpack
165910d565efSmrgTarget supports a vector promotion (unpacking) of @code{char} to @code{short}
166010d565efSmrgand from @code{char} to @code{int}.
166110d565efSmrg
166210d565efSmrg@item vect_intfloat_cvt
166310d565efSmrgTarget supports conversion from @code{signed int} to @code{float}.
166410d565efSmrg
166510d565efSmrg@item vect_uintfloat_cvt
166610d565efSmrgTarget supports conversion from @code{unsigned int} to @code{float}.
166710d565efSmrg
166810d565efSmrg@item vect_floatint_cvt
166910d565efSmrgTarget supports conversion from @code{float} to @code{signed int}.
167010d565efSmrg
167110d565efSmrg@item vect_floatuint_cvt
167210d565efSmrgTarget supports conversion from @code{float} to @code{unsigned int}.
167310d565efSmrg
1674c7a68eb7Smrg@item vect_intdouble_cvt
1675c7a68eb7SmrgTarget supports conversion from @code{signed int} to @code{double}.
1676c7a68eb7Smrg
1677c7a68eb7Smrg@item vect_doubleint_cvt
1678c7a68eb7SmrgTarget supports conversion from @code{double} to @code{signed int}.
1679c7a68eb7Smrg
168010d565efSmrg@item vect_max_reduc
168110d565efSmrgTarget supports max reduction for vectors.
1682c7a68eb7Smrg
1683c7a68eb7Smrg@item vect_sizes_16B_8B
1684c7a68eb7SmrgTarget supports 16- and 8-bytes vectors.
1685c7a68eb7Smrg
1686c7a68eb7Smrg@item vect_sizes_32B_16B
1687c7a68eb7SmrgTarget supports 32- and 16-bytes vectors.
1688c7a68eb7Smrg
1689c7a68eb7Smrg@item vect_logical_reduc
1690c7a68eb7SmrgTarget supports AND, IOR and XOR reduction on vectors.
1691c7a68eb7Smrg
1692c7a68eb7Smrg@item vect_fold_extract_last
1693c7a68eb7SmrgTarget supports the @code{fold_extract_last} optab.
169410d565efSmrg@end table
169510d565efSmrg
169610d565efSmrg@subsubsection Thread Local Storage attributes
169710d565efSmrg
169810d565efSmrg@table @code
169910d565efSmrg@item tls
170010d565efSmrgTarget supports thread-local storage.
170110d565efSmrg
170210d565efSmrg@item tls_native
170310d565efSmrgTarget supports native (rather than emulated) thread-local storage.
170410d565efSmrg
170510d565efSmrg@item tls_runtime
170610d565efSmrgTest system supports executing TLS executables.
170710d565efSmrg@end table
170810d565efSmrg
170910d565efSmrg@subsubsection Decimal floating point attributes
171010d565efSmrg
171110d565efSmrg@table @code
171210d565efSmrg@item dfp
171310d565efSmrgTargets supports compiling decimal floating point extension to C.
171410d565efSmrg
171510d565efSmrg@item dfp_nocache
171610d565efSmrgIncluding the options used to compile this particular test, the
171710d565efSmrgtarget supports compiling decimal floating point extension to C.
171810d565efSmrg
171910d565efSmrg@item dfprt
172010d565efSmrgTest system can execute decimal floating point tests.
172110d565efSmrg
172210d565efSmrg@item dfprt_nocache
172310d565efSmrgIncluding the options used to compile this particular test, the
172410d565efSmrgtest system can execute decimal floating point tests.
172510d565efSmrg
172610d565efSmrg@item hard_dfp
172710d565efSmrgTarget generates decimal floating point instructions with current options.
172810d565efSmrg@end table
172910d565efSmrg
173010d565efSmrg@subsubsection ARM-specific attributes
173110d565efSmrg
173210d565efSmrg@table @code
173310d565efSmrg@item arm32
173410d565efSmrgARM target generates 32-bit code.
173510d565efSmrg
1736*ec02198aSmrg@item arm_little_endian
1737*ec02198aSmrgARM target that generates little-endian code.
1738*ec02198aSmrg
173910d565efSmrg@item arm_eabi
174010d565efSmrgARM target adheres to the ABI for the ARM Architecture.
174110d565efSmrg
174210d565efSmrg@item arm_fp_ok
174310d565efSmrg@anchor{arm_fp_ok}
174410d565efSmrgARM target defines @code{__ARM_FP} using @code{-mfloat-abi=softfp} or
174510d565efSmrgequivalent options.  Some multilibs may be incompatible with these
174610d565efSmrgoptions.
174710d565efSmrg
1748*ec02198aSmrg@item arm_fp_dp_ok
1749*ec02198aSmrg@anchor{arm_fp_dp_ok}
1750*ec02198aSmrgARM target defines @code{__ARM_FP} with double-precision support using
1751*ec02198aSmrg@code{-mfloat-abi=softfp} or equivalent options.  Some multilibs may
1752*ec02198aSmrgbe incompatible with these options.
1753*ec02198aSmrg
175410d565efSmrg@item arm_hf_eabi
175510d565efSmrgARM target adheres to the VFP and Advanced SIMD Register Arguments
175610d565efSmrgvariant of the ABI for the ARM Architecture (as selected with
175710d565efSmrg@code{-mfloat-abi=hard}).
175810d565efSmrg
1759c7a68eb7Smrg@item arm_softfloat
1760c7a68eb7SmrgARM target uses the soft-float ABI with no floating-point instructions
1761c7a68eb7Smrgused whatsoever (as selected with @code{-mfloat-abi=soft}).
1762c7a68eb7Smrg
176310d565efSmrg@item arm_hard_vfp_ok
176410d565efSmrgARM target supports @code{-mfpu=vfp -mfloat-abi=hard}.
176510d565efSmrgSome multilibs may be incompatible with these options.
176610d565efSmrg
176710d565efSmrg@item arm_iwmmxt_ok
176810d565efSmrgARM target supports @code{-mcpu=iwmmxt}.
176910d565efSmrgSome multilibs may be incompatible with this option.
177010d565efSmrg
177110d565efSmrg@item arm_neon
177210d565efSmrgARM target supports generating NEON instructions.
177310d565efSmrg
177410d565efSmrg@item arm_tune_string_ops_prefer_neon
177510d565efSmrgTest CPU tune supports inlining string operations with NEON instructions.
177610d565efSmrg
177710d565efSmrg@item arm_neon_hw
177810d565efSmrgTest system supports executing NEON instructions.
177910d565efSmrg
178010d565efSmrg@item arm_neonv2_hw
178110d565efSmrgTest system supports executing NEON v2 instructions.
178210d565efSmrg
178310d565efSmrg@item arm_neon_ok
178410d565efSmrg@anchor{arm_neon_ok}
178510d565efSmrgARM Target supports @code{-mfpu=neon -mfloat-abi=softfp} or compatible
178610d565efSmrgoptions.  Some multilibs may be incompatible with these options.
178710d565efSmrg
178810d565efSmrg@item arm_neon_ok_no_float_abi
178910d565efSmrg@anchor{arm_neon_ok_no_float_abi}
179010d565efSmrgARM Target supports NEON with @code{-mfpu=neon}, but without any
179110d565efSmrg-mfloat-abi= option.  Some multilibs may be incompatible with this
179210d565efSmrgoption.
179310d565efSmrg
179410d565efSmrg@item arm_neonv2_ok
179510d565efSmrg@anchor{arm_neonv2_ok}
179610d565efSmrgARM Target supports @code{-mfpu=neon-vfpv4 -mfloat-abi=softfp} or compatible
179710d565efSmrgoptions.  Some multilibs may be incompatible with these options.
179810d565efSmrg
179910d565efSmrg@item arm_fp16_ok
180010d565efSmrg@anchor{arm_fp16_ok}
180110d565efSmrgTarget supports options to generate VFP half-precision floating-point
180210d565efSmrginstructions.  Some multilibs may be incompatible with these
180310d565efSmrgoptions.  This test is valid for ARM only.
180410d565efSmrg
180510d565efSmrg@item arm_fp16_hw
180610d565efSmrgTarget supports executing VFP half-precision floating-point
180710d565efSmrginstructions.  This test is valid for ARM only.
180810d565efSmrg
180910d565efSmrg@item arm_neon_fp16_ok
181010d565efSmrg@anchor{arm_neon_fp16_ok}
181110d565efSmrgARM Target supports @code{-mfpu=neon-fp16 -mfloat-abi=softfp} or compatible
181210d565efSmrgoptions, including @code{-mfp16-format=ieee} if necessary to obtain the
181310d565efSmrg@code{__fp16} type.  Some multilibs may be incompatible with these options.
181410d565efSmrg
181510d565efSmrg@item arm_neon_fp16_hw
181610d565efSmrgTest system supports executing Neon half-precision float instructions.
181710d565efSmrg(Implies previous.)
181810d565efSmrg
181910d565efSmrg@item arm_fp16_alternative_ok
182010d565efSmrgARM target supports the ARM FP16 alternative format.  Some multilibs
182110d565efSmrgmay be incompatible with the options needed.
182210d565efSmrg
182310d565efSmrg@item arm_fp16_none_ok
182410d565efSmrgARM target supports specifying none as the ARM FP16 format.
182510d565efSmrg
182610d565efSmrg@item arm_thumb1_ok
182710d565efSmrgARM target generates Thumb-1 code for @code{-mthumb}.
182810d565efSmrg
182910d565efSmrg@item arm_thumb2_ok
183010d565efSmrgARM target generates Thumb-2 code for @code{-mthumb}.
183110d565efSmrg
1832*ec02198aSmrg@item arm_nothumb
1833*ec02198aSmrgARM target that is not using Thumb.
1834*ec02198aSmrg
183510d565efSmrg@item arm_vfp_ok
183610d565efSmrgARM target supports @code{-mfpu=vfp -mfloat-abi=softfp}.
183710d565efSmrgSome multilibs may be incompatible with these options.
183810d565efSmrg
183910d565efSmrg@item arm_vfp3_ok
184010d565efSmrg@anchor{arm_vfp3_ok}
184110d565efSmrgARM target supports @code{-mfpu=vfp3 -mfloat-abi=softfp}.
184210d565efSmrgSome multilibs may be incompatible with these options.
184310d565efSmrg
1844*ec02198aSmrg@item arm_arch_v8a_hard_ok
1845*ec02198aSmrg@anchor{arm_arch_v8a_hard_ok}
1846*ec02198aSmrgThe compiler is targeting @code{arm*-*-*} and can compile and assemble code
1847*ec02198aSmrgusing the options @code{-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard}.
1848*ec02198aSmrgThis is not enough to guarantee that linking works.
1849*ec02198aSmrg
1850*ec02198aSmrg@item arm_arch_v8a_hard_multilib
1851*ec02198aSmrgThe compiler is targeting @code{arm*-*-*} and can build programs using
1852*ec02198aSmrgthe options @code{-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard}.
1853*ec02198aSmrgThe target can also run the resulting binaries.
1854*ec02198aSmrg
185510d565efSmrg@item arm_v8_vfp_ok
185610d565efSmrgARM target supports @code{-mfpu=fp-armv8 -mfloat-abi=softfp}.
185710d565efSmrgSome multilibs may be incompatible with these options.
185810d565efSmrg
185910d565efSmrg@item arm_v8_neon_ok
186010d565efSmrgARM target supports @code{-mfpu=neon-fp-armv8 -mfloat-abi=softfp}.
186110d565efSmrgSome multilibs may be incompatible with these options.
186210d565efSmrg
186310d565efSmrg@item arm_v8_1a_neon_ok
186410d565efSmrg@anchor{arm_v8_1a_neon_ok}
1865c7a68eb7SmrgARM target supports options to generate ARMv8.1-A Adv.SIMD instructions.
186610d565efSmrgSome multilibs may be incompatible with these options.
186710d565efSmrg
186810d565efSmrg@item arm_v8_1a_neon_hw
1869c7a68eb7SmrgARM target supports executing ARMv8.1-A Adv.SIMD instructions.  Some
187010d565efSmrgmultilibs may be incompatible with the options needed.  Implies
187110d565efSmrgarm_v8_1a_neon_ok.
187210d565efSmrg
187310d565efSmrg@item arm_acq_rel
187410d565efSmrgARM target supports acquire-release instructions.
187510d565efSmrg
187610d565efSmrg@item arm_v8_2a_fp16_scalar_ok
187710d565efSmrg@anchor{arm_v8_2a_fp16_scalar_ok}
1878c7a68eb7SmrgARM target supports options to generate instructions for ARMv8.2-A and
187910d565efSmrgscalar instructions from the FP16 extension.  Some multilibs may be
188010d565efSmrgincompatible with these options.
188110d565efSmrg
188210d565efSmrg@item arm_v8_2a_fp16_scalar_hw
1883c7a68eb7SmrgARM target supports executing instructions for ARMv8.2-A and scalar
188410d565efSmrginstructions from the FP16 extension.  Some multilibs may be
188510d565efSmrgincompatible with these options.  Implies arm_v8_2a_fp16_neon_ok.
188610d565efSmrg
188710d565efSmrg@item arm_v8_2a_fp16_neon_ok
188810d565efSmrg@anchor{arm_v8_2a_fp16_neon_ok}
1889c7a68eb7SmrgARM target supports options to generate instructions from ARMv8.2-A with
189010d565efSmrgthe FP16 extension.  Some multilibs may be incompatible with these
189110d565efSmrgoptions.  Implies arm_v8_2a_fp16_scalar_ok.
189210d565efSmrg
189310d565efSmrg@item arm_v8_2a_fp16_neon_hw
1894c7a68eb7SmrgARM target supports executing instructions from ARMv8.2-A with the FP16
189510d565efSmrgextension.  Some multilibs may be incompatible with these options.
189610d565efSmrgImplies arm_v8_2a_fp16_neon_ok and arm_v8_2a_fp16_scalar_hw.
189710d565efSmrg
1898c7a68eb7Smrg@item arm_v8_2a_dotprod_neon_ok
1899c7a68eb7Smrg@anchor{arm_v8_2a_dotprod_neon_ok}
1900c7a68eb7SmrgARM target supports options to generate instructions from ARMv8.2-A with
1901c7a68eb7Smrgthe Dot Product extension. Some multilibs may be incompatible with these
1902c7a68eb7Smrgoptions.
1903c7a68eb7Smrg
1904c7a68eb7Smrg@item arm_v8_2a_dotprod_neon_hw
1905c7a68eb7SmrgARM target supports executing instructions from ARMv8.2-A with the Dot
1906c7a68eb7SmrgProduct extension. Some multilibs may be incompatible with these options.
1907c7a68eb7SmrgImplies arm_v8_2a_dotprod_neon_ok.
1908c7a68eb7Smrg
1909c7a68eb7Smrg@item arm_fp16fml_neon_ok
1910c7a68eb7Smrg@anchor{arm_fp16fml_neon_ok}
1911c7a68eb7SmrgARM target supports extensions to generate the @code{VFMAL} and @code{VFMLS}
1912c7a68eb7Smrghalf-precision floating-point instructions available from ARMv8.2-A and
1913c7a68eb7Smrgonwards.  Some multilibs may be incompatible with these options.
1914c7a68eb7Smrg
1915*ec02198aSmrg@item arm_v8_2a_bf16_neon_ok
1916*ec02198aSmrgARM target supports options to generate instructions from ARMv8.2-A with
1917*ec02198aSmrgthe BFloat16 extension (bf16). Some multilibs may be incompatible with these
1918*ec02198aSmrgoptions.
1919*ec02198aSmrg
1920*ec02198aSmrg@item arm_v8_2a_i8mm_ok
1921*ec02198aSmrgARM target supports options to generate instructions from ARMv8.2-A with
1922*ec02198aSmrgthe 8-Bit Integer Matrix Multiply extension (i8mm). Some multilibs may be
1923*ec02198aSmrgincompatible with these options.
1924*ec02198aSmrg
1925*ec02198aSmrg@item arm_v8_1m_mve_ok
1926*ec02198aSmrgARM target supports options to generate instructions from ARMv8.1-M with
1927*ec02198aSmrgthe M-Profile Vector Extension (MVE). Some multilibs may be incompatible
1928*ec02198aSmrgwith these options.
1929*ec02198aSmrg
1930*ec02198aSmrg@item arm_v8_1m_mve_fp_ok
1931*ec02198aSmrgARM target supports options to generate instructions from ARMv8.1-M with
1932*ec02198aSmrgthe Half-precision floating-point instructions (HP), Floating-point Extension
1933*ec02198aSmrg(FP) along with M-Profile Vector Extension (MVE). Some multilibs may be
1934*ec02198aSmrgincompatible with these options.
1935*ec02198aSmrg
1936*ec02198aSmrg@item arm_mve_hw
1937*ec02198aSmrgTest system supports executing MVE instructions.
1938*ec02198aSmrg
1939*ec02198aSmrg@item arm_v8m_main_cde
1940*ec02198aSmrgARM target supports options to generate instructions from ARMv8-M with
1941*ec02198aSmrgthe Custom Datapath Extension (CDE). Some multilibs may be incompatible
1942*ec02198aSmrgwith these options.
1943*ec02198aSmrg
1944*ec02198aSmrg@item arm_v8m_main_cde_fp
1945*ec02198aSmrgARM target supports options to generate instructions from ARMv8-M with
1946*ec02198aSmrgthe Custom Datapath Extension (CDE) and floating-point (VFP).
1947*ec02198aSmrgSome multilibs may be incompatible with these options.
1948*ec02198aSmrg
1949*ec02198aSmrg@item arm_v8_1m_main_cde_mve
1950*ec02198aSmrgARM target supports options to generate instructions from ARMv8.1-M with
1951*ec02198aSmrgthe Custom Datapath Extension (CDE) and M-Profile Vector Extension (MVE).
1952*ec02198aSmrgSome multilibs may be incompatible with these options.
1953*ec02198aSmrg
195410d565efSmrg@item arm_prefer_ldrd_strd
195510d565efSmrgARM target prefers @code{LDRD} and @code{STRD} instructions over
195610d565efSmrg@code{LDM} and @code{STM} instructions.
195710d565efSmrg
195810d565efSmrg@item arm_thumb1_movt_ok
195910d565efSmrgARM target generates Thumb-1 code for @code{-mthumb} with @code{MOVW}
196010d565efSmrgand @code{MOVT} instructions available.
196110d565efSmrg
196210d565efSmrg@item arm_thumb1_cbz_ok
196310d565efSmrgARM target generates Thumb-1 code for @code{-mthumb} with
196410d565efSmrg@code{CBZ} and @code{CBNZ} instructions available.
196510d565efSmrg
196610d565efSmrg@item arm_divmod_simode
196710d565efSmrgARM target for which divmod transform is disabled, if it supports hardware
196810d565efSmrgdiv instruction.
196910d565efSmrg
197010d565efSmrg@item arm_cmse_ok
197110d565efSmrgARM target supports ARMv8-M Security Extensions, enabled by the @code{-mcmse}
197210d565efSmrgoption.
197310d565efSmrg
197410d565efSmrg@item arm_coproc1_ok
197510d565efSmrg@anchor{arm_coproc1_ok}
197610d565efSmrgARM target supports the following coprocessor instructions: @code{CDP},
197710d565efSmrg@code{LDC}, @code{STC}, @code{MCR} and @code{MRC}.
197810d565efSmrg
197910d565efSmrg@item arm_coproc2_ok
198010d565efSmrg@anchor{arm_coproc2_ok}
198110d565efSmrgARM target supports all the coprocessor instructions also listed as supported
198210d565efSmrgin @ref{arm_coproc1_ok} in addition to the following: @code{CDP2}, @code{LDC2},
198310d565efSmrg@code{LDC2l}, @code{STC2}, @code{STC2l}, @code{MCR2} and @code{MRC2}.
198410d565efSmrg
198510d565efSmrg@item arm_coproc3_ok
198610d565efSmrg@anchor{arm_coproc3_ok}
198710d565efSmrgARM target supports all the coprocessor instructions also listed as supported
198810d565efSmrgin @ref{arm_coproc2_ok} in addition the following: @code{MCRR} and @code{MRRC}.
198910d565efSmrg
199010d565efSmrg@item arm_coproc4_ok
199110d565efSmrgARM target supports all the coprocessor instructions also listed as supported
199210d565efSmrgin @ref{arm_coproc3_ok} in addition the following: @code{MCRR2} and @code{MRRC2}.
1993*ec02198aSmrg
1994*ec02198aSmrg@item arm_simd32_ok
1995*ec02198aSmrg@anchor{arm_simd32_ok}
1996*ec02198aSmrgARM Target supports options suitable for accessing the SIMD32 intrinsics from
1997*ec02198aSmrg@code{arm_acle.h}.
1998*ec02198aSmrgSome multilibs may be incompatible with these options.
1999*ec02198aSmrg
2000*ec02198aSmrg@item arm_qbit_ok
2001*ec02198aSmrg@anchor{arm_qbit_ok}
2002*ec02198aSmrgARM Target supports options suitable for accessing the Q-bit manipulation
2003*ec02198aSmrgintrinsics from @code{arm_acle.h}.
2004*ec02198aSmrgSome multilibs may be incompatible with these options.
2005*ec02198aSmrg
2006*ec02198aSmrg@item arm_softfp_ok
2007*ec02198aSmrg@anchor{arm_softfp_ok}
2008*ec02198aSmrgARM target supports the @code{-mfloat-abi=softfp} option.
2009*ec02198aSmrg
2010*ec02198aSmrg@item arm_hard_ok
2011*ec02198aSmrg@anchor{arm_hard_ok}
2012*ec02198aSmrgARM target supports the @code{-mfloat-abi=hard} option.
2013*ec02198aSmrg
201410d565efSmrg@end table
201510d565efSmrg
201610d565efSmrg@subsubsection AArch64-specific attributes
201710d565efSmrg
201810d565efSmrg@table @code
201910d565efSmrg@item aarch64_asm_<ext>_ok
202010d565efSmrgAArch64 assembler supports the architecture extension @code{ext} via the
202110d565efSmrg@code{.arch_extension} pseudo-op.
202210d565efSmrg@item aarch64_tiny
202310d565efSmrgAArch64 target which generates instruction sequences for tiny memory model.
202410d565efSmrg@item aarch64_small
202510d565efSmrgAArch64 target which generates instruction sequences for small memory model.
202610d565efSmrg@item aarch64_large
202710d565efSmrgAArch64 target which generates instruction sequences for large memory model.
202810d565efSmrg@item aarch64_little_endian
202910d565efSmrgAArch64 target which generates instruction sequences for little endian.
203010d565efSmrg@item aarch64_big_endian
203110d565efSmrgAArch64 target which generates instruction sequences for big endian.
203210d565efSmrg@item aarch64_small_fpic
203310d565efSmrgBinutils installed on test system supports relocation types required by -fpic
203410d565efSmrgfor AArch64 small memory model.
2035*ec02198aSmrg@item aarch64_sve_hw
2036*ec02198aSmrgAArch64 target that is able to generate and execute SVE code (regardless of
2037*ec02198aSmrgwhether it does so by default).
2038*ec02198aSmrg@item aarch64_sve128_hw
2039*ec02198aSmrg@itemx aarch64_sve256_hw
2040*ec02198aSmrg@itemx aarch64_sve512_hw
2041*ec02198aSmrg@itemx aarch64_sve1024_hw
2042*ec02198aSmrg@itemx aarch64_sve2048_hw
2043*ec02198aSmrgLike @code{aarch64_sve_hw}, but also test for an exact hardware vector length.
204410d565efSmrg
2045*ec02198aSmrg@item aarch64_fjcvtzs_hw
2046*ec02198aSmrgAArch64 target that is able to generate and execute armv8.3-a FJCVTZS
2047*ec02198aSmrginstruction.
204810d565efSmrg@end table
204910d565efSmrg
205010d565efSmrg@subsubsection MIPS-specific attributes
205110d565efSmrg
205210d565efSmrg@table @code
205310d565efSmrg@item mips64
205410d565efSmrgMIPS target supports 64-bit instructions.
205510d565efSmrg
205610d565efSmrg@item nomips16
205710d565efSmrgMIPS target does not produce MIPS16 code.
205810d565efSmrg
205910d565efSmrg@item mips16_attribute
206010d565efSmrgMIPS target can generate MIPS16 code.
206110d565efSmrg
206210d565efSmrg@item mips_loongson
206310d565efSmrgMIPS target is a Loongson-2E or -2F target using an ABI that supports
206410d565efSmrgthe Loongson vector modes.
206510d565efSmrg
206610d565efSmrg@item mips_msa
206710d565efSmrgMIPS target supports @code{-mmsa}, MIPS SIMD Architecture (MSA).
206810d565efSmrg
206910d565efSmrg@item mips_newabi_large_long_double
207010d565efSmrgMIPS target supports @code{long double} larger than @code{double}
207110d565efSmrgwhen using the new ABI.
207210d565efSmrg
207310d565efSmrg@item mpaired_single
207410d565efSmrgMIPS target supports @code{-mpaired-single}.
207510d565efSmrg@end table
207610d565efSmrg
207710d565efSmrg@subsubsection PowerPC-specific attributes
207810d565efSmrg
207910d565efSmrg@table @code
208010d565efSmrg
208110d565efSmrg@item dfp_hw
208210d565efSmrgPowerPC target supports executing hardware DFP instructions.
208310d565efSmrg
208410d565efSmrg@item p8vector_hw
208510d565efSmrgPowerPC target supports executing VSX instructions (ISA 2.07).
208610d565efSmrg
208710d565efSmrg@item powerpc64
208810d565efSmrgTest system supports executing 64-bit instructions.
208910d565efSmrg
209010d565efSmrg@item powerpc_altivec
209110d565efSmrgPowerPC target supports AltiVec.
209210d565efSmrg
209310d565efSmrg@item powerpc_altivec_ok
209410d565efSmrgPowerPC target supports @code{-maltivec}.
209510d565efSmrg
209610d565efSmrg@item powerpc_eabi_ok
209710d565efSmrgPowerPC target supports @code{-meabi}.
209810d565efSmrg
209910d565efSmrg@item powerpc_elfv2
210010d565efSmrgPowerPC target supports @code{-mabi=elfv2}.
210110d565efSmrg
210210d565efSmrg@item powerpc_fprs
210310d565efSmrgPowerPC target supports floating-point registers.
210410d565efSmrg
210510d565efSmrg@item powerpc_hard_double
210610d565efSmrgPowerPC target supports hardware double-precision floating-point.
210710d565efSmrg
210810d565efSmrg@item powerpc_htm_ok
210910d565efSmrgPowerPC target supports @code{-mhtm}
211010d565efSmrg
211110d565efSmrg@item powerpc_p8vector_ok
211210d565efSmrgPowerPC target supports @code{-mpower8-vector}
211310d565efSmrg
211410d565efSmrg@item powerpc_popcntb_ok
211510d565efSmrgPowerPC target supports the @code{popcntb} instruction, indicating
211610d565efSmrgthat this target supports @code{-mcpu=power5}.
211710d565efSmrg
211810d565efSmrg@item powerpc_ppu_ok
211910d565efSmrgPowerPC target supports @code{-mcpu=cell}.
212010d565efSmrg
212110d565efSmrg@item powerpc_spe
212210d565efSmrgPowerPC target supports PowerPC SPE.
212310d565efSmrg
212410d565efSmrg@item powerpc_spe_nocache
212510d565efSmrgIncluding the options used to compile this particular test, the
212610d565efSmrgPowerPC target supports PowerPC SPE.
212710d565efSmrg
212810d565efSmrg@item powerpc_spu
212910d565efSmrgPowerPC target supports PowerPC SPU.
213010d565efSmrg
213110d565efSmrg@item powerpc_vsx_ok
213210d565efSmrgPowerPC target supports @code{-mvsx}.
213310d565efSmrg
213410d565efSmrg@item powerpc_405_nocache
213510d565efSmrgIncluding the options used to compile this particular test, the
213610d565efSmrgPowerPC target supports PowerPC 405.
213710d565efSmrg
213810d565efSmrg@item ppc_recip_hw
213910d565efSmrgPowerPC target supports executing reciprocal estimate instructions.
214010d565efSmrg
214110d565efSmrg@item vmx_hw
214210d565efSmrgPowerPC target supports executing AltiVec instructions.
214310d565efSmrg
214410d565efSmrg@item vsx_hw
214510d565efSmrgPowerPC target supports executing VSX instructions (ISA 2.06).
214610d565efSmrg@end table
214710d565efSmrg
214810d565efSmrg@subsubsection Other hardware attributes
214910d565efSmrg
2150c7a68eb7Smrg@c Please keep this table sorted alphabetically.
215110d565efSmrg@table @code
2152c7a68eb7Smrg@item autoincdec
2153c7a68eb7SmrgTarget supports autoincrement/decrement addressing.
2154c7a68eb7Smrg
215510d565efSmrg@item avx
215610d565efSmrgTarget supports compiling @code{avx} instructions.
215710d565efSmrg
215810d565efSmrg@item avx_runtime
215910d565efSmrgTarget supports the execution of @code{avx} instructions.
216010d565efSmrg
2161c7a68eb7Smrg@item avx2
2162c7a68eb7SmrgTarget supports compiling @code{avx2} instructions.
2163c7a68eb7Smrg
2164c7a68eb7Smrg@item avx2_runtime
2165c7a68eb7SmrgTarget supports the execution of @code{avx2} instructions.
2166c7a68eb7Smrg
2167c7a68eb7Smrg@item avx512f
2168c7a68eb7SmrgTarget supports compiling @code{avx512f} instructions.
2169c7a68eb7Smrg
2170c7a68eb7Smrg@item avx512f_runtime
2171c7a68eb7SmrgTarget supports the execution of @code{avx512f} instructions.
2172c7a68eb7Smrg
2173*ec02198aSmrg@item avx512vp2intersect
2174*ec02198aSmrgTarget supports the execution of @code{avx512vp2intersect} instructions.
2175*ec02198aSmrg
217610d565efSmrg@item cell_hw
217710d565efSmrgTest system can execute AltiVec and Cell PPU instructions.
217810d565efSmrg
217910d565efSmrg@item coldfire_fpu
218010d565efSmrgTarget uses a ColdFire FPU.
218110d565efSmrg
2182c7a68eb7Smrg@item divmod
2183c7a68eb7SmrgTarget supporting hardware divmod insn or divmod libcall.
2184c7a68eb7Smrg
2185c7a68eb7Smrg@item divmod_simode
2186c7a68eb7SmrgTarget supporting hardware divmod insn or divmod libcall for SImode.
2187c7a68eb7Smrg
218810d565efSmrg@item hard_float
218910d565efSmrgTarget supports FPU instructions.
219010d565efSmrg
219110d565efSmrg@item non_strict_align
219210d565efSmrgTarget does not require strict alignment.
219310d565efSmrg
2194c7a68eb7Smrg@item pie_copyreloc
2195c7a68eb7SmrgThe x86-64 target linker supports PIE with copy reloc.
2196c7a68eb7Smrg
2197c7a68eb7Smrg@item rdrand
2198c7a68eb7SmrgTarget supports x86 @code{rdrand} instruction.
2199c7a68eb7Smrg
220010d565efSmrg@item sqrt_insn
220110d565efSmrgTarget has a square root instruction that the compiler can generate.
220210d565efSmrg
220310d565efSmrg@item sse
220410d565efSmrgTarget supports compiling @code{sse} instructions.
220510d565efSmrg
220610d565efSmrg@item sse_runtime
220710d565efSmrgTarget supports the execution of @code{sse} instructions.
220810d565efSmrg
220910d565efSmrg@item sse2
221010d565efSmrgTarget supports compiling @code{sse2} instructions.
221110d565efSmrg
221210d565efSmrg@item sse2_runtime
221310d565efSmrgTarget supports the execution of @code{sse2} instructions.
221410d565efSmrg
221510d565efSmrg@item sync_char_short
221610d565efSmrgTarget supports atomic operations on @code{char} and @code{short}.
221710d565efSmrg
221810d565efSmrg@item sync_int_long
221910d565efSmrgTarget supports atomic operations on @code{int} and @code{long}.
222010d565efSmrg
222110d565efSmrg@item ultrasparc_hw
222210d565efSmrgTest environment appears to run executables on a simulator that
222310d565efSmrgaccepts only @code{EM_SPARC} executables and chokes on @code{EM_SPARC32PLUS}
222410d565efSmrgor @code{EM_SPARCV9} executables.
222510d565efSmrg
222610d565efSmrg@item vect_cmdline_needed
222710d565efSmrgTarget requires a command line argument to enable a SIMD instruction set.
222810d565efSmrg
2229c7a68eb7Smrg@item xorsign
2230c7a68eb7SmrgTarget supports the xorsign optab expansion.
223110d565efSmrg
223210d565efSmrg@end table
223310d565efSmrg
223410d565efSmrg@subsubsection Environment attributes
223510d565efSmrg
223610d565efSmrg@table @code
223710d565efSmrg@item c
223810d565efSmrgThe language for the compiler under test is C.
223910d565efSmrg
224010d565efSmrg@item c++
224110d565efSmrgThe language for the compiler under test is C++.
224210d565efSmrg
224310d565efSmrg@item c99_runtime
224410d565efSmrgTarget provides a full C99 runtime.
224510d565efSmrg
224610d565efSmrg@item correct_iso_cpp_string_wchar_protos
224710d565efSmrgTarget @code{string.h} and @code{wchar.h} headers provide C++ required
224810d565efSmrgoverloads for @code{strchr} etc. functions.
224910d565efSmrg
22500fc04c29Smrg@item d_runtime
22510fc04c29SmrgTarget provides the D runtime.
22520fc04c29Smrg
2253*ec02198aSmrg@item d_runtime_has_std_library
2254*ec02198aSmrgTarget provides the D standard library (Phobos).
2255*ec02198aSmrg
225610d565efSmrg@item dummy_wcsftime
225710d565efSmrgTarget uses a dummy @code{wcsftime} function that always returns zero.
225810d565efSmrg
225910d565efSmrg@item fd_truncate
226010d565efSmrgTarget can truncate a file from a file descriptor, as used by
22610fc04c29Smrg@file{libgfortran/io/unix.c:fd_truncate}; i.e.@: @code{ftruncate} or
226210d565efSmrg@code{chsize}.
226310d565efSmrg
22640fc04c29Smrg@item fenv
22650fc04c29SmrgTarget provides @file{fenv.h} include file.
22660fc04c29Smrg
22670fc04c29Smrg@item fenv_exceptions
22680fc04c29SmrgTarget supports @file{fenv.h} with all the standard IEEE exceptions
22690fc04c29Smrgand floating-point exceptions are raised by arithmetic operations.
22700fc04c29Smrg
2271*ec02198aSmrg@item fileio
2272*ec02198aSmrgTarget offers such file I/O library functions as @code{fopen},
2273*ec02198aSmrg@code{fclose}, @code{tmpnam}, and @code{remove}.  This is a link-time
2274*ec02198aSmrgrequirement for the presence of the functions in the library; even if
2275*ec02198aSmrgthey fail at runtime, the requirement is still regarded as satisfied.
2276*ec02198aSmrg
227710d565efSmrg@item freestanding
227810d565efSmrgTarget is @samp{freestanding} as defined in section 4 of the C99 standard.
227910d565efSmrgEffectively, it is a target which supports no extra headers or libraries
228010d565efSmrgother than what is considered essential.
228110d565efSmrg
228210d565efSmrg@item gettimeofday
228310d565efSmrgTarget supports @code{gettimeofday}.
228410d565efSmrg
228510d565efSmrg@item init_priority
228610d565efSmrgTarget supports constructors with initialization priority arguments.
228710d565efSmrg
228810d565efSmrg@item inttypes_types
228910d565efSmrgTarget has the basic signed and unsigned types in @code{inttypes.h}.
229010d565efSmrgThis is for tests that GCC's notions of these types agree with those
229110d565efSmrgin the header, as some systems have only @code{inttypes.h}.
229210d565efSmrg
229310d565efSmrg@item lax_strtofp
229410d565efSmrgTarget might have errors of a few ULP in string to floating-point
229510d565efSmrgconversion functions and overflow is not always detected correctly by
229610d565efSmrgthose functions.
229710d565efSmrg
229810d565efSmrg@item mempcpy
229910d565efSmrgTarget provides @code{mempcpy} function.
230010d565efSmrg
230110d565efSmrg@item mmap
230210d565efSmrgTarget supports @code{mmap}.
230310d565efSmrg
230410d565efSmrg@item newlib
230510d565efSmrgTarget supports Newlib.
230610d565efSmrg
23070fc04c29Smrg@item newlib_nano_io
23080fc04c29SmrgGCC was configured with @code{--enable-newlib-nano-formatted-io}, which reduces
23090fc04c29Smrgthe code size of Newlib formatted I/O functions.
23100fc04c29Smrg
231110d565efSmrg@item pow10
231210d565efSmrgTarget provides @code{pow10} function.
231310d565efSmrg
231410d565efSmrg@item pthread
231510d565efSmrgTarget can compile using @code{pthread.h} with no errors or warnings.
231610d565efSmrg
231710d565efSmrg@item pthread_h
231810d565efSmrgTarget has @code{pthread.h}.
231910d565efSmrg
232010d565efSmrg@item run_expensive_tests
232110d565efSmrgExpensive testcases (usually those that consume excessive amounts of CPU
232210d565efSmrgtime) should be run on this target.  This can be enabled by setting the
232310d565efSmrg@env{GCC_TEST_RUN_EXPENSIVE} environment variable to a non-empty string.
232410d565efSmrg
232510d565efSmrg@item simulator
23260fc04c29SmrgTest system runs executables on a simulator (i.e.@: slowly) rather than
23270fc04c29Smrghardware (i.e.@: fast).
232810d565efSmrg
2329c7a68eb7Smrg@item signal
2330c7a68eb7SmrgTarget has @code{signal.h}.
2331c7a68eb7Smrg
233210d565efSmrg@item stabs
233310d565efSmrgTarget supports the stabs debugging format.
233410d565efSmrg
233510d565efSmrg@item stdint_types
233610d565efSmrgTarget has the basic signed and unsigned C types in @code{stdint.h}.
233710d565efSmrgThis will be obsolete when GCC ensures a working @code{stdint.h} for
233810d565efSmrgall targets.
233910d565efSmrg
234010d565efSmrg@item stpcpy
234110d565efSmrgTarget provides @code{stpcpy} function.
234210d565efSmrg
234310d565efSmrg@item trampolines
234410d565efSmrgTarget supports trampolines.
234510d565efSmrg
234610d565efSmrg@item uclibc
234710d565efSmrgTarget supports uClibc.
234810d565efSmrg
234910d565efSmrg@item unwrapped
235010d565efSmrgTarget does not use a status wrapper.
235110d565efSmrg
235210d565efSmrg@item vxworks_kernel
235310d565efSmrgTarget is a VxWorks kernel.
235410d565efSmrg
235510d565efSmrg@item vxworks_rtp
235610d565efSmrgTarget is a VxWorks RTP.
235710d565efSmrg
235810d565efSmrg@item wchar
235910d565efSmrgTarget supports wide characters.
236010d565efSmrg@end table
236110d565efSmrg
236210d565efSmrg@subsubsection Other attributes
236310d565efSmrg
236410d565efSmrg@table @code
236510d565efSmrg@item automatic_stack_alignment
236610d565efSmrgTarget supports automatic stack alignment.
236710d565efSmrg
2368c7a68eb7Smrg@item branch_cost
2369c7a68eb7SmrgTarget supports @option{-branch-cost=N}.
237010d565efSmrg
237110d565efSmrg@item cxa_atexit
237210d565efSmrgTarget uses @code{__cxa_atexit}.
237310d565efSmrg
237410d565efSmrg@item default_packed
237510d565efSmrgTarget has packed layout of structure members by default.
237610d565efSmrg
23770fc04c29Smrg@item exceptions
23780fc04c29SmrgTarget supports exceptions.
23790fc04c29Smrg
2380*ec02198aSmrg@item exceptions_enabled
2381*ec02198aSmrgTarget supports exceptions and they are enabled in the current
2382*ec02198aSmrgtesting configuration.
2383*ec02198aSmrg
238410d565efSmrg@item fgraphite
238510d565efSmrgTarget supports Graphite optimizations.
238610d565efSmrg
238710d565efSmrg@item fixed_point
238810d565efSmrgTarget supports fixed-point extension to C.
238910d565efSmrg
239010d565efSmrg@item fopenacc
239110d565efSmrgTarget supports OpenACC via @option{-fopenacc}.
239210d565efSmrg
239310d565efSmrg@item fopenmp
239410d565efSmrgTarget supports OpenMP via @option{-fopenmp}.
239510d565efSmrg
239610d565efSmrg@item fpic
239710d565efSmrgTarget supports @option{-fpic} and @option{-fPIC}.
239810d565efSmrg
239910d565efSmrg@item freorder
240010d565efSmrgTarget supports @option{-freorder-blocks-and-partition}.
240110d565efSmrg
240210d565efSmrg@item fstack_protector
240310d565efSmrgTarget supports @option{-fstack-protector}.
240410d565efSmrg
240510d565efSmrg@item gas
240610d565efSmrgTarget uses GNU @command{as}.
240710d565efSmrg
240810d565efSmrg@item gc_sections
240910d565efSmrgTarget supports @option{--gc-sections}.
241010d565efSmrg
241110d565efSmrg@item gld
241210d565efSmrgTarget uses GNU @command{ld}.
241310d565efSmrg
241410d565efSmrg@item keeps_null_pointer_checks
241510d565efSmrgTarget keeps null pointer checks, either due to the use of
241610d565efSmrg@option{-fno-delete-null-pointer-checks} or hardwired into the target.
241710d565efSmrg
24180fc04c29Smrg@item llvm_binutils
24190fc04c29SmrgTarget is using an LLVM assembler and/or linker, instead of GNU Binutils.
24200fc04c29Smrg
242110d565efSmrg@item lto
242210d565efSmrgCompiler has been configured to support link-time optimization (LTO).
242310d565efSmrg
24240fc04c29Smrg@item lto_incremental
24250fc04c29SmrgCompiler and linker support link-time optimization relocatable linking
24260fc04c29Smrgwith @option{-r} and @option{-flto} options.
24270fc04c29Smrg
242810d565efSmrg@item naked_functions
242910d565efSmrgTarget supports the @code{naked} function attribute.
243010d565efSmrg
243110d565efSmrg@item named_sections
243210d565efSmrgTarget supports named sections.
243310d565efSmrg
243410d565efSmrg@item natural_alignment_32
243510d565efSmrgTarget uses natural alignment (aligned to type size) for types of
243610d565efSmrg32 bits or less.
243710d565efSmrg
243810d565efSmrg@item target_natural_alignment_64
243910d565efSmrgTarget uses natural alignment (aligned to type size) for types of
244010d565efSmrg64 bits or less.
244110d565efSmrg
2442*ec02198aSmrg@item noinit
2443*ec02198aSmrgTarget supports the @code{noinit} variable attribute.
2444*ec02198aSmrg
244510d565efSmrg@item nonpic
244610d565efSmrgTarget does not generate PIC by default.
244710d565efSmrg
24480fc04c29Smrg@item offload_gcn
24490fc04c29SmrgTarget has been configured for OpenACC/OpenMP offloading on AMD GCN.
24500fc04c29Smrg
245110d565efSmrg@item pie_enabled
245210d565efSmrgTarget generates PIE by default.
245310d565efSmrg
245410d565efSmrg@item pcc_bitfield_type_matters
245510d565efSmrgTarget defines @code{PCC_BITFIELD_TYPE_MATTERS}.
245610d565efSmrg
245710d565efSmrg@item pe_aligned_commons
245810d565efSmrgTarget supports @option{-mpe-aligned-commons}.
245910d565efSmrg
246010d565efSmrg@item pie
246110d565efSmrgTarget supports @option{-pie}, @option{-fpie} and @option{-fPIE}.
246210d565efSmrg
246310d565efSmrg@item rdynamic
246410d565efSmrgTarget supports @option{-rdynamic}.
246510d565efSmrg
24660fc04c29Smrg@item scalar_all_fma
24670fc04c29SmrgTarget supports all four fused multiply-add optabs for both @code{float}
24680fc04c29Smrgand @code{double}.  These optabs are: @code{fma_optab}, @code{fms_optab},
24690fc04c29Smrg@code{fnma_optab} and @code{fnms_optab}.
24700fc04c29Smrg
247110d565efSmrg@item section_anchors
247210d565efSmrgTarget supports section anchors.
247310d565efSmrg
247410d565efSmrg@item short_enums
247510d565efSmrgTarget defaults to short enums.
247610d565efSmrg
2477c7a68eb7Smrg@item stack_size
2478c7a68eb7Smrg@anchor{stack_size_et}
2479c7a68eb7SmrgTarget has limited stack size.  The stack size limit can be obtained using the
2480c7a68eb7SmrgSTACK_SIZE macro defined by @ref{stack_size_ao,,@code{dg-add-options} feature
2481c7a68eb7Smrg@code{stack_size}}.
2482c7a68eb7Smrg
248310d565efSmrg@item static
248410d565efSmrgTarget supports @option{-static}.
248510d565efSmrg
248610d565efSmrg@item static_libgfortran
248710d565efSmrgTarget supports statically linking @samp{libgfortran}.
248810d565efSmrg
248910d565efSmrg@item string_merging
249010d565efSmrgTarget supports merging string constants at link time.
249110d565efSmrg
249210d565efSmrg@item ucn
249310d565efSmrgTarget supports compiling and assembling UCN.
249410d565efSmrg
249510d565efSmrg@item ucn_nocache
249610d565efSmrgIncluding the options used to compile this particular test, the
249710d565efSmrgtarget supports compiling and assembling UCN.
249810d565efSmrg
249910d565efSmrg@item unaligned_stack
250010d565efSmrgTarget does not guarantee that its @code{STACK_BOUNDARY} is greater than
250110d565efSmrgor equal to the required vector alignment.
250210d565efSmrg
250310d565efSmrg@item vector_alignment_reachable
250410d565efSmrgVector alignment is reachable for types of 32 bits or less.
250510d565efSmrg
250610d565efSmrg@item vector_alignment_reachable_for_64bit
250710d565efSmrgVector alignment is reachable for types of 64 bits or less.
250810d565efSmrg
250910d565efSmrg@item wchar_t_char16_t_compatible
251010d565efSmrgTarget supports @code{wchar_t} that is compatible with @code{char16_t}.
251110d565efSmrg
251210d565efSmrg@item wchar_t_char32_t_compatible
251310d565efSmrgTarget supports @code{wchar_t} that is compatible with @code{char32_t}.
251410d565efSmrg
251510d565efSmrg@item comdat_group
251610d565efSmrgTarget uses comdat groups.
2517*ec02198aSmrg
2518*ec02198aSmrg@item indirect_calls
2519*ec02198aSmrgTarget supports indirect calls, i.e. calls where the target is not
2520*ec02198aSmrgconstant.
252110d565efSmrg@end table
252210d565efSmrg
252310d565efSmrg@subsubsection Local to tests in @code{gcc.target/i386}
252410d565efSmrg
252510d565efSmrg@table @code
252610d565efSmrg@item 3dnow
252710d565efSmrgTarget supports compiling @code{3dnow} instructions.
252810d565efSmrg
252910d565efSmrg@item aes
253010d565efSmrgTarget supports compiling @code{aes} instructions.
253110d565efSmrg
253210d565efSmrg@item fma4
253310d565efSmrgTarget supports compiling @code{fma4} instructions.
253410d565efSmrg
25350fc04c29Smrg@item mfentry
25360fc04c29SmrgTarget supports the @code{-mfentry} option that alters the
25370fc04c29Smrgposition of profiling calls such that they precede the prologue.
25380fc04c29Smrg
253910d565efSmrg@item ms_hook_prologue
254010d565efSmrgTarget supports attribute @code{ms_hook_prologue}.
254110d565efSmrg
254210d565efSmrg@item pclmul
254310d565efSmrgTarget supports compiling @code{pclmul} instructions.
254410d565efSmrg
254510d565efSmrg@item sse3
254610d565efSmrgTarget supports compiling @code{sse3} instructions.
254710d565efSmrg
254810d565efSmrg@item sse4
254910d565efSmrgTarget supports compiling @code{sse4} instructions.
255010d565efSmrg
255110d565efSmrg@item sse4a
255210d565efSmrgTarget supports compiling @code{sse4a} instructions.
255310d565efSmrg
255410d565efSmrg@item ssse3
255510d565efSmrgTarget supports compiling @code{ssse3} instructions.
255610d565efSmrg
255710d565efSmrg@item vaes
255810d565efSmrgTarget supports compiling @code{vaes} instructions.
255910d565efSmrg
256010d565efSmrg@item vpclmul
256110d565efSmrgTarget supports compiling @code{vpclmul} instructions.
256210d565efSmrg
256310d565efSmrg@item xop
256410d565efSmrgTarget supports compiling @code{xop} instructions.
256510d565efSmrg@end table
256610d565efSmrg
256710d565efSmrg@subsubsection Local to tests in @code{gcc.test-framework}
256810d565efSmrg
256910d565efSmrg@table @code
257010d565efSmrg@item no
257110d565efSmrgAlways returns 0.
257210d565efSmrg
257310d565efSmrg@item yes
257410d565efSmrgAlways returns 1.
257510d565efSmrg@end table
257610d565efSmrg
257710d565efSmrg@node Add Options
257810d565efSmrg@subsection Features for @code{dg-add-options}
257910d565efSmrg
258010d565efSmrgThe supported values of @var{feature} for directive @code{dg-add-options}
258110d565efSmrgare:
258210d565efSmrg
258310d565efSmrg@table @code
258410d565efSmrg@item arm_fp
258510d565efSmrg@code{__ARM_FP} definition.  Only ARM targets support this feature, and only then
258610d565efSmrgin certain modes; see the @ref{arm_fp_ok,,arm_fp_ok effective target
258710d565efSmrgkeyword}.
258810d565efSmrg
2589*ec02198aSmrg@item arm_fp_dp
2590*ec02198aSmrg@code{__ARM_FP} definition with double-precision support.  Only ARM
2591*ec02198aSmrgtargets support this feature, and only then in certain modes; see the
2592*ec02198aSmrg@ref{arm_fp_dp_ok,,arm_fp_dp_ok effective target keyword}.
2593*ec02198aSmrg
259410d565efSmrg@item arm_neon
259510d565efSmrgNEON support.  Only ARM targets support this feature, and only then
259610d565efSmrgin certain modes; see the @ref{arm_neon_ok,,arm_neon_ok effective target
259710d565efSmrgkeyword}.
259810d565efSmrg
259910d565efSmrg@item arm_fp16
260010d565efSmrgVFP half-precision floating point support.  This does not select the
260110d565efSmrgFP16 format; for that, use @ref{arm_fp16_ieee,,arm_fp16_ieee} or
260210d565efSmrg@ref{arm_fp16_alternative,,arm_fp16_alternative} instead.  This
260310d565efSmrgfeature is only supported by ARM targets and then only in certain
260410d565efSmrgmodes; see the @ref{arm_fp16_ok,,arm_fp16_ok effective target
260510d565efSmrgkeyword}.
260610d565efSmrg
260710d565efSmrg@item arm_fp16_ieee
260810d565efSmrg@anchor{arm_fp16_ieee}
260910d565efSmrgARM IEEE 754-2008 format VFP half-precision floating point support.
261010d565efSmrgThis feature is only supported by ARM targets and then only in certain
261110d565efSmrgmodes; see the @ref{arm_fp16_ok,,arm_fp16_ok effective target
261210d565efSmrgkeyword}.
261310d565efSmrg
261410d565efSmrg@item arm_fp16_alternative
261510d565efSmrg@anchor{arm_fp16_alternative}
261610d565efSmrgARM Alternative format VFP half-precision floating point support.
261710d565efSmrgThis feature is only supported by ARM targets and then only in certain
261810d565efSmrgmodes; see the @ref{arm_fp16_ok,,arm_fp16_ok effective target
261910d565efSmrgkeyword}.
262010d565efSmrg
262110d565efSmrg@item arm_neon_fp16
262210d565efSmrgNEON and half-precision floating point support.  Only ARM targets
262310d565efSmrgsupport this feature, and only then in certain modes; see
262410d565efSmrgthe @ref{arm_neon_fp16_ok,,arm_neon_fp16_ok effective target keyword}.
262510d565efSmrg
262610d565efSmrg@item arm_vfp3
262710d565efSmrgarm vfp3 floating point support; see
262810d565efSmrgthe @ref{arm_vfp3_ok,,arm_vfp3_ok effective target keyword}.
262910d565efSmrg
2630*ec02198aSmrg@item arm_arch_v8a_hard
2631*ec02198aSmrgAdd options for ARMv8-A and the hard-float variant of the AAPCS,
2632*ec02198aSmrgif this is supported by the compiler; see the
2633*ec02198aSmrg@ref{arm_arch_v8a_hard_ok,,arm_arch_v8a_hard_ok} effective target keyword.
2634*ec02198aSmrg
263510d565efSmrg@item arm_v8_1a_neon
2636c7a68eb7SmrgAdd options for ARMv8.1-A with Adv.SIMD support, if this is supported
263710d565efSmrgby the target; see the @ref{arm_v8_1a_neon_ok,,arm_v8_1a_neon_ok}
263810d565efSmrgeffective target keyword.
263910d565efSmrg
264010d565efSmrg@item arm_v8_2a_fp16_scalar
2641c7a68eb7SmrgAdd options for ARMv8.2-A with scalar FP16 support, if this is
264210d565efSmrgsupported by the target; see the
264310d565efSmrg@ref{arm_v8_2a_fp16_scalar_ok,,arm_v8_2a_fp16_scalar_ok} effective
264410d565efSmrgtarget keyword.
264510d565efSmrg
264610d565efSmrg@item arm_v8_2a_fp16_neon
2647c7a68eb7SmrgAdd options for ARMv8.2-A with Adv.SIMD FP16 support, if this is
264810d565efSmrgsupported by the target; see the
264910d565efSmrg@ref{arm_v8_2a_fp16_neon_ok,,arm_v8_2a_fp16_neon_ok} effective target
265010d565efSmrgkeyword.
265110d565efSmrg
2652c7a68eb7Smrg@item arm_v8_2a_dotprod_neon
2653c7a68eb7SmrgAdd options for ARMv8.2-A with Adv.SIMD Dot Product support, if this is
2654c7a68eb7Smrgsupported by the target; see the
2655c7a68eb7Smrg@ref{arm_v8_2a_dotprod_neon_ok} effective target keyword.
2656c7a68eb7Smrg
2657c7a68eb7Smrg@item arm_fp16fml_neon
2658c7a68eb7SmrgAdd options to enable generation of the @code{VFMAL} and @code{VFMSL}
2659c7a68eb7Smrginstructions, if this is supported by the target; see the
2660c7a68eb7Smrg@ref{arm_fp16fml_neon_ok} effective target keyword.
2661c7a68eb7Smrg
266210d565efSmrg@item bind_pic_locally
266310d565efSmrgAdd the target-specific flags needed to enable functions to bind
266410d565efSmrglocally when using pic/PIC passes in the testsuite.
266510d565efSmrg
266610d565efSmrg@item float@var{n}
266710d565efSmrgAdd the target-specific flags needed to use the @code{_Float@var{n}} type.
266810d565efSmrg
266910d565efSmrg@item float@var{n}x
267010d565efSmrgAdd the target-specific flags needed to use the @code{_Float@var{n}x} type.
267110d565efSmrg
267210d565efSmrg@item ieee
267310d565efSmrgAdd the target-specific flags needed to enable full IEEE
267410d565efSmrgcompliance mode.
267510d565efSmrg
267610d565efSmrg@item mips16_attribute
267710d565efSmrg@code{mips16} function attributes.
267810d565efSmrgOnly MIPS targets support this feature, and only then in certain modes.
267910d565efSmrg
2680c7a68eb7Smrg@item stack_size
2681c7a68eb7Smrg@anchor{stack_size_ao}
2682c7a68eb7SmrgAdd the flags needed to define macro STACK_SIZE and set it to the stack size
2683c7a68eb7Smrglimit associated with the @ref{stack_size_et,,@code{stack_size} effective
2684c7a68eb7Smrgtarget}.
2685c7a68eb7Smrg
26860fc04c29Smrg@item sqrt_insn
26870fc04c29SmrgAdd the target-specific flags needed to enable hardware square root
26880fc04c29Smrginstructions, if any.
26890fc04c29Smrg
269010d565efSmrg@item tls
269110d565efSmrgAdd the target-specific flags needed to use thread-local storage.
269210d565efSmrg@end table
269310d565efSmrg
269410d565efSmrg@node Require Support
269510d565efSmrg@subsection Variants of @code{dg-require-@var{support}}
269610d565efSmrg
269710d565efSmrgA few of the @code{dg-require} directives take arguments.
269810d565efSmrg
269910d565efSmrg@table @code
270010d565efSmrg@item dg-require-iconv @var{codeset}
270110d565efSmrgSkip the test if the target does not support iconv.  @var{codeset} is
270210d565efSmrgthe codeset to convert to.
270310d565efSmrg
270410d565efSmrg@item dg-require-profiling @var{profopt}
270510d565efSmrgSkip the test if the target does not support profiling with option
270610d565efSmrg@var{profopt}.
270710d565efSmrg
2708c7a68eb7Smrg@item dg-require-stack-check @var{check}
2709c7a68eb7SmrgSkip the test if the target does not support the @code{-fstack-check}
2710c7a68eb7Smrgoption.  If @var{check} is @code{""}, support for @code{-fstack-check}
2711c7a68eb7Smrgis checked, for @code{-fstack-check=("@var{check}")} otherwise.
2712c7a68eb7Smrg
2713c7a68eb7Smrg@item dg-require-stack-size @var{size}
2714c7a68eb7SmrgSkip the test if the target does not support a stack size of @var{size}.
2715c7a68eb7Smrg
271610d565efSmrg@item dg-require-visibility @var{vis}
271710d565efSmrgSkip the test if the target does not support the @code{visibility} attribute.
271810d565efSmrgIf @var{vis} is @code{""}, support for @code{visibility("hidden")} is
271910d565efSmrgchecked, for @code{visibility("@var{vis}")} otherwise.
272010d565efSmrg@end table
272110d565efSmrg
272210d565efSmrgThe original @code{dg-require} directives were defined before there
272310d565efSmrgwas support for effective-target keywords.  The directives that do not
272410d565efSmrgtake arguments could be replaced with effective-target keywords.
272510d565efSmrg
272610d565efSmrg@table @code
272710d565efSmrg@item dg-require-alias ""
272810d565efSmrgSkip the test if the target does not support the @samp{alias} attribute.
272910d565efSmrg
273010d565efSmrg@item dg-require-ascii-locale ""
273110d565efSmrgSkip the test if the host does not support an ASCII locale.
273210d565efSmrg
273310d565efSmrg@item dg-require-compat-dfp ""
273410d565efSmrgSkip this test unless both compilers in a @file{compat} testsuite
273510d565efSmrgsupport decimal floating point.
273610d565efSmrg
273710d565efSmrg@item dg-require-cxa-atexit ""
273810d565efSmrgSkip the test if the target does not support @code{__cxa_atexit}.
273910d565efSmrgThis is equivalent to @code{dg-require-effective-target cxa_atexit}.
274010d565efSmrg
274110d565efSmrg@item dg-require-dll ""
274210d565efSmrgSkip the test if the target does not support DLL attributes.
274310d565efSmrg
2744*ec02198aSmrg@item dg-require-dot ""
2745*ec02198aSmrgSkip the test if the host does not have @command{dot}.
2746*ec02198aSmrg
274710d565efSmrg@item dg-require-fork ""
274810d565efSmrgSkip the test if the target does not support @code{fork}.
274910d565efSmrg
275010d565efSmrg@item dg-require-gc-sections ""
275110d565efSmrgSkip the test if the target's linker does not support the
275210d565efSmrg@code{--gc-sections} flags.
275310d565efSmrgThis is equivalent to @code{dg-require-effective-target gc-sections}.
275410d565efSmrg
275510d565efSmrg@item dg-require-host-local ""
275610d565efSmrgSkip the test if the host is remote, rather than the same as the build
275710d565efSmrgsystem.  Some tests are incompatible with DejaGnu's handling of remote
275810d565efSmrghosts, which involves copying the source file to the host and compiling
275910d565efSmrgit with a relative path and "@code{-o a.out}".
276010d565efSmrg
276110d565efSmrg@item dg-require-mkfifo ""
276210d565efSmrgSkip the test if the target does not support @code{mkfifo}.
276310d565efSmrg
276410d565efSmrg@item dg-require-named-sections ""
276510d565efSmrgSkip the test is the target does not support named sections.
276610d565efSmrgThis is equivalent to @code{dg-require-effective-target named_sections}.
276710d565efSmrg
276810d565efSmrg@item dg-require-weak ""
276910d565efSmrgSkip the test if the target does not support weak symbols.
277010d565efSmrg
277110d565efSmrg@item dg-require-weak-override ""
277210d565efSmrgSkip the test if the target does not support overriding weak symbols.
277310d565efSmrg@end table
277410d565efSmrg
277510d565efSmrg@node Final Actions
277610d565efSmrg@subsection Commands for use in @code{dg-final}
277710d565efSmrg
277810d565efSmrgThe GCC testsuite defines the following directives to be used within
277910d565efSmrg@code{dg-final}.
278010d565efSmrg
278110d565efSmrg@subsubsection Scan a particular file
278210d565efSmrg
278310d565efSmrg@table @code
278410d565efSmrg@item scan-file @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}]
278510d565efSmrgPasses if @var{regexp} matches text in @var{filename}.
278610d565efSmrg@item scan-file-not @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}]
278710d565efSmrgPasses if @var{regexp} does not match text in @var{filename}.
278810d565efSmrg@item scan-module @var{module} @var{regexp} [@{ target/xfail @var{selector} @}]
278910d565efSmrgPasses if @var{regexp} matches in Fortran module @var{module}.
2790*ec02198aSmrg@item dg-check-dot @var{filename}
2791*ec02198aSmrgPasses if @var{filename} is a valid @file{.dot} file (by running
2792*ec02198aSmrg@code{dot -Tpng} on it, and verifying the exit code is 0).
279310d565efSmrg@end table
279410d565efSmrg
279510d565efSmrg@subsubsection Scan the assembly output
279610d565efSmrg
279710d565efSmrg@table @code
279810d565efSmrg@item scan-assembler @var{regex} [@{ target/xfail @var{selector} @}]
279910d565efSmrgPasses if @var{regex} matches text in the test's assembler output.
280010d565efSmrg
280110d565efSmrg@item scan-assembler-not @var{regex} [@{ target/xfail @var{selector} @}]
280210d565efSmrgPasses if @var{regex} does not match text in the test's assembler output.
280310d565efSmrg
280410d565efSmrg@item scan-assembler-times @var{regex} @var{num} [@{ target/xfail @var{selector} @}]
280510d565efSmrgPasses if @var{regex} is matched exactly @var{num} times in the test's
280610d565efSmrgassembler output.
280710d565efSmrg
280810d565efSmrg@item scan-assembler-dem @var{regex} [@{ target/xfail @var{selector} @}]
280910d565efSmrgPasses if @var{regex} matches text in the test's demangled assembler output.
281010d565efSmrg
281110d565efSmrg@item scan-assembler-dem-not @var{regex} [@{ target/xfail @var{selector} @}]
281210d565efSmrgPasses if @var{regex} does not match text in the test's demangled assembler
281310d565efSmrgoutput.
281410d565efSmrg
281510d565efSmrg@item scan-hidden @var{symbol} [@{ target/xfail @var{selector} @}]
281610d565efSmrgPasses if @var{symbol} is defined as a hidden symbol in the test's
281710d565efSmrgassembly output.
281810d565efSmrg
281910d565efSmrg@item scan-not-hidden @var{symbol} [@{ target/xfail @var{selector} @}]
282010d565efSmrgPasses if @var{symbol} is not defined as a hidden symbol in the test's
282110d565efSmrgassembly output.
2822*ec02198aSmrg
2823*ec02198aSmrg@item check-function-bodies @var{prefix} @var{terminator} [@var{options} [@{ target/xfail @var{selector} @}]]
2824*ec02198aSmrgLooks through the source file for comments that give the expected assembly
2825*ec02198aSmrgoutput for selected functions.  Each line of expected output starts with the
2826*ec02198aSmrgprefix string @var{prefix} and the expected output for a function as a whole
2827*ec02198aSmrgis followed by a line that starts with the string @var{terminator}.
2828*ec02198aSmrgSpecifying an empty terminator is equivalent to specifying @samp{"*/"}.
2829*ec02198aSmrg
2830*ec02198aSmrg@var{options}, if specified, is a list of regular expressions, each of
2831*ec02198aSmrgwhich matches a full command-line option.  A non-empty list prevents
2832*ec02198aSmrgthe test from running unless all of the given options are present on the
2833*ec02198aSmrgcommand line.  This can help if a source file is compiled both with
2834*ec02198aSmrgand without optimization, since it is rarely useful to check the full
2835*ec02198aSmrgfunction body for unoptimized code.
2836*ec02198aSmrg
2837*ec02198aSmrgThe first line of the expected output for a function @var{fn} has the form:
2838*ec02198aSmrg
2839*ec02198aSmrg@smallexample
2840*ec02198aSmrg@var{prefix} @var{fn}:  [@{ target/xfail @var{selector} @}]
2841*ec02198aSmrg@end smallexample
2842*ec02198aSmrg
2843*ec02198aSmrgSubsequent lines of the expected output also start with @var{prefix}.
2844*ec02198aSmrgIn both cases, whitespace after @var{prefix} is not significant.
2845*ec02198aSmrg
2846*ec02198aSmrgThe test discards assembly directives such as @code{.cfi_startproc}
2847*ec02198aSmrgand local label definitions such as @code{.LFB0} from the compiler's
2848*ec02198aSmrgassembly output.  It then matches the result against the expected
2849*ec02198aSmrgoutput for a function as a single regular expression.  This means that
2850*ec02198aSmrglater lines can use backslashes to refer back to @samp{(@dots{})}
2851*ec02198aSmrgcaptures on earlier lines.  For example:
2852*ec02198aSmrg
2853*ec02198aSmrg@smallexample
2854*ec02198aSmrg/* @{ dg-final @{ check-function-bodies "**" "" "-DCHECK_ASM" @} @} */
2855*ec02198aSmrg@dots{}
2856*ec02198aSmrg/*
2857*ec02198aSmrg** add_w0_s8_m:
2858*ec02198aSmrg**	mov	(z[0-9]+\.b), w0
2859*ec02198aSmrg**	add	z0\.b, p0/m, z0\.b, \1
2860*ec02198aSmrg**	ret
2861*ec02198aSmrg*/
2862*ec02198aSmrgsvint8_t add_w0_s8_m (@dots{}) @{ @dots{} @}
2863*ec02198aSmrg@dots{}
2864*ec02198aSmrg/*
2865*ec02198aSmrg** add_b0_s8_m:
2866*ec02198aSmrg**	mov	(z[0-9]+\.b), b0
2867*ec02198aSmrg**	add	z1\.b, p0/m, z1\.b, \1
2868*ec02198aSmrg**	ret
2869*ec02198aSmrg*/
2870*ec02198aSmrgsvint8_t add_b0_s8_m (@dots{}) @{ @dots{} @}
2871*ec02198aSmrg@end smallexample
2872*ec02198aSmrg
2873*ec02198aSmrgchecks whether the implementations of @code{add_w0_s8_m} and
2874*ec02198aSmrg@code{add_b0_s8_m} match the regular expressions given.  The test only
2875*ec02198aSmrgruns when @samp{-DCHECK_ASM} is passed on the command line.
2876*ec02198aSmrg
2877*ec02198aSmrgIt is possible to create non-capturing multi-line regular expression
2878*ec02198aSmrggroups of the form @samp{(@var{a}|@var{b}|@dots{})} by putting the
2879*ec02198aSmrg@samp{(}, @samp{|} and @samp{)} on separate lines (each still using
2880*ec02198aSmrg@var{prefix}).  For example:
2881*ec02198aSmrg
2882*ec02198aSmrg@smallexample
2883*ec02198aSmrg/*
2884*ec02198aSmrg** cmple_f16_tied:
2885*ec02198aSmrg** (
2886*ec02198aSmrg**	fcmge	p0\.h, p0/z, z1\.h, z0\.h
2887*ec02198aSmrg** |
2888*ec02198aSmrg**	fcmle	p0\.h, p0/z, z0\.h, z1\.h
2889*ec02198aSmrg** )
2890*ec02198aSmrg**	ret
2891*ec02198aSmrg*/
2892*ec02198aSmrgsvbool_t cmple_f16_tied (@dots{}) @{ @dots{} @}
2893*ec02198aSmrg@end smallexample
2894*ec02198aSmrg
2895*ec02198aSmrgchecks whether @code{cmple_f16_tied} is implemented by the
2896*ec02198aSmrg@code{fcmge} instruction followed by @code{ret} or by the
2897*ec02198aSmrg@code{fcmle} instruction followed by @code{ret}.  The test is
2898*ec02198aSmrgstill a single regular rexpression.
2899*ec02198aSmrg
2900*ec02198aSmrgA line containing just:
2901*ec02198aSmrg
2902*ec02198aSmrg@smallexample
2903*ec02198aSmrg@var{prefix} ...
2904*ec02198aSmrg@end smallexample
2905*ec02198aSmrg
2906*ec02198aSmrgstands for zero or more unmatched lines; the whitespace after
2907*ec02198aSmrg@var{prefix} is again not significant.
2908*ec02198aSmrg
290910d565efSmrg@end table
291010d565efSmrg
291110d565efSmrg@subsubsection Scan optimization dump files
291210d565efSmrg
29130fc04c29SmrgThese commands are available for @var{kind} of @code{tree}, @code{ltrans-tree},
29140fc04c29Smrg@code{offload-tree}, @code{rtl}, @code{offload-rtl}, @code{ipa}, and
29150fc04c29Smrg@code{wpa-ipa}.
291610d565efSmrg
291710d565efSmrg@table @code
291810d565efSmrg@item scan-@var{kind}-dump @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
291910d565efSmrgPasses if @var{regex} matches text in the dump file with suffix @var{suffix}.
292010d565efSmrg
292110d565efSmrg@item scan-@var{kind}-dump-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
292210d565efSmrgPasses if @var{regex} does not match text in the dump file with suffix
292310d565efSmrg@var{suffix}.
292410d565efSmrg
292510d565efSmrg@item scan-@var{kind}-dump-times @var{regex} @var{num} @var{suffix} [@{ target/xfail @var{selector} @}]
292610d565efSmrgPasses if @var{regex} is found exactly @var{num} times in the dump file
292710d565efSmrgwith suffix @var{suffix}.
292810d565efSmrg
292910d565efSmrg@item scan-@var{kind}-dump-dem @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
293010d565efSmrgPasses if @var{regex} matches demangled text in the dump file with
293110d565efSmrgsuffix @var{suffix}.
293210d565efSmrg
293310d565efSmrg@item scan-@var{kind}-dump-dem-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
293410d565efSmrgPasses if @var{regex} does not match demangled text in the dump file with
293510d565efSmrgsuffix @var{suffix}.
293610d565efSmrg@end table
293710d565efSmrg
29380fc04c29Smrg@subsubsection Check for output files
293910d565efSmrg
294010d565efSmrg@table @code
294110d565efSmrg@item output-exists [@{ target/xfail @var{selector} @}]
294210d565efSmrgPasses if compiler output file exists.
294310d565efSmrg
294410d565efSmrg@item output-exists-not [@{ target/xfail @var{selector} @}]
294510d565efSmrgPasses if compiler output file does not exist.
294610d565efSmrg
294710d565efSmrg@item scan-symbol @var{regexp} [@{ target/xfail @var{selector} @}]
294810d565efSmrgPasses if the pattern is present in the final executable.
29490fc04c29Smrg
29500fc04c29Smrg@item scan-symbol-not @var{regexp} [@{ target/xfail @var{selector} @}]
29510fc04c29SmrgPasses if the pattern is absent from the final executable.
295210d565efSmrg@end table
295310d565efSmrg
295410d565efSmrg@subsubsection Checks for @command{gcov} tests
295510d565efSmrg
295610d565efSmrg@table @code
295710d565efSmrg@item run-gcov @var{sourcefile}
295810d565efSmrgCheck line counts in @command{gcov} tests.
295910d565efSmrg
296010d565efSmrg@item run-gcov [branches] [calls] @{ @var{opts} @var{sourcefile} @}
296110d565efSmrgCheck branch and/or call counts, in addition to line counts, in
296210d565efSmrg@command{gcov} tests.
296310d565efSmrg@end table
296410d565efSmrg
296510d565efSmrg@subsubsection Clean up generated test files
296610d565efSmrg
296710d565efSmrgUsually the test-framework removes files that were generated during
296810d565efSmrgtesting. If a testcase, for example, uses any dumping mechanism to
296910d565efSmrginspect a passes dump file, the testsuite recognized the dump option
297010d565efSmrgpassed to the tool and schedules a final cleanup to remove these files.
297110d565efSmrg
297210d565efSmrgThere are, however, following additional cleanup directives that can be
297310d565efSmrgused to annotate a testcase "manually".
297410d565efSmrg@table @code
297510d565efSmrg@item cleanup-coverage-files
297610d565efSmrgRemoves coverage data files generated for this test.
297710d565efSmrg
297810d565efSmrg@item cleanup-modules "@var{list-of-extra-modules}"
297910d565efSmrgRemoves Fortran module files generated for this test, excluding the
298010d565efSmrgmodule names listed in keep-modules.
298110d565efSmrgCleaning up module files is usually done automatically by the testsuite
298210d565efSmrgby looking at the source files and removing the modules after the test
298310d565efSmrghas been executed.
298410d565efSmrg@smallexample
298510d565efSmrgmodule MoD1
298610d565efSmrgend module MoD1
298710d565efSmrgmodule Mod2
298810d565efSmrgend module Mod2
298910d565efSmrgmodule moD3
299010d565efSmrgend module moD3
299110d565efSmrgmodule mod4
299210d565efSmrgend module mod4
299310d565efSmrg! @{ dg-final @{ cleanup-modules "mod1 mod2" @} @} ! redundant
299410d565efSmrg! @{ dg-final @{ keep-modules "mod3 mod4" @} @}
299510d565efSmrg@end smallexample
299610d565efSmrg
299710d565efSmrg@item keep-modules "@var{list-of-modules-not-to-delete}"
299810d565efSmrgWhitespace separated list of module names that should not be deleted by
299910d565efSmrgcleanup-modules.
300010d565efSmrgIf the list of modules is empty, all modules defined in this file are kept.
300110d565efSmrg@smallexample
300210d565efSmrgmodule maybe_unneeded
300310d565efSmrgend module maybe_unneeded
300410d565efSmrgmodule keep1
300510d565efSmrgend module keep1
300610d565efSmrgmodule keep2
300710d565efSmrgend module keep2
300810d565efSmrg! @{ dg-final @{ keep-modules "keep1 keep2" @} @} ! just keep these two
300910d565efSmrg! @{ dg-final @{ keep-modules "" @} @} ! keep all
301010d565efSmrg@end smallexample
301110d565efSmrg
301210d565efSmrg@item dg-keep-saved-temps "@var{list-of-suffixes-not-to-delete}"
301310d565efSmrgWhitespace separated list of suffixes that should not be deleted
301410d565efSmrgautomatically in a testcase that uses @option{-save-temps}.
301510d565efSmrg@smallexample
301610d565efSmrg// @{ dg-options "-save-temps -fpch-preprocess -I." @}
301710d565efSmrgint main() @{ return 0; @}
301810d565efSmrg// @{ dg-keep-saved-temps ".s" @} ! just keep assembler file
301910d565efSmrg// @{ dg-keep-saved-temps ".s" ".i" @} ! ... and .i
302010d565efSmrg// @{ dg-keep-saved-temps ".ii" ".o" @} ! or just .ii and .o
302110d565efSmrg@end smallexample
302210d565efSmrg
302310d565efSmrg@item cleanup-profile-file
302410d565efSmrgRemoves profiling files generated for this test.
302510d565efSmrg
302610d565efSmrg@end table
302710d565efSmrg
302810d565efSmrg@node Ada Tests
302910d565efSmrg@section Ada Language Testsuites
303010d565efSmrg
303110d565efSmrgThe Ada testsuite includes executable tests from the ACATS
303210d565efSmrgtestsuite, publicly available at
303310d565efSmrg@uref{http://www.ada-auth.org/acats.html}.
303410d565efSmrg
303510d565efSmrgThese tests are integrated in the GCC testsuite in the
303610d565efSmrg@file{ada/acats} directory, and
303710d565efSmrgenabled automatically when running @code{make check}, assuming
303810d565efSmrgthe Ada language has been enabled when configuring GCC@.
303910d565efSmrg
304010d565efSmrgYou can also run the Ada testsuite independently, using
304110d565efSmrg@code{make check-ada}, or run a subset of the tests by specifying which
304210d565efSmrgchapter to run, e.g.:
304310d565efSmrg
304410d565efSmrg@smallexample
304510d565efSmrg$ make check-ada CHAPTERS="c3 c9"
304610d565efSmrg@end smallexample
304710d565efSmrg
304810d565efSmrgThe tests are organized by directory, each directory corresponding to
304910d565efSmrga chapter of the Ada Reference Manual.  So for example, @file{c9} corresponds
305010d565efSmrgto chapter 9, which deals with tasking features of the language.
305110d565efSmrg
305210d565efSmrgThe tests are run using two @command{sh} scripts: @file{run_acats} and
305310d565efSmrg@file{run_all.sh}.  To run the tests using a simulator or a cross
305410d565efSmrgtarget, see the small
305510d565efSmrgcustomization section at the top of @file{run_all.sh}.
305610d565efSmrg
305710d565efSmrgThese tests are run using the build tree: they can be run without doing
305810d565efSmrga @code{make install}.
305910d565efSmrg
306010d565efSmrg@node C Tests
306110d565efSmrg@section C Language Testsuites
306210d565efSmrg
306310d565efSmrgGCC contains the following C language testsuites, in the
306410d565efSmrg@file{gcc/testsuite} directory:
306510d565efSmrg
306610d565efSmrg@table @file
306710d565efSmrg@item gcc.dg
306810d565efSmrgThis contains tests of particular features of the C compiler, using the
306910d565efSmrgmore modern @samp{dg} harness.  Correctness tests for various compiler
307010d565efSmrgfeatures should go here if possible.
307110d565efSmrg
307210d565efSmrgMagic comments determine whether the file
307310d565efSmrgis preprocessed, compiled, linked or run.  In these tests, error and warning
307410d565efSmrgmessage texts are compared against expected texts or regular expressions
307510d565efSmrggiven in comments.  These tests are run with the options @samp{-ansi -pedantic}
307610d565efSmrgunless other options are given in the test.  Except as noted below they
307710d565efSmrgare not run with multiple optimization options.
307810d565efSmrg@item gcc.dg/compat
307910d565efSmrgThis subdirectory contains tests for binary compatibility using
308010d565efSmrg@file{lib/compat.exp}, which in turn uses the language-independent support
308110d565efSmrg(@pxref{compat Testing, , Support for testing binary compatibility}).
308210d565efSmrg@item gcc.dg/cpp
308310d565efSmrgThis subdirectory contains tests of the preprocessor.
308410d565efSmrg@item gcc.dg/debug
308510d565efSmrgThis subdirectory contains tests for debug formats.  Tests in this
308610d565efSmrgsubdirectory are run for each debug format that the compiler supports.
308710d565efSmrg@item gcc.dg/format
308810d565efSmrgThis subdirectory contains tests of the @option{-Wformat} format
308910d565efSmrgchecking.  Tests in this directory are run with and without
309010d565efSmrg@option{-DWIDE}.
309110d565efSmrg@item gcc.dg/noncompile
309210d565efSmrgThis subdirectory contains tests of code that should not compile and
309310d565efSmrgdoes not need any special compilation options.  They are run with
309410d565efSmrgmultiple optimization options, since sometimes invalid code crashes
309510d565efSmrgthe compiler with optimization.
309610d565efSmrg@item gcc.dg/special
309710d565efSmrgFIXME: describe this.
309810d565efSmrg
309910d565efSmrg@item gcc.c-torture
310010d565efSmrgThis contains particular code fragments which have historically broken easily.
310110d565efSmrgThese tests are run with multiple optimization options, so tests for features
310210d565efSmrgwhich only break at some optimization levels belong here.  This also contains
310310d565efSmrgtests to check that certain optimizations occur.  It might be worthwhile to
310410d565efSmrgseparate the correctness tests cleanly from the code quality tests, but
310510d565efSmrgit hasn't been done yet.
310610d565efSmrg
310710d565efSmrg@item gcc.c-torture/compat
310810d565efSmrgFIXME: describe this.
310910d565efSmrg
311010d565efSmrgThis directory should probably not be used for new tests.
311110d565efSmrg@item gcc.c-torture/compile
311210d565efSmrgThis testsuite contains test cases that should compile, but do not
311310d565efSmrgneed to link or run.  These test cases are compiled with several
311410d565efSmrgdifferent combinations of optimization options.  All warnings are
311510d565efSmrgdisabled for these test cases, so this directory is not suitable if
311610d565efSmrgyou wish to test for the presence or absence of compiler warnings.
311710d565efSmrgWhile special options can be set, and tests disabled on specific
311810d565efSmrgplatforms, by the use of @file{.x} files, mostly these test cases
311910d565efSmrgshould not contain platform dependencies.  FIXME: discuss how defines
3120c7a68eb7Smrgsuch as @code{STACK_SIZE} are used.
312110d565efSmrg@item gcc.c-torture/execute
312210d565efSmrgThis testsuite contains test cases that should compile, link and run;
312310d565efSmrgotherwise the same comments as for @file{gcc.c-torture/compile} apply.
312410d565efSmrg@item gcc.c-torture/execute/ieee
312510d565efSmrgThis contains tests which are specific to IEEE floating point.
312610d565efSmrg@item gcc.c-torture/unsorted
312710d565efSmrgFIXME: describe this.
312810d565efSmrg
312910d565efSmrgThis directory should probably not be used for new tests.
313010d565efSmrg@item gcc.misc-tests
313110d565efSmrgThis directory contains C tests that require special handling.  Some
313210d565efSmrgof these tests have individual expect files, and others share
313310d565efSmrgspecial-purpose expect files:
313410d565efSmrg
313510d565efSmrg@table @file
313610d565efSmrg@item @code{bprob*.c}
313710d565efSmrgTest @option{-fbranch-probabilities} using
313810d565efSmrg@file{gcc.misc-tests/bprob.exp}, which
313910d565efSmrgin turn uses the generic, language-independent framework
314010d565efSmrg(@pxref{profopt Testing, , Support for testing profile-directed
314110d565efSmrgoptimizations}).
314210d565efSmrg
314310d565efSmrg@item @code{gcov*.c}
314410d565efSmrgTest @command{gcov} output using @file{gcov.exp}, which in turn uses the
314510d565efSmrglanguage-independent support (@pxref{gcov Testing, , Support for testing gcov}).
314610d565efSmrg
314710d565efSmrg@item @code{i386-pf-*.c}
314810d565efSmrgTest i386-specific support for data prefetch using @file{i386-prefetch.exp}.
314910d565efSmrg@end table
315010d565efSmrg
315110d565efSmrg@item gcc.test-framework
315210d565efSmrg@table @file
315310d565efSmrg@item @code{dg-*.c}
315410d565efSmrgTest the testsuite itself using @file{gcc.test-framework/test-framework.exp}.
315510d565efSmrg@end table
315610d565efSmrg
315710d565efSmrg@end table
315810d565efSmrg
315910d565efSmrgFIXME: merge in @file{testsuite/README.gcc} and discuss the format of
316010d565efSmrgtest cases and magic comments more.
316110d565efSmrg
316210d565efSmrg@node LTO Testing
316310d565efSmrg@section Support for testing link-time optimizations
316410d565efSmrg
316510d565efSmrgTests for link-time optimizations usually require multiple source files
316610d565efSmrgthat are compiled separately, perhaps with different sets of options.
316710d565efSmrgThere are several special-purpose test directives used for these tests.
316810d565efSmrg
316910d565efSmrg@table @code
317010d565efSmrg@item @{ dg-lto-do @var{do-what-keyword} @}
317110d565efSmrg@var{do-what-keyword} specifies how the test is compiled and whether
317210d565efSmrgit is executed.  It is one of:
317310d565efSmrg
317410d565efSmrg@table @code
317510d565efSmrg@item assemble
317610d565efSmrgCompile with @option{-c} to produce a relocatable object file.
317710d565efSmrg@item link
317810d565efSmrgCompile, assemble, and link to produce an executable file.
317910d565efSmrg@item run
318010d565efSmrgProduce and run an executable file, which is expected to return
318110d565efSmrgan exit code of 0.
318210d565efSmrg@end table
318310d565efSmrg
318410d565efSmrgThe default is @code{assemble}.  That can be overridden for a set of
318510d565efSmrgtests by redefining @code{dg-do-what-default} within the @code{.exp}
318610d565efSmrgfile for those tests.
318710d565efSmrg
318810d565efSmrgUnlike @code{dg-do}, @code{dg-lto-do} does not support an optional
318910d565efSmrg@samp{target} or @samp{xfail} list.  Use @code{dg-skip-if},
319010d565efSmrg@code{dg-xfail-if}, or @code{dg-xfail-run-if}.
319110d565efSmrg
319210d565efSmrg@item @{ dg-lto-options @{ @{ @var{options} @} [@{ @var{options} @}] @} [@{ target @var{selector} @}]@}
319310d565efSmrgThis directive provides a list of one or more sets of compiler options
319410d565efSmrgto override @var{LTO_OPTIONS}.  Each test will be compiled and run with
319510d565efSmrgeach of these sets of options.
319610d565efSmrg
319710d565efSmrg@item @{ dg-extra-ld-options @var{options} [@{ target @var{selector} @}]@}
319810d565efSmrgThis directive adds @var{options} to the linker options used.
319910d565efSmrg
320010d565efSmrg@item @{ dg-suppress-ld-options @var{options} [@{ target @var{selector} @}]@}
320110d565efSmrgThis directive removes @var{options} from the set of linker options used.
320210d565efSmrg@end table
320310d565efSmrg
320410d565efSmrg@node gcov Testing
320510d565efSmrg@section Support for testing @command{gcov}
320610d565efSmrg
320710d565efSmrgLanguage-independent support for testing @command{gcov}, and for checking
320810d565efSmrgthat branch profiling produces expected values, is provided by the
320910d565efSmrgexpect file @file{lib/gcov.exp}.  @command{gcov} tests also rely on procedures
321010d565efSmrgin @file{lib/gcc-dg.exp} to compile and run the test program.  A typical
321110d565efSmrg@command{gcov} test contains the following DejaGnu commands within comments:
321210d565efSmrg
321310d565efSmrg@smallexample
32140fc04c29Smrg@{ dg-options "--coverage" @}
321510d565efSmrg@{ dg-do run @{ target native @} @}
321610d565efSmrg@{ dg-final @{ run-gcov sourcefile @} @}
321710d565efSmrg@end smallexample
321810d565efSmrg
321910d565efSmrgChecks of @command{gcov} output can include line counts, branch percentages,
322010d565efSmrgand call return percentages.  All of these checks are requested via
322110d565efSmrgcommands that appear in comments in the test's source file.
322210d565efSmrgCommands to check line counts are processed by default.
322310d565efSmrgCommands to check branch percentages and call return percentages are
322410d565efSmrgprocessed if the @command{run-gcov} command has arguments @code{branches}
322510d565efSmrgor @code{calls}, respectively.  For example, the following specifies
322610d565efSmrgchecking both, as well as passing @option{-b} to @command{gcov}:
322710d565efSmrg
322810d565efSmrg@smallexample
322910d565efSmrg@{ dg-final @{ run-gcov branches calls @{ -b sourcefile @} @} @}
323010d565efSmrg@end smallexample
323110d565efSmrg
323210d565efSmrgA line count command appears within a comment on the source line
323310d565efSmrgthat is expected to get the specified count and has the form
323410d565efSmrg@code{count(@var{cnt})}.  A test should only check line counts for
323510d565efSmrglines that will get the same count for any architecture.
323610d565efSmrg
323710d565efSmrgCommands to check branch percentages (@code{branch}) and call
323810d565efSmrgreturn percentages (@code{returns}) are very similar to each other.
323910d565efSmrgA beginning command appears on or before the first of a range of
324010d565efSmrglines that will report the percentage, and the ending command
324110d565efSmrgfollows that range of lines.  The beginning command can include a
324210d565efSmrglist of percentages, all of which are expected to be found within
324310d565efSmrgthe range.  A range is terminated by the next command of the same
324410d565efSmrgkind.  A command @code{branch(end)} or @code{returns(end)} marks
324510d565efSmrgthe end of a range without starting a new one.  For example:
324610d565efSmrg
324710d565efSmrg@smallexample
324810d565efSmrgif (i > 10 && j > i && j < 20)  /* @r{branch(27 50 75)} */
324910d565efSmrg                                /* @r{branch(end)} */
325010d565efSmrg  foo (i, j);
325110d565efSmrg@end smallexample
325210d565efSmrg
325310d565efSmrgFor a call return percentage, the value specified is the
325410d565efSmrgpercentage of calls reported to return.  For a branch percentage,
325510d565efSmrgthe value is either the expected percentage or 100 minus that
325610d565efSmrgvalue, since the direction of a branch can differ depending on the
325710d565efSmrgtarget or the optimization level.
325810d565efSmrg
325910d565efSmrgNot all branches and calls need to be checked.  A test should not
326010d565efSmrgcheck for branches that might be optimized away or replaced with
326110d565efSmrgpredicated instructions.  Don't check for calls inserted by the
326210d565efSmrgcompiler or ones that might be inlined or optimized away.
326310d565efSmrg
326410d565efSmrgA single test can check for combinations of line counts, branch
326510d565efSmrgpercentages, and call return percentages.  The command to check a
326610d565efSmrgline count must appear on the line that will report that count, but
326710d565efSmrgcommands to check branch percentages and call return percentages can
326810d565efSmrgbracket the lines that report them.
326910d565efSmrg
327010d565efSmrg@node profopt Testing
327110d565efSmrg@section Support for testing profile-directed optimizations
327210d565efSmrg
327310d565efSmrgThe file @file{profopt.exp} provides language-independent support for
327410d565efSmrgchecking correct execution of a test built with profile-directed
327510d565efSmrgoptimization.  This testing requires that a test program be built and
327610d565efSmrgexecuted twice.  The first time it is compiled to generate profile
327710d565efSmrgdata, and the second time it is compiled to use the data that was
327810d565efSmrggenerated during the first execution.  The second execution is to
327910d565efSmrgverify that the test produces the expected results.
328010d565efSmrg
328110d565efSmrgTo check that the optimization actually generated better code, a
328210d565efSmrgtest can be built and run a third time with normal optimizations to
328310d565efSmrgverify that the performance is better with the profile-directed
328410d565efSmrgoptimizations.  @file{profopt.exp} has the beginnings of this kind
328510d565efSmrgof support.
328610d565efSmrg
328710d565efSmrg@file{profopt.exp} provides generic support for profile-directed
328810d565efSmrgoptimizations.  Each set of tests that uses it provides information
328910d565efSmrgabout a specific optimization:
329010d565efSmrg
329110d565efSmrg@table @code
329210d565efSmrg@item tool
329310d565efSmrgtool being tested, e.g., @command{gcc}
329410d565efSmrg
329510d565efSmrg@item profile_option
329610d565efSmrgoptions used to generate profile data
329710d565efSmrg
329810d565efSmrg@item feedback_option
329910d565efSmrgoptions used to optimize using that profile data
330010d565efSmrg
330110d565efSmrg@item prof_ext
330210d565efSmrgsuffix of profile data files
330310d565efSmrg
330410d565efSmrg@item PROFOPT_OPTIONS
330510d565efSmrglist of options with which to run each test, similar to the lists for
330610d565efSmrgtorture tests
330710d565efSmrg
330810d565efSmrg@item @{ dg-final-generate @{ @var{local-directive} @} @}
330910d565efSmrgThis directive is similar to @code{dg-final}, but the
331010d565efSmrg@var{local-directive} is run after the generation of profile data.
331110d565efSmrg
331210d565efSmrg@item @{ dg-final-use @{ @var{local-directive} @} @}
331310d565efSmrgThe @var{local-directive} is run after the profile data have been
331410d565efSmrgused.
331510d565efSmrg@end table
331610d565efSmrg
331710d565efSmrg@node compat Testing
331810d565efSmrg@section Support for testing binary compatibility
331910d565efSmrg
332010d565efSmrgThe file @file{compat.exp} provides language-independent support for
332110d565efSmrgbinary compatibility testing.  It supports testing interoperability of
332210d565efSmrgtwo compilers that follow the same ABI, or of multiple sets of
332310d565efSmrgcompiler options that should not affect binary compatibility.  It is
332410d565efSmrgintended to be used for testsuites that complement ABI testsuites.
332510d565efSmrg
332610d565efSmrgA test supported by this framework has three parts, each in a
332710d565efSmrgseparate source file: a main program and two pieces that interact
332810d565efSmrgwith each other to split up the functionality being tested.
332910d565efSmrg
333010d565efSmrg@table @file
333110d565efSmrg@item @var{testname}_main.@var{suffix}
333210d565efSmrgContains the main program, which calls a function in file
333310d565efSmrg@file{@var{testname}_x.@var{suffix}}.
333410d565efSmrg
333510d565efSmrg@item @var{testname}_x.@var{suffix}
333610d565efSmrgContains at least one call to a function in
333710d565efSmrg@file{@var{testname}_y.@var{suffix}}.
333810d565efSmrg
333910d565efSmrg@item @var{testname}_y.@var{suffix}
334010d565efSmrgShares data with, or gets arguments from,
334110d565efSmrg@file{@var{testname}_x.@var{suffix}}.
334210d565efSmrg@end table
334310d565efSmrg
334410d565efSmrgWithin each test, the main program and one functional piece are
334510d565efSmrgcompiled by the GCC under test.  The other piece can be compiled by
334610d565efSmrgan alternate compiler.  If no alternate compiler is specified,
334710d565efSmrgthen all three source files are all compiled by the GCC under test.
334810d565efSmrgYou can specify pairs of sets of compiler options.  The first element
334910d565efSmrgof such a pair specifies options used with the GCC under test, and the
335010d565efSmrgsecond element of the pair specifies options used with the alternate
335110d565efSmrgcompiler.  Each test is compiled with each pair of options.
335210d565efSmrg
335310d565efSmrg@file{compat.exp} defines default pairs of compiler options.
335410d565efSmrgThese can be overridden by defining the environment variable
335510d565efSmrg@env{COMPAT_OPTIONS} as:
335610d565efSmrg
335710d565efSmrg@smallexample
335810d565efSmrgCOMPAT_OPTIONS="[list [list @{@var{tst1}@} @{@var{alt1}@}]
335910d565efSmrg  @dots{}[list @{@var{tstn}@} @{@var{altn}@}]]"
336010d565efSmrg@end smallexample
336110d565efSmrg
336210d565efSmrgwhere @var{tsti} and @var{alti} are lists of options, with @var{tsti}
336310d565efSmrgused by the compiler under test and @var{alti} used by the alternate
336410d565efSmrgcompiler.  For example, with
336510d565efSmrg@code{[list [list @{-g -O0@} @{-O3@}] [list @{-fpic@} @{-fPIC -O2@}]]},
336610d565efSmrgthe test is first built with @option{-g -O0} by the compiler under
336710d565efSmrgtest and with @option{-O3} by the alternate compiler.  The test is
336810d565efSmrgbuilt a second time using @option{-fpic} by the compiler under test
336910d565efSmrgand @option{-fPIC -O2} by the alternate compiler.
337010d565efSmrg
337110d565efSmrgAn alternate compiler is specified by defining an environment
337210d565efSmrgvariable to be the full pathname of an installed compiler; for C
337310d565efSmrgdefine @env{ALT_CC_UNDER_TEST}, and for C++ define
337410d565efSmrg@env{ALT_CXX_UNDER_TEST}.  These will be written to the
337510d565efSmrg@file{site.exp} file used by DejaGnu.  The default is to build each
337610d565efSmrgtest with the compiler under test using the first of each pair of
337710d565efSmrgcompiler options from @env{COMPAT_OPTIONS}.  When
337810d565efSmrg@env{ALT_CC_UNDER_TEST} or
337910d565efSmrg@env{ALT_CXX_UNDER_TEST} is @code{same}, each test is built using
338010d565efSmrgthe compiler under test but with combinations of the options from
338110d565efSmrg@env{COMPAT_OPTIONS}.
338210d565efSmrg
338310d565efSmrgTo run only the C++ compatibility suite using the compiler under test
338410d565efSmrgand another version of GCC using specific compiler options, do the
338510d565efSmrgfollowing from @file{@var{objdir}/gcc}:
338610d565efSmrg
338710d565efSmrg@smallexample
338810d565efSmrgrm site.exp
338910d565efSmrgmake -k \
339010d565efSmrg  ALT_CXX_UNDER_TEST=$@{alt_prefix@}/bin/g++ \
339110d565efSmrg  COMPAT_OPTIONS="@var{lists as shown above}" \
339210d565efSmrg  check-c++ \
339310d565efSmrg  RUNTESTFLAGS="compat.exp"
339410d565efSmrg@end smallexample
339510d565efSmrg
339610d565efSmrgA test that fails when the source files are compiled with different
339710d565efSmrgcompilers, but passes when the files are compiled with the same
339810d565efSmrgcompiler, demonstrates incompatibility of the generated code or
339910d565efSmrgruntime support.  A test that fails for the alternate compiler but
340010d565efSmrgpasses for the compiler under test probably tests for a bug that was
340110d565efSmrgfixed in the compiler under test but is present in the alternate
340210d565efSmrgcompiler.
340310d565efSmrg
340410d565efSmrgThe binary compatibility tests support a small number of test framework
340510d565efSmrgcommands that appear within comments in a test file.
340610d565efSmrg
340710d565efSmrg@table @code
340810d565efSmrg@item dg-require-*
340910d565efSmrgThese commands can be used in @file{@var{testname}_main.@var{suffix}}
341010d565efSmrgto skip the test if specific support is not available on the target.
341110d565efSmrg
341210d565efSmrg@item dg-options
341310d565efSmrgThe specified options are used for compiling this particular source
341410d565efSmrgfile, appended to the options from @env{COMPAT_OPTIONS}.  When this
341510d565efSmrgcommand appears in @file{@var{testname}_main.@var{suffix}} the options
341610d565efSmrgare also used to link the test program.
341710d565efSmrg
341810d565efSmrg@item dg-xfail-if
341910d565efSmrgThis command can be used in a secondary source file to specify that
342010d565efSmrgcompilation is expected to fail for particular options on particular
342110d565efSmrgtargets.
342210d565efSmrg@end table
342310d565efSmrg
342410d565efSmrg@node Torture Tests
342510d565efSmrg@section Support for torture testing using multiple options
342610d565efSmrg
342710d565efSmrgThroughout the compiler testsuite there are several directories whose
342810d565efSmrgtests are run multiple times, each with a different set of options.
342910d565efSmrgThese are known as torture tests.
343010d565efSmrg@file{lib/torture-options.exp} defines procedures to
343110d565efSmrgset up these lists:
343210d565efSmrg
343310d565efSmrg@table @code
343410d565efSmrg@item torture-init
343510d565efSmrgInitialize use of torture lists.
343610d565efSmrg@item set-torture-options
343710d565efSmrgSet lists of torture options to use for tests with and without loops.
343810d565efSmrgOptionally combine a set of torture options with a set of other
343910d565efSmrgoptions, as is done with Objective-C runtime options.
344010d565efSmrg@item torture-finish
344110d565efSmrgFinalize use of torture lists.
344210d565efSmrg@end table
344310d565efSmrg
344410d565efSmrgThe @file{.exp} file for a set of tests that use torture options must
344510d565efSmrginclude calls to these three procedures if:
344610d565efSmrg
344710d565efSmrg@itemize @bullet
344810d565efSmrg@item It calls @code{gcc-dg-runtest} and overrides @var{DG_TORTURE_OPTIONS}.
344910d565efSmrg
345010d565efSmrg@item It calls @var{$@{tool@}}@code{-torture} or
345110d565efSmrg@var{$@{tool@}}@code{-torture-execute}, where @var{tool} is @code{c},
345210d565efSmrg@code{fortran}, or @code{objc}.
345310d565efSmrg
345410d565efSmrg@item It calls @code{dg-pch}.
345510d565efSmrg@end itemize
345610d565efSmrg
345710d565efSmrgIt is not necessary for a @file{.exp} file that calls @code{gcc-dg-runtest}
345810d565efSmrgto call the torture procedures if the tests should use the list in
345910d565efSmrg@var{DG_TORTURE_OPTIONS} defined in @file{gcc-dg.exp}.
346010d565efSmrg
346110d565efSmrgMost uses of torture options can override the default lists by defining
346210d565efSmrg@var{TORTURE_OPTIONS} or add to the default list by defining
346310d565efSmrg@var{ADDITIONAL_TORTURE_OPTIONS}.  Define these in a @file{.dejagnurc}
346410d565efSmrgfile or add them to the @file{site.exp} file; for example
346510d565efSmrg
346610d565efSmrg@smallexample
346710d565efSmrgset ADDITIONAL_TORTURE_OPTIONS  [list \
346810d565efSmrg  @{ -O2 -ftree-loop-linear @} \
346910d565efSmrg  @{ -O2 -fpeel-loops @} ]
347010d565efSmrg@end smallexample
347110d565efSmrg
347210d565efSmrg@node GIMPLE Tests
347310d565efSmrg@section Support for testing GIMPLE passes
347410d565efSmrg
347510d565efSmrgAs of gcc 7, C functions can be tagged with @code{__GIMPLE} to indicate
347610d565efSmrgthat the function body will be GIMPLE, rather than C.  The compiler requires
347710d565efSmrgthe option @option{-fgimple} to enable this functionality.  For example:
347810d565efSmrg
347910d565efSmrg@smallexample
348010d565efSmrg/* @{ dg-do compile @} */
348110d565efSmrg/* @{ dg-options "-O -fgimple" @} */
348210d565efSmrg
348310d565efSmrgvoid __GIMPLE (startwith ("dse2")) foo ()
348410d565efSmrg@{
348510d565efSmrg  int a;
348610d565efSmrg
348710d565efSmrgbb_2:
348810d565efSmrg  if (a > 4)
348910d565efSmrg    goto bb_3;
349010d565efSmrg  else
349110d565efSmrg    goto bb_4;
349210d565efSmrg
349310d565efSmrgbb_3:
349410d565efSmrg  a_2 = 10;
349510d565efSmrg  goto bb_5;
349610d565efSmrg
349710d565efSmrgbb_4:
349810d565efSmrg  a_3 = 20;
349910d565efSmrg
350010d565efSmrgbb_5:
350110d565efSmrg  a_1 = __PHI (bb_3: a_2, bb_4: a_3);
350210d565efSmrg  a_4 = a_1 + 4;
350310d565efSmrg
350410d565efSmrg  return;
350510d565efSmrg@}
350610d565efSmrg@end smallexample
350710d565efSmrg
350810d565efSmrgThe @code{startwith} argument indicates at which pass to begin.
350910d565efSmrg
35100fc04c29SmrgUse the dump modifier @code{-gimple} (e.g.@: @option{-fdump-tree-all-gimple})
351110d565efSmrgto make tree dumps more closely follow the format accepted by the GIMPLE
351210d565efSmrgparser.
351310d565efSmrg
351410d565efSmrgExample DejaGnu tests of GIMPLE can be seen in the source tree at
351510d565efSmrg@file{gcc/testsuite/gcc.dg/gimplefe-*.c}.
351610d565efSmrg
351710d565efSmrgThe @code{__GIMPLE} parser is integrated with the C tokenizer and
351810d565efSmrgpreprocessor, so it should be possible to use macros to build out
351910d565efSmrgtest coverage.
352010d565efSmrg
352110d565efSmrg@node RTL Tests
352210d565efSmrg@section Support for testing RTL passes
352310d565efSmrg
352410d565efSmrgAs of gcc 7, C functions can be tagged with @code{__RTL} to indicate that the
352510d565efSmrgfunction body will be RTL, rather than C.  For example:
352610d565efSmrg
352710d565efSmrg@smallexample
352810d565efSmrgdouble __RTL (startwith ("ira")) test (struct foo *f, const struct bar *b)
352910d565efSmrg@{
353010d565efSmrg  (function "test"
353110d565efSmrg     [...snip; various directives go in here...]
353210d565efSmrg  ) ;; function "test"
353310d565efSmrg@}
353410d565efSmrg@end smallexample
353510d565efSmrg
353610d565efSmrgThe @code{startwith} argument indicates at which pass to begin.
353710d565efSmrg
353810d565efSmrgThe parser expects the RTL body to be in the format emitted by this
353910d565efSmrgdumping function:
354010d565efSmrg
354110d565efSmrg@smallexample
354210d565efSmrgDEBUG_FUNCTION void
354310d565efSmrgprint_rtx_function (FILE *outfile, function *fn, bool compact);
354410d565efSmrg@end smallexample
354510d565efSmrg
354610d565efSmrgwhen "compact" is true.  So you can capture RTL in the correct format
354710d565efSmrgfrom the debugger using:
354810d565efSmrg
354910d565efSmrg@smallexample
355010d565efSmrg(gdb) print_rtx_function (stderr, cfun, true);
355110d565efSmrg@end smallexample
355210d565efSmrg
355310d565efSmrgand copy and paste the output into the body of the C function.
355410d565efSmrg
355510d565efSmrgExample DejaGnu tests of RTL can be seen in the source tree under
355610d565efSmrg@file{gcc/testsuite/gcc.dg/rtl}.
355710d565efSmrg
355810d565efSmrgThe @code{__RTL} parser is not integrated with the C tokenizer or
355910d565efSmrgpreprocessor, and works simply by reading the relevant lines within
356010d565efSmrgthe braces.  In particular, the RTL body must be on separate lines from
356110d565efSmrgthe enclosing braces, and the preprocessor is not usable within it.
3562