xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/doc/sourcebuild.texi (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1*8feb0f0bSmrg@c Copyright (C) 2002-2020 Free Software Foundation, Inc.
21debfc3dSmrg@c This is part of the GCC manual.
31debfc3dSmrg@c For copying conditions, see the file gcc.texi.
41debfc3dSmrg
51debfc3dSmrg@node Source Tree
61debfc3dSmrg@chapter Source Tree Structure and Build System
71debfc3dSmrg
81debfc3dSmrgThis chapter describes the structure of the GCC source tree, and how
91debfc3dSmrgGCC is built.  The user documentation for building and installing GCC
101debfc3dSmrgis in a separate manual (@uref{http://gcc.gnu.org/install/}), with
111debfc3dSmrgwhich it is presumed that you are familiar.
121debfc3dSmrg
131debfc3dSmrg@menu
141debfc3dSmrg* Configure Terms:: Configuration terminology and history.
151debfc3dSmrg* Top Level::       The top level source directory.
161debfc3dSmrg* gcc Directory::   The @file{gcc} subdirectory.
171debfc3dSmrg@end menu
181debfc3dSmrg
191debfc3dSmrg@include configterms.texi
201debfc3dSmrg
211debfc3dSmrg@node Top Level
221debfc3dSmrg@section Top Level Source Directory
231debfc3dSmrg
241debfc3dSmrgThe top level source directory in a GCC distribution contains several
251debfc3dSmrgfiles and directories that are shared with other software
261debfc3dSmrgdistributions such as that of GNU Binutils.  It also contains several
271debfc3dSmrgsubdirectories that contain parts of GCC and its runtime libraries:
281debfc3dSmrg
291debfc3dSmrg@table @file
301debfc3dSmrg@item boehm-gc
311debfc3dSmrgThe Boehm conservative garbage collector, optionally used as part of
321debfc3dSmrgthe ObjC runtime library when configured with @option{--enable-objc-gc}.
331debfc3dSmrg
341debfc3dSmrg@item config
351debfc3dSmrgAutoconf macros and Makefile fragments used throughout the tree.
361debfc3dSmrg
371debfc3dSmrg@item contrib
381debfc3dSmrgContributed scripts that may be found useful in conjunction with GCC@.
391debfc3dSmrgOne of these, @file{contrib/texi2pod.pl}, is used to generate man
401debfc3dSmrgpages from Texinfo manuals as part of the GCC build process.
411debfc3dSmrg
421debfc3dSmrg@item fixincludes
431debfc3dSmrgThe support for fixing system headers to work with GCC@.  See
441debfc3dSmrg@file{fixincludes/README} for more information.  The headers fixed by
451debfc3dSmrgthis mechanism are installed in @file{@var{libsubdir}/include-fixed}.
461debfc3dSmrgAlong with those headers, @file{README-fixinc} is also installed, as
471debfc3dSmrg@file{@var{libsubdir}/include-fixed/README}.
481debfc3dSmrg
491debfc3dSmrg@item gcc
501debfc3dSmrgThe main sources of GCC itself (except for runtime libraries),
511debfc3dSmrgincluding optimizers, support for different target architectures,
521debfc3dSmrglanguage front ends, and testsuites.  @xref{gcc Directory, , The
531debfc3dSmrg@file{gcc} Subdirectory}, for details.
541debfc3dSmrg
551debfc3dSmrg@item gnattools
561debfc3dSmrgSupport tools for GNAT.
571debfc3dSmrg
581debfc3dSmrg@item include
591debfc3dSmrgHeaders for the @code{libiberty} library.
601debfc3dSmrg
611debfc3dSmrg@item intl
621debfc3dSmrgGNU @code{libintl}, from GNU @code{gettext}, for systems which do not
631debfc3dSmrginclude it in @code{libc}.
641debfc3dSmrg
651debfc3dSmrg@item libada
661debfc3dSmrgThe Ada runtime library.
671debfc3dSmrg
681debfc3dSmrg@item libatomic
69c0a68be4SmrgThe runtime support library for atomic operations (e.g.@: for @code{__sync}
701debfc3dSmrgand @code{__atomic}).
711debfc3dSmrg
721debfc3dSmrg@item libcpp
731debfc3dSmrgThe C preprocessor library.
741debfc3dSmrg
751debfc3dSmrg@item libdecnumber
761debfc3dSmrgThe Decimal Float support library.
771debfc3dSmrg
781debfc3dSmrg@item libffi
791debfc3dSmrgThe @code{libffi} library, used as part of the Go runtime library.
801debfc3dSmrg
811debfc3dSmrg@item libgcc
821debfc3dSmrgThe GCC runtime library.
831debfc3dSmrg
841debfc3dSmrg@item libgfortran
851debfc3dSmrgThe Fortran runtime library.
861debfc3dSmrg
871debfc3dSmrg@item libgo
881debfc3dSmrgThe Go runtime library.  The bulk of this library is mirrored from the
891debfc3dSmrg@uref{https://github.com/@/golang/go, master Go repository}.
901debfc3dSmrg
911debfc3dSmrg@item libgomp
921debfc3dSmrgThe GNU Offloading and Multi Processing Runtime Library.
931debfc3dSmrg
941debfc3dSmrg@item libiberty
951debfc3dSmrgThe @code{libiberty} library, used for portability and for some
961debfc3dSmrggenerally useful data structures and algorithms.  @xref{Top, ,
971debfc3dSmrgIntroduction, libiberty, @sc{gnu} libiberty}, for more information
981debfc3dSmrgabout this library.
991debfc3dSmrg
1001debfc3dSmrg@item libitm
1011debfc3dSmrgThe runtime support library for transactional memory.
1021debfc3dSmrg
1031debfc3dSmrg@item libobjc
1041debfc3dSmrgThe Objective-C and Objective-C++ runtime library.
1051debfc3dSmrg
1061debfc3dSmrg@item libquadmath
1071debfc3dSmrgThe runtime support library for quad-precision math operations.
1081debfc3dSmrg
109c0a68be4Smrg@item libphobos
110c0a68be4SmrgThe D standard and runtime library.  The bulk of this library is mirrored
111c0a68be4Smrgfrom the @uref{https://github.com/@/dlang, master D repositories}.
112c0a68be4Smrg
1131debfc3dSmrg@item libssp
1141debfc3dSmrgThe Stack protector runtime library.
1151debfc3dSmrg
1161debfc3dSmrg@item libstdc++-v3
1171debfc3dSmrgThe C++ runtime library.
1181debfc3dSmrg
1191debfc3dSmrg@item lto-plugin
1201debfc3dSmrgPlugin used by the linker if link-time optimizations are enabled.
1211debfc3dSmrg
1221debfc3dSmrg@item maintainer-scripts
1231debfc3dSmrgScripts used by the @code{gccadmin} account on @code{gcc.gnu.org}.
1241debfc3dSmrg
1251debfc3dSmrg@item zlib
1261debfc3dSmrgThe @code{zlib} compression library, used for compressing and
1271debfc3dSmrguncompressing GCC's intermediate language in LTO object files.
1281debfc3dSmrg@end table
1291debfc3dSmrg
1301debfc3dSmrgThe build system in the top level directory, including how recursion
1311debfc3dSmrginto subdirectories works and how building runtime libraries for
1321debfc3dSmrgmultilibs is handled, is documented in a separate manual, included
1331debfc3dSmrgwith GNU Binutils.  @xref{Top, , GNU configure and build system,
1341debfc3dSmrgconfigure, The GNU configure and build system}, for details.
1351debfc3dSmrg
1361debfc3dSmrg@node gcc Directory
1371debfc3dSmrg@section The @file{gcc} Subdirectory
1381debfc3dSmrg
1391debfc3dSmrgThe @file{gcc} directory contains many files that are part of the C
1401debfc3dSmrgsources of GCC, other files used as part of the configuration and
1411debfc3dSmrgbuild process, and subdirectories including documentation and a
1421debfc3dSmrgtestsuite.  The files that are sources of GCC are documented in a
1431debfc3dSmrgseparate chapter.  @xref{Passes, , Passes and Files of the Compiler}.
1441debfc3dSmrg
1451debfc3dSmrg@menu
1461debfc3dSmrg* Subdirectories:: Subdirectories of @file{gcc}.
1471debfc3dSmrg* Configuration::  The configuration process, and the files it uses.
1481debfc3dSmrg* Build::          The build system in the @file{gcc} directory.
1491debfc3dSmrg* Makefile::       Targets in @file{gcc/Makefile}.
1501debfc3dSmrg* Library Files::  Library source files and headers under @file{gcc/}.
1511debfc3dSmrg* Headers::        Headers installed by GCC.
1521debfc3dSmrg* Documentation::  Building documentation in GCC.
1531debfc3dSmrg* Front End::      Anatomy of a language front end.
1541debfc3dSmrg* Back End::       Anatomy of a target back end.
1551debfc3dSmrg@end menu
1561debfc3dSmrg
1571debfc3dSmrg@node Subdirectories
1581debfc3dSmrg@subsection Subdirectories of @file{gcc}
1591debfc3dSmrg
1601debfc3dSmrgThe @file{gcc} directory contains the following subdirectories:
1611debfc3dSmrg
1621debfc3dSmrg@table @file
1631debfc3dSmrg@item @var{language}
1641debfc3dSmrgSubdirectories for various languages.  Directories containing a file
1651debfc3dSmrg@file{config-lang.in} are language subdirectories.  The contents of
1661debfc3dSmrgthe subdirectories @file{c} (for C), @file{cp} (for C++),
1671debfc3dSmrg@file{objc} (for Objective-C), @file{objcp} (for Objective-C++),
1681debfc3dSmrgand @file{lto} (for LTO) are documented in this
1691debfc3dSmrgmanual (@pxref{Passes, , Passes and Files of the Compiler});
1701debfc3dSmrgthose for other languages are not.  @xref{Front End, ,
1711debfc3dSmrgAnatomy of a Language Front End}, for details of the files in these
1721debfc3dSmrgdirectories.
1731debfc3dSmrg
1741debfc3dSmrg@item common
1751debfc3dSmrgSource files shared between the compiler drivers (such as
1761debfc3dSmrg@command{gcc}) and the compilers proper (such as @file{cc1}).  If an
1771debfc3dSmrgarchitecture defines target hooks shared between those places, it also
1781debfc3dSmrghas a subdirectory in @file{common/config}.  @xref{Target Structure}.
1791debfc3dSmrg
1801debfc3dSmrg@item config
1811debfc3dSmrgConfiguration files for supported architectures and operating
1821debfc3dSmrgsystems.  @xref{Back End, , Anatomy of a Target Back End}, for
1831debfc3dSmrgdetails of the files in this directory.
1841debfc3dSmrg
1851debfc3dSmrg@item doc
1861debfc3dSmrgTexinfo documentation for GCC, together with automatically generated
1871debfc3dSmrgman pages and support for converting the installation manual to
1881debfc3dSmrgHTML@.  @xref{Documentation}.
1891debfc3dSmrg
1901debfc3dSmrg@item ginclude
1911debfc3dSmrgSystem headers installed by GCC, mainly those required by the C
1921debfc3dSmrgstandard of freestanding implementations.  @xref{Headers, , Headers
1931debfc3dSmrgInstalled by GCC}, for details of when these and other headers are
1941debfc3dSmrginstalled.
1951debfc3dSmrg
1961debfc3dSmrg@item po
1971debfc3dSmrgMessage catalogs with translations of messages produced by GCC into
1981debfc3dSmrgvarious languages, @file{@var{language}.po}.  This directory also
1991debfc3dSmrgcontains @file{gcc.pot}, the template for these message catalogues,
2001debfc3dSmrg@file{exgettext}, a wrapper around @command{gettext} to extract the
2011debfc3dSmrgmessages from the GCC sources and create @file{gcc.pot}, which is run
2021debfc3dSmrgby @samp{make gcc.pot}, and @file{EXCLUDES}, a list of files from
2031debfc3dSmrgwhich messages should not be extracted.
2041debfc3dSmrg
2051debfc3dSmrg@item testsuite
2061debfc3dSmrgThe GCC testsuites (except for those for runtime libraries).
2071debfc3dSmrg@xref{Testsuites}.
2081debfc3dSmrg@end table
2091debfc3dSmrg
2101debfc3dSmrg@node Configuration
2111debfc3dSmrg@subsection Configuration in the @file{gcc} Directory
2121debfc3dSmrg
2131debfc3dSmrgThe @file{gcc} directory is configured with an Autoconf-generated
2141debfc3dSmrgscript @file{configure}.  The @file{configure} script is generated
2151debfc3dSmrgfrom @file{configure.ac} and @file{aclocal.m4}.  From the files
2161debfc3dSmrg@file{configure.ac} and @file{acconfig.h}, Autoheader generates the
2171debfc3dSmrgfile @file{config.in}.  The file @file{cstamp-h.in} is used as a
2181debfc3dSmrgtimestamp.
2191debfc3dSmrg
2201debfc3dSmrg@menu
2211debfc3dSmrg* Config Fragments::     Scripts used by @file{configure}.
2221debfc3dSmrg* System Config::        The @file{config.build}, @file{config.host}, and
2231debfc3dSmrg                         @file{config.gcc} files.
2241debfc3dSmrg* Configuration Files::  Files created by running @file{configure}.
2251debfc3dSmrg@end menu
2261debfc3dSmrg
2271debfc3dSmrg@node Config Fragments
2281debfc3dSmrg@subsubsection Scripts Used by @file{configure}
2291debfc3dSmrg
2301debfc3dSmrg@file{configure} uses some other scripts to help in its work:
2311debfc3dSmrg
2321debfc3dSmrg@itemize @bullet
2331debfc3dSmrg@item The standard GNU @file{config.sub} and @file{config.guess}
2341debfc3dSmrgfiles, kept in the top level directory, are used.
2351debfc3dSmrg
2361debfc3dSmrg@item The file @file{config.gcc} is used to handle configuration
2371debfc3dSmrgspecific to the particular target machine.  The file
2381debfc3dSmrg@file{config.build} is used to handle configuration specific to the
2391debfc3dSmrgparticular build machine.  The file @file{config.host} is used to handle
2401debfc3dSmrgconfiguration specific to the particular host machine.  (In general,
2411debfc3dSmrgthese should only be used for features that cannot reasonably be tested in
2421debfc3dSmrgAutoconf feature tests.)
2431debfc3dSmrg@xref{System Config, , The @file{config.build}; @file{config.host};
2441debfc3dSmrgand @file{config.gcc} Files}, for details of the contents of these files.
2451debfc3dSmrg
2461debfc3dSmrg@item Each language subdirectory has a file
2471debfc3dSmrg@file{@var{language}/config-lang.in} that is used for
2481debfc3dSmrgfront-end-specific configuration.  @xref{Front End Config, , The Front
2491debfc3dSmrgEnd @file{config-lang.in} File}, for details of this file.
2501debfc3dSmrg
2511debfc3dSmrg@item A helper script @file{configure.frag} is used as part of
2521debfc3dSmrgcreating the output of @file{configure}.
2531debfc3dSmrg@end itemize
2541debfc3dSmrg
2551debfc3dSmrg@node System Config
2561debfc3dSmrg@subsubsection The @file{config.build}; @file{config.host}; and @file{config.gcc} Files
2571debfc3dSmrg
2581debfc3dSmrgThe @file{config.build} file contains specific rules for particular systems
2591debfc3dSmrgwhich GCC is built on.  This should be used as rarely as possible, as the
2601debfc3dSmrgbehavior of the build system can always be detected by autoconf.
2611debfc3dSmrg
2621debfc3dSmrgThe @file{config.host} file contains specific rules for particular systems
2631debfc3dSmrgwhich GCC will run on.  This is rarely needed.
2641debfc3dSmrg
2651debfc3dSmrgThe @file{config.gcc} file contains specific rules for particular systems
2661debfc3dSmrgwhich GCC will generate code for.  This is usually needed.
2671debfc3dSmrg
2681debfc3dSmrgEach file has a list of the shell variables it sets, with descriptions, at the
2691debfc3dSmrgtop of the file.
2701debfc3dSmrg
2711debfc3dSmrgFIXME: document the contents of these files, and what variables should
2721debfc3dSmrgbe set to control build, host and target configuration.
2731debfc3dSmrg
2741debfc3dSmrg@include configfiles.texi
2751debfc3dSmrg
2761debfc3dSmrg@node Build
2771debfc3dSmrg@subsection Build System in the @file{gcc} Directory
2781debfc3dSmrg
2791debfc3dSmrgFIXME: describe the build system, including what is built in what
2801debfc3dSmrgstages.  Also list the various source files that are used in the build
2811debfc3dSmrgprocess but aren't source files of GCC itself and so aren't documented
2821debfc3dSmrgbelow (@pxref{Passes}).
2831debfc3dSmrg
2841debfc3dSmrg@include makefile.texi
2851debfc3dSmrg
2861debfc3dSmrg@node Library Files
2871debfc3dSmrg@subsection Library Source Files and Headers under the @file{gcc} Directory
2881debfc3dSmrg
2891debfc3dSmrgFIXME: list here, with explanation, all the C source files and headers
2901debfc3dSmrgunder the @file{gcc} directory that aren't built into the GCC
2911debfc3dSmrgexecutable but rather are part of runtime libraries and object files,
2921debfc3dSmrgsuch as @file{crtstuff.c} and @file{unwind-dw2.c}.  @xref{Headers, ,
2931debfc3dSmrgHeaders Installed by GCC}, for more information about the
2941debfc3dSmrg@file{ginclude} directory.
2951debfc3dSmrg
2961debfc3dSmrg@node Headers
2971debfc3dSmrg@subsection Headers Installed by GCC
2981debfc3dSmrg
2991debfc3dSmrgIn general, GCC expects the system C library to provide most of the
3001debfc3dSmrgheaders to be used with it.  However, GCC will fix those headers if
3011debfc3dSmrgnecessary to make them work with GCC, and will install some headers
3021debfc3dSmrgrequired of freestanding implementations.  These headers are installed
3031debfc3dSmrgin @file{@var{libsubdir}/include}.  Headers for non-C runtime
3041debfc3dSmrglibraries are also installed by GCC; these are not documented here.
3051debfc3dSmrg(FIXME: document them somewhere.)
3061debfc3dSmrg
3071debfc3dSmrgSeveral of the headers GCC installs are in the @file{ginclude}
3081debfc3dSmrgdirectory.  These headers, @file{iso646.h},
3091debfc3dSmrg@file{stdarg.h}, @file{stdbool.h}, and @file{stddef.h},
3101debfc3dSmrgare installed in @file{@var{libsubdir}/include},
3111debfc3dSmrgunless the target Makefile fragment (@pxref{Target Fragment})
3121debfc3dSmrgoverrides this by setting @code{USER_H}.
3131debfc3dSmrg
3141debfc3dSmrgIn addition to these headers and those generated by fixing system
3151debfc3dSmrgheaders to work with GCC, some other headers may also be installed in
3161debfc3dSmrg@file{@var{libsubdir}/include}.  @file{config.gcc} may set
3171debfc3dSmrg@code{extra_headers}; this specifies additional headers under
3181debfc3dSmrg@file{config} to be installed on some systems.
3191debfc3dSmrg
3201debfc3dSmrgGCC installs its own version of @code{<float.h>}, from @file{ginclude/float.h}.
3211debfc3dSmrgThis is done to cope with command-line options that change the
3221debfc3dSmrgrepresentation of floating point numbers.
3231debfc3dSmrg
3241debfc3dSmrgGCC also installs its own version of @code{<limits.h>}; this is generated
3251debfc3dSmrgfrom @file{glimits.h}, together with @file{limitx.h} and
3261debfc3dSmrg@file{limity.h} if the system also has its own version of
3271debfc3dSmrg@code{<limits.h>}.  (GCC provides its own header because it is
3281debfc3dSmrgrequired of ISO C freestanding implementations, but needs to include
3291debfc3dSmrgthe system header from its own header as well because other standards
3301debfc3dSmrgsuch as POSIX specify additional values to be defined in
3311debfc3dSmrg@code{<limits.h>}.)  The system's @code{<limits.h>} header is used via
3321debfc3dSmrg@file{@var{libsubdir}/include/syslimits.h}, which is copied from
3331debfc3dSmrg@file{gsyslimits.h} if it does not need fixing to work with GCC; if it
3341debfc3dSmrgneeds fixing, @file{syslimits.h} is the fixed copy.
3351debfc3dSmrg
3361debfc3dSmrgGCC can also install @code{<tgmath.h>}.  It will do this when
3371debfc3dSmrg@file{config.gcc} sets @code{use_gcc_tgmath} to @code{yes}.
3381debfc3dSmrg
3391debfc3dSmrg@node Documentation
3401debfc3dSmrg@subsection Building Documentation
3411debfc3dSmrg
3421debfc3dSmrgThe main GCC documentation is in the form of manuals in Texinfo
3431debfc3dSmrgformat.  These are installed in Info format; DVI versions may be
3441debfc3dSmrggenerated by @samp{make dvi}, PDF versions by @samp{make pdf}, and
3451debfc3dSmrgHTML versions by @samp{make html}.  In addition, some man pages are
3461debfc3dSmrggenerated from the Texinfo manuals, there are some other text files
3471debfc3dSmrgwith miscellaneous documentation, and runtime libraries have their own
3481debfc3dSmrgdocumentation outside the @file{gcc} directory.  FIXME: document the
3491debfc3dSmrgdocumentation for runtime libraries somewhere.
3501debfc3dSmrg
3511debfc3dSmrg@menu
3521debfc3dSmrg* Texinfo Manuals::      GCC manuals in Texinfo format.
3531debfc3dSmrg* Man Page Generation::  Generating man pages from Texinfo manuals.
3541debfc3dSmrg* Miscellaneous Docs::   Miscellaneous text files with documentation.
3551debfc3dSmrg@end menu
3561debfc3dSmrg
3571debfc3dSmrg@node Texinfo Manuals
3581debfc3dSmrg@subsubsection Texinfo Manuals
3591debfc3dSmrg
3601debfc3dSmrgThe manuals for GCC as a whole, and the C and C++ front ends, are in
3611debfc3dSmrgfiles @file{doc/*.texi}.  Other front ends have their own manuals in
3621debfc3dSmrgfiles @file{@var{language}/*.texi}.  Common files
3631debfc3dSmrg@file{doc/include/*.texi} are provided which may be included in
3641debfc3dSmrgmultiple manuals; the following files are in @file{doc/include}:
3651debfc3dSmrg
3661debfc3dSmrg@table @file
3671debfc3dSmrg@item fdl.texi
3681debfc3dSmrgThe GNU Free Documentation License.
3691debfc3dSmrg@item funding.texi
3701debfc3dSmrgThe section ``Funding Free Software''.
3711debfc3dSmrg@item gcc-common.texi
3721debfc3dSmrgCommon definitions for manuals.
3731debfc3dSmrg@item gpl_v3.texi
3741debfc3dSmrgThe GNU General Public License.
3751debfc3dSmrg@item texinfo.tex
3761debfc3dSmrgA copy of @file{texinfo.tex} known to work with the GCC manuals.
3771debfc3dSmrg@end table
3781debfc3dSmrg
3791debfc3dSmrgDVI-formatted manuals are generated by @samp{make dvi}, which uses
3801debfc3dSmrg@command{texi2dvi} (via the Makefile macro @code{$(TEXI2DVI)}).
3811debfc3dSmrgPDF-formatted manuals are generated by @samp{make pdf}, which uses
3821debfc3dSmrg@command{texi2pdf} (via the Makefile macro @code{$(TEXI2PDF)}).  HTML
3831debfc3dSmrgformatted manuals are generated by @samp{make html}.  Info
3841debfc3dSmrgmanuals are generated by @samp{make info} (which is run as part of
3851debfc3dSmrga bootstrap); this generates the manuals in the source directory,
3861debfc3dSmrgusing @command{makeinfo} via the Makefile macro @code{$(MAKEINFO)},
3871debfc3dSmrgand they are included in release distributions.
3881debfc3dSmrg
3891debfc3dSmrgManuals are also provided on the GCC web site, in both HTML and
3901debfc3dSmrgPostScript forms.  This is done via the script
391*8feb0f0bSmrg@file{maintainer-scripts/update_web_docs_git}.  Each manual to be
3921debfc3dSmrgprovided online must be listed in the definition of @code{MANUALS} in
3931debfc3dSmrgthat file; a file @file{@var{name}.texi} must only appear once in the
3941debfc3dSmrgsource tree, and the output manual must have the same name as the
3951debfc3dSmrgsource file.  (However, other Texinfo files, included in manuals but
3961debfc3dSmrgnot themselves the root files of manuals, may have names that appear
3971debfc3dSmrgmore than once in the source tree.)  The manual file
3981debfc3dSmrg@file{@var{name}.texi} should only include other files in its own
3991debfc3dSmrgdirectory or in @file{doc/include}.  HTML manuals will be generated by
4001debfc3dSmrg@samp{makeinfo --html}, PostScript manuals by @command{texi2dvi}
4011debfc3dSmrgand @command{dvips}, and PDF manuals by @command{texi2pdf}.
4021debfc3dSmrgAll Texinfo files that are parts of manuals must
4031debfc3dSmrgbe version-controlled, even if they are generated files, for the
4041debfc3dSmrggeneration of online manuals to work.
4051debfc3dSmrg
4061debfc3dSmrgThe installation manual, @file{doc/install.texi}, is also provided on
4071debfc3dSmrgthe GCC web site.  The HTML version is generated by the script
4081debfc3dSmrg@file{doc/install.texi2html}.
4091debfc3dSmrg
4101debfc3dSmrg@node Man Page Generation
4111debfc3dSmrg@subsubsection Man Page Generation
4121debfc3dSmrg
4131debfc3dSmrgBecause of user demand, in addition to full Texinfo manuals, man pages
4141debfc3dSmrgare provided which contain extracts from those manuals.  These man
4151debfc3dSmrgpages are generated from the Texinfo manuals using
4161debfc3dSmrg@file{contrib/texi2pod.pl} and @command{pod2man}.  (The man page for
4171debfc3dSmrg@command{g++}, @file{cp/g++.1}, just contains a @samp{.so} reference
4181debfc3dSmrgto @file{gcc.1}, but all the other man pages are generated from
4191debfc3dSmrgTexinfo manuals.)
4201debfc3dSmrg
4211debfc3dSmrgBecause many systems may not have the necessary tools installed to
4221debfc3dSmrggenerate the man pages, they are only generated if the
4231debfc3dSmrg@file{configure} script detects that recent enough tools are
4241debfc3dSmrginstalled, and the Makefiles allow generating man pages to fail
4251debfc3dSmrgwithout aborting the build.  Man pages are also included in release
4261debfc3dSmrgdistributions.  They are generated in the source directory.
4271debfc3dSmrg
4281debfc3dSmrgMagic comments in Texinfo files starting @samp{@@c man} control what
4291debfc3dSmrgparts of a Texinfo file go into a man page.  Only a subset of Texinfo
4301debfc3dSmrgis supported by @file{texi2pod.pl}, and it may be necessary to add
4311debfc3dSmrgsupport for more Texinfo features to this script when generating new
4321debfc3dSmrgman pages.  To improve the man page output, some special Texinfo
4331debfc3dSmrgmacros are provided in @file{doc/include/gcc-common.texi} which
4341debfc3dSmrg@file{texi2pod.pl} understands:
4351debfc3dSmrg
4361debfc3dSmrg@table @code
4371debfc3dSmrg@item @@gcctabopt
4381debfc3dSmrgUse in the form @samp{@@table @@gcctabopt} for tables of options,
4391debfc3dSmrgwhere for printed output the effect of @samp{@@code} is better than
4401debfc3dSmrgthat of @samp{@@option} but for man page output a different effect is
4411debfc3dSmrgwanted.
4421debfc3dSmrg@item @@gccoptlist
4431debfc3dSmrgUse for summary lists of options in manuals.
4441debfc3dSmrg@item @@gol
4451debfc3dSmrgUse at the end of each line inside @samp{@@gccoptlist}.  This is
4461debfc3dSmrgnecessary to avoid problems with differences in how the
4471debfc3dSmrg@samp{@@gccoptlist} macro is handled by different Texinfo formatters.
4481debfc3dSmrg@end table
4491debfc3dSmrg
4501debfc3dSmrgFIXME: describe the @file{texi2pod.pl} input language and magic
4511debfc3dSmrgcomments in more detail.
4521debfc3dSmrg
4531debfc3dSmrg@node Miscellaneous Docs
4541debfc3dSmrg@subsubsection Miscellaneous Documentation
4551debfc3dSmrg
4561debfc3dSmrgIn addition to the formal documentation that is installed by GCC,
4571debfc3dSmrgthere are several other text files in the @file{gcc} subdirectory
4581debfc3dSmrgwith miscellaneous documentation:
4591debfc3dSmrg
4601debfc3dSmrg@table @file
4611debfc3dSmrg@item ABOUT-GCC-NLS
4621debfc3dSmrgNotes on GCC's Native Language Support.  FIXME: this should be part of
4631debfc3dSmrgthis manual rather than a separate file.
4641debfc3dSmrg@item ABOUT-NLS
4651debfc3dSmrgNotes on the Free Translation Project.
4661debfc3dSmrg@item COPYING
4671debfc3dSmrg@itemx COPYING3
4681debfc3dSmrgThe GNU General Public License, Versions 2 and 3.
4691debfc3dSmrg@item COPYING.LIB
4701debfc3dSmrg@itemx COPYING3.LIB
4711debfc3dSmrgThe GNU Lesser General Public License, Versions 2.1 and 3.
4721debfc3dSmrg@item *ChangeLog*
4731debfc3dSmrg@itemx */ChangeLog*
4741debfc3dSmrgChange log files for various parts of GCC@.
4751debfc3dSmrg@item LANGUAGES
4761debfc3dSmrgDetails of a few changes to the GCC front-end interface.  FIXME: the
4771debfc3dSmrginformation in this file should be part of general documentation of
4781debfc3dSmrgthe front-end interface in this manual.
4791debfc3dSmrg@item ONEWS
4801debfc3dSmrgInformation about new features in old versions of GCC@.  (For recent
4811debfc3dSmrgversions, the information is on the GCC web site.)
4821debfc3dSmrg@item README.Portability
4831debfc3dSmrgInformation about portability issues when writing code in GCC@.  FIXME:
4841debfc3dSmrgwhy isn't this part of this manual or of the GCC Coding Conventions?
4851debfc3dSmrg@end table
4861debfc3dSmrg
4871debfc3dSmrgFIXME: document such files in subdirectories, at least @file{config},
4881debfc3dSmrg@file{c}, @file{cp}, @file{objc}, @file{testsuite}.
4891debfc3dSmrg
4901debfc3dSmrg@node Front End
4911debfc3dSmrg@subsection Anatomy of a Language Front End
4921debfc3dSmrg
4931debfc3dSmrgA front end for a language in GCC has the following parts:
4941debfc3dSmrg
4951debfc3dSmrg@itemize @bullet
4961debfc3dSmrg@item
4971debfc3dSmrgA directory @file{@var{language}} under @file{gcc} containing source
4981debfc3dSmrgfiles for that front end.  @xref{Front End Directory, , The Front End
4991debfc3dSmrg@file{@var{language}} Directory}, for details.
5001debfc3dSmrg@item
5011debfc3dSmrgA mention of the language in the list of supported languages in
5021debfc3dSmrg@file{gcc/doc/install.texi}.
5031debfc3dSmrg@item
5041debfc3dSmrgA mention of the name under which the language's runtime library is
5051debfc3dSmrgrecognized by @option{--enable-shared=@var{package}} in the
5061debfc3dSmrgdocumentation of that option in @file{gcc/doc/install.texi}.
5071debfc3dSmrg@item
5081debfc3dSmrgA mention of any special prerequisites for building the front end in
5091debfc3dSmrgthe documentation of prerequisites in @file{gcc/doc/install.texi}.
5101debfc3dSmrg@item
5111debfc3dSmrgDetails of contributors to that front end in
5121debfc3dSmrg@file{gcc/doc/contrib.texi}.  If the details are in that front end's
5131debfc3dSmrgown manual then there should be a link to that manual's list in
5141debfc3dSmrg@file{contrib.texi}.
5151debfc3dSmrg@item
5161debfc3dSmrgInformation about support for that language in
5171debfc3dSmrg@file{gcc/doc/frontends.texi}.
5181debfc3dSmrg@item
5191debfc3dSmrgInformation about standards for that language, and the front end's
5201debfc3dSmrgsupport for them, in @file{gcc/doc/standards.texi}.  This may be a
5211debfc3dSmrglink to such information in the front end's own manual.
5221debfc3dSmrg@item
5231debfc3dSmrgDetails of source file suffixes for that language and @option{-x
5241debfc3dSmrg@var{lang}} options supported, in @file{gcc/doc/invoke.texi}.
5251debfc3dSmrg@item
5261debfc3dSmrgEntries in @code{default_compilers} in @file{gcc.c} for source file
5271debfc3dSmrgsuffixes for that language.
5281debfc3dSmrg@item
5291debfc3dSmrgPreferably testsuites, which may be under @file{gcc/testsuite} or
5301debfc3dSmrgruntime library directories.  FIXME: document somewhere how to write
5311debfc3dSmrgtestsuite harnesses.
5321debfc3dSmrg@item
5331debfc3dSmrgProbably a runtime library for the language, outside the @file{gcc}
5341debfc3dSmrgdirectory.  FIXME: document this further.
5351debfc3dSmrg@item
5361debfc3dSmrgDetails of the directories of any runtime libraries in
5371debfc3dSmrg@file{gcc/doc/sourcebuild.texi}.
5381debfc3dSmrg@item
5391debfc3dSmrgCheck targets in @file{Makefile.def} for the top-level @file{Makefile}
5401debfc3dSmrgto check just the compiler or the compiler and runtime library for the
5411debfc3dSmrglanguage.
5421debfc3dSmrg@end itemize
5431debfc3dSmrg
5441debfc3dSmrgIf the front end is added to the official GCC source repository, the
5451debfc3dSmrgfollowing are also necessary:
5461debfc3dSmrg
5471debfc3dSmrg@itemize @bullet
5481debfc3dSmrg@item
5491debfc3dSmrgAt least one Bugzilla component for bugs in that front end and runtime
5501debfc3dSmrglibraries.  This category needs to be added to the Bugzilla database.
5511debfc3dSmrg@item
5521debfc3dSmrgNormally, one or more maintainers of that front end listed in
5531debfc3dSmrg@file{MAINTAINERS}.
5541debfc3dSmrg@item
5551debfc3dSmrgMentions on the GCC web site in @file{index.html} and
5561debfc3dSmrg@file{frontends.html}, with any relevant links on
5571debfc3dSmrg@file{readings.html}.  (Front ends that are not an official part of
5581debfc3dSmrgGCC may also be listed on @file{frontends.html}, with relevant links.)
5591debfc3dSmrg@item
5601debfc3dSmrgA news item on @file{index.html}, and possibly an announcement on the
5611debfc3dSmrg@email{gcc-announce@@gcc.gnu.org} mailing list.
5621debfc3dSmrg@item
5631debfc3dSmrgThe front end's manuals should be mentioned in
564*8feb0f0bSmrg@file{maintainer-scripts/update_web_docs_git} (@pxref{Texinfo Manuals})
5651debfc3dSmrgand the online manuals should be linked to from
5661debfc3dSmrg@file{onlinedocs/index.html}.
5671debfc3dSmrg@item
5681debfc3dSmrgAny old releases or CVS repositories of the front end, before its
569*8feb0f0bSmrginclusion in GCC, should be made available on the GCC web site at
570*8feb0f0bSmrg@uref{https://gcc.gnu.org/pub/gcc/old-releases/}.
5711debfc3dSmrg@item
5721debfc3dSmrgThe release and snapshot script @file{maintainer-scripts/gcc_release}
5731debfc3dSmrgshould be updated to generate appropriate tarballs for this front end.
5741debfc3dSmrg@item
5751debfc3dSmrgIf this front end includes its own version files that include the
5761debfc3dSmrgcurrent date, @file{maintainer-scripts/update_version} should be
5771debfc3dSmrgupdated accordingly.
5781debfc3dSmrg@end itemize
5791debfc3dSmrg
5801debfc3dSmrg@menu
5811debfc3dSmrg* Front End Directory::  The front end @file{@var{language}} directory.
5821debfc3dSmrg* Front End Config::     The front end @file{config-lang.in} file.
5831debfc3dSmrg* Front End Makefile::   The front end @file{Make-lang.in} file.
5841debfc3dSmrg@end menu
5851debfc3dSmrg
5861debfc3dSmrg@node Front End Directory
5871debfc3dSmrg@subsubsection The Front End @file{@var{language}} Directory
5881debfc3dSmrg
5891debfc3dSmrgA front end @file{@var{language}} directory contains the source files
5901debfc3dSmrgof that front end (but not of any runtime libraries, which should be
5911debfc3dSmrgoutside the @file{gcc} directory).  This includes documentation, and
5921debfc3dSmrgpossibly some subsidiary programs built alongside the front end.
5931debfc3dSmrgCertain files are special and other parts of the compiler depend on
5941debfc3dSmrgtheir names:
5951debfc3dSmrg
5961debfc3dSmrg@table @file
5971debfc3dSmrg@item config-lang.in
5981debfc3dSmrgThis file is required in all language subdirectories.  @xref{Front End
5991debfc3dSmrgConfig, , The Front End @file{config-lang.in} File}, for details of
6001debfc3dSmrgits contents
6011debfc3dSmrg@item Make-lang.in
6021debfc3dSmrgThis file is required in all language subdirectories.  @xref{Front End
6031debfc3dSmrgMakefile, , The Front End @file{Make-lang.in} File}, for details of its
6041debfc3dSmrgcontents.
6051debfc3dSmrg@item lang.opt
6061debfc3dSmrgThis file registers the set of switches that the front end accepts on
6071debfc3dSmrgthe command line, and their @option{--help} text.  @xref{Options}.
6081debfc3dSmrg@item lang-specs.h
6091debfc3dSmrgThis file provides entries for @code{default_compilers} in
6101debfc3dSmrg@file{gcc.c} which override the default of giving an error that a
6111debfc3dSmrgcompiler for that language is not installed.
6121debfc3dSmrg@item @var{language}-tree.def
6131debfc3dSmrgThis file, which need not exist, defines any language-specific tree
6141debfc3dSmrgcodes.
6151debfc3dSmrg@end table
6161debfc3dSmrg
6171debfc3dSmrg@node Front End Config
6181debfc3dSmrg@subsubsection The Front End @file{config-lang.in} File
6191debfc3dSmrg
6201debfc3dSmrgEach language subdirectory contains a @file{config-lang.in} file.
6211debfc3dSmrgThis file is a shell script that may define some variables describing
6221debfc3dSmrgthe language:
6231debfc3dSmrg
6241debfc3dSmrg@table @code
6251debfc3dSmrg@item language
6261debfc3dSmrgThis definition must be present, and gives the name of the language
6271debfc3dSmrgfor some purposes such as arguments to @option{--enable-languages}.
6281debfc3dSmrg@item lang_requires
6291debfc3dSmrgIf defined, this variable lists (space-separated) language front ends
6301debfc3dSmrgother than C that this front end requires to be enabled (with the
6311debfc3dSmrgnames given being their @code{language} settings).  For example, the
6321debfc3dSmrgObj-C++ front end depends on the C++ and ObjC front ends, so sets
6331debfc3dSmrg@samp{lang_requires="objc c++"}.
6341debfc3dSmrg@item subdir_requires
6351debfc3dSmrgIf defined, this variable lists (space-separated) front end directories
6361debfc3dSmrgother than C that this front end requires to be present.  For example,
6371debfc3dSmrgthe Objective-C++ front end uses source files from the C++ and
6381debfc3dSmrgObjective-C front ends, so sets @samp{subdir_requires="cp objc"}.
6391debfc3dSmrg@item target_libs
6401debfc3dSmrgIf defined, this variable lists (space-separated) targets in the top
6411debfc3dSmrglevel @file{Makefile} to build the runtime libraries for this
6421debfc3dSmrglanguage, such as @code{target-libobjc}.
6431debfc3dSmrg@item lang_dirs
6441debfc3dSmrgIf defined, this variable lists (space-separated) top level
6451debfc3dSmrgdirectories (parallel to @file{gcc}), apart from the runtime libraries,
6461debfc3dSmrgthat should not be configured if this front end is not built.
6471debfc3dSmrg@item build_by_default
6481debfc3dSmrgIf defined to @samp{no}, this language front end is not built unless
6491debfc3dSmrgenabled in a @option{--enable-languages} argument.  Otherwise, front
6501debfc3dSmrgends are built by default, subject to any special logic in
6511debfc3dSmrg@file{configure.ac} (as is present to disable the Ada front end if the
6521debfc3dSmrgAda compiler is not already installed).
6531debfc3dSmrg@item boot_language
6541debfc3dSmrgIf defined to @samp{yes}, this front end is built in stage1 of the
6551debfc3dSmrgbootstrap.  This is only relevant to front ends written in their own
6561debfc3dSmrglanguages.
6571debfc3dSmrg@item compilers
6581debfc3dSmrgIf defined, a space-separated list of compiler executables that will
6591debfc3dSmrgbe run by the driver.  The names here will each end
6601debfc3dSmrgwith @samp{\$(exeext)}.
6611debfc3dSmrg@item outputs
6621debfc3dSmrgIf defined, a space-separated list of files that should be generated
6631debfc3dSmrgby @file{configure} substituting values in them.  This mechanism can
6641debfc3dSmrgbe used to create a file @file{@var{language}/Makefile} from
6651debfc3dSmrg@file{@var{language}/Makefile.in}, but this is deprecated, building
6661debfc3dSmrgeverything from the single @file{gcc/Makefile} is preferred.
6671debfc3dSmrg@item gtfiles
6681debfc3dSmrgIf defined, a space-separated list of files that should be scanned by
6691debfc3dSmrg@file{gengtype.c} to generate the garbage collection tables and routines for
6701debfc3dSmrgthis language.  This excludes the files that are common to all front
6711debfc3dSmrgends.  @xref{Type Information}.
6721debfc3dSmrg
6731debfc3dSmrg@end table
6741debfc3dSmrg
6751debfc3dSmrg@node Front End Makefile
6761debfc3dSmrg@subsubsection The Front End @file{Make-lang.in} File
6771debfc3dSmrg
6781debfc3dSmrgEach language subdirectory contains a @file{Make-lang.in} file.  It contains
6791debfc3dSmrgtargets @code{@var{lang}.@var{hook}} (where @code{@var{lang}} is the
6801debfc3dSmrgsetting of @code{language} in @file{config-lang.in}) for the following
6811debfc3dSmrgvalues of @code{@var{hook}}, and any other Makefile rules required to
6821debfc3dSmrgbuild those targets (which may if necessary use other Makefiles
6831debfc3dSmrgspecified in @code{outputs} in @file{config-lang.in}, although this is
6841debfc3dSmrgdeprecated).  It also adds any testsuite targets that can use the
6851debfc3dSmrgstandard rule in @file{gcc/Makefile.in} to the variable
6861debfc3dSmrg@code{lang_checks}.
6871debfc3dSmrg
6881debfc3dSmrg@table @code
6891debfc3dSmrg@item all.cross
6901debfc3dSmrg@itemx start.encap
6911debfc3dSmrg@itemx rest.encap
6921debfc3dSmrgFIXME: exactly what goes in each of these targets?
6931debfc3dSmrg@item tags
6941debfc3dSmrgBuild an @command{etags} @file{TAGS} file in the language subdirectory
6951debfc3dSmrgin the source tree.
6961debfc3dSmrg@item info
6971debfc3dSmrgBuild info documentation for the front end, in the build directory.
6981debfc3dSmrgThis target is only called by @samp{make bootstrap} if a suitable
6991debfc3dSmrgversion of @command{makeinfo} is available, so does not need to check
7001debfc3dSmrgfor this, and should fail if an error occurs.
7011debfc3dSmrg@item dvi
7021debfc3dSmrgBuild DVI documentation for the front end, in the build directory.
7031debfc3dSmrgThis should be done using @code{$(TEXI2DVI)}, with appropriate
7041debfc3dSmrg@option{-I} arguments pointing to directories of included files.
7051debfc3dSmrg@item pdf
7061debfc3dSmrgBuild PDF documentation for the front end, in the build directory.
7071debfc3dSmrgThis should be done using @code{$(TEXI2PDF)}, with appropriate
7081debfc3dSmrg@option{-I} arguments pointing to directories of included files.
7091debfc3dSmrg@item html
7101debfc3dSmrgBuild HTML documentation for the front end, in the build directory.
7111debfc3dSmrg@item man
7121debfc3dSmrgBuild generated man pages for the front end from Texinfo manuals
7131debfc3dSmrg(@pxref{Man Page Generation}), in the build directory.  This target
7141debfc3dSmrgis only called if the necessary tools are available, but should ignore
7151debfc3dSmrgerrors so as not to stop the build if errors occur; man pages are
7161debfc3dSmrgoptional and the tools involved may be installed in a broken way.
7171debfc3dSmrg@item install-common
7181debfc3dSmrgInstall everything that is part of the front end, apart from the
7191debfc3dSmrgcompiler executables listed in @code{compilers} in
7201debfc3dSmrg@file{config-lang.in}.
7211debfc3dSmrg@item install-info
7221debfc3dSmrgInstall info documentation for the front end, if it is present in the
7231debfc3dSmrgsource directory.  This target should have dependencies on info files
7241debfc3dSmrgthat should be installed.
7251debfc3dSmrg@item install-man
7261debfc3dSmrgInstall man pages for the front end.  This target should ignore
7271debfc3dSmrgerrors.
7281debfc3dSmrg@item install-plugin
7291debfc3dSmrgInstall headers needed for plugins.
7301debfc3dSmrg@item srcextra
7311debfc3dSmrgCopies its dependencies into the source directory.  This generally should
7321debfc3dSmrgbe used for generated files such as Bison output files which are not
7331debfc3dSmrgversion-controlled, but should be included in any release tarballs.  This
7341debfc3dSmrgtarget will be executed during a bootstrap if
7351debfc3dSmrg@samp{--enable-generated-files-in-srcdir} was specified as a
7361debfc3dSmrg@file{configure} option.
7371debfc3dSmrg@item srcinfo
7381debfc3dSmrg@itemx srcman
7391debfc3dSmrgCopies its dependencies into the source directory.  These targets will be
7401debfc3dSmrgexecuted during a bootstrap if @samp{--enable-generated-files-in-srcdir}
7411debfc3dSmrgwas specified as a @file{configure} option.
7421debfc3dSmrg@item uninstall
7431debfc3dSmrgUninstall files installed by installing the compiler.  This is
7441debfc3dSmrgcurrently documented not to be supported, so the hook need not do
7451debfc3dSmrganything.
7461debfc3dSmrg@item mostlyclean
7471debfc3dSmrg@itemx clean
7481debfc3dSmrg@itemx distclean
7491debfc3dSmrg@itemx maintainer-clean
7501debfc3dSmrgThe language parts of the standard GNU
7511debfc3dSmrg@samp{*clean} targets.  @xref{Standard Targets, , Standard Targets for
7521debfc3dSmrgUsers, standards, GNU Coding Standards}, for details of the standard
7531debfc3dSmrgtargets.  For GCC, @code{maintainer-clean} should delete
7541debfc3dSmrgall generated files in the source directory that are not version-controlled,
7551debfc3dSmrgbut should not delete anything that is.
7561debfc3dSmrg@end table
7571debfc3dSmrg
7581debfc3dSmrg@file{Make-lang.in} must also define a variable @code{@var{lang}_OBJS}
7591debfc3dSmrgto a list of host object files that are used by that language.
7601debfc3dSmrg
7611debfc3dSmrg@node Back End
7621debfc3dSmrg@subsection Anatomy of a Target Back End
7631debfc3dSmrg
7641debfc3dSmrgA back end for a target architecture in GCC has the following parts:
7651debfc3dSmrg
7661debfc3dSmrg@itemize @bullet
7671debfc3dSmrg@item
7681debfc3dSmrgA directory @file{@var{machine}} under @file{gcc/config}, containing a
7691debfc3dSmrgmachine description @file{@var{machine}.md} file (@pxref{Machine Desc,
7701debfc3dSmrg, Machine Descriptions}), header files @file{@var{machine}.h} and
7711debfc3dSmrg@file{@var{machine}-protos.h} and a source file @file{@var{machine}.c}
7721debfc3dSmrg(@pxref{Target Macros, , Target Description Macros and Functions}),
7731debfc3dSmrgpossibly a target Makefile fragment @file{t-@var{machine}}
7741debfc3dSmrg(@pxref{Target Fragment, , The Target Makefile Fragment}), and maybe
7751debfc3dSmrgsome other files.  The names of these files may be changed from the
7761debfc3dSmrgdefaults given by explicit specifications in @file{config.gcc}.
7771debfc3dSmrg@item
7781debfc3dSmrgIf necessary, a file @file{@var{machine}-modes.def} in the
7791debfc3dSmrg@file{@var{machine}} directory, containing additional machine modes to
7801debfc3dSmrgrepresent condition codes.  @xref{Condition Code}, for further details.
7811debfc3dSmrg@item
7821debfc3dSmrgAn optional @file{@var{machine}.opt} file in the @file{@var{machine}}
7831debfc3dSmrgdirectory, containing a list of target-specific options.  You can also
7841debfc3dSmrgadd other option files using the @code{extra_options} variable in
7851debfc3dSmrg@file{config.gcc}.  @xref{Options}.
7861debfc3dSmrg@item
7871debfc3dSmrgEntries in @file{config.gcc} (@pxref{System Config, , The
7881debfc3dSmrg@file{config.gcc} File}) for the systems with this target
7891debfc3dSmrgarchitecture.
7901debfc3dSmrg@item
7911debfc3dSmrgDocumentation in @file{gcc/doc/invoke.texi} for any command-line
7921debfc3dSmrgoptions supported by this target (@pxref{Run-time Target, , Run-time
7931debfc3dSmrgTarget Specification}).  This means both entries in the summary table
7941debfc3dSmrgof options and details of the individual options.
7951debfc3dSmrg@item
7961debfc3dSmrgDocumentation in @file{gcc/doc/extend.texi} for any target-specific
7971debfc3dSmrgattributes supported (@pxref{Target Attributes, , Defining
7981debfc3dSmrgtarget-specific uses of @code{__attribute__}}), including where the
7991debfc3dSmrgsame attribute is already supported on some targets, which are
8001debfc3dSmrgenumerated in the manual.
8011debfc3dSmrg@item
8021debfc3dSmrgDocumentation in @file{gcc/doc/extend.texi} for any target-specific
8031debfc3dSmrgpragmas supported.
8041debfc3dSmrg@item
8051debfc3dSmrgDocumentation in @file{gcc/doc/extend.texi} of any target-specific
8061debfc3dSmrgbuilt-in functions supported.
8071debfc3dSmrg@item
8081debfc3dSmrgDocumentation in @file{gcc/doc/extend.texi} of any target-specific
8091debfc3dSmrgformat checking styles supported.
8101debfc3dSmrg@item
8111debfc3dSmrgDocumentation in @file{gcc/doc/md.texi} of any target-specific
8121debfc3dSmrgconstraint letters (@pxref{Machine Constraints, , Constraints for
8131debfc3dSmrgParticular Machines}).
8141debfc3dSmrg@item
8151debfc3dSmrgA note in @file{gcc/doc/contrib.texi} under the person or people who
8161debfc3dSmrgcontributed the target support.
8171debfc3dSmrg@item
8181debfc3dSmrgEntries in @file{gcc/doc/install.texi} for all target triplets
8191debfc3dSmrgsupported with this target architecture, giving details of any special
8201debfc3dSmrgnotes about installation for this target, or saying that there are no
8211debfc3dSmrgspecial notes if there are none.
8221debfc3dSmrg@item
8231debfc3dSmrgPossibly other support outside the @file{gcc} directory for runtime
8241debfc3dSmrglibraries.  FIXME: reference docs for this.  The @code{libstdc++} porting
8251debfc3dSmrgmanual needs to be installed as info for this to work, or to be a
8261debfc3dSmrgchapter of this manual.
8271debfc3dSmrg@end itemize
8281debfc3dSmrg
829a2dc1f3fSmrgThe @file{@var{machine}.h} header is included very early in GCC's
830a2dc1f3fSmrgstandard sequence of header files, while @file{@var{machine}-protos.h}
831a2dc1f3fSmrgis included late in the sequence.  Thus @file{@var{machine}-protos.h}
832a2dc1f3fSmrgcan include declarations referencing types that are not defined when
833a2dc1f3fSmrg@file{@var{machine}.h} is included, specifically including those from
834a2dc1f3fSmrg@file{rtl.h} and @file{tree.h}.  Since both RTL and tree types may not
835a2dc1f3fSmrgbe available in every context where @file{@var{machine}-protos.h} is
836a2dc1f3fSmrgincluded, in this file you should guard declarations using these types
837a2dc1f3fSmrginside appropriate @code{#ifdef RTX_CODE} or @code{#ifdef TREE_CODE}
838a2dc1f3fSmrgconditional code segments.
839a2dc1f3fSmrg
840a2dc1f3fSmrgIf the backend uses shared data structures that require @code{GTY} markers
841a2dc1f3fSmrgfor garbage collection (@pxref{Type Information}), you must declare those
842a2dc1f3fSmrgin @file{@var{machine}.h} rather than @file{@var{machine}-protos.h}.
843a2dc1f3fSmrgAny definitions required for building libgcc must also go in
844a2dc1f3fSmrg@file{@var{machine}.h}.
845a2dc1f3fSmrg
846a2dc1f3fSmrgGCC uses the macro @code{IN_TARGET_CODE} to distinguish between
847a2dc1f3fSmrgmachine-specific @file{.c} and @file{.cc} files and
848a2dc1f3fSmrgmachine-independent @file{.c} and @file{.cc} files.  Machine-specific
849a2dc1f3fSmrgfiles should use the directive:
850a2dc1f3fSmrg
851a2dc1f3fSmrg@example
852a2dc1f3fSmrg#define IN_TARGET_CODE 1
853a2dc1f3fSmrg@end example
854a2dc1f3fSmrg
855a2dc1f3fSmrgbefore including @code{config.h}.
856a2dc1f3fSmrg
8571debfc3dSmrgIf the back end is added to the official GCC source repository, the
8581debfc3dSmrgfollowing are also necessary:
8591debfc3dSmrg
8601debfc3dSmrg@itemize @bullet
8611debfc3dSmrg@item
8621debfc3dSmrgAn entry for the target architecture in @file{readings.html} on the
8631debfc3dSmrgGCC web site, with any relevant links.
8641debfc3dSmrg@item
8651debfc3dSmrgDetails of the properties of the back end and target architecture in
8661debfc3dSmrg@file{backends.html} on the GCC web site.
8671debfc3dSmrg@item
8681debfc3dSmrgA news item about the contribution of support for that target
8691debfc3dSmrgarchitecture, in @file{index.html} on the GCC web site.
8701debfc3dSmrg@item
8711debfc3dSmrgNormally, one or more maintainers of that target listed in
8721debfc3dSmrg@file{MAINTAINERS}.  Some existing architectures may be unmaintained,
8731debfc3dSmrgbut it would be unusual to add support for a target that does not have
8741debfc3dSmrga maintainer when support is added.
8751debfc3dSmrg@item
8761debfc3dSmrgTarget triplets covering all @file{config.gcc} stanzas for the target,
8771debfc3dSmrgin the list in @file{contrib/config-list.mk}.
8781debfc3dSmrg@end itemize
8791debfc3dSmrg
8801debfc3dSmrg@node Testsuites
8811debfc3dSmrg@chapter Testsuites
8821debfc3dSmrg
8831debfc3dSmrgGCC contains several testsuites to help maintain compiler quality.
8841debfc3dSmrgMost of the runtime libraries and language front ends in GCC have
8851debfc3dSmrgtestsuites.  Currently only the C language testsuites are documented
8861debfc3dSmrghere; FIXME: document the others.
8871debfc3dSmrg
8881debfc3dSmrg@menu
8891debfc3dSmrg* Test Idioms::     Idioms used in testsuite code.
8901debfc3dSmrg* Test Directives:: Directives used within DejaGnu tests.
8911debfc3dSmrg* Ada Tests::       The Ada language testsuites.
8921debfc3dSmrg* C Tests::         The C language testsuites.
8931debfc3dSmrg* LTO Testing::     Support for testing link-time optimizations.
8941debfc3dSmrg* gcov Testing::    Support for testing gcov.
8951debfc3dSmrg* profopt Testing:: Support for testing profile-directed optimizations.
8961debfc3dSmrg* compat Testing::  Support for testing binary compatibility.
8971debfc3dSmrg* Torture Tests::   Support for torture testing using multiple options.
8981debfc3dSmrg* GIMPLE Tests::    Support for testing GIMPLE passes.
8991debfc3dSmrg* RTL Tests::       Support for testing RTL passes.
9001debfc3dSmrg@end menu
9011debfc3dSmrg
9021debfc3dSmrg@node Test Idioms
9031debfc3dSmrg@section Idioms Used in Testsuite Code
9041debfc3dSmrg
9051debfc3dSmrgIn general, C testcases have a trailing @file{-@var{n}.c}, starting
9061debfc3dSmrgwith @file{-1.c}, in case other testcases with similar names are added
9071debfc3dSmrglater.  If the test is a test of some well-defined feature, it should
9081debfc3dSmrghave a name referring to that feature such as
9091debfc3dSmrg@file{@var{feature}-1.c}.  If it does not test a well-defined feature
9101debfc3dSmrgbut just happens to exercise a bug somewhere in the compiler, and a
9111debfc3dSmrgbug report has been filed for this bug in the GCC bug database,
9121debfc3dSmrg@file{pr@var{bug-number}-1.c} is the appropriate form of name.
9131debfc3dSmrgOtherwise (for miscellaneous bugs not filed in the GCC bug database),
9141debfc3dSmrgand previously more generally, test cases are named after the date on
9151debfc3dSmrgwhich they were added.  This allows people to tell at a glance whether
9161debfc3dSmrga test failure is because of a recently found bug that has not yet
9171debfc3dSmrgbeen fixed, or whether it may be a regression, but does not give any
9181debfc3dSmrgother information about the bug or where discussion of it may be
9191debfc3dSmrgfound.  Some other language testsuites follow similar conventions.
9201debfc3dSmrg
9211debfc3dSmrgIn the @file{gcc.dg} testsuite, it is often necessary to test that an
9221debfc3dSmrgerror is indeed a hard error and not just a warning---for example,
9231debfc3dSmrgwhere it is a constraint violation in the C standard, which must
9241debfc3dSmrgbecome an error with @option{-pedantic-errors}.  The following idiom,
9251debfc3dSmrgwhere the first line shown is line @var{line} of the file and the line
9261debfc3dSmrgthat generates the error, is used for this:
9271debfc3dSmrg
9281debfc3dSmrg@smallexample
9291debfc3dSmrg/* @{ dg-bogus "warning" "warning in place of error" @} */
9301debfc3dSmrg/* @{ dg-error "@var{regexp}" "@var{message}" @{ target *-*-* @} @var{line} @} */
9311debfc3dSmrg@end smallexample
9321debfc3dSmrg
9331debfc3dSmrgIt may be necessary to check that an expression is an integer constant
9341debfc3dSmrgexpression and has a certain value.  To check that @code{@var{E}} has
9351debfc3dSmrgvalue @code{@var{V}}, an idiom similar to the following is used:
9361debfc3dSmrg
9371debfc3dSmrg@smallexample
9381debfc3dSmrgchar x[((E) == (V) ? 1 : -1)];
9391debfc3dSmrg@end smallexample
9401debfc3dSmrg
9411debfc3dSmrgIn @file{gcc.dg} tests, @code{__typeof__} is sometimes used to make
9421debfc3dSmrgassertions about the types of expressions.  See, for example,
9431debfc3dSmrg@file{gcc.dg/c99-condexpr-1.c}.  The more subtle uses depend on the
9441debfc3dSmrgexact rules for the types of conditional expressions in the C
9451debfc3dSmrgstandard; see, for example, @file{gcc.dg/c99-intconst-1.c}.
9461debfc3dSmrg
9471debfc3dSmrgIt is useful to be able to test that optimizations are being made
9481debfc3dSmrgproperly.  This cannot be done in all cases, but it can be done where
9491debfc3dSmrgthe optimization will lead to code being optimized away (for example,
9501debfc3dSmrgwhere flow analysis or alias analysis should show that certain code
9511debfc3dSmrgcannot be called) or to functions not being called because they have
9521debfc3dSmrgbeen expanded as built-in functions.  Such tests go in
9531debfc3dSmrg@file{gcc.c-torture/execute}.  Where code should be optimized away, a
9541debfc3dSmrgcall to a nonexistent function such as @code{link_failure ()} may be
9551debfc3dSmrginserted; a definition
9561debfc3dSmrg
9571debfc3dSmrg@smallexample
9581debfc3dSmrg#ifndef __OPTIMIZE__
9591debfc3dSmrgvoid
9601debfc3dSmrglink_failure (void)
9611debfc3dSmrg@{
9621debfc3dSmrg  abort ();
9631debfc3dSmrg@}
9641debfc3dSmrg#endif
9651debfc3dSmrg@end smallexample
9661debfc3dSmrg
9671debfc3dSmrg@noindent
9681debfc3dSmrgwill also be needed so that linking still succeeds when the test is
9691debfc3dSmrgrun without optimization.  When all calls to a built-in function
9701debfc3dSmrgshould have been optimized and no calls to the non-built-in version of
9711debfc3dSmrgthe function should remain, that function may be defined as
9721debfc3dSmrg@code{static} to call @code{abort ()} (although redeclaring a function
9731debfc3dSmrgas static may not work on all targets).
9741debfc3dSmrg
9751debfc3dSmrgAll testcases must be portable.  Target-specific testcases must have
9761debfc3dSmrgappropriate code to avoid causing failures on unsupported systems;
9771debfc3dSmrgunfortunately, the mechanisms for this differ by directory.
9781debfc3dSmrg
9791debfc3dSmrgFIXME: discuss non-C testsuites here.
9801debfc3dSmrg
9811debfc3dSmrg@node Test Directives
9821debfc3dSmrg@section Directives used within DejaGnu tests
9831debfc3dSmrg
9841debfc3dSmrg@menu
9851debfc3dSmrg* Directives::  Syntax and descriptions of test directives.
9861debfc3dSmrg* Selectors:: Selecting targets to which a test applies.
9871debfc3dSmrg* Effective-Target Keywords:: Keywords describing target attributes.
9881debfc3dSmrg* Add Options:: Features for @code{dg-add-options}
9891debfc3dSmrg* Require Support:: Variants of @code{dg-require-@var{support}}
9901debfc3dSmrg* Final Actions:: Commands for use in @code{dg-final}
9911debfc3dSmrg@end menu
9921debfc3dSmrg
9931debfc3dSmrg@node Directives
9941debfc3dSmrg@subsection Syntax and Descriptions of test directives
9951debfc3dSmrg
9961debfc3dSmrgTest directives appear within comments in a test source file and begin
9971debfc3dSmrgwith @code{dg-}.  Some of these are defined within DejaGnu and others
9981debfc3dSmrgare local to the GCC testsuite.
9991debfc3dSmrg
10001debfc3dSmrgThe order in which test directives appear in a test can be important:
10011debfc3dSmrgdirectives local to GCC sometimes override information used by the
10021debfc3dSmrgDejaGnu directives, which know nothing about the GCC directives, so the
10031debfc3dSmrgDejaGnu directives must precede GCC directives.
10041debfc3dSmrg
10051debfc3dSmrgSeveral test directives include selectors (@pxref{Selectors, , })
10061debfc3dSmrgwhich are usually preceded by the keyword @code{target} or @code{xfail}.
10071debfc3dSmrg
10081debfc3dSmrg@subsubsection Specify how to build the test
10091debfc3dSmrg
10101debfc3dSmrg@table @code
10111debfc3dSmrg@item @{ dg-do @var{do-what-keyword} [@{ target/xfail @var{selector} @}] @}
10121debfc3dSmrg@var{do-what-keyword} specifies how the test is compiled and whether
10131debfc3dSmrgit is executed.  It is one of:
10141debfc3dSmrg
10151debfc3dSmrg@table @code
10161debfc3dSmrg@item preprocess
10171debfc3dSmrgCompile with @option{-E} to run only the preprocessor.
10181debfc3dSmrg@item compile
10191debfc3dSmrgCompile with @option{-S} to produce an assembly code file.
10201debfc3dSmrg@item assemble
10211debfc3dSmrgCompile with @option{-c} to produce a relocatable object file.
10221debfc3dSmrg@item link
10231debfc3dSmrgCompile, assemble, and link to produce an executable file.
10241debfc3dSmrg@item run
10251debfc3dSmrgProduce and run an executable file, which is expected to return
10261debfc3dSmrgan exit code of 0.
10271debfc3dSmrg@end table
10281debfc3dSmrg
10291debfc3dSmrgThe default is @code{compile}.  That can be overridden for a set of
10301debfc3dSmrgtests by redefining @code{dg-do-what-default} within the @code{.exp}
10311debfc3dSmrgfile for those tests.
10321debfc3dSmrg
10331debfc3dSmrgIf the directive includes the optional @samp{@{ target @var{selector} @}}
10341debfc3dSmrgthen the test is skipped unless the target system matches the
10351debfc3dSmrg@var{selector}.
10361debfc3dSmrg
10371debfc3dSmrgIf @var{do-what-keyword} is @code{run} and the directive includes
10381debfc3dSmrgthe optional @samp{@{ xfail @var{selector} @}} and the selector is met
10391debfc3dSmrgthen the test is expected to fail.  The @code{xfail} clause is ignored
10401debfc3dSmrgfor other values of @var{do-what-keyword}; those tests can use
10411debfc3dSmrgdirective @code{dg-xfail-if}.
10421debfc3dSmrg@end table
10431debfc3dSmrg
10441debfc3dSmrg@subsubsection Specify additional compiler options
10451debfc3dSmrg
10461debfc3dSmrg@table @code
10471debfc3dSmrg@item @{ dg-options @var{options} [@{ target @var{selector} @}] @}
10481debfc3dSmrgThis DejaGnu directive provides a list of compiler options, to be used
10491debfc3dSmrgif the target system matches @var{selector}, that replace the default
10501debfc3dSmrgoptions used for this set of tests.
10511debfc3dSmrg
10521debfc3dSmrg@item @{ dg-add-options @var{feature} @dots{} @}
10531debfc3dSmrgAdd any compiler options that are needed to access certain features.
10541debfc3dSmrgThis directive does nothing on targets that enable the features by
10551debfc3dSmrgdefault, or that don't provide them at all.  It must come after
10561debfc3dSmrgall @code{dg-options} directives.
10571debfc3dSmrgFor supported values of @var{feature} see @ref{Add Options, ,}.
10581debfc3dSmrg
10591debfc3dSmrg@item @{ dg-additional-options @var{options} [@{ target @var{selector} @}] @}
10601debfc3dSmrgThis directive provides a list of compiler options, to be used
10611debfc3dSmrgif the target system matches @var{selector}, that are added to the default
10621debfc3dSmrgoptions used for this set of tests.
10631debfc3dSmrg@end table
10641debfc3dSmrg
10651debfc3dSmrg@subsubsection Modify the test timeout value
10661debfc3dSmrg
10671debfc3dSmrgThe normal timeout limit, in seconds, is found by searching the
10681debfc3dSmrgfollowing in order:
10691debfc3dSmrg
10701debfc3dSmrg@itemize @bullet
10711debfc3dSmrg@item the value defined by an earlier @code{dg-timeout} directive in
10721debfc3dSmrgthe test
10731debfc3dSmrg
10741debfc3dSmrg@item variable @var{tool_timeout} defined by the set of tests
10751debfc3dSmrg
10761debfc3dSmrg@item @var{gcc},@var{timeout} set in the target board
10771debfc3dSmrg
10781debfc3dSmrg@item 300
10791debfc3dSmrg@end itemize
10801debfc3dSmrg
10811debfc3dSmrg@table @code
10821debfc3dSmrg@item @{ dg-timeout @var{n} [@{target @var{selector} @}] @}
10831debfc3dSmrgSet the time limit for the compilation and for the execution of the test
10841debfc3dSmrgto the specified number of seconds.
10851debfc3dSmrg
10861debfc3dSmrg@item @{ dg-timeout-factor @var{x} [@{ target @var{selector} @}] @}
10871debfc3dSmrgMultiply the normal time limit for compilation and execution of the test
10881debfc3dSmrgby the specified floating-point factor.
10891debfc3dSmrg@end table
10901debfc3dSmrg
10911debfc3dSmrg@subsubsection Skip a test for some targets
10921debfc3dSmrg
10931debfc3dSmrg@table @code
10941debfc3dSmrg@item @{ dg-skip-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
10951debfc3dSmrgArguments @var{include-opts} and @var{exclude-opts} are lists in which
10961debfc3dSmrgeach element is a string of zero or more GCC options.
10971debfc3dSmrgSkip the test if all of the following conditions are met:
10981debfc3dSmrg@itemize @bullet
10991debfc3dSmrg@item the test system is included in @var{selector}
11001debfc3dSmrg
11011debfc3dSmrg@item for at least one of the option strings in @var{include-opts},
11021debfc3dSmrgevery option from that string is in the set of options with which
11031debfc3dSmrgthe test would be compiled; use @samp{"*"} for an @var{include-opts} list
11041debfc3dSmrgthat matches any options; that is the default if @var{include-opts} is
11051debfc3dSmrgnot specified
11061debfc3dSmrg
11071debfc3dSmrg@item for each of the option strings in @var{exclude-opts}, at least one
11081debfc3dSmrgoption from that string is not in the set of options with which the test
11091debfc3dSmrgwould be compiled; use @samp{""} for an empty @var{exclude-opts} list;
11101debfc3dSmrgthat is the default if @var{exclude-opts} is not specified
11111debfc3dSmrg@end itemize
11121debfc3dSmrg
11131debfc3dSmrgFor example, to skip a test if option @code{-Os} is present:
11141debfc3dSmrg
11151debfc3dSmrg@smallexample
11161debfc3dSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-Os" @} @{ "" @} @} */
11171debfc3dSmrg@end smallexample
11181debfc3dSmrg
11191debfc3dSmrgTo skip a test if both options @code{-O2} and @code{-g} are present:
11201debfc3dSmrg
11211debfc3dSmrg@smallexample
11221debfc3dSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2 -g" @} @{ "" @} @} */
11231debfc3dSmrg@end smallexample
11241debfc3dSmrg
11251debfc3dSmrgTo skip a test if either @code{-O2} or @code{-O3} is present:
11261debfc3dSmrg
11271debfc3dSmrg@smallexample
11281debfc3dSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2" "-O3" @} @{ "" @} @} */
11291debfc3dSmrg@end smallexample
11301debfc3dSmrg
11311debfc3dSmrgTo skip a test unless option @code{-Os} is present:
11321debfc3dSmrg
11331debfc3dSmrg@smallexample
11341debfc3dSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "*" @} @{ "-Os" @} @} */
11351debfc3dSmrg@end smallexample
11361debfc3dSmrg
11371debfc3dSmrgTo skip a test if either @code{-O2} or @code{-O3} is used with @code{-g}
11381debfc3dSmrgbut not if @code{-fpic} is also present:
11391debfc3dSmrg
11401debfc3dSmrg@smallexample
11411debfc3dSmrg/* @{ dg-skip-if "" @{ *-*-* @}  @{ "-O2 -g" "-O3 -g" @} @{ "-fpic" @} @} */
11421debfc3dSmrg@end smallexample
11431debfc3dSmrg
11441debfc3dSmrg@item @{ dg-require-effective-target @var{keyword} [@{ @var{selector} @}] @}
11451debfc3dSmrgSkip the test if the test target, including current multilib flags,
11461debfc3dSmrgis not covered by the effective-target keyword.
11471debfc3dSmrgIf the directive includes the optional @samp{@{ @var{selector} @}}
11481debfc3dSmrgthen the effective-target test is only performed if the target system
11491debfc3dSmrgmatches the @var{selector}.
11501debfc3dSmrgThis directive must appear after any @code{dg-do} directive in the test
11511debfc3dSmrgand before any @code{dg-additional-sources} directive.
11521debfc3dSmrg@xref{Effective-Target Keywords, , }.
11531debfc3dSmrg
11541debfc3dSmrg@item @{ dg-require-@var{support} args @}
11551debfc3dSmrgSkip the test if the target does not provide the required support.
11561debfc3dSmrgThese directives must appear after any @code{dg-do} directive in the test
11571debfc3dSmrgand before any @code{dg-additional-sources} directive.
11581debfc3dSmrgThey require at least one argument, which can be an empty string if the
11591debfc3dSmrgspecific procedure does not examine the argument.
11601debfc3dSmrg@xref{Require Support, , }, for a complete list of these directives.
11611debfc3dSmrg@end table
11621debfc3dSmrg
11631debfc3dSmrg@subsubsection Expect a test to fail for some targets
11641debfc3dSmrg
11651debfc3dSmrg@table @code
11661debfc3dSmrg@item  @{ dg-xfail-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
11671debfc3dSmrgExpect the test to fail if the conditions (which are the same as for
11681debfc3dSmrg@code{dg-skip-if}) are met.  This does not affect the execute step.
11691debfc3dSmrg
11701debfc3dSmrg@item  @{ dg-xfail-run-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @}
11711debfc3dSmrgExpect the execute step of a test to fail if the conditions (which are
11721debfc3dSmrgthe same as for @code{dg-skip-if}) are met.
11731debfc3dSmrg@end table
11741debfc3dSmrg
11751debfc3dSmrg@subsubsection Expect the test executable to fail
11761debfc3dSmrg
11771debfc3dSmrg@table @code
11781debfc3dSmrg@item  @{ dg-shouldfail @var{comment} [@{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]]] @}
11791debfc3dSmrgExpect the test executable to return a nonzero exit status if the
11801debfc3dSmrgconditions (which are the same as for @code{dg-skip-if}) are met.
11811debfc3dSmrg@end table
11821debfc3dSmrg
11831debfc3dSmrg@subsubsection Verify compiler messages
1184c0a68be4SmrgWhere @var{line} is an accepted argument for these commands, a value of @samp{0}
1185c0a68be4Smrgcan be used if there is no line associated with the message.
11861debfc3dSmrg
11871debfc3dSmrg@table @code
11881debfc3dSmrg@item @{ dg-error @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
11891debfc3dSmrgThis DejaGnu directive appears on a source line that is expected to get
11901debfc3dSmrgan error message, or else specifies the source line associated with the
11911debfc3dSmrgmessage.  If there is no message for that line or if the text of that
11921debfc3dSmrgmessage is not matched by @var{regexp} then the check fails and
11931debfc3dSmrg@var{comment} is included in the @code{FAIL} message.  The check does
11941debfc3dSmrgnot look for the string @samp{error} unless it is part of @var{regexp}.
11951debfc3dSmrg
11961debfc3dSmrg@item @{ dg-warning @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
11971debfc3dSmrgThis DejaGnu directive appears on a source line that is expected to get
11981debfc3dSmrga warning message, or else specifies the source line associated with the
11991debfc3dSmrgmessage.  If there is no message for that line or if the text of that
12001debfc3dSmrgmessage is not matched by @var{regexp} then the check fails and
12011debfc3dSmrg@var{comment} is included in the @code{FAIL} message.  The check does
12021debfc3dSmrgnot look for the string @samp{warning} unless it is part of @var{regexp}.
12031debfc3dSmrg
12041debfc3dSmrg@item @{ dg-message @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
12051debfc3dSmrgThe line is expected to get a message other than an error or warning.
12061debfc3dSmrgIf there is no message for that line or if the text of that message is
12071debfc3dSmrgnot matched by @var{regexp} then the check fails and @var{comment} is
12081debfc3dSmrgincluded in the @code{FAIL} message.
12091debfc3dSmrg
12101debfc3dSmrg@item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
12111debfc3dSmrgThis DejaGnu directive appears on a source line that should not get a
12121debfc3dSmrgmessage matching @var{regexp}, or else specifies the source line
12131debfc3dSmrgassociated with the bogus message.  It is usually used with @samp{xfail}
12141debfc3dSmrgto indicate that the message is a known problem for a particular set of
12151debfc3dSmrgtargets.
12161debfc3dSmrg
1217a2dc1f3fSmrg@item @{ dg-line @var{linenumvar} @}
1218a2dc1f3fSmrgThis DejaGnu directive sets the variable @var{linenumvar} to the line number of
1219a2dc1f3fSmrgthe source line.  The variable @var{linenumvar} can then be used in subsequent
1220a2dc1f3fSmrg@code{dg-error}, @code{dg-warning}, @code{dg-message} and @code{dg-bogus}
1221a2dc1f3fSmrgdirectives.  For example:
1222a2dc1f3fSmrg
1223a2dc1f3fSmrg@smallexample
1224a2dc1f3fSmrgint a;   /* @{ dg-line first_def_a @} */
1225a2dc1f3fSmrgfloat a; /* @{ dg-error "conflicting types of" @} */
1226a2dc1f3fSmrg/* @{ dg-message "previous declaration of" "" @{ target *-*-* @} first_def_a @} */
1227a2dc1f3fSmrg@end smallexample
1228a2dc1f3fSmrg
12291debfc3dSmrg@item @{ dg-excess-errors @var{comment} [@{ target/xfail @var{selector} @}] @}
12301debfc3dSmrgThis DejaGnu directive indicates that the test is expected to fail due
12311debfc3dSmrgto compiler messages that are not handled by @samp{dg-error},
12321debfc3dSmrg@samp{dg-warning} or @samp{dg-bogus}.  For this directive @samp{xfail}
12331debfc3dSmrghas the same effect as @samp{target}.
12341debfc3dSmrg
12351debfc3dSmrg@item @{ dg-prune-output @var{regexp} @}
12361debfc3dSmrgPrune messages matching @var{regexp} from the test output.
12371debfc3dSmrg@end table
12381debfc3dSmrg
12391debfc3dSmrg@subsubsection Verify output of the test executable
12401debfc3dSmrg
12411debfc3dSmrg@table @code
12421debfc3dSmrg@item @{ dg-output @var{regexp} [@{ target/xfail @var{selector} @}] @}
12431debfc3dSmrgThis DejaGnu directive compares @var{regexp} to the combined output
12441debfc3dSmrgthat the test executable writes to @file{stdout} and @file{stderr}.
12451debfc3dSmrg@end table
12461debfc3dSmrg
1247*8feb0f0bSmrg@subsubsection Specify environment variables for a test
1248*8feb0f0bSmrg
1249*8feb0f0bSmrg@table @code
1250*8feb0f0bSmrg@item @{ dg-set-compiler-env-var @var{var_name} "@var{var_value}" @}
1251*8feb0f0bSmrgSpecify that the environment variable @var{var_name} needs to be set
1252*8feb0f0bSmrgto @var{var_value} before invoking the compiler on the test file.
1253*8feb0f0bSmrg
1254*8feb0f0bSmrg@item @{ dg-set-target-env-var @var{var_name} "@var{var_value}" @}
1255*8feb0f0bSmrgSpecify that the environment variable @var{var_name} needs to be set
1256*8feb0f0bSmrgto @var{var_value} before execution of the program created by the test.
1257*8feb0f0bSmrg@end table
1258*8feb0f0bSmrg
12591debfc3dSmrg@subsubsection Specify additional files for a test
12601debfc3dSmrg
12611debfc3dSmrg@table @code
12621debfc3dSmrg@item @{ dg-additional-files "@var{filelist}" @}
12631debfc3dSmrgSpecify additional files, other than source files, that must be copied
12641debfc3dSmrgto the system where the compiler runs.
12651debfc3dSmrg
12661debfc3dSmrg@item @{ dg-additional-sources "@var{filelist}" @}
12671debfc3dSmrgSpecify additional source files to appear in the compile line
12681debfc3dSmrgfollowing the main test file.
12691debfc3dSmrg@end table
12701debfc3dSmrg
12711debfc3dSmrg@subsubsection Add checks at the end of a test
12721debfc3dSmrg
12731debfc3dSmrg@table @code
12741debfc3dSmrg@item @{ dg-final @{ @var{local-directive} @} @}
12751debfc3dSmrgThis DejaGnu directive is placed within a comment anywhere in the
12761debfc3dSmrgsource file and is processed after the test has been compiled and run.
12771debfc3dSmrgMultiple @samp{dg-final} commands are processed in the order in which
12781debfc3dSmrgthey appear in the source file.  @xref{Final Actions, , }, for a list
12791debfc3dSmrgof directives that can be used within @code{dg-final}.
12801debfc3dSmrg@end table
12811debfc3dSmrg
12821debfc3dSmrg@node Selectors
12831debfc3dSmrg@subsection Selecting targets to which a test applies
12841debfc3dSmrg
12851debfc3dSmrgSeveral test directives include @var{selector}s to limit the targets
12861debfc3dSmrgfor which a test is run or to declare that a test is expected to fail
12871debfc3dSmrgon particular targets.
12881debfc3dSmrg
12891debfc3dSmrgA selector is:
12901debfc3dSmrg@itemize @bullet
12911debfc3dSmrg@item one or more target triplets, possibly including wildcard characters;
12921debfc3dSmrguse @samp{*-*-*} to match any target
12931debfc3dSmrg@item a single effective-target keyword (@pxref{Effective-Target Keywords})
12941debfc3dSmrg@item a logical expression
12951debfc3dSmrg@end itemize
12961debfc3dSmrg
12971debfc3dSmrgDepending on the context, the selector specifies whether a test is
12981debfc3dSmrgskipped and reported as unsupported or is expected to fail.  A context
12991debfc3dSmrgthat allows either @samp{target} or @samp{xfail} also allows
13001debfc3dSmrg@samp{@{ target @var{selector1} xfail @var{selector2} @}}
13011debfc3dSmrgto skip the test for targets that don't match @var{selector1} and the
13021debfc3dSmrgtest to fail for targets that match @var{selector2}.
13031debfc3dSmrg
13041debfc3dSmrgA selector expression appears within curly braces and uses a single
13051debfc3dSmrglogical operator: one of @samp{!}, @samp{&&}, or @samp{||}.  An
13061debfc3dSmrgoperand is another selector expression, an effective-target keyword,
13071debfc3dSmrga single target triplet, or a list of target triplets within quotes or
13081debfc3dSmrgcurly braces.  For example:
13091debfc3dSmrg
13101debfc3dSmrg@smallexample
13111debfc3dSmrg@{ target @{ ! "hppa*-*-* ia64*-*-*" @} @}
13121debfc3dSmrg@{ target @{ powerpc*-*-* && lp64 @} @}
13131debfc3dSmrg@{ xfail @{ lp64 || vect_no_align @} @}
13141debfc3dSmrg@end smallexample
13151debfc3dSmrg
13161debfc3dSmrg@node Effective-Target Keywords
13171debfc3dSmrg@subsection Keywords describing target attributes
13181debfc3dSmrg
13191debfc3dSmrgEffective-target keywords identify sets of targets that support
13201debfc3dSmrgparticular functionality.  They are used to limit tests to be run only
13211debfc3dSmrgfor particular targets, or to specify that particular sets of targets
13221debfc3dSmrgare expected to fail some tests.
13231debfc3dSmrg
13241debfc3dSmrgEffective-target keywords are defined in @file{lib/target-supports.exp} in
13251debfc3dSmrgthe GCC testsuite, with the exception of those that are documented as
13261debfc3dSmrgbeing local to a particular test directory.
13271debfc3dSmrg
13281debfc3dSmrgThe @samp{effective target} takes into account all of the compiler options
13291debfc3dSmrgwith which the test will be compiled, including the multilib options.
13301debfc3dSmrgBy convention, keywords ending in @code{_nocache} can also include options
13311debfc3dSmrgspecified for the particular test in an earlier @code{dg-options} or
13321debfc3dSmrg@code{dg-add-options} directive.
13331debfc3dSmrg
1334a2dc1f3fSmrg@subsubsection Endianness
1335a2dc1f3fSmrg
1336a2dc1f3fSmrg@table @code
1337a2dc1f3fSmrg@item be
1338a2dc1f3fSmrgTarget uses big-endian memory order for multi-byte and multi-word data.
1339a2dc1f3fSmrg
1340a2dc1f3fSmrg@item le
1341a2dc1f3fSmrgTarget uses little-endian memory order for multi-byte and multi-word data.
1342a2dc1f3fSmrg@end table
1343a2dc1f3fSmrg
13441debfc3dSmrg@subsubsection Data type sizes
13451debfc3dSmrg
13461debfc3dSmrg@table @code
13471debfc3dSmrg@item ilp32
13481debfc3dSmrgTarget has 32-bit @code{int}, @code{long}, and pointers.
13491debfc3dSmrg
13501debfc3dSmrg@item lp64
13511debfc3dSmrgTarget has 32-bit @code{int}, 64-bit @code{long} and pointers.
13521debfc3dSmrg
13531debfc3dSmrg@item llp64
13541debfc3dSmrgTarget has 32-bit @code{int} and @code{long}, 64-bit @code{long long}
13551debfc3dSmrgand pointers.
13561debfc3dSmrg
13571debfc3dSmrg@item double64
13581debfc3dSmrgTarget has 64-bit @code{double}.
13591debfc3dSmrg
13601debfc3dSmrg@item double64plus
13611debfc3dSmrgTarget has @code{double} that is 64 bits or longer.
13621debfc3dSmrg
13631debfc3dSmrg@item longdouble128
13641debfc3dSmrgTarget has 128-bit @code{long double}.
13651debfc3dSmrg
13661debfc3dSmrg@item int32plus
13671debfc3dSmrgTarget has @code{int} that is at 32 bits or longer.
13681debfc3dSmrg
13691debfc3dSmrg@item int16
13701debfc3dSmrgTarget has @code{int} that is 16 bits or shorter.
13711debfc3dSmrg
1372*8feb0f0bSmrg@item longlong64
1373*8feb0f0bSmrgTarget has 64-bit @code{long long}.
1374*8feb0f0bSmrg
13751debfc3dSmrg@item long_neq_int
13761debfc3dSmrgTarget has @code{int} and @code{long} with different sizes.
13771debfc3dSmrg
1378c0a68be4Smrg@item int_eq_float
1379c0a68be4SmrgTarget has @code{int} and @code{float} with the same size.
1380c0a68be4Smrg
1381c0a68be4Smrg@item ptr_eq_long
1382c0a68be4SmrgTarget has pointers (@code{void *}) and @code{long} with the same size.
1383c0a68be4Smrg
13841debfc3dSmrg@item large_double
13851debfc3dSmrgTarget supports @code{double} that is longer than @code{float}.
13861debfc3dSmrg
13871debfc3dSmrg@item large_long_double
13881debfc3dSmrgTarget supports @code{long double} that is longer than @code{double}.
13891debfc3dSmrg
13901debfc3dSmrg@item ptr32plus
13911debfc3dSmrgTarget has pointers that are 32 bits or longer.
13921debfc3dSmrg
1393c0a68be4Smrg@item size20plus
1394c0a68be4SmrgTarget has a 20-bit or larger address space, so at least supports
1395c0a68be4Smrg16-bit array and structure sizes.
1396c0a68be4Smrg
13971debfc3dSmrg@item size32plus
1398c0a68be4SmrgTarget has a 32-bit or larger address space, so at least supports
1399c0a68be4Smrg24-bit array and structure sizes.
14001debfc3dSmrg
14011debfc3dSmrg@item 4byte_wchar_t
14021debfc3dSmrgTarget has @code{wchar_t} that is at least 4 bytes.
14031debfc3dSmrg
14041debfc3dSmrg@item float@var{n}
14051debfc3dSmrgTarget has the @code{_Float@var{n}} type.
14061debfc3dSmrg
14071debfc3dSmrg@item float@var{n}x
14081debfc3dSmrgTarget has the @code{_Float@var{n}x} type.
14091debfc3dSmrg
14101debfc3dSmrg@item float@var{n}_runtime
14111debfc3dSmrgTarget has the @code{_Float@var{n}} type, including runtime support
14121debfc3dSmrgfor any options added with @code{dg-add-options}.
14131debfc3dSmrg
14141debfc3dSmrg@item float@var{n}x_runtime
14151debfc3dSmrgTarget has the @code{_Float@var{n}x} type, including runtime support
14161debfc3dSmrgfor any options added with @code{dg-add-options}.
14171debfc3dSmrg
14181debfc3dSmrg@item floatn_nx_runtime
14191debfc3dSmrgTarget has runtime support for any options added with
14201debfc3dSmrg@code{dg-add-options} for any @code{_Float@var{n}} or
14211debfc3dSmrg@code{_Float@var{n}x} type.
14221debfc3dSmrg
1423c0a68be4Smrg@item inf
1424c0a68be4SmrgTarget supports floating point infinite (@code{inf}) for type
1425c0a68be4Smrg@code{double}.
1426c0a68be4Smrg@end table
14271debfc3dSmrg@subsubsection Fortran-specific attributes
14281debfc3dSmrg
14291debfc3dSmrg@table @code
14301debfc3dSmrg@item fortran_integer_16
14311debfc3dSmrgTarget supports Fortran @code{integer} that is 16 bytes or longer.
14321debfc3dSmrg
1433a2dc1f3fSmrg@item fortran_real_10
1434a2dc1f3fSmrgTarget supports Fortran @code{real} that is 10 bytes or longer.
1435a2dc1f3fSmrg
1436a2dc1f3fSmrg@item fortran_real_16
1437a2dc1f3fSmrgTarget supports Fortran @code{real} that is 16 bytes or longer.
1438a2dc1f3fSmrg
14391debfc3dSmrg@item fortran_large_int
14401debfc3dSmrgTarget supports Fortran @code{integer} kinds larger than @code{integer(8)}.
14411debfc3dSmrg
14421debfc3dSmrg@item fortran_large_real
14431debfc3dSmrgTarget supports Fortran @code{real} kinds larger than @code{real(8)}.
14441debfc3dSmrg@end table
14451debfc3dSmrg
14461debfc3dSmrg@subsubsection Vector-specific attributes
14471debfc3dSmrg
14481debfc3dSmrg@table @code
1449a2dc1f3fSmrg@item vect_align_stack_vars
1450a2dc1f3fSmrgThe target's ABI allows stack variables to be aligned to the preferred
1451a2dc1f3fSmrgvector alignment.
1452a2dc1f3fSmrg
1453c0a68be4Smrg@item vect_avg_qi
1454c0a68be4SmrgTarget supports both signed and unsigned averaging operations on vectors
1455c0a68be4Smrgof bytes.
1456c0a68be4Smrg
1457*8feb0f0bSmrg@item vect_mulhrs_hi
1458*8feb0f0bSmrgTarget supports both signed and unsigned multiply-high-with-round-and-scale
1459*8feb0f0bSmrgoperations on vectors of half-words.
1460*8feb0f0bSmrg
1461*8feb0f0bSmrg@item vect_sdiv_pow2_si
1462*8feb0f0bSmrgTarget supports signed division by constant power-of-2 operations
1463*8feb0f0bSmrgon vectors of 4-byte integers.
1464*8feb0f0bSmrg
14651debfc3dSmrg@item vect_condition
14661debfc3dSmrgTarget supports vector conditional operations.
14671debfc3dSmrg
14681debfc3dSmrg@item vect_cond_mixed
14691debfc3dSmrgTarget supports vector conditional operations where comparison operands
14701debfc3dSmrghave different type from the value operands.
14711debfc3dSmrg
14721debfc3dSmrg@item vect_double
14731debfc3dSmrgTarget supports hardware vectors of @code{double}.
14741debfc3dSmrg
1475c0a68be4Smrg@item vect_double_cond_arith
1476c0a68be4SmrgTarget supports conditional addition, subtraction, multiplication,
1477c0a68be4Smrgdivision, minimum and maximum on vectors of @code{double}, via the
1478c0a68be4Smrg@code{cond_} optabs.
1479c0a68be4Smrg
1480a2dc1f3fSmrg@item vect_element_align_preferred
1481a2dc1f3fSmrgThe target's preferred vector alignment is the same as the element
1482a2dc1f3fSmrgalignment.
1483a2dc1f3fSmrg
14841debfc3dSmrg@item vect_float
1485a2dc1f3fSmrgTarget supports hardware vectors of @code{float} when
1486a2dc1f3fSmrg@option{-funsafe-math-optimizations} is in effect.
1487a2dc1f3fSmrg
1488a2dc1f3fSmrg@item vect_float_strict
1489a2dc1f3fSmrgTarget supports hardware vectors of @code{float} when
1490a2dc1f3fSmrg@option{-funsafe-math-optimizations} is not in effect.
1491a2dc1f3fSmrgThis implies @code{vect_float}.
14921debfc3dSmrg
14931debfc3dSmrg@item vect_int
14941debfc3dSmrgTarget supports hardware vectors of @code{int}.
14951debfc3dSmrg
14961debfc3dSmrg@item vect_long
14971debfc3dSmrgTarget supports hardware vectors of @code{long}.
14981debfc3dSmrg
14991debfc3dSmrg@item vect_long_long
15001debfc3dSmrgTarget supports hardware vectors of @code{long long}.
15011debfc3dSmrg
1502*8feb0f0bSmrg@item vect_check_ptrs
1503*8feb0f0bSmrgTarget supports the @code{check_raw_ptrs} and @code{check_war_ptrs}
1504*8feb0f0bSmrgoptabs on vectors.
1505*8feb0f0bSmrg
1506a2dc1f3fSmrg@item vect_fully_masked
1507a2dc1f3fSmrgTarget supports fully-masked (also known as fully-predicated) loops,
1508a2dc1f3fSmrgso that vector loops can handle partial as well as full vectors.
1509a2dc1f3fSmrg
1510a2dc1f3fSmrg@item vect_masked_store
1511a2dc1f3fSmrgTarget supports vector masked stores.
1512a2dc1f3fSmrg
1513a2dc1f3fSmrg@item vect_scatter_store
1514a2dc1f3fSmrgTarget supports vector scatter stores.
1515a2dc1f3fSmrg
15161debfc3dSmrg@item vect_aligned_arrays
15171debfc3dSmrgTarget aligns arrays to vector alignment boundary.
15181debfc3dSmrg
15191debfc3dSmrg@item vect_hw_misalign
15201debfc3dSmrgTarget supports a vector misalign access.
15211debfc3dSmrg
15221debfc3dSmrg@item vect_no_align
15231debfc3dSmrgTarget does not support a vector alignment mechanism.
15241debfc3dSmrg
1525a2dc1f3fSmrg@item vect_peeling_profitable
1526a2dc1f3fSmrgTarget might require to peel loops for alignment purposes.
1527a2dc1f3fSmrg
15281debfc3dSmrg@item vect_no_int_min_max
15291debfc3dSmrgTarget does not support a vector min and max instruction on @code{int}.
15301debfc3dSmrg
15311debfc3dSmrg@item vect_no_int_add
15321debfc3dSmrgTarget does not support a vector add instruction on @code{int}.
15331debfc3dSmrg
15341debfc3dSmrg@item vect_no_bitwise
15351debfc3dSmrgTarget does not support vector bitwise instructions.
15361debfc3dSmrg
1537*8feb0f0bSmrg@item vect_bool_cmp
1538*8feb0f0bSmrgTarget supports comparison of @code{bool} vectors for at least one
1539*8feb0f0bSmrgvector length.
1540*8feb0f0bSmrg
1541*8feb0f0bSmrg@item vect_char_add
1542*8feb0f0bSmrgTarget supports addition of @code{char} vectors for at least one
1543*8feb0f0bSmrgvector length.
1544*8feb0f0bSmrg
15451debfc3dSmrg@item vect_char_mult
15461debfc3dSmrgTarget supports @code{vector char} multiplication.
15471debfc3dSmrg
15481debfc3dSmrg@item vect_short_mult
15491debfc3dSmrgTarget supports @code{vector short} multiplication.
15501debfc3dSmrg
15511debfc3dSmrg@item vect_int_mult
15521debfc3dSmrgTarget supports @code{vector int} multiplication.
15531debfc3dSmrg
1554a2dc1f3fSmrg@item vect_long_mult
1555a2dc1f3fSmrgTarget supports 64 bit @code{vector long} multiplication.
1556a2dc1f3fSmrg
15571debfc3dSmrg@item vect_extract_even_odd
15581debfc3dSmrgTarget supports vector even/odd element extraction.
15591debfc3dSmrg
15601debfc3dSmrg@item vect_extract_even_odd_wide
15611debfc3dSmrgTarget supports vector even/odd element extraction of vectors with elements
15621debfc3dSmrg@code{SImode} or larger.
15631debfc3dSmrg
15641debfc3dSmrg@item vect_interleave
15651debfc3dSmrgTarget supports vector interleaving.
15661debfc3dSmrg
15671debfc3dSmrg@item vect_strided
15681debfc3dSmrgTarget supports vector interleaving and extract even/odd.
15691debfc3dSmrg
15701debfc3dSmrg@item vect_strided_wide
15711debfc3dSmrgTarget supports vector interleaving and extract even/odd for wide
15721debfc3dSmrgelement types.
15731debfc3dSmrg
15741debfc3dSmrg@item vect_perm
15751debfc3dSmrgTarget supports vector permutation.
15761debfc3dSmrg
1577a2dc1f3fSmrg@item vect_perm_byte
1578a2dc1f3fSmrgTarget supports permutation of vectors with 8-bit elements.
1579a2dc1f3fSmrg
1580a2dc1f3fSmrg@item vect_perm_short
1581a2dc1f3fSmrgTarget supports permutation of vectors with 16-bit elements.
1582a2dc1f3fSmrg
1583a2dc1f3fSmrg@item vect_perm3_byte
1584a2dc1f3fSmrgTarget supports permutation of vectors with 8-bit elements, and for the
1585a2dc1f3fSmrgdefault vector length it is possible to permute:
1586a2dc1f3fSmrg@example
1587a2dc1f3fSmrg@{ a0, a1, a2, b0, b1, b2, @dots{} @}
1588a2dc1f3fSmrg@end example
1589a2dc1f3fSmrgto:
1590a2dc1f3fSmrg@example
1591a2dc1f3fSmrg@{ a0, a0, a0, b0, b0, b0, @dots{} @}
1592a2dc1f3fSmrg@{ a1, a1, a1, b1, b1, b1, @dots{} @}
1593a2dc1f3fSmrg@{ a2, a2, a2, b2, b2, b2, @dots{} @}
1594a2dc1f3fSmrg@end example
1595a2dc1f3fSmrgusing only two-vector permutes, regardless of how long the sequence is.
1596a2dc1f3fSmrg
1597a2dc1f3fSmrg@item vect_perm3_int
1598a2dc1f3fSmrgLike @code{vect_perm3_byte}, but for 32-bit elements.
1599a2dc1f3fSmrg
1600a2dc1f3fSmrg@item vect_perm3_short
1601a2dc1f3fSmrgLike @code{vect_perm3_byte}, but for 16-bit elements.
1602a2dc1f3fSmrg
16031debfc3dSmrg@item vect_shift
16041debfc3dSmrgTarget supports a hardware vector shift operation.
16051debfc3dSmrg
1606a2dc1f3fSmrg@item vect_unaligned_possible
1607a2dc1f3fSmrgTarget prefers vectors to have an alignment greater than element
1608a2dc1f3fSmrgalignment, but also allows unaligned vector accesses in some
1609a2dc1f3fSmrgcircumstances.
1610a2dc1f3fSmrg
1611a2dc1f3fSmrg@item vect_variable_length
1612a2dc1f3fSmrgTarget has variable-length vectors.
1613a2dc1f3fSmrg
16141debfc3dSmrg@item vect_widen_sum_hi_to_si
16151debfc3dSmrgTarget supports a vector widening summation of @code{short} operands
16161debfc3dSmrginto @code{int} results, or can promote (unpack) from @code{short}
16171debfc3dSmrgto @code{int}.
16181debfc3dSmrg
16191debfc3dSmrg@item vect_widen_sum_qi_to_hi
16201debfc3dSmrgTarget supports a vector widening summation of @code{char} operands
16211debfc3dSmrginto @code{short} results, or can promote (unpack) from @code{char}
16221debfc3dSmrgto @code{short}.
16231debfc3dSmrg
16241debfc3dSmrg@item vect_widen_sum_qi_to_si
16251debfc3dSmrgTarget supports a vector widening summation of @code{char} operands
16261debfc3dSmrginto @code{int} results.
16271debfc3dSmrg
16281debfc3dSmrg@item vect_widen_mult_qi_to_hi
16291debfc3dSmrgTarget supports a vector widening multiplication of @code{char} operands
16301debfc3dSmrginto @code{short} results, or can promote (unpack) from @code{char} to
16311debfc3dSmrg@code{short} and perform non-widening multiplication of @code{short}.
16321debfc3dSmrg
16331debfc3dSmrg@item vect_widen_mult_hi_to_si
16341debfc3dSmrgTarget supports a vector widening multiplication of @code{short} operands
16351debfc3dSmrginto @code{int} results, or can promote (unpack) from @code{short} to
16361debfc3dSmrg@code{int} and perform non-widening multiplication of @code{int}.
16371debfc3dSmrg
16381debfc3dSmrg@item vect_widen_mult_si_to_di_pattern
16391debfc3dSmrgTarget supports a vector widening multiplication of @code{int} operands
16401debfc3dSmrginto @code{long} results.
16411debfc3dSmrg
16421debfc3dSmrg@item vect_sdot_qi
16431debfc3dSmrgTarget supports a vector dot-product of @code{signed char}.
16441debfc3dSmrg
16451debfc3dSmrg@item vect_udot_qi
16461debfc3dSmrgTarget supports a vector dot-product of @code{unsigned char}.
16471debfc3dSmrg
16481debfc3dSmrg@item vect_sdot_hi
16491debfc3dSmrgTarget supports a vector dot-product of @code{signed short}.
16501debfc3dSmrg
16511debfc3dSmrg@item vect_udot_hi
16521debfc3dSmrgTarget supports a vector dot-product of @code{unsigned short}.
16531debfc3dSmrg
16541debfc3dSmrg@item vect_pack_trunc
16551debfc3dSmrgTarget supports a vector demotion (packing) of @code{short} to @code{char}
16561debfc3dSmrgand from @code{int} to @code{short} using modulo arithmetic.
16571debfc3dSmrg
16581debfc3dSmrg@item vect_unpack
16591debfc3dSmrgTarget supports a vector promotion (unpacking) of @code{char} to @code{short}
16601debfc3dSmrgand from @code{char} to @code{int}.
16611debfc3dSmrg
16621debfc3dSmrg@item vect_intfloat_cvt
16631debfc3dSmrgTarget supports conversion from @code{signed int} to @code{float}.
16641debfc3dSmrg
16651debfc3dSmrg@item vect_uintfloat_cvt
16661debfc3dSmrgTarget supports conversion from @code{unsigned int} to @code{float}.
16671debfc3dSmrg
16681debfc3dSmrg@item vect_floatint_cvt
16691debfc3dSmrgTarget supports conversion from @code{float} to @code{signed int}.
16701debfc3dSmrg
16711debfc3dSmrg@item vect_floatuint_cvt
16721debfc3dSmrgTarget supports conversion from @code{float} to @code{unsigned int}.
16731debfc3dSmrg
1674a2dc1f3fSmrg@item vect_intdouble_cvt
1675a2dc1f3fSmrgTarget supports conversion from @code{signed int} to @code{double}.
1676a2dc1f3fSmrg
1677a2dc1f3fSmrg@item vect_doubleint_cvt
1678a2dc1f3fSmrgTarget supports conversion from @code{double} to @code{signed int}.
1679a2dc1f3fSmrg
16801debfc3dSmrg@item vect_max_reduc
16811debfc3dSmrgTarget supports max reduction for vectors.
1682a2dc1f3fSmrg
1683a2dc1f3fSmrg@item vect_sizes_16B_8B
1684a2dc1f3fSmrgTarget supports 16- and 8-bytes vectors.
1685a2dc1f3fSmrg
1686a2dc1f3fSmrg@item vect_sizes_32B_16B
1687a2dc1f3fSmrgTarget supports 32- and 16-bytes vectors.
1688a2dc1f3fSmrg
1689a2dc1f3fSmrg@item vect_logical_reduc
1690a2dc1f3fSmrgTarget supports AND, IOR and XOR reduction on vectors.
1691a2dc1f3fSmrg
1692a2dc1f3fSmrg@item vect_fold_extract_last
1693a2dc1f3fSmrgTarget supports the @code{fold_extract_last} optab.
16941debfc3dSmrg@end table
16951debfc3dSmrg
16961debfc3dSmrg@subsubsection Thread Local Storage attributes
16971debfc3dSmrg
16981debfc3dSmrg@table @code
16991debfc3dSmrg@item tls
17001debfc3dSmrgTarget supports thread-local storage.
17011debfc3dSmrg
17021debfc3dSmrg@item tls_native
17031debfc3dSmrgTarget supports native (rather than emulated) thread-local storage.
17041debfc3dSmrg
17051debfc3dSmrg@item tls_runtime
17061debfc3dSmrgTest system supports executing TLS executables.
17071debfc3dSmrg@end table
17081debfc3dSmrg
17091debfc3dSmrg@subsubsection Decimal floating point attributes
17101debfc3dSmrg
17111debfc3dSmrg@table @code
17121debfc3dSmrg@item dfp
17131debfc3dSmrgTargets supports compiling decimal floating point extension to C.
17141debfc3dSmrg
17151debfc3dSmrg@item dfp_nocache
17161debfc3dSmrgIncluding the options used to compile this particular test, the
17171debfc3dSmrgtarget supports compiling decimal floating point extension to C.
17181debfc3dSmrg
17191debfc3dSmrg@item dfprt
17201debfc3dSmrgTest system can execute decimal floating point tests.
17211debfc3dSmrg
17221debfc3dSmrg@item dfprt_nocache
17231debfc3dSmrgIncluding the options used to compile this particular test, the
17241debfc3dSmrgtest system can execute decimal floating point tests.
17251debfc3dSmrg
17261debfc3dSmrg@item hard_dfp
17271debfc3dSmrgTarget generates decimal floating point instructions with current options.
17281debfc3dSmrg@end table
17291debfc3dSmrg
17301debfc3dSmrg@subsubsection ARM-specific attributes
17311debfc3dSmrg
17321debfc3dSmrg@table @code
17331debfc3dSmrg@item arm32
17341debfc3dSmrgARM target generates 32-bit code.
17351debfc3dSmrg
1736*8feb0f0bSmrg@item arm_little_endian
1737*8feb0f0bSmrgARM target that generates little-endian code.
1738*8feb0f0bSmrg
17391debfc3dSmrg@item arm_eabi
17401debfc3dSmrgARM target adheres to the ABI for the ARM Architecture.
17411debfc3dSmrg
17421debfc3dSmrg@item arm_fp_ok
17431debfc3dSmrg@anchor{arm_fp_ok}
17441debfc3dSmrgARM target defines @code{__ARM_FP} using @code{-mfloat-abi=softfp} or
17451debfc3dSmrgequivalent options.  Some multilibs may be incompatible with these
17461debfc3dSmrgoptions.
17471debfc3dSmrg
1748*8feb0f0bSmrg@item arm_fp_dp_ok
1749*8feb0f0bSmrg@anchor{arm_fp_dp_ok}
1750*8feb0f0bSmrgARM target defines @code{__ARM_FP} with double-precision support using
1751*8feb0f0bSmrg@code{-mfloat-abi=softfp} or equivalent options.  Some multilibs may
1752*8feb0f0bSmrgbe incompatible with these options.
1753*8feb0f0bSmrg
17541debfc3dSmrg@item arm_hf_eabi
17551debfc3dSmrgARM target adheres to the VFP and Advanced SIMD Register Arguments
17561debfc3dSmrgvariant of the ABI for the ARM Architecture (as selected with
17571debfc3dSmrg@code{-mfloat-abi=hard}).
17581debfc3dSmrg
1759a2dc1f3fSmrg@item arm_softfloat
1760a2dc1f3fSmrgARM target uses the soft-float ABI with no floating-point instructions
1761a2dc1f3fSmrgused whatsoever (as selected with @code{-mfloat-abi=soft}).
1762a2dc1f3fSmrg
17631debfc3dSmrg@item arm_hard_vfp_ok
17641debfc3dSmrgARM target supports @code{-mfpu=vfp -mfloat-abi=hard}.
17651debfc3dSmrgSome multilibs may be incompatible with these options.
17661debfc3dSmrg
17671debfc3dSmrg@item arm_iwmmxt_ok
17681debfc3dSmrgARM target supports @code{-mcpu=iwmmxt}.
17691debfc3dSmrgSome multilibs may be incompatible with this option.
17701debfc3dSmrg
17711debfc3dSmrg@item arm_neon
17721debfc3dSmrgARM target supports generating NEON instructions.
17731debfc3dSmrg
17741debfc3dSmrg@item arm_tune_string_ops_prefer_neon
17751debfc3dSmrgTest CPU tune supports inlining string operations with NEON instructions.
17761debfc3dSmrg
17771debfc3dSmrg@item arm_neon_hw
17781debfc3dSmrgTest system supports executing NEON instructions.
17791debfc3dSmrg
17801debfc3dSmrg@item arm_neonv2_hw
17811debfc3dSmrgTest system supports executing NEON v2 instructions.
17821debfc3dSmrg
17831debfc3dSmrg@item arm_neon_ok
17841debfc3dSmrg@anchor{arm_neon_ok}
17851debfc3dSmrgARM Target supports @code{-mfpu=neon -mfloat-abi=softfp} or compatible
17861debfc3dSmrgoptions.  Some multilibs may be incompatible with these options.
17871debfc3dSmrg
17881debfc3dSmrg@item arm_neon_ok_no_float_abi
17891debfc3dSmrg@anchor{arm_neon_ok_no_float_abi}
17901debfc3dSmrgARM Target supports NEON with @code{-mfpu=neon}, but without any
17911debfc3dSmrg-mfloat-abi= option.  Some multilibs may be incompatible with this
17921debfc3dSmrgoption.
17931debfc3dSmrg
17941debfc3dSmrg@item arm_neonv2_ok
17951debfc3dSmrg@anchor{arm_neonv2_ok}
17961debfc3dSmrgARM Target supports @code{-mfpu=neon-vfpv4 -mfloat-abi=softfp} or compatible
17971debfc3dSmrgoptions.  Some multilibs may be incompatible with these options.
17981debfc3dSmrg
17991debfc3dSmrg@item arm_fp16_ok
18001debfc3dSmrg@anchor{arm_fp16_ok}
18011debfc3dSmrgTarget supports options to generate VFP half-precision floating-point
18021debfc3dSmrginstructions.  Some multilibs may be incompatible with these
18031debfc3dSmrgoptions.  This test is valid for ARM only.
18041debfc3dSmrg
18051debfc3dSmrg@item arm_fp16_hw
18061debfc3dSmrgTarget supports executing VFP half-precision floating-point
18071debfc3dSmrginstructions.  This test is valid for ARM only.
18081debfc3dSmrg
18091debfc3dSmrg@item arm_neon_fp16_ok
18101debfc3dSmrg@anchor{arm_neon_fp16_ok}
18111debfc3dSmrgARM Target supports @code{-mfpu=neon-fp16 -mfloat-abi=softfp} or compatible
18121debfc3dSmrgoptions, including @code{-mfp16-format=ieee} if necessary to obtain the
18131debfc3dSmrg@code{__fp16} type.  Some multilibs may be incompatible with these options.
18141debfc3dSmrg
18151debfc3dSmrg@item arm_neon_fp16_hw
18161debfc3dSmrgTest system supports executing Neon half-precision float instructions.
18171debfc3dSmrg(Implies previous.)
18181debfc3dSmrg
18191debfc3dSmrg@item arm_fp16_alternative_ok
18201debfc3dSmrgARM target supports the ARM FP16 alternative format.  Some multilibs
18211debfc3dSmrgmay be incompatible with the options needed.
18221debfc3dSmrg
18231debfc3dSmrg@item arm_fp16_none_ok
18241debfc3dSmrgARM target supports specifying none as the ARM FP16 format.
18251debfc3dSmrg
18261debfc3dSmrg@item arm_thumb1_ok
18271debfc3dSmrgARM target generates Thumb-1 code for @code{-mthumb}.
18281debfc3dSmrg
18291debfc3dSmrg@item arm_thumb2_ok
18301debfc3dSmrgARM target generates Thumb-2 code for @code{-mthumb}.
18311debfc3dSmrg
1832*8feb0f0bSmrg@item arm_nothumb
1833*8feb0f0bSmrgARM target that is not using Thumb.
1834*8feb0f0bSmrg
18351debfc3dSmrg@item arm_vfp_ok
18361debfc3dSmrgARM target supports @code{-mfpu=vfp -mfloat-abi=softfp}.
18371debfc3dSmrgSome multilibs may be incompatible with these options.
18381debfc3dSmrg
18391debfc3dSmrg@item arm_vfp3_ok
18401debfc3dSmrg@anchor{arm_vfp3_ok}
18411debfc3dSmrgARM target supports @code{-mfpu=vfp3 -mfloat-abi=softfp}.
18421debfc3dSmrgSome multilibs may be incompatible with these options.
18431debfc3dSmrg
1844*8feb0f0bSmrg@item arm_arch_v8a_hard_ok
1845*8feb0f0bSmrg@anchor{arm_arch_v8a_hard_ok}
1846*8feb0f0bSmrgThe compiler is targeting @code{arm*-*-*} and can compile and assemble code
1847*8feb0f0bSmrgusing the options @code{-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard}.
1848*8feb0f0bSmrgThis is not enough to guarantee that linking works.
1849*8feb0f0bSmrg
1850*8feb0f0bSmrg@item arm_arch_v8a_hard_multilib
1851*8feb0f0bSmrgThe compiler is targeting @code{arm*-*-*} and can build programs using
1852*8feb0f0bSmrgthe options @code{-march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard}.
1853*8feb0f0bSmrgThe target can also run the resulting binaries.
1854*8feb0f0bSmrg
18551debfc3dSmrg@item arm_v8_vfp_ok
18561debfc3dSmrgARM target supports @code{-mfpu=fp-armv8 -mfloat-abi=softfp}.
18571debfc3dSmrgSome multilibs may be incompatible with these options.
18581debfc3dSmrg
18591debfc3dSmrg@item arm_v8_neon_ok
18601debfc3dSmrgARM target supports @code{-mfpu=neon-fp-armv8 -mfloat-abi=softfp}.
18611debfc3dSmrgSome multilibs may be incompatible with these options.
18621debfc3dSmrg
18631debfc3dSmrg@item arm_v8_1a_neon_ok
18641debfc3dSmrg@anchor{arm_v8_1a_neon_ok}
1865a2dc1f3fSmrgARM target supports options to generate ARMv8.1-A Adv.SIMD instructions.
18661debfc3dSmrgSome multilibs may be incompatible with these options.
18671debfc3dSmrg
18681debfc3dSmrg@item arm_v8_1a_neon_hw
1869a2dc1f3fSmrgARM target supports executing ARMv8.1-A Adv.SIMD instructions.  Some
18701debfc3dSmrgmultilibs may be incompatible with the options needed.  Implies
18711debfc3dSmrgarm_v8_1a_neon_ok.
18721debfc3dSmrg
18731debfc3dSmrg@item arm_acq_rel
18741debfc3dSmrgARM target supports acquire-release instructions.
18751debfc3dSmrg
18761debfc3dSmrg@item arm_v8_2a_fp16_scalar_ok
18771debfc3dSmrg@anchor{arm_v8_2a_fp16_scalar_ok}
1878a2dc1f3fSmrgARM target supports options to generate instructions for ARMv8.2-A and
18791debfc3dSmrgscalar instructions from the FP16 extension.  Some multilibs may be
18801debfc3dSmrgincompatible with these options.
18811debfc3dSmrg
18821debfc3dSmrg@item arm_v8_2a_fp16_scalar_hw
1883a2dc1f3fSmrgARM target supports executing instructions for ARMv8.2-A and scalar
18841debfc3dSmrginstructions from the FP16 extension.  Some multilibs may be
18851debfc3dSmrgincompatible with these options.  Implies arm_v8_2a_fp16_neon_ok.
18861debfc3dSmrg
18871debfc3dSmrg@item arm_v8_2a_fp16_neon_ok
18881debfc3dSmrg@anchor{arm_v8_2a_fp16_neon_ok}
1889a2dc1f3fSmrgARM target supports options to generate instructions from ARMv8.2-A with
18901debfc3dSmrgthe FP16 extension.  Some multilibs may be incompatible with these
18911debfc3dSmrgoptions.  Implies arm_v8_2a_fp16_scalar_ok.
18921debfc3dSmrg
18931debfc3dSmrg@item arm_v8_2a_fp16_neon_hw
1894a2dc1f3fSmrgARM target supports executing instructions from ARMv8.2-A with the FP16
18951debfc3dSmrgextension.  Some multilibs may be incompatible with these options.
18961debfc3dSmrgImplies arm_v8_2a_fp16_neon_ok and arm_v8_2a_fp16_scalar_hw.
18971debfc3dSmrg
1898a2dc1f3fSmrg@item arm_v8_2a_dotprod_neon_ok
1899a2dc1f3fSmrg@anchor{arm_v8_2a_dotprod_neon_ok}
1900a2dc1f3fSmrgARM target supports options to generate instructions from ARMv8.2-A with
1901a2dc1f3fSmrgthe Dot Product extension. Some multilibs may be incompatible with these
1902a2dc1f3fSmrgoptions.
1903a2dc1f3fSmrg
1904a2dc1f3fSmrg@item arm_v8_2a_dotprod_neon_hw
1905a2dc1f3fSmrgARM target supports executing instructions from ARMv8.2-A with the Dot
1906a2dc1f3fSmrgProduct extension. Some multilibs may be incompatible with these options.
1907a2dc1f3fSmrgImplies arm_v8_2a_dotprod_neon_ok.
1908a2dc1f3fSmrg
1909a2dc1f3fSmrg@item arm_fp16fml_neon_ok
1910a2dc1f3fSmrg@anchor{arm_fp16fml_neon_ok}
1911a2dc1f3fSmrgARM target supports extensions to generate the @code{VFMAL} and @code{VFMLS}
1912a2dc1f3fSmrghalf-precision floating-point instructions available from ARMv8.2-A and
1913a2dc1f3fSmrgonwards.  Some multilibs may be incompatible with these options.
1914a2dc1f3fSmrg
1915*8feb0f0bSmrg@item arm_v8_2a_bf16_neon_ok
1916*8feb0f0bSmrgARM target supports options to generate instructions from ARMv8.2-A with
1917*8feb0f0bSmrgthe BFloat16 extension (bf16). Some multilibs may be incompatible with these
1918*8feb0f0bSmrgoptions.
1919*8feb0f0bSmrg
1920*8feb0f0bSmrg@item arm_v8_2a_i8mm_ok
1921*8feb0f0bSmrgARM target supports options to generate instructions from ARMv8.2-A with
1922*8feb0f0bSmrgthe 8-Bit Integer Matrix Multiply extension (i8mm). Some multilibs may be
1923*8feb0f0bSmrgincompatible with these options.
1924*8feb0f0bSmrg
1925*8feb0f0bSmrg@item arm_v8_1m_mve_ok
1926*8feb0f0bSmrgARM target supports options to generate instructions from ARMv8.1-M with
1927*8feb0f0bSmrgthe M-Profile Vector Extension (MVE). Some multilibs may be incompatible
1928*8feb0f0bSmrgwith these options.
1929*8feb0f0bSmrg
1930*8feb0f0bSmrg@item arm_v8_1m_mve_fp_ok
1931*8feb0f0bSmrgARM target supports options to generate instructions from ARMv8.1-M with
1932*8feb0f0bSmrgthe Half-precision floating-point instructions (HP), Floating-point Extension
1933*8feb0f0bSmrg(FP) along with M-Profile Vector Extension (MVE). Some multilibs may be
1934*8feb0f0bSmrgincompatible with these options.
1935*8feb0f0bSmrg
1936*8feb0f0bSmrg@item arm_mve_hw
1937*8feb0f0bSmrgTest system supports executing MVE instructions.
1938*8feb0f0bSmrg
1939*8feb0f0bSmrg@item arm_v8m_main_cde
1940*8feb0f0bSmrgARM target supports options to generate instructions from ARMv8-M with
1941*8feb0f0bSmrgthe Custom Datapath Extension (CDE). Some multilibs may be incompatible
1942*8feb0f0bSmrgwith these options.
1943*8feb0f0bSmrg
1944*8feb0f0bSmrg@item arm_v8m_main_cde_fp
1945*8feb0f0bSmrgARM target supports options to generate instructions from ARMv8-M with
1946*8feb0f0bSmrgthe Custom Datapath Extension (CDE) and floating-point (VFP).
1947*8feb0f0bSmrgSome multilibs may be incompatible with these options.
1948*8feb0f0bSmrg
1949*8feb0f0bSmrg@item arm_v8_1m_main_cde_mve
1950*8feb0f0bSmrgARM target supports options to generate instructions from ARMv8.1-M with
1951*8feb0f0bSmrgthe Custom Datapath Extension (CDE) and M-Profile Vector Extension (MVE).
1952*8feb0f0bSmrgSome multilibs may be incompatible with these options.
1953*8feb0f0bSmrg
19541debfc3dSmrg@item arm_prefer_ldrd_strd
19551debfc3dSmrgARM target prefers @code{LDRD} and @code{STRD} instructions over
19561debfc3dSmrg@code{LDM} and @code{STM} instructions.
19571debfc3dSmrg
19581debfc3dSmrg@item arm_thumb1_movt_ok
19591debfc3dSmrgARM target generates Thumb-1 code for @code{-mthumb} with @code{MOVW}
19601debfc3dSmrgand @code{MOVT} instructions available.
19611debfc3dSmrg
19621debfc3dSmrg@item arm_thumb1_cbz_ok
19631debfc3dSmrgARM target generates Thumb-1 code for @code{-mthumb} with
19641debfc3dSmrg@code{CBZ} and @code{CBNZ} instructions available.
19651debfc3dSmrg
19661debfc3dSmrg@item arm_divmod_simode
19671debfc3dSmrgARM target for which divmod transform is disabled, if it supports hardware
19681debfc3dSmrgdiv instruction.
19691debfc3dSmrg
19701debfc3dSmrg@item arm_cmse_ok
19711debfc3dSmrgARM target supports ARMv8-M Security Extensions, enabled by the @code{-mcmse}
19721debfc3dSmrgoption.
19731debfc3dSmrg
19741debfc3dSmrg@item arm_coproc1_ok
19751debfc3dSmrg@anchor{arm_coproc1_ok}
19761debfc3dSmrgARM target supports the following coprocessor instructions: @code{CDP},
19771debfc3dSmrg@code{LDC}, @code{STC}, @code{MCR} and @code{MRC}.
19781debfc3dSmrg
19791debfc3dSmrg@item arm_coproc2_ok
19801debfc3dSmrg@anchor{arm_coproc2_ok}
19811debfc3dSmrgARM target supports all the coprocessor instructions also listed as supported
19821debfc3dSmrgin @ref{arm_coproc1_ok} in addition to the following: @code{CDP2}, @code{LDC2},
19831debfc3dSmrg@code{LDC2l}, @code{STC2}, @code{STC2l}, @code{MCR2} and @code{MRC2}.
19841debfc3dSmrg
19851debfc3dSmrg@item arm_coproc3_ok
19861debfc3dSmrg@anchor{arm_coproc3_ok}
19871debfc3dSmrgARM target supports all the coprocessor instructions also listed as supported
19881debfc3dSmrgin @ref{arm_coproc2_ok} in addition the following: @code{MCRR} and @code{MRRC}.
19891debfc3dSmrg
19901debfc3dSmrg@item arm_coproc4_ok
19911debfc3dSmrgARM target supports all the coprocessor instructions also listed as supported
19921debfc3dSmrgin @ref{arm_coproc3_ok} in addition the following: @code{MCRR2} and @code{MRRC2}.
1993*8feb0f0bSmrg
1994*8feb0f0bSmrg@item arm_simd32_ok
1995*8feb0f0bSmrg@anchor{arm_simd32_ok}
1996*8feb0f0bSmrgARM Target supports options suitable for accessing the SIMD32 intrinsics from
1997*8feb0f0bSmrg@code{arm_acle.h}.
1998*8feb0f0bSmrgSome multilibs may be incompatible with these options.
1999*8feb0f0bSmrg
2000*8feb0f0bSmrg@item arm_qbit_ok
2001*8feb0f0bSmrg@anchor{arm_qbit_ok}
2002*8feb0f0bSmrgARM Target supports options suitable for accessing the Q-bit manipulation
2003*8feb0f0bSmrgintrinsics from @code{arm_acle.h}.
2004*8feb0f0bSmrgSome multilibs may be incompatible with these options.
2005*8feb0f0bSmrg
2006*8feb0f0bSmrg@item arm_softfp_ok
2007*8feb0f0bSmrg@anchor{arm_softfp_ok}
2008*8feb0f0bSmrgARM target supports the @code{-mfloat-abi=softfp} option.
2009*8feb0f0bSmrg
2010*8feb0f0bSmrg@item arm_hard_ok
2011*8feb0f0bSmrg@anchor{arm_hard_ok}
2012*8feb0f0bSmrgARM target supports the @code{-mfloat-abi=hard} option.
2013*8feb0f0bSmrg
20141debfc3dSmrg@end table
20151debfc3dSmrg
20161debfc3dSmrg@subsubsection AArch64-specific attributes
20171debfc3dSmrg
20181debfc3dSmrg@table @code
20191debfc3dSmrg@item aarch64_asm_<ext>_ok
20201debfc3dSmrgAArch64 assembler supports the architecture extension @code{ext} via the
20211debfc3dSmrg@code{.arch_extension} pseudo-op.
20221debfc3dSmrg@item aarch64_tiny
20231debfc3dSmrgAArch64 target which generates instruction sequences for tiny memory model.
20241debfc3dSmrg@item aarch64_small
20251debfc3dSmrgAArch64 target which generates instruction sequences for small memory model.
20261debfc3dSmrg@item aarch64_large
20271debfc3dSmrgAArch64 target which generates instruction sequences for large memory model.
20281debfc3dSmrg@item aarch64_little_endian
20291debfc3dSmrgAArch64 target which generates instruction sequences for little endian.
20301debfc3dSmrg@item aarch64_big_endian
20311debfc3dSmrgAArch64 target which generates instruction sequences for big endian.
20321debfc3dSmrg@item aarch64_small_fpic
20331debfc3dSmrgBinutils installed on test system supports relocation types required by -fpic
20341debfc3dSmrgfor AArch64 small memory model.
2035*8feb0f0bSmrg@item aarch64_sve_hw
2036*8feb0f0bSmrgAArch64 target that is able to generate and execute SVE code (regardless of
2037*8feb0f0bSmrgwhether it does so by default).
2038*8feb0f0bSmrg@item aarch64_sve128_hw
2039*8feb0f0bSmrg@itemx aarch64_sve256_hw
2040*8feb0f0bSmrg@itemx aarch64_sve512_hw
2041*8feb0f0bSmrg@itemx aarch64_sve1024_hw
2042*8feb0f0bSmrg@itemx aarch64_sve2048_hw
2043*8feb0f0bSmrgLike @code{aarch64_sve_hw}, but also test for an exact hardware vector length.
20441debfc3dSmrg
2045*8feb0f0bSmrg@item aarch64_fjcvtzs_hw
2046*8feb0f0bSmrgAArch64 target that is able to generate and execute armv8.3-a FJCVTZS
2047*8feb0f0bSmrginstruction.
20481debfc3dSmrg@end table
20491debfc3dSmrg
20501debfc3dSmrg@subsubsection MIPS-specific attributes
20511debfc3dSmrg
20521debfc3dSmrg@table @code
20531debfc3dSmrg@item mips64
20541debfc3dSmrgMIPS target supports 64-bit instructions.
20551debfc3dSmrg
20561debfc3dSmrg@item nomips16
20571debfc3dSmrgMIPS target does not produce MIPS16 code.
20581debfc3dSmrg
20591debfc3dSmrg@item mips16_attribute
20601debfc3dSmrgMIPS target can generate MIPS16 code.
20611debfc3dSmrg
20621debfc3dSmrg@item mips_loongson
20631debfc3dSmrgMIPS target is a Loongson-2E or -2F target using an ABI that supports
20641debfc3dSmrgthe Loongson vector modes.
20651debfc3dSmrg
20661debfc3dSmrg@item mips_msa
20671debfc3dSmrgMIPS target supports @code{-mmsa}, MIPS SIMD Architecture (MSA).
20681debfc3dSmrg
20691debfc3dSmrg@item mips_newabi_large_long_double
20701debfc3dSmrgMIPS target supports @code{long double} larger than @code{double}
20711debfc3dSmrgwhen using the new ABI.
20721debfc3dSmrg
20731debfc3dSmrg@item mpaired_single
20741debfc3dSmrgMIPS target supports @code{-mpaired-single}.
20751debfc3dSmrg@end table
20761debfc3dSmrg
20771debfc3dSmrg@subsubsection PowerPC-specific attributes
20781debfc3dSmrg
20791debfc3dSmrg@table @code
20801debfc3dSmrg
20811debfc3dSmrg@item dfp_hw
20821debfc3dSmrgPowerPC target supports executing hardware DFP instructions.
20831debfc3dSmrg
20841debfc3dSmrg@item p8vector_hw
20851debfc3dSmrgPowerPC target supports executing VSX instructions (ISA 2.07).
20861debfc3dSmrg
20871debfc3dSmrg@item powerpc64
20881debfc3dSmrgTest system supports executing 64-bit instructions.
20891debfc3dSmrg
20901debfc3dSmrg@item powerpc_altivec
20911debfc3dSmrgPowerPC target supports AltiVec.
20921debfc3dSmrg
20931debfc3dSmrg@item powerpc_altivec_ok
20941debfc3dSmrgPowerPC target supports @code{-maltivec}.
20951debfc3dSmrg
20961debfc3dSmrg@item powerpc_eabi_ok
20971debfc3dSmrgPowerPC target supports @code{-meabi}.
20981debfc3dSmrg
20991debfc3dSmrg@item powerpc_elfv2
21001debfc3dSmrgPowerPC target supports @code{-mabi=elfv2}.
21011debfc3dSmrg
21021debfc3dSmrg@item powerpc_fprs
21031debfc3dSmrgPowerPC target supports floating-point registers.
21041debfc3dSmrg
21051debfc3dSmrg@item powerpc_hard_double
21061debfc3dSmrgPowerPC target supports hardware double-precision floating-point.
21071debfc3dSmrg
21081debfc3dSmrg@item powerpc_htm_ok
21091debfc3dSmrgPowerPC target supports @code{-mhtm}
21101debfc3dSmrg
21111debfc3dSmrg@item powerpc_p8vector_ok
21121debfc3dSmrgPowerPC target supports @code{-mpower8-vector}
21131debfc3dSmrg
21141debfc3dSmrg@item powerpc_popcntb_ok
21151debfc3dSmrgPowerPC target supports the @code{popcntb} instruction, indicating
21161debfc3dSmrgthat this target supports @code{-mcpu=power5}.
21171debfc3dSmrg
21181debfc3dSmrg@item powerpc_ppu_ok
21191debfc3dSmrgPowerPC target supports @code{-mcpu=cell}.
21201debfc3dSmrg
21211debfc3dSmrg@item powerpc_spe
21221debfc3dSmrgPowerPC target supports PowerPC SPE.
21231debfc3dSmrg
21241debfc3dSmrg@item powerpc_spe_nocache
21251debfc3dSmrgIncluding the options used to compile this particular test, the
21261debfc3dSmrgPowerPC target supports PowerPC SPE.
21271debfc3dSmrg
21281debfc3dSmrg@item powerpc_spu
21291debfc3dSmrgPowerPC target supports PowerPC SPU.
21301debfc3dSmrg
21311debfc3dSmrg@item powerpc_vsx_ok
21321debfc3dSmrgPowerPC target supports @code{-mvsx}.
21331debfc3dSmrg
21341debfc3dSmrg@item powerpc_405_nocache
21351debfc3dSmrgIncluding the options used to compile this particular test, the
21361debfc3dSmrgPowerPC target supports PowerPC 405.
21371debfc3dSmrg
21381debfc3dSmrg@item ppc_recip_hw
21391debfc3dSmrgPowerPC target supports executing reciprocal estimate instructions.
21401debfc3dSmrg
21411debfc3dSmrg@item vmx_hw
21421debfc3dSmrgPowerPC target supports executing AltiVec instructions.
21431debfc3dSmrg
21441debfc3dSmrg@item vsx_hw
21451debfc3dSmrgPowerPC target supports executing VSX instructions (ISA 2.06).
21461debfc3dSmrg@end table
21471debfc3dSmrg
21481debfc3dSmrg@subsubsection Other hardware attributes
21491debfc3dSmrg
2150a2dc1f3fSmrg@c Please keep this table sorted alphabetically.
21511debfc3dSmrg@table @code
2152a2dc1f3fSmrg@item autoincdec
2153a2dc1f3fSmrgTarget supports autoincrement/decrement addressing.
2154a2dc1f3fSmrg
21551debfc3dSmrg@item avx
21561debfc3dSmrgTarget supports compiling @code{avx} instructions.
21571debfc3dSmrg
21581debfc3dSmrg@item avx_runtime
21591debfc3dSmrgTarget supports the execution of @code{avx} instructions.
21601debfc3dSmrg
2161a2dc1f3fSmrg@item avx2
2162a2dc1f3fSmrgTarget supports compiling @code{avx2} instructions.
2163a2dc1f3fSmrg
2164a2dc1f3fSmrg@item avx2_runtime
2165a2dc1f3fSmrgTarget supports the execution of @code{avx2} instructions.
2166a2dc1f3fSmrg
2167a2dc1f3fSmrg@item avx512f
2168a2dc1f3fSmrgTarget supports compiling @code{avx512f} instructions.
2169a2dc1f3fSmrg
2170a2dc1f3fSmrg@item avx512f_runtime
2171a2dc1f3fSmrgTarget supports the execution of @code{avx512f} instructions.
2172a2dc1f3fSmrg
2173*8feb0f0bSmrg@item avx512vp2intersect
2174*8feb0f0bSmrgTarget supports the execution of @code{avx512vp2intersect} instructions.
2175*8feb0f0bSmrg
21761debfc3dSmrg@item cell_hw
21771debfc3dSmrgTest system can execute AltiVec and Cell PPU instructions.
21781debfc3dSmrg
21791debfc3dSmrg@item coldfire_fpu
21801debfc3dSmrgTarget uses a ColdFire FPU.
21811debfc3dSmrg
2182a2dc1f3fSmrg@item divmod
2183a2dc1f3fSmrgTarget supporting hardware divmod insn or divmod libcall.
2184a2dc1f3fSmrg
2185a2dc1f3fSmrg@item divmod_simode
2186a2dc1f3fSmrgTarget supporting hardware divmod insn or divmod libcall for SImode.
2187a2dc1f3fSmrg
21881debfc3dSmrg@item hard_float
21891debfc3dSmrgTarget supports FPU instructions.
21901debfc3dSmrg
21911debfc3dSmrg@item non_strict_align
21921debfc3dSmrgTarget does not require strict alignment.
21931debfc3dSmrg
2194a2dc1f3fSmrg@item pie_copyreloc
2195a2dc1f3fSmrgThe x86-64 target linker supports PIE with copy reloc.
2196a2dc1f3fSmrg
2197a2dc1f3fSmrg@item rdrand
2198a2dc1f3fSmrgTarget supports x86 @code{rdrand} instruction.
2199a2dc1f3fSmrg
22001debfc3dSmrg@item sqrt_insn
22011debfc3dSmrgTarget has a square root instruction that the compiler can generate.
22021debfc3dSmrg
22031debfc3dSmrg@item sse
22041debfc3dSmrgTarget supports compiling @code{sse} instructions.
22051debfc3dSmrg
22061debfc3dSmrg@item sse_runtime
22071debfc3dSmrgTarget supports the execution of @code{sse} instructions.
22081debfc3dSmrg
22091debfc3dSmrg@item sse2
22101debfc3dSmrgTarget supports compiling @code{sse2} instructions.
22111debfc3dSmrg
22121debfc3dSmrg@item sse2_runtime
22131debfc3dSmrgTarget supports the execution of @code{sse2} instructions.
22141debfc3dSmrg
22151debfc3dSmrg@item sync_char_short
22161debfc3dSmrgTarget supports atomic operations on @code{char} and @code{short}.
22171debfc3dSmrg
22181debfc3dSmrg@item sync_int_long
22191debfc3dSmrgTarget supports atomic operations on @code{int} and @code{long}.
22201debfc3dSmrg
22211debfc3dSmrg@item ultrasparc_hw
22221debfc3dSmrgTest environment appears to run executables on a simulator that
22231debfc3dSmrgaccepts only @code{EM_SPARC} executables and chokes on @code{EM_SPARC32PLUS}
22241debfc3dSmrgor @code{EM_SPARCV9} executables.
22251debfc3dSmrg
22261debfc3dSmrg@item vect_cmdline_needed
22271debfc3dSmrgTarget requires a command line argument to enable a SIMD instruction set.
22281debfc3dSmrg
2229a2dc1f3fSmrg@item xorsign
2230a2dc1f3fSmrgTarget supports the xorsign optab expansion.
22311debfc3dSmrg
22321debfc3dSmrg@end table
22331debfc3dSmrg
22341debfc3dSmrg@subsubsection Environment attributes
22351debfc3dSmrg
22361debfc3dSmrg@table @code
22371debfc3dSmrg@item c
22381debfc3dSmrgThe language for the compiler under test is C.
22391debfc3dSmrg
22401debfc3dSmrg@item c++
22411debfc3dSmrgThe language for the compiler under test is C++.
22421debfc3dSmrg
22431debfc3dSmrg@item c99_runtime
22441debfc3dSmrgTarget provides a full C99 runtime.
22451debfc3dSmrg
22461debfc3dSmrg@item correct_iso_cpp_string_wchar_protos
22471debfc3dSmrgTarget @code{string.h} and @code{wchar.h} headers provide C++ required
22481debfc3dSmrgoverloads for @code{strchr} etc. functions.
22491debfc3dSmrg
2250c0a68be4Smrg@item d_runtime
2251c0a68be4SmrgTarget provides the D runtime.
2252c0a68be4Smrg
2253*8feb0f0bSmrg@item d_runtime_has_std_library
2254*8feb0f0bSmrgTarget provides the D standard library (Phobos).
2255*8feb0f0bSmrg
22561debfc3dSmrg@item dummy_wcsftime
22571debfc3dSmrgTarget uses a dummy @code{wcsftime} function that always returns zero.
22581debfc3dSmrg
22591debfc3dSmrg@item fd_truncate
22601debfc3dSmrgTarget can truncate a file from a file descriptor, as used by
2261c0a68be4Smrg@file{libgfortran/io/unix.c:fd_truncate}; i.e.@: @code{ftruncate} or
22621debfc3dSmrg@code{chsize}.
22631debfc3dSmrg
2264c0a68be4Smrg@item fenv
2265c0a68be4SmrgTarget provides @file{fenv.h} include file.
2266c0a68be4Smrg
2267c0a68be4Smrg@item fenv_exceptions
2268c0a68be4SmrgTarget supports @file{fenv.h} with all the standard IEEE exceptions
2269c0a68be4Smrgand floating-point exceptions are raised by arithmetic operations.
2270c0a68be4Smrg
2271*8feb0f0bSmrg@item fileio
2272*8feb0f0bSmrgTarget offers such file I/O library functions as @code{fopen},
2273*8feb0f0bSmrg@code{fclose}, @code{tmpnam}, and @code{remove}.  This is a link-time
2274*8feb0f0bSmrgrequirement for the presence of the functions in the library; even if
2275*8feb0f0bSmrgthey fail at runtime, the requirement is still regarded as satisfied.
2276*8feb0f0bSmrg
22771debfc3dSmrg@item freestanding
22781debfc3dSmrgTarget is @samp{freestanding} as defined in section 4 of the C99 standard.
22791debfc3dSmrgEffectively, it is a target which supports no extra headers or libraries
22801debfc3dSmrgother than what is considered essential.
22811debfc3dSmrg
22821debfc3dSmrg@item gettimeofday
22831debfc3dSmrgTarget supports @code{gettimeofday}.
22841debfc3dSmrg
22851debfc3dSmrg@item init_priority
22861debfc3dSmrgTarget supports constructors with initialization priority arguments.
22871debfc3dSmrg
22881debfc3dSmrg@item inttypes_types
22891debfc3dSmrgTarget has the basic signed and unsigned types in @code{inttypes.h}.
22901debfc3dSmrgThis is for tests that GCC's notions of these types agree with those
22911debfc3dSmrgin the header, as some systems have only @code{inttypes.h}.
22921debfc3dSmrg
22931debfc3dSmrg@item lax_strtofp
22941debfc3dSmrgTarget might have errors of a few ULP in string to floating-point
22951debfc3dSmrgconversion functions and overflow is not always detected correctly by
22961debfc3dSmrgthose functions.
22971debfc3dSmrg
22981debfc3dSmrg@item mempcpy
22991debfc3dSmrgTarget provides @code{mempcpy} function.
23001debfc3dSmrg
23011debfc3dSmrg@item mmap
23021debfc3dSmrgTarget supports @code{mmap}.
23031debfc3dSmrg
23041debfc3dSmrg@item newlib
23051debfc3dSmrgTarget supports Newlib.
23061debfc3dSmrg
2307c0a68be4Smrg@item newlib_nano_io
2308c0a68be4SmrgGCC was configured with @code{--enable-newlib-nano-formatted-io}, which reduces
2309c0a68be4Smrgthe code size of Newlib formatted I/O functions.
2310c0a68be4Smrg
23111debfc3dSmrg@item pow10
23121debfc3dSmrgTarget provides @code{pow10} function.
23131debfc3dSmrg
23141debfc3dSmrg@item pthread
23151debfc3dSmrgTarget can compile using @code{pthread.h} with no errors or warnings.
23161debfc3dSmrg
23171debfc3dSmrg@item pthread_h
23181debfc3dSmrgTarget has @code{pthread.h}.
23191debfc3dSmrg
23201debfc3dSmrg@item run_expensive_tests
23211debfc3dSmrgExpensive testcases (usually those that consume excessive amounts of CPU
23221debfc3dSmrgtime) should be run on this target.  This can be enabled by setting the
23231debfc3dSmrg@env{GCC_TEST_RUN_EXPENSIVE} environment variable to a non-empty string.
23241debfc3dSmrg
23251debfc3dSmrg@item simulator
2326c0a68be4SmrgTest system runs executables on a simulator (i.e.@: slowly) rather than
2327c0a68be4Smrghardware (i.e.@: fast).
23281debfc3dSmrg
2329a2dc1f3fSmrg@item signal
2330a2dc1f3fSmrgTarget has @code{signal.h}.
2331a2dc1f3fSmrg
23321debfc3dSmrg@item stabs
23331debfc3dSmrgTarget supports the stabs debugging format.
23341debfc3dSmrg
23351debfc3dSmrg@item stdint_types
23361debfc3dSmrgTarget has the basic signed and unsigned C types in @code{stdint.h}.
23371debfc3dSmrgThis will be obsolete when GCC ensures a working @code{stdint.h} for
23381debfc3dSmrgall targets.
23391debfc3dSmrg
23401debfc3dSmrg@item stpcpy
23411debfc3dSmrgTarget provides @code{stpcpy} function.
23421debfc3dSmrg
23431debfc3dSmrg@item trampolines
23441debfc3dSmrgTarget supports trampolines.
23451debfc3dSmrg
23461debfc3dSmrg@item uclibc
23471debfc3dSmrgTarget supports uClibc.
23481debfc3dSmrg
23491debfc3dSmrg@item unwrapped
23501debfc3dSmrgTarget does not use a status wrapper.
23511debfc3dSmrg
23521debfc3dSmrg@item vxworks_kernel
23531debfc3dSmrgTarget is a VxWorks kernel.
23541debfc3dSmrg
23551debfc3dSmrg@item vxworks_rtp
23561debfc3dSmrgTarget is a VxWorks RTP.
23571debfc3dSmrg
23581debfc3dSmrg@item wchar
23591debfc3dSmrgTarget supports wide characters.
23601debfc3dSmrg@end table
23611debfc3dSmrg
23621debfc3dSmrg@subsubsection Other attributes
23631debfc3dSmrg
23641debfc3dSmrg@table @code
23651debfc3dSmrg@item automatic_stack_alignment
23661debfc3dSmrgTarget supports automatic stack alignment.
23671debfc3dSmrg
2368a2dc1f3fSmrg@item branch_cost
2369a2dc1f3fSmrgTarget supports @option{-branch-cost=N}.
23701debfc3dSmrg
23711debfc3dSmrg@item cxa_atexit
23721debfc3dSmrgTarget uses @code{__cxa_atexit}.
23731debfc3dSmrg
23741debfc3dSmrg@item default_packed
23751debfc3dSmrgTarget has packed layout of structure members by default.
23761debfc3dSmrg
2377c0a68be4Smrg@item exceptions
2378c0a68be4SmrgTarget supports exceptions.
2379c0a68be4Smrg
2380*8feb0f0bSmrg@item exceptions_enabled
2381*8feb0f0bSmrgTarget supports exceptions and they are enabled in the current
2382*8feb0f0bSmrgtesting configuration.
2383*8feb0f0bSmrg
23841debfc3dSmrg@item fgraphite
23851debfc3dSmrgTarget supports Graphite optimizations.
23861debfc3dSmrg
23871debfc3dSmrg@item fixed_point
23881debfc3dSmrgTarget supports fixed-point extension to C.
23891debfc3dSmrg
23901debfc3dSmrg@item fopenacc
23911debfc3dSmrgTarget supports OpenACC via @option{-fopenacc}.
23921debfc3dSmrg
23931debfc3dSmrg@item fopenmp
23941debfc3dSmrgTarget supports OpenMP via @option{-fopenmp}.
23951debfc3dSmrg
23961debfc3dSmrg@item fpic
23971debfc3dSmrgTarget supports @option{-fpic} and @option{-fPIC}.
23981debfc3dSmrg
23991debfc3dSmrg@item freorder
24001debfc3dSmrgTarget supports @option{-freorder-blocks-and-partition}.
24011debfc3dSmrg
24021debfc3dSmrg@item fstack_protector
24031debfc3dSmrgTarget supports @option{-fstack-protector}.
24041debfc3dSmrg
24051debfc3dSmrg@item gas
24061debfc3dSmrgTarget uses GNU @command{as}.
24071debfc3dSmrg
24081debfc3dSmrg@item gc_sections
24091debfc3dSmrgTarget supports @option{--gc-sections}.
24101debfc3dSmrg
24111debfc3dSmrg@item gld
24121debfc3dSmrgTarget uses GNU @command{ld}.
24131debfc3dSmrg
24141debfc3dSmrg@item keeps_null_pointer_checks
24151debfc3dSmrgTarget keeps null pointer checks, either due to the use of
24161debfc3dSmrg@option{-fno-delete-null-pointer-checks} or hardwired into the target.
24171debfc3dSmrg
2418c0a68be4Smrg@item llvm_binutils
2419c0a68be4SmrgTarget is using an LLVM assembler and/or linker, instead of GNU Binutils.
2420c0a68be4Smrg
24211debfc3dSmrg@item lto
24221debfc3dSmrgCompiler has been configured to support link-time optimization (LTO).
24231debfc3dSmrg
2424c0a68be4Smrg@item lto_incremental
2425c0a68be4SmrgCompiler and linker support link-time optimization relocatable linking
2426c0a68be4Smrgwith @option{-r} and @option{-flto} options.
2427c0a68be4Smrg
24281debfc3dSmrg@item naked_functions
24291debfc3dSmrgTarget supports the @code{naked} function attribute.
24301debfc3dSmrg
24311debfc3dSmrg@item named_sections
24321debfc3dSmrgTarget supports named sections.
24331debfc3dSmrg
24341debfc3dSmrg@item natural_alignment_32
24351debfc3dSmrgTarget uses natural alignment (aligned to type size) for types of
24361debfc3dSmrg32 bits or less.
24371debfc3dSmrg
24381debfc3dSmrg@item target_natural_alignment_64
24391debfc3dSmrgTarget uses natural alignment (aligned to type size) for types of
24401debfc3dSmrg64 bits or less.
24411debfc3dSmrg
2442*8feb0f0bSmrg@item noinit
2443*8feb0f0bSmrgTarget supports the @code{noinit} variable attribute.
2444*8feb0f0bSmrg
24451debfc3dSmrg@item nonpic
24461debfc3dSmrgTarget does not generate PIC by default.
24471debfc3dSmrg
2448c0a68be4Smrg@item offload_gcn
2449c0a68be4SmrgTarget has been configured for OpenACC/OpenMP offloading on AMD GCN.
2450c0a68be4Smrg
24511debfc3dSmrg@item pie_enabled
24521debfc3dSmrgTarget generates PIE by default.
24531debfc3dSmrg
24541debfc3dSmrg@item pcc_bitfield_type_matters
24551debfc3dSmrgTarget defines @code{PCC_BITFIELD_TYPE_MATTERS}.
24561debfc3dSmrg
24571debfc3dSmrg@item pe_aligned_commons
24581debfc3dSmrgTarget supports @option{-mpe-aligned-commons}.
24591debfc3dSmrg
24601debfc3dSmrg@item pie
24611debfc3dSmrgTarget supports @option{-pie}, @option{-fpie} and @option{-fPIE}.
24621debfc3dSmrg
24631debfc3dSmrg@item rdynamic
24641debfc3dSmrgTarget supports @option{-rdynamic}.
24651debfc3dSmrg
2466c0a68be4Smrg@item scalar_all_fma
2467c0a68be4SmrgTarget supports all four fused multiply-add optabs for both @code{float}
2468c0a68be4Smrgand @code{double}.  These optabs are: @code{fma_optab}, @code{fms_optab},
2469c0a68be4Smrg@code{fnma_optab} and @code{fnms_optab}.
2470c0a68be4Smrg
24711debfc3dSmrg@item section_anchors
24721debfc3dSmrgTarget supports section anchors.
24731debfc3dSmrg
24741debfc3dSmrg@item short_enums
24751debfc3dSmrgTarget defaults to short enums.
24761debfc3dSmrg
2477a2dc1f3fSmrg@item stack_size
2478a2dc1f3fSmrg@anchor{stack_size_et}
2479a2dc1f3fSmrgTarget has limited stack size.  The stack size limit can be obtained using the
2480a2dc1f3fSmrgSTACK_SIZE macro defined by @ref{stack_size_ao,,@code{dg-add-options} feature
2481a2dc1f3fSmrg@code{stack_size}}.
2482a2dc1f3fSmrg
24831debfc3dSmrg@item static
24841debfc3dSmrgTarget supports @option{-static}.
24851debfc3dSmrg
24861debfc3dSmrg@item static_libgfortran
24871debfc3dSmrgTarget supports statically linking @samp{libgfortran}.
24881debfc3dSmrg
24891debfc3dSmrg@item string_merging
24901debfc3dSmrgTarget supports merging string constants at link time.
24911debfc3dSmrg
24921debfc3dSmrg@item ucn
24931debfc3dSmrgTarget supports compiling and assembling UCN.
24941debfc3dSmrg
24951debfc3dSmrg@item ucn_nocache
24961debfc3dSmrgIncluding the options used to compile this particular test, the
24971debfc3dSmrgtarget supports compiling and assembling UCN.
24981debfc3dSmrg
24991debfc3dSmrg@item unaligned_stack
25001debfc3dSmrgTarget does not guarantee that its @code{STACK_BOUNDARY} is greater than
25011debfc3dSmrgor equal to the required vector alignment.
25021debfc3dSmrg
25031debfc3dSmrg@item vector_alignment_reachable
25041debfc3dSmrgVector alignment is reachable for types of 32 bits or less.
25051debfc3dSmrg
25061debfc3dSmrg@item vector_alignment_reachable_for_64bit
25071debfc3dSmrgVector alignment is reachable for types of 64 bits or less.
25081debfc3dSmrg
25091debfc3dSmrg@item wchar_t_char16_t_compatible
25101debfc3dSmrgTarget supports @code{wchar_t} that is compatible with @code{char16_t}.
25111debfc3dSmrg
25121debfc3dSmrg@item wchar_t_char32_t_compatible
25131debfc3dSmrgTarget supports @code{wchar_t} that is compatible with @code{char32_t}.
25141debfc3dSmrg
25151debfc3dSmrg@item comdat_group
25161debfc3dSmrgTarget uses comdat groups.
2517*8feb0f0bSmrg
2518*8feb0f0bSmrg@item indirect_calls
2519*8feb0f0bSmrgTarget supports indirect calls, i.e. calls where the target is not
2520*8feb0f0bSmrgconstant.
25211debfc3dSmrg@end table
25221debfc3dSmrg
25231debfc3dSmrg@subsubsection Local to tests in @code{gcc.target/i386}
25241debfc3dSmrg
25251debfc3dSmrg@table @code
25261debfc3dSmrg@item 3dnow
25271debfc3dSmrgTarget supports compiling @code{3dnow} instructions.
25281debfc3dSmrg
25291debfc3dSmrg@item aes
25301debfc3dSmrgTarget supports compiling @code{aes} instructions.
25311debfc3dSmrg
25321debfc3dSmrg@item fma4
25331debfc3dSmrgTarget supports compiling @code{fma4} instructions.
25341debfc3dSmrg
2535c0a68be4Smrg@item mfentry
2536c0a68be4SmrgTarget supports the @code{-mfentry} option that alters the
2537c0a68be4Smrgposition of profiling calls such that they precede the prologue.
2538c0a68be4Smrg
25391debfc3dSmrg@item ms_hook_prologue
25401debfc3dSmrgTarget supports attribute @code{ms_hook_prologue}.
25411debfc3dSmrg
25421debfc3dSmrg@item pclmul
25431debfc3dSmrgTarget supports compiling @code{pclmul} instructions.
25441debfc3dSmrg
25451debfc3dSmrg@item sse3
25461debfc3dSmrgTarget supports compiling @code{sse3} instructions.
25471debfc3dSmrg
25481debfc3dSmrg@item sse4
25491debfc3dSmrgTarget supports compiling @code{sse4} instructions.
25501debfc3dSmrg
25511debfc3dSmrg@item sse4a
25521debfc3dSmrgTarget supports compiling @code{sse4a} instructions.
25531debfc3dSmrg
25541debfc3dSmrg@item ssse3
25551debfc3dSmrgTarget supports compiling @code{ssse3} instructions.
25561debfc3dSmrg
25571debfc3dSmrg@item vaes
25581debfc3dSmrgTarget supports compiling @code{vaes} instructions.
25591debfc3dSmrg
25601debfc3dSmrg@item vpclmul
25611debfc3dSmrgTarget supports compiling @code{vpclmul} instructions.
25621debfc3dSmrg
25631debfc3dSmrg@item xop
25641debfc3dSmrgTarget supports compiling @code{xop} instructions.
25651debfc3dSmrg@end table
25661debfc3dSmrg
25671debfc3dSmrg@subsubsection Local to tests in @code{gcc.test-framework}
25681debfc3dSmrg
25691debfc3dSmrg@table @code
25701debfc3dSmrg@item no
25711debfc3dSmrgAlways returns 0.
25721debfc3dSmrg
25731debfc3dSmrg@item yes
25741debfc3dSmrgAlways returns 1.
25751debfc3dSmrg@end table
25761debfc3dSmrg
25771debfc3dSmrg@node Add Options
25781debfc3dSmrg@subsection Features for @code{dg-add-options}
25791debfc3dSmrg
25801debfc3dSmrgThe supported values of @var{feature} for directive @code{dg-add-options}
25811debfc3dSmrgare:
25821debfc3dSmrg
25831debfc3dSmrg@table @code
25841debfc3dSmrg@item arm_fp
25851debfc3dSmrg@code{__ARM_FP} definition.  Only ARM targets support this feature, and only then
25861debfc3dSmrgin certain modes; see the @ref{arm_fp_ok,,arm_fp_ok effective target
25871debfc3dSmrgkeyword}.
25881debfc3dSmrg
2589*8feb0f0bSmrg@item arm_fp_dp
2590*8feb0f0bSmrg@code{__ARM_FP} definition with double-precision support.  Only ARM
2591*8feb0f0bSmrgtargets support this feature, and only then in certain modes; see the
2592*8feb0f0bSmrg@ref{arm_fp_dp_ok,,arm_fp_dp_ok effective target keyword}.
2593*8feb0f0bSmrg
25941debfc3dSmrg@item arm_neon
25951debfc3dSmrgNEON support.  Only ARM targets support this feature, and only then
25961debfc3dSmrgin certain modes; see the @ref{arm_neon_ok,,arm_neon_ok effective target
25971debfc3dSmrgkeyword}.
25981debfc3dSmrg
25991debfc3dSmrg@item arm_fp16
26001debfc3dSmrgVFP half-precision floating point support.  This does not select the
26011debfc3dSmrgFP16 format; for that, use @ref{arm_fp16_ieee,,arm_fp16_ieee} or
26021debfc3dSmrg@ref{arm_fp16_alternative,,arm_fp16_alternative} instead.  This
26031debfc3dSmrgfeature is only supported by ARM targets and then only in certain
26041debfc3dSmrgmodes; see the @ref{arm_fp16_ok,,arm_fp16_ok effective target
26051debfc3dSmrgkeyword}.
26061debfc3dSmrg
26071debfc3dSmrg@item arm_fp16_ieee
26081debfc3dSmrg@anchor{arm_fp16_ieee}
26091debfc3dSmrgARM IEEE 754-2008 format VFP half-precision floating point support.
26101debfc3dSmrgThis feature is only supported by ARM targets and then only in certain
26111debfc3dSmrgmodes; see the @ref{arm_fp16_ok,,arm_fp16_ok effective target
26121debfc3dSmrgkeyword}.
26131debfc3dSmrg
26141debfc3dSmrg@item arm_fp16_alternative
26151debfc3dSmrg@anchor{arm_fp16_alternative}
26161debfc3dSmrgARM Alternative format VFP half-precision floating point support.
26171debfc3dSmrgThis feature is only supported by ARM targets and then only in certain
26181debfc3dSmrgmodes; see the @ref{arm_fp16_ok,,arm_fp16_ok effective target
26191debfc3dSmrgkeyword}.
26201debfc3dSmrg
26211debfc3dSmrg@item arm_neon_fp16
26221debfc3dSmrgNEON and half-precision floating point support.  Only ARM targets
26231debfc3dSmrgsupport this feature, and only then in certain modes; see
26241debfc3dSmrgthe @ref{arm_neon_fp16_ok,,arm_neon_fp16_ok effective target keyword}.
26251debfc3dSmrg
26261debfc3dSmrg@item arm_vfp3
26271debfc3dSmrgarm vfp3 floating point support; see
26281debfc3dSmrgthe @ref{arm_vfp3_ok,,arm_vfp3_ok effective target keyword}.
26291debfc3dSmrg
2630*8feb0f0bSmrg@item arm_arch_v8a_hard
2631*8feb0f0bSmrgAdd options for ARMv8-A and the hard-float variant of the AAPCS,
2632*8feb0f0bSmrgif this is supported by the compiler; see the
2633*8feb0f0bSmrg@ref{arm_arch_v8a_hard_ok,,arm_arch_v8a_hard_ok} effective target keyword.
2634*8feb0f0bSmrg
26351debfc3dSmrg@item arm_v8_1a_neon
2636a2dc1f3fSmrgAdd options for ARMv8.1-A with Adv.SIMD support, if this is supported
26371debfc3dSmrgby the target; see the @ref{arm_v8_1a_neon_ok,,arm_v8_1a_neon_ok}
26381debfc3dSmrgeffective target keyword.
26391debfc3dSmrg
26401debfc3dSmrg@item arm_v8_2a_fp16_scalar
2641a2dc1f3fSmrgAdd options for ARMv8.2-A with scalar FP16 support, if this is
26421debfc3dSmrgsupported by the target; see the
26431debfc3dSmrg@ref{arm_v8_2a_fp16_scalar_ok,,arm_v8_2a_fp16_scalar_ok} effective
26441debfc3dSmrgtarget keyword.
26451debfc3dSmrg
26461debfc3dSmrg@item arm_v8_2a_fp16_neon
2647a2dc1f3fSmrgAdd options for ARMv8.2-A with Adv.SIMD FP16 support, if this is
26481debfc3dSmrgsupported by the target; see the
26491debfc3dSmrg@ref{arm_v8_2a_fp16_neon_ok,,arm_v8_2a_fp16_neon_ok} effective target
26501debfc3dSmrgkeyword.
26511debfc3dSmrg
2652a2dc1f3fSmrg@item arm_v8_2a_dotprod_neon
2653a2dc1f3fSmrgAdd options for ARMv8.2-A with Adv.SIMD Dot Product support, if this is
2654a2dc1f3fSmrgsupported by the target; see the
2655a2dc1f3fSmrg@ref{arm_v8_2a_dotprod_neon_ok} effective target keyword.
2656a2dc1f3fSmrg
2657a2dc1f3fSmrg@item arm_fp16fml_neon
2658a2dc1f3fSmrgAdd options to enable generation of the @code{VFMAL} and @code{VFMSL}
2659a2dc1f3fSmrginstructions, if this is supported by the target; see the
2660a2dc1f3fSmrg@ref{arm_fp16fml_neon_ok} effective target keyword.
2661a2dc1f3fSmrg
26621debfc3dSmrg@item bind_pic_locally
26631debfc3dSmrgAdd the target-specific flags needed to enable functions to bind
26641debfc3dSmrglocally when using pic/PIC passes in the testsuite.
26651debfc3dSmrg
26661debfc3dSmrg@item float@var{n}
26671debfc3dSmrgAdd the target-specific flags needed to use the @code{_Float@var{n}} type.
26681debfc3dSmrg
26691debfc3dSmrg@item float@var{n}x
26701debfc3dSmrgAdd the target-specific flags needed to use the @code{_Float@var{n}x} type.
26711debfc3dSmrg
26721debfc3dSmrg@item ieee
26731debfc3dSmrgAdd the target-specific flags needed to enable full IEEE
26741debfc3dSmrgcompliance mode.
26751debfc3dSmrg
26761debfc3dSmrg@item mips16_attribute
26771debfc3dSmrg@code{mips16} function attributes.
26781debfc3dSmrgOnly MIPS targets support this feature, and only then in certain modes.
26791debfc3dSmrg
2680a2dc1f3fSmrg@item stack_size
2681a2dc1f3fSmrg@anchor{stack_size_ao}
2682a2dc1f3fSmrgAdd the flags needed to define macro STACK_SIZE and set it to the stack size
2683a2dc1f3fSmrglimit associated with the @ref{stack_size_et,,@code{stack_size} effective
2684a2dc1f3fSmrgtarget}.
2685a2dc1f3fSmrg
2686c0a68be4Smrg@item sqrt_insn
2687c0a68be4SmrgAdd the target-specific flags needed to enable hardware square root
2688c0a68be4Smrginstructions, if any.
2689c0a68be4Smrg
26901debfc3dSmrg@item tls
26911debfc3dSmrgAdd the target-specific flags needed to use thread-local storage.
26921debfc3dSmrg@end table
26931debfc3dSmrg
26941debfc3dSmrg@node Require Support
26951debfc3dSmrg@subsection Variants of @code{dg-require-@var{support}}
26961debfc3dSmrg
26971debfc3dSmrgA few of the @code{dg-require} directives take arguments.
26981debfc3dSmrg
26991debfc3dSmrg@table @code
27001debfc3dSmrg@item dg-require-iconv @var{codeset}
27011debfc3dSmrgSkip the test if the target does not support iconv.  @var{codeset} is
27021debfc3dSmrgthe codeset to convert to.
27031debfc3dSmrg
27041debfc3dSmrg@item dg-require-profiling @var{profopt}
27051debfc3dSmrgSkip the test if the target does not support profiling with option
27061debfc3dSmrg@var{profopt}.
27071debfc3dSmrg
2708a2dc1f3fSmrg@item dg-require-stack-check @var{check}
2709a2dc1f3fSmrgSkip the test if the target does not support the @code{-fstack-check}
2710a2dc1f3fSmrgoption.  If @var{check} is @code{""}, support for @code{-fstack-check}
2711a2dc1f3fSmrgis checked, for @code{-fstack-check=("@var{check}")} otherwise.
2712a2dc1f3fSmrg
2713a2dc1f3fSmrg@item dg-require-stack-size @var{size}
2714a2dc1f3fSmrgSkip the test if the target does not support a stack size of @var{size}.
2715a2dc1f3fSmrg
27161debfc3dSmrg@item dg-require-visibility @var{vis}
27171debfc3dSmrgSkip the test if the target does not support the @code{visibility} attribute.
27181debfc3dSmrgIf @var{vis} is @code{""}, support for @code{visibility("hidden")} is
27191debfc3dSmrgchecked, for @code{visibility("@var{vis}")} otherwise.
27201debfc3dSmrg@end table
27211debfc3dSmrg
27221debfc3dSmrgThe original @code{dg-require} directives were defined before there
27231debfc3dSmrgwas support for effective-target keywords.  The directives that do not
27241debfc3dSmrgtake arguments could be replaced with effective-target keywords.
27251debfc3dSmrg
27261debfc3dSmrg@table @code
27271debfc3dSmrg@item dg-require-alias ""
27281debfc3dSmrgSkip the test if the target does not support the @samp{alias} attribute.
27291debfc3dSmrg
27301debfc3dSmrg@item dg-require-ascii-locale ""
27311debfc3dSmrgSkip the test if the host does not support an ASCII locale.
27321debfc3dSmrg
27331debfc3dSmrg@item dg-require-compat-dfp ""
27341debfc3dSmrgSkip this test unless both compilers in a @file{compat} testsuite
27351debfc3dSmrgsupport decimal floating point.
27361debfc3dSmrg
27371debfc3dSmrg@item dg-require-cxa-atexit ""
27381debfc3dSmrgSkip the test if the target does not support @code{__cxa_atexit}.
27391debfc3dSmrgThis is equivalent to @code{dg-require-effective-target cxa_atexit}.
27401debfc3dSmrg
27411debfc3dSmrg@item dg-require-dll ""
27421debfc3dSmrgSkip the test if the target does not support DLL attributes.
27431debfc3dSmrg
2744*8feb0f0bSmrg@item dg-require-dot ""
2745*8feb0f0bSmrgSkip the test if the host does not have @command{dot}.
2746*8feb0f0bSmrg
27471debfc3dSmrg@item dg-require-fork ""
27481debfc3dSmrgSkip the test if the target does not support @code{fork}.
27491debfc3dSmrg
27501debfc3dSmrg@item dg-require-gc-sections ""
27511debfc3dSmrgSkip the test if the target's linker does not support the
27521debfc3dSmrg@code{--gc-sections} flags.
27531debfc3dSmrgThis is equivalent to @code{dg-require-effective-target gc-sections}.
27541debfc3dSmrg
27551debfc3dSmrg@item dg-require-host-local ""
27561debfc3dSmrgSkip the test if the host is remote, rather than the same as the build
27571debfc3dSmrgsystem.  Some tests are incompatible with DejaGnu's handling of remote
27581debfc3dSmrghosts, which involves copying the source file to the host and compiling
27591debfc3dSmrgit with a relative path and "@code{-o a.out}".
27601debfc3dSmrg
27611debfc3dSmrg@item dg-require-mkfifo ""
27621debfc3dSmrgSkip the test if the target does not support @code{mkfifo}.
27631debfc3dSmrg
27641debfc3dSmrg@item dg-require-named-sections ""
27651debfc3dSmrgSkip the test is the target does not support named sections.
27661debfc3dSmrgThis is equivalent to @code{dg-require-effective-target named_sections}.
27671debfc3dSmrg
27681debfc3dSmrg@item dg-require-weak ""
27691debfc3dSmrgSkip the test if the target does not support weak symbols.
27701debfc3dSmrg
27711debfc3dSmrg@item dg-require-weak-override ""
27721debfc3dSmrgSkip the test if the target does not support overriding weak symbols.
27731debfc3dSmrg@end table
27741debfc3dSmrg
27751debfc3dSmrg@node Final Actions
27761debfc3dSmrg@subsection Commands for use in @code{dg-final}
27771debfc3dSmrg
27781debfc3dSmrgThe GCC testsuite defines the following directives to be used within
27791debfc3dSmrg@code{dg-final}.
27801debfc3dSmrg
27811debfc3dSmrg@subsubsection Scan a particular file
27821debfc3dSmrg
27831debfc3dSmrg@table @code
27841debfc3dSmrg@item scan-file @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}]
27851debfc3dSmrgPasses if @var{regexp} matches text in @var{filename}.
27861debfc3dSmrg@item scan-file-not @var{filename} @var{regexp} [@{ target/xfail @var{selector} @}]
27871debfc3dSmrgPasses if @var{regexp} does not match text in @var{filename}.
27881debfc3dSmrg@item scan-module @var{module} @var{regexp} [@{ target/xfail @var{selector} @}]
27891debfc3dSmrgPasses if @var{regexp} matches in Fortran module @var{module}.
2790*8feb0f0bSmrg@item dg-check-dot @var{filename}
2791*8feb0f0bSmrgPasses if @var{filename} is a valid @file{.dot} file (by running
2792*8feb0f0bSmrg@code{dot -Tpng} on it, and verifying the exit code is 0).
27931debfc3dSmrg@end table
27941debfc3dSmrg
27951debfc3dSmrg@subsubsection Scan the assembly output
27961debfc3dSmrg
27971debfc3dSmrg@table @code
27981debfc3dSmrg@item scan-assembler @var{regex} [@{ target/xfail @var{selector} @}]
27991debfc3dSmrgPasses if @var{regex} matches text in the test's assembler output.
28001debfc3dSmrg
28011debfc3dSmrg@item scan-assembler-not @var{regex} [@{ target/xfail @var{selector} @}]
28021debfc3dSmrgPasses if @var{regex} does not match text in the test's assembler output.
28031debfc3dSmrg
28041debfc3dSmrg@item scan-assembler-times @var{regex} @var{num} [@{ target/xfail @var{selector} @}]
28051debfc3dSmrgPasses if @var{regex} is matched exactly @var{num} times in the test's
28061debfc3dSmrgassembler output.
28071debfc3dSmrg
28081debfc3dSmrg@item scan-assembler-dem @var{regex} [@{ target/xfail @var{selector} @}]
28091debfc3dSmrgPasses if @var{regex} matches text in the test's demangled assembler output.
28101debfc3dSmrg
28111debfc3dSmrg@item scan-assembler-dem-not @var{regex} [@{ target/xfail @var{selector} @}]
28121debfc3dSmrgPasses if @var{regex} does not match text in the test's demangled assembler
28131debfc3dSmrgoutput.
28141debfc3dSmrg
28151debfc3dSmrg@item scan-hidden @var{symbol} [@{ target/xfail @var{selector} @}]
28161debfc3dSmrgPasses if @var{symbol} is defined as a hidden symbol in the test's
28171debfc3dSmrgassembly output.
28181debfc3dSmrg
28191debfc3dSmrg@item scan-not-hidden @var{symbol} [@{ target/xfail @var{selector} @}]
28201debfc3dSmrgPasses if @var{symbol} is not defined as a hidden symbol in the test's
28211debfc3dSmrgassembly output.
2822*8feb0f0bSmrg
2823*8feb0f0bSmrg@item check-function-bodies @var{prefix} @var{terminator} [@var{options} [@{ target/xfail @var{selector} @}]]
2824*8feb0f0bSmrgLooks through the source file for comments that give the expected assembly
2825*8feb0f0bSmrgoutput for selected functions.  Each line of expected output starts with the
2826*8feb0f0bSmrgprefix string @var{prefix} and the expected output for a function as a whole
2827*8feb0f0bSmrgis followed by a line that starts with the string @var{terminator}.
2828*8feb0f0bSmrgSpecifying an empty terminator is equivalent to specifying @samp{"*/"}.
2829*8feb0f0bSmrg
2830*8feb0f0bSmrg@var{options}, if specified, is a list of regular expressions, each of
2831*8feb0f0bSmrgwhich matches a full command-line option.  A non-empty list prevents
2832*8feb0f0bSmrgthe test from running unless all of the given options are present on the
2833*8feb0f0bSmrgcommand line.  This can help if a source file is compiled both with
2834*8feb0f0bSmrgand without optimization, since it is rarely useful to check the full
2835*8feb0f0bSmrgfunction body for unoptimized code.
2836*8feb0f0bSmrg
2837*8feb0f0bSmrgThe first line of the expected output for a function @var{fn} has the form:
2838*8feb0f0bSmrg
2839*8feb0f0bSmrg@smallexample
2840*8feb0f0bSmrg@var{prefix} @var{fn}:  [@{ target/xfail @var{selector} @}]
2841*8feb0f0bSmrg@end smallexample
2842*8feb0f0bSmrg
2843*8feb0f0bSmrgSubsequent lines of the expected output also start with @var{prefix}.
2844*8feb0f0bSmrgIn both cases, whitespace after @var{prefix} is not significant.
2845*8feb0f0bSmrg
2846*8feb0f0bSmrgThe test discards assembly directives such as @code{.cfi_startproc}
2847*8feb0f0bSmrgand local label definitions such as @code{.LFB0} from the compiler's
2848*8feb0f0bSmrgassembly output.  It then matches the result against the expected
2849*8feb0f0bSmrgoutput for a function as a single regular expression.  This means that
2850*8feb0f0bSmrglater lines can use backslashes to refer back to @samp{(@dots{})}
2851*8feb0f0bSmrgcaptures on earlier lines.  For example:
2852*8feb0f0bSmrg
2853*8feb0f0bSmrg@smallexample
2854*8feb0f0bSmrg/* @{ dg-final @{ check-function-bodies "**" "" "-DCHECK_ASM" @} @} */
2855*8feb0f0bSmrg@dots{}
2856*8feb0f0bSmrg/*
2857*8feb0f0bSmrg** add_w0_s8_m:
2858*8feb0f0bSmrg**	mov	(z[0-9]+\.b), w0
2859*8feb0f0bSmrg**	add	z0\.b, p0/m, z0\.b, \1
2860*8feb0f0bSmrg**	ret
2861*8feb0f0bSmrg*/
2862*8feb0f0bSmrgsvint8_t add_w0_s8_m (@dots{}) @{ @dots{} @}
2863*8feb0f0bSmrg@dots{}
2864*8feb0f0bSmrg/*
2865*8feb0f0bSmrg** add_b0_s8_m:
2866*8feb0f0bSmrg**	mov	(z[0-9]+\.b), b0
2867*8feb0f0bSmrg**	add	z1\.b, p0/m, z1\.b, \1
2868*8feb0f0bSmrg**	ret
2869*8feb0f0bSmrg*/
2870*8feb0f0bSmrgsvint8_t add_b0_s8_m (@dots{}) @{ @dots{} @}
2871*8feb0f0bSmrg@end smallexample
2872*8feb0f0bSmrg
2873*8feb0f0bSmrgchecks whether the implementations of @code{add_w0_s8_m} and
2874*8feb0f0bSmrg@code{add_b0_s8_m} match the regular expressions given.  The test only
2875*8feb0f0bSmrgruns when @samp{-DCHECK_ASM} is passed on the command line.
2876*8feb0f0bSmrg
2877*8feb0f0bSmrgIt is possible to create non-capturing multi-line regular expression
2878*8feb0f0bSmrggroups of the form @samp{(@var{a}|@var{b}|@dots{})} by putting the
2879*8feb0f0bSmrg@samp{(}, @samp{|} and @samp{)} on separate lines (each still using
2880*8feb0f0bSmrg@var{prefix}).  For example:
2881*8feb0f0bSmrg
2882*8feb0f0bSmrg@smallexample
2883*8feb0f0bSmrg/*
2884*8feb0f0bSmrg** cmple_f16_tied:
2885*8feb0f0bSmrg** (
2886*8feb0f0bSmrg**	fcmge	p0\.h, p0/z, z1\.h, z0\.h
2887*8feb0f0bSmrg** |
2888*8feb0f0bSmrg**	fcmle	p0\.h, p0/z, z0\.h, z1\.h
2889*8feb0f0bSmrg** )
2890*8feb0f0bSmrg**	ret
2891*8feb0f0bSmrg*/
2892*8feb0f0bSmrgsvbool_t cmple_f16_tied (@dots{}) @{ @dots{} @}
2893*8feb0f0bSmrg@end smallexample
2894*8feb0f0bSmrg
2895*8feb0f0bSmrgchecks whether @code{cmple_f16_tied} is implemented by the
2896*8feb0f0bSmrg@code{fcmge} instruction followed by @code{ret} or by the
2897*8feb0f0bSmrg@code{fcmle} instruction followed by @code{ret}.  The test is
2898*8feb0f0bSmrgstill a single regular rexpression.
2899*8feb0f0bSmrg
2900*8feb0f0bSmrgA line containing just:
2901*8feb0f0bSmrg
2902*8feb0f0bSmrg@smallexample
2903*8feb0f0bSmrg@var{prefix} ...
2904*8feb0f0bSmrg@end smallexample
2905*8feb0f0bSmrg
2906*8feb0f0bSmrgstands for zero or more unmatched lines; the whitespace after
2907*8feb0f0bSmrg@var{prefix} is again not significant.
2908*8feb0f0bSmrg
29091debfc3dSmrg@end table
29101debfc3dSmrg
29111debfc3dSmrg@subsubsection Scan optimization dump files
29121debfc3dSmrg
2913c0a68be4SmrgThese commands are available for @var{kind} of @code{tree}, @code{ltrans-tree},
2914c0a68be4Smrg@code{offload-tree}, @code{rtl}, @code{offload-rtl}, @code{ipa}, and
2915c0a68be4Smrg@code{wpa-ipa}.
29161debfc3dSmrg
29171debfc3dSmrg@table @code
29181debfc3dSmrg@item scan-@var{kind}-dump @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
29191debfc3dSmrgPasses if @var{regex} matches text in the dump file with suffix @var{suffix}.
29201debfc3dSmrg
29211debfc3dSmrg@item scan-@var{kind}-dump-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
29221debfc3dSmrgPasses if @var{regex} does not match text in the dump file with suffix
29231debfc3dSmrg@var{suffix}.
29241debfc3dSmrg
29251debfc3dSmrg@item scan-@var{kind}-dump-times @var{regex} @var{num} @var{suffix} [@{ target/xfail @var{selector} @}]
29261debfc3dSmrgPasses if @var{regex} is found exactly @var{num} times in the dump file
29271debfc3dSmrgwith suffix @var{suffix}.
29281debfc3dSmrg
29291debfc3dSmrg@item scan-@var{kind}-dump-dem @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
29301debfc3dSmrgPasses if @var{regex} matches demangled text in the dump file with
29311debfc3dSmrgsuffix @var{suffix}.
29321debfc3dSmrg
29331debfc3dSmrg@item scan-@var{kind}-dump-dem-not @var{regex} @var{suffix} [@{ target/xfail @var{selector} @}]
29341debfc3dSmrgPasses if @var{regex} does not match demangled text in the dump file with
29351debfc3dSmrgsuffix @var{suffix}.
29361debfc3dSmrg@end table
29371debfc3dSmrg
2938c0a68be4Smrg@subsubsection Check for output files
29391debfc3dSmrg
29401debfc3dSmrg@table @code
29411debfc3dSmrg@item output-exists [@{ target/xfail @var{selector} @}]
29421debfc3dSmrgPasses if compiler output file exists.
29431debfc3dSmrg
29441debfc3dSmrg@item output-exists-not [@{ target/xfail @var{selector} @}]
29451debfc3dSmrgPasses if compiler output file does not exist.
29461debfc3dSmrg
29471debfc3dSmrg@item scan-symbol @var{regexp} [@{ target/xfail @var{selector} @}]
29481debfc3dSmrgPasses if the pattern is present in the final executable.
2949c0a68be4Smrg
2950c0a68be4Smrg@item scan-symbol-not @var{regexp} [@{ target/xfail @var{selector} @}]
2951c0a68be4SmrgPasses if the pattern is absent from the final executable.
29521debfc3dSmrg@end table
29531debfc3dSmrg
29541debfc3dSmrg@subsubsection Checks for @command{gcov} tests
29551debfc3dSmrg
29561debfc3dSmrg@table @code
29571debfc3dSmrg@item run-gcov @var{sourcefile}
29581debfc3dSmrgCheck line counts in @command{gcov} tests.
29591debfc3dSmrg
29601debfc3dSmrg@item run-gcov [branches] [calls] @{ @var{opts} @var{sourcefile} @}
29611debfc3dSmrgCheck branch and/or call counts, in addition to line counts, in
29621debfc3dSmrg@command{gcov} tests.
29631debfc3dSmrg@end table
29641debfc3dSmrg
29651debfc3dSmrg@subsubsection Clean up generated test files
29661debfc3dSmrg
29671debfc3dSmrgUsually the test-framework removes files that were generated during
29681debfc3dSmrgtesting. If a testcase, for example, uses any dumping mechanism to
29691debfc3dSmrginspect a passes dump file, the testsuite recognized the dump option
29701debfc3dSmrgpassed to the tool and schedules a final cleanup to remove these files.
29711debfc3dSmrg
29721debfc3dSmrgThere are, however, following additional cleanup directives that can be
29731debfc3dSmrgused to annotate a testcase "manually".
29741debfc3dSmrg@table @code
29751debfc3dSmrg@item cleanup-coverage-files
29761debfc3dSmrgRemoves coverage data files generated for this test.
29771debfc3dSmrg
29781debfc3dSmrg@item cleanup-modules "@var{list-of-extra-modules}"
29791debfc3dSmrgRemoves Fortran module files generated for this test, excluding the
29801debfc3dSmrgmodule names listed in keep-modules.
29811debfc3dSmrgCleaning up module files is usually done automatically by the testsuite
29821debfc3dSmrgby looking at the source files and removing the modules after the test
29831debfc3dSmrghas been executed.
29841debfc3dSmrg@smallexample
29851debfc3dSmrgmodule MoD1
29861debfc3dSmrgend module MoD1
29871debfc3dSmrgmodule Mod2
29881debfc3dSmrgend module Mod2
29891debfc3dSmrgmodule moD3
29901debfc3dSmrgend module moD3
29911debfc3dSmrgmodule mod4
29921debfc3dSmrgend module mod4
29931debfc3dSmrg! @{ dg-final @{ cleanup-modules "mod1 mod2" @} @} ! redundant
29941debfc3dSmrg! @{ dg-final @{ keep-modules "mod3 mod4" @} @}
29951debfc3dSmrg@end smallexample
29961debfc3dSmrg
29971debfc3dSmrg@item keep-modules "@var{list-of-modules-not-to-delete}"
29981debfc3dSmrgWhitespace separated list of module names that should not be deleted by
29991debfc3dSmrgcleanup-modules.
30001debfc3dSmrgIf the list of modules is empty, all modules defined in this file are kept.
30011debfc3dSmrg@smallexample
30021debfc3dSmrgmodule maybe_unneeded
30031debfc3dSmrgend module maybe_unneeded
30041debfc3dSmrgmodule keep1
30051debfc3dSmrgend module keep1
30061debfc3dSmrgmodule keep2
30071debfc3dSmrgend module keep2
30081debfc3dSmrg! @{ dg-final @{ keep-modules "keep1 keep2" @} @} ! just keep these two
30091debfc3dSmrg! @{ dg-final @{ keep-modules "" @} @} ! keep all
30101debfc3dSmrg@end smallexample
30111debfc3dSmrg
30121debfc3dSmrg@item dg-keep-saved-temps "@var{list-of-suffixes-not-to-delete}"
30131debfc3dSmrgWhitespace separated list of suffixes that should not be deleted
30141debfc3dSmrgautomatically in a testcase that uses @option{-save-temps}.
30151debfc3dSmrg@smallexample
30161debfc3dSmrg// @{ dg-options "-save-temps -fpch-preprocess -I." @}
30171debfc3dSmrgint main() @{ return 0; @}
30181debfc3dSmrg// @{ dg-keep-saved-temps ".s" @} ! just keep assembler file
30191debfc3dSmrg// @{ dg-keep-saved-temps ".s" ".i" @} ! ... and .i
30201debfc3dSmrg// @{ dg-keep-saved-temps ".ii" ".o" @} ! or just .ii and .o
30211debfc3dSmrg@end smallexample
30221debfc3dSmrg
30231debfc3dSmrg@item cleanup-profile-file
30241debfc3dSmrgRemoves profiling files generated for this test.
30251debfc3dSmrg
30261debfc3dSmrg@end table
30271debfc3dSmrg
30281debfc3dSmrg@node Ada Tests
30291debfc3dSmrg@section Ada Language Testsuites
30301debfc3dSmrg
30311debfc3dSmrgThe Ada testsuite includes executable tests from the ACATS
30321debfc3dSmrgtestsuite, publicly available at
30331debfc3dSmrg@uref{http://www.ada-auth.org/acats.html}.
30341debfc3dSmrg
30351debfc3dSmrgThese tests are integrated in the GCC testsuite in the
30361debfc3dSmrg@file{ada/acats} directory, and
30371debfc3dSmrgenabled automatically when running @code{make check}, assuming
30381debfc3dSmrgthe Ada language has been enabled when configuring GCC@.
30391debfc3dSmrg
30401debfc3dSmrgYou can also run the Ada testsuite independently, using
30411debfc3dSmrg@code{make check-ada}, or run a subset of the tests by specifying which
30421debfc3dSmrgchapter to run, e.g.:
30431debfc3dSmrg
30441debfc3dSmrg@smallexample
30451debfc3dSmrg$ make check-ada CHAPTERS="c3 c9"
30461debfc3dSmrg@end smallexample
30471debfc3dSmrg
30481debfc3dSmrgThe tests are organized by directory, each directory corresponding to
30491debfc3dSmrga chapter of the Ada Reference Manual.  So for example, @file{c9} corresponds
30501debfc3dSmrgto chapter 9, which deals with tasking features of the language.
30511debfc3dSmrg
30521debfc3dSmrgThe tests are run using two @command{sh} scripts: @file{run_acats} and
30531debfc3dSmrg@file{run_all.sh}.  To run the tests using a simulator or a cross
30541debfc3dSmrgtarget, see the small
30551debfc3dSmrgcustomization section at the top of @file{run_all.sh}.
30561debfc3dSmrg
30571debfc3dSmrgThese tests are run using the build tree: they can be run without doing
30581debfc3dSmrga @code{make install}.
30591debfc3dSmrg
30601debfc3dSmrg@node C Tests
30611debfc3dSmrg@section C Language Testsuites
30621debfc3dSmrg
30631debfc3dSmrgGCC contains the following C language testsuites, in the
30641debfc3dSmrg@file{gcc/testsuite} directory:
30651debfc3dSmrg
30661debfc3dSmrg@table @file
30671debfc3dSmrg@item gcc.dg
30681debfc3dSmrgThis contains tests of particular features of the C compiler, using the
30691debfc3dSmrgmore modern @samp{dg} harness.  Correctness tests for various compiler
30701debfc3dSmrgfeatures should go here if possible.
30711debfc3dSmrg
30721debfc3dSmrgMagic comments determine whether the file
30731debfc3dSmrgis preprocessed, compiled, linked or run.  In these tests, error and warning
30741debfc3dSmrgmessage texts are compared against expected texts or regular expressions
30751debfc3dSmrggiven in comments.  These tests are run with the options @samp{-ansi -pedantic}
30761debfc3dSmrgunless other options are given in the test.  Except as noted below they
30771debfc3dSmrgare not run with multiple optimization options.
30781debfc3dSmrg@item gcc.dg/compat
30791debfc3dSmrgThis subdirectory contains tests for binary compatibility using
30801debfc3dSmrg@file{lib/compat.exp}, which in turn uses the language-independent support
30811debfc3dSmrg(@pxref{compat Testing, , Support for testing binary compatibility}).
30821debfc3dSmrg@item gcc.dg/cpp
30831debfc3dSmrgThis subdirectory contains tests of the preprocessor.
30841debfc3dSmrg@item gcc.dg/debug
30851debfc3dSmrgThis subdirectory contains tests for debug formats.  Tests in this
30861debfc3dSmrgsubdirectory are run for each debug format that the compiler supports.
30871debfc3dSmrg@item gcc.dg/format
30881debfc3dSmrgThis subdirectory contains tests of the @option{-Wformat} format
30891debfc3dSmrgchecking.  Tests in this directory are run with and without
30901debfc3dSmrg@option{-DWIDE}.
30911debfc3dSmrg@item gcc.dg/noncompile
30921debfc3dSmrgThis subdirectory contains tests of code that should not compile and
30931debfc3dSmrgdoes not need any special compilation options.  They are run with
30941debfc3dSmrgmultiple optimization options, since sometimes invalid code crashes
30951debfc3dSmrgthe compiler with optimization.
30961debfc3dSmrg@item gcc.dg/special
30971debfc3dSmrgFIXME: describe this.
30981debfc3dSmrg
30991debfc3dSmrg@item gcc.c-torture
31001debfc3dSmrgThis contains particular code fragments which have historically broken easily.
31011debfc3dSmrgThese tests are run with multiple optimization options, so tests for features
31021debfc3dSmrgwhich only break at some optimization levels belong here.  This also contains
31031debfc3dSmrgtests to check that certain optimizations occur.  It might be worthwhile to
31041debfc3dSmrgseparate the correctness tests cleanly from the code quality tests, but
31051debfc3dSmrgit hasn't been done yet.
31061debfc3dSmrg
31071debfc3dSmrg@item gcc.c-torture/compat
31081debfc3dSmrgFIXME: describe this.
31091debfc3dSmrg
31101debfc3dSmrgThis directory should probably not be used for new tests.
31111debfc3dSmrg@item gcc.c-torture/compile
31121debfc3dSmrgThis testsuite contains test cases that should compile, but do not
31131debfc3dSmrgneed to link or run.  These test cases are compiled with several
31141debfc3dSmrgdifferent combinations of optimization options.  All warnings are
31151debfc3dSmrgdisabled for these test cases, so this directory is not suitable if
31161debfc3dSmrgyou wish to test for the presence or absence of compiler warnings.
31171debfc3dSmrgWhile special options can be set, and tests disabled on specific
31181debfc3dSmrgplatforms, by the use of @file{.x} files, mostly these test cases
31191debfc3dSmrgshould not contain platform dependencies.  FIXME: discuss how defines
3120a2dc1f3fSmrgsuch as @code{STACK_SIZE} are used.
31211debfc3dSmrg@item gcc.c-torture/execute
31221debfc3dSmrgThis testsuite contains test cases that should compile, link and run;
31231debfc3dSmrgotherwise the same comments as for @file{gcc.c-torture/compile} apply.
31241debfc3dSmrg@item gcc.c-torture/execute/ieee
31251debfc3dSmrgThis contains tests which are specific to IEEE floating point.
31261debfc3dSmrg@item gcc.c-torture/unsorted
31271debfc3dSmrgFIXME: describe this.
31281debfc3dSmrg
31291debfc3dSmrgThis directory should probably not be used for new tests.
31301debfc3dSmrg@item gcc.misc-tests
31311debfc3dSmrgThis directory contains C tests that require special handling.  Some
31321debfc3dSmrgof these tests have individual expect files, and others share
31331debfc3dSmrgspecial-purpose expect files:
31341debfc3dSmrg
31351debfc3dSmrg@table @file
31361debfc3dSmrg@item @code{bprob*.c}
31371debfc3dSmrgTest @option{-fbranch-probabilities} using
31381debfc3dSmrg@file{gcc.misc-tests/bprob.exp}, which
31391debfc3dSmrgin turn uses the generic, language-independent framework
31401debfc3dSmrg(@pxref{profopt Testing, , Support for testing profile-directed
31411debfc3dSmrgoptimizations}).
31421debfc3dSmrg
31431debfc3dSmrg@item @code{gcov*.c}
31441debfc3dSmrgTest @command{gcov} output using @file{gcov.exp}, which in turn uses the
31451debfc3dSmrglanguage-independent support (@pxref{gcov Testing, , Support for testing gcov}).
31461debfc3dSmrg
31471debfc3dSmrg@item @code{i386-pf-*.c}
31481debfc3dSmrgTest i386-specific support for data prefetch using @file{i386-prefetch.exp}.
31491debfc3dSmrg@end table
31501debfc3dSmrg
31511debfc3dSmrg@item gcc.test-framework
31521debfc3dSmrg@table @file
31531debfc3dSmrg@item @code{dg-*.c}
31541debfc3dSmrgTest the testsuite itself using @file{gcc.test-framework/test-framework.exp}.
31551debfc3dSmrg@end table
31561debfc3dSmrg
31571debfc3dSmrg@end table
31581debfc3dSmrg
31591debfc3dSmrgFIXME: merge in @file{testsuite/README.gcc} and discuss the format of
31601debfc3dSmrgtest cases and magic comments more.
31611debfc3dSmrg
31621debfc3dSmrg@node LTO Testing
31631debfc3dSmrg@section Support for testing link-time optimizations
31641debfc3dSmrg
31651debfc3dSmrgTests for link-time optimizations usually require multiple source files
31661debfc3dSmrgthat are compiled separately, perhaps with different sets of options.
31671debfc3dSmrgThere are several special-purpose test directives used for these tests.
31681debfc3dSmrg
31691debfc3dSmrg@table @code
31701debfc3dSmrg@item @{ dg-lto-do @var{do-what-keyword} @}
31711debfc3dSmrg@var{do-what-keyword} specifies how the test is compiled and whether
31721debfc3dSmrgit is executed.  It is one of:
31731debfc3dSmrg
31741debfc3dSmrg@table @code
31751debfc3dSmrg@item assemble
31761debfc3dSmrgCompile with @option{-c} to produce a relocatable object file.
31771debfc3dSmrg@item link
31781debfc3dSmrgCompile, assemble, and link to produce an executable file.
31791debfc3dSmrg@item run
31801debfc3dSmrgProduce and run an executable file, which is expected to return
31811debfc3dSmrgan exit code of 0.
31821debfc3dSmrg@end table
31831debfc3dSmrg
31841debfc3dSmrgThe default is @code{assemble}.  That can be overridden for a set of
31851debfc3dSmrgtests by redefining @code{dg-do-what-default} within the @code{.exp}
31861debfc3dSmrgfile for those tests.
31871debfc3dSmrg
31881debfc3dSmrgUnlike @code{dg-do}, @code{dg-lto-do} does not support an optional
31891debfc3dSmrg@samp{target} or @samp{xfail} list.  Use @code{dg-skip-if},
31901debfc3dSmrg@code{dg-xfail-if}, or @code{dg-xfail-run-if}.
31911debfc3dSmrg
31921debfc3dSmrg@item @{ dg-lto-options @{ @{ @var{options} @} [@{ @var{options} @}] @} [@{ target @var{selector} @}]@}
31931debfc3dSmrgThis directive provides a list of one or more sets of compiler options
31941debfc3dSmrgto override @var{LTO_OPTIONS}.  Each test will be compiled and run with
31951debfc3dSmrgeach of these sets of options.
31961debfc3dSmrg
31971debfc3dSmrg@item @{ dg-extra-ld-options @var{options} [@{ target @var{selector} @}]@}
31981debfc3dSmrgThis directive adds @var{options} to the linker options used.
31991debfc3dSmrg
32001debfc3dSmrg@item @{ dg-suppress-ld-options @var{options} [@{ target @var{selector} @}]@}
32011debfc3dSmrgThis directive removes @var{options} from the set of linker options used.
32021debfc3dSmrg@end table
32031debfc3dSmrg
32041debfc3dSmrg@node gcov Testing
32051debfc3dSmrg@section Support for testing @command{gcov}
32061debfc3dSmrg
32071debfc3dSmrgLanguage-independent support for testing @command{gcov}, and for checking
32081debfc3dSmrgthat branch profiling produces expected values, is provided by the
32091debfc3dSmrgexpect file @file{lib/gcov.exp}.  @command{gcov} tests also rely on procedures
32101debfc3dSmrgin @file{lib/gcc-dg.exp} to compile and run the test program.  A typical
32111debfc3dSmrg@command{gcov} test contains the following DejaGnu commands within comments:
32121debfc3dSmrg
32131debfc3dSmrg@smallexample
3214c0a68be4Smrg@{ dg-options "--coverage" @}
32151debfc3dSmrg@{ dg-do run @{ target native @} @}
32161debfc3dSmrg@{ dg-final @{ run-gcov sourcefile @} @}
32171debfc3dSmrg@end smallexample
32181debfc3dSmrg
32191debfc3dSmrgChecks of @command{gcov} output can include line counts, branch percentages,
32201debfc3dSmrgand call return percentages.  All of these checks are requested via
32211debfc3dSmrgcommands that appear in comments in the test's source file.
32221debfc3dSmrgCommands to check line counts are processed by default.
32231debfc3dSmrgCommands to check branch percentages and call return percentages are
32241debfc3dSmrgprocessed if the @command{run-gcov} command has arguments @code{branches}
32251debfc3dSmrgor @code{calls}, respectively.  For example, the following specifies
32261debfc3dSmrgchecking both, as well as passing @option{-b} to @command{gcov}:
32271debfc3dSmrg
32281debfc3dSmrg@smallexample
32291debfc3dSmrg@{ dg-final @{ run-gcov branches calls @{ -b sourcefile @} @} @}
32301debfc3dSmrg@end smallexample
32311debfc3dSmrg
32321debfc3dSmrgA line count command appears within a comment on the source line
32331debfc3dSmrgthat is expected to get the specified count and has the form
32341debfc3dSmrg@code{count(@var{cnt})}.  A test should only check line counts for
32351debfc3dSmrglines that will get the same count for any architecture.
32361debfc3dSmrg
32371debfc3dSmrgCommands to check branch percentages (@code{branch}) and call
32381debfc3dSmrgreturn percentages (@code{returns}) are very similar to each other.
32391debfc3dSmrgA beginning command appears on or before the first of a range of
32401debfc3dSmrglines that will report the percentage, and the ending command
32411debfc3dSmrgfollows that range of lines.  The beginning command can include a
32421debfc3dSmrglist of percentages, all of which are expected to be found within
32431debfc3dSmrgthe range.  A range is terminated by the next command of the same
32441debfc3dSmrgkind.  A command @code{branch(end)} or @code{returns(end)} marks
32451debfc3dSmrgthe end of a range without starting a new one.  For example:
32461debfc3dSmrg
32471debfc3dSmrg@smallexample
32481debfc3dSmrgif (i > 10 && j > i && j < 20)  /* @r{branch(27 50 75)} */
32491debfc3dSmrg                                /* @r{branch(end)} */
32501debfc3dSmrg  foo (i, j);
32511debfc3dSmrg@end smallexample
32521debfc3dSmrg
32531debfc3dSmrgFor a call return percentage, the value specified is the
32541debfc3dSmrgpercentage of calls reported to return.  For a branch percentage,
32551debfc3dSmrgthe value is either the expected percentage or 100 minus that
32561debfc3dSmrgvalue, since the direction of a branch can differ depending on the
32571debfc3dSmrgtarget or the optimization level.
32581debfc3dSmrg
32591debfc3dSmrgNot all branches and calls need to be checked.  A test should not
32601debfc3dSmrgcheck for branches that might be optimized away or replaced with
32611debfc3dSmrgpredicated instructions.  Don't check for calls inserted by the
32621debfc3dSmrgcompiler or ones that might be inlined or optimized away.
32631debfc3dSmrg
32641debfc3dSmrgA single test can check for combinations of line counts, branch
32651debfc3dSmrgpercentages, and call return percentages.  The command to check a
32661debfc3dSmrgline count must appear on the line that will report that count, but
32671debfc3dSmrgcommands to check branch percentages and call return percentages can
32681debfc3dSmrgbracket the lines that report them.
32691debfc3dSmrg
32701debfc3dSmrg@node profopt Testing
32711debfc3dSmrg@section Support for testing profile-directed optimizations
32721debfc3dSmrg
32731debfc3dSmrgThe file @file{profopt.exp} provides language-independent support for
32741debfc3dSmrgchecking correct execution of a test built with profile-directed
32751debfc3dSmrgoptimization.  This testing requires that a test program be built and
32761debfc3dSmrgexecuted twice.  The first time it is compiled to generate profile
32771debfc3dSmrgdata, and the second time it is compiled to use the data that was
32781debfc3dSmrggenerated during the first execution.  The second execution is to
32791debfc3dSmrgverify that the test produces the expected results.
32801debfc3dSmrg
32811debfc3dSmrgTo check that the optimization actually generated better code, a
32821debfc3dSmrgtest can be built and run a third time with normal optimizations to
32831debfc3dSmrgverify that the performance is better with the profile-directed
32841debfc3dSmrgoptimizations.  @file{profopt.exp} has the beginnings of this kind
32851debfc3dSmrgof support.
32861debfc3dSmrg
32871debfc3dSmrg@file{profopt.exp} provides generic support for profile-directed
32881debfc3dSmrgoptimizations.  Each set of tests that uses it provides information
32891debfc3dSmrgabout a specific optimization:
32901debfc3dSmrg
32911debfc3dSmrg@table @code
32921debfc3dSmrg@item tool
32931debfc3dSmrgtool being tested, e.g., @command{gcc}
32941debfc3dSmrg
32951debfc3dSmrg@item profile_option
32961debfc3dSmrgoptions used to generate profile data
32971debfc3dSmrg
32981debfc3dSmrg@item feedback_option
32991debfc3dSmrgoptions used to optimize using that profile data
33001debfc3dSmrg
33011debfc3dSmrg@item prof_ext
33021debfc3dSmrgsuffix of profile data files
33031debfc3dSmrg
33041debfc3dSmrg@item PROFOPT_OPTIONS
33051debfc3dSmrglist of options with which to run each test, similar to the lists for
33061debfc3dSmrgtorture tests
33071debfc3dSmrg
33081debfc3dSmrg@item @{ dg-final-generate @{ @var{local-directive} @} @}
33091debfc3dSmrgThis directive is similar to @code{dg-final}, but the
33101debfc3dSmrg@var{local-directive} is run after the generation of profile data.
33111debfc3dSmrg
33121debfc3dSmrg@item @{ dg-final-use @{ @var{local-directive} @} @}
33131debfc3dSmrgThe @var{local-directive} is run after the profile data have been
33141debfc3dSmrgused.
33151debfc3dSmrg@end table
33161debfc3dSmrg
33171debfc3dSmrg@node compat Testing
33181debfc3dSmrg@section Support for testing binary compatibility
33191debfc3dSmrg
33201debfc3dSmrgThe file @file{compat.exp} provides language-independent support for
33211debfc3dSmrgbinary compatibility testing.  It supports testing interoperability of
33221debfc3dSmrgtwo compilers that follow the same ABI, or of multiple sets of
33231debfc3dSmrgcompiler options that should not affect binary compatibility.  It is
33241debfc3dSmrgintended to be used for testsuites that complement ABI testsuites.
33251debfc3dSmrg
33261debfc3dSmrgA test supported by this framework has three parts, each in a
33271debfc3dSmrgseparate source file: a main program and two pieces that interact
33281debfc3dSmrgwith each other to split up the functionality being tested.
33291debfc3dSmrg
33301debfc3dSmrg@table @file
33311debfc3dSmrg@item @var{testname}_main.@var{suffix}
33321debfc3dSmrgContains the main program, which calls a function in file
33331debfc3dSmrg@file{@var{testname}_x.@var{suffix}}.
33341debfc3dSmrg
33351debfc3dSmrg@item @var{testname}_x.@var{suffix}
33361debfc3dSmrgContains at least one call to a function in
33371debfc3dSmrg@file{@var{testname}_y.@var{suffix}}.
33381debfc3dSmrg
33391debfc3dSmrg@item @var{testname}_y.@var{suffix}
33401debfc3dSmrgShares data with, or gets arguments from,
33411debfc3dSmrg@file{@var{testname}_x.@var{suffix}}.
33421debfc3dSmrg@end table
33431debfc3dSmrg
33441debfc3dSmrgWithin each test, the main program and one functional piece are
33451debfc3dSmrgcompiled by the GCC under test.  The other piece can be compiled by
33461debfc3dSmrgan alternate compiler.  If no alternate compiler is specified,
33471debfc3dSmrgthen all three source files are all compiled by the GCC under test.
33481debfc3dSmrgYou can specify pairs of sets of compiler options.  The first element
33491debfc3dSmrgof such a pair specifies options used with the GCC under test, and the
33501debfc3dSmrgsecond element of the pair specifies options used with the alternate
33511debfc3dSmrgcompiler.  Each test is compiled with each pair of options.
33521debfc3dSmrg
33531debfc3dSmrg@file{compat.exp} defines default pairs of compiler options.
33541debfc3dSmrgThese can be overridden by defining the environment variable
33551debfc3dSmrg@env{COMPAT_OPTIONS} as:
33561debfc3dSmrg
33571debfc3dSmrg@smallexample
33581debfc3dSmrgCOMPAT_OPTIONS="[list [list @{@var{tst1}@} @{@var{alt1}@}]
33591debfc3dSmrg  @dots{}[list @{@var{tstn}@} @{@var{altn}@}]]"
33601debfc3dSmrg@end smallexample
33611debfc3dSmrg
33621debfc3dSmrgwhere @var{tsti} and @var{alti} are lists of options, with @var{tsti}
33631debfc3dSmrgused by the compiler under test and @var{alti} used by the alternate
33641debfc3dSmrgcompiler.  For example, with
33651debfc3dSmrg@code{[list [list @{-g -O0@} @{-O3@}] [list @{-fpic@} @{-fPIC -O2@}]]},
33661debfc3dSmrgthe test is first built with @option{-g -O0} by the compiler under
33671debfc3dSmrgtest and with @option{-O3} by the alternate compiler.  The test is
33681debfc3dSmrgbuilt a second time using @option{-fpic} by the compiler under test
33691debfc3dSmrgand @option{-fPIC -O2} by the alternate compiler.
33701debfc3dSmrg
33711debfc3dSmrgAn alternate compiler is specified by defining an environment
33721debfc3dSmrgvariable to be the full pathname of an installed compiler; for C
33731debfc3dSmrgdefine @env{ALT_CC_UNDER_TEST}, and for C++ define
33741debfc3dSmrg@env{ALT_CXX_UNDER_TEST}.  These will be written to the
33751debfc3dSmrg@file{site.exp} file used by DejaGnu.  The default is to build each
33761debfc3dSmrgtest with the compiler under test using the first of each pair of
33771debfc3dSmrgcompiler options from @env{COMPAT_OPTIONS}.  When
33781debfc3dSmrg@env{ALT_CC_UNDER_TEST} or
33791debfc3dSmrg@env{ALT_CXX_UNDER_TEST} is @code{same}, each test is built using
33801debfc3dSmrgthe compiler under test but with combinations of the options from
33811debfc3dSmrg@env{COMPAT_OPTIONS}.
33821debfc3dSmrg
33831debfc3dSmrgTo run only the C++ compatibility suite using the compiler under test
33841debfc3dSmrgand another version of GCC using specific compiler options, do the
33851debfc3dSmrgfollowing from @file{@var{objdir}/gcc}:
33861debfc3dSmrg
33871debfc3dSmrg@smallexample
33881debfc3dSmrgrm site.exp
33891debfc3dSmrgmake -k \
33901debfc3dSmrg  ALT_CXX_UNDER_TEST=$@{alt_prefix@}/bin/g++ \
33911debfc3dSmrg  COMPAT_OPTIONS="@var{lists as shown above}" \
33921debfc3dSmrg  check-c++ \
33931debfc3dSmrg  RUNTESTFLAGS="compat.exp"
33941debfc3dSmrg@end smallexample
33951debfc3dSmrg
33961debfc3dSmrgA test that fails when the source files are compiled with different
33971debfc3dSmrgcompilers, but passes when the files are compiled with the same
33981debfc3dSmrgcompiler, demonstrates incompatibility of the generated code or
33991debfc3dSmrgruntime support.  A test that fails for the alternate compiler but
34001debfc3dSmrgpasses for the compiler under test probably tests for a bug that was
34011debfc3dSmrgfixed in the compiler under test but is present in the alternate
34021debfc3dSmrgcompiler.
34031debfc3dSmrg
34041debfc3dSmrgThe binary compatibility tests support a small number of test framework
34051debfc3dSmrgcommands that appear within comments in a test file.
34061debfc3dSmrg
34071debfc3dSmrg@table @code
34081debfc3dSmrg@item dg-require-*
34091debfc3dSmrgThese commands can be used in @file{@var{testname}_main.@var{suffix}}
34101debfc3dSmrgto skip the test if specific support is not available on the target.
34111debfc3dSmrg
34121debfc3dSmrg@item dg-options
34131debfc3dSmrgThe specified options are used for compiling this particular source
34141debfc3dSmrgfile, appended to the options from @env{COMPAT_OPTIONS}.  When this
34151debfc3dSmrgcommand appears in @file{@var{testname}_main.@var{suffix}} the options
34161debfc3dSmrgare also used to link the test program.
34171debfc3dSmrg
34181debfc3dSmrg@item dg-xfail-if
34191debfc3dSmrgThis command can be used in a secondary source file to specify that
34201debfc3dSmrgcompilation is expected to fail for particular options on particular
34211debfc3dSmrgtargets.
34221debfc3dSmrg@end table
34231debfc3dSmrg
34241debfc3dSmrg@node Torture Tests
34251debfc3dSmrg@section Support for torture testing using multiple options
34261debfc3dSmrg
34271debfc3dSmrgThroughout the compiler testsuite there are several directories whose
34281debfc3dSmrgtests are run multiple times, each with a different set of options.
34291debfc3dSmrgThese are known as torture tests.
34301debfc3dSmrg@file{lib/torture-options.exp} defines procedures to
34311debfc3dSmrgset up these lists:
34321debfc3dSmrg
34331debfc3dSmrg@table @code
34341debfc3dSmrg@item torture-init
34351debfc3dSmrgInitialize use of torture lists.
34361debfc3dSmrg@item set-torture-options
34371debfc3dSmrgSet lists of torture options to use for tests with and without loops.
34381debfc3dSmrgOptionally combine a set of torture options with a set of other
34391debfc3dSmrgoptions, as is done with Objective-C runtime options.
34401debfc3dSmrg@item torture-finish
34411debfc3dSmrgFinalize use of torture lists.
34421debfc3dSmrg@end table
34431debfc3dSmrg
34441debfc3dSmrgThe @file{.exp} file for a set of tests that use torture options must
34451debfc3dSmrginclude calls to these three procedures if:
34461debfc3dSmrg
34471debfc3dSmrg@itemize @bullet
34481debfc3dSmrg@item It calls @code{gcc-dg-runtest} and overrides @var{DG_TORTURE_OPTIONS}.
34491debfc3dSmrg
34501debfc3dSmrg@item It calls @var{$@{tool@}}@code{-torture} or
34511debfc3dSmrg@var{$@{tool@}}@code{-torture-execute}, where @var{tool} is @code{c},
34521debfc3dSmrg@code{fortran}, or @code{objc}.
34531debfc3dSmrg
34541debfc3dSmrg@item It calls @code{dg-pch}.
34551debfc3dSmrg@end itemize
34561debfc3dSmrg
34571debfc3dSmrgIt is not necessary for a @file{.exp} file that calls @code{gcc-dg-runtest}
34581debfc3dSmrgto call the torture procedures if the tests should use the list in
34591debfc3dSmrg@var{DG_TORTURE_OPTIONS} defined in @file{gcc-dg.exp}.
34601debfc3dSmrg
34611debfc3dSmrgMost uses of torture options can override the default lists by defining
34621debfc3dSmrg@var{TORTURE_OPTIONS} or add to the default list by defining
34631debfc3dSmrg@var{ADDITIONAL_TORTURE_OPTIONS}.  Define these in a @file{.dejagnurc}
34641debfc3dSmrgfile or add them to the @file{site.exp} file; for example
34651debfc3dSmrg
34661debfc3dSmrg@smallexample
34671debfc3dSmrgset ADDITIONAL_TORTURE_OPTIONS  [list \
34681debfc3dSmrg  @{ -O2 -ftree-loop-linear @} \
34691debfc3dSmrg  @{ -O2 -fpeel-loops @} ]
34701debfc3dSmrg@end smallexample
34711debfc3dSmrg
34721debfc3dSmrg@node GIMPLE Tests
34731debfc3dSmrg@section Support for testing GIMPLE passes
34741debfc3dSmrg
34751debfc3dSmrgAs of gcc 7, C functions can be tagged with @code{__GIMPLE} to indicate
34761debfc3dSmrgthat the function body will be GIMPLE, rather than C.  The compiler requires
34771debfc3dSmrgthe option @option{-fgimple} to enable this functionality.  For example:
34781debfc3dSmrg
34791debfc3dSmrg@smallexample
34801debfc3dSmrg/* @{ dg-do compile @} */
34811debfc3dSmrg/* @{ dg-options "-O -fgimple" @} */
34821debfc3dSmrg
34831debfc3dSmrgvoid __GIMPLE (startwith ("dse2")) foo ()
34841debfc3dSmrg@{
34851debfc3dSmrg  int a;
34861debfc3dSmrg
34871debfc3dSmrgbb_2:
34881debfc3dSmrg  if (a > 4)
34891debfc3dSmrg    goto bb_3;
34901debfc3dSmrg  else
34911debfc3dSmrg    goto bb_4;
34921debfc3dSmrg
34931debfc3dSmrgbb_3:
34941debfc3dSmrg  a_2 = 10;
34951debfc3dSmrg  goto bb_5;
34961debfc3dSmrg
34971debfc3dSmrgbb_4:
34981debfc3dSmrg  a_3 = 20;
34991debfc3dSmrg
35001debfc3dSmrgbb_5:
35011debfc3dSmrg  a_1 = __PHI (bb_3: a_2, bb_4: a_3);
35021debfc3dSmrg  a_4 = a_1 + 4;
35031debfc3dSmrg
35041debfc3dSmrg  return;
35051debfc3dSmrg@}
35061debfc3dSmrg@end smallexample
35071debfc3dSmrg
35081debfc3dSmrgThe @code{startwith} argument indicates at which pass to begin.
35091debfc3dSmrg
3510c0a68be4SmrgUse the dump modifier @code{-gimple} (e.g.@: @option{-fdump-tree-all-gimple})
35111debfc3dSmrgto make tree dumps more closely follow the format accepted by the GIMPLE
35121debfc3dSmrgparser.
35131debfc3dSmrg
35141debfc3dSmrgExample DejaGnu tests of GIMPLE can be seen in the source tree at
35151debfc3dSmrg@file{gcc/testsuite/gcc.dg/gimplefe-*.c}.
35161debfc3dSmrg
35171debfc3dSmrgThe @code{__GIMPLE} parser is integrated with the C tokenizer and
35181debfc3dSmrgpreprocessor, so it should be possible to use macros to build out
35191debfc3dSmrgtest coverage.
35201debfc3dSmrg
35211debfc3dSmrg@node RTL Tests
35221debfc3dSmrg@section Support for testing RTL passes
35231debfc3dSmrg
35241debfc3dSmrgAs of gcc 7, C functions can be tagged with @code{__RTL} to indicate that the
35251debfc3dSmrgfunction body will be RTL, rather than C.  For example:
35261debfc3dSmrg
35271debfc3dSmrg@smallexample
35281debfc3dSmrgdouble __RTL (startwith ("ira")) test (struct foo *f, const struct bar *b)
35291debfc3dSmrg@{
35301debfc3dSmrg  (function "test"
35311debfc3dSmrg     [...snip; various directives go in here...]
35321debfc3dSmrg  ) ;; function "test"
35331debfc3dSmrg@}
35341debfc3dSmrg@end smallexample
35351debfc3dSmrg
35361debfc3dSmrgThe @code{startwith} argument indicates at which pass to begin.
35371debfc3dSmrg
35381debfc3dSmrgThe parser expects the RTL body to be in the format emitted by this
35391debfc3dSmrgdumping function:
35401debfc3dSmrg
35411debfc3dSmrg@smallexample
35421debfc3dSmrgDEBUG_FUNCTION void
35431debfc3dSmrgprint_rtx_function (FILE *outfile, function *fn, bool compact);
35441debfc3dSmrg@end smallexample
35451debfc3dSmrg
35461debfc3dSmrgwhen "compact" is true.  So you can capture RTL in the correct format
35471debfc3dSmrgfrom the debugger using:
35481debfc3dSmrg
35491debfc3dSmrg@smallexample
35501debfc3dSmrg(gdb) print_rtx_function (stderr, cfun, true);
35511debfc3dSmrg@end smallexample
35521debfc3dSmrg
35531debfc3dSmrgand copy and paste the output into the body of the C function.
35541debfc3dSmrg
35551debfc3dSmrgExample DejaGnu tests of RTL can be seen in the source tree under
35561debfc3dSmrg@file{gcc/testsuite/gcc.dg/rtl}.
35571debfc3dSmrg
35581debfc3dSmrgThe @code{__RTL} parser is not integrated with the C tokenizer or
35591debfc3dSmrgpreprocessor, and works simply by reading the relevant lines within
35601debfc3dSmrgthe braces.  In particular, the RTL body must be on separate lines from
35611debfc3dSmrgthe enclosing braces, and the preprocessor is not usable within it.
3562