diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-10 23:18:49 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-10 23:18:49 +0100 |
commit | be82a46963a2b08db29ec2fa5e941943bf0c7835 (patch) | |
tree | 2b6542862a4a3040d2010ad7db397aea4c11d06a | |
parent | 320b0c28d38b8500d50ba29cd7c855e1d03110f5 (diff) | |
parent | 8216ca85037be9f4d5c20540522a22a4a93b660e (diff) | |
download | gcc-be82a46963a2b08db29ec2fa5e941943bf0c7835.zip gcc-be82a46963a2b08db29ec2fa5e941943bf0c7835.tar.gz gcc-be82a46963a2b08db29ec2fa5e941943bf0c7835.tar.bz2 |
Merge commit 'ea1cd66f2200839d46a8b4dc140d18c00b849c82^' into HEAD
425 files changed, 15846 insertions, 4555 deletions
@@ -1,3 +1,13 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * configure.ac (--enable-host-pie): New check. Set PICFLAG after this + check. + * configure: Regenerate. + +2023-06-14 Filip Kastl <filip.kastl@gmail.com> + + * MAINTAINERS: Add myself to write after approval + 2023-06-02 YunQiang Su <yunqiang.su@cipunited.com> * MAINTAINERS (CPU Port Maintainers): Add myself as MIPS diff --git a/MAINTAINERS b/MAINTAINERS index 9cd9922..fdcfb4f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -413,6 +413,7 @@ Li Feng <nemokingdom@gmail.com> Thomas Fitzsimmons <fitzsim@redhat.com> Alexander Fomin <afomin.mailbox@gmail.com> Brian Ford <ford@vss.fsi.com> +Matthew Fortune <mfortune@gmail.com> John Freeman <jfreeman08@gmail.com> Nathan Froyd <froydnj@gcc.gnu.org> Chao-ying Fu <fu@mips.com> @@ -485,6 +486,7 @@ Kean Johnston <jkj@sco.com> Phillip Jordan <phillip.m.jordan@gmail.com> Tim Josling <tej@melbpc.org.au> Victor Kaplansky <victork@il.ibm.com> +Filip Kastl <filip.kastl@gmail.com> Geoffrey Keating <geoffk@geoffk.org> Brendan Kehoe <brendan@zen.org> Andi Kleen <andi@firstfloor.org> diff --git a/c++tools/ChangeLog b/c++tools/ChangeLog index 6a6ff51..5d98eef 100644 --- a/c++tools/ChangeLog +++ b/c++tools/ChangeLog @@ -1,3 +1,11 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * Makefile.in: Rename PIEFLAG to PICFLAG. Set LD_PICFLAG. Use it. + Use pic/libiberty.a if PICFLAG is set. + * configure.ac (--enable-default-pie): Set PICFLAG instead of PIEFLAG. + (--enable-host-pie): New check. + * configure: Regenerate. + 2023-03-31 Jonathan Wakely <jwakely@redhat.com> PR bootstrap/101834 diff --git a/c++tools/Makefile.in b/c++tools/Makefile.in index 77bda3d..dcb1029 100644 --- a/c++tools/Makefile.in +++ b/c++tools/Makefile.in @@ -29,8 +29,9 @@ AUTOCONF := @AUTOCONF@ AUTOHEADER := @AUTOHEADER@ CXX := @CXX@ CXXFLAGS := @CXXFLAGS@ -PIEFLAG := @PIEFLAG@ -CXXOPTS := $(CXXFLAGS) $(PIEFLAG) -fno-exceptions -fno-rtti +PICFLAG := @PICFLAG@ +LD_PICFLAG := @LD_PICFLAG@ +CXXOPTS := $(CXXFLAGS) $(PICFLAG) -fno-exceptions -fno-rtti LDFLAGS := @LDFLAGS@ exeext := @EXEEXT@ LIBIBERTY := ../libiberty/libiberty.a @@ -90,11 +91,15 @@ ifeq (@CXX_AUX_TOOLS@,yes) all::g++-mapper-server$(exeext) +ifneq ($(PICFLAG),) +override LIBIBERTY := ../libiberty/pic/libiberty.a +endif + MAPPER.O := server.o resolver.o CODYLIB = ../libcody/libcody.a CXXINC += -I$(srcdir)/../libcody -I$(srcdir)/../include -I$(srcdir)/../gcc -I. -I../gcc g++-mapper-server$(exeext): $(MAPPER.O) $(CODYLIB) - +$(CXX) $(LDFLAGS) $(PIEFLAG) -o $@ $^ $(LIBIBERTY) $(NETLIBS) + +$(CXX) $(LDFLAGS) $(PICFLAG) $(LD_PICFLAG) -o $@ $^ $(LIBIBERTY) $(NETLIBS) # copy to gcc dir so tests there can run all::../gcc/g++-mapper-server$(exeext) diff --git a/c++tools/configure b/c++tools/configure index 742816e..8808700 100755 --- a/c++tools/configure +++ b/c++tools/configure @@ -627,7 +627,8 @@ get_gcc_base_ver EGREP GREP CXXCPP -PIEFLAG +LD_PICFLAG +PICFLAG MAINTAINER CXX_AUX_TOOLS AUTOHEADER @@ -700,6 +701,7 @@ enable_c___tools enable_maintainer_mode enable_checking enable_default_pie +enable_host_pie with_gcc_major_version_only ' ac_precious_vars='build_alias @@ -1333,6 +1335,7 @@ Optional Features: only specific categories of checks. Categories are: yes,no,all,none,release. --enable-default-pie enable Position Independent Executable as default + --enable-host-pie build host code as PIE Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -2990,12 +2993,20 @@ fi # Check whether --enable-default-pie was given. # Check whether --enable-default-pie was given. if test "${enable_default_pie+set}" = set; then : - enableval=$enable_default_pie; PIEFLAG=-fPIE + enableval=$enable_default_pie; PICFLAG=-fPIE else - PIEFLAG= + PICFLAG= fi +# Enable --enable-host-pie +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; PICFLAG=-fPIE; LD_PICFLAG=-pie +fi + + + # Check if O_CLOEXEC is defined by fcntl diff --git a/c++tools/configure.ac b/c++tools/configure.ac index 23e98c8..44dfacc 100644 --- a/c++tools/configure.ac +++ b/c++tools/configure.ac @@ -102,8 +102,15 @@ fi AC_ARG_ENABLE(default-pie, [AS_HELP_STRING([--enable-default-pie], [enable Position Independent Executable as default])], -[PIEFLAG=-fPIE], [PIEFLAG=]) -AC_SUBST([PIEFLAG]) +[PICFLAG=-fPIE], [PICFLAG=]) + +# Enable --enable-host-pie +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])], +[PICFLAG=-fPIE; LD_PICFLAG=-pie], []) +AC_SUBST(PICFLAG) +AC_SUBST(LD_PICFLAG) # Check if O_CLOEXEC is defined by fcntl AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [ @@ -687,7 +687,9 @@ extra_host_zlib_configure_flags extra_host_libiberty_configure_flags stage1_languages host_libs_picflag +PICFLAG host_shared +host_pie extra_linker_plugin_flags extra_linker_plugin_configure_flags islinc @@ -830,6 +832,7 @@ enable_isl_version_check enable_lto enable_linker_plugin_configure_flags enable_linker_plugin_flags +enable_host_pie enable_host_shared enable_stage1_languages enable_objc_gc @@ -1558,6 +1561,7 @@ Optional Features: --enable-linker-plugin-flags=FLAGS additional flags for configuring and building linker plugins [none] + --enable-host-pie build position independent host executables --enable-host-shared build host code as shared libraries --enable-stage1-languages[=all] choose additional languages to build during stage1. @@ -8657,6 +8661,30 @@ fi +# Enable --enable-host-pie. +# Checked early to determine whether jit is an 'all' language +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; host_pie=$enableval + case $host in + x86_64-*-darwin* | aarch64-*-darwin*) + if test x$host_pie != xyes ; then + # PIC is the default, and actually cannot be switched off. + echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 + host_pie=yes + fi ;; + *) ;; + esac +else + case $host in + *-*-darwin2*) host_pie=yes ;; + *) host_pie=no ;; + esac +fi + + + + # Enable --enable-host-shared. # Checked early to determine whether jit is an 'all' language # Check whether --enable-host-shared was given. @@ -8669,23 +8697,40 @@ if test "${enable_host_shared+set}" = set; then : echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 host_shared=yes fi ;; + *-*-darwin*) + if test x$host_pie == xyes ; then + echo configure.ac: warning: PIC code is required for PIE executables. 1>&2 + host_shared=yes + fi ;; *) ;; esac else case $host in x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;; - *) host_shared=no ;; + # Darwin needs PIC objects to link PIE executables. + *-*-darwin*) host_shared=host_pie ;; + *) host_shared=no;; esac fi +if test x$host_shared = xyes; then + PICFLAG=-fPIC +elif test x$host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi + + + # If we are building PIC/PIE host executables, and we are building dependent # libs (e.g. GMP) in-tree those libs need to be configured to generate PIC # code. host_libs_picflag= -if test "$host_shared" = "yes";then +if test "$host_shared" = "yes" -o "$host_pie" = "yes"; then host_libs_picflag='--with-pic' fi diff --git a/configure.ac b/configure.ac index 80d4ad1..b5eba89 100644 --- a/configure.ac +++ b/configure.ac @@ -1903,6 +1903,28 @@ AC_ARG_ENABLE(linker-plugin-flags, extra_linker_plugin_flags=) AC_SUBST(extra_linker_plugin_flags) +# Enable --enable-host-pie. +# Checked early to determine whether jit is an 'all' language +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build position independent host executables])], +[host_pie=$enableval + case $host in + x86_64-*-darwin* | aarch64-*-darwin*) + if test x$host_pie != xyes ; then + # PIC is the default, and actually cannot be switched off. + echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 + host_pie=yes + fi ;; + *) ;; + esac], +[case $host in + *-*-darwin2*) host_pie=yes ;; + *) host_pie=no ;; + esac]) + +AC_SUBST(host_pie) + # Enable --enable-host-shared. # Checked early to determine whether jit is an 'all' language AC_ARG_ENABLE(host-shared, @@ -1916,20 +1938,37 @@ AC_ARG_ENABLE(host-shared, echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 host_shared=yes fi ;; + *-*-darwin*) + if test x$host_pie == xyes ; then + echo configure.ac: warning: PIC code is required for PIE executables. 1>&2 + host_shared=yes + fi ;; *) ;; esac], [case $host in x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;; - *) host_shared=no ;; + # Darwin needs PIC objects to link PIE executables. + *-*-darwin*) host_shared=host_pie ;; + *) host_shared=no;; esac]) AC_SUBST(host_shared) +if test x$host_shared = xyes; then + PICFLAG=-fPIC +elif test x$host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi + +AC_SUBST(PICFLAG) + # If we are building PIC/PIE host executables, and we are building dependent # libs (e.g. GMP) in-tree those libs need to be configured to generate PIC # code. host_libs_picflag= -if test "$host_shared" = "yes";then +if test "$host_shared" = "yes" -o "$host_pie" = "yes"; then host_libs_picflag='--with-pic' fi AC_SUBST(host_libs_picflag) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index f30bb85..2aa559fb 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,71 @@ +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py (TestResult,) + (ParseManifestWorker, ParseSummary, Main): Handle new option + "--srcpath <regex>". + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py (TestResult): Update. + (Main): Handle new option "--expiry_date YYYYMMDD". + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py (ResultSet.update,) + (ResultSet.HasTestsuite): New methods. + (GetResults): Update. + (ParseSummary, CompareResults, PerformComparison, Main): Handle new + option --invert_match. + +2023-06-14 Thiago Bauermann <thiago.bauermann@linaro.org> + + * testsuite-management/validate_failures.py (TestResult): Improve error + output. + +2023-06-14 Christophe Lyon <christophe.lyon@linaro.org> + + * testsuite-management/validate_failures.py (_EXP_LINE_FORMAT,) + (_EXP_LINE_REX, ResultSet): Support "$tool:" prefix in exp names. + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py (Main): Use exit code "2" + to indicate regression. + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py (_VALID_TEST_RESULTS_REX): + Update. + (TestResult): Use _VALID_TEST_RESULTS_REX. + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py: Add more verbosity levels. + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py: Simplify GetManifestPath(). + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py (GetResults): Update. + (CompareBuilds): Read in manifest. + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py (ParseManifestWorker): + Support expiry attributes in manifests. + (ParseSummary): Add a comment. + +2023-06-14 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * testsuite-management/validate_failures.py: Avoid testsuite + aliasing. + +2023-06-13 Andi Kleen <ak@linux.intel.com> + + * gen_autofdo_event.py: Update for download server changes + 2023-06-03 Lehua Ding <lehua.ding@rivai.ai> * clang-format (ForEachMacros): Add missing cases diff --git a/contrib/gen_autofdo_event.py b/contrib/gen_autofdo_event.py index ac23b83..533c706 100755 --- a/contrib/gen_autofdo_event.py +++ b/contrib/gen_autofdo_event.py @@ -32,8 +32,9 @@ import json import argparse import collections import os +import fnmatch -baseurl = "https://download.01.org/perfmon" +baseurl = "https://raw.githubusercontent.com/intel/perfmon/main" target_events = ('BR_INST_RETIRED.NEAR_TAKEN', 'BR_INST_EXEC.TAKEN', @@ -74,7 +75,7 @@ def get_cpustr(): def find_event(eventurl, model): print("Downloading", eventurl, file = sys.stderr) u = urllib.request.urlopen(eventurl) - events = json.loads(u.read()) + events = json.loads(u.read())["Events"] u.close() found = 0 @@ -102,7 +103,7 @@ found = 0 cpufound = 0 for j in u: n = j.rstrip().decode().split(',') - if len(n) >= 4 and (args.all or n[0] == cpu) and n[3] == "core": + if len(n) >= 4 and (args.all or fnmatch.fnmatch(cpu, n[0])) and n[3] == "core": components = n[0].split("-") model = components[2] model = int(model, 16) diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py index 43d9d50..4dfd9cd 100755 --- a/contrib/testsuite-management/validate_failures.py +++ b/contrib/testsuite-management/validate_failures.py @@ -60,9 +60,22 @@ import os import re import sys -# Handled test results. _VALID_TEST_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ] -_VALID_TEST_RESULTS_REX = re.compile("%s" % "|".join(_VALID_TEST_RESULTS)) +# <STATE>: <NAME> <DESCRIPTION" +_VALID_TEST_RESULTS_REX = re.compile('(%s):\s*(\S+)\s*(.*)' + % "|".join(_VALID_TEST_RESULTS)) + +# Formats of .sum file sections +_TOOL_LINE_FORMAT = '\t\t=== %s tests ===\n' +_EXP_LINE_FORMAT = '\nRunning %s:%s ...\n' +_SUMMARY_LINE_FORMAT = '\n\t\t=== %s Summary ===\n' + +# ... and their compiled regexs. +_TOOL_LINE_REX = re.compile('^\t\t=== (.*) tests ===\n') +# Match .exp file name, optionally prefixed by a "tool:" name and a +# path ending with "testsuite/" +_EXP_LINE_REX = re.compile('^Running (?:.*:)?(.*) \.\.\.\n') +_SUMMARY_LINE_REX = re.compile('^\t\t=== (.*) Summary ===\n') # Subdirectory of srcdir in which to find the manifest file. _MANIFEST_SUBDIR = 'contrib/testsuite-management' @@ -111,20 +124,33 @@ class TestResult(object): ordinal: Monotonically increasing integer. It is used to keep results for one .exp file sorted by the order the tests were run. + tool: Top-level testsuite name (aka "tool" in DejaGnu parlance) of the test. + exp: Name of .exp testsuite file. """ - def __init__(self, summary_line, ordinal=-1): + def __init__(self, summary_line, ordinal, tool, exp): try: (self.attrs, summary_line) = SplitAttributesFromSummaryLine(summary_line) try: (self.state, self.name, - self.description) = re.match(r'([A-Z]+):\s*(\S+)\s*(.*)', - summary_line).groups() + self.description) = _VALID_TEST_RESULTS_REX.match(summary_line).groups() + if _OPTIONS.srcpath_regex and _OPTIONS.srcpath_regex != '': + self.description = re.sub(_OPTIONS.srcpath_regex, '', + self.description) except: - print('Failed to parse summary line: "%s"' % summary_line) + print('Failed to parse summary line: "%s"' % summary_line, + file=sys.stderr) raise self.ordinal = ordinal + if tool == None or exp == None: + # .sum file seem to be broken. There was no "tool" and/or "exp" + # lines preceding this result. + print(f'.sum file seems to be broken: tool="{tool}", exp="{exp}", summary_line="{summary_line}"', + file=sys.stderr) + raise + self.tool = tool + self.exp = exp except ValueError: Error('Cannot parse summary line "%s"' % summary_line) @@ -133,14 +159,27 @@ class TestResult(object): self.state, summary_line, self)) def __lt__(self, other): - return (self.name < other.name or - (self.name == other.name and self.ordinal < other.ordinal)) + if (self.tool != other.tool): + return self.tool < other.tool + if (self.exp != other.exp): + return self.exp < other.exp + if (self.name != other.name): + return self.name < other.name + return self.ordinal < other.ordinal def __hash__(self): - return hash(self.state) ^ hash(self.name) ^ hash(self.description) - + return (hash(self.state) ^ hash(self.tool) ^ hash(self.exp) + ^ hash(self.name) ^ hash(self.description)) + + # Note that we don't include "attrs" in this comparison. This means that + # result entries "FAIL: test" and "flaky | FAIL: test" are considered + # the same. Therefore the ResultSet will preserve only the first occurence. + # In practice this means that flaky entries should preceed expected fails + # entries. def __eq__(self, other): return (self.state == other.state and + self.tool == other.tool and + self.exp == other.exp and self.name == other.name and self.description == other.description) @@ -170,9 +209,55 @@ class TestResult(object): # Return True if the expiration date of this result has passed. expiration_date = self.ExpirationDate() if expiration_date: - now = datetime.date.today() - return now > expiration_date + return _OPTIONS.expiry_today_date > expiration_date + + +class ResultSet(set): + """Describes a set of DejaGNU test results. + This set can be read in from .sum files or emitted as a manifest. + + Attributes: + current_tool: Name of the current top-level DejaGnu testsuite. + current_exp: Name of the current .exp testsuite file. + testsuites: A set of (tool, exp) tuples representing encountered testsuites. + """ + + def __init__(self): + super().__init__() + self.ResetToolExp() + self.testsuites=set() + def update(self, other): + super().update(other) + self.testsuites.update(other.testsuites) + + def ResetToolExp(self): + self.current_tool = None + self.current_exp = None + + def MakeTestResult(self, summary_line, ordinal=-1): + return TestResult(summary_line, ordinal, + self.current_tool, self.current_exp) + + def Print(self, outfile=sys.stdout): + current_tool = None + current_exp = None + + for result in sorted(self): + if current_tool != result.tool: + current_tool = result.tool + outfile.write(_TOOL_LINE_FORMAT % current_tool) + if current_exp != result.exp: + current_exp = result.exp + outfile.write(_EXP_LINE_FORMAT % (current_tool, current_exp)) + outfile.write('%s\n' % result) + + outfile.write(_SUMMARY_LINE_FORMAT % 'Results') + + # Check if testsuite of expected_result is present in current results. + # This is used to compare partial test results against a full manifest. + def HasTestsuite(self, expected_result): + return (expected_result.tool, expected_result.exp) in self.testsuites def GetMakefileValue(makefile_name, value_name): if os.path.exists(makefile_name): @@ -216,6 +301,21 @@ def IsInterestingResult(line): return bool(_VALID_TEST_RESULTS_REX.match(line)) +def IsToolLine(line): + """Return True if line mentions the tool (in DejaGnu terms) for the following tests.""" + return bool(_TOOL_LINE_REX.match(line)) + + +def IsExpLine(line): + """Return True if line mentions the .exp file for the following tests.""" + return bool(_EXP_LINE_REX.match(line)) + + +def IsSummaryLine(line): + """Return True if line starts .sum footer.""" + return bool(_SUMMARY_LINE_REX.match(line)) + + def IsInclude(line): """Return True if line is an include of another file.""" return line.startswith("@include ") @@ -241,21 +341,36 @@ def GetNegativeResult(line): def ParseManifestWorker(result_set, manifest_path): """Read manifest_path, adding the contents to result_set.""" - if _OPTIONS.verbosity >= 1: + if _OPTIONS.verbosity >= 5: print('Parsing manifest file %s.' % manifest_path) manifest_file = open(manifest_path, encoding='latin-1', mode='r') - for line in manifest_file: - line = line.strip() + for orig_line in manifest_file: + line = orig_line.strip() if line == "": pass elif IsComment(line): pass elif IsNegativeResult(line): - result_set.remove(TestResult(GetNegativeResult(line))) + result_set.remove(result_set.MakeTestResult(GetNegativeResult(line))) elif IsInclude(line): ParseManifestWorker(result_set, GetIncludeFile(line, manifest_path)) elif IsInterestingResult(line): - result_set.add(TestResult(line)) + result = result_set.MakeTestResult(line) + if result.HasExpired(): + # Ignore expired manifest entries. + if _OPTIONS.verbosity >= 4: + print('WARNING: Expected failure "%s" has expired.' % line.strip()) + continue + result_set.add(result) + elif IsExpLine(orig_line): + result_set.current_exp = _EXP_LINE_REX.match(orig_line).groups()[0] + if _OPTIONS.srcpath_regex and _OPTIONS.srcpath_regex != '': + result_set.current_exp = re.sub(_OPTIONS.srcpath_regex, '', + result_set.current_exp) + elif IsToolLine(orig_line): + result_set.current_tool = _TOOL_LINE_REX.match(orig_line).groups()[0] + elif IsSummaryLine(orig_line): + result_set.ResetToolExp() else: Error('Unrecognized line in manifest file: %s' % line) manifest_file.close() @@ -263,29 +378,44 @@ def ParseManifestWorker(result_set, manifest_path): def ParseManifest(manifest_path): """Create a set of TestResult instances from the given manifest file.""" - result_set = set() + result_set = ResultSet() ParseManifestWorker(result_set, manifest_path) return result_set def ParseSummary(sum_fname): """Create a set of TestResult instances from the given summary file.""" - result_set = set() + result_set = ResultSet() # ordinal is used when sorting the results so that tests within each # .exp file are kept sorted. ordinal=0 sum_file = open(sum_fname, encoding='latin-1', mode='r') for line in sum_file: if IsInterestingResult(line): - result = TestResult(line, ordinal) + result = result_set.MakeTestResult(line, ordinal) ordinal += 1 if result.HasExpired(): + # ??? What is the use-case for this? How "expiry" annotations are + # ??? supposed to be added to .sum results? # Tests that have expired are not added to the set of expected # results. If they are still present in the set of actual results, # they will cause an error to be reported. - print('WARNING: Expected failure "%s" has expired.' % line.strip()) + if _OPTIONS.verbosity >= 4: + print('WARNING: Expected failure "%s" has expired.' % line.strip()) continue result_set.add(result) + elif IsExpLine(line): + result_set.current_exp = _EXP_LINE_REX.match(line).groups()[0] + if _OPTIONS.srcpath_regex and _OPTIONS.srcpath_regex != '': + result_set.current_exp = re.sub(_OPTIONS.srcpath_regex, '', + result_set.current_exp) + result_set.testsuites.add((result_set.current_tool, + result_set.current_exp)) + elif IsToolLine(line): + result_set.current_tool = _TOOL_LINE_REX.match(line).groups()[0] + result_set.current_exp = None + elif IsSummaryLine(line): + result_set.ResetToolExp() sum_file.close() return result_set @@ -301,7 +431,7 @@ def GetManifest(manifest_path): if os.path.exists(manifest_path): return ParseManifest(manifest_path) else: - return set() + return ResultSet() def CollectSumFiles(builddir): @@ -316,12 +446,14 @@ def CollectSumFiles(builddir): return sum_files -def GetResults(sum_files): +def GetResults(sum_files, build_results = None): """Collect all the test results from the given .sum files.""" - build_results = set() + if build_results == None: + build_results = ResultSet() for sum_fname in sum_files: - print('\t%s' % sum_fname) - build_results |= ParseSummary(sum_fname) + if _OPTIONS.verbosity >= 3: + print('\t%s' % sum_fname) + build_results.update(ParseSummary(sum_fname)) return build_results @@ -332,7 +464,7 @@ def CompareResults(manifest, actual): """ # Collect all the actual results not present in the manifest. # Results in this set will be reported as errors. - actual_vs_manifest = set() + actual_vs_manifest = ResultSet() for actual_result in actual: if actual_result not in manifest: actual_vs_manifest.add(actual_result) @@ -341,18 +473,22 @@ def CompareResults(manifest, actual): # in the actual results. # Results in this set will be reported as warnings (since # they are expected failures that are not failing anymore). - manifest_vs_actual = set() + manifest_vs_actual = ResultSet() for expected_result in manifest: # Ignore tests marked flaky. if 'flaky' in expected_result.attrs: continue - if expected_result not in actual: + # We try to support comparing partial results vs full manifest + # (e.g., manifest has failures for gcc, g++, gfortran, but we ran only + # g++ testsuite). To achieve this we record encountered testsuites in + # actual.testsuites set, and then we check it here using HasTestsuite(). + if expected_result not in actual and actual.HasTestsuite(expected_result): manifest_vs_actual.add(expected_result) return actual_vs_manifest, manifest_vs_actual -def GetManifestPath(srcdir, target, user_provided_must_exist): +def GetManifestPath(user_provided_must_exist): """Return the full path to the manifest file.""" manifest_path = _OPTIONS.manifest if manifest_path: @@ -360,6 +496,7 @@ def GetManifestPath(srcdir, target, user_provided_must_exist): Error('Manifest does not exist: %s' % manifest_path) return manifest_path else: + (srcdir, target) = GetBuildData() if not srcdir: Error('Could not determine the location of GCC\'s source tree. ' 'The Makefile does not contain a definition for "srcdir".') @@ -383,68 +520,79 @@ def GetBuildData(): return None, None srcdir = GetMakefileValue('%s/Makefile' % _OPTIONS.build_dir, 'srcdir =') target = GetMakefileValue('%s/Makefile' % _OPTIONS.build_dir, 'target_alias=') - print('Source directory: %s' % srcdir) - print('Build target: %s' % target) + if _OPTIONS.verbosity >= 3: + print('Source directory: %s' % srcdir) + print('Build target: %s' % target) return srcdir, target -def PrintSummary(msg, summary): - print('\n\n%s' % msg) - for result in sorted(summary): - print(result) - +def PrintSummary(summary): + summary.Print() def GetSumFiles(results, build_dir): if not results: - print('Getting actual results from build directory %s' % build_dir) + if _OPTIONS.verbosity >= 3: + print('Getting actual results from build directory %s' % build_dir) sum_files = CollectSumFiles(build_dir) else: - print('Getting actual results from user-provided results') + if _OPTIONS.verbosity >= 3: + print('Getting actual results from user-provided results') sum_files = results.split() return sum_files -def PerformComparison(expected, actual, ignore_missing_failures): +def PerformComparison(expected, actual): actual_vs_expected, expected_vs_actual = CompareResults(expected, actual) + if _OPTIONS.inverse_match: + # Switch results if inverse comparison is requested. + # This is useful in detecting flaky tests that FAILed in expected set, + # but PASSed in actual set. + actual_vs_expected, expected_vs_actual \ + = expected_vs_actual, actual_vs_expected + tests_ok = True if len(actual_vs_expected) > 0: - PrintSummary('Unexpected results in this build (new failures)', - actual_vs_expected) + if _OPTIONS.verbosity >= 3: + print('\n\nUnexpected results in this build (new failures)') + if _OPTIONS.verbosity >= 1: + PrintSummary(actual_vs_expected) tests_ok = False - if not ignore_missing_failures and len(expected_vs_actual) > 0: - PrintSummary('Expected results not present in this build (fixed tests)' - '\n\nNOTE: This is not a failure. It just means that these ' - 'tests were expected\nto fail, but either they worked in ' - 'this configuration or they were not\npresent at all.\n', - expected_vs_actual) + if _OPTIONS.verbosity >= 2 and len(expected_vs_actual) > 0: + print('\n\nExpected results not present in this build (fixed tests)' + '\n\nNOTE: This is not a failure. It just means that these ' + 'tests were expected\nto fail, but either they worked in ' + 'this configuration or they were not\npresent at all.\n') + PrintSummary(expected_vs_actual) - if tests_ok: + if tests_ok and _OPTIONS.verbosity >= 3: print('\nSUCCESS: No unexpected failures.') return tests_ok def CheckExpectedResults(): - srcdir, target = GetBuildData() - manifest_path = GetManifestPath(srcdir, target, True) - print('Manifest: %s' % manifest_path) + manifest_path = GetManifestPath(True) + if _OPTIONS.verbosity >= 3: + print('Manifest: %s' % manifest_path) manifest = GetManifest(manifest_path) sum_files = GetSumFiles(_OPTIONS.results, _OPTIONS.build_dir) actual = GetResults(sum_files) - if _OPTIONS.verbosity >= 1: - PrintSummary('Tests expected to fail', manifest) - PrintSummary('\nActual test results', actual) + if _OPTIONS.verbosity >= 5: + print('\n\nTests expected to fail') + PrintSummary(manifest) + print('\n\nActual test results') + PrintSummary(actual) - return PerformComparison(manifest, actual, _OPTIONS.ignore_missing_failures) + return PerformComparison(manifest, actual) def ProduceManifest(): - (srcdir, target) = GetBuildData() - manifest_path = GetManifestPath(srcdir, target, False) - print('Manifest: %s' % manifest_path) + manifest_path = GetManifestPath(False) + if _OPTIONS.verbosity >= 3: + print('Manifest: %s' % manifest_path) if os.path.exists(manifest_path) and not _OPTIONS.force: Error('Manifest file %s already exists.\nUse --force to overwrite.' % manifest_path) @@ -452,24 +600,29 @@ def ProduceManifest(): sum_files = GetSumFiles(_OPTIONS.results, _OPTIONS.build_dir) actual = GetResults(sum_files) manifest_file = open(manifest_path, encoding='latin-1', mode='w') - for result in sorted(actual): - print(result) - manifest_file.write('%s\n' % result) + actual.Print(manifest_file) + actual.Print() manifest_file.close() return True def CompareBuilds(): - (srcdir, target) = GetBuildData() - sum_files = GetSumFiles(_OPTIONS.results, _OPTIONS.build_dir) actual = GetResults(sum_files) + clean = ResultSet() + + if _OPTIONS.manifest: + manifest_path = GetManifestPath(True) + if _OPTIONS.verbosity >= 3: + print('Manifest: %s' % manifest_path) + clean = GetManifest(manifest_path) + clean_sum_files = GetSumFiles(_OPTIONS.results, _OPTIONS.clean_build) - clean = GetResults(clean_sum_files) + clean = GetResults(clean_sum_files, clean) - return PerformComparison(clean, actual, _OPTIONS.ignore_missing_failures) + return PerformComparison(clean, actual) def Main(argv): @@ -491,13 +644,23 @@ def Main(argv): default=False, help='When used with --produce_manifest, ' 'it will overwrite an existing manifest file ' '(default = False)') - parser.add_option('--ignore_missing_failures', action='store_true', - dest='ignore_missing_failures', default=False, - help='When a failure is expected in the manifest but ' - 'it is not found in the actual results, the script ' - 'produces a note alerting to this fact. This means ' - 'that the expected failure has been fixed, or ' - 'it did not run, or it may simply be flaky ' + parser.add_option('--expiry_date', action='store', + dest='expiry_today_date', default=None, + help='Use provided date YYYYMMDD to decide whether ' + 'manifest entries with expiry settings have expired ' + 'or not. (default = Use today date)') + parser.add_option('--srcpath', action='store', type='string', + dest='srcpath_regex', default='[^ ]+/testsuite/', + help='Remove provided path (can be a regex) from ' + 'the result entries. This is useful to remove ' + 'occasional filesystem path from the results. ' + '(default = "[^ ]+/testsuite/")') + parser.add_option('--inverse_match', action='store_true', + dest='inverse_match', default=False, + help='Inverse result sets in comparison. ' + 'Output unexpected passes as unexpected failures and ' + 'unexpected failures as unexpected passes. ' + 'This is used to catch FAIL->PASS flaky tests. ' '(default = False)') parser.add_option('--manifest', action='store', type='string', dest='manifest', default=None, @@ -515,10 +678,33 @@ def Main(argv): 'starting with FAIL, XPASS or UNRESOLVED (default = ' '.sum files collected from the build directory).') parser.add_option('--verbosity', action='store', dest='verbosity', - type='int', default=0, help='Verbosity level (default = 0)') + type='int', default=3, help='Verbosity level ' + '(default = 3). Level 0: only error output, this is ' + 'useful in scripting when only the exit code is used. ' + 'Level 1: output unexpected failures. ' + 'Level 2: output unexpected passes. ' + 'Level 3: output helpful information. ' + 'Level 4: output notification on expired entries. ' + 'Level 5: output debug information.') global _OPTIONS (_OPTIONS, _) = parser.parse_args(argv[1:]) + # Set "today" date to compare expiration entries against. + # Setting expiration date into the future allows re-detection of flaky + # tests and creating fresh entries for them before the current flaky entries + # expire. + if _OPTIONS.expiry_today_date: + today_date = re.search(r'(\d\d\d\d)(\d\d)(\d\d)', + _OPTIONS.expiry_today_date) + if not today_date: + Error('Invalid --expiry_today_date format "%s". Must be of the form ' + '"expire=YYYYMMDD"' % _OPTIONS.expiry_today_date) + _OPTIONS.expiry_today_date=datetime.date(int(today_date.group(1)), + int(today_date.group(2)), + int(today_date.group(3))) + else: + _OPTIONS.expiry_today_date = datetime.date.today() + if _OPTIONS.produce_manifest: retval = ProduceManifest() elif _OPTIONS.clean_build: @@ -529,7 +715,7 @@ def Main(argv): if retval: return 0 else: - return 1 + return 2 if __name__ == '__main__': diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index af6873a..ed4116e 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * Makefile.in: Set and use PICFLAG and LD_PICFLAG. Use the "pic" + build of libiberty if PICFLAG is set. + * configure.ac: + * configure: Regenerate. + 2023-03-28 Xi Ruoyao <xry111@xry111.site> PR other/109293 diff --git a/fixincludes/Makefile.in b/fixincludes/Makefile.in index 1937dca..e6ce41d 100644 --- a/fixincludes/Makefile.in +++ b/fixincludes/Makefile.in @@ -73,7 +73,7 @@ default : all # Now figure out from those variables how to compile and link. .c.o: - $(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $< + $(CC) -c $(CFLAGS) $(PICFLAG) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $< # The only suffixes we want for implicit rules are .c and .o. .SUFFIXES: @@ -87,7 +87,11 @@ default : all ## ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +ifeq ($(PICFLAG),) LIBIBERTY=../libiberty/libiberty.a +else +LIBIBERTY=../libiberty/pic/libiberty.a +endif ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \ fixlib.o fixopts.o @@ -107,15 +111,15 @@ oneprocess : full-stamp twoprocess : test-stamp $(AF) full-stamp : $(ALLOBJ) $(LIBIBERTY) - $(CC) $(CFLAGS) $(LDFLAGS) -o $(FI) $(ALLOBJ) $(LIBIBERTY) + $(CC) $(CFLAGS) $(PICFLAG) $(LDFLAGS) $(LD_PICFLAG) -o $(FI) $(ALLOBJ) $(LIBIBERTY) $(STAMP) $@ test-stamp : $(TESTOBJ) $(LIBIBERTY) - $(CC) $(CFLAGS) $(LDFLAGS) -o $(FI) $(TESTOBJ) $(LIBIBERTY) + $(CC) $(CFLAGS) $(PICFLAG) $(LDFLAGS) $(LD_PICFLAG) -o $(FI) $(TESTOBJ) $(LIBIBERTY) $(STAMP) $@ $(AF): $(FIXOBJ) $(LIBIBERTY) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(FIXOBJ) $(LIBIBERTY) + $(CC) $(CFLAGS) $(PICFLAG) $(LDFLAGS) $(LD_PICFLAG) -o $@ $(FIXOBJ) $(LIBIBERTY) $(ALLOBJ) : $(HDR) fixincl.o : fixincl.c $(srcdir)/fixincl.x diff --git a/fixincludes/configure b/fixincludes/configure index bdcc41f..f1748eb 100755 --- a/fixincludes/configure +++ b/fixincludes/configure @@ -623,6 +623,8 @@ ac_subst_vars='LTLIBOBJS LIBOBJS get_gcc_base_ver MAINT +LD_PICFLAG +PICFLAG TARGET target_noncanonical WERROR @@ -695,6 +697,7 @@ enable_option_checking enable_werror_always with_local_prefix enable_twoprocess +enable_host_pie enable_maintainer_mode with_gcc_major_version_only ' @@ -1323,6 +1326,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-werror-always enable -Werror despite compiler version --enable-twoprocess Use a separate process to apply the fixes + --enable-host-pie build host code as PIE --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -4835,6 +4839,15 @@ $as_echo "#define SEPARATE_FIX_PROC 1" >>confdefs.h fi +# Enable --enable-host-pie. +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; PICFLAG=-fPIE; LD_PICFLAG=-pie +fi + + + + case $host in vax-dec-bsd* ) diff --git a/fixincludes/configure.ac b/fixincludes/configure.ac index ef2227e..4e78511 100644 --- a/fixincludes/configure.ac +++ b/fixincludes/configure.ac @@ -68,6 +68,14 @@ if test $TARGET = twoprocess; then [Define if testing and fixing are done by separate process]) fi +# Enable --enable-host-pie. +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])], +[PICFLAG=-fPIE; LD_PICFLAG=-pie], []) +AC_SUBST(PICFLAG) +AC_SUBST(LD_PICFLAG) + case $host in vax-dec-bsd* ) AC_DEFINE(exit, xexit, [Define to xexit if the host system does not support atexit]) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f6867b7..0dcae8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,630 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * Makefile.in: Set LD_PICFLAG. Use it. Set enable_host_pie. + Remove NO_PIE_CFLAGS and NO_PIE_FLAG. Pass LD_PICFLAG to + ALL_LINKERFLAGS. Use the "pic" build of libiberty if --enable-host-pie. + * configure.ac (--enable-host-shared): Don't set PICFLAG here. + (--enable-host-pie): New check. Set PICFLAG and LD_PICFLAG after this + check. + * configure: Regenerate. + * doc/install.texi: Document --enable-host-pie. + +2023-06-15 Manolis Tsamis <manolis.tsamis@vrull.eu> + + * regcprop.cc (maybe_mode_change): Enable stack pointer + propagation. + +2023-06-15 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/110266 + * gimple-range-fold.cc (adjust_imagpart_expr): Check for integer + complex type. + (adjust_realpart_expr): Ditto. + +2023-06-15 Jan Beulich <jbeulich@suse.com> + + * config/i386/sse.md (<avx512>_vec_dup<mode><mask_name>): Use + vmovddup. + +2023-06-15 Jan Beulich <jbeulich@suse.com> + + * config/i386/constraints.md: Mention k and r for B. + +2023-06-15 Lulu Cheng <chenglulu@loongson.cn> + Andrew Pinski <apinski@marvell.com> + + PR target/110136 + * config/loongarch/loongarch.md: Modify the register constraints for template + "jumptable" and "indirect_jump" from "r" to "e". + +2023-06-15 Xi Ruoyao <xry111@xry111.site> + + * config/loongarch/loongarch-tune.h (loongarch_align): New + struct. + * config/loongarch/loongarch-def.h (loongarch_cpu_align): New + array. + * config/loongarch/loongarch-def.c (loongarch_cpu_align): Define + the array. + * config/loongarch/loongarch.cc + (loongarch_option_override_internal): Set the value of + -falign-functions= if -falign-functions is enabled but no value + is given. Likewise for -falign-labels=. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/79173 + * internal-fn.def (UADDC, USUBC): New internal functions. + * internal-fn.cc (expand_UADDC, expand_USUBC): New functions. + (commutative_ternary_fn_p): Return true also for IFN_UADDC. + * optabs.def (uaddc5_optab, usubc5_optab): New optabs. + * tree-ssa-math-opts.cc (uaddc_cast, uaddc_ne0, uaddc_is_cplxpart, + match_uaddc_usubc): New functions. + (math_opts_dom_walker::after_dom_children): Call match_uaddc_usubc + for PLUS_EXPR, MINUS_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR unless + other optimizations have been successful for those. + * gimple-fold.cc (gimple_fold_call): Handle IFN_UADDC and IFN_USUBC. + * fold-const-call.cc (fold_const_call): Likewise. + * gimple-range-fold.cc (adjust_imagpart_expr): Likewise. + * tree-ssa-dce.cc (eliminate_unnecessary_stmts): Likewise. + * doc/md.texi (uaddc<mode>5, usubc<mode>5): Document new named + patterns. + * config/i386/i386.md (uaddc<mode>5, usubc<mode>5): New + define_expand patterns. + (*setcc_qi_addqi3_cconly_overflow_1_<mode>, *setccc): Split + into NOTE_INSN_DELETED note rather than nop instruction. + (*setcc_qi_negqi_ccc_1_<mode>, *setcc_qi_negqi_ccc_2_<mode>): + Likewise. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/79173 + * config/i386/i386.md (subborrow<mode>): Add alternative with + memory destination and add for it define_peephole2 + TARGET_READ_MODIFY_WRITE/-Os patterns to prefer using memory + destination in these patterns. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/79173 + * config/i386/i386.md (*sub<mode>_3, @add<mode>3_carry, + addcarry<mode>, @sub<mode>3_carry, *add<mode>3_cc_overflow_1): Add + define_peephole2 TARGET_READ_MODIFY_WRITE/-Os patterns to prefer + using memory destination in these patterns. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + * gimple-fold.cc (gimple_fold_call): Move handling of arg0 + as well as arg1 INTEGER_CSTs for .UBSAN_CHECK_{ADD,SUB,MUL} + and .{ADD,SUB,MUL}_OVERFLOW calls from here... + * fold-const-call.cc (fold_const_call): ... here. + +2023-06-15 Oluwatamilore Adebayo <oluwatamilore.adebayo@arm.com> + + * config/aarch64/aarch64-simd.md (aarch64_<su>abd<mode>): + Rename to <su>abd<mode>3. + * config/aarch64/aarch64-sve.md (<su>abd<mode>_3): Rename + to <su>abd<mode>3. + +2023-06-15 Oluwatamilore Adebayo <oluwatamilore.adebayo@arm.com> + + * doc/md.texi (sabd, uabd): Document them. + * internal-fn.def (ABD): Use new optab. + * optabs.def (sabd_optab, uabd_optab): New optabs, + * tree-vect-patterns.cc (vect_recog_absolute_difference): + Recognize the following idiom abs (a - b). + (vect_recog_sad_pattern): Refactor to use + vect_recog_absolute_difference. + (vect_recog_abd_pattern): Use patterns found by + vect_recog_absolute_difference to build a new ABD + internal call. + +2023-06-15 chenxiaolong <chenxl04200420@163.com> + + * config/loongarch/loongarch.h (LARCH_CALL_RATIO): Modify the value + of macro LARCH_CALL_RATIO on LoongArch to make it perform optimally. + +2023-06-15 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-v.cc (shuffle_merge_patterns): New pattern. + (expand_vec_perm_const_1): Add merge optmization. + +2023-06-15 Lehua Ding <lehua.ding@rivai.ai> + + PR target/110119 + * config/riscv/riscv.cc (riscv_get_arg_info): Return NULL_RTX for vector mode + (riscv_pass_by_reference): Return true for vector mode + +2023-06-15 Pan Li <pan2.li@intel.com> + + * config/riscv/autovec-opt.md: Align the predictor sytle. + * config/riscv/autovec.md: Ditto. + +2023-06-15 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-v.cc (rvv_builder::get_merge_scalar_mask): + Take elen instead of scalar BITS_PER_WORD. + (expand_vector_init_merge_repeating_sequence): Use inner_bits_size + instead of scaler BITS_PER_WORD. + +2023-06-14 Jivan Hakobyan <jivanhakobyan9@gmail.com> + + * config/moxie/uclinux.h (MFWRAP_SPEC): Remove + +2023-06-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/aarch64/aarch64-sve-builtins-base.cc (svlast_impl::fold): + Fix signed comparison warning in loop from npats to enelts. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * gcc.cc (driver_handle_option): Forward host '-lgfortran', '-lm' + to offloading compilation. + * config/gcn/mkoffload.cc (main): Adjust. + * config/nvptx/mkoffload.cc (main): Likewise. + * doc/invoke.texi (foffload-options): Update example. + +2023-06-14 liuhongt <hongtao.liu@intel.com> + + PR target/110227 + * config/i386/sse.md (mov<mode>_internal>): Use x instead of v + for alternative 2 since there's no evex version for vpcmpeqd + ymm, ymm, ymm. + +2023-06-13 Jeff Law <jlaw@ventanamicro.com> + + * gcc.cc (LINK_COMMAND_SPEC): Remove mudflap spec handling. + +2023-06-13 Jeff Law <jlaw@ventanamicro.com> + + * config/sh/divtab.cc: Remove. + +2023-06-13 Jakub Jelinek <jakub@redhat.com> + + * config/i386/i386.cc (standard_sse_constant_opcode): Remove + superfluous spaces around \t for vpcmpeqd. + +2023-06-13 Roger Sayle <roger@nextmovesoftware.com> + + * expr.cc (store_constructor) <case VECTOR_TYPE>: Don't bother + clearing vectors with only a single element. Set CLEARED if the + vector was initialized to zero. + +2023-06-13 Lehua Ding <lehua.ding@rivai.ai> + + * config/riscv/riscv-v.cc (struct mode_vtype_group): Remove duplicate + #include. + (ENTRY): Undef. + (TUPLE_ENTRY): Undef. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-v.cc (rvv_builder::single_step_npatterns_p): Add comment. + (shuffle_generic_patterns): Ditto. + (expand_vec_perm_const_1): Ditto. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-v.cc (emit_vlmax_decompress_insn): Fix bug. + (shuffle_decompress_patterns): Ditto. + +2023-06-13 Richard Biener <rguenther@suse.de> + + * tree-ssa-loop-ch.cc (ch_base::copy_headers): Free loop BBs. + +2023-06-13 Yanzhang Wang <yanzhang.wang@intel.com> + Kito Cheng <kito.cheng@sifive.com> + + * config/riscv/riscv-protos.h (riscv_init_cumulative_args): Set + warning flag if func is not builtin + * config/riscv/riscv.cc + (riscv_scalable_vector_type_p): Determine whether the type is scalable vector. + (riscv_arg_has_vector): Determine whether the arg is vector type. + (riscv_pass_in_vector_p): Check the vector type param is passed by value. + (riscv_init_cumulative_args): The same as header. + (riscv_get_arg_info): Add the checking. + (riscv_function_value): Check the func return and set warning flag + * config/riscv/riscv.h (INIT_CUMULATIVE_ARGS): Add a flag to + determine whether warning psabi or not. + +2023-06-13 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/arm/arm-opts.h (enum arm_tp_type): Remove TP_CP15. + Add TP_TPIDRURW, TP_TPIDRURO, TP_TPIDRPRW values. + * config/arm/arm-protos.h (arm_output_load_tpidr): Declare prototype. + * config/arm/arm.cc (arm_option_reconfigure_globals): Replace TP_CP15 + with TP_TPIDRURO. + (arm_output_load_tpidr): Define. + * config/arm/arm.h (TARGET_HARD_TP): Define in terms of TARGET_SOFT_TP. + * config/arm/arm.md (load_tp_hard): Call arm_output_load_tpidr to output + assembly. + (reload_tp_hard): Likewise. + * config/arm/arm.opt (tpidrurw, tpidruro, tpidrprw): New values for + arm_tp_type. + * doc/invoke.texi (Arm Options, mtp): Document new values. + +2023-06-13 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/108779 + * config/aarch64/aarch64-opts.h (enum aarch64_tp_reg): Add + AARCH64_TPIDRRO_EL0 value. + * config/aarch64/aarch64.cc (aarch64_output_load_tp): Define. + * config/aarch64/aarch64.opt (tpidr_el0, tpidr_el1, tpidr_el2, + tpidr_el3, tpidrro_el3): New accepted values to -mtp=. + * doc/invoke.texi (AArch64 Options): Document new -mtp= options. + +2023-06-13 Alexandre Oliva <oliva@adacore.com> + + * range-op-float.cc (frange_nextafter): Drop inline. + (frelop_early_resolve): Add static. + (frange_float): Likewise. + +2023-06-13 Richard Biener <rguenther@suse.de> + + PR middle-end/110232 + * fold-const.cc (native_interpret_vector): Use TYPE_SIZE_UNIT + to check whether the buffer covers the whole vector. + +2023-06-13 Richard Biener <rguenther@suse.de> + + * tree-ssa-alias.cc (ref_maybe_used_by_call_p_1): For + .MASK_LOAD and friends set the size of the access to unknown. + +2023-06-13 Tejas Belagod <tbelagod@arm.com> + + PR target/96339 + * config/aarch64/aarch64-sve-builtins-base.cc (svlast_impl::fold): Fold sve + calls that have a constant input predicate vector. + (svlast_impl::is_lasta): Query to check if intrinsic is svlasta. + (svlast_impl::is_lastb): Query to check if intrinsic is svlastb. + (svlast_impl::vect_all_same): Check if all vector elements are equal. + +2023-06-13 Andi Kleen <ak@linux.intel.com> + + * config/i386/gcc-auto-profile: Regenerate. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/vector-iterators.md: Fix requirement. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/riscv-v.cc (emit_vlmax_decompress_insn): New function. + (shuffle_decompress_patterns): New function. + (expand_vec_perm_const_1): Add decompress optimization. + +2023-06-12 Jeff Law <jlaw@ventanamicro.com> + + PR rtl-optimization/101188 + * postreload.cc (reload_cse_move2add_invalidate): New function, + extracted from... + (reload_cse_move2add): Call reload_cse_move2add_invalidate. + +2023-06-12 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> + + * config/aarch64/aarch64.cc (aarch64_expand_vector_init): Tweak condition + if (n_var == n_elts && n_elts <= 16) to allow a single constant, + and if maxv == 1, use constant element for duplicating into register. + +2023-06-12 Tobias Burnus <tobias@codesourcery.com> + + * gimplify.cc (gimplify_adjust_omp_clauses_1): Use + GOMP_MAP_FORCE_PRESENT for 'present alloc' implicit mapping. + (gimplify_adjust_omp_clauses): Change + GOMP_MAP_PRESENT_{TO,TOFROM,FROM,ALLOC} to the equivalent + GOMP_MAP_FORCE_PRESENT. + * omp-low.cc (lower_omp_target): Remove handling of no-longer valid + GOMP_MAP_PRESENT_{TO,TOFROM,FROM,ALLOC}; update map kinds used for + to/from clauses with present modifier. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/110205 + * range-op-float.cc (range_operator::fold_range): Add default FII + fold routine. + * range-op-mixed.h (class operator_gt): Add missing final overrides. + * range-op.cc (range_op_handler::fold_range): Add RO_FII case. + (operator_lshift ::update_bitmask): Add final override. + (operator_rshift ::update_bitmask): Add final override. + * range-op.h (range_operator::fold_range): Add FII prototype. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * gimple-range-op.cc (gimple_range_op_handler::maybe_non_standard): + Use range_op_handler directly. + * range-op.cc (range_op_handler::range_op_handler): Unsigned + param instead of tree-code. + (ptr_op_widen_plus_signed): Delete. + (ptr_op_widen_plus_unsigned): Delete. + (ptr_op_widen_mult_signed): Delete. + (ptr_op_widen_mult_unsigned): Delete. + (range_op_table::initialize_integral_ops): Add new opcodes. + * range-op.h (range_op_handler): Use unsigned. + (OP_WIDEN_MULT_SIGNED): New. + (OP_WIDEN_MULT_UNSIGNED): New. + (OP_WIDEN_PLUS_SIGNED): New. + (OP_WIDEN_PLUS_UNSIGNED): New. + (RANGE_OP_TABLE_SIZE): New. + (range_op_table::operator []): Use unsigned. + (range_op_table::set): Use unsigned. + (m_range_tree): Make unsigned. + (ptr_op_widen_mult_signed): Remove. + (ptr_op_widen_mult_unsigned): Remove. + (ptr_op_widen_plus_signed): Remove. + (ptr_op_widen_plus_unsigned): Remove. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * gimple-range-op.cc (gimple_range_op_handler): Set m_operator + manually as there is no access to the default operator. + (cfn_copysign::fold_range): Don't check for validity. + (cfn_ubsan::fold_range): Ditto. + (gimple_range_op_handler::maybe_builtin_call): Don't set to NULL. + * range-op.cc (default_operator): New. + (range_op_handler::range_op_handler): Use default_operator + instead of NULL. + (range_op_handler::operator bool): Move from header, compare + against default operator. + (range_op_handler::range_op): New. + * range-op.h (range_op_handler::operator bool): Move. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op.cc (unified_table): Delete. + (range_op_table operator_table): Instantiate. + (range_op_table::range_op_table): Rename from unified_table. + (range_op_handler::range_op_handler): Use range_op_table. + * range-op.h (range_op_table::operator []): Inline. + (range_op_table::set): Inline. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * gimple-range-gori.cc (gori_compute::condexpr_adjust): Do not + pass type. + * gimple-range-op.cc (get_code): Rename from get_code_and_type + and simplify. + (gimple_range_op_handler::supported_p): No need for type. + (gimple_range_op_handler::gimple_range_op_handler): Ditto. + (cfn_copysign::fold_range): Ditto. + (cfn_ubsan::fold_range): Ditto. + * ipa-cp.cc (ipa_vr_operation_and_type_effects): Ditto. + * ipa-fnsummary.cc (evaluate_conditions_for_known_args): Ditto. + * range-op-float.cc (operator_plus::op1_range): Ditto. + (operator_mult::op1_range): Ditto. + (range_op_float_tests): Ditto. + * range-op.cc (get_op_handler): Remove. + (range_op_handler::set_op_handler): Remove. + (operator_plus::op1_range): No need for type. + (operator_minus::op1_range): Ditto. + (operator_mult::op1_range): Ditto. + (operator_exact_divide::op1_range): Ditto. + (operator_cast::op1_range): Ditto. + (perator_bitwise_not::fold_range): Ditto. + (operator_negate::fold_range): Ditto. + * range-op.h (range_op_handler::range_op_handler): Remove type param. + (range_cast): No need for type. + (range_op_table::operator[]): Check for enum_code >= 0. + * tree-data-ref.cc (compute_distributive_range): No need for type. + * tree-ssa-loop-unswitch.cc (unswitch_predicate): Ditto. + * value-query.cc (range_query::get_tree_range): Ditto. + * value-relation.cc (relation_oracle::validate_relation): Ditto. + * vr-values.cc (range_of_var_in_loop): Ditto. + (simplify_using_ranges::fold_cond_with_ops): Ditto. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (operator_max): Remove final. + * range-op-ptr.cc (pointer_table::pointer_table): Remove MAX_EXPR. + (pointer_table::pointer_table): Remove. + (class hybrid_max_operator): New. + (range_op_table::initialize_pointer_ops): Add hybrid_max_operator. + * range-op.cc (pointer_tree_table): Remove. + (unified_table::unified_table): Comment out MAX_EXPR. + (get_op_handler): Remove check of pointer table. + * range-op.h (class pointer_table): Remove. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (operator_min): Remove final. + * range-op-ptr.cc (pointer_table::pointer_table): Remove MIN_EXPR. + (class hybrid_min_operator): New. + (range_op_table::initialize_pointer_ops): Add hybrid_min_operator. + * range-op.cc (unified_table::unified_table): Comment out MIN_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (operator_bitwise_or): Remove final. + * range-op-ptr.cc (pointer_table::pointer_table): Remove BIT_IOR_EXPR. + (class hybrid_or_operator): New. + (range_op_table::initialize_pointer_ops): Add hybrid_or_operator. + * range-op.cc (unified_table::unified_table): Comment out BIT_IOR_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (operator_bitwise_and): Remove final. + * range-op-ptr.cc (pointer_table::pointer_table): Remove BIT_AND_EXPR. + (class hybrid_and_operator): New. + (range_op_table::initialize_pointer_ops): Add hybrid_and_operator. + * range-op.cc (unified_table::unified_table): Comment out BIT_AND_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * Makefile.in (OBJS): Add range-op-ptr.o. + * range-op-mixed.h (update_known_bitmask): Move prototype here. + (minus_op1_op2_relation_effect): Move prototype here. + (wi_includes_zero_p): Move function to here. + (wi_zero_p): Ditto. + * range-op.cc (update_known_bitmask): Remove static. + (wi_includes_zero_p): Move to header. + (wi_zero_p): Move to header. + (minus_op1_op2_relation_effect): Remove static. + (operator_pointer_diff): Move class and routines to range-op-ptr.cc. + (pointer_plus_operator): Ditto. + (pointer_min_max_operator): Ditto. + (pointer_and_operator): Ditto. + (pointer_or_operator): Ditto. + (pointer_table): Ditto. + (range_op_table::initialize_pointer_ops): Ditto. + * range-op-ptr.cc: New. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (class operator_max): Move from... + * range-op.cc (unified_table::unified_table): Add MAX_EXPR. + (get_op_handler): Remove the integral table. + (class operator_max): Move from here. + (integral_table::integral_table): Delete. + * range-op.h (class integral_table): Delete. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (class operator_min): Move from... + * range-op.cc (unified_table::unified_table): Add MIN_EXPR. + (class operator_min): Move from here. + (integral_table::integral_table): Remove MIN_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (class operator_bitwise_or): Move from... + * range-op.cc (unified_table::unified_table): Add BIT_IOR_EXPR. + (class operator_bitwise_or): Move from here. + (integral_table::integral_table): Remove BIT_IOR_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (class operator_bitwise_and): Move from... + * range-op.cc (unified_table::unified_table): Add BIT_AND_EXPR. + (get_op_handler): Check for a pointer table entry first. + (class operator_bitwise_and): Move from here. + (integral_table::integral_table): Remove BIT_AND_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (class operator_bitwise_xor): Move from... + * range-op.cc (unified_table::unified_table): Add BIT_XOR_EXPR. + (class operator_bitwise_xor): Move from here. + (integral_table::integral_table): Remove BIT_XOR_EXPR. + (pointer_table::pointer_table): Remove BIT_XOR_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (class operator_bitwise_not): Move from... + * range-op.cc (unified_table::unified_table): Add BIT_NOT_EXPR. + (class operator_bitwise_not): Move from here. + (integral_table::integral_table): Remove BIT_NOT_EXPR. + (pointer_table::pointer_table): Remove BIT_NOT_EXPR. + +2023-06-12 Andrew MacLeod <amacleod@redhat.com> + + * range-op-mixed.h (class operator_addr_expr): Move from... + * range-op.cc (unified_table::unified_table): Add ADDR_EXPR. + (class operator_addr_expr): Move from here. + (integral_table::integral_table): Remove ADDR_EXPR. + (pointer_table::pointer_table): Remove ADDR_EXPR. + +2023-06-12 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-vector-builtins-types.def + (vfloat16m1_t): Add type to lmul1 ops. + (vfloat16m2_t): Likewise. + (vfloat16m4_t): Likewise. + +2023-06-12 Richard Biener <rguenther@suse.de> + + * tree-ssa-alias.cc (call_may_clobber_ref_p_1): For + .MASK_STORE and friend set the size of the access to + unknown. + +2023-06-12 Tamar Christina <tamar.christina@arm.com> + + * config.in: Regenerate. + * configure: Regenerate. + * configure.ac: Remove DEFAULT_MATCHPD_PARTITIONS. + +2023-06-12 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * config/riscv/autovec-opt.md + (*v<any_shiftrt:optab><any_extend:optab>trunc<mode>): New pattern. + (*<any_shiftrt:optab>trunc<mode>): Ditto. + * config/riscv/autovec.md (<optab><mode>3): Change to + define_insn_and_split. + (v<optab><mode>3): Ditto. + (trunc<mode><v_double_trunc>2): Ditto. + +2023-06-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * simplify-rtx.cc (simplify_const_unary_operation): + Handle US_TRUNCATE, SS_TRUNCATE. + +2023-06-12 Eric Botcazou <ebotcazou@adacore.com> + + PR modula2/109952 + * doc/gm2.texi (Standard procedures): Fix Next link. + +2023-06-12 Tamar Christina <tamar.christina@arm.com> + + * config.in: Regenerate. + +2023-06-12 Andre Vieira <andre.simoesdiasvieira@arm.com> + + PR middle-end/110142 + * tree-vect-patterns.cc (vect_recog_widen_op_pattern): Don't pass + subtype to vect_widened_op_tree and remove subtype parameter, also + remove superfluous overloaded function definition. + (vect_recog_widen_plus_pattern): Remove subtype parameter and dont pass + to call to vect_recog_widen_op_pattern. + (vect_recog_widen_minus_pattern): Likewise. + +2023-06-12 liuhongt <hongtao.liu@intel.com> + + * config/i386/sse.md (vec_pack<floatprefix>_float_<mode>): New expander. + (vec_unpack_<fixprefix>fix_trunc_lo_<mode>): Ditto. + (vec_unpack_<fixprefix>fix_trunc_hi_<mode>): Ditto. + (vec_unpacks_lo_<mode>): Ditto. + (vec_unpacks_hi_<mode>): Ditto. + (sse_movlhps_<mode>): New define_insn. + (ssse3_palignr<mode>_perm): Extend to V_128H. + (V_128H): New mode iterator. + (ssepackPHmode): New mode attribute. + (vunpck_extract_mode): Ditto. + (vpckfloat_concat_mode): Extend to VxSI/VxSF for _Float16. + (vpckfloat_temp_mode): Ditto. + (vpckfloat_op_mode): Ditto. + (vunpckfixt_mode): Extend to VxHF. + (vunpckfixt_model): Ditto. + (vunpckfixt_extract_mode): Ditto. + +2023-06-12 Richard Biener <rguenther@suse.de> + + PR middle-end/110200 + * genmatch.cc (expr::gen_transform): Put braces around + the if arm for the (convert ...) short-cut. + +2023-06-12 Kewen Lin <linkw@linux.ibm.com> + + PR target/109932 + * config/rs6000/rs6000-builtins.def (__builtin_pack_vector_int128, + __builtin_unpack_vector_int128): Move from stanza power7 to vsx. + +2023-06-12 Kewen Lin <linkw@linux.ibm.com> + + PR target/110011 + * config/rs6000/rs6000.cc (output_toc): Use the mode of the 128-bit + floating constant itself for real_to_target call. + +2023-06-12 Pan Li <pan2.li@intel.com> + + * config/riscv/riscv-vector-builtins-types.def + (vfloat16mf4_t): Add type to X2/X4/X8/X16/X32 vlmul ext ops. + (vfloat16mf2_t): Ditto. + (vfloat16m1_t): Ditto. + (vfloat16m2_t): Ditto. + (vfloat16m4_t): Ditto. + +2023-06-12 David Edelsohn <dje.gcc@gmail.com> + + * config/rs6000/rs6000-logue.cc (rs6000_stack_info): + Do not require a stack frame when debugging is enabled for AIX. + 2023-06-11 Georg-Johann Lay <avr@gjlay.de> * config/avr/avr.md (adjust_len) [insv_notbit_0, insv_notbit_7]: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 995c0c1..d8455aa 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20230612 +20230616 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 0f81e46..65c60c7 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -158,6 +158,9 @@ LDFLAGS = @LDFLAGS@ # Should we build position-independent host code? PICFLAG = @PICFLAG@ +# The linker flag for the above. +LD_PICFLAG = @LD_PICFLAG@ + # Flags to determine code coverage. When coverage is disabled, this will # contain the optimization flags, as you normally want code coverage # without optimization. @@ -283,19 +286,19 @@ LINKER = $(CC) LINKER_FLAGS = $(CFLAGS) endif +enable_host_pie = @enable_host_pie@ + # Enable Intel CET on Intel CET enabled host if needed. CET_HOST_FLAGS = @CET_HOST_FLAGS@ COMPILER += $(CET_HOST_FLAGS) -NO_PIE_CFLAGS = @NO_PIE_CFLAGS@ -NO_PIE_FLAG = @NO_PIE_FLAG@ DO_LINK_MUTEX = @DO_LINK_MUTEX@ -# We don't want to compile the compilers with -fPIE, it make PCH fail. -COMPILER += $(NO_PIE_CFLAGS) +# Maybe compile the compilers with -fPIE or -fPIC. +COMPILER += $(PICFLAG) -# Link with -no-pie since we compile the compiler with -fno-PIE. -LINKER += $(NO_PIE_FLAG) +# Link with -pie, or -no-pie, depending on the above. +LINKER += $(LD_PICFLAG) # Like LINKER, but use a mutex for serializing front end links. ifeq (@DO_LINK_MUTEX@,true) @@ -1072,7 +1075,7 @@ RTL_SSA_H = $(PRETTY_PRINT_H) insn-config.h splay-tree-utils.h \ # programs built during a bootstrap. # autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a # cross compiler which does not use the native headers and libraries. -INTERNAL_CFLAGS = -DIN_GCC $(PICFLAG) @CROSS@ +INTERNAL_CFLAGS = -DIN_GCC @CROSS@ # This is the variable actually used when we compile. If you change this, # you probably want to update BUILD_CFLAGS in configure.ac @@ -1090,21 +1093,24 @@ ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \ ALL_CPPFLAGS = $(INCLUDES) $(CPPFLAGS) # This is the variable to use when using $(COMPILER). -ALL_COMPILERFLAGS = $(ALL_CXXFLAGS) +ALL_COMPILERFLAGS = $(ALL_CXXFLAGS) $(PICFLAG) # This is the variable to use when using $(LINKER). -ALL_LINKERFLAGS = $(ALL_CXXFLAGS) +ALL_LINKERFLAGS = $(ALL_CXXFLAGS) $(LD_PICFLAG) # Build and host support libraries. -# Use the "pic" build of libiberty if --enable-host-shared, unless we are -# building for mingw. +# Use the "pic" build of libiberty if --enable-host-shared or --enable-host-pie, +# unless we are building for mingw. LIBIBERTY_PICDIR=$(if $(findstring mingw,$(target)),,pic) -ifeq ($(enable_host_shared),yes) +ifneq ($(enable_host_shared)$(enable_host_pie),) LIBIBERTY = ../libiberty/$(LIBIBERTY_PICDIR)/libiberty.a -BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/$(LIBIBERTY_PICDIR)/libiberty.a else LIBIBERTY = ../libiberty/libiberty.a +endif +ifeq ($(enable_host_shared),yes) +BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/$(LIBIBERTY_PICDIR)/libiberty.a +else BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a endif @@ -1596,6 +1602,7 @@ OBJS = \ range.o \ range-op.o \ range-op-float.o \ + range-op-ptr.o \ read-md.o \ read-rtl.o \ read-rtl-function.o \ diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fe1d77d..c3035d1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,503 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * gcc-interface/Make-lang.in (ALL_ADAFLAGS): Remove NO_PIE_CFLAGS. Add + PICFLAG. Use PICFLAG when building ada/b_gnat1.o and ada/b_gnatb.o. + * gcc-interface/Makefile.in: Use pic/libiberty.a if PICFLAG is set. + Remove NO_PIE_FLAG. + +2023-06-15 Marc Poulhiès <poulhies@adacore.com> + + * vxworks7-cert-rtp-base-link.spec: Removed. + * vxworks7-cert-rtp-base-link__ppc64.spec: Removed. + * vxworks7-cert-rtp-base-link__x86.spec: Removed. + * vxworks7-cert-rtp-base-link__x86_64.spec: Removed. + * vxworks7-cert-rtp-link.spec: Removed. + * vxworks7-cert-rtp-link__ppcXX.spec: Removed. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/utils2.cc (build_binary_op) <MODIFY_EXPR>: Do not + remove a VIEW_CONVERT_EXPR on the LHS if it is also on the RHS. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Restrict + the special handling of temporaries created for return values and + subject to a renaming to the top level. + +2023-06-15 Ronan Desplanques <desplanques@adacore.com> + + * doc/gnat_ugn/about_this_guide.rst: Fix typo. Uniformize punctuation. + * doc/gnat_ugn/the_gnat_compilation_model.rst: Uniformize punctuation. + Fix capitalization. Fix indentation of code block. Fix RST formatting + syntax errors. + * gnat_ugn.texi: Regenerate. + +2023-06-15 Yannick Moy <moy@adacore.com> + + * sem_attr.adb (Analyze_Attribute): Reject case of Loop_Entry + inside the prefix of Loop_Entry, as per SPARK RM 5.5.3.1(4,8). + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch3.adb (Make_Allocator_For_Return): Rewrite the logic that + determines the type used for the allocation and add assertions. + * exp_util.adb (Has_Tag_Of_Type): Also return true for extension + aggregates. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * sinfo.ads (Iterator_Filter): Document field. + * sem_ch5.adb (Analyze_Iterator_Specification): Move comment around. + (Analyze_Loop_Parameter_Specification): Only preanalyze the iterator + filter, if any. + * exp_ch5.adb (Expand_N_Loop_Statement): Analyze the new list built + when an iterator filter is present. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * exp_util.adb (Find_Hook_Context): Revert latest change. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch3.adb (Make_Allocator_For_Return): Deal again specifically + with an aggregate returned through an object of a class-wide type. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Do not insert + an always empty list. Remove unused parameter Isc. + (Expand_Iterator_Loop): Adjust call to above procedure. + +2023-06-15 Ronan Desplanques <desplanques@adacore.com> + + * targparm.adb: Allow pragma Style_Checks in some forms. + * targparm.ads: Document new pragma permission. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * exp_util.ads (Within_Case_Or_If_Expression): Adjust description. + * exp_util.adb (Find_Hook_Context): Stop the search for the topmost + conditional expression, if within one, at contexts where temporaries + may be contained. + (Within_Case_Or_If_Expression): Return false upon first encoutering + contexts where temporaries may be contained. + +2023-06-15 Johannes Kliemann <kliemann@adacore.com> + + * libgnarl/s-osinte__qnx.adb: Adjust priority conversion function. + * libgnat/system-qnx-arm.ads: Adjust priority range and default + priority. + +2023-06-15 Ronan Desplanques <desplanques@adacore.com> + + * targparm.ads: Remove references to front-end-based exceptions. Fix + thinko. + +2023-06-15 Piotr Trojanek <trojanek@adacore.com> + + * contracts.adb (Add_Contract_Item): Add pragma Always_Terminates to + package contract. + * sem_prag.adb (Analyze_Pragma): Accept pragma Always_Terminates on + packages and generic packages, but only when it has no arguments. + +2023-06-15 Piotr Trojanek <trojanek@adacore.com> + + * sem_prag.adb (Analyze_Pragma): Accept pragma Always_Terminates when + it applies to an entry. + +2023-06-15 Piotr Trojanek <trojanek@adacore.com> + + * sem_prag.adb (Analyze_Pragma): Reject pragma Always_Terminates when + it applies to a function or generic function. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch4.adb (Analyze_Call): Adjust the test to detect the presence + of an incomplete view of a type on a function call. + +2023-06-15 Ronan Desplanques <desplanques@adacore.com> + + * ttypes.ads: Remove reference to Ttypef in comment. Fix typo in + comment. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * get_targ.ads (Get_Max_Unaligned_Field): Delete. + * ada_get_targ.adb (Get_Max_Unaligned_Field): Likewise. + * get_targ.adb (Get_Max_Unaligned_Field): Likewise. + * set_targ.ads (Max_Unaligned_Field): Adjust comment. + * set_targ.adb: Set Max_Unaligned_Field to 1 during elaboration. + * ttypes.ads (Max_Unaligned_Field): Delete. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * sem_type.adb (Disambiguate): Fix pasto in the implementation of + the RM 8.4(10) clause for operators. + +2023-06-15 Piotr Trojanek <trojanek@adacore.com> + + * aspects.adb + (Base_Aspect): Fix layout. + * aspects.ads + (Aspect_Argument): Expression for Always_Terminates is optional. + * sem_prag.adb + (Analyze_Always_Terminates_In_Decl_Part): Only analyze expression when + pragma argument is present. + (Analyze_Pragma): Argument for Always_Terminates is optional; fix + whitespace for Async_Readers. + +2023-06-15 Javier Miranda <miranda@adacore.com> + + * sem_util.adb + (Is_CPP_Constructor_Call): Add missing support for calls to + functions returning a private type. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * exp_util.ads (Build_Transient_Object_Statements): Remove obsolete + references to array and record aggregates in documentation. + +2023-06-15 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch13.adb (Analyze_Aspect_Specifications): Add missing items + in the list of aspects handled by means of Insert_Pragma. + <Aspect_Linker_Section>: Remove obsolete code. Do not delay the + processing of the aspect if the entity is already frozen. + +2023-06-15 Piotr Trojanek <trojanek@adacore.com> + + * sem_aggr.adb + (Resolve_Array_Aggregate): Simplify comment. + (Resolve_Iterated_Component_Association): Tune comment; change variable + to constant. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * sem_aggr.adb (Resolve_Iterated_Component_Association): Simply resolve + the expression. + +2023-06-13 Bob Duff <duff@adacore.com> + + * exp_ch4.adb + (Expand_N_Quantified_Expression): Detect the secondary-stack + case, and find the innermost scope where we should mark/release, + and Set_Uses_Sec_Stack on that. Skip intermediate blocks and loops + that are part of expansion. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * sem_util.adb (Is_Repeatedly_Evaluated): Recognize iterated component + association as repeatedly evaluated. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * sem_util.adb (Is_Potentially_Unevaluated): Recognize iterated + component association as potentially unevaluated. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * sem_res.adb (Resolve_Call): Replace early call to + In_Quantified_Expression with a call to Is_Potentially_Unevaluated that + was only done when Full_Analysis is true. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * aspects.ads (Aspect_Id): Add new aspect. + (Implementation_Defined_Aspect): New aspect is + implementation-defined. + (Aspect_Argument): New aspect has an expression argument. + (Is_Representation_Aspect): New aspect is not a representation + aspect. + (Aspect_Names): Link new aspect identifier with a name. + (Aspect_Delay): New aspect is never delayed. + * contracts.adb (Expand_Subprogram_Contract): Mention new aspect + in comment. + (Add_Contract_Item): Attach pragma corresponding to the new aspect + to contract items. + (Analyze_Entry_Or_Subprogram_Contract): Analyze pragma + corresponding to the new aspect that appears with subprogram spec. + (Analyze_Subprogram_Body_Stub_Contract): Expand pragma + corresponding to the new aspect. + * contracts.ads + (Add_Contract_Item, Analyze_Entry_Or_Subprogram_Contract) + (Analyze_Entry_Or_Subprogram_Body_Contract) + (Analyze_Subprogram_Body_Stub_Contract): Mention new aspect in + comment. + * einfo-utils.adb (Get_Pragma): Return pragma attached to + contract. + * einfo-utils.ads (Get_Pragma): Mention new contract in comment. + * exp_prag.adb (Expand_Pragma_Always_Terminates): Placeholder for + possibly expanding new aspect. + * exp_prag.ads (Expand_Pragma_Always_Terminates): Dedicated + routine for expansion of the new aspect. + * inline.adb (Remove_Aspects_And_Pragmas): Remove aspect from + inlined bodies. + * par-prag.adb (Prag): Postpone checking of the pragma until + analysis. + * sem_ch12.adb: Mention new aspect in explanation of handling + contracts on generic units. + * sem_ch13.adb (Analyze_Aspect_Specifications): Convert new aspect + into a corresponding pragma. + (Check_Aspect_At_Freeze_Point): Don't expect new aspect. + * sem_prag.adb (Analyze_Always_Terminates_In_Decl_Part): Analyze + pragma corresponding to the new aspect. + (Analyze_Pragma): Handle pragma corresponding to the new aspect. + (Is_Non_Significant_Pragma_Reference): Handle references appearing + within new aspect. + * sem_prag.ads (Aspect_Specifying_Pragma): New aspect can be + emulated with a pragma. + (Assertion_Expression_Pragma): New aspect has an assertion + expression. + (Pragma_Significant_To_Subprograms): New aspect is significant to + subprograms. + (Analyze_Always_Terminates_In_Decl_Part): Add spec for routine + that analyses new aspect. + (Find_Related_Declaration_Or_Body): Mention new aspect in comment. + * sem_util.adb (Is_Subprogram_Contract_Annotation): New aspect is + a subprogram contract annotation. + * sem_util.ads (Is_Subprogram_Contract_Annotation): Mention new + aspect in comment. + * sinfo.ads (Is_Generic_Contract_Pragma): New pragma is a generic + contract. + (Contract): Explain attaching new pragma to subprogram contract. + * snames.ads-tmpl (Name_Always_Terminates): New name for the new + contract. + (Pragma_Always_Terminates): New pragma identifier. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * sem_elab.adb (Check_Overriding_Primitive): Prevent Corresponding_Body + to be called with entity of an abstract subprogram. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch12.adb (Save_References_In_Identifier): In the case where + the identifier has been turned into a function call by analysis, + call Set_Global_Type on the entity if it is global. + +2023-06-13 Marc Poulhiès <poulhies@adacore.com> + + * sem_aggr.adb (Resolve_Iterated_Component_Association): Call + Preanalyze_And_Resolve instead of Resolve_Aggr_Expr except for + aggregate. + Co-authored-by: Ed Schonberg <schonberg@adacore.com> + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * contracts.adb (Contract_Error): New exception. + (Add_Contract_Item): Raise Contract_Error instead of Program_Error. + (Add_Generic_Contract_Pragma): Deal with Contract_Error. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * sem_attr.adb (Eval_Attribute): Add more exceptions to the early + return for a prefix which is a nonfrozen generic actual type. + * sem_ch12.adb (Copy_Generic_Node): Also check private views in the + case of an entity name or operator analyzed as a function call. + (Set_Global_Type): Make it a child of Save_Global_References. + (Save_References_In_Operator): In the case where the operator has + been turned into a function call, call Set_Global_Type on the entity + if it is global. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * contracts.adb (Analyze_Entry_Or_Subprogram_Body_Contract): For a + subprogram body that has no contracts and does not come from source, + make sure that contracts on its corresponding spec are analyzed, if + any, before expanding them. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * gen_il-fields.ads (Opt_Field_Enum): Add No_Finalize_Actions and + remove No_Side_Effect_Removal. + * gen_il-gen-gen_nodes.adb (N_Function_Call): Remove semantic flag + No_Side_Effect_Removal + (N_Assignment_Statement): Add semantic flag No_Finalize_Actions. + * sinfo.ads (No_Ctrl_Actions): Adjust comment. + (No_Finalize_Actions): New flag on assignment statements. + (No_Side_Effect_Removal): Delete. + * exp_aggr.adb (Build_Record_Aggr_Code): Remove obsolete comment and + Ancestor_Is_Expression variable. In the case of an extension, do + not generate a call to Adjust manually, call Set_No_Finalize_Actions + instead. Do not set the tags, replace call to Make_Unsuppress_Block + by Make_Suppress_Block and remove useless assertions. + In the general case, call Initialize_Component. + (Initialize_Controlled_Component): Delete. + (Initialize_Simple_Component): Delete. + (Initialize_Component): Do the low-level processing, but do not + generate a call to Adjust manually, call Set_No_Finalize_Actions. + (Process_Transient_Component): Delete. + (Process_Transient_Component_Completion): Likewise. + * exp_ch5.adb (Expand_Assign_Array): Deal with No_Finalize_Actions. + (Expand_Assign_Array_Loop): Likewise. + (Expand_N_Assignment_Statement): Likewise. + (Make_Tag_Ctrl_Assignment): Likewise. + * exp_util.adb (Remove_Side_Effects): Do not test the + No_Side_Effect_Removal flag. + * sem_prag.adb (Process_Suppress_Unsuppress): Give the warning in + SPARK mode only for pragma Suppress. + * tbuild.ads (Make_Suppress_Block): New declaration. + (Make_Unsuppress_Block): Adjust comment. + * tbuild.adb (Make_Suppress_Block): New procedure. + (Make_Unsuppress_Block): Unsuppress instead of suppressing. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch5.adb (Analyze_Assignment): Turn Rhs into a constant and + remove calls to the following subprograms. + (Transform_BIP_Assignment): Delete. + (Should_Transform_BIP_Assignment): Likewise. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * sem_util.ads (Is_Inherited_Operation_For_Type): Remove spec. + * sem_util.adb (Is_Inherited_Operation_For_Type): Remove body. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * exp_aggr.adb (Build_Record_Aggr_Code): Add new variable Ancestor_Q + to store the result of Unqualify on Ancestor. Remove the dead call + to Generate_Finalization_Actions in the case of another aggregate as + ancestor part. Remove the redundant setting of Assignment_OK. Use + Init_Typ in lieu of Etype (Ancestor) more consistently. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * exp_aggr.adb (Build_Record_Aggr_Code): In the case of an extension + aggregate of a limited type whose ancestor part is an aggregate, do + not skip the final code assigning the tag of the extension. + +2023-06-13 Yannick Moy <moy@adacore.com> + + * ghost.adb (Check_Ghost_Context): Allow absence of Ghost_Id + for attribute. Update error message to mention Ghost_Predicate. + (Is_Ghost_Attribute_Reference): New query. + * ghost.ads (Is_Ghost_Attribute_Reference): New query. + * sem_attr.adb (Resolve_Attribute): Check ghost context for ghost + attributes. + +2023-06-13 Daniel King <dmking@adacore.com> + + * libgnat/s-stoele.ads: Add No_Elaboration_Code_All pragma. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * exp_util.ads (Make_Tag_Assignment_From_Type): Declare. + * exp_util.adb (Make_Tag_Assignment_From_Type): New function. + * exp_aggr.adb (Build_Record_Aggr_Code): Call the above function. + (Initialize_Simple_Component): Likewise. + * exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Likewise. + (Build_Record_Init_Proc.Build_Init_Procedure ): Likewise. + (Make_Tag_Assignment): Likewise. Rename local variable and call + Unqualify to go through qualified expressions. + * exp_ch4.adb (Expand_Allocator_Expression): Likewise. + +2023-06-13 Yannick Moy <moy@adacore.com> + + * libgnat/a-strsup.ads: Change predicate aspect. + * sem_ch13.adb (Add_Predicate): Fix for first predicate. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * exp_aggr.adb (Initialize_Component): Perform immediate expansion + of the initialization expression if it is a conditional expression + and the component type is controlled. + +2023-06-13 Eric Botcazou <ebotcazou@adacore.com> + + * exp_aggr.adb (Initialize_Component): New procedure factored out + from the processing of array and record aggregates. + (Initialize_Controlled_Component): Likewise. + (Initialize_Simple_Component): Likewise. + (Build_Array_Aggr_Code.Gen_Assign): Remove In_Loop parameter. + Call Initialize_Component to initialize the component. + (Initialize_Array_Component): Delete. + (Initialize_Ctrl_Array_Component): Likewise. + (Build_Array_Aggr_Code): Adjust calls to Gen_Assign. + (Build_Record_Aggr_Code): Call Initialize_Simple_Component or + Initialize_Component to initialize the component. + (Initialize_Ctrl_Record_Component): Delete. + (Initialize_Record_Component): Likewise. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * exp_ch11.adb (Expand_N_Raise_Statement): Expansion of raise statements + never happens in GNATprove mode. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * exp_ch11.adb (Find_Local_Handler): Replace guard against other + constructs appearing in the list of exception handlers with iteration + using First_Non_Pragma/Next_Non_Pragma. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * exp_ch11.ads (Find_Local_Handler): Fix typo in comment. + * exp_ch11.adb (Find_Local_Handler): Remove redundant check for the + Exception_Handler list being present; use membership test to eliminate + local object LCN; fold nested IF statements. Remove useless ELSIF + condition. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * sem_util.adb (Check_Function_Writable_Actuals): Tune style; use + subtype name to detect membership test nodes. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * exp_disp.adb (Make_Disp_Asynchronous_Select_Spec): Use a single call + to New_List. + +2023-06-13 Yannick Moy <moy@adacore.com> + + * doc/gnat_rm/implementation_defined_aspects.rst: Document new + aspect. + * doc/gnat_rm/implementation_defined_pragmas.rst: Whitespace. + * aspects.adb (Init_Canonical_Aspect): Set it to Predicate. + * aspects.ads: Set global constants for new aspect. + * einfo.ads: Describe new flag related to new aspect. + * exp_ch6.adb (Can_Fold_Predicate_Call): Do not fold new aspect. + * exp_util.adb (Make_Predicate_Check): Add comment. + * gen_il-fields.ads: Add new flag. + * gen_il-gen-gen_entities.adb: Add new flag. + * ghost.adb (Is_OK_Ghost_Context): Ghost predicate is an OK + ghost context. + (Mark_Ghost_Pragma): Add overloading with ghost mode parameter. + * ghost.ads (Mark_Ghost_Pragma): Add overloading with ghpst mode + parameter. + (Name_To_Ghost_Mode): Make function public. + * sem_aggr.adb: Issue error for violation of valid use. + * sem_case.adb: Issue error for violation of valid use. + * sem_ch13.adb: Adapt for new aspect. + * sem_ch3.adb (Analyze_Full_Type_Declaration): Remove dead code + which was trying to propagate Has_Predicates flag in the wrong + direction (from derived to parent type). + (Analyze_Number_Declaration): Issue error for violation of valid + use. + (Build_Derived_Type): Cleanup inheritance of predicate flags from + parent to derived type. + (Build_Predicate_Function): Only add a predicate check when it + is not ignored as Ghost code. + * sem_ch4.adb (Analyze_Membership_Op): Issue an error for use of + a subtype with a ghost predicate as name in a membership test. + * sem_ch5.adb (Check_Predicate_Use): Issue error for violation of + valid use. + * sem_eval.adb: Adapt code for Dynamic_Predicate to account for + Ghost_Predicate too. + * sem_prag.adb (Analyze_Pragma): Make pragma ghost or not. + * sem_util.adb (Bad_Predicated_Subtype_Use): Adapt to new aspect. + (Inherit_Predicate_Flags): Add inheritance of flag. Add parameter + to apply to derived types. + * sem_util.ads (Inherit_Predicate_Flags): Change signature. + * snames.ads-tmpl: Add new aspect name. + * gnat_rm.texi: Regenerate. + +2023-06-13 Piotr Trojanek <trojanek@adacore.com> + + * exp_ch3.adb (Make_Controlling_Function_Wrappers): Remove early + decoration. + 2023-05-30 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.cc (get_storage_model_access): Also strip any diff --git a/gcc/ada/ada_get_targ.adb b/gcc/ada/ada_get_targ.adb index 6aadb77..5de9fc4 100644 --- a/gcc/ada/ada_get_targ.adb +++ b/gcc/ada/ada_get_targ.adb @@ -209,15 +209,6 @@ package body Get_Targ is end Get_Double_Scalar_Alignment; ----------------------------- - -- Get_Max_Unaligned_Field -- - ----------------------------- - - function Get_Max_Unaligned_Field return Pos is - begin - return 64; -- Can be different on some targets - end Get_Max_Unaligned_Field; - - ----------------------------- -- Register_Back_End_Types -- ----------------------------- diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index 0b2774f..c14769c 100644 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -41,20 +41,20 @@ package body Aspects is -- type. False means it is not inherited. Base_Aspect : constant array (Aspect_Id) of Boolean := - (Aspect_Atomic => True, - Aspect_Atomic_Components => True, - Aspect_Constant_Indexing => True, - Aspect_Default_Iterator => True, - Aspect_Discard_Names => True, - Aspect_Independent_Components => True, - Aspect_Iterator_Element => True, - Aspect_Stable_Properties => True, - Aspect_Type_Invariant => True, - Aspect_Unchecked_Union => True, - Aspect_Variable_Indexing => True, - Aspect_Volatile => True, - Aspect_Volatile_Full_Access => True, - others => False); + (Aspect_Atomic => True, + Aspect_Atomic_Components => True, + Aspect_Constant_Indexing => True, + Aspect_Default_Iterator => True, + Aspect_Discard_Names => True, + Aspect_Independent_Components => True, + Aspect_Iterator_Element => True, + Aspect_Stable_Properties => True, + Aspect_Type_Invariant => True, + Aspect_Unchecked_Union => True, + Aspect_Variable_Indexing => True, + Aspect_Volatile => True, + Aspect_Volatile_Full_Access => True, + others => False); -- The following array indicates type aspects that are inherited and apply -- to the class-wide type as well. @@ -542,6 +542,7 @@ package body Aspects is -- ...except for these: Result (Aspect_Dynamic_Predicate) := Aspect_Predicate; + Result (Aspect_Ghost_Predicate) := Aspect_Predicate; Result (Aspect_Inline_Always) := Aspect_Inline; Result (Aspect_Interrupt_Priority) := Aspect_Priority; Result (Aspect_Postcondition) := Aspect_Post; diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index 5771967..0567797 100644 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -72,6 +72,7 @@ package Aspects is Aspect_Address, Aspect_Aggregate, Aspect_Alignment, + Aspect_Always_Terminates, -- GNAT Aspect_Annotate, -- GNAT Aspect_Async_Readers, -- GNAT Aspect_Async_Writers, -- GNAT @@ -101,6 +102,7 @@ package Aspects is Aspect_External_Name, Aspect_External_Tag, Aspect_Ghost, -- GNAT + Aspect_Ghost_Predicate, -- GNAT Aspect_Global, -- GNAT Aspect_GNAT_Annotate, -- GNAT Aspect_Implicit_Dereference, @@ -260,6 +262,7 @@ package Aspects is Implementation_Defined_Aspect : constant array (Aspect_Id) of Boolean := (Aspect_Abstract_State => True, + Aspect_Always_Terminates => True, Aspect_Annotate => True, Aspect_Async_Readers => True, Aspect_Async_Writers => True, @@ -274,6 +277,7 @@ package Aspects is Aspect_Extensions_Visible => True, Aspect_Favor_Top_Level => True, Aspect_Ghost => True, + Aspect_Ghost_Predicate => True, Aspect_Global => True, Aspect_GNAT_Annotate => True, Aspect_Inline_Always => True, @@ -368,6 +372,7 @@ package Aspects is Aspect_Address => Expression, Aspect_Aggregate => Expression, Aspect_Alignment => Expression, + Aspect_Always_Terminates => Optional_Expression, Aspect_Annotate => Expression, Aspect_Async_Readers => Optional_Expression, Aspect_Async_Writers => Optional_Expression, @@ -397,6 +402,7 @@ package Aspects is Aspect_External_Name => Expression, Aspect_External_Tag => Expression, Aspect_Ghost => Optional_Expression, + Aspect_Ghost_Predicate => Expression, Aspect_Global => Expression, Aspect_GNAT_Annotate => Expression, Aspect_Implicit_Dereference => Name, @@ -474,6 +480,7 @@ package Aspects is Aspect_Address => True, Aspect_Aggregate => False, Aspect_Alignment => True, + Aspect_Always_Terminates => False, Aspect_Annotate => False, Aspect_Async_Readers => False, Aspect_Async_Writers => False, @@ -506,8 +513,9 @@ package Aspects is Aspect_External_Name => False, Aspect_External_Tag => False, Aspect_Ghost => False, + Aspect_Ghost_Predicate => False, Aspect_Global => False, - Aspect_GNAT_Annotate => False, + Aspect_GNAT_Annotate => False, Aspect_Implicit_Dereference => False, Aspect_Initial_Condition => False, Aspect_Initializes => False, @@ -626,6 +634,7 @@ package Aspects is Aspect_Aggregate => Name_Aggregate, Aspect_Alignment => Name_Alignment, Aspect_All_Calls_Remote => Name_All_Calls_Remote, + Aspect_Always_Terminates => Name_Always_Terminates, Aspect_Annotate => Name_Annotate, Aspect_Async_Readers => Name_Async_Readers, Aspect_Async_Writers => Name_Async_Writers, @@ -667,6 +676,7 @@ package Aspects is Aspect_Favor_Top_Level => Name_Favor_Top_Level, Aspect_Full_Access_Only => Name_Full_Access_Only, Aspect_Ghost => Name_Ghost, + Aspect_Ghost_Predicate => Name_Ghost_Predicate, Aspect_Global => Name_Global, Aspect_GNAT_Annotate => Name_GNAT_Annotate, Aspect_Implicit_Dereference => Name_Implicit_Dereference, @@ -912,6 +922,7 @@ package Aspects is Aspect_External_Name => Always_Delay, Aspect_External_Tag => Always_Delay, Aspect_Favor_Top_Level => Always_Delay, + Aspect_Ghost_Predicate => Always_Delay, Aspect_Implicit_Dereference => Always_Delay, Aspect_Independent => Always_Delay, Aspect_Independent_Components => Always_Delay, @@ -974,6 +985,7 @@ package Aspects is Aspect_Write => Always_Delay, Aspect_Abstract_State => Never_Delay, + Aspect_Always_Terminates => Never_Delay, Aspect_Annotate => Never_Delay, Aspect_Async_Readers => Never_Delay, Aspect_Async_Writers => Never_Delay, diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 7625abf..26bc4b3 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -62,6 +62,11 @@ with Warnsw; use Warnsw; package body Contracts is + Contract_Error : exception; + -- This exception is raised by Add_Contract_Item when it is invoked on an + -- invalid pragma. Note that clients of the package must filter them out + -- before invoking Add_Contract_Item, so it should not escape the package. + procedure Analyze_Package_Instantiation_Contract (Inst_Id : Entity_Id); -- Analyze all delayed pragmas chained on the contract of package -- instantiation Inst_Id as if they appear at the end of a declarative @@ -104,9 +109,9 @@ package body Contracts is procedure Expand_Subprogram_Contract (Body_Id : Entity_Id); -- Expand the contracts of a subprogram body and its correspoding spec (if -- any). This routine processes all [refined] pre- and postconditions as - -- well as Contract_Cases, Exceptional_Cases, Subprogram_Variant, - -- invariants and predicates. Body_Id denotes the entity of the - -- subprogram body. + -- well as Always_Terminates, Contract_Cases, Exceptional_Cases, + -- Subprogram_Variant, invariants and predicates. Body_Id denotes the + -- entity of the subprogram body. procedure Preanalyze_Condition (Subp : Entity_Id; @@ -198,7 +203,7 @@ package body Contracts is -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; -- Entry bodies, the applicable pragmas are: @@ -216,10 +221,11 @@ package body Contracts is -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; -- Entry or subprogram declarations, the applicable pragmas are: + -- Always_Terminates -- Attach_Handler -- Contract_Cases -- Depends @@ -255,7 +261,8 @@ package body Contracts is then Add_Classification; - elsif Prag_Nam in Name_Contract_Cases + elsif Prag_Nam in Name_Always_Terminates + | Name_Contract_Cases | Name_Exceptional_Cases | Name_Subprogram_Variant | Name_Test_Case @@ -268,7 +275,7 @@ package body Contracts is -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; -- Packages or instantiations, the applicable pragmas are: @@ -289,10 +296,13 @@ package body Contracts is elsif Prag_Nam = Name_Part_Of and then Is_Generic_Instance (Id) then Add_Classification; + elsif Prag_Nam = Name_Always_Terminates then + Add_Contract_Test_Case; + -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; -- Package bodies, the applicable pragmas are: @@ -305,7 +315,7 @@ package body Contracts is -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; -- The four volatility refinement pragmas are ok for all types. @@ -343,7 +353,7 @@ package body Contracts is -- The pragma is not a proper contract item - raise Program_Error; + raise Contract_Error; end if; end; @@ -367,7 +377,7 @@ package body Contracts is -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; -- Task bodies, the applicable pragmas are: @@ -381,7 +391,7 @@ package body Contracts is -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; -- Task units, the applicable pragmas are: @@ -416,11 +426,11 @@ package body Contracts is -- The pragma is not a proper contract item else - raise Program_Error; + raise Contract_Error; end if; else - raise Program_Error; + raise Contract_Error; end if; end Add_Contract_Item; @@ -598,6 +608,22 @@ package body Contracts is else Set_Analyzed (Items); end if; + + -- When this is a subprogram body not coming from source, for example an + -- expression function, it does not cause freezing of previous contracts + -- (see Analyze_Subprogram_Body_Helper), in particular not of those on + -- its spec if it exists. In this case make sure they have been properly + -- analyzed before being expanded below, as we may be invoked during the + -- freezing of the subprogram in the middle of its enclosing declarative + -- part because the declarative part contains e.g. the declaration of a + -- variable initialized by means of a call to the subprogram. + + elsif Nkind (Body_Decl) = N_Subprogram_Body + and then not Comes_From_Source (Original_Node (Body_Decl)) + and then Present (Corresponding_Spec (Body_Decl)) + and then Present (Contract (Corresponding_Spec (Body_Decl))) + then + Analyze_Entry_Or_Subprogram_Contract (Corresponding_Spec (Body_Decl)); end if; -- Due to the timing of contract analysis, delayed pragmas may be @@ -642,10 +668,10 @@ package body Contracts is Gen_Id => Spec_Id); end if; - -- Deal with preconditions, [refined] postconditions, Contract_Cases, - -- Exceptional_Cases, Subprogram_Variant, invariants and predicates - -- associated with body and its spec. Do not expand the contract of - -- subprogram body stubs. + -- Deal with preconditions, [refined] postconditions, Always_Terminates, + -- Contract_Cases, Exceptional_Cases, Subprogram_Variant, invariants and + -- predicates associated with body and its spec. Do not expand the + -- contract of subprogram body stubs. if Nkind (Body_Decl) = N_Subprogram_Body then Expand_Subprogram_Contract (Body_Id); @@ -768,7 +794,10 @@ package body Contracts is while Present (Prag) loop Prag_Nam := Pragma_Name (Prag); - if Prag_Nam = Name_Contract_Cases then + if Prag_Nam = Name_Always_Terminates then + Analyze_Always_Terminates_In_Decl_Part (Prag); + + elsif Prag_Nam = Name_Contract_Cases then -- Do not analyze the contract cases of an entry declaration -- unless annotating the original tree for GNATprove. @@ -1512,6 +1541,7 @@ package body Contracts is Analyze_Entry_Or_Subprogram_Body_Contract (Stub_Id); -- The stub acts as its own spec, the applicable pragmas are: + -- Always_Terminates -- Contract_Cases -- Depends -- Exceptional_Cases @@ -2209,6 +2239,12 @@ package body Contracts is else Add_Contract_Item (Prag, Templ_Id); end if; + + exception + -- We do not stop the compilation at this point in the case of an + -- invalid pragma because it will be properly diagnosed afterward. + + when Contract_Error => null; end Add_Generic_Contract_Pragma; -- Local variables @@ -2852,7 +2888,10 @@ package body Contracts is Prag := Contract_Test_Cases (Items); while Present (Prag) loop if Is_Checked (Prag) then - if Pragma_Name (Prag) = Name_Contract_Cases then + if Pragma_Name (Prag) = Name_Always_Terminates then + Expand_Pragma_Always_Terminates (Prag); + + elsif Pragma_Name (Prag) = Name_Contract_Cases then Expand_Pragma_Contract_Cases (CCs => Prag, Subp_Id => Subp_Id, diff --git a/gcc/ada/contracts.ads b/gcc/ada/contracts.ads index d52e1aa..c3dc5d6 100644 --- a/gcc/ada/contracts.ads +++ b/gcc/ada/contracts.ads @@ -37,6 +37,7 @@ package Contracts is -- The following are valid pragmas: -- -- Abstract_State + -- Always_Terminates -- Async_Readers -- Async_Writers -- Attach_Handler @@ -81,6 +82,7 @@ package Contracts is -- subprogram body Body_Id as if they appeared at the end of a declarative -- region. Pragmas in question are: -- + -- Always_Terminates (stand alone subprogram body) -- Contract_Cases (stand alone subprogram body) -- Depends (stand alone subprogram body) -- Exceptional_Cases (stand alone subprogram body) @@ -100,6 +102,7 @@ package Contracts is -- subprogram Subp_Id as if they appeared at the end of a declarative -- region. The pragmas in question are: -- + -- Always_Terminates -- Contract_Cases -- Depends -- Exceptional_Cases @@ -175,6 +178,7 @@ package Contracts is -- stub Stub_Id as if they appeared at the end of a declarative region. The -- pragmas in question are: -- + -- Always_Terminates -- Contract_Cases -- Depends -- Exceptional_Cases diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst index 960c505..b37a158 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst @@ -255,6 +255,16 @@ Aspect Ghost This aspect is equivalent to :ref:`pragma Ghost<Pragma-Ghost>`. +Aspect Ghost_Predicate +====================== +.. index:: Ghost_Predicate + +This aspect introduces a subtype predicate that can reference ghost +entities. The subtype cannot appear as a subtype_mark in a membership test. + +For the detailed semantics of this aspect, see the entry for subtype predicates +in the SPARK Reference Manual, section 3.2.4. + Aspect Global ============= .. index:: Global diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index a6c5600..35a3fe5 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -3530,7 +3530,7 @@ and the Ceiling_Locking locking policy is in effect, then the run-time actions associated with the Ceiling_Locking locking policy (described in Ada RM D.3) are not performed when a protected operation of the protected unit is executed. - + Pragma Loop_Invariant ===================== diff --git a/gcc/ada/doc/gnat_ugn/about_this_guide.rst b/gcc/ada/doc/gnat_ugn/about_this_guide.rst index 3347626..18cfb02 100644 --- a/gcc/ada/doc/gnat_ugn/about_this_guide.rst +++ b/gcc/ada/doc/gnat_ugn/about_this_guide.rst @@ -38,17 +38,17 @@ This guide contains the following chapters: using the GNU make utility with GNAT. * :ref:`GNAT_Utility_Programs` explains the various utility programs that - are included in the GNAT environment + are included in the GNAT environment. * :ref:`GNAT_and_Program_Execution` covers a number of topics related to - running, debugging, and tuning the performace of programs developed - with GNAT + running, debugging, and tuning the performance of programs developed + with GNAT. Appendices cover several additional topics: * :ref:`Platform_Specific_Information` describes the different run-time library implementations and also presents information on how to use - GNAT on several specific platforms + GNAT on several specific platforms. * :ref:`Example_of_Binder_Output_File` shows the source code for the binder output file for a sample program. diff --git a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst index 77a2055..c7f15b4 100644 --- a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst +++ b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst @@ -168,7 +168,7 @@ GNAT also supports several other 8-bit coding schemes: *ISO 8859-15 (Latin-9)* ISO 8859-15 (Latin-9) letters allowed in identifiers, with uppercase and - lowercase equivalence + lowercase equivalence. .. index:: code page 437 (IBM PC) @@ -1778,8 +1778,8 @@ default, that contains calls to the elaboration procedures of those compilation unit that require them, followed by a call to the main program. This Ada program is compiled to generate the object file for the main program. The name of -the Ada file is :file:`b~xxx`.adb` (with the corresponding spec -:file:`b~xxx`.ads`) where ``xxx`` is the name of the +the Ada file is :file:`b~xxx.adb` (with the corresponding spec +:file:`b~xxx.ads`) where ``xxx`` is the name of the main program unit. Finally, the linker is used to build the resulting executable program, @@ -3590,7 +3590,7 @@ Convention identifiers are recognized by GNAT: Ada compiler for further details on elaboration. However, it is not possible to mix the tasking run time of GNAT and - HP Ada 83, All the tasking operations must either be entirely within + HP Ada 83, all the tasking operations must either be entirely within GNAT compiled sections of the program, or entirely within HP Ada 83 compiled sections of the program. @@ -3715,14 +3715,14 @@ Convention identifiers are recognized by GNAT: to perform dimensional checks: - .. code-block:: ada + .. code-block:: ada - type Distance is new Long_Float; - type Time is new Long_Float; - type Velocity is new Long_Float; - function "/" (D : Distance; T : Time) - return Velocity; - pragma Import (Intrinsic, "/"); + type Distance is new Long_Float; + type Time is new Long_Float; + type Velocity is new Long_Float; + function "/" (D : Distance; T : Time) + return Velocity; + pragma Import (Intrinsic, "/"); This common idiom is often programmed with a generic definition and an explicit body. The pragma makes it simpler to introduce such declarations. @@ -3858,7 +3858,7 @@ considered: * Using GNAT and G++ from two different GCC installations: If both - compilers are on the :envvar`PATH`, the previous method may be used. It is + compilers are on the :envvar:`PATH`, the previous method may be used. It is important to note that environment variables such as :envvar:`C_INCLUDE_PATH`, :envvar:`GCC_EXEC_PREFIX`, :envvar:`BINUTILS_ROOT`, and diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb index d1db66f..dad3a65 100644 --- a/gcc/ada/einfo-utils.adb +++ b/gcc/ada/einfo-utils.adb @@ -1017,6 +1017,7 @@ package body Einfo.Utils is -- Contract / subprogram variant / test case pragmas Is_CTC : constant Boolean := + Id = Pragma_Always_Terminates or else Id = Pragma_Contract_Cases or else Id = Pragma_Exceptional_Cases or else Id = Pragma_Subprogram_Variant or else diff --git a/gcc/ada/einfo-utils.ads b/gcc/ada/einfo-utils.ads index e805502..fee771c 100644 --- a/gcc/ada/einfo-utils.ads +++ b/gcc/ada/einfo-utils.ads @@ -439,6 +439,7 @@ package Einfo.Utils is -- node, otherwise Empty is returned. The following contract pragmas that -- appear in N_Contract nodes are also handled by this routine: -- Abstract_State + -- Always_Terminates -- Async_Readers -- Async_Writers -- Attach_Handler diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 39efb93..a861ff7 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -1677,6 +1677,10 @@ package Einfo is -- Exp_Dbug for a full description of the use of this flag and also the -- related flag Has_Qualified_Name. +-- Has_Ghost_Predicate_Aspect +-- Defined in all types and subtypes. Set if a Ghost_Predicate aspect +-- was explicitly applied to the type. + -- Has_Gigi_Rep_Item -- Defined in all entities. Set if the rep item chain (referenced by -- First_Rep_Item and linked through the Next_Rep_Item chain) contains a @@ -5026,6 +5030,7 @@ package Einfo is -- Has_Delayed_Rep_Aspects -- Has_Discriminants -- Has_Dynamic_Predicate_Aspect + -- Has_Ghost_Predicate_Aspect -- Has_Independent_Components (base type only) -- Has_Inheritable_Invariants (base type only) -- Has_Inherited_DIC (base type only) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 270d3bb..fb5f404 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -105,6 +105,16 @@ package body Exp_Aggr is -- N is an aggregate (record or array). Checks the presence of default -- initialization (<>) in any component (Ada 2005: AI-287). + procedure Initialize_Component + (N : Node_Id; + Comp : Node_Id; + Comp_Typ : Node_Id; + Init_Expr : Node_Id; + Stmts : List_Id); + -- Perform the initialization of component Comp with expected type + -- Comp_Typ of aggregate N. Init_Expr denotes the initialization + -- expression of the component. All generated code is added to Stmts. + function Is_CCG_Supported_Aggregate (N : Node_Id) return Boolean; -- Return True if aggregate N is located in a context supported by the -- CCG backend; False otherwise. @@ -151,37 +161,6 @@ package body Exp_Aggr is -- Returns the number of discrete choices (not including the others choice -- if present) contained in (sub-)aggregate N. - procedure Process_Transient_Component - (Loc : Source_Ptr; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Fin_Call : out Node_Id; - Hook_Clear : out Node_Id; - Aggr : Node_Id := Empty; - Stmts : List_Id := No_List); - -- Subsidiary to the expansion of array and record aggregates. Generate - -- part of the necessary code to finalize a transient component. Comp_Typ - -- is the component type. Init_Expr is the initialization expression of the - -- component which is always a function call. Fin_Call is the finalization - -- call used to clean up the transient function result. Hook_Clear is the - -- hook reset statement. Aggr and Stmts both control the placement of the - -- generated code. Aggr is the related aggregate. If present, all code is - -- inserted prior to Aggr using Insert_Action. Stmts is the initialization - -- statements of the component. If present, all code is added to Stmts. - - procedure Process_Transient_Component_Completion - (Loc : Source_Ptr; - Aggr : Node_Id; - Fin_Call : Node_Id; - Hook_Clear : Node_Id; - Stmts : List_Id); - -- Subsidiary to the expansion of array and record aggregates. Generate - -- part of the necessary code to finalize a transient component. Aggr is - -- the related aggregate. Fin_Clear is the finalization call used to clean - -- up the transient component. Hook_Clear is the hook reset statement. - -- Stmts is the initialization statement list for the component. All - -- generated code is added to Stmts. - procedure Sort_Case_Table (Case_Table : in out Case_Table_Type); -- Sort the Case Table using the Lower Bound of each Choice as the key. -- A simple insertion sort is used since the number of choices in a case @@ -1081,16 +1060,14 @@ package body Exp_Aggr is function Gen_Assign (Ind : Node_Id; - Expr : Node_Id; - In_Loop : Boolean := False) return List_Id; + Expr : Node_Id) return List_Id; -- Ind must be a side-effect-free expression. If the input aggregate N -- to Build_Loop contains no subaggregates, then this function returns -- the assignment statement: -- -- Into (Indexes, Ind) := Expr; -- - -- Otherwise we call Build_Code recursively. Flag In_Loop should be set - -- when the assignment appears within a generated loop. + -- Otherwise we call Build_Code recursively. -- -- Ada 2005 (AI-287): In case of default initialized component, Expr -- is empty and we generate a call to the corresponding IP subprogram. @@ -1310,35 +1287,13 @@ package body Exp_Aggr is function Gen_Assign (Ind : Node_Id; - Expr : Node_Id; - In_Loop : Boolean := False) return List_Id + Expr : Node_Id) return List_Id is function Add_Loop_Actions (Lis : List_Id) return List_Id; -- Collect insert_actions generated in the construction of a loop, -- and prepend them to the sequence of assignments to complete the -- eventual body of the loop. - procedure Initialize_Array_Component - (Arr_Comp : Node_Id; - Comp_Typ : Node_Id; - Init_Expr : Node_Id; - Stmts : List_Id); - -- Perform the initialization of array component Arr_Comp with - -- expected type Comp_Typ. Init_Expr denotes the initialization - -- expression of the array component. All generated code is added - -- to list Stmts. - - procedure Initialize_Ctrl_Array_Component - (Arr_Comp : Node_Id; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Stmts : List_Id); - -- Perform the initialization of array component Arr_Comp when its - -- expected type Comp_Typ needs finalization actions. Init_Expr is - -- the initialization expression of the array component. All hook- - -- related declarations are inserted prior to aggregate N. Remaining - -- code is added to list Stmts. - ---------------------- -- Add_Loop_Actions -- ---------------------- @@ -1366,263 +1321,6 @@ package body Exp_Aggr is end if; end Add_Loop_Actions; - -------------------------------- - -- Initialize_Array_Component -- - -------------------------------- - - procedure Initialize_Array_Component - (Arr_Comp : Node_Id; - Comp_Typ : Node_Id; - Init_Expr : Node_Id; - Stmts : List_Id) - is - Exceptions_OK : constant Boolean := - not Restriction_Active - (No_Exception_Propagation); - - Finalization_OK : constant Boolean := - Present (Comp_Typ) - and then Needs_Finalization (Comp_Typ); - - Full_Typ : constant Entity_Id := Underlying_Type (Comp_Typ); - Adj_Call : Node_Id; - Blk_Stmts : List_Id; - Init_Stmt : Node_Id; - - begin - -- Protect the initialization statements from aborts. Generate: - - -- Abort_Defer; - - if Finalization_OK and Abort_Allowed then - if Exceptions_OK then - Blk_Stmts := New_List; - else - Blk_Stmts := Stmts; - end if; - - Append_To (Blk_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer)); - - -- Otherwise aborts are not allowed. All generated code is added - -- directly to the input list. - - else - Blk_Stmts := Stmts; - end if; - - -- Initialize the array element. Generate: - - -- Arr_Comp := Init_Expr; - - -- Note that the initialization expression is replicated because - -- it has to be reevaluated within a generated loop. - - Init_Stmt := - Make_OK_Assignment_Statement (Loc, - Name => New_Copy_Tree (Arr_Comp), - Expression => New_Copy_Tree (Init_Expr)); - Set_No_Ctrl_Actions (Init_Stmt); - - Append_To (Blk_Stmts, Init_Stmt); - - -- Adjust the tag due to a possible view conversion. Generate: - - -- Arr_Comp._tag := Full_TypP; - - if Tagged_Type_Expansion - and then Present (Comp_Typ) - and then Is_Tagged_Type (Comp_Typ) - then - Append_To (Blk_Stmts, - Make_OK_Assignment_Statement (Loc, - Name => - Make_Selected_Component (Loc, - Prefix => New_Copy_Tree (Arr_Comp), - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Full_Typ), Loc)), - - Expression => - Unchecked_Convert_To (RTE (RE_Tag), - New_Occurrence_Of - (Node (First_Elmt (Access_Disp_Table (Full_Typ))), - Loc)))); - end if; - - -- Adjust the array component. Controlled subaggregates are not - -- considered because each of their individual elements will - -- receive an adjustment of its own. Generate: - - -- [Deep_]Adjust (Arr_Comp); - - if Finalization_OK - and then not Is_Limited_Type (Comp_Typ) - and then not Is_Build_In_Place_Function_Call (Init_Expr) - and then not - (Is_Array_Type (Comp_Typ) - and then Needs_Finalization (Component_Type (Comp_Typ)) - and then Nkind (Unqualify (Init_Expr)) = N_Aggregate) - then - Adj_Call := - Make_Adjust_Call - (Obj_Ref => New_Copy_Tree (Arr_Comp), - Typ => Comp_Typ); - - -- Guard against a missing [Deep_]Adjust when the component - -- type was not frozen properly. - - if Present (Adj_Call) then - Append_To (Blk_Stmts, Adj_Call); - end if; - end if; - - -- Complete the protection of the initialization statements - - if Finalization_OK and Abort_Allowed then - - -- Wrap the initialization statements in a block to catch a - -- potential exception. Generate: - - -- begin - -- Abort_Defer; - -- Arr_Comp := Init_Expr; - -- Arr_Comp._tag := Full_TypP; - -- [Deep_]Adjust (Arr_Comp); - -- at end - -- Abort_Undefer_Direct; - -- end; - - if Exceptions_OK then - Append_To (Stmts, - Build_Abort_Undefer_Block (Loc, - Stmts => Blk_Stmts, - Context => N)); - - -- Otherwise exceptions are not propagated. Generate: - - -- Abort_Defer; - -- Arr_Comp := Init_Expr; - -- Arr_Comp._tag := Full_TypP; - -- [Deep_]Adjust (Arr_Comp); - -- Abort_Undefer; - - else - Append_To (Blk_Stmts, - Build_Runtime_Call (Loc, RE_Abort_Undefer)); - end if; - end if; - end Initialize_Array_Component; - - ------------------------------------- - -- Initialize_Ctrl_Array_Component -- - ------------------------------------- - - procedure Initialize_Ctrl_Array_Component - (Arr_Comp : Node_Id; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Stmts : List_Id) - is - Init_Expr_Q : constant Node_Id := Unqualify (Init_Expr); - - Act_Aggr : Node_Id; - Act_Stmts : List_Id; - Fin_Call : Node_Id; - Hook_Clear : Node_Id; - - In_Place_Expansion : Boolean; - -- Flag set when a nonlimited controlled function call requires - -- in-place expansion. - - begin - -- Perform a preliminary analysis and resolution to determine what - -- the initialization expression denotes. An unanalyzed function - -- call may appear as an identifier or an indexed component. - - if Nkind (Init_Expr_Q) in N_Function_Call - | N_Identifier - | N_Indexed_Component - and then not Analyzed (Init_Expr) - then - Preanalyze_And_Resolve (Init_Expr, Comp_Typ); - end if; - - In_Place_Expansion := - Nkind (Init_Expr_Q) = N_Function_Call - and then not Is_Build_In_Place_Result_Type (Comp_Typ); - - -- The initialization expression is a controlled function call. - -- Perform in-place removal of side effects to avoid creating a - -- transient scope, which leads to premature finalization. - - -- This in-place expansion is not performed for limited transient - -- objects, because the initialization is already done in place. - - if In_Place_Expansion then - - -- Suppress the removal of side effects by general analysis, - -- because this behavior is emulated here. This avoids the - -- generation of a transient scope, which leads to out-of-order - -- adjustment and finalization. - - Set_No_Side_Effect_Removal (Init_Expr); - - -- When the transient component initialization is related to a - -- range or an "others", keep all generated statements within - -- the enclosing loop. This way the controlled function call - -- will be evaluated at each iteration, and its result will be - -- finalized at the end of each iteration. - - if In_Loop then - Act_Aggr := Empty; - Act_Stmts := Stmts; - - -- Otherwise this is a single component initialization. Hook- - -- related statements are inserted prior to the aggregate. - - else - Act_Aggr := N; - Act_Stmts := No_List; - end if; - - -- Install all hook-related declarations and prepare the clean - -- up statements. - - Process_Transient_Component - (Loc => Loc, - Comp_Typ => Comp_Typ, - Init_Expr => Init_Expr, - Fin_Call => Fin_Call, - Hook_Clear => Hook_Clear, - Aggr => Act_Aggr, - Stmts => Act_Stmts); - end if; - - -- Use the noncontrolled component initialization circuitry to - -- assign the result of the function call to the array element. - -- This also performs subaggregate wrapping, tag adjustment, and - -- [deep] adjustment of the array element. - - Initialize_Array_Component - (Arr_Comp => Arr_Comp, - Comp_Typ => Comp_Typ, - Init_Expr => Init_Expr, - Stmts => Stmts); - - -- At this point the array element is fully initialized. Complete - -- the processing of the controlled array component by finalizing - -- the transient function result. - - if In_Place_Expansion then - Process_Transient_Component_Completion - (Loc => Loc, - Aggr => N, - Fin_Call => Fin_Call, - Hook_Clear => Hook_Clear, - Stmts => Stmts); - end if; - end Initialize_Ctrl_Array_Component; - -- Local variables Stmts : constant List_Id := New_List; @@ -1768,57 +1466,12 @@ package body Exp_Aggr is end if; if Present (Expr) then - - -- Handle an initialization expression of a controlled type in - -- case it denotes a function call. In general such a scenario - -- will produce a transient scope, but this will lead to wrong - -- order of initialization, adjustment, and finalization in the - -- context of aggregates. - - -- Target (1) := Ctrl_Func_Call; - - -- begin -- scope - -- Trans_Obj : ... := Ctrl_Func_Call; -- object - -- Target (1) := Trans_Obj; - -- Finalize (Trans_Obj); - -- end; - -- Target (1)._tag := ...; - -- Adjust (Target (1)); - - -- In the example above, the call to Finalize occurs too early - -- and as a result it may leave the array component in a bad - -- state. Finalization of the transient object should really - -- happen after adjustment. - - -- To avoid this scenario, perform in-place side-effect removal - -- of the function call. This eliminates the transient property - -- of the function result and ensures correct order of actions. - - -- Res : ... := Ctrl_Func_Call; - -- Target (1) := Res; - -- Target (1)._tag := ...; - -- Adjust (Target (1)); - -- Finalize (Res); - - if Present (Comp_Typ) - and then Needs_Finalization (Comp_Typ) - and then Nkind (Expr_Q) /= N_Aggregate - then - Initialize_Ctrl_Array_Component - (Arr_Comp => Indexed_Comp, - Comp_Typ => Comp_Typ, - Init_Expr => Expr, - Stmts => Stmts); - - -- Otherwise perform simple component initialization - - else - Initialize_Array_Component - (Arr_Comp => Indexed_Comp, - Comp_Typ => Comp_Typ, - Init_Expr => Expr, - Stmts => Stmts); - end if; + Initialize_Component + (N => N, + Comp => Indexed_Comp, + Comp_Typ => Comp_Typ, + Init_Expr => Expr, + Stmts => Stmts); -- Ada 2005 (AI-287): In case of default initialized component, call -- the initialization subprogram associated with the component type. @@ -2070,8 +1723,7 @@ package body Exp_Aggr is -- Construct the statements to execute in the loop body - L_Body := - Gen_Assign (New_Occurrence_Of (L_J, Loc), Expr, In_Loop => True); + L_Body := Gen_Assign (New_Occurrence_Of (L_J, Loc), Expr); -- Construct the final loop @@ -2184,7 +1836,7 @@ package body Exp_Aggr is Append_To (W_Body, W_Increment); Append_List_To (W_Body, - Gen_Assign (New_Occurrence_Of (W_J, Loc), Expr, In_Loop => True)); + Gen_Assign (New_Occurrence_Of (W_J, Loc), Expr)); -- Construct the final loop @@ -2539,14 +2191,6 @@ package body Exp_Aggr is Comp_Expr : Node_Id; Expr_Q : Node_Id; - -- If this is an internal aggregate, the External_Final_List is an - -- expression for the controller record of the enclosing type. - - -- If the current aggregate has several controlled components, this - -- expression will appear in several calls to attach to the finali- - -- zation list, and it must not be shared. - - Ancestor_Is_Expression : Boolean := False; Ancestor_Is_Subtype_Mark : Boolean := False; Init_Typ : Entity_Id := Empty; @@ -2606,26 +2250,6 @@ package body Exp_Aggr is -- The type of the aggregate is a subtype created ealier using the -- given values of the discriminant components of the aggregate. - procedure Initialize_Ctrl_Record_Component - (Rec_Comp : Node_Id; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Stmts : List_Id); - -- Perform the initialization of controlled record component Rec_Comp. - -- Comp_Typ is the component type. Init_Expr is the initialization - -- expression for the record component. Hook-related declarations are - -- inserted prior to aggregate N using Insert_Action. All remaining - -- generated code is added to list Stmts. - - procedure Initialize_Record_Component - (Rec_Comp : Node_Id; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Stmts : List_Id); - -- Perform the initialization of record component Rec_Comp. Comp_Typ - -- is the component type. Init_Expr is the initialization expression - -- of the record component. All generated code is added to list Stmts. - function Is_Int_Range_Bounds (Bounds : Node_Id) return Boolean; -- Check whether Bounds is a range node and its lower and higher bounds -- are integers literals. @@ -3119,236 +2743,6 @@ package body Exp_Aggr is end loop; end Init_Stored_Discriminants; - -------------------------------------- - -- Initialize_Ctrl_Record_Component -- - -------------------------------------- - - procedure Initialize_Ctrl_Record_Component - (Rec_Comp : Node_Id; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Stmts : List_Id) - is - Init_Expr_Q : constant Node_Id := Unqualify (Init_Expr); - - Fin_Call : Node_Id; - Hook_Clear : Node_Id; - - In_Place_Expansion : Boolean; - -- Flag set when a nonlimited controlled function call requires - -- in-place expansion. - - begin - -- Perform a preliminary analysis and resolution to determine what - -- the initialization expression denotes. Unanalyzed function calls - -- may appear as identifiers or indexed components. - - if Nkind (Init_Expr_Q) in N_Function_Call - | N_Identifier - | N_Indexed_Component - and then not Analyzed (Init_Expr) - then - Preanalyze_And_Resolve (Init_Expr, Comp_Typ); - end if; - - In_Place_Expansion := - Nkind (Init_Expr_Q) = N_Function_Call - and then not Is_Build_In_Place_Result_Type (Comp_Typ); - - -- The initialization expression is a controlled function call. - -- Perform in-place removal of side effects to avoid creating a - -- transient scope. - - -- This in-place expansion is not performed for limited transient - -- objects because the initialization is already done in place. - - if In_Place_Expansion then - - -- Suppress the removal of side effects by general analysis - -- because this behavior is emulated here. This avoids the - -- generation of a transient scope, which leads to out-of-order - -- adjustment and finalization. - - Set_No_Side_Effect_Removal (Init_Expr); - - -- Install all hook-related declarations and prepare the clean up - -- statements. The generated code follows the initialization order - -- of individual components and discriminants, rather than being - -- inserted prior to the aggregate. This ensures that a transient - -- component which mentions a discriminant has proper visibility - -- of the discriminant. - - Process_Transient_Component - (Loc => Loc, - Comp_Typ => Comp_Typ, - Init_Expr => Init_Expr, - Fin_Call => Fin_Call, - Hook_Clear => Hook_Clear, - Stmts => Stmts); - end if; - - -- Use the noncontrolled component initialization circuitry to - -- assign the result of the function call to the record component. - -- This also performs tag adjustment and [deep] adjustment of the - -- record component. - - Initialize_Record_Component - (Rec_Comp => Rec_Comp, - Comp_Typ => Comp_Typ, - Init_Expr => Init_Expr, - Stmts => Stmts); - - -- At this point the record component is fully initialized. Complete - -- the processing of the controlled record component by finalizing - -- the transient function result. - - if In_Place_Expansion then - Process_Transient_Component_Completion - (Loc => Loc, - Aggr => N, - Fin_Call => Fin_Call, - Hook_Clear => Hook_Clear, - Stmts => Stmts); - end if; - end Initialize_Ctrl_Record_Component; - - --------------------------------- - -- Initialize_Record_Component -- - --------------------------------- - - procedure Initialize_Record_Component - (Rec_Comp : Node_Id; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Stmts : List_Id) - is - Exceptions_OK : constant Boolean := - not Restriction_Active (No_Exception_Propagation); - - Finalization_OK : constant Boolean := Needs_Finalization (Comp_Typ); - - Full_Typ : constant Entity_Id := Underlying_Type (Comp_Typ); - Adj_Call : Node_Id; - Blk_Stmts : List_Id; - Init_Stmt : Node_Id; - - begin - pragma Assert (Nkind (Init_Expr) in N_Subexpr); - - -- Protect the initialization statements from aborts. Generate: - - -- Abort_Defer; - - if Finalization_OK and Abort_Allowed then - if Exceptions_OK then - Blk_Stmts := New_List; - else - Blk_Stmts := Stmts; - end if; - - Append_To (Blk_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer)); - - -- Otherwise aborts are not allowed. All generated code is added - -- directly to the input list. - - else - Blk_Stmts := Stmts; - end if; - - -- Initialize the record component. Generate: - - -- Rec_Comp := Init_Expr; - - -- Note that the initialization expression is NOT replicated because - -- only a single component may be initialized by it. - - Init_Stmt := - Make_OK_Assignment_Statement (Loc, - Name => New_Copy_Tree (Rec_Comp), - Expression => Init_Expr); - Set_No_Ctrl_Actions (Init_Stmt); - - Append_To (Blk_Stmts, Init_Stmt); - - -- Adjust the tag due to a possible view conversion. Generate: - - -- Rec_Comp._tag := Full_TypeP; - - if Tagged_Type_Expansion and then Is_Tagged_Type (Comp_Typ) then - Append_To (Blk_Stmts, - Make_OK_Assignment_Statement (Loc, - Name => - Make_Selected_Component (Loc, - Prefix => New_Copy_Tree (Rec_Comp), - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Full_Typ), Loc)), - - Expression => - Unchecked_Convert_To (RTE (RE_Tag), - New_Occurrence_Of - (Node (First_Elmt (Access_Disp_Table (Full_Typ))), - Loc)))); - end if; - - -- Adjust the component. Generate: - - -- [Deep_]Adjust (Rec_Comp); - - if Finalization_OK - and then not Is_Limited_Type (Comp_Typ) - and then not Is_Build_In_Place_Function_Call (Init_Expr) - then - Adj_Call := - Make_Adjust_Call - (Obj_Ref => New_Copy_Tree (Rec_Comp), - Typ => Comp_Typ); - - -- Guard against a missing [Deep_]Adjust when the component type - -- was not properly frozen. - - if Present (Adj_Call) then - Append_To (Blk_Stmts, Adj_Call); - end if; - end if; - - -- Complete the protection of the initialization statements - - if Finalization_OK and Abort_Allowed then - - -- Wrap the initialization statements in a block to catch a - -- potential exception. Generate: - - -- begin - -- Abort_Defer; - -- Rec_Comp := Init_Expr; - -- Rec_Comp._tag := Full_TypP; - -- [Deep_]Adjust (Rec_Comp); - -- at end - -- Abort_Undefer_Direct; - -- end; - - if Exceptions_OK then - Append_To (Stmts, - Build_Abort_Undefer_Block (Loc, - Stmts => Blk_Stmts, - Context => N)); - - -- Otherwise exceptions are not propagated. Generate: - - -- Abort_Defer; - -- Rec_Comp := Init_Expr; - -- Rec_Comp._tag := Full_TypP; - -- [Deep_]Adjust (Rec_Comp); - -- Abort_Undefer; - - else - Append_To (Blk_Stmts, - Build_Runtime_Call (Loc, RE_Abort_Undefer)); - end if; - end if; - end Initialize_Record_Component; - ------------------------- -- Is_Int_Range_Bounds -- ------------------------- @@ -3441,9 +2835,7 @@ package body Exp_Aggr is -- to the actual type of the aggregate, so that the proper components -- are visible. We know already that the types are compatible. - if Present (Etype (Lhs)) - and then Is_Class_Wide_Type (Etype (Lhs)) - then + if Present (Etype (Lhs)) and then Is_Class_Wide_Type (Etype (Lhs)) then Target := Unchecked_Convert_To (Typ, Lhs); else Target := Lhs; @@ -3454,12 +2846,13 @@ package body Exp_Aggr is if Nkind (N) = N_Extension_Aggregate then declare - Ancestor : constant Node_Id := Ancestor_Part (N); - Adj_Call : Node_Id; + Ancestor : constant Node_Id := Ancestor_Part (N); + Ancestor_Q : constant Node_Id := Unqualify (Ancestor); + Assign : List_Id; begin - -- If the ancestor part is a subtype mark "T", we generate + -- If the ancestor part is a subtype mark T, we generate -- init-proc (T (tmp)); if T is constrained and -- init-proc (S (tmp)); where S applies an appropriate @@ -3583,125 +2976,61 @@ package body Exp_Aggr is -- qualified). elsif Is_Limited_Type (Etype (Ancestor)) - and then Nkind (Unqualify (Ancestor)) in - N_Aggregate | N_Extension_Aggregate + and then Nkind (Ancestor_Q) in N_Aggregate + | N_Extension_Aggregate then - Ancestor_Is_Expression := True; - - -- Set up finalization data for enclosing record, because - -- controlled subcomponents of the ancestor part will be - -- attached to it. - - Generate_Finalization_Actions; - Append_List_To (L, Build_Record_Aggr_Code - (N => Unqualify (Ancestor), - Typ => Etype (Unqualify (Ancestor)), + (N => Ancestor_Q, + Typ => Etype (Ancestor_Q), Lhs => Target)); - -- If the ancestor part is an expression "E", we generate + -- If the ancestor part is an expression E of type T, we generate -- T (tmp) := E; -- In Ada 2005, this includes the case of a (possibly qualified) - -- limited function call. The assignment will turn into a - -- build-in-place function call (for further details, see + -- limited function call. The assignment will later be turned into + -- a build-in-place function call (for further details, see -- Make_Build_In_Place_Call_In_Assignment). else - Ancestor_Is_Expression := True; Init_Typ := Etype (Ancestor); -- If the ancestor part is an aggregate, force its full -- expansion, which was delayed. - if Nkind (Unqualify (Ancestor)) in - N_Aggregate | N_Extension_Aggregate + if Nkind (Ancestor_Q) in N_Aggregate | N_Extension_Aggregate then Set_Analyzed (Ancestor, False); Set_Analyzed (Expression (Ancestor), False); end if; Ref := Convert_To (Init_Typ, New_Copy_Tree (Target)); - Set_Assignment_OK (Ref); - - -- Make the assignment without usual controlled actions, since - -- we only want to Adjust afterwards, but not to Finalize - -- beforehand. Add manual Adjust when necessary. Assign := New_List ( Make_OK_Assignment_Statement (Loc, Name => Ref, Expression => Ancestor)); - Set_No_Ctrl_Actions (First (Assign)); - -- Assign the tag now to make sure that the dispatching call in - -- the subsequent deep_adjust works properly (unless - -- Tagged_Type_Expansion where tags are implicit). - - if Tagged_Type_Expansion then - Instr := - Make_OK_Assignment_Statement (Loc, - Name => - Make_Selected_Component (Loc, - Prefix => New_Copy_Tree (Target), - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Base_Type (Typ)), Loc)), + -- Arrange for the component to be adjusted if need be (the + -- call will be generated by Make_Tag_Ctrl_Assignment). - Expression => - Unchecked_Convert_To (RTE (RE_Tag), - New_Occurrence_Of - (Node (First_Elmt - (Access_Disp_Table (Base_Type (Typ)))), - Loc))); - - Set_Assignment_OK (Name (Instr)); - Append_To (Assign, Instr); - - -- Ada 2005 (AI-251): If tagged type has progenitors we must - -- also initialize tags of the secondary dispatch tables. - - if Has_Interfaces (Base_Type (Typ)) then - Init_Secondary_Tags - (Typ => Base_Type (Typ), - Target => Target, - Stmts_List => Assign, - Init_Tags_List => Assign); - end if; - end if; - - -- Call Adjust manually - - if Needs_Finalization (Etype (Ancestor)) - and then not Is_Limited_Type (Etype (Ancestor)) - and then not Is_Build_In_Place_Function_Call (Ancestor) + if Needs_Finalization (Init_Typ) + and then not Is_Limited_View (Init_Typ) then - Adj_Call := - Make_Adjust_Call - (Obj_Ref => New_Copy_Tree (Ref), - Typ => Etype (Ancestor)); - - -- Guard against a missing [Deep_]Adjust when the ancestor - -- type was not properly frozen. - - if Present (Adj_Call) then - Append_To (Assign, Adj_Call); - end if; + Set_No_Finalize_Actions (First (Assign)); + else + Set_No_Ctrl_Actions (First (Assign)); end if; Append_To (L, - Make_Unsuppress_Block (Loc, Name_Discriminant_Check, Assign)); + Make_Suppress_Block (Loc, Name_Discriminant_Check, Assign)); if Has_Discriminants (Init_Typ) then Check_Ancestor_Discriminants (Init_Typ); end if; end if; - - pragma Assert (Nkind (N) = N_Extension_Aggregate); - pragma Assert - (not (Ancestor_Is_Expression and Ancestor_Is_Subtype_Mark)); end; -- Generate assignments of hidden discriminants. If the base type is @@ -3828,8 +3157,9 @@ package body Exp_Aggr is Prefix => New_Copy_Tree (Target), Selector_Name => New_Occurrence_Of (Selector, Loc)); - Initialize_Record_Component - (Rec_Comp => Comp_Expr, + Initialize_Component + (N => N, + Comp => Comp_Expr, Comp_Typ => Etype (Selector), Init_Expr => Get_Simple_Init_Val (Typ => Etype (Selector), @@ -4062,56 +3392,12 @@ package body Exp_Aggr is end; else - -- Handle an initialization expression of a controlled type - -- in case it denotes a function call. In general such a - -- scenario will produce a transient scope, but this will - -- lead to wrong order of initialization, adjustment, and - -- finalization in the context of aggregates. - - -- Target.Comp := Ctrl_Func_Call; - - -- begin -- scope - -- Trans_Obj : ... := Ctrl_Func_Call; -- object - -- Target.Comp := Trans_Obj; - -- Finalize (Trans_Obj); - -- end - -- Target.Comp._tag := ...; - -- Adjust (Target.Comp); - - -- In the example above, the call to Finalize occurs too - -- early and as a result it may leave the record component - -- in a bad state. Finalization of the transient object - -- should really happen after adjustment. - - -- To avoid this scenario, perform in-place side-effect - -- removal of the function call. This eliminates the - -- transient property of the function result and ensures - -- correct order of actions. - - -- Res : ... := Ctrl_Func_Call; - -- Target.Comp := Res; - -- Target.Comp._tag := ...; - -- Adjust (Target.Comp); - -- Finalize (Res); - - if Needs_Finalization (Comp_Type) - and then Nkind (Expr_Q) /= N_Aggregate - then - Initialize_Ctrl_Record_Component - (Rec_Comp => Comp_Expr, - Comp_Typ => Etype (Selector), - Init_Expr => Expr_Q, - Stmts => L); - - -- Otherwise perform single component initialization - - else - Initialize_Record_Component - (Rec_Comp => Comp_Expr, - Comp_Typ => Etype (Selector), - Init_Expr => Expr_Q, - Stmts => L); - end if; + Initialize_Component + (N => N, + Comp => Comp_Expr, + Comp_Typ => Etype (Selector), + Init_Expr => Expr_Q, + Stmts => L); end if; end if; @@ -4202,36 +3488,22 @@ package body Exp_Aggr is Next (Comp); end loop; - -- If the type is tagged, the tag needs to be initialized (unless we - -- are in VM-mode where tags are implicit). It is done late in the - -- initialization process because in some cases, we call the init - -- proc of an ancestor which will not leave out the right tag. - - if Ancestor_Is_Expression then - null; - -- For CPP types we generated a call to the C++ default constructor -- before the components have been initialized to ensure the proper -- initialization of the _Tag component (see above). - elsif Is_CPP_Class (Typ) then + if Is_CPP_Class (Typ) then null; + -- If the type is tagged, the tag needs to be initialized (unless we + -- are in VM-mode where tags are implicit). It is done late in the + -- initialization process because in some cases, we call the init + -- proc of an ancestor which will not leave out the right tag. + elsif Is_Tagged_Type (Typ) and then Tagged_Type_Expansion then Instr := - Make_OK_Assignment_Statement (Loc, - Name => - Make_Selected_Component (Loc, - Prefix => New_Copy_Tree (Target), - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Base_Type (Typ)), Loc)), - - Expression => - Unchecked_Convert_To (RTE (RE_Tag), - New_Occurrence_Of - (Node (First_Elmt (Access_Disp_Table (Base_Type (Typ)))), - Loc))); + Make_Tag_Assignment_From_Type + (Loc, New_Copy_Tree (Target), Base_Type (Typ)); Append_To (L, Instr); @@ -9025,6 +8297,129 @@ package body Exp_Aggr is return False; end Has_Default_Init_Comps; + -------------------------- + -- Initialize_Component -- + -------------------------- + + procedure Initialize_Component + (N : Node_Id; + Comp : Node_Id; + Comp_Typ : Node_Id; + Init_Expr : Node_Id; + Stmts : List_Id) + is + Exceptions_OK : constant Boolean := + not Restriction_Active (No_Exception_Propagation); + Finalization_OK : constant Boolean := + Present (Comp_Typ) + and then Needs_Finalization (Comp_Typ); + Loc : constant Source_Ptr := Sloc (N); + + Blk_Stmts : List_Id; + Init_Stmt : Node_Id; + + begin + pragma Assert (Nkind (Init_Expr) in N_Subexpr); + + -- Protect the initialization statements from aborts. Generate: + + -- Abort_Defer; + + if Finalization_OK and Abort_Allowed then + if Exceptions_OK then + Blk_Stmts := New_List; + else + Blk_Stmts := Stmts; + end if; + + Append_To (Blk_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer)); + + -- Otherwise aborts are not allowed. All generated code is added + -- directly to the input list. + + else + Blk_Stmts := Stmts; + end if; + + -- Initialize the component. Generate: + + -- Comp := Init_Expr; + + -- Note that the initialization expression is not duplicated because + -- either only a single component may be initialized by it (record) + -- or it has already been duplicated if need be (array). + + Init_Stmt := + Make_OK_Assignment_Statement (Loc, + Name => New_Copy_Tree (Comp), + Expression => Relocate_Node (Init_Expr)); + + Append_To (Blk_Stmts, Init_Stmt); + + -- Arrange for the component to be adjusted if need be (the call will be + -- generated by Make_Tag_Ctrl_Assignment). But, in the case of an array + -- aggregate, controlled subaggregates are not considered because each + -- of their individual elements will receive an adjustment of its own. + + if Finalization_OK + and then not Is_Limited_View (Comp_Typ) + and then not + (Is_Array_Type (Etype (N)) + and then Is_Array_Type (Comp_Typ) + and then Needs_Finalization (Component_Type (Comp_Typ)) + and then Nkind (Unqualify (Init_Expr)) = N_Aggregate) + then + Set_No_Finalize_Actions (Init_Stmt); + + -- Or else, only adjust the tag due to a possible view conversion + + else + Set_No_Ctrl_Actions (Init_Stmt); + + if Tagged_Type_Expansion and then Is_Tagged_Type (Comp_Typ) then + Append_To (Blk_Stmts, + Make_Tag_Assignment_From_Type + (Loc, New_Copy_Tree (Comp), Underlying_Type (Comp_Typ))); + end if; + end if; + + -- Complete the protection of the initialization statements + + if Finalization_OK and Abort_Allowed then + + -- Wrap the initialization statements in a block to catch a + -- potential exception. Generate: + + -- begin + -- Abort_Defer; + -- Comp := Init_Expr; + -- Comp._tag := Full_TypP; + -- [Deep_]Adjust (Comp); + -- at end + -- Abort_Undefer_Direct; + -- end; + + if Exceptions_OK then + Append_To (Stmts, + Build_Abort_Undefer_Block (Loc, + Stmts => Blk_Stmts, + Context => N)); + + -- Otherwise exceptions are not propagated. Generate: + + -- Abort_Defer; + -- Comp := Init_Expr; + -- Comp._tag := Full_TypP; + -- [Deep_]Adjust (Comp); + -- Abort_Undefer; + + else + Append_To (Blk_Stmts, + Build_Runtime_Call (Loc, RE_Abort_Undefer)); + end if; + end if; + end Initialize_Component; + ---------------------------------------- -- Is_Build_In_Place_Aggregate_Return -- ---------------------------------------- @@ -9749,304 +9144,6 @@ package body Exp_Aggr is end if; end Must_Slide; - --------------------------------- - -- Process_Transient_Component -- - --------------------------------- - - procedure Process_Transient_Component - (Loc : Source_Ptr; - Comp_Typ : Entity_Id; - Init_Expr : Node_Id; - Fin_Call : out Node_Id; - Hook_Clear : out Node_Id; - Aggr : Node_Id := Empty; - Stmts : List_Id := No_List) - is - procedure Add_Item (Item : Node_Id); - -- Insert arbitrary node Item into the tree depending on the values of - -- Aggr and Stmts. - - -------------- - -- Add_Item -- - -------------- - - procedure Add_Item (Item : Node_Id) is - begin - if Present (Aggr) then - Insert_Action (Aggr, Item); - else - pragma Assert (Present (Stmts)); - Append_To (Stmts, Item); - end if; - end Add_Item; - - -- Local variables - - Hook_Assign : Node_Id; - Hook_Decl : Node_Id; - Ptr_Decl : Node_Id; - Res_Decl : Node_Id; - Res_Id : Entity_Id; - Res_Typ : Entity_Id; - Copy_Init_Expr : constant Node_Id := New_Copy_Tree (Init_Expr); - - -- Start of processing for Process_Transient_Component - - begin - -- Add the access type, which provides a reference to the function - -- result. Generate: - - -- type Res_Typ is access all Comp_Typ; - - Res_Typ := Make_Temporary (Loc, 'A'); - Mutate_Ekind (Res_Typ, E_General_Access_Type); - Set_Directly_Designated_Type (Res_Typ, Comp_Typ); - - Add_Item - (Make_Full_Type_Declaration (Loc, - Defining_Identifier => Res_Typ, - Type_Definition => - Make_Access_To_Object_Definition (Loc, - All_Present => True, - Subtype_Indication => New_Occurrence_Of (Comp_Typ, Loc)))); - - -- Add the temporary which captures the result of the function call. - -- Generate: - - -- Res : constant Res_Typ := Init_Expr'Reference; - - -- Note that this temporary is effectively a transient object because - -- its lifetime is bounded by the current array or record component. - - Res_Id := Make_Temporary (Loc, 'R'); - Mutate_Ekind (Res_Id, E_Constant); - Set_Etype (Res_Id, Res_Typ); - - -- Mark the transient object as successfully processed to avoid double - -- finalization. - - Set_Is_Finalized_Transient (Res_Id); - - -- Signal the general finalization machinery that this transient object - -- should not be considered for finalization actions because its cleanup - -- will be performed by Process_Transient_Component_Completion. - - Set_Is_Ignored_Transient (Res_Id); - - Res_Decl := - Make_Object_Declaration (Loc, - Defining_Identifier => Res_Id, - Constant_Present => True, - Object_Definition => New_Occurrence_Of (Res_Typ, Loc), - Expression => - Make_Reference (Loc, Copy_Init_Expr)); - - -- In some cases, like iterated component, the Init_Expr may have been - -- analyzed in a context where all the Etype fields are not correct yet - -- and a later call to Analyze is expected to set them. - -- Resetting the Analyzed flag ensures this later call doesn't skip this - -- node. - - Reset_Analyzed_Flags (Copy_Init_Expr); - - Add_Item (Res_Decl); - - -- Construct all pieces necessary to hook and finalize the transient - -- result. - - Build_Transient_Object_Statements - (Obj_Decl => Res_Decl, - Fin_Call => Fin_Call, - Hook_Assign => Hook_Assign, - Hook_Clear => Hook_Clear, - Hook_Decl => Hook_Decl, - Ptr_Decl => Ptr_Decl); - - -- Add the access type which provides a reference to the transient - -- result. Generate: - - -- type Ptr_Typ is access all Comp_Typ; - - Add_Item (Ptr_Decl); - - -- Add the temporary which acts as a hook to the transient result. - -- Generate: - - -- Hook : Ptr_Typ := null; - - Add_Item (Hook_Decl); - - -- Attach the transient result to the hook. Generate: - - -- Hook := Ptr_Typ (Res); - - Add_Item (Hook_Assign); - - -- The original initialization expression now references the value of - -- the temporary function result. Generate: - - -- Res.all - - Rewrite (Init_Expr, - Make_Explicit_Dereference (Loc, - Prefix => New_Occurrence_Of (Res_Id, Loc))); - end Process_Transient_Component; - - -------------------------------------------- - -- Process_Transient_Component_Completion -- - -------------------------------------------- - - procedure Process_Transient_Component_Completion - (Loc : Source_Ptr; - Aggr : Node_Id; - Fin_Call : Node_Id; - Hook_Clear : Node_Id; - Stmts : List_Id) - is - Exceptions_OK : constant Boolean := - not Restriction_Active (No_Exception_Propagation); - - begin - pragma Assert (Present (Hook_Clear)); - - -- Generate the following code if exception propagation is allowed: - - -- declare - -- Abort : constant Boolean := Triggered_By_Abort; - -- <or> - -- Abort : constant Boolean := False; -- no abort - - -- E : Exception_Occurrence; - -- Raised : Boolean := False; - - -- begin - -- [Abort_Defer;] - - -- begin - -- Hook := null; - -- [Deep_]Finalize (Res.all); - - -- exception - -- when others => - -- if not Raised then - -- Raised := True; - -- Save_Occurrence (E, - -- Get_Curent_Excep.all.all); - -- end if; - -- end; - - -- [Abort_Undefer;] - - -- if Raised and then not Abort then - -- Raise_From_Controlled_Operation (E); - -- end if; - -- end; - - if Exceptions_OK then - Abort_And_Exception : declare - Blk_Decls : constant List_Id := New_List; - Blk_Stmts : constant List_Id := New_List; - Fin_Stmts : constant List_Id := New_List; - - Fin_Data : Finalization_Exception_Data; - - begin - -- Create the declarations of the two flags and the exception - -- occurrence. - - Build_Object_Declarations (Fin_Data, Blk_Decls, Loc); - - -- Generate: - -- Abort_Defer; - - if Abort_Allowed then - Append_To (Blk_Stmts, - Build_Runtime_Call (Loc, RE_Abort_Defer)); - end if; - - -- Wrap the hook clear and the finalization call in order to trap - -- a potential exception. - - Append_To (Fin_Stmts, Hook_Clear); - - if Present (Fin_Call) then - Append_To (Fin_Stmts, Fin_Call); - end if; - - Append_To (Blk_Stmts, - Make_Block_Statement (Loc, - Handled_Statement_Sequence => - Make_Handled_Sequence_Of_Statements (Loc, - Statements => Fin_Stmts, - Exception_Handlers => New_List ( - Build_Exception_Handler (Fin_Data))))); - - -- Generate: - -- Abort_Undefer; - - if Abort_Allowed then - Append_To (Blk_Stmts, - Build_Runtime_Call (Loc, RE_Abort_Undefer)); - end if; - - -- Reraise the potential exception with a proper "upgrade" to - -- Program_Error if needed. - - Append_To (Blk_Stmts, Build_Raise_Statement (Fin_Data)); - - -- Wrap everything in a block - - Append_To (Stmts, - Make_Block_Statement (Loc, - Declarations => Blk_Decls, - Handled_Statement_Sequence => - Make_Handled_Sequence_Of_Statements (Loc, - Statements => Blk_Stmts))); - end Abort_And_Exception; - - -- Generate the following code if exception propagation is not allowed - -- and aborts are allowed: - - -- begin - -- Abort_Defer; - -- Hook := null; - -- [Deep_]Finalize (Res.all); - -- at end - -- Abort_Undefer_Direct; - -- end; - - elsif Abort_Allowed then - Abort_Only : declare - Blk_Stmts : constant List_Id := New_List; - - begin - Append_To (Blk_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer)); - Append_To (Blk_Stmts, Hook_Clear); - - if Present (Fin_Call) then - Append_To (Blk_Stmts, Fin_Call); - end if; - - Append_To (Stmts, - Build_Abort_Undefer_Block (Loc, - Stmts => Blk_Stmts, - Context => Aggr)); - end Abort_Only; - - -- Otherwise generate: - - -- Hook := null; - -- [Deep_]Finalize (Res.all); - - else - Append_To (Stmts, Hook_Clear); - - if Present (Fin_Call) then - Append_To (Stmts, Fin_Call); - end if; - end if; - end Process_Transient_Component_Completion; - --------------------- -- Sort_Case_Table -- --------------------- diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index 753412e..53f0753 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -1592,10 +1592,8 @@ package body Exp_Ch11 is else -- Bypass expansion to a run-time call when back-end exception - -- handling is active, unless the target is CodePeer or GNATprove. - -- In CodePeer, raising an exception is treated as an error, while in - -- GNATprove all code with exceptions falls outside the subset of - -- code which can be formally analyzed. + -- handling is active, unless the target is CodePeer, where + -- raising an exception is treated as an error. if not CodePeer_Mode then return; @@ -1604,7 +1602,7 @@ package body Exp_Ch11 is -- Find innermost enclosing exception handler (there must be one, -- since the semantics has already verified that this raise statement -- is valid, and a raise with no arguments is only permitted in the - -- context of an exception handler. + -- context of an exception handler). Ehand := Parent (N); while Nkind (Ehand) /= N_Exception_Handler loop @@ -1803,95 +1801,77 @@ package body Exp_Ch11 is -- Test for handled sequence of statements with at least one -- exception handler which might be the one we are looking for. - elsif Nkind (P) = N_Handled_Sequence_Of_Statements - and then Present (Exception_Handlers (P)) - then - -- Before we proceed we need to check if the node N is covered - -- by the statement part of P rather than one of its exception - -- handlers (an exception handler obviously does not cover its - -- own statements). - - -- This test is more delicate than might be thought. It is not - -- just a matter of checking the Statements (P), because the node - -- might be waiting to be wrapped in a transient scope, in which - -- case it will end up in the block statements, even though it - -- is not there now. - - if Is_List_Member (N) then - declare - LCN : constant List_Id := List_Containing (N); - - begin - if LCN = Statements (P) - or else - LCN = SSE.Actions_To_Be_Wrapped (Before) - or else - LCN = SSE.Actions_To_Be_Wrapped (After) - or else - LCN = SSE.Actions_To_Be_Wrapped (Cleanup) - then - -- Loop through exception handlers + -- We need to check if the node N is covered by the statement part of + -- P rather than one of its exception handlers (an exception handler + -- obviously does not cover its own statements). - H := First (Exception_Handlers (P)); - while Present (H) loop + -- This test is more delicate than might be thought. It is not just + -- a matter of checking the Statements (P), because the node might be + -- waiting to be wrapped in a transient scope, in which case it will + -- end up in the block statements, even though it is not there now. - -- Guard against other constructs appearing in the - -- list of exception handlers. + elsif Nkind (P) = N_Handled_Sequence_Of_Statements + and then Is_List_Member (N) + and then List_Containing (N) in Statements (P) + | SSE.Actions_To_Be_Wrapped (Before) + | SSE.Actions_To_Be_Wrapped (After) + | SSE.Actions_To_Be_Wrapped (Cleanup) + then + -- Loop through exception handlers and guard against pragmas + -- appearing among them. - if Nkind (H) = N_Exception_Handler then + H := First_Non_Pragma (Exception_Handlers (P)); + while Present (H) loop - -- Loop through choices in one handler + -- Guard against other constructs appearing in the list of + -- exception handlers. - C := First (Exception_Choices (H)); - while Present (C) loop + -- Loop through choices in one handler - -- Deal with others case + C := First (Exception_Choices (H)); + while Present (C) loop - if Nkind (C) = N_Others_Choice then + -- Deal with others case - -- Matching others handler, but we need - -- to ensure there is no choice parameter. - -- If there is, then we don't have a local - -- handler after all (since we do not allow - -- choice parameters for local handlers). + if Nkind (C) = N_Others_Choice then - if No (Choice_Parameter (H)) then - return H; - else - return Empty; - end if; + -- Matching others handler, but we need to ensure there + -- is no choice parameter. If there is, then we don't + -- have a local handler after all (since we do not allow + -- choice parameters for local handlers). - -- If not others must be entity name + if No (Choice_Parameter (H)) then + return H; + else + return Empty; + end if; - elsif Nkind (C) /= N_Others_Choice then - pragma Assert (Is_Entity_Name (C)); - pragma Assert (Present (Entity (C))); + -- If not others must be entity name - -- Get exception being handled, dealing with - -- renaming. + else + pragma Assert (Is_Entity_Name (C)); + pragma Assert (Present (Entity (C))); - EHandle := Get_Renamed_Entity (Entity (C)); + -- Get exception being handled, dealing with renaming - -- If match, then check choice parameter + EHandle := Get_Renamed_Entity (Entity (C)); - if ERaise = EHandle then - if No (Choice_Parameter (H)) then - return H; - else - return Empty; - end if; - end if; - end if; + -- If match, then check choice parameter - Next (C); - end loop; + if ERaise = EHandle then + if No (Choice_Parameter (H)) then + return H; + else + return Empty; end if; - - Next (H); - end loop; + end if; end if; - end; - end if; + + Next (C); + end loop; + + Next_Non_Pragma (H); + end loop; end if; N := P; diff --git a/gcc/ada/exp_ch11.ads b/gcc/ada/exp_ch11.ads index 483c759..8d5b998 100644 --- a/gcc/ada/exp_ch11.ads +++ b/gcc/ada/exp_ch11.ads @@ -59,7 +59,7 @@ package Exp_Ch11 is (Ename : Entity_Id; Nod : Node_Id) return Node_Id; -- This function searches for a local exception handler that will handle - -- the exception named by Ename. If such a local hander exists, then the + -- the exception named by Ename. If such a local handler exists, then the -- corresponding N_Exception_Handler is returned. If no such handler is -- found then Empty is returned. In order to match and return True, the -- handler may not have a choice parameter specification. Nod is the raise diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index f8c9947..7ac4680 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -2150,21 +2150,10 @@ package body Exp_Ch3 is and then Nkind (Exp_Q) /= N_Raise_Expression then Append_To (Res, - Make_Assignment_Statement (Default_Loc, - Name => - Make_Selected_Component (Default_Loc, - Prefix => - New_Copy_Tree (Lhs, New_Scope => Proc_Id), - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Typ), Default_Loc)), - - Expression => - Unchecked_Convert_To (RTE (RE_Tag), - New_Occurrence_Of - (Node (First_Elmt (Access_Disp_Table (Underlying_Type - (Typ)))), - Default_Loc)))); + Make_Tag_Assignment_From_Type + (Default_Loc, + New_Copy_Tree (Lhs, New_Scope => Proc_Id), + Underlying_Type (Typ))); end if; -- Adjust the component if controlled except if it is an aggregate @@ -2791,17 +2780,8 @@ package body Exp_Ch3 is -- Initialize the primary tag component Init_Tags_List := New_List ( - Make_Assignment_Statement (Loc, - Name => - Make_Selected_Component (Loc, - Prefix => Make_Identifier (Loc, Name_uInit), - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Rec_Type), Loc)), - Expression => - New_Occurrence_Of - (Node - (First_Elmt (Access_Disp_Table (Rec_Type))), Loc))); + Make_Tag_Assignment_From_Type + (Loc, Make_Identifier (Loc, Name_uInit), Rec_Type)); -- Ada 2005 (AI-251): Initialize the secondary tags components -- located at fixed positions (tags whose position depends on @@ -2880,17 +2860,8 @@ package body Exp_Ch3 is -- Initialize the primary tag Init_Tags_List := New_List ( - Make_Assignment_Statement (Loc, - Name => - Make_Selected_Component (Loc, - Prefix => Make_Identifier (Loc, Name_uInit), - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Rec_Type), Loc)), - Expression => - New_Occurrence_Of - (Node - (First_Elmt (Access_Disp_Table (Rec_Type))), Loc))); + Make_Tag_Assignment_From_Type + (Loc, Make_Identifier (Loc, Name_uInit), Rec_Type)); -- Ada 2005 (AI-251): Initialize the secondary tags components -- located at fixed positions (tags whose position depends on @@ -7143,8 +7114,64 @@ package body Exp_Ch3 is function Make_Allocator_For_Return (Expr : Node_Id) return Node_Id is Alloc : Node_Id; Alloc_Expr : Entity_Id; + Alloc_Typ : Entity_Id; begin + -- If the return object's declaration does not include an expression, + -- then we use its subtype for the allocation. Likewise in the case + -- of a degenerate expression like a raise expression. + + if No (Expr) + or else Nkind (Original_Node (Expr)) = N_Raise_Expression + then + Alloc_Typ := Typ; + + -- If the return object's declaration includes an expression, then + -- there are two cases: either the nominal subtype of the object is + -- definite and we can use it for the allocation directly, or it is + -- not and Analyze_Object_Declaration should have built an actual + -- subtype from the expression. + + -- However, there are exceptions in the latter case for interfaces + -- (see Analyze_Object_Declaration), as well as class-wide types and + -- types with unknown discriminants if they are additionally limited + -- (see Expand_Subtype_From_Expr), so we must cope with them. + + elsif Is_Interface (Typ) then + pragma Assert (Is_Class_Wide_Type (Typ)); + + -- For interfaces, we use the type of the expression, except if + -- we need to put back a conversion that we have removed earlier + -- in the processing. + + if Is_Class_Wide_Type (Etype (Expr)) then + Alloc_Typ := Typ; + else + Alloc_Typ := Etype (Expr); + end if; + + elsif Is_Class_Wide_Type (Typ) then + + -- For class-wide types, we have to make sure that we use the + -- dynamic type of the expression for the allocation, either by + -- means of its (static) subtype or through the actual subtype. + + if Has_Tag_Of_Type (Expr) then + Alloc_Typ := Etype (Expr); + + else pragma Assert (Ekind (Typ) = E_Class_Wide_Subtype + and then Present (Equivalent_Type (Typ))); + + Alloc_Typ := Typ; + end if; + + else pragma Assert (Is_Definite_Subtype (Typ) + or else (Has_Unknown_Discriminants (Typ) + and then Is_Limited_View (Typ))); + + Alloc_Typ := Typ; + end if; + -- If the return object's declaration includes an expression and the -- declaration isn't marked as No_Initialization, then we generate an -- allocator with a qualified expression. Although this is necessary @@ -7170,35 +7197,22 @@ package body Exp_Ch3 is Alloc_Expr := New_Copy_Tree (Expr); - -- In the constrained array case, deal with a potential sliding. - -- In the interface case, put back a conversion that we may have - -- removed earlier in the processing. - - if (Ekind (Typ) = E_Array_Subtype - or else (Is_Interface (Typ) - and then Is_Class_Wide_Type (Etype (Alloc_Expr)))) - and then Typ /= Etype (Alloc_Expr) - then - Alloc_Expr := Convert_To (Typ, Alloc_Expr); + if Etype (Alloc_Expr) /= Alloc_Typ then + Alloc_Expr := Convert_To (Alloc_Typ, Alloc_Expr); end if; - -- We always use the type of the expression for the qualified - -- expression, rather than the return object's type. We cannot - -- always use the return object's type because the expression - -- might be of a specific type and the return object might not. - Alloc := Make_Allocator (Loc, Expression => Make_Qualified_Expression (Loc, Subtype_Mark => - New_Occurrence_Of (Etype (Alloc_Expr), Loc), + New_Occurrence_Of (Alloc_Typ, Loc), Expression => Alloc_Expr)); else Alloc := Make_Allocator (Loc, - Expression => New_Occurrence_Of (Typ, Loc)); + Expression => New_Occurrence_Of (Alloc_Typ, Loc)); -- If the return object requires default initialization, then it -- will happen later following the elaboration of the renaming. @@ -11140,8 +11154,6 @@ package body Exp_Ch3 is -- is a wrapper's body in order to get check suppression right. Set_Corresponding_Spec (Func_Body, Func_Id); - - Override_Dispatching_Operation (Tag_Typ, Subp, New_Op => Func_Id); end if; <<Next_Prim>> @@ -12080,13 +12092,11 @@ package body Exp_Ch3 is function Make_Tag_Assignment (N : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); - Def_If : constant Entity_Id := Defining_Identifier (N); + Def_Id : constant Entity_Id := Defining_Identifier (N); Expr : constant Node_Id := Expression (N); - Typ : constant Entity_Id := Etype (Def_If); + Typ : constant Entity_Id := Etype (Def_Id); Full_Typ : constant Entity_Id := Underlying_Type (Typ); - New_Ref : Node_Id; - begin -- This expansion activity is called during analysis @@ -12094,25 +12104,12 @@ package body Exp_Ch3 is and then not Is_Class_Wide_Type (Typ) and then not Is_CPP_Class (Typ) and then Tagged_Type_Expansion - and then Nkind (Expr) /= N_Aggregate - and then (Nkind (Expr) /= N_Qualified_Expression - or else Nkind (Expression (Expr)) /= N_Aggregate) + and then Nkind (Unqualify (Expr)) /= N_Aggregate then - New_Ref := - Make_Selected_Component (Loc, - Prefix => New_Occurrence_Of (Def_If, Loc), - Selector_Name => - New_Occurrence_Of (First_Tag_Component (Full_Typ), Loc)); - - Set_Assignment_OK (New_Ref); - return - Make_Assignment_Statement (Loc, - Name => New_Ref, - Expression => - Unchecked_Convert_To (RTE (RE_Tag), - New_Occurrence_Of - (Node (First_Elmt (Access_Disp_Table (Full_Typ))), Loc))); + Make_Tag_Assignment_From_Type + (Loc, New_Occurrence_Of (Def_Id, Loc), Full_Typ); + else return Empty; end if; diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 537d7a6..7b6e997 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -567,7 +567,6 @@ package body Exp_Ch4 is Adj_Call : Node_Id; Aggr_In_Place : Boolean; Node : Node_Id; - Tag_Assign : Node_Id; Temp : Entity_Id; Temp_Decl : Node_Id; @@ -923,30 +922,9 @@ package body Exp_Ch4 is end if; if Present (TagT) then - declare - Full_T : constant Entity_Id := Underlying_Type (TagT); - - begin - Tag_Assign := - Make_Assignment_Statement (Loc, - Name => - Make_Selected_Component (Loc, - Prefix => TagR, - Selector_Name => - New_Occurrence_Of - (First_Tag_Component (Full_T), Loc)), - - Expression => - Unchecked_Convert_To (RTE (RE_Tag), - New_Occurrence_Of - (Elists.Node - (First_Elmt (Access_Disp_Table (Full_T))), Loc))); - end; - - -- The previous assignment has to be done in any case - - Set_Assignment_OK (Name (Tag_Assign)); - Insert_Action (N, Tag_Assign); + Insert_Action (N, + Make_Tag_Assignment_From_Type + (Loc, TagR, Underlying_Type (TagT))); end if; -- Generate an Adjust call if the object will be moved. In Ada 2005, @@ -11138,6 +11116,32 @@ package body Exp_Ch4 is Freeze_Before (P, Etype (Var)); end; + -- For an expression of the form "for all/some X of F(...) => ...", + -- where F(...) is a function call that returns on the secondary stack, + -- we need to mark an enclosing scope as Uses_Sec_Stack. We must do + -- this before expansion, which can obscure the tree. Note that we + -- might be inside another quantified expression. Skip blocks and + -- loops that were generated by expansion. + + if Present (Iterator_Specification (N)) + and then Nkind (Name (Iterator_Specification (N))) = N_Function_Call + and then Needs_Secondary_Stack + (Etype (Name (Iterator_Specification (N)))) + then + declare + Source_Scope : Entity_Id := Current_Scope; + begin + while Ekind (Source_Scope) in E_Block | E_Loop + and then not Comes_From_Source (Source_Scope) + loop + Source_Scope := Scope (Source_Scope); + end loop; + + Set_Uses_Sec_Stack (Source_Scope); + Check_Restriction (No_Secondary_Stack, N); + end; + end if; + -- Create the declaration of the flag which tracks the status of the -- quantified expression. Generate: diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 2be6e7e..258459b 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -181,14 +181,13 @@ package body Exp_Ch5 is procedure Expand_Iterator_Loop_Over_Container (N : Node_Id; - Isc : Node_Id; I_Spec : Node_Id; Container : Node_Id; Container_Typ : Entity_Id); -- Expand loop over containers that uses the form "for X of C" with an - -- optional subtype mark, or "for Y in C". Isc is the iteration scheme. - -- I_Spec is the iterator specification and Container is either the - -- Container (for OF) or the iterator (for IN). + -- optional subtype mark, or "for Y in C". I_Spec is the iterator + -- specification and Container is either the Container (for OF) or the + -- iterator (for IN). procedure Expand_Predicated_Loop (N : Node_Id); -- Expand for loop over predicated subtype @@ -952,6 +951,7 @@ package body Exp_Ch5 is and then Base_Type (L_Type) = Base_Type (R_Type) and then Ndim = 1 and then not No_Ctrl_Actions (N) + and then not No_Finalize_Actions (N) then declare Proc : constant Entity_Id := @@ -1097,8 +1097,8 @@ package body Exp_Ch5 is and then Base_Type (L_Type) = Base_Type (R_Type) and then Ndim = 1 and then not No_Ctrl_Actions (N) + and then not No_Finalize_Actions (N) then - -- Call TSS procedure for array assignment, passing the -- explicit bounds of right- and left-hand sides. @@ -1321,9 +1321,10 @@ package body Exp_Ch5 is Set_Assignment_OK (Name (Assign)); - -- Propagate the No_Ctrl_Actions flag to individual assignments + -- Propagate the No_{Ctrl,Finalize}_Actions flags to assignments - Set_No_Ctrl_Actions (Assign, No_Ctrl_Actions (N)); + Set_No_Ctrl_Actions (Assign, No_Ctrl_Actions (N)); + Set_No_Finalize_Actions (Assign, No_Finalize_Actions (N)); end; -- Now construct the loop from the inside out, with the last subscript @@ -2963,7 +2964,9 @@ package body Exp_Ch5 is then Tagged_Case : declare L : List_Id := No_List; - Expand_Ctrl_Actions : constant Boolean := not No_Ctrl_Actions (N); + Expand_Ctrl_Actions : constant Boolean + := not No_Ctrl_Actions (N) + and then not No_Finalize_Actions (N); begin -- In the controlled case, we ensure that function calls are @@ -3163,10 +3166,20 @@ package body Exp_Ch5 is end if; end if; - Rewrite (N, - Make_Block_Statement (Loc, - Handled_Statement_Sequence => - Make_Handled_Sequence_Of_Statements (Loc, Statements => L))); + -- We will analyze the block statement with all checks suppressed + -- below, but we need elaboration checks for the primitives in the + -- case of an assignment created by the expansion of an aggregate. + + if No_Finalize_Actions (N) then + Rewrite (N, + Make_Unsuppress_Block (Loc, Name_Elaboration_Check, L)); + + else + Rewrite (N, + Make_Block_Statement (Loc, + Handled_Statement_Sequence => + Make_Handled_Sequence_Of_Statements (Loc, L))); + end if; -- If no restrictions on aborts, protect the whole assignment -- for controlled objects as per 9.8(11). @@ -4822,7 +4835,7 @@ package body Exp_Ch5 is else Expand_Iterator_Loop_Over_Container - (N, Isc, I_Spec, Container, Container_Typ); + (N, I_Spec, Container, Container_Typ); end if; end Expand_Iterator_Loop; @@ -5119,7 +5132,6 @@ package body Exp_Ch5 is procedure Expand_Iterator_Loop_Over_Container (N : Node_Id; - Isc : Node_Id; I_Spec : Node_Id; Container : Node_Id; Container_Typ : Entity_Id) @@ -5592,13 +5604,6 @@ package body Exp_Ch5 is Mutate_Ekind (Cursor, Id_Kind); end; - -- If the range of iteration is given by a function call that returns - -- a container, the finalization actions have been saved in the - -- Condition_Actions of the iterator. Insert them now at the head of - -- the loop. - - Insert_List_Before (N, Condition_Actions (Isc)); - Rewrite (N, New_Loop); Analyze (N); end Expand_Iterator_Loop_Over_Container; @@ -5673,6 +5678,7 @@ package body Exp_Ch5 is New_List (Make_If_Statement (Loc, Condition => Iterator_Filter (LPS), Then_Statements => Stats))); + Analyze_List (Statements (N)); end if; -- Deal with loop over predicates @@ -6240,12 +6246,20 @@ package body Exp_Ch5 is Res : constant List_Id := New_List; T : constant Entity_Id := Underlying_Type (Etype (L)); + Adj_Act : constant Boolean := Needs_Finalization (T) + and then not No_Ctrl_Actions (N); Comp_Asn : constant Boolean := Is_Fully_Repped_Tagged_Type (T); Ctrl_Act : constant Boolean := Needs_Finalization (T) - and then not No_Ctrl_Actions (N); + and then not No_Ctrl_Actions (N) + and then not No_Finalize_Actions (N); Save_Tag : constant Boolean := Is_Tagged_Type (T) and then not Comp_Asn and then not No_Ctrl_Actions (N) + and then not No_Finalize_Actions (N) + and then Tagged_Type_Expansion; + Set_Tag : constant Boolean := Is_Tagged_Type (T) + and then not Comp_Asn + and then not No_Ctrl_Actions (N) and then Tagged_Type_Expansion; Adj_Call : Node_Id; Fin_Call : Node_Id; @@ -6256,8 +6270,8 @@ package body Exp_Ch5 is -- We have two exceptions here: - -- 1. If we are in an init proc since it is an initialization more - -- than an assignment. + -- 1. If we are in an init proc or within an aggregate, since it is an + -- initialization more than an assignment. -- 2. If the left-hand side is a temporary that was not initialized -- (or the parent part of a temporary since it is the case in @@ -6266,7 +6280,7 @@ package body Exp_Ch5 is -- it may be a component of an entry formal, in which case it has -- been rewritten and does not appear to come from source either. - -- Case of init proc + -- Case of init proc or aggregate if not Ctrl_Act then null; @@ -6336,12 +6350,19 @@ package body Exp_Ch5 is Selector_Name => New_Occurrence_Of (First_Tag_Component (T), Loc)), Expression => New_Occurrence_Of (Tag_Id, Loc))); + + -- Or else just initialize it + + elsif Set_Tag then + Append_To (Res, + Make_Tag_Assignment_From_Type + (Loc, Duplicate_Subexpr_No_Checks (L), T)); end if; -- Adjust the target after the assignment when controlled (not in the -- init proc since it is an initialization more than an assignment). - if Ctrl_Act then + if Ctrl_Act or else Adj_Act then Adj_Call := Make_Adjust_Call (Obj_Ref => Duplicate_Subexpr_Move_Checks (L), diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index b19db8f..28d563f 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -3405,6 +3405,7 @@ package body Exp_Ch6 is or else No (Aspect) -- Do not fold if multiple applicable predicate aspects + or else Has_Ghost_Predicate_Aspect (Subt) or else Has_Aspect (Subt, Aspect_Static_Predicate) or else Has_Aspect (Subt, Aspect_Predicate) or else Augments_Other_Dynamic_Predicate (Aspect) diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 494ead7..9381cee 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -2755,7 +2755,7 @@ package body Exp_Disp is Def_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uDisp_Asynchronous_Select); - Params : constant List_Id := New_List; + Params : List_Id; begin pragma Assert (not Restriction_Active (No_Dispatching_Calls)); @@ -2770,7 +2770,7 @@ package body Exp_Disp is Set_Warnings_Off (B_Id); - Append_List_To (Params, New_List ( + Params := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uT), @@ -2795,7 +2795,7 @@ package body Exp_Disp is Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uF), Parameter_Type => New_Occurrence_Of (Standard_Boolean, Loc), - Out_Present => True))); + Out_Present => True)); return Make_Procedure_Specification (Loc, diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index e660196..1cc4653 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -269,6 +269,16 @@ package body Exp_Prag is end; end Expand_Pragma_Abort_Defer; + ------------------------------------- + -- Expand_Pragma_Always_Terminates -- + ------------------------------------- + + procedure Expand_Pragma_Always_Terminates (Prag : Node_Id) is + pragma Unreferenced (Prag); + begin + null; + end Expand_Pragma_Always_Terminates; + -------------------------- -- Expand_Pragma_Check -- -------------------------- diff --git a/gcc/ada/exp_prag.ads b/gcc/ada/exp_prag.ads index 9f810da..10ccaf7 100644 --- a/gcc/ada/exp_prag.ads +++ b/gcc/ada/exp_prag.ads @@ -31,6 +31,10 @@ package Exp_Prag is procedure Expand_N_Pragma (N : Node_Id); + procedure Expand_Pragma_Always_Terminates (Prag : Node_Id); + -- This routine only exists for consistency with other pragmas, since + -- Always_Terminates has no meaningful expansion. + procedure Expand_Pragma_Contract_Cases (CCs : Node_Id; Subp_Id : Entity_Id; diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 4c48445..0d0ad8a 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7283,6 +7283,7 @@ package body Exp_Util is when N_Indexed_Component | N_Selected_Component | N_Aggregate + | N_Extension_Aggregate => return True; @@ -10105,6 +10106,8 @@ package body Exp_Util is -- Compute proper name to use, we need to get this right so that the -- right set of check policies apply to the Check pragma we are making. + -- The presence or not of a Ghost_Predicate does not influence the + -- choice of the applicable check policy. if Has_Dynamic_Predicate_Aspect (Typ) then Nam := Name_Dynamic_Predicate; @@ -10333,6 +10336,33 @@ package body Exp_Util is Constraints => List_Constr)); end Make_Subtype_From_Expr; + ----------------------------------- + -- Make_Tag_Assignment_From_Type -- + ----------------------------------- + + function Make_Tag_Assignment_From_Type + (Loc : Source_Ptr; + Target : Node_Id; + Typ : Entity_Id) return Node_Id + is + Nam : constant Node_Id := + Make_Selected_Component (Loc, + Prefix => Target, + Selector_Name => + New_Occurrence_Of (First_Tag_Component (Typ), Loc)); + + begin + Set_Assignment_OK (Nam); + + return + Make_Assignment_Statement (Loc, + Name => Nam, + Expression => + Unchecked_Convert_To (RTE (RE_Tag), + New_Occurrence_Of + (Node (First_Elmt (Access_Disp_Table (Typ))), Loc))); + end Make_Tag_Assignment_From_Type; + ----------------------------- -- Make_Variant_Comparison -- ----------------------------- @@ -11848,14 +11878,6 @@ package body Exp_Util is then return; - -- Nothing to do if prior expansion determined that a function call does - -- not require side effect removal. - - elsif Nkind (Exp) = N_Function_Call - and then No_Side_Effect_Removal (Exp) - then - return; - -- No action needed for side-effect free expressions elsif Check_Side_Effects @@ -14201,6 +14223,16 @@ package body Exp_Util is then return True; + -- Stop at contexts where temporaries may be contained + + elsif Nkind (Par) in N_Aggregate + | N_Delta_Aggregate + | N_Extension_Aggregate + | N_Block_Statement + | N_Loop_Statement + then + return False; + -- Prevent the search from going too far elsif Is_Body_Or_Package_Declaration (Par) then diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index eef6800..24065b6 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -372,9 +372,9 @@ package Exp_Util is Ptr_Decl : out Node_Id; Finalize_Obj : Boolean := True); -- Subsidiary to the processing of transient objects in transient scopes, - -- if expressions, case expressions, expression_with_action nodes, array - -- aggregates, and record aggregates. Obj_Decl denotes the declaration of - -- the transient object. Generate the following nodes: + -- if expressions, case expressions, and expression_with_action nodes. + -- Obj_Decl denotes the declaration of the transient object. Generate the + -- following nodes: -- -- * Fin_Call - the call to [Deep_]Finalize which cleans up the transient -- object if flag Finalize_Obj is set to True, or finalizes the hook when @@ -925,6 +925,13 @@ package Exp_Util is -- wide type. Set Related_Id to request an external name for the subtype -- rather than an internal temporary. + function Make_Tag_Assignment_From_Type + (Loc : Source_Ptr; + Target : Node_Id; + Typ : Entity_Id) return Node_Id; + -- Return an assignment of the tag of tagged type Typ to prefix Target, + -- which must be a record object of a descendant of Typ. + function Make_Variant_Comparison (Loc : Source_Ptr; Typ : Entity_Id; @@ -1233,7 +1240,9 @@ package Exp_Util is -- extension to verify legality rules on inherited conditions. function Within_Case_Or_If_Expression (N : Node_Id) return Boolean; - -- Determine whether arbitrary node N is within a case or an if expression + -- Determine whether arbitrary node N is immediately within a case or an if + -- expression. The criterion is whether temporaries created by the actions + -- attached to N need to outlive an enclosing case or if expression. private pragma Inline (Duplicate_Subexpr); diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index d7bab7d..364dea6 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -73,8 +73,8 @@ endif ADA_CFLAGS = ALL_ADAFLAGS = \ - $(CFLAGS) $(NO_PIE_CFLAGS) $(ADA_CFLAGS) \ - $(ADAFLAGS) $(CHECKING_ADAFLAGS) $(WARN_ADAFLAGS) + $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) $(CHECKING_ADAFLAGS) \ + $(WARN_ADAFLAGS) $(PICFLAG) FORCE_DEBUG_ADAFLAGS = -g COMMON_ADA_INCLUDES = -I- -I. -Iada/generated -Iada -I$(srcdir)/ada @@ -1112,7 +1112,7 @@ ada/b_gnat1.adb : $(GNAT1_ADA_OBJS) ada/b_gnat1.o : ada/b_gnat1.adb # Do not use ADAFLAGS to get rid of -gnatg which generates a lot # of style messages. - $(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \ + $(CC) -c $(CFLAGS) $(ADA_CFLAGS) $(PICFLAG) -gnatp -gnatws $(ADA_INCLUDES) \ $< $(ADA_OUTPUT_OPTION) ada/b_gnatb.adb : $(GNATBIND_OBJS) ada/gnatbind.o @@ -1121,7 +1121,7 @@ ada/b_gnatb.adb : $(GNATBIND_OBJS) ada/gnatbind.o $(MV) b_gnatb.adb b_gnatb.ads ada/ ada/b_gnatb.o : ada/b_gnatb.adb - $(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \ + $(CC) -c $(CFLAGS) $(ADA_CFLAGS) $(PICFLAG) -gnatp -gnatws $(ADA_INCLUDES) \ $< $(ADA_OUTPUT_OPTION) include $(srcdir)/ada/Make-generated.in diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index da6a56f..dc0e54f 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -91,6 +91,7 @@ LS = ls RANLIB = @RANLIB@ RANLIB_FLAGS = @ranlib_flags@ AWK = @AWK@ +PICFLAG = @PICFLAG@ COMPILER = $(CC) COMPILER_FLAGS = $(CFLAGS) @@ -239,7 +240,11 @@ ALL_CPPFLAGS = $(CPPFLAGS) ALL_COMPILERFLAGS = $(ALL_CFLAGS) # This is where we get libiberty.a from. +ifeq ($(PICFLAG),) LIBIBERTY = ../../libiberty/libiberty.a +else +LIBIBERTY = ../../libiberty/pic/libiberty.a +endif # We need to link against libbacktrace because diagnostic.c in # libcommon.a uses it. @@ -256,9 +261,6 @@ TOOLS_LIBS = ../version.o ../link.o ../targext.o ../../ggc-none.o \ $(LIBGNAT) $(LIBINTL) $(LIBICONV) ../$(LIBBACKTRACE) ../$(LIBIBERTY) \ $(SYSLIBS) $(TGT_LIB) -# Add -no-pie to TOOLS_LIBS since some of them are compiled with -fno-PIE. -TOOLS_LIBS += @NO_PIE_FLAG@ - # Specify the directories to be searched for header files. # Both . and srcdir are used, in that order, # so that tm.h and config.h will be found in the compilation diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index e5e04dd..b2b7778 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -1076,9 +1076,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) || EXPRESSION_CLASS_P (inner) /* We need to detect the case where a temporary is created to hold the return value, since we cannot safely rename it at - top level as it lives only in the elaboration routine. */ + top level because it lives only in the elaboration routine. + But, at a lower level, an object initialized by a function + call may be (implicitly) renamed as this temporary by the + front-end and, in this case, we cannot make a copy. */ || (VAR_P (inner) - && DECL_RETURN_VALUE_P (inner)) + && DECL_RETURN_VALUE_P (inner) + && global_bindings_p ()) /* We also need to detect the case where the front-end creates a dangling 'reference to a function call at top level and substitutes it in the renaming, for example: @@ -1092,12 +1096,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) q__b : boolean renames q__R1s.all.e (1); We cannot safely rename the rewritten expression since the - underlying object lives only in the elaboration routine. */ + underlying object lives only in the elaboration routine but, + as above, this cannot be done at a lower level. */ || (INDIRECT_REF_P (inner) && (inner = remove_conversions (TREE_OPERAND (inner, 0), true)) && VAR_P (inner) - && DECL_RETURN_VALUE_P (inner))) + && DECL_RETURN_VALUE_P (inner) + && global_bindings_p ())) ; /* Otherwise, this is an lvalue being renamed, so it needs to be diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index e173772..95bbce2 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -878,7 +878,8 @@ build_binary_op (enum tree_code op_code, tree result_type, them; we'll be putting them back below if needed. Likewise for conversions between record types, except for justified modular types. But don't do this if the right operand is not BLKmode (for packed - arrays) unless we are not changing the mode. */ + arrays) unless we are not changing the mode, or if both ooperands + are view conversions to the same type. */ while ((CONVERT_EXPR_P (left_operand) || TREE_CODE (left_operand) == VIEW_CONVERT_EXPR) && (((INTEGRAL_TYPE_P (left_type) @@ -890,7 +891,10 @@ build_binary_op (enum tree_code op_code, tree result_type, && TREE_CODE (operand_type (left_operand)) == RECORD_TYPE && (TYPE_MODE (right_type) == BLKmode || TYPE_MODE (left_type) - == TYPE_MODE (operand_type (left_operand)))))) + == TYPE_MODE (operand_type (left_operand))) + && !(TREE_CODE (left_operand) == VIEW_CONVERT_EXPR + && TREE_CODE (right_operand) == VIEW_CONVERT_EXPR + && left_type == right_type)))) { left_operand = TREE_OPERAND (left_operand, 0); left_type = TREE_TYPE (left_operand); diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index 8a1db38..c62523d 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -321,9 +321,9 @@ package Gen_IL.Fields is No_Ctrl_Actions, No_Elaboration_Check, No_Entities_Ref_In_Spec, + No_Finalize_Actions, No_Initialization, No_Minimize_Eliminate, - No_Side_Effect_Removal, No_Truncation, Null_Excluding_Subtype, Null_Exclusion_Present, @@ -578,6 +578,7 @@ package Gen_IL.Fields is Has_Expanded_Contract, Has_Forward_Instantiation, Has_Fully_Qualified_Name, + Has_Ghost_Predicate_Aspect, Has_Gigi_Rep_Item, Has_Homonym, Has_Implicit_Dereference, diff --git a/gcc/ada/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb index 67efc5d..f980ba2 100644 --- a/gcc/ada/gen_il-gen-gen_entities.adb +++ b/gcc/ada/gen_il-gen-gen_entities.adb @@ -476,6 +476,7 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (Has_Dispatch_Table, Flag, Pre => "Is_Tagged_Type (N)"), Sm (Has_Dynamic_Predicate_Aspect, Flag), + Sm (Has_Ghost_Predicate_Aspect, Flag), Sm (Has_Inheritable_Invariants, Flag, Base_Type_Only), Sm (Has_Inherited_DIC, Flag, Base_Type_Only), Sm (Has_Inherited_Invariants, Flag, Base_Type_Only), diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index 864b7c4..19551fd 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -401,8 +401,7 @@ begin -- Gen_IL.Gen.Gen_Nodes Cc (N_Function_Call, N_Subprogram_Call, (Sy (Name, Node_Id, Default_Empty), Sy (Parameter_Associations, List_Id, Default_No_List), - Sm (Is_Expanded_Build_In_Place_Call, Flag), - Sm (No_Side_Effect_Removal, Flag))); + Sm (Is_Expanded_Build_In_Place_Call, Flag))); Cc (N_Procedure_Call_Statement, N_Subprogram_Call, (Sy (Name, Node_Id, Default_Empty), @@ -970,6 +969,7 @@ begin -- Gen_IL.Gen.Gen_Nodes Sm (Is_Elaboration_Code, Flag), Sm (Is_SPARK_Mode_On_Node, Flag), Sm (No_Ctrl_Actions, Flag), + Sm (No_Finalize_Actions, Flag), Sm (Suppress_Assignment_Checks, Flag))); Cc (N_Asynchronous_Select, N_Statement_Other_Than_Procedure_Call, diff --git a/gcc/ada/get_targ.adb b/gcc/ada/get_targ.adb index b2b8932..3422899 100644 --- a/gcc/ada/get_targ.adb +++ b/gcc/ada/get_targ.adb @@ -279,15 +279,6 @@ package body Get_Targ is end Get_Back_End_Config_File; ----------------------------- - -- Get_Max_Unaligned_Field -- - ----------------------------- - - function Get_Max_Unaligned_Field return Pos is - begin - return 64; -- Can be different on some targets - end Get_Max_Unaligned_Field; - - ----------------------------- -- Register_Back_End_Types -- ----------------------------- diff --git a/gcc/ada/get_targ.ads b/gcc/ada/get_targ.ads index ef9c572..2520659 100644 --- a/gcc/ada/get_targ.ads +++ b/gcc/ada/get_targ.ads @@ -110,10 +110,6 @@ package Get_Targ is -- Other subprograms - function Get_Max_Unaligned_Field return Pos; - -- Returns the maximum supported size in bits for a field that is - -- not aligned on a storage unit boundary. - type C_String is array (0 .. 255) of aliased Character; pragma Convention (C, C_String); diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index 5b3cd89..6cf87ce 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -31,7 +31,6 @@ with Einfo.Entities; use Einfo.Entities; with Einfo.Utils; use Einfo.Utils; with Elists; use Elists; with Errout; use Errout; -with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Sem; use Sem; @@ -101,11 +100,6 @@ package body Ghost is -- mode Mode. Mark all formals parameters when N denotes a subprogram or a -- body. - function Name_To_Ghost_Mode (Mode : Name_Id) return Ghost_Mode_Type; - pragma Inline (Name_To_Ghost_Mode); - -- Convert a Ghost mode denoted by name Mode into its respective enumerated - -- value. - procedure Record_Ignored_Ghost_Node (N : Node_Or_Entity_Id); -- Save ignored Ghost node or entity N in table Ignored_Ghost_Nodes for -- later elimination. @@ -490,13 +484,15 @@ package body Ghost is -- A reference to a Ghost entity can appear within an aspect -- specification (SPARK RM 6.9(10)). The precise checking will -- occur when analyzing the corresponding pragma. We make an - -- exception for predicate aspects that only allow referencing - -- a Ghost entity when the corresponding type declaration is - -- Ghost (SPARK RM 6.9(11)). + -- exception for predicate aspects other than Ghost_Predicate + -- that only allow referencing a Ghost entity when the + -- corresponding type declaration is Ghost (SPARK RM 6.9(11)). elsif Nkind (Par) = N_Aspect_Specification - and then not Same_Aspect - (Get_Aspect_Id (Par), Aspect_Predicate) + and then + (Get_Aspect_Id (Par) = Aspect_Ghost_Predicate + or else not Same_Aspect + (Get_Aspect_Id (Par), Aspect_Predicate)) then return True; @@ -659,7 +655,9 @@ package body Ghost is -- declaration and at the point of use match. if Is_OK_Ghost_Context (Ghost_Ref) then - Check_Ghost_Policy (Ghost_Id, Ghost_Ref); + if Present (Ghost_Id) then + Check_Ghost_Policy (Ghost_Id, Ghost_Ref); + end if; -- Otherwise the Ghost entity appears in a non-Ghost context and affects -- its behavior or value (SPARK RM 6.9(10,11)). @@ -677,6 +675,7 @@ package body Ghost is Ghost_Ref); Error_Msg_N ("\either make the type ghost " + & "or use a Ghost_Predicate " & "or use a type invariant on a private type", Ghost_Ref); end if; end if; @@ -1198,6 +1197,16 @@ package body Ghost is return False; end Is_Ghost_Assignment; + ---------------------------------- + -- Is_Ghost_Attribute_Reference -- + ---------------------------------- + + function Is_Ghost_Attribute_Reference (N : Node_Id) return Boolean is + begin + return Nkind (N) = N_Attribute_Reference + and then Attribute_Name (N) = Name_Initialized; + end Is_Ghost_Attribute_Reference; + -------------------------- -- Is_Ghost_Declaration -- -------------------------- @@ -1877,9 +1886,22 @@ package body Ghost is -- a Ghost entity. if Is_Checked_Ghost_Entity (Id) then - Set_Is_Checked_Ghost_Pragma (N); + Mark_Ghost_Pragma (N, Check); elsif Is_Ignored_Ghost_Entity (Id) then + Mark_Ghost_Pragma (N, Ignore); + end if; + end Mark_Ghost_Pragma; + + procedure Mark_Ghost_Pragma + (N : Node_Id; + Mode : Ghost_Mode_Type) + is + begin + if Mode = Check then + Set_Is_Checked_Ghost_Pragma (N); + + else Set_Is_Ignored_Ghost_Pragma (N); Set_Is_Ignored_Ghost_Node (N); Record_Ignored_Ghost_Node (N); diff --git a/gcc/ada/ghost.ads b/gcc/ada/ghost.ads index 67ef194..663e70c 100644 --- a/gcc/ada/ghost.ads +++ b/gcc/ada/ghost.ads @@ -26,6 +26,7 @@ -- This package contains routines that deal with the static and runtime -- semantics of Ghost entities. +with Namet; use Namet; with Opt; use Opt; with Types; use Types; @@ -110,6 +111,10 @@ package Ghost is -- Determine whether arbitrary node N denotes an assignment statement whose -- target is a Ghost entity. + function Is_Ghost_Attribute_Reference (N : Node_Id) return Boolean; + -- Determine whether arbitrary node N denotes an attribute reference which + -- denotes a Ghost attribute. + function Is_Ghost_Declaration (N : Node_Id) return Boolean; -- Determine whether arbitrary node N denotes a declaration which defines -- a Ghost entity. @@ -214,6 +219,11 @@ package Ghost is -- -- * The pragma is associated with Ghost entity Id + procedure Mark_Ghost_Pragma + (N : Node_Id; + Mode : Ghost_Mode_Type); + -- Mark pragma N as Ghost with the corresponding Mode + procedure Mark_Ghost_Renaming (N : Node_Id; Id : Entity_Id); @@ -221,6 +231,11 @@ package Ghost is -- -- * Renamed entity Id denotes a Ghost entity + function Name_To_Ghost_Mode (Mode : Name_Id) return Ghost_Mode_Type; + pragma Inline (Name_To_Ghost_Mode); + -- Convert a Ghost mode denoted by name Mode into its respective enumerated + -- value. + procedure Remove_Ignored_Ghost_Code; -- Remove all code marked as ignored Ghost from the trees of all qualifying -- units (SPARK RM 6.9(4)). diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 0c841fd..a5ee992 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -19,7 +19,7 @@ @copying @quotation -GNAT Reference Manual , May 09, 2023 +GNAT Reference Manual , Jun 01, 2023 AdaCore @@ -314,6 +314,7 @@ Implementation Defined Aspects * Aspect Extensions_Visible:: * Aspect Favor_Top_Level:: * Aspect Ghost:: +* Aspect Ghost_Predicate:: * Aspect Global:: * Aspect Initial_Condition:: * Aspect Initializes:: @@ -9163,6 +9164,7 @@ or attribute definition clause. * Aspect Extensions_Visible:: * Aspect Favor_Top_Level:: * Aspect Ghost:: +* Aspect Ghost_Predicate:: * Aspect Global:: * Aspect Initial_Condition:: * Aspect Initializes:: @@ -9448,7 +9450,7 @@ This aspect is equivalent to @ref{69,,pragma Extensions_Visible}. This boolean aspect is equivalent to @ref{6e,,pragma Favor_Top_Level}. -@node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects +@node Aspect Ghost,Aspect Ghost_Predicate,Aspect Favor_Top_Level,Implementation Defined Aspects @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{133} @section Aspect Ghost @@ -9457,8 +9459,21 @@ This boolean aspect is equivalent to @ref{6e,,pragma Favor_Top_Level}. This aspect is equivalent to @ref{72,,pragma Ghost}. -@node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{134} +@node Aspect Ghost_Predicate,Aspect Global,Aspect Ghost,Implementation Defined Aspects +@anchor{gnat_rm/implementation_defined_aspects aspect-ghost-predicate}@anchor{134} +@section Aspect Ghost_Predicate + + +@geindex Ghost_Predicate + +This aspect introduces a subtype predicate that can reference ghost +entities. The subtype cannot appear as a subtype_mark in a membership test. + +For the detailed semantics of this aspect, see the entry for subtype predicates +in the SPARK Reference Manual, section 3.2.4. + +@node Aspect Global,Aspect Initial_Condition,Aspect Ghost_Predicate,Implementation Defined Aspects +@anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{135} @section Aspect Global @@ -9467,7 +9482,7 @@ This aspect is equivalent to @ref{72,,pragma Ghost}. This aspect is equivalent to @ref{74,,pragma Global}. @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{135} +@anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{136} @section Aspect Initial_Condition @@ -9476,7 +9491,7 @@ This aspect is equivalent to @ref{74,,pragma Global}. This aspect is equivalent to @ref{81,,pragma Initial_Condition}. @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{136} +@anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{137} @section Aspect Initializes @@ -9485,7 +9500,7 @@ This aspect is equivalent to @ref{81,,pragma Initial_Condition}. This aspect is equivalent to @ref{84,,pragma Initializes}. @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{137} +@anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{138} @section Aspect Inline_Always @@ -9494,7 +9509,7 @@ This aspect is equivalent to @ref{84,,pragma Initializes}. This boolean aspect is equivalent to @ref{86,,pragma Inline_Always}. @node Aspect Invariant,Aspect Invariant’Class,Aspect Inline_Always,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{138} +@anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{139} @section Aspect Invariant @@ -9505,7 +9520,7 @@ synonym for the language defined aspect @code{Type_Invariant} except that it is separately controllable using pragma @code{Assertion_Policy}. @node Aspect Invariant’Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{139} +@anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{13a} @section Aspect Invariant’Class @@ -9516,7 +9531,7 @@ synonym for the language defined aspect @code{Type_Invariant'Class} except that it is separately controllable using pragma @code{Assertion_Policy}. @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant’Class,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13a} +@anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13b} @section Aspect Iterable @@ -9600,7 +9615,7 @@ function Get_Element (Cont : Container; Position : Cursor) return Element_Type; This aspect is used in the GNAT-defined formal container packages. @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13b} +@anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13c} @section Aspect Linker_Section @@ -9609,7 +9624,7 @@ This aspect is used in the GNAT-defined formal container packages. This aspect is equivalent to @ref{95,,pragma Linker_Section}. @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{13c} +@anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{13d} @section Aspect Lock_Free @@ -9618,7 +9633,7 @@ This aspect is equivalent to @ref{95,,pragma Linker_Section}. This boolean aspect is equivalent to @ref{97,,pragma Lock_Free}. @node Aspect Max_Queue_Length,Aspect No_Caching,Aspect Lock_Free,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13d} +@anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13e} @section Aspect Max_Queue_Length @@ -9627,7 +9642,7 @@ This boolean aspect is equivalent to @ref{97,,pragma Lock_Free}. This aspect is equivalent to @ref{9f,,pragma Max_Queue_Length}. @node Aspect No_Caching,Aspect No_Elaboration_Code_All,Aspect Max_Queue_Length,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{13e} +@anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{13f} @section Aspect No_Caching @@ -9636,7 +9651,7 @@ This aspect is equivalent to @ref{9f,,pragma Max_Queue_Length}. This boolean aspect is equivalent to @ref{a2,,pragma No_Caching}. @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect No_Caching,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{13f} +@anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{140} @section Aspect No_Elaboration_Code_All @@ -9646,7 +9661,7 @@ This aspect is equivalent to @ref{a5,,pragma No_Elaboration_Code_All} for a program unit. @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{140} +@anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{141} @section Aspect No_Inline @@ -9655,7 +9670,7 @@ for a program unit. This boolean aspect is equivalent to @ref{a8,,pragma No_Inline}. @node Aspect No_Tagged_Streams,Aspect No_Task_Parts,Aspect No_Inline,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{141} +@anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{142} @section Aspect No_Tagged_Streams @@ -9666,7 +9681,7 @@ argument specifying a root tagged type (thus this aspect can only be applied to such a type). @node Aspect No_Task_Parts,Aspect Object_Size,Aspect No_Tagged_Streams,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-no-task-parts}@anchor{142} +@anchor{gnat_rm/implementation_defined_aspects aspect-no-task-parts}@anchor{143} @section Aspect No_Task_Parts @@ -9682,16 +9697,16 @@ away certain tasking-related code that would otherwise be needed for T’Class, because descendants of T might contain tasks. @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Task_Parts,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{143} +@anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{144} @section Aspect Object_Size @geindex Object_Size -This aspect is equivalent to @ref{144,,attribute Object_Size}. +This aspect is equivalent to @ref{145,,attribute Object_Size}. @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{145} +@anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{146} @section Aspect Obsolescent @@ -9702,7 +9717,7 @@ evaluation of this aspect happens at the point of occurrence, it is not delayed until the freeze point. @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{146} +@anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{147} @section Aspect Part_Of @@ -9711,7 +9726,7 @@ delayed until the freeze point. This aspect is equivalent to @ref{b5,,pragma Part_Of}. @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{147} +@anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{148} @section Aspect Persistent_BSS @@ -9720,7 +9735,7 @@ This aspect is equivalent to @ref{b5,,pragma Part_Of}. This boolean aspect is equivalent to @ref{b9,,pragma Persistent_BSS}. @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{148} +@anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{149} @section Aspect Predicate @@ -9734,7 +9749,7 @@ expression. It is also separately controllable using pragma @code{Assertion_Policy}. @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{149} +@anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{14a} @section Aspect Pure_Function @@ -9743,7 +9758,7 @@ expression. It is also separately controllable using pragma This boolean aspect is equivalent to @ref{cc,,pragma Pure_Function}. @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{14a} +@anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{14b} @section Aspect Refined_Depends @@ -9752,7 +9767,7 @@ This boolean aspect is equivalent to @ref{cc,,pragma Pure_Function}. This aspect is equivalent to @ref{d0,,pragma Refined_Depends}. @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14b} +@anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14c} @section Aspect Refined_Global @@ -9761,7 +9776,7 @@ This aspect is equivalent to @ref{d0,,pragma Refined_Depends}. This aspect is equivalent to @ref{d2,,pragma Refined_Global}. @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14c} +@anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14d} @section Aspect Refined_Post @@ -9770,7 +9785,7 @@ This aspect is equivalent to @ref{d2,,pragma Refined_Global}. This aspect is equivalent to @ref{d4,,pragma Refined_Post}. @node Aspect Refined_State,Aspect Relaxed_Initialization,Aspect Refined_Post,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{14d} +@anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{14e} @section Aspect Refined_State @@ -9779,7 +9794,7 @@ This aspect is equivalent to @ref{d4,,pragma Refined_Post}. This aspect is equivalent to @ref{d6,,pragma Refined_State}. @node Aspect Relaxed_Initialization,Aspect Remote_Access_Type,Aspect Refined_State,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-relaxed-initialization}@anchor{14e} +@anchor{gnat_rm/implementation_defined_aspects aspect-relaxed-initialization}@anchor{14f} @section Aspect Relaxed_Initialization @@ -9789,7 +9804,7 @@ For the syntax and semantics of this aspect, see the SPARK 2014 Reference Manual, section 6.10. @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Relaxed_Initialization,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{14f} +@anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{150} @section Aspect Remote_Access_Type @@ -9798,7 +9813,7 @@ Manual, section 6.10. This aspect is equivalent to @ref{d9,,pragma Remote_Access_Type}. @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{150} +@anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{151} @section Aspect Secondary_Stack_Size @@ -9807,16 +9822,16 @@ This aspect is equivalent to @ref{d9,,pragma Remote_Access_Type}. This aspect is equivalent to @ref{df,,pragma Secondary_Stack_Size}. @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{151} +@anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{152} @section Aspect Scalar_Storage_Order @geindex Scalar_Storage_Order -This aspect is equivalent to a @ref{152,,attribute Scalar_Storage_Order}. +This aspect is equivalent to a @ref{153,,attribute Scalar_Storage_Order}. @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{153} +@anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{154} @section Aspect Shared @@ -9826,7 +9841,7 @@ This boolean aspect is equivalent to @ref{e2,,pragma Shared} and is thus a synonym for aspect @code{Atomic}. @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{154} +@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{155} @section Aspect Simple_Storage_Pool @@ -9835,7 +9850,7 @@ and is thus a synonym for aspect @code{Atomic}. This aspect is equivalent to @ref{e7,,attribute Simple_Storage_Pool}. @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{155} +@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{156} @section Aspect Simple_Storage_Pool_Type @@ -9844,7 +9859,7 @@ This aspect is equivalent to @ref{e7,,attribute Simple_Storage_Pool}. This boolean aspect is equivalent to @ref{e6,,pragma Simple_Storage_Pool_Type}. @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{156} +@anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{157} @section Aspect SPARK_Mode @@ -9855,7 +9870,7 @@ may be specified for either or both of the specification and body of a subprogram or package. @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{157} +@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{158} @section Aspect Suppress_Debug_Info @@ -9864,7 +9879,7 @@ of a subprogram or package. This boolean aspect is equivalent to @ref{f6,,pragma Suppress_Debug_Info}. @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{158} +@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{159} @section Aspect Suppress_Initialization @@ -9873,7 +9888,7 @@ This boolean aspect is equivalent to @ref{f6,,pragma Suppress_Debug_Info}. This boolean aspect is equivalent to @ref{f9,,pragma Suppress_Initialization}. @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{159} +@anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{15a} @section Aspect Test_Case @@ -9882,7 +9897,7 @@ This boolean aspect is equivalent to @ref{f9,,pragma Suppress_Initialization}. This aspect is equivalent to @ref{fd,,pragma Test_Case}. @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{15a} +@anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{15b} @section Aspect Thread_Local_Storage @@ -9891,7 +9906,7 @@ This aspect is equivalent to @ref{fd,,pragma Test_Case}. This boolean aspect is equivalent to @ref{ff,,pragma Thread_Local_Storage}. @node Aspect Universal_Aliasing,Aspect Unmodified,Aspect Thread_Local_Storage,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{15b} +@anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{15c} @section Aspect Universal_Aliasing @@ -9900,7 +9915,7 @@ This boolean aspect is equivalent to @ref{ff,,pragma Thread_Local_Storage}. This boolean aspect is equivalent to @ref{109,,pragma Universal_Aliasing}. @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Aliasing,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15c} +@anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15d} @section Aspect Unmodified @@ -9909,7 +9924,7 @@ This boolean aspect is equivalent to @ref{109,,pragma Universal_Aliasing}. This boolean aspect is equivalent to @ref{10b,,pragma Unmodified}. @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{15d} +@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{15e} @section Aspect Unreferenced @@ -9922,7 +9937,7 @@ parameters, which is in particular the only form possible for expression functions. @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{15e} +@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{15f} @section Aspect Unreferenced_Objects @@ -9931,16 +9946,16 @@ functions. This boolean aspect is equivalent to @ref{10f,,pragma Unreferenced_Objects}. @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{15f} +@anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{160} @section Aspect Value_Size @geindex Value_Size -This aspect is equivalent to @ref{160,,attribute Value_Size}. +This aspect is equivalent to @ref{161,,attribute Value_Size}. @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{161} +@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{162} @section Aspect Volatile_Full_Access @@ -9949,7 +9964,7 @@ This aspect is equivalent to @ref{160,,attribute Value_Size}. This boolean aspect is equivalent to @ref{119,,pragma Volatile_Full_Access}. @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{162} +@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{163} @section Aspect Volatile_Function @@ -9958,7 +9973,7 @@ This boolean aspect is equivalent to @ref{119,,pragma Volatile_Full_Access}. This boolean aspect is equivalent to @ref{11b,,pragma Volatile_Function}. @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects -@anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{163} +@anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{164} @section Aspect Warnings @@ -9969,7 +9984,7 @@ where the first argument is @code{ON} or @code{OFF} and the second argument is the entity. @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top -@anchor{gnat_rm/implementation_defined_attributes doc}@anchor{164}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{165}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8} +@anchor{gnat_rm/implementation_defined_attributes doc}@anchor{165}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{166}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8} @chapter Implementation Defined Attributes @@ -10075,7 +10090,7 @@ consideration, you should minimize the use of these attributes. @end menu @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{166} +@anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{167} @section Attribute Abort_Signal @@ -10089,7 +10104,7 @@ completely outside the normal semantics of Ada, for a user program to intercept the abort exception). @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{167} +@anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{168} @section Attribute Address_Size @@ -10105,7 +10120,7 @@ reference to System.Address’Size is nonstatic because Address is a private type. @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{168} +@anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{169} @section Attribute Asm_Input @@ -10119,10 +10134,10 @@ to be a static expression, and is the constraint for the parameter, value to be used as the input argument. The possible values for the constant are the same as those used in the RTL, and are dependent on the configuration file used to built the GCC back end. -@ref{169,,Machine Code Insertions} +@ref{16a,,Machine Code Insertions} @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{16a} +@anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{16b} @section Attribute Asm_Output @@ -10138,10 +10153,10 @@ result. The possible values for constraint are the same as those used in the RTL, and are dependent on the configuration file used to build the GCC back end. If there are no output operands, then this argument may either be omitted, or explicitly given as @code{No_Output_Operands}. -@ref{169,,Machine Code Insertions} +@ref{16a,,Machine Code Insertions} @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16b} +@anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16c} @section Attribute Atomic_Always_Lock_Free @@ -10153,7 +10168,7 @@ and False otherwise. The result indicate whether atomic operations are supported by the target for the given type. @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16c} +@anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16d} @section Attribute Bit @@ -10184,7 +10199,7 @@ This attribute is designed to be compatible with the DEC Ada 83 definition and implementation of the @code{Bit} attribute. @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{16d} +@anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{16e} @section Attribute Bit_Position @@ -10199,7 +10214,7 @@ type `universal_integer'. The value depends only on the field the containing record @code{R}. @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{16e} +@anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{16f} @section Attribute Code_Address @@ -10242,7 +10257,7 @@ the same value as is returned by the corresponding @code{'Address} attribute. @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{16f} +@anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{170} @section Attribute Compiler_Version @@ -10253,7 +10268,7 @@ prefix) yields a static string identifying the version of the compiler being used to compile the unit containing the attribute reference. @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{170} +@anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{171} @section Attribute Constrained @@ -10268,7 +10283,7 @@ record type without discriminants is always @code{True}. This usage is compatible with older Ada compilers, including notably DEC Ada. @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{171} +@anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{172} @section Attribute Default_Bit_Order @@ -10285,7 +10300,7 @@ as a @code{Pos} value (0 for @code{High_Order_First}, 1 for @code{Default_Bit_Order} in package @code{System}. @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{172} +@anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{173} @section Attribute Default_Scalar_Storage_Order @@ -10302,7 +10317,7 @@ equal to @code{Default_Bit_Order} if unspecified) as a @code{System.Bit_Order} value. This is a static attribute. @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{173} +@anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{174} @section Attribute Deref @@ -10315,7 +10330,7 @@ a named access-to-@cite{typ} type, except that it yields a variable, so it can b used on the left side of an assignment. @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{174} +@anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{175} @section Attribute Descriptor_Size @@ -10344,7 +10359,7 @@ since @code{Positive} has an alignment of 4, the size of the descriptor is which yields a size of 32 bits, i.e. including 16 bits of padding. @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{175} +@anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{176} @section Attribute Elaborated @@ -10359,7 +10374,7 @@ units has been completed. An exception is for units which need no elaboration, the value is always False for such units. @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{176} +@anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{177} @section Attribute Elab_Body @@ -10375,7 +10390,7 @@ e.g., if it is necessary to do selective re-elaboration to fix some error. @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{177} +@anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{178} @section Attribute Elab_Spec @@ -10391,7 +10406,7 @@ Ada code, e.g., if it is necessary to do selective re-elaboration to fix some error. @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{178} +@anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{179} @section Attribute Elab_Subp_Body @@ -10405,7 +10420,7 @@ elaboration procedure by the binder in CodePeer mode only and is unrecognized otherwise. @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{179} +@anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{17a} @section Attribute Emax @@ -10418,7 +10433,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute. @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{17a} +@anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{17b} @section Attribute Enabled @@ -10442,7 +10457,7 @@ a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating the package or subprogram, controlling whether the check will be present. @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17b} +@anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17c} @section Attribute Enum_Rep @@ -10482,7 +10497,7 @@ integer calculation is done at run time, then the call to @code{Enum_Rep} may raise @code{Constraint_Error}. @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17c} +@anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17d} @section Attribute Enum_Val @@ -10508,7 +10523,7 @@ absence of an enumeration representation clause. This is a static attribute (i.e., the result is static if the argument is static). @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{17d} +@anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{17e} @section Attribute Epsilon @@ -10521,7 +10536,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute. @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{17e} +@anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{17f} @section Attribute Fast_Math @@ -10532,7 +10547,7 @@ prefix) yields a static Boolean value that is True if pragma @code{Fast_Math} is active, and False otherwise. @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{17f} +@anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{180} @section Attribute Finalization_Size @@ -10550,7 +10565,7 @@ class-wide type whose tag denotes a type with no controlled parts. Note that only heap-allocated objects contain finalization data. @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{180} +@anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{181} @section Attribute Fixed_Value @@ -10577,7 +10592,7 @@ This attribute is primarily intended for use in implementation of the input-output functions for fixed-point values. @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{181} +@anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{182} @section Attribute From_Any @@ -10587,7 +10602,7 @@ This internal attribute is used for the generation of remote subprogram stubs in the context of the Distributed Systems Annex. @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{182} +@anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{183} @section Attribute Has_Access_Values @@ -10605,7 +10620,7 @@ definitions. If the attribute is applied to a generic private type, it indicates whether or not the corresponding actual type has access values. @node Attribute Has_Discriminants,Attribute Has_Tagged_Values,Attribute Has_Access_Values,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{183} +@anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{184} @section Attribute Has_Discriminants @@ -10621,7 +10636,7 @@ definitions. If the attribute is applied to a generic private type, it indicates whether or not the corresponding actual type has discriminants. @node Attribute Has_Tagged_Values,Attribute Img,Attribute Has_Discriminants,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-has-tagged-values}@anchor{184} +@anchor{gnat_rm/implementation_defined_attributes attribute-has-tagged-values}@anchor{185} @section Attribute Has_Tagged_Values @@ -10638,7 +10653,7 @@ definitions. If the attribute is applied to a generic private type, it indicates whether or not the corresponding actual type has access values. @node Attribute Img,Attribute Initialized,Attribute Has_Tagged_Values,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{185} +@anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{186} @section Attribute Img @@ -10668,7 +10683,7 @@ that returns the appropriate string when called. This means that in an instantiation as a function parameter. @node Attribute Initialized,Attribute Integer_Value,Attribute Img,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-initialized}@anchor{186} +@anchor{gnat_rm/implementation_defined_attributes attribute-initialized}@anchor{187} @section Attribute Initialized @@ -10678,7 +10693,7 @@ For the syntax and semantics of this attribute, see the SPARK 2014 Reference Manual, section 6.10. @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Initialized,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{187} +@anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{188} @section Attribute Integer_Value @@ -10706,7 +10721,7 @@ This attribute is primarily intended for use in implementation of the standard input-output functions for fixed-point values. @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{188} +@anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{189} @section Attribute Invalid_Value @@ -10720,7 +10735,7 @@ including the ability to modify the value with the binder -Sxx flag and relevant environment variables at run time. @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{189} +@anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{18a} @section Attribute Iterable @@ -10729,7 +10744,7 @@ relevant environment variables at run time. Equivalent to Aspect Iterable. @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{18a} +@anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{18b} @section Attribute Large @@ -10742,7 +10757,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute. @node Attribute Library_Level,Attribute Loop_Entry,Attribute Large,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{18b} +@anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{18c} @section Attribute Library_Level @@ -10768,7 +10783,7 @@ end Gen; @end example @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Library_Level,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18c} +@anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18d} @section Attribute Loop_Entry @@ -10801,7 +10816,7 @@ entry. This copy is not performed if the loop is not entered, or if the corresponding pragmas are ignored or disabled. @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18d} +@anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18e} @section Attribute Machine_Size @@ -10811,7 +10826,7 @@ This attribute is identical to the @code{Object_Size} attribute. It is provided for compatibility with the DEC Ada 83 attribute of this name. @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{18e} +@anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{18f} @section Attribute Mantissa @@ -10824,7 +10839,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute. @node Attribute Maximum_Alignment,Attribute Max_Integer_Size,Attribute Mantissa,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{18f}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{190} +@anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{190}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{191} @section Attribute Maximum_Alignment @@ -10840,7 +10855,7 @@ for an object, guaranteeing that it is properly aligned in all cases. @node Attribute Max_Integer_Size,Attribute Mechanism_Code,Attribute Maximum_Alignment,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-max-integer-size}@anchor{191} +@anchor{gnat_rm/implementation_defined_attributes attribute-max-integer-size}@anchor{192} @section Attribute Max_Integer_Size @@ -10851,7 +10866,7 @@ prefix) provides the size of the largest supported integer type for the target. The result is a static constant. @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Max_Integer_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{192} +@anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{193} @section Attribute Mechanism_Code @@ -10882,7 +10897,7 @@ by reference @end table @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{193} +@anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{194} @section Attribute Null_Parameter @@ -10907,7 +10922,7 @@ There is no way of indicating this without the @code{Null_Parameter} attribute. @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{144}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{194} +@anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{145}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{195} @section Attribute Object_Size @@ -10977,7 +10992,7 @@ Similar additional checks are performed in other contexts requiring statically matching subtypes. @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{195} +@anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{196} @section Attribute Old @@ -10992,7 +11007,7 @@ definition are allowed under control of implementation defined pragma @code{Unevaluated_Use_Of_Old}. @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{196} +@anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{197} @section Attribute Passed_By_Reference @@ -11008,7 +11023,7 @@ passed by copy in calls. For scalar types, the result is always @code{False} and is static. For non-scalar types, the result is nonstatic. @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{197} +@anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{198} @section Attribute Pool_Address @@ -11030,7 +11045,7 @@ For an object created by @code{new}, @code{Ptr.all'Pool_Address} is what is passed to @code{Allocate} and returned from @code{Deallocate}. @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{198} +@anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{199} @section Attribute Range_Length @@ -11043,7 +11058,7 @@ applied to the index subtype of a one dimensional array always gives the same result as @code{Length} applied to the array itself. @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{199} +@anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{19a} @section Attribute Restriction_Set @@ -11113,7 +11128,7 @@ Restrictions pragma, they are not analyzed semantically, so they do not have a type. @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{19a} +@anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{19b} @section Attribute Result @@ -11126,7 +11141,7 @@ For a further discussion of the use of this attribute and examples of its use, see the description of pragma Postcondition. @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{19b} +@anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{19c} @section Attribute Safe_Emax @@ -11139,7 +11154,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute. @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{19c} +@anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{19d} @section Attribute Safe_Large @@ -11152,7 +11167,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute. @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{19d} +@anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{19e} @section Attribute Safe_Small @@ -11165,7 +11180,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute. @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{152}@anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19e} +@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{153}@anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19f} @section Attribute Scalar_Storage_Order @@ -11328,7 +11343,7 @@ Note that debuggers may be unable to display the correct value of scalar components of a type for which the opposite storage order is specified. @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e7}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{19f} +@anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e7}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{1a0} @section Attribute Simple_Storage_Pool @@ -11391,7 +11406,7 @@ as defined in section 13.11.2 of the Ada Reference Manual, except that the term `simple storage pool' is substituted for `storage pool'. @node Attribute Small,Attribute Small_Denominator,Attribute Simple_Storage_Pool,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{1a0} +@anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{1a1} @section Attribute Small @@ -11407,7 +11422,7 @@ the Ada 83 reference manual for an exact description of the semantics of this attribute when applied to floating-point types. @node Attribute Small_Denominator,Attribute Small_Numerator,Attribute Small,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-small-denominator}@anchor{1a1} +@anchor{gnat_rm/implementation_defined_attributes attribute-small-denominator}@anchor{1a2} @section Attribute Small_Denominator @@ -11420,7 +11435,7 @@ denominator in the representation of @code{typ'Small} as a rational number with coprime factors (i.e. as an irreducible fraction). @node Attribute Small_Numerator,Attribute Storage_Unit,Attribute Small_Denominator,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-small-numerator}@anchor{1a2} +@anchor{gnat_rm/implementation_defined_attributes attribute-small-numerator}@anchor{1a3} @section Attribute Small_Numerator @@ -11433,7 +11448,7 @@ numerator in the representation of @code{typ'Small} as a rational number with coprime factors (i.e. as an irreducible fraction). @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small_Numerator,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{1a3} +@anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{1a4} @section Attribute Storage_Unit @@ -11443,7 +11458,7 @@ with coprime factors (i.e. as an irreducible fraction). prefix) provides the same value as @code{System.Storage_Unit}. @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{1a4} +@anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{1a5} @section Attribute Stub_Type @@ -11467,7 +11482,7 @@ unit @code{System.Partition_Interface}. Use of this attribute will create an implicit dependency on this unit. @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1a5} +@anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1a6} @section Attribute System_Allocator_Alignment @@ -11484,7 +11499,7 @@ with alignment too large or to enable a realignment circuitry if the alignment request is larger than this value. @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1a6} +@anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1a7} @section Attribute Target_Name @@ -11497,7 +11512,7 @@ standard gcc target name without the terminating slash (for example, GNAT 5.0 on windows yields “i586-pc-mingw32msv”). @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1a7} +@anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1a8} @section Attribute To_Address @@ -11520,7 +11535,7 @@ modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on a 32 bits machine). @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1a8} +@anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1a9} @section Attribute To_Any @@ -11530,7 +11545,7 @@ This internal attribute is used for the generation of remote subprogram stubs in the context of the Distributed Systems Annex. @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1a9} +@anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1aa} @section Attribute Type_Class @@ -11560,7 +11575,7 @@ applies to all concurrent types. This attribute is designed to be compatible with the DEC Ada 83 attribute of the same name. @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1aa} +@anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1ab} @section Attribute Type_Key @@ -11572,7 +11587,7 @@ about the type or subtype. This provides improved compatibility with other implementations that support this attribute. @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1ab} +@anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1ac} @section Attribute TypeCode @@ -11582,7 +11597,7 @@ This internal attribute is used for the generation of remote subprogram stubs in the context of the Distributed Systems Annex. @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1ac} +@anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1ad} @section Attribute Unconstrained_Array @@ -11596,7 +11611,7 @@ still static, and yields the result of applying this test to the generic actual. @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1ad} +@anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1ae} @section Attribute Universal_Literal_String @@ -11624,7 +11639,7 @@ end; @end example @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1ae} +@anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1af} @section Attribute Unrestricted_Access @@ -11811,7 +11826,7 @@ In general this is a risky approach. It may appear to “work” but such uses o of GNAT to another, so are best avoided if possible. @node Attribute Update,Attribute Valid_Value,Attribute Unrestricted_Access,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1af} +@anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1b0} @section Attribute Update @@ -11892,7 +11907,7 @@ A := A'Update ((1, 2) => 20, (3, 4) => 30); which changes element (1,2) to 20 and (3,4) to 30. @node Attribute Valid_Value,Attribute Valid_Scalars,Attribute Update,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-valid-value}@anchor{1b0} +@anchor{gnat_rm/implementation_defined_attributes attribute-valid-value}@anchor{1b1} @section Attribute Valid_Value @@ -11904,7 +11919,7 @@ a String, and returns Boolean. @code{T'Valid_Value (S)} returns True if and only if @code{T'Value (S)} would not raise Constraint_Error. @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Valid_Value,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1b1} +@anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1b2} @section Attribute Valid_Scalars @@ -11938,7 +11953,7 @@ write a function with a single use of the attribute, and then call that function from multiple places. @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1b2} +@anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1b3} @section Attribute VADS_Size @@ -11958,7 +11973,7 @@ gives the result that would be obtained by applying the attribute to the corresponding type. @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{160}@anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b3} +@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{161}@anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b4} @section Attribute Value_Size @@ -11972,7 +11987,7 @@ a value of the given subtype. It is the same as @code{type'Size}, but, unlike @code{Size}, may be set for non-first subtypes. @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1b4} +@anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1b5} @section Attribute Wchar_T_Size @@ -11984,7 +11999,7 @@ primarily for constructing the definition of this type in package @code{Interfaces.C}. The result is a static constant. @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes -@anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1b5} +@anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1b6} @section Attribute Word_Size @@ -11995,7 +12010,7 @@ prefix) provides the value @code{System.Word_Size}. The result is a static constant. @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top -@anchor{gnat_rm/standard_and_implementation_defined_restrictions doc}@anchor{1b6}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1b7}@anchor{gnat_rm/standard_and_implementation_defined_restrictions standard-and-implementation-defined-restrictions}@anchor{9} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions doc}@anchor{1b7}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1b8}@anchor{gnat_rm/standard_and_implementation_defined_restrictions standard-and-implementation-defined-restrictions}@anchor{9} @chapter Standard and Implementation Defined Restrictions @@ -12024,7 +12039,7 @@ language defined or GNAT-specific, are listed in the following. @end menu @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1b8}@anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1b9} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1b9}@anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1ba} @section Partition-Wide Restrictions @@ -12115,7 +12130,7 @@ then all compilation units in the partition must obey the restriction). @end menu @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1ba} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1bb} @subsection Immediate_Reclamation @@ -12127,7 +12142,7 @@ deallocation, any storage reserved at run time for an object is immediately reclaimed when the object no longer exists. @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1bb} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1bc} @subsection Max_Asynchronous_Select_Nesting @@ -12139,7 +12154,7 @@ detected at compile time. Violations of this restriction with values other than zero cause Storage_Error to be raised. @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1bc} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1bd} @subsection Max_Entry_Queue_Length @@ -12160,7 +12175,7 @@ compatibility purposes (and a warning will be generated for its use if warnings on obsolescent features are activated). @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1bd} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1be} @subsection Max_Protected_Entries @@ -12171,7 +12186,7 @@ bounds of every entry family of a protected unit shall be static, or shall be defined by a discriminant of a subtype whose corresponding bound is static. @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1be} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1bf} @subsection Max_Select_Alternatives @@ -12180,7 +12195,7 @@ defined by a discriminant of a subtype whose corresponding bound is static. [RM D.7] Specifies the maximum number of alternatives in a selective accept. @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1bf} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1c0} @subsection Max_Storage_At_Blocking @@ -12191,7 +12206,7 @@ Storage_Size that can be retained by a blocked task. A violation of this restriction causes Storage_Error to be raised. @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1c0} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1c1} @subsection Max_Task_Entries @@ -12204,7 +12219,7 @@ defined by a discriminant of a subtype whose corresponding bound is static. @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1c1} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1c2} @subsection Max_Tasks @@ -12217,7 +12232,7 @@ time. Violations of this restriction with values other than zero cause Storage_Error to be raised. @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1c2} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1c3} @subsection No_Abort_Statements @@ -12227,7 +12242,7 @@ Storage_Error to be raised. no calls to Task_Identification.Abort_Task. @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1c3} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1c4} @subsection No_Access_Parameter_Allocators @@ -12238,7 +12253,7 @@ occurrences of an allocator as the actual parameter to an access parameter. @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1c4} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1c5} @subsection No_Access_Subprograms @@ -12248,7 +12263,7 @@ parameter. declarations of access-to-subprogram types. @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1c5} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1c6} @subsection No_Allocators @@ -12258,7 +12273,7 @@ declarations of access-to-subprogram types. occurrences of an allocator. @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1c6} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1c7} @subsection No_Anonymous_Allocators @@ -12268,7 +12283,7 @@ occurrences of an allocator. occurrences of an allocator of anonymous access type. @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1c7} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1c8} @subsection No_Asynchronous_Control @@ -12278,7 +12293,7 @@ occurrences of an allocator of anonymous access type. dependences on the predefined package Asynchronous_Task_Control. @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1c8} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1c9} @subsection No_Calendar @@ -12288,7 +12303,7 @@ dependences on the predefined package Asynchronous_Task_Control. dependences on package Calendar. @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1c9} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1ca} @subsection No_Coextensions @@ -12298,7 +12313,7 @@ dependences on package Calendar. coextensions. See 3.10.2. @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1ca} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1cb} @subsection No_Default_Initialization @@ -12315,7 +12330,7 @@ is to prohibit all cases of variables declared without a specific initializer (including the case of OUT scalar parameters). @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1cb} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1cc} @subsection No_Delay @@ -12325,7 +12340,7 @@ initializer (including the case of OUT scalar parameters). delay statements and no semantic dependences on package Calendar. @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1cc} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1cd} @subsection No_Dependence @@ -12368,7 +12383,7 @@ to support specific constructs of the language. Here are some examples: @end itemize @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1cd} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1ce} @subsection No_Direct_Boolean_Operators @@ -12381,7 +12396,7 @@ protocol requires the use of short-circuit (and then, or else) forms for all composite boolean operations. @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1ce} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1cf} @subsection No_Dispatch @@ -12391,7 +12406,7 @@ composite boolean operations. occurrences of @code{T'Class}, for any (tagged) subtype @code{T}. @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1cf} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1d0} @subsection No_Dispatching_Calls @@ -12452,7 +12467,7 @@ end Example; @end example @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1d0} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1d1} @subsection No_Dynamic_Attachment @@ -12471,7 +12486,7 @@ compatibility purposes (and a warning will be generated for its use if warnings on obsolescent features are activated). @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1d1} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1d2} @subsection No_Dynamic_Priorities @@ -12480,7 +12495,7 @@ warnings on obsolescent features are activated). [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities. @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1d2} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1d3} @subsection No_Entry_Calls_In_Elaboration_Code @@ -12492,7 +12507,7 @@ restriction, the compiler can assume that no code past an accept statement in a task can be executed at elaboration time. @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1d3} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1d4} @subsection No_Enumeration_Maps @@ -12503,7 +12518,7 @@ enumeration maps are used (that is Image and Value attributes applied to enumeration types). @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1d4} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1d5} @subsection No_Exception_Handlers @@ -12528,7 +12543,7 @@ statement generated by the compiler). The Line parameter when nonzero represents the line number in the source program where the raise occurs. @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1d5} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1d6} @subsection No_Exception_Propagation @@ -12545,7 +12560,7 @@ the package GNAT.Current_Exception is not permitted, and reraise statements (raise with no operand) are not permitted. @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1d6} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1d7} @subsection No_Exception_Registration @@ -12559,7 +12574,7 @@ code is simplified by omitting the otherwise-required global registration of exceptions when they are declared. @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1d7} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1d8} @subsection No_Exceptions @@ -12570,7 +12585,7 @@ raise statements and no exception handlers and also suppresses the generation of language-defined run-time checks. @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1d8} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1d9} @subsection No_Finalization @@ -12611,7 +12626,7 @@ object or a nested component, either declared on the stack or on the heap. The deallocation of a controlled object no longer finalizes its contents. @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1d9} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1da} @subsection No_Fixed_Point @@ -12621,7 +12636,7 @@ deallocation of a controlled object no longer finalizes its contents. occurrences of fixed point types and operations. @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1da} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1db} @subsection No_Floating_Point @@ -12631,7 +12646,7 @@ occurrences of fixed point types and operations. occurrences of floating point types and operations. @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1db} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1dc} @subsection No_Implicit_Conditionals @@ -12647,7 +12662,7 @@ normal manner. Constructs generating implicit conditionals include comparisons of composite objects and the Max/Min attributes. @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1dc} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1dd} @subsection No_Implicit_Dynamic_Code @@ -12677,7 +12692,7 @@ foreign-language convention; primitive operations of nested tagged types. @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1dd} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1de} @subsection No_Implicit_Heap_Allocations @@ -12686,7 +12701,7 @@ types. [RM D.7] No constructs are allowed to cause implicit heap allocation. @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1de} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1df} @subsection No_Implicit_Protected_Object_Allocations @@ -12696,7 +12711,7 @@ types. protected object. @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1df} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1e0} @subsection No_Implicit_Task_Allocations @@ -12705,7 +12720,7 @@ protected object. [GNAT] No constructs are allowed to cause implicit heap allocation of a task. @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1e0} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1e1} @subsection No_Initialize_Scalars @@ -12717,7 +12732,7 @@ code, and in particular eliminates dummy null initialization routines that are otherwise generated for some record and array types. @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1e1} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1e2} @subsection No_IO @@ -12728,7 +12743,7 @@ dependences on any of the library units Sequential_IO, Direct_IO, Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO. @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1e2} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1e3} @subsection No_Local_Allocators @@ -12739,7 +12754,7 @@ occurrences of an allocator in subprograms, generic subprograms, tasks, and entry bodies. @node No_Local_Protected_Objects,No_Local_Tagged_Types,No_Local_Allocators,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1e3} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1e4} @subsection No_Local_Protected_Objects @@ -12749,7 +12764,7 @@ and entry bodies. only declared at the library level. @node No_Local_Tagged_Types,No_Local_Timing_Events,No_Local_Protected_Objects,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-tagged-types}@anchor{1e4} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-tagged-types}@anchor{1e5} @subsection No_Local_Tagged_Types @@ -12759,7 +12774,7 @@ only declared at the library level. declared at the library level. @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Tagged_Types,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1e5} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1e6} @subsection No_Local_Timing_Events @@ -12769,7 +12784,7 @@ declared at the library level. declared at the library level. @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1e6} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1e7} @subsection No_Long_Long_Integers @@ -12781,7 +12796,7 @@ implicit base type is Long_Long_Integer, and modular types whose size exceeds Long_Integer’Size. @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1e7} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1e8} @subsection No_Multiple_Elaboration @@ -12797,7 +12812,7 @@ possible, including non-Ada main programs and Stand Alone libraries, are not permitted and will be diagnosed by the binder. @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1e8} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1e9} @subsection No_Nested_Finalization @@ -12806,7 +12821,7 @@ permitted and will be diagnosed by the binder. [RM D.7] All objects requiring finalization are declared at the library level. @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1e9} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1ea} @subsection No_Protected_Type_Allocators @@ -12816,7 +12831,7 @@ permitted and will be diagnosed by the binder. expressions that attempt to allocate protected objects. @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1ea} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1eb} @subsection No_Protected_Types @@ -12826,7 +12841,7 @@ expressions that attempt to allocate protected objects. declarations of protected types or protected objects. @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1eb} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1ec} @subsection No_Recursion @@ -12836,7 +12851,7 @@ declarations of protected types or protected objects. part of its execution. @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1ec} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1ed} @subsection No_Reentrancy @@ -12846,7 +12861,7 @@ part of its execution. two tasks at the same time. @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1ed} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1ee} @subsection No_Relative_Delay @@ -12857,7 +12872,7 @@ relative statements and prevents expressions such as @code{delay 1.23;} from appearing in source code. @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1ee} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1ef} @subsection No_Requeue_Statements @@ -12875,7 +12890,7 @@ compatibility purposes (and a warning will be generated for its use if warnings on oNobsolescent features are activated). @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1ef} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1f0} @subsection No_Secondary_Stack @@ -12888,7 +12903,7 @@ stack is used to implement functions returning unconstrained objects secondary stacks for tasks (excluding the environment task) at run time. @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1f0} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1f1} @subsection No_Select_Statements @@ -12898,7 +12913,7 @@ secondary stacks for tasks (excluding the environment task) at run time. kind are permitted, that is the keyword @code{select} may not appear. @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1f1} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1f2} @subsection No_Specific_Termination_Handlers @@ -12908,7 +12923,7 @@ kind are permitted, that is the keyword @code{select} may not appear. or to Ada.Task_Termination.Specific_Handler. @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1f2} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1f3} @subsection No_Specification_of_Aspect @@ -12919,7 +12934,7 @@ specification, attribute definition clause, or pragma is given for a given aspect. @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1f3} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1f4} @subsection No_Standard_Allocators_After_Elaboration @@ -12931,7 +12946,7 @@ library items of the partition has completed. Otherwise, Storage_Error is raised. @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1f4} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1f5} @subsection No_Standard_Storage_Pools @@ -12943,7 +12958,7 @@ have an explicit Storage_Pool attribute defined specifying a user-defined storage pool. @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1f5} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1f6} @subsection No_Stream_Optimizations @@ -12956,7 +12971,7 @@ due to their superior performance. When this restriction is in effect, the compiler performs all IO operations on a per-character basis. @node No_Streams,No_Tagged_Type_Registration,No_Stream_Optimizations,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1f6} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1f7} @subsection No_Streams @@ -12977,7 +12992,7 @@ unit declaring a tagged type should be compiled with the restriction, though this is not required. @node No_Tagged_Type_Registration,No_Task_Allocators,No_Streams,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tagged-type-registration}@anchor{1f7} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tagged-type-registration}@anchor{1f8} @subsection No_Tagged_Type_Registration @@ -12992,7 +13007,7 @@ are declared. This restriction may be necessary in order to also apply the No_Elaboration_Code restriction. @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Tagged_Type_Registration,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1f8} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1f9} @subsection No_Task_Allocators @@ -13002,7 +13017,7 @@ the No_Elaboration_Code restriction. or types containing task subcomponents. @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1f9} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1fa} @subsection No_Task_At_Interrupt_Priority @@ -13014,7 +13029,7 @@ a consequence, the tasks are always created with a priority below that an interrupt priority. @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1fa} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1fb} @subsection No_Task_Attributes_Package @@ -13031,7 +13046,7 @@ compatibility purposes (and a warning will be generated for its use if warnings on obsolescent features are activated). @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1fb} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1fc} @subsection No_Task_Hierarchy @@ -13041,7 +13056,7 @@ warnings on obsolescent features are activated). directly on the environment task of the partition. @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1fc} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1fd} @subsection No_Task_Termination @@ -13050,7 +13065,7 @@ directly on the environment task of the partition. [RM D.7] Tasks that terminate are erroneous. @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1fd} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1fe} @subsection No_Tasking @@ -13063,7 +13078,7 @@ and cause an error message to be output either by the compiler or binder. @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1fe} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1ff} @subsection No_Terminate_Alternatives @@ -13072,7 +13087,7 @@ binder. [RM D.7] There are no selective accepts with terminate alternatives. @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1ff} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{200} @subsection No_Unchecked_Access @@ -13082,7 +13097,7 @@ binder. occurrences of the Unchecked_Access attribute. @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{200} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{201} @subsection No_Unchecked_Conversion @@ -13092,7 +13107,7 @@ occurrences of the Unchecked_Access attribute. dependences on the predefined generic function Unchecked_Conversion. @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{201} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{202} @subsection No_Unchecked_Deallocation @@ -13102,7 +13117,7 @@ dependences on the predefined generic function Unchecked_Conversion. dependences on the predefined generic procedure Unchecked_Deallocation. @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{202} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{203} @subsection No_Use_Of_Entity @@ -13122,7 +13137,7 @@ No_Use_Of_Entity => Ada.Text_IO.Put_Line @end example @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{203} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{204} @subsection Pure_Barriers @@ -13173,7 +13188,7 @@ but still ensures absence of side effects, exceptions, and recursion during the evaluation of the barriers. @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{204} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{205} @subsection Simple_Barriers @@ -13192,7 +13207,7 @@ compatibility purposes (and a warning will be generated for its use if warnings on obsolescent features are activated). @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{205} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{206} @subsection Static_Priorities @@ -13203,7 +13218,7 @@ are static, and that there are no dependences on the package @code{Ada.Dynamic_Priorities}. @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{206} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{207} @subsection Static_Storage_Size @@ -13213,7 +13228,7 @@ are static, and that there are no dependences on the package in a Storage_Size pragma or attribute definition clause is static. @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{207}@anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{208} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{208}@anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{209} @section Program Unit Level Restrictions @@ -13244,7 +13259,7 @@ other compilation units in the partition. @end menu @node No_Elaboration_Code,No_Dynamic_Accessibility_Checks,,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{209} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{20a} @subsection No_Elaboration_Code @@ -13300,7 +13315,7 @@ associated with the unit. This counter is typically used to check for access before elaboration and to control multiple elaboration attempts. @node No_Dynamic_Accessibility_Checks,No_Dynamic_Sized_Objects,No_Elaboration_Code,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-accessibility-checks}@anchor{20a} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-accessibility-checks}@anchor{20b} @subsection No_Dynamic_Accessibility_Checks @@ -13349,7 +13364,7 @@ In all other cases, the level of T is as defined by the existing rules of Ada. @end itemize @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Dynamic_Accessibility_Checks,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{20b} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{20c} @subsection No_Dynamic_Sized_Objects @@ -13367,7 +13382,7 @@ access discriminants. It is often a good idea to combine this restriction with No_Secondary_Stack. @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{20c} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{20d} @subsection No_Entry_Queue @@ -13380,7 +13395,7 @@ checked at compile time. A program execution is erroneous if an attempt is made to queue a second task on such an entry. @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{20d} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{20e} @subsection No_Implementation_Aspect_Specifications @@ -13391,7 +13406,7 @@ GNAT-defined aspects are present. With this restriction, the only aspects that can be used are those defined in the Ada Reference Manual. @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{20e} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{20f} @subsection No_Implementation_Attributes @@ -13403,7 +13418,7 @@ attributes that can be used are those defined in the Ada Reference Manual. @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{20f} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{210} @subsection No_Implementation_Identifiers @@ -13414,7 +13429,7 @@ implementation-defined identifiers (marked with pragma Implementation_Defined) occur within language-defined packages. @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{210} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{211} @subsection No_Implementation_Pragmas @@ -13425,7 +13440,7 @@ GNAT-defined pragmas are present. With this restriction, the only pragmas that can be used are those defined in the Ada Reference Manual. @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{211} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{212} @subsection No_Implementation_Restrictions @@ -13437,7 +13452,7 @@ are present. With this restriction, the only other restriction identifiers that can be used are those defined in the Ada Reference Manual. @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{212} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{213} @subsection No_Implementation_Units @@ -13448,7 +13463,7 @@ mention in the context clause of any implementation-defined descendants of packages Ada, Interfaces, or System. @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{213} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{214} @subsection No_Implicit_Aliasing @@ -13463,7 +13478,7 @@ to be aliased, and in such cases, it can always be replaced by the standard attribute Unchecked_Access which is preferable. @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{214} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{215} @subsection No_Implicit_Loops @@ -13480,7 +13495,7 @@ arrays larger than about 5000 scalar components. Note that if this restriction is set in the spec of a package, it will not apply to its body. @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{215} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{216} @subsection No_Obsolescent_Features @@ -13490,7 +13505,7 @@ is set in the spec of a package, it will not apply to its body. features are used, as defined in Annex J of the Ada Reference Manual. @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{216} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{217} @subsection No_Wide_Characters @@ -13504,7 +13519,7 @@ appear in the program (that is literals representing characters not in type @code{Character}). @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{217} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{218} @subsection Static_Dispatch_Tables @@ -13514,7 +13529,7 @@ type @code{Character}). associated with dispatch tables can be placed in read-only memory. @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions -@anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{218} +@anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{219} @subsection SPARK_05 @@ -13537,7 +13552,7 @@ gnatprove -P project.gpr --mode=check_all @end example @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top -@anchor{gnat_rm/implementation_advice doc}@anchor{219}@anchor{gnat_rm/implementation_advice id1}@anchor{21a}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a} +@anchor{gnat_rm/implementation_advice doc}@anchor{21a}@anchor{gnat_rm/implementation_advice id1}@anchor{21b}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a} @chapter Implementation Advice @@ -13635,7 +13650,7 @@ case the text describes what GNAT does and why. @end menu @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{21b} +@anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{21c} @section RM 1.1.3(20): Error Detection @@ -13652,7 +13667,7 @@ or diagnosed at compile time. @geindex Child Units @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{21c} +@anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{21d} @section RM 1.1.3(31): Child Units @@ -13668,7 +13683,7 @@ Followed. @geindex Bounded errors @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{21d} +@anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{21e} @section RM 1.1.5(12): Bounded Errors @@ -13685,7 +13700,7 @@ runtime. @geindex Pragmas @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice -@anchor{gnat_rm/implementation_advice id2}@anchor{21e}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{21f} +@anchor{gnat_rm/implementation_advice id2}@anchor{21f}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{220} @section RM 2.8(16): Pragmas @@ -13798,7 +13813,7 @@ that this advice not be followed. For details see @ref{7,,Implementation Defined Pragmas}. @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{220} +@anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{221} @section RM 2.8(17-19): Pragmas @@ -13819,14 +13834,14 @@ replacing @code{library_items}.” @end itemize @end quotation -See @ref{21f,,RM 2.8(16); Pragmas}. +See @ref{220,,RM 2.8(16); Pragmas}. @geindex Character Sets @geindex Alternative Character Sets @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{221} +@anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{222} @section RM 3.5.2(5): Alternative Character Sets @@ -13854,7 +13869,7 @@ there is no such restriction. @geindex Integer types @node RM 3 5 4 28 Integer Types,RM 3 5 4 29 Integer Types,RM 3 5 2 5 Alternative Character Sets,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{222} +@anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{223} @section RM 3.5.4(28): Integer Types @@ -13873,7 +13888,7 @@ are supported for convenient interface to C, and so that all hardware types of the machine are easily available. @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{223} +@anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{224} @section RM 3.5.4(29): Integer Types @@ -13889,7 +13904,7 @@ Followed. @geindex Enumeration values @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{224} +@anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{225} @section RM 3.5.5(8): Enumeration Values @@ -13909,7 +13924,7 @@ Followed. @geindex Float types @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{225} +@anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{226} @section RM 3.5.7(17): Float Types @@ -13939,7 +13954,7 @@ is a software rather than a hardware format. @geindex multidimensional @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration’Small,RM 3 5 7 17 Float Types,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{226} +@anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{227} @section RM 3.6.2(11): Multidimensional Arrays @@ -13957,7 +13972,7 @@ Followed. @geindex Duration'Small @node RM 9 6 30-31 Duration’Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{227} +@anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{228} @section RM 9.6(30-31): Duration’Small @@ -13978,7 +13993,7 @@ it need not be the same time base as used for @code{Calendar.Clock}.” Followed. @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration’Small,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{228} +@anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{229} @section RM 10.2.1(12): Consistent Representation @@ -14000,7 +14015,7 @@ advice without severely impacting efficiency of execution. @geindex Exception information @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{229} +@anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{22a} @section RM 11.4.1(19): Exception Information @@ -14031,7 +14046,7 @@ Pragma @code{Discard_Names}. @geindex suppression of @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{22a} +@anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{22b} @section RM 11.5(28): Suppression of Checks @@ -14046,7 +14061,7 @@ Followed. @geindex Representation clauses @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{22b} +@anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{22c} @section RM 13.1 (21-24): Representation Clauses @@ -14095,7 +14110,7 @@ Followed. @geindex Packed types @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{22c} +@anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{22d} @section RM 13.2(6-8): Packed Types @@ -14126,7 +14141,7 @@ subcomponent of the packed type. @geindex Address clauses @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{22d} +@anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{22e} @section RM 13.3(14-19): Address Clauses @@ -14179,7 +14194,7 @@ Followed. @geindex Alignment clauses @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{22e} +@anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{22f} @section RM 13.3(29-35): Alignment Clauses @@ -14236,7 +14251,7 @@ Followed. @geindex Size clauses @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{22f} +@anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{230} @section RM 13.3(42-43): Size Clauses @@ -14254,7 +14269,7 @@ object’s @code{Alignment} (if the @code{Alignment} is nonzero).” Followed. @node RM 13 3 50-56 Size Clauses,RM 13 3 71-73 Component Size Clauses,RM 13 3 42-43 Size Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{230} +@anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{231} @section RM 13.3(50-56): Size Clauses @@ -14305,7 +14320,7 @@ Followed. @geindex Component_Size clauses @node RM 13 3 71-73 Component Size Clauses,RM 13 4 9-10 Enumeration Representation Clauses,RM 13 3 50-56 Size Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{231} +@anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{232} @section RM 13.3(71-73): Component Size Clauses @@ -14339,7 +14354,7 @@ Followed. @geindex enumeration @node RM 13 4 9-10 Enumeration Representation Clauses,RM 13 5 1 17-22 Record Representation Clauses,RM 13 3 71-73 Component Size Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{232} +@anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{233} @section RM 13.4(9-10): Enumeration Representation Clauses @@ -14361,7 +14376,7 @@ Followed. @geindex records @node RM 13 5 1 17-22 Record Representation Clauses,RM 13 5 2 5 Storage Place Attributes,RM 13 4 9-10 Enumeration Representation Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{233} +@anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{234} @section RM 13.5.1(17-22): Record Representation Clauses @@ -14421,7 +14436,7 @@ and all mentioned features are implemented. @geindex Storage place attributes @node RM 13 5 2 5 Storage Place Attributes,RM 13 5 3 7-8 Bit Ordering,RM 13 5 1 17-22 Record Representation Clauses,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{234} +@anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{235} @section RM 13.5.2(5): Storage Place Attributes @@ -14441,7 +14456,7 @@ Followed. There are no such components in GNAT. @geindex Bit ordering @node RM 13 5 3 7-8 Bit Ordering,RM 13 7 37 Address as Private,RM 13 5 2 5 Storage Place Attributes,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{235} +@anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{236} @section RM 13.5.3(7-8): Bit Ordering @@ -14461,7 +14476,7 @@ Thus non-default bit ordering is not supported. @geindex as private type @node RM 13 7 37 Address as Private,RM 13 7 1 16 Address Operations,RM 13 5 3 7-8 Bit Ordering,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{236} +@anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{237} @section RM 13.7(37): Address as Private @@ -14479,7 +14494,7 @@ Followed. @geindex operations of @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{237} +@anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{238} @section RM 13.7.1(16): Address Operations @@ -14497,7 +14512,7 @@ operation raises @code{Program_Error}, since all operations make sense. @geindex Unchecked conversion @node RM 13 9 14-17 Unchecked Conversion,RM 13 11 23-25 Implicit Heap Usage,RM 13 7 1 16 Address Operations,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{238} +@anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{239} @section RM 13.9(14-17): Unchecked Conversion @@ -14541,7 +14556,7 @@ Followed. @geindex implicit @node RM 13 11 23-25 Implicit Heap Usage,RM 13 11 2 17 Unchecked Deallocation,RM 13 9 14-17 Unchecked Conversion,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{239} +@anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{23a} @section RM 13.11(23-25): Implicit Heap Usage @@ -14592,7 +14607,7 @@ Followed. @geindex Unchecked deallocation @node RM 13 11 2 17 Unchecked Deallocation,RM 13 13 2 1 6 Stream Oriented Attributes,RM 13 11 23-25 Implicit Heap Usage,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{23a} +@anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{23b} @section RM 13.11.2(17): Unchecked Deallocation @@ -14607,7 +14622,7 @@ Followed. @geindex Stream oriented attributes @node RM 13 13 2 1 6 Stream Oriented Attributes,RM A 1 52 Names of Predefined Numeric Types,RM 13 11 2 17 Unchecked Deallocation,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-13-13-2-1-6-stream-oriented-attributes}@anchor{23b} +@anchor{gnat_rm/implementation_advice rm-13-13-2-1-6-stream-oriented-attributes}@anchor{23c} @section RM 13.13.2(1.6): Stream Oriented Attributes @@ -14638,7 +14653,7 @@ scalar types. This XDR alternative can be enabled via the binder switch -xdr. @geindex Stream oriented attributes @node RM A 1 52 Names of Predefined Numeric Types,RM A 3 2 49 Ada Characters Handling,RM 13 13 2 1 6 Stream Oriented Attributes,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{23c} +@anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{23d} @section RM A.1(52): Names of Predefined Numeric Types @@ -14656,7 +14671,7 @@ Followed. @geindex Ada.Characters.Handling @node RM A 3 2 49 Ada Characters Handling,RM A 4 4 106 Bounded-Length String Handling,RM A 1 52 Names of Predefined Numeric Types,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{23d} +@anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{23e} @section RM A.3.2(49): @code{Ada.Characters.Handling} @@ -14673,7 +14688,7 @@ Followed. GNAT provides no such localized definitions. @geindex Bounded-length strings @node RM A 4 4 106 Bounded-Length String Handling,RM A 5 2 46-47 Random Number Generation,RM A 3 2 49 Ada Characters Handling,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{23e} +@anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{23f} @section RM A.4.4(106): Bounded-Length String Handling @@ -14688,7 +14703,7 @@ Followed. No implicit pointers or dynamic allocation are used. @geindex Random number generation @node RM A 5 2 46-47 Random Number Generation,RM A 10 7 23 Get_Immediate,RM A 4 4 106 Bounded-Length String Handling,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{23f} +@anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{240} @section RM A.5.2(46-47): Random Number Generation @@ -14717,7 +14732,7 @@ condition here to hold true. @geindex Get_Immediate @node RM A 10 7 23 Get_Immediate,RM A 18 Containers,RM A 5 2 46-47 Random Number Generation,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{240} +@anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{241} @section RM A.10.7(23): @code{Get_Immediate} @@ -14741,7 +14756,7 @@ this functionality. @geindex Containers @node RM A 18 Containers,RM B 1 39-41 Pragma Export,RM A 10 7 23 Get_Immediate,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-a-18-containers}@anchor{241} +@anchor{gnat_rm/implementation_advice rm-a-18-containers}@anchor{242} @section RM A.18: @code{Containers} @@ -14762,7 +14777,7 @@ follow the implementation advice. @geindex Export @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 18 Containers,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{242} +@anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{243} @section RM B.1(39-41): Pragma @code{Export} @@ -14810,7 +14825,7 @@ Followed. @geindex Interfaces @node RM B 2 12-13 Package Interfaces,RM B 3 63-71 Interfacing with C,RM B 1 39-41 Pragma Export,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{243} +@anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{244} @section RM B.2(12-13): Package @code{Interfaces} @@ -14840,7 +14855,7 @@ Followed. GNAT provides all the packages described in this section. @geindex interfacing with @node RM B 3 63-71 Interfacing with C,RM B 4 95-98 Interfacing with COBOL,RM B 2 12-13 Package Interfaces,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{244} +@anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{245} @section RM B.3(63-71): Interfacing with C @@ -14928,7 +14943,7 @@ Followed. @geindex interfacing with @node RM B 4 95-98 Interfacing with COBOL,RM B 5 22-26 Interfacing with Fortran,RM B 3 63-71 Interfacing with C,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{245} +@anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{246} @section RM B.4(95-98): Interfacing with COBOL @@ -14969,7 +14984,7 @@ Followed. @geindex interfacing with @node RM B 5 22-26 Interfacing with Fortran,RM C 1 3-5 Access to Machine Operations,RM B 4 95-98 Interfacing with COBOL,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{246} +@anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{247} @section RM B.5(22-26): Interfacing with Fortran @@ -15020,7 +15035,7 @@ Followed. @geindex Machine operations @node RM C 1 3-5 Access to Machine Operations,RM C 1 10-16 Access to Machine Operations,RM B 5 22-26 Interfacing with Fortran,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{247} +@anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{248} @section RM C.1(3-5): Access to Machine Operations @@ -15055,7 +15070,7 @@ object that is specified as exported.” Followed. @node RM C 1 10-16 Access to Machine Operations,RM C 3 28 Interrupt Support,RM C 1 3-5 Access to Machine Operations,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{248} +@anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{249} @section RM C.1(10-16): Access to Machine Operations @@ -15116,7 +15131,7 @@ Followed on any target supporting such operations. @geindex Interrupt support @node RM C 3 28 Interrupt Support,RM C 3 1 20-21 Protected Procedure Handlers,RM C 1 10-16 Access to Machine Operations,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{249} +@anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{24a} @section RM C.3(28): Interrupt Support @@ -15134,7 +15149,7 @@ of interrupt blocking. @geindex Protected procedure handlers @node RM C 3 1 20-21 Protected Procedure Handlers,RM C 3 2 25 Package Interrupts,RM C 3 28 Interrupt Support,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{24a} +@anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{24b} @section RM C.3.1(20-21): Protected Procedure Handlers @@ -15160,7 +15175,7 @@ Followed. Compile time warnings are given when possible. @geindex Interrupts @node RM C 3 2 25 Package Interrupts,RM C 4 14 Pre-elaboration Requirements,RM C 3 1 20-21 Protected Procedure Handlers,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{24b} +@anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{24c} @section RM C.3.2(25): Package @code{Interrupts} @@ -15178,7 +15193,7 @@ Followed. @geindex Pre-elaboration requirements @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{24c} +@anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{24d} @section RM C.4(14): Pre-elaboration Requirements @@ -15194,7 +15209,7 @@ Followed. Executable code is generated in some cases, e.g., loops to initialize large arrays. @node RM C 5 8 Pragma Discard_Names,RM C 7 2 30 The Package Task_Attributes,RM C 4 14 Pre-elaboration Requirements,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{24d} +@anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{24e} @section RM C.5(8): Pragma @code{Discard_Names} @@ -15212,7 +15227,7 @@ Followed. @geindex Task_Attributes @node RM C 7 2 30 The Package Task_Attributes,RM D 3 17 Locking Policies,RM C 5 8 Pragma Discard_Names,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{24e} +@anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{24f} @section RM C.7.2(30): The Package Task_Attributes @@ -15233,7 +15248,7 @@ Not followed. This implementation is not targeted to such a domain. @geindex Locking Policies @node RM D 3 17 Locking Policies,RM D 4 16 Entry Queuing Policies,RM C 7 2 30 The Package Task_Attributes,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{24f} +@anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{250} @section RM D.3(17): Locking Policies @@ -15250,7 +15265,7 @@ whose names (@code{Inheritance_Locking} and @geindex Entry queuing policies @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{250} +@anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{251} @section RM D.4(16): Entry Queuing Policies @@ -15265,7 +15280,7 @@ Followed. No such implementation-defined queuing policies exist. @geindex Preemptive abort @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{251} +@anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{252} @section RM D.6(9-10): Preemptive Abort @@ -15291,7 +15306,7 @@ Followed. @geindex Tasking restrictions @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{252} +@anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{253} @section RM D.7(21): Tasking Restrictions @@ -15310,7 +15325,7 @@ pragma @code{Profile (Restricted)} for more details. @geindex monotonic @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{253} +@anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{254} @section RM D.8(47-49): Monotonic Time @@ -15345,7 +15360,7 @@ Followed. @geindex PCS @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{254} +@anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{255} @section RM E.5(28-29): Partition Communication Subsystem @@ -15373,7 +15388,7 @@ GNAT. @geindex COBOL support @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{255} +@anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{256} @section RM F(7): COBOL Support @@ -15393,7 +15408,7 @@ Followed. @geindex Decimal radix support @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{256} +@anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{257} @section RM F.1(2): Decimal Radix Support @@ -15409,7 +15424,7 @@ representations. @geindex Numerics @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{257} +@anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{258} @section RM G: Numerics @@ -15429,7 +15444,7 @@ Followed. @geindex Complex types @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{258} +@anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{259} @section RM G.1.1(56-58): Complex Types @@ -15491,7 +15506,7 @@ Followed. @geindex Complex elementary functions @node RM G 1 2 49 Complex Elementary Functions,RM G 2 4 19 Accuracy Requirements,RM G 1 1 56-58 Complex Types,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{259} +@anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{25a} @section RM G.1.2(49): Complex Elementary Functions @@ -15513,7 +15528,7 @@ Followed. @geindex Accuracy requirements @node RM G 2 4 19 Accuracy Requirements,RM G 2 6 15 Complex Arithmetic Accuracy,RM G 1 2 49 Complex Elementary Functions,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{25a} +@anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{25b} @section RM G.2.4(19): Accuracy Requirements @@ -15537,7 +15552,7 @@ Followed. @geindex complex arithmetic @node RM G 2 6 15 Complex Arithmetic Accuracy,RM H 6 15/2 Pragma Partition_Elaboration_Policy,RM G 2 4 19 Accuracy Requirements,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{25b} +@anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{25c} @section RM G.2.6(15): Complex Arithmetic Accuracy @@ -15555,7 +15570,7 @@ Followed. @geindex Sequential elaboration policy @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice -@anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{25c} +@anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{25d} @section RM H.6(15/2): Pragma Partition_Elaboration_Policy @@ -15570,7 +15585,7 @@ immediately terminated.” Not followed. @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top -@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{25d}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{25e}@anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b} +@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{25e}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{25f}@anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b} @chapter Implementation Defined Characteristics @@ -16865,7 +16880,7 @@ When the @code{Pattern} parameter is not the null string, it is interpreted according to the syntax of regular expressions as defined in the @code{GNAT.Regexp} package. -See @ref{25f,,GNAT.Regexp (g-regexp.ads)}. +See @ref{260,,GNAT.Regexp (g-regexp.ads)}. @itemize * @@ -17963,7 +17978,7 @@ Information on those subjects is not yet available. Execution is erroneous in that case. @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top -@anchor{gnat_rm/intrinsic_subprograms doc}@anchor{260}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{261}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c} +@anchor{gnat_rm/intrinsic_subprograms doc}@anchor{261}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{262}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c} @chapter Intrinsic Subprograms @@ -18001,7 +18016,7 @@ Ada standard does not require Ada compilers to implement this feature. @end menu @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms id2}@anchor{262}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{263} +@anchor{gnat_rm/intrinsic_subprograms id2}@anchor{263}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{264} @section Intrinsic Operators @@ -18032,7 +18047,7 @@ It is also possible to specify such operators for private types, if the full views are appropriate arithmetic types. @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{264}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{265} +@anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{265}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{266} @section Compilation_ISO_Date @@ -18046,7 +18061,7 @@ application program should simply call the function the current compilation (in local time format YYYY-MM-DD). @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{266}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{267} +@anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{267}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{268} @section Compilation_Date @@ -18056,7 +18071,7 @@ Same as Compilation_ISO_Date, except the string is in the form MMM DD YYYY. @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{268}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{269} +@anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{269}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{26a} @section Compilation_Time @@ -18070,7 +18085,7 @@ application program should simply call the function the current compilation (in local time format HH:MM:SS). @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{26a}@anchor{gnat_rm/intrinsic_subprograms id6}@anchor{26b} +@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{26b}@anchor{gnat_rm/intrinsic_subprograms id6}@anchor{26c} @section Enclosing_Entity @@ -18084,7 +18099,7 @@ application program should simply call the function the current subprogram, package, task, entry, or protected subprogram. @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{26c}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{26d} +@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{26d}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{26e} @section Exception_Information @@ -18098,7 +18113,7 @@ so an application program should simply call the function the exception information associated with the current exception. @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{26e}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{26f} +@anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{26f}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{270} @section Exception_Message @@ -18112,7 +18127,7 @@ so an application program should simply call the function the message associated with the current exception. @node Exception_Name,File,Exception_Message,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{270}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{271} +@anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{271}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{272} @section Exception_Name @@ -18126,7 +18141,7 @@ so an application program should simply call the function the name of the current exception. @node File,Line,Exception_Name,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms file}@anchor{272}@anchor{gnat_rm/intrinsic_subprograms id10}@anchor{273} +@anchor{gnat_rm/intrinsic_subprograms file}@anchor{273}@anchor{gnat_rm/intrinsic_subprograms id10}@anchor{274} @section File @@ -18140,7 +18155,7 @@ application program should simply call the function file. @node Line,Shifts and Rotates,File,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms id11}@anchor{274}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{275} +@anchor{gnat_rm/intrinsic_subprograms id11}@anchor{275}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{276} @section Line @@ -18154,7 +18169,7 @@ application program should simply call the function source line. @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{276}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{277} +@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{277}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{278} @section Shifts and Rotates @@ -18197,7 +18212,7 @@ corresponding operator for modular type. In particular, shifting a negative number may change its sign bit to positive. @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms -@anchor{gnat_rm/intrinsic_subprograms id13}@anchor{278}@anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{279} +@anchor{gnat_rm/intrinsic_subprograms id13}@anchor{279}@anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{27a} @section Source_Location @@ -18211,7 +18226,7 @@ application program should simply call the function source file location. @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top -@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{27a}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{27b}@anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d} +@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{27b}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d} @chapter Representation Clauses and Pragmas @@ -18257,7 +18272,7 @@ and this section describes the additional capabilities provided. @end menu @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{27d} +@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{27d}@anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{27e} @section Alignment Clauses @@ -18279,7 +18294,7 @@ For elementary types, the alignment is the minimum of the actual size of objects of the type divided by @code{Storage_Unit}, and the maximum alignment supported by the target. (This maximum alignment is given by the GNAT-specific attribute -@code{Standard'Maximum_Alignment}; see @ref{18f,,Attribute Maximum_Alignment}.) +@code{Standard'Maximum_Alignment}; see @ref{190,,Attribute Maximum_Alignment}.) @geindex Maximum_Alignment attribute @@ -18388,7 +18403,7 @@ assumption is non-portable, and other compilers may choose different alignments for the subtype @code{RS}. @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{27f} +@anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{27f}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{280} @section Size Clauses @@ -18465,7 +18480,7 @@ if it is known that a Size value can be accommodated in an object of type Integer. @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{280}@anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{281} +@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{281}@anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{282} @section Storage_Size Clauses @@ -18538,7 +18553,7 @@ Of course in practice, there will not be any explicit allocators in the case of such an access declaration. @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{282}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{283} +@anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{283}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{284} @section Size of Variant Record Objects @@ -18648,7 +18663,7 @@ the maximum size, regardless of the current variant value, the variant value. @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{284}@anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{285} +@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{285}@anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{286} @section Biased Representation @@ -18686,7 +18701,7 @@ biased representation can be used for all discrete types except for enumeration types for which a representation clause is given. @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{286}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{287} +@anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{287}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{288} @section Value_Size and Object_Size Clauses @@ -19002,7 +19017,7 @@ definition clause forces biased representation. This warning can be turned off using @code{-gnatw.B}. @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{288}@anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{289} +@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{289}@anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{28a} @section Component_Size Clauses @@ -19050,7 +19065,7 @@ and a pragma Pack for the same array type. if such duplicate clauses are given, the pragma Pack will be ignored. @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{28a}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{28b} +@anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{28b}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{28c} @section Bit_Order Clauses @@ -19156,7 +19171,7 @@ if desired. The following section contains additional details regarding the issue of byte ordering. @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{28c}@anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{28d} +@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{28d}@anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{28e} @section Effect of Bit_Order on Byte Ordering @@ -19413,7 +19428,7 @@ to set the boolean constant @code{Master_Byte_First} in an appropriate manner. @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{28e}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{28f} +@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{28f}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{290} @section Pragma Pack for Arrays @@ -19533,7 +19548,7 @@ Here 31-bit packing is achieved as required, and no warning is generated, since in this case the programmer intention is clear. @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{290}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{291} +@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{291}@anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{292} @section Pragma Pack for Records @@ -19617,7 +19632,7 @@ array that is longer than 64 bits, so it is itself non-packable on boundary, and takes an integral number of bytes, i.e., 72 bits. @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{292}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{293} +@anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{293}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{294} @section Record Representation Clauses @@ -19696,7 +19711,7 @@ end record; @end example @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{294}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{295} +@anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{295}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{296} @section Handling of Records with Holes @@ -19772,7 +19787,7 @@ for Hrec'Size use 64; @end example @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{296}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{297} +@anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{297}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{298} @section Enumeration Clauses @@ -19815,7 +19830,7 @@ the overhead of converting representation values to the corresponding positional values, (i.e., the value delivered by the @code{Pos} attribute). @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{298}@anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{299} +@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{299}@anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{29a} @section Address Clauses @@ -20155,7 +20170,7 @@ then the program compiles without the warning and when run will generate the output @code{X was not clobbered}. @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{29a}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{29b} +@anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{29b}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{29c} @section Use of Address Clauses for Memory-Mapped I/O @@ -20213,7 +20228,7 @@ provides the pragma @code{Volatile_Full_Access} which can be used in lieu of pragma @code{Atomic} and will give the additional guarantee. @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{29c}@anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{29d} +@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{29d}@anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{29e} @section Effect of Convention on Representation @@ -20291,7 +20306,7 @@ when one of these values is read, any nonzero value is treated as True. @end itemize @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{29e}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{29f} +@anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{29f}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{2a0} @section Conventions and Anonymous Access Types @@ -20367,7 +20382,7 @@ package ConvComp is @end example @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas -@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{2a0}@anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{2a1} +@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{2a1}@anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{2a2} @section Determining the Representations chosen by GNAT @@ -20519,7 +20534,7 @@ generated by the compiler into the original source to fix and guarantee the actual representation to be used. @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top -@anchor{gnat_rm/standard_library_routines doc}@anchor{2a2}@anchor{gnat_rm/standard_library_routines id1}@anchor{2a3}@anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e} +@anchor{gnat_rm/standard_library_routines doc}@anchor{2a3}@anchor{gnat_rm/standard_library_routines id1}@anchor{2a4}@anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e} @chapter Standard Library Routines @@ -21343,7 +21358,7 @@ For packages in Interfaces and System, all the RM defined packages are available in GNAT, see the Ada 2012 RM for full details. @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top -@anchor{gnat_rm/the_implementation_of_standard_i_o doc}@anchor{2a4}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{2a5}@anchor{gnat_rm/the_implementation_of_standard_i_o the-implementation-of-standard-i-o}@anchor{f} +@anchor{gnat_rm/the_implementation_of_standard_i_o doc}@anchor{2a5}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{2a6}@anchor{gnat_rm/the_implementation_of_standard_i_o the-implementation-of-standard-i-o}@anchor{f} @chapter The Implementation of Standard I/O @@ -21395,7 +21410,7 @@ these additional facilities are also described in this chapter. @end menu @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{2a6}@anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{2a7} +@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{2a7}@anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{2a8} @section Standard I/O Packages @@ -21466,7 +21481,7 @@ flush the common I/O streams and in particular Standard_Output before elaborating the Ada code. @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{2a8}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{2a9} +@anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{2a9}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{2aa} @section FORM Strings @@ -21492,7 +21507,7 @@ unrecognized keyword appears in a form string, it is silently ignored and not considered invalid. @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{2aa}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{2ab} +@anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{2ab}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{2ac} @section Direct_IO @@ -21512,7 +21527,7 @@ There is no limit on the size of Direct_IO files, they are expanded as necessary to accommodate whatever records are written to the file. @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{2ac}@anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{2ad} +@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{2ad}@anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{2ae} @section Sequential_IO @@ -21559,7 +21574,7 @@ using Stream_IO, and this is the preferred mechanism. In particular, the above program fragment rewritten to use Stream_IO will work correctly. @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2ae}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2af} +@anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2af}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2b0} @section Text_IO @@ -21642,7 +21657,7 @@ the file. @end menu @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2b0}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2b1} +@anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2b1}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2b2} @subsection Stream Pointer Positioning @@ -21678,7 +21693,7 @@ between two Ada files, then the difference may be observable in some situations. @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2b2}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2b3} +@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2b3}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2b4} @subsection Reading and Writing Non-Regular Files @@ -21729,7 +21744,7 @@ to read data past that end of file indication, until another end of file indication is entered. @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2b4}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2b5} +@anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2b5}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2b6} @subsection Get_Immediate @@ -21747,7 +21762,7 @@ possible), it is undefined whether the FF character will be treated as a page mark. @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2b6}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2b7} +@anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2b7}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2b8} @subsection Treating Text_IO Files as Streams @@ -21763,7 +21778,7 @@ skipped and the effect is similar to that described above for @code{Get_Immediate}. @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2b8}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2b9} +@anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2b9}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2ba} @subsection Text_IO Extensions @@ -21791,7 +21806,7 @@ the string is to be read. @end itemize @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2ba}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2bb} +@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2bb}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2bc} @subsection Text_IO Facilities for Unbounded Strings @@ -21839,7 +21854,7 @@ files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings. @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2bc}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2bd} +@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2bd}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2be} @section Wide_Text_IO @@ -22086,12 +22101,12 @@ input also causes Constraint_Error to be raised. @end menu @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2be}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2bf} +@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2bf}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2c0} @subsection Stream Pointer Positioning @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling -of stream pointer positioning (@ref{2af,,Text_IO}). There is one additional +of stream pointer positioning (@ref{2b0,,Text_IO}). There is one additional case: If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the @@ -22110,7 +22125,7 @@ to a normal program using @code{Wide_Text_IO}. However, this discrepancy can be observed if the wide text file shares a stream with another file. @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2c0}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2c1} +@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2c1}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2c2} @subsection Reading and Writing Non-Regular Files @@ -22121,7 +22136,7 @@ treated as data characters), and @code{End_Of_Page} always returns it is possible to read beyond an end of file. @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2c2}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2c3} +@anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2c3}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2c4} @section Wide_Wide_Text_IO @@ -22290,12 +22305,12 @@ input also causes Constraint_Error to be raised. @end menu @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2c4}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2c5} +@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2c5}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2c6} @subsection Stream Pointer Positioning @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling -of stream pointer positioning (@ref{2af,,Text_IO}). There is one additional +of stream pointer positioning (@ref{2b0,,Text_IO}). There is one additional case: If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the @@ -22314,7 +22329,7 @@ to a normal program using @code{Wide_Wide_Text_IO}. However, this discrepancy can be observed if the wide text file shares a stream with another file. @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO -@anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2c6}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2c7} +@anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2c7}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2c8} @subsection Reading and Writing Non-Regular Files @@ -22325,7 +22340,7 @@ treated as data characters), and @code{End_Of_Page} always returns it is possible to read beyond an end of file. @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2c8}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2c9} +@anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2c9}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2ca} @section Stream_IO @@ -22347,7 +22362,7 @@ manner described for stream attributes. @end itemize @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2ca}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2cb} +@anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2cb}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2cc} @section Text Translation @@ -22381,7 +22396,7 @@ mode. (corresponds to_O_U16TEXT). @end itemize @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2cc}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2cd} +@anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2cd}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2ce} @section Shared Files @@ -22444,7 +22459,7 @@ heterogeneous input-output. Although this approach will work in GNAT if for this purpose (using the stream attributes) @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2ce}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2cf} +@anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2cf}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2d0} @section Filenames encoding @@ -22484,7 +22499,7 @@ platform. On the other Operating Systems the run-time is supporting UTF-8 natively. @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2d0}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2d1} +@anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2d1}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2d2} @section File content encoding @@ -22517,7 +22532,7 @@ Unicode 8-bit encoding This encoding is only supported on the Windows platform. @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2d2}@anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2d3} +@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2d3}@anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2d4} @section Open Modes @@ -22620,7 +22635,7 @@ subsequently requires switching from reading to writing or vice-versa, then the file is reopened in @code{r+} mode to permit the required operation. @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2d4}@anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2d5} +@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2d5}@anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2d6} @section Operations on C Streams @@ -22780,7 +22795,7 @@ end Interfaces.C_Streams; @end example @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O -@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2d6}@anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2d7} +@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2d7}@anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2d8} @section Interfacing to C Streams @@ -22873,7 +22888,7 @@ imported from a C program, allowing an Ada file to operate on an existing C file. @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top -@anchor{gnat_rm/the_gnat_library doc}@anchor{2d8}@anchor{gnat_rm/the_gnat_library id1}@anchor{2d9}@anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10} +@anchor{gnat_rm/the_gnat_library doc}@anchor{2d9}@anchor{gnat_rm/the_gnat_library id1}@anchor{2da}@anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10} @chapter The GNAT Library @@ -23059,7 +23074,7 @@ of GNAT, and will generate a warning message. @end menu @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2da}@anchor{gnat_rm/the_gnat_library id2}@anchor{2db} +@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2db}@anchor{gnat_rm/the_gnat_library id2}@anchor{2dc} @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads}) @@ -23076,7 +23091,7 @@ is specifically authorized by the Ada Reference Manual (RM A.3.3(27)). @node Ada Characters Wide_Latin_1 a-cwila1 ads,Ada Characters Wide_Latin_9 a-cwila9 ads,Ada Characters Latin_9 a-chlat9 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2dc}@anchor{gnat_rm/the_gnat_library id3}@anchor{2dd} +@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2dd}@anchor{gnat_rm/the_gnat_library id3}@anchor{2de} @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads}) @@ -23093,7 +23108,7 @@ is specifically authorized by the Ada Reference Manual (RM A.3.3(27)). @node Ada Characters Wide_Latin_9 a-cwila9 ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila9-ads}@anchor{2de}@anchor{gnat_rm/the_gnat_library id4}@anchor{2df} +@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila9-ads}@anchor{2df}@anchor{gnat_rm/the_gnat_library id4}@anchor{2e0} @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila9.ads}) @@ -23110,7 +23125,7 @@ is specifically authorized by the Ada Reference Manual (RM A.3.3(27)). @node Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,Ada Characters Wide_Latin_9 a-cwila9 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2e0}@anchor{gnat_rm/the_gnat_library id5}@anchor{2e1} +@anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2e1}@anchor{gnat_rm/the_gnat_library id5}@anchor{2e2} @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads}) @@ -23127,7 +23142,7 @@ is specifically authorized by the Ada Reference Manual (RM A.3.3(27)). @node Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,Ada Containers Bounded_Holders a-coboho ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2e2}@anchor{gnat_rm/the_gnat_library id6}@anchor{2e3} +@anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2e3}@anchor{gnat_rm/the_gnat_library id6}@anchor{2e4} @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads}) @@ -23144,7 +23159,7 @@ is specifically authorized by the Ada Reference Manual (RM A.3.3(27)). @node Ada Containers Bounded_Holders a-coboho ads,Ada Command_Line Environment a-colien ads,Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2e4}@anchor{gnat_rm/the_gnat_library id7}@anchor{2e5} +@anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2e5}@anchor{gnat_rm/the_gnat_library id7}@anchor{2e6} @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads}) @@ -23156,7 +23171,7 @@ This child of @code{Ada.Containers} defines a modified version of Indefinite_Holders that avoids heap allocation. @node Ada Command_Line Environment a-colien ads,Ada Command_Line Remove a-colire ads,Ada Containers Bounded_Holders a-coboho ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2e6}@anchor{gnat_rm/the_gnat_library id8}@anchor{2e7} +@anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2e7}@anchor{gnat_rm/the_gnat_library id8}@anchor{2e8} @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads}) @@ -23169,7 +23184,7 @@ provides a mechanism for obtaining environment values on systems where this concept makes sense. @node Ada Command_Line Remove a-colire ads,Ada Command_Line Response_File a-clrefi ads,Ada Command_Line Environment a-colien ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2e8}@anchor{gnat_rm/the_gnat_library id9}@anchor{2e9} +@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2e9}@anchor{gnat_rm/the_gnat_library id9}@anchor{2ea} @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads}) @@ -23187,7 +23202,7 @@ to further calls to the subprograms in @code{Ada.Command_Line}. These calls will not see the removed argument. @node Ada Command_Line Response_File a-clrefi ads,Ada Direct_IO C_Streams a-diocst ads,Ada Command_Line Remove a-colire ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2ea}@anchor{gnat_rm/the_gnat_library id10}@anchor{2eb} +@anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2eb}@anchor{gnat_rm/the_gnat_library id10}@anchor{2ec} @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads}) @@ -23207,7 +23222,7 @@ Using a response file allow passing a set of arguments to an executable longer than the maximum allowed by the system on the command line. @node Ada Direct_IO C_Streams a-diocst ads,Ada Exceptions Is_Null_Occurrence a-einuoc ads,Ada Command_Line Response_File a-clrefi ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2ec}@anchor{gnat_rm/the_gnat_library id11}@anchor{2ed} +@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2ed}@anchor{gnat_rm/the_gnat_library id11}@anchor{2ee} @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads}) @@ -23222,7 +23237,7 @@ extracted from a file opened on the Ada side, and an Ada file can be constructed from a stream opened on the C side. @node Ada Exceptions Is_Null_Occurrence a-einuoc ads,Ada Exceptions Last_Chance_Handler a-elchha ads,Ada Direct_IO C_Streams a-diocst ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id12}@anchor{2ef} +@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2ef}@anchor{gnat_rm/the_gnat_library id12}@anchor{2f0} @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads}) @@ -23236,7 +23251,7 @@ exception occurrence (@code{Null_Occurrence}) without raising an exception. @node Ada Exceptions Last_Chance_Handler a-elchha ads,Ada Exceptions Traceback a-exctra ads,Ada Exceptions Is_Null_Occurrence a-einuoc ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2f0}@anchor{gnat_rm/the_gnat_library id13}@anchor{2f1} +@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2f1}@anchor{gnat_rm/the_gnat_library id13}@anchor{2f2} @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads}) @@ -23250,7 +23265,7 @@ exceptions (hence the name last chance), and perform clean ups before terminating the program. Note that this subprogram never returns. @node Ada Exceptions Traceback a-exctra ads,Ada Sequential_IO C_Streams a-siocst ads,Ada Exceptions Last_Chance_Handler a-elchha ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2f2}@anchor{gnat_rm/the_gnat_library id14}@anchor{2f3} +@anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2f3}@anchor{gnat_rm/the_gnat_library id14}@anchor{2f4} @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads}) @@ -23263,7 +23278,7 @@ give a traceback array of addresses based on an exception occurrence. @node Ada Sequential_IO C_Streams a-siocst ads,Ada Streams Stream_IO C_Streams a-ssicst ads,Ada Exceptions Traceback a-exctra ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2f4}@anchor{gnat_rm/the_gnat_library id15}@anchor{2f5} +@anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2f5}@anchor{gnat_rm/the_gnat_library id15}@anchor{2f6} @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads}) @@ -23278,7 +23293,7 @@ extracted from a file opened on the Ada side, and an Ada file can be constructed from a stream opened on the C side. @node Ada Streams Stream_IO C_Streams a-ssicst ads,Ada Strings Unbounded Text_IO a-suteio ads,Ada Sequential_IO C_Streams a-siocst ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2f6}@anchor{gnat_rm/the_gnat_library id16}@anchor{2f7} +@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2f7}@anchor{gnat_rm/the_gnat_library id16}@anchor{2f8} @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads}) @@ -23293,7 +23308,7 @@ extracted from a file opened on the Ada side, and an Ada file can be constructed from a stream opened on the C side. @node Ada Strings Unbounded Text_IO a-suteio ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,Ada Streams Stream_IO C_Streams a-ssicst ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2f8}@anchor{gnat_rm/the_gnat_library id17}@anchor{2f9} +@anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2f9}@anchor{gnat_rm/the_gnat_library id17}@anchor{2fa} @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads}) @@ -23310,7 +23325,7 @@ strings, avoiding the necessity for an intermediate operation with ordinary strings. @node Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Strings Unbounded Text_IO a-suteio ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{2fa}@anchor{gnat_rm/the_gnat_library id18}@anchor{2fb} +@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{2fb}@anchor{gnat_rm/the_gnat_library id18}@anchor{2fc} @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads}) @@ -23327,7 +23342,7 @@ wide strings, avoiding the necessity for an intermediate operation with ordinary wide strings. @node Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Task_Initialization a-tasini ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{2fc}@anchor{gnat_rm/the_gnat_library id19}@anchor{2fd} +@anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{2fd}@anchor{gnat_rm/the_gnat_library id19}@anchor{2fe} @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads}) @@ -23344,7 +23359,7 @@ wide wide strings, avoiding the necessity for an intermediate operation with ordinary wide wide strings. @node Ada Task_Initialization a-tasini ads,Ada Text_IO C_Streams a-tiocst ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-task-initialization-a-tasini-ads}@anchor{2fe}@anchor{gnat_rm/the_gnat_library id20}@anchor{2ff} +@anchor{gnat_rm/the_gnat_library ada-task-initialization-a-tasini-ads}@anchor{2ff}@anchor{gnat_rm/the_gnat_library id20}@anchor{300} @section @code{Ada.Task_Initialization} (@code{a-tasini.ads}) @@ -23356,7 +23371,7 @@ parameterless procedures. Note that such a handler is only invoked for those tasks activated after the handler is set. @node Ada Text_IO C_Streams a-tiocst ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Task_Initialization a-tasini ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{300}@anchor{gnat_rm/the_gnat_library id21}@anchor{301} +@anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{301}@anchor{gnat_rm/the_gnat_library id21}@anchor{302} @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads}) @@ -23371,7 +23386,7 @@ extracted from a file opened on the Ada side, and an Ada file can be constructed from a stream opened on the C side. @node Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Wide_Characters Unicode a-wichun ads,Ada Text_IO C_Streams a-tiocst ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{302}@anchor{gnat_rm/the_gnat_library id22}@anchor{303} +@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{303}@anchor{gnat_rm/the_gnat_library id22}@anchor{304} @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads}) @@ -23386,7 +23401,7 @@ execution (for example a standard input file may be redefined to be interactive). @node Ada Wide_Characters Unicode a-wichun ads,Ada Wide_Text_IO C_Streams a-wtcstr ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{304}@anchor{gnat_rm/the_gnat_library id23}@anchor{305} +@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{305}@anchor{gnat_rm/the_gnat_library id23}@anchor{306} @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads}) @@ -23399,7 +23414,7 @@ This package provides subprograms that allow categorization of Wide_Character values according to Unicode categories. @node Ada Wide_Text_IO C_Streams a-wtcstr ads,Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,Ada Wide_Characters Unicode a-wichun ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{306}@anchor{gnat_rm/the_gnat_library id24}@anchor{307} +@anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{307}@anchor{gnat_rm/the_gnat_library id24}@anchor{308} @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads}) @@ -23414,7 +23429,7 @@ extracted from a file opened on the Ada side, and an Ada file can be constructed from a stream opened on the C side. @node Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,Ada Wide_Wide_Characters Unicode a-zchuni ads,Ada Wide_Text_IO C_Streams a-wtcstr ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{308}@anchor{gnat_rm/the_gnat_library id25}@anchor{309} +@anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{309}@anchor{gnat_rm/the_gnat_library id25}@anchor{30a} @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads}) @@ -23429,7 +23444,7 @@ execution (for example a standard input file may be redefined to be interactive). @node Ada Wide_Wide_Characters Unicode a-zchuni ads,Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{30a}@anchor{gnat_rm/the_gnat_library id26}@anchor{30b} +@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{30b}@anchor{gnat_rm/the_gnat_library id26}@anchor{30c} @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads}) @@ -23442,7 +23457,7 @@ This package provides subprograms that allow categorization of Wide_Wide_Character values according to Unicode categories. @node Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,Ada Wide_Wide_Characters Unicode a-zchuni ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{30c}@anchor{gnat_rm/the_gnat_library id27}@anchor{30d} +@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{30d}@anchor{gnat_rm/the_gnat_library id27}@anchor{30e} @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads}) @@ -23457,7 +23472,7 @@ extracted from a file opened on the Ada side, and an Ada file can be constructed from a stream opened on the C side. @node Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,GNAT Altivec g-altive ads,Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{30e}@anchor{gnat_rm/the_gnat_library id28}@anchor{30f} +@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{30f}@anchor{gnat_rm/the_gnat_library id28}@anchor{310} @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads}) @@ -23472,7 +23487,7 @@ change during execution (for example a standard input file may be redefined to be interactive). @node GNAT Altivec g-altive ads,GNAT Altivec Conversions g-altcon ads,Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{310}@anchor{gnat_rm/the_gnat_library id29}@anchor{311} +@anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{311}@anchor{gnat_rm/the_gnat_library id29}@anchor{312} @section @code{GNAT.Altivec} (@code{g-altive.ads}) @@ -23485,7 +23500,7 @@ definitions of constants and types common to all the versions of the binding. @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{312}@anchor{gnat_rm/the_gnat_library id30}@anchor{313} +@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{313}@anchor{gnat_rm/the_gnat_library id30}@anchor{314} @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads}) @@ -23496,7 +23511,7 @@ binding. This package provides the Vector/View conversion routines. @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{314}@anchor{gnat_rm/the_gnat_library id31}@anchor{315} +@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{315}@anchor{gnat_rm/the_gnat_library id31}@anchor{316} @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads}) @@ -23510,7 +23525,7 @@ library. The hard binding is provided as a separate package. This unit is common to both bindings. @node GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Vector_Views g-alvevi ads,GNAT Altivec Vector_Operations g-alveop ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{316}@anchor{gnat_rm/the_gnat_library id32}@anchor{317} +@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{317}@anchor{gnat_rm/the_gnat_library id32}@anchor{318} @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads}) @@ -23522,7 +23537,7 @@ This package exposes the various vector types part of the Ada binding to AltiVec facilities. @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{318}@anchor{gnat_rm/the_gnat_library id33}@anchor{319} +@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{319}@anchor{gnat_rm/the_gnat_library id33}@anchor{31a} @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads}) @@ -23537,7 +23552,7 @@ vector elements and provides a simple way to initialize vector objects. @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{31a}@anchor{gnat_rm/the_gnat_library id34}@anchor{31b} +@anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{31b}@anchor{gnat_rm/the_gnat_library id34}@anchor{31c} @section @code{GNAT.Array_Split} (@code{g-arrspl.ads}) @@ -23550,7 +23565,7 @@ an array wherever the separators appear, and provide direct access to the resulting slices. @node GNAT AWK g-awk ads,GNAT Binary_Search g-binsea ads,GNAT Array_Split g-arrspl ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{31c}@anchor{gnat_rm/the_gnat_library id35}@anchor{31d} +@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{31d}@anchor{gnat_rm/the_gnat_library id35}@anchor{31e} @section @code{GNAT.AWK} (@code{g-awk.ads}) @@ -23565,7 +23580,7 @@ or more files containing formatted data. The file is viewed as a database where each record is a line and a field is a data element in this line. @node GNAT Binary_Search g-binsea ads,GNAT Bind_Environment g-binenv ads,GNAT AWK g-awk ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-binary-search-g-binsea-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id36}@anchor{31f} +@anchor{gnat_rm/the_gnat_library gnat-binary-search-g-binsea-ads}@anchor{31f}@anchor{gnat_rm/the_gnat_library id36}@anchor{320} @section @code{GNAT.Binary_Search} (@code{g-binsea.ads}) @@ -23577,7 +23592,7 @@ Allow binary search of a sorted array (or of an array-like container; the generic does not reference the array directly). @node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT Binary_Search g-binsea ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{320}@anchor{gnat_rm/the_gnat_library id37}@anchor{321} +@anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{321}@anchor{gnat_rm/the_gnat_library id37}@anchor{322} @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads}) @@ -23590,7 +23605,7 @@ These associations can be specified using the @code{-V} binder command line switch. @node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{322}@anchor{gnat_rm/the_gnat_library id38}@anchor{323} +@anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{323}@anchor{gnat_rm/the_gnat_library id38}@anchor{324} @section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads}) @@ -23601,7 +23616,7 @@ line switch. Provides routines giving hints to the branch predictor of the code generator. @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{324}@anchor{gnat_rm/the_gnat_library id39}@anchor{325} +@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{325}@anchor{gnat_rm/the_gnat_library id39}@anchor{326} @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads}) @@ -23616,7 +23631,7 @@ useful directly or as parts of the implementations of other abstractions, such as mailboxes. @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{326}@anchor{gnat_rm/the_gnat_library id40}@anchor{327} +@anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{327}@anchor{gnat_rm/the_gnat_library id40}@anchor{328} @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads}) @@ -23629,7 +23644,7 @@ such as mailboxes. Provides a thread-safe asynchronous intertask mailbox communication facility. @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{328}@anchor{gnat_rm/the_gnat_library id41}@anchor{329} +@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{329}@anchor{gnat_rm/the_gnat_library id41}@anchor{32a} @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads}) @@ -23644,7 +23659,7 @@ data items. Exchange and comparison procedures are provided by passing access-to-procedure values. @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{32a}@anchor{gnat_rm/the_gnat_library id42}@anchor{32b} +@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{32b}@anchor{gnat_rm/the_gnat_library id42}@anchor{32c} @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads}) @@ -23660,7 +23675,7 @@ access-to-procedure values. This is an older version, retained for compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable. @node GNAT Bubble_Sort_G g-busorg ads,GNAT Byte_Order_Mark g-byorma ads,GNAT Bubble_Sort_A g-busora ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{32c}@anchor{gnat_rm/the_gnat_library id43}@anchor{32d} +@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{32d}@anchor{gnat_rm/the_gnat_library id43}@anchor{32e} @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads}) @@ -23676,7 +23691,7 @@ if the procedures can be inlined, at the expense of duplicating code for multiple instantiations. @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{32e}@anchor{gnat_rm/the_gnat_library id44}@anchor{32f} +@anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{32f}@anchor{gnat_rm/the_gnat_library id44}@anchor{330} @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads}) @@ -23692,7 +23707,7 @@ the encoding of the string. The routine includes detection of special XML sequences for various UCS input formats. @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{330}@anchor{gnat_rm/the_gnat_library id45}@anchor{331} +@anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{331}@anchor{gnat_rm/the_gnat_library id45}@anchor{332} @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads}) @@ -23706,7 +23721,7 @@ General routines for swapping the bytes in 2-, 4-, and 8-byte quantities. Machine-specific implementations are available in some cases. @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{332}@anchor{gnat_rm/the_gnat_library id46}@anchor{333} +@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{333}@anchor{gnat_rm/the_gnat_library id46}@anchor{334} @section @code{GNAT.Calendar} (@code{g-calend.ads}) @@ -23720,7 +23735,7 @@ Also provides conversion of @code{Ada.Calendar.Time} values to and from the C @code{timeval} format. @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{334}@anchor{gnat_rm/the_gnat_library id47}@anchor{335} +@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{335}@anchor{gnat_rm/the_gnat_library id47}@anchor{336} @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads}) @@ -23731,7 +23746,7 @@ C @code{timeval} format. @geindex GNAT.Calendar.Time_IO (g-catiio.ads) @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{336}@anchor{gnat_rm/the_gnat_library id48}@anchor{337} +@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id48}@anchor{338} @section @code{GNAT.CRC32} (@code{g-crc32.ads}) @@ -23748,7 +23763,7 @@ of this algorithm see Aug. 1988. Sarwate, D.V. @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{338}@anchor{gnat_rm/the_gnat_library id49}@anchor{339} +@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{339}@anchor{gnat_rm/the_gnat_library id49}@anchor{33a} @section @code{GNAT.Case_Util} (@code{g-casuti.ads}) @@ -23763,7 +23778,7 @@ without the overhead of the full casing tables in @code{Ada.Characters.Handling}. @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{33a}@anchor{gnat_rm/the_gnat_library id50}@anchor{33b} +@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{33b}@anchor{gnat_rm/the_gnat_library id50}@anchor{33c} @section @code{GNAT.CGI} (@code{g-cgi.ads}) @@ -23778,7 +23793,7 @@ builds a table whose index is the key and provides some services to deal with this table. @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{33c}@anchor{gnat_rm/the_gnat_library id51}@anchor{33d} +@anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{33d}@anchor{gnat_rm/the_gnat_library id51}@anchor{33e} @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads}) @@ -23793,7 +23808,7 @@ Common Gateway Interface (CGI). It exports services to deal with Web cookies (piece of information kept in the Web client software). @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{33e}@anchor{gnat_rm/the_gnat_library id52}@anchor{33f} +@anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{33f}@anchor{gnat_rm/the_gnat_library id52}@anchor{340} @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads}) @@ -23805,7 +23820,7 @@ This is a package to help debugging CGI (Common Gateway Interface) programs written in Ada. @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{340}@anchor{gnat_rm/the_gnat_library id53}@anchor{341} +@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{341}@anchor{gnat_rm/the_gnat_library id53}@anchor{342} @section @code{GNAT.Command_Line} (@code{g-comlin.ads}) @@ -23818,7 +23833,7 @@ including the ability to scan for named switches with optional parameters and expand file names using wildcard notations. @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{342}@anchor{gnat_rm/the_gnat_library id54}@anchor{343} +@anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{343}@anchor{gnat_rm/the_gnat_library id54}@anchor{344} @section @code{GNAT.Compiler_Version} (@code{g-comver.ads}) @@ -23836,7 +23851,7 @@ of the compiler if a consistent tool set is used to compile all units of a partition). @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{344}@anchor{gnat_rm/the_gnat_library id55}@anchor{345} +@anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{345}@anchor{gnat_rm/the_gnat_library id55}@anchor{346} @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads}) @@ -23847,7 +23862,7 @@ of a partition). Provides a simple interface to handle Ctrl-C keyboard events. @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{346}@anchor{gnat_rm/the_gnat_library id56}@anchor{347} +@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{347}@anchor{gnat_rm/the_gnat_library id56}@anchor{348} @section @code{GNAT.Current_Exception} (@code{g-curexc.ads}) @@ -23864,7 +23879,7 @@ This is particularly useful in simulating typical facilities for obtaining information about exceptions provided by Ada 83 compilers. @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{348}@anchor{gnat_rm/the_gnat_library id57}@anchor{349} +@anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{349}@anchor{gnat_rm/the_gnat_library id57}@anchor{34a} @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads}) @@ -23881,7 +23896,7 @@ problems. See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User’s Guide}. @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{34a}@anchor{gnat_rm/the_gnat_library id58}@anchor{34b} +@anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{34b}@anchor{gnat_rm/the_gnat_library id58}@anchor{34c} @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads}) @@ -23894,7 +23909,7 @@ to and from string images of address values. Supports both C and Ada formats for hexadecimal literals. @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{34c}@anchor{gnat_rm/the_gnat_library id59}@anchor{34d} +@anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{34d}@anchor{gnat_rm/the_gnat_library id59}@anchor{34e} @section @code{GNAT.Decode_String} (@code{g-decstr.ads}) @@ -23918,7 +23933,7 @@ Useful in conjunction with Unicode character coding. Note there is a preinstantiation for UTF-8. See next entry. @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{34e}@anchor{gnat_rm/the_gnat_library id60}@anchor{34f} +@anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{34f}@anchor{gnat_rm/the_gnat_library id60}@anchor{350} @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads}) @@ -23939,7 +23954,7 @@ preinstantiation for UTF-8. See next entry. A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding. @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{350}@anchor{gnat_rm/the_gnat_library id61}@anchor{351} +@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{351}@anchor{gnat_rm/the_gnat_library id61}@anchor{352} @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads}) @@ -23952,7 +23967,7 @@ the current directory, making new directories, and scanning the files in a directory. @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{352}@anchor{gnat_rm/the_gnat_library id62}@anchor{353} +@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{353}@anchor{gnat_rm/the_gnat_library id62}@anchor{354} @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads}) @@ -23964,7 +23979,7 @@ A child unit of GNAT.Directory_Operations providing additional operations for iterating through directories. @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{354}@anchor{gnat_rm/the_gnat_library id63}@anchor{355} +@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{355}@anchor{gnat_rm/the_gnat_library id63}@anchor{356} @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads}) @@ -23982,7 +23997,7 @@ dynamic instances of the hash table, while an instantiation of @code{GNAT.HTable} creates a single instance of the hash table. @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{356}@anchor{gnat_rm/the_gnat_library id64}@anchor{357} +@anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{357}@anchor{gnat_rm/the_gnat_library id64}@anchor{358} @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads}) @@ -24002,7 +24017,7 @@ dynamic instances of the table, while an instantiation of @code{GNAT.Table} creates a single instance of the table type. @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{358}@anchor{gnat_rm/the_gnat_library id65}@anchor{359} +@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{359}@anchor{gnat_rm/the_gnat_library id65}@anchor{35a} @section @code{GNAT.Encode_String} (@code{g-encstr.ads}) @@ -24024,7 +24039,7 @@ encoding method. Useful in conjunction with Unicode character coding. Note there is a preinstantiation for UTF-8. See next entry. @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{35a}@anchor{gnat_rm/the_gnat_library id66}@anchor{35b} +@anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{35b}@anchor{gnat_rm/the_gnat_library id66}@anchor{35c} @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads}) @@ -24045,7 +24060,7 @@ Note there is a preinstantiation for UTF-8. See next entry. A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding. @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{35c}@anchor{gnat_rm/the_gnat_library id67}@anchor{35d} +@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{35d}@anchor{gnat_rm/the_gnat_library id67}@anchor{35e} @section @code{GNAT.Exception_Actions} (@code{g-excact.ads}) @@ -24058,7 +24073,7 @@ for specific exceptions, or when any exception is raised. This can be used for instance to force a core dump to ease debugging. @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{35e}@anchor{gnat_rm/the_gnat_library id68}@anchor{35f} +@anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{35f}@anchor{gnat_rm/the_gnat_library id68}@anchor{360} @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads}) @@ -24072,7 +24087,7 @@ Provides an interface allowing to control automatic output upon exception occurrences. @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{360}@anchor{gnat_rm/the_gnat_library id69}@anchor{361} +@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{361}@anchor{gnat_rm/the_gnat_library id69}@anchor{362} @section @code{GNAT.Exceptions} (@code{g-except.ads}) @@ -24093,7 +24108,7 @@ predefined exceptions, and for example allows raising @code{Constraint_Error} with a message from a pure subprogram. @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{362}@anchor{gnat_rm/the_gnat_library id70}@anchor{363} +@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{363}@anchor{gnat_rm/the_gnat_library id70}@anchor{364} @section @code{GNAT.Expect} (@code{g-expect.ads}) @@ -24109,7 +24124,7 @@ It is not implemented for cross ports, and in particular is not implemented for VxWorks or LynxOS. @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{364}@anchor{gnat_rm/the_gnat_library id71}@anchor{365} +@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{365}@anchor{gnat_rm/the_gnat_library id71}@anchor{366} @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads}) @@ -24121,7 +24136,7 @@ ports. It is not implemented for cross ports, and in particular is not implemented for VxWorks or LynxOS. @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{366}@anchor{gnat_rm/the_gnat_library id72}@anchor{367} +@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{367}@anchor{gnat_rm/the_gnat_library id72}@anchor{368} @section @code{GNAT.Float_Control} (@code{g-flocon.ads}) @@ -24135,7 +24150,7 @@ library calls may cause this mode to be modified, and the Reset procedure in this package can be used to reestablish the required mode. @node GNAT Formatted_String g-forstr ads,GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Float_Control g-flocon ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{368}@anchor{gnat_rm/the_gnat_library id73}@anchor{369} +@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{369}@anchor{gnat_rm/the_gnat_library id73}@anchor{36a} @section @code{GNAT.Formatted_String} (@code{g-forstr.ads}) @@ -24150,7 +24165,7 @@ derived from Integer, Float or enumerations as values for the formatted string. @node GNAT Generic_Fast_Math_Functions g-gfmafu ads,GNAT Heap_Sort g-heasor ads,GNAT Formatted_String g-forstr ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-generic-fast-math-functions-g-gfmafu-ads}@anchor{36a}@anchor{gnat_rm/the_gnat_library id74}@anchor{36b} +@anchor{gnat_rm/the_gnat_library gnat-generic-fast-math-functions-g-gfmafu-ads}@anchor{36b}@anchor{gnat_rm/the_gnat_library id74}@anchor{36c} @section @code{GNAT.Generic_Fast_Math_Functions} (@code{g-gfmafu.ads}) @@ -24168,7 +24183,7 @@ have a vector implementation that can be automatically used by the compiler when auto-vectorization is enabled. @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Generic_Fast_Math_Functions g-gfmafu ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{36c}@anchor{gnat_rm/the_gnat_library id75}@anchor{36d} +@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{36d}@anchor{gnat_rm/the_gnat_library id75}@anchor{36e} @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads}) @@ -24182,7 +24197,7 @@ access-to-procedure values. The algorithm used is a modified heap sort that performs approximately N*log(N) comparisons in the worst case. @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{36e}@anchor{gnat_rm/the_gnat_library id76}@anchor{36f} +@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{36f}@anchor{gnat_rm/the_gnat_library id76}@anchor{370} @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads}) @@ -24198,7 +24213,7 @@ This differs from @code{GNAT.Heap_Sort} in having a less convenient interface, but may be slightly more efficient. @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{370}@anchor{gnat_rm/the_gnat_library id77}@anchor{371} +@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{371}@anchor{gnat_rm/the_gnat_library id77}@anchor{372} @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads}) @@ -24212,7 +24227,7 @@ if the procedures can be inlined, at the expense of duplicating code for multiple instantiations. @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{372}@anchor{gnat_rm/the_gnat_library id78}@anchor{373} +@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{373}@anchor{gnat_rm/the_gnat_library id78}@anchor{374} @section @code{GNAT.HTable} (@code{g-htable.ads}) @@ -24225,7 +24240,7 @@ data. Provides two approaches, one a simple static approach, and the other allowing arbitrary dynamic hash tables. @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{374}@anchor{gnat_rm/the_gnat_library id79}@anchor{375} +@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{375}@anchor{gnat_rm/the_gnat_library id79}@anchor{376} @section @code{GNAT.IO} (@code{g-io.ads}) @@ -24241,7 +24256,7 @@ Standard_Input, and writing characters, strings and integers to either Standard_Output or Standard_Error. @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{376}@anchor{gnat_rm/the_gnat_library id80}@anchor{377} +@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{377}@anchor{gnat_rm/the_gnat_library id80}@anchor{378} @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads}) @@ -24255,7 +24270,7 @@ Provides some auxiliary functions for use with Text_IO, including a test for whether a file exists, and functions for reading a line of text. @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{378}@anchor{gnat_rm/the_gnat_library id81}@anchor{379} +@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{379}@anchor{gnat_rm/the_gnat_library id81}@anchor{37a} @section @code{GNAT.Lock_Files} (@code{g-locfil.ads}) @@ -24269,7 +24284,7 @@ Provides a general interface for using files as locks. Can be used for providing program level synchronization. @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{37a}@anchor{gnat_rm/the_gnat_library id82}@anchor{37b} +@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{37b}@anchor{gnat_rm/the_gnat_library id82}@anchor{37c} @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads}) @@ -24281,7 +24296,7 @@ The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses a modified version of the Blum-Blum-Shub generator. @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{37c}@anchor{gnat_rm/the_gnat_library id83}@anchor{37d} +@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{37d}@anchor{gnat_rm/the_gnat_library id83}@anchor{37e} @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads}) @@ -24293,7 +24308,7 @@ The original implementation of @code{Ada.Numerics.Float_Random}. Uses a modified version of the Blum-Blum-Shub generator. @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{37e}@anchor{gnat_rm/the_gnat_library id84}@anchor{37f} +@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{37f}@anchor{gnat_rm/the_gnat_library id84}@anchor{380} @section @code{GNAT.MD5} (@code{g-md5.ads}) @@ -24306,7 +24321,7 @@ the HMAC-MD5 message authentication function as described in RFC 2104 and FIPS PUB 198. @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{380}@anchor{gnat_rm/the_gnat_library id85}@anchor{381} +@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{381}@anchor{gnat_rm/the_gnat_library id85}@anchor{382} @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads}) @@ -24319,7 +24334,7 @@ standard output or standard error files. Uses GNAT.IO for actual output. @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{382}@anchor{gnat_rm/the_gnat_library id86}@anchor{383} +@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{383}@anchor{gnat_rm/the_gnat_library id86}@anchor{384} @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads}) @@ -24333,7 +24348,7 @@ various logging purposes, including duplicating functionality of some Ada 83 implementation dependent extensions. @node GNAT OS_Lib g-os_lib ads,GNAT Perfect_Hash_Generators g-pehage ads,GNAT Most_Recent_Exception g-moreex ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{384}@anchor{gnat_rm/the_gnat_library id87}@anchor{385} +@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{385}@anchor{gnat_rm/the_gnat_library id87}@anchor{386} @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads}) @@ -24349,7 +24364,7 @@ including a portable spawn procedure, and access to environment variables and error return codes. @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{386}@anchor{gnat_rm/the_gnat_library id88}@anchor{387} +@anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{387}@anchor{gnat_rm/the_gnat_library id88}@anchor{388} @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads}) @@ -24367,7 +24382,7 @@ hashcode are in the same order. These hashing functions are very convenient for use with realtime applications. @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{388}@anchor{gnat_rm/the_gnat_library id89}@anchor{389} +@anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id89}@anchor{38a} @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads}) @@ -24379,7 +24394,7 @@ Provides random number capabilities which extend those available in the standard Ada library and are more convenient to use. @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{25f}@anchor{gnat_rm/the_gnat_library id90}@anchor{38a} +@anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{260}@anchor{gnat_rm/the_gnat_library id90}@anchor{38b} @section @code{GNAT.Regexp} (@code{g-regexp.ads}) @@ -24395,7 +24410,7 @@ simplest of the three pattern matching packages provided, and is particularly suitable for ‘file globbing’ applications. @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{38b}@anchor{gnat_rm/the_gnat_library id91}@anchor{38c} +@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{38c}@anchor{gnat_rm/the_gnat_library id91}@anchor{38d} @section @code{GNAT.Registry} (@code{g-regist.ads}) @@ -24409,7 +24424,7 @@ registry API, but at a lower level of abstraction, refer to the Win32.Winreg package provided with the Win32Ada binding @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{38d}@anchor{gnat_rm/the_gnat_library id92}@anchor{38e} +@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{38e}@anchor{gnat_rm/the_gnat_library id92}@anchor{38f} @section @code{GNAT.Regpat} (@code{g-regpat.ads}) @@ -24424,7 +24439,7 @@ from the original V7 style regular expression library written in C by Henry Spencer (and binary compatible with this C library). @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{38f}@anchor{gnat_rm/the_gnat_library id93}@anchor{390} +@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{390}@anchor{gnat_rm/the_gnat_library id93}@anchor{391} @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads}) @@ -24438,7 +24453,7 @@ full content to be processed is not loaded into memory all at once. This makes this interface usable for large files or socket streams. @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{391}@anchor{gnat_rm/the_gnat_library id94}@anchor{392} +@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{392}@anchor{gnat_rm/the_gnat_library id94}@anchor{393} @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads}) @@ -24450,7 +24465,7 @@ Provides the capability to query the high water mark of the current task’s secondary stack. @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{393}@anchor{gnat_rm/the_gnat_library id95}@anchor{394} +@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{394}@anchor{gnat_rm/the_gnat_library id95}@anchor{395} @section @code{GNAT.Semaphores} (@code{g-semaph.ads}) @@ -24461,7 +24476,7 @@ secondary stack. Provides classic counting and binary semaphores using protected types. @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{395}@anchor{gnat_rm/the_gnat_library id96}@anchor{396} +@anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{396}@anchor{gnat_rm/the_gnat_library id96}@anchor{397} @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads}) @@ -24473,7 +24488,7 @@ Provides a simple interface to send and receive data over a serial port. This is only supported on GNU/Linux and Windows. @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{397}@anchor{gnat_rm/the_gnat_library id97}@anchor{398} +@anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{398}@anchor{gnat_rm/the_gnat_library id97}@anchor{399} @section @code{GNAT.SHA1} (@code{g-sha1.ads}) @@ -24486,7 +24501,7 @@ and RFC 3174, and the HMAC-SHA1 message authentication function as described in RFC 2104 and FIPS PUB 198. @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{399}@anchor{gnat_rm/the_gnat_library id98}@anchor{39a} +@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{39a}@anchor{gnat_rm/the_gnat_library id98}@anchor{39b} @section @code{GNAT.SHA224} (@code{g-sha224.ads}) @@ -24499,7 +24514,7 @@ and the HMAC-SHA224 message authentication function as described in RFC 2104 and FIPS PUB 198. @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{39b}@anchor{gnat_rm/the_gnat_library id99}@anchor{39c} +@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{39c}@anchor{gnat_rm/the_gnat_library id99}@anchor{39d} @section @code{GNAT.SHA256} (@code{g-sha256.ads}) @@ -24512,7 +24527,7 @@ and the HMAC-SHA256 message authentication function as described in RFC 2104 and FIPS PUB 198. @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{39d}@anchor{gnat_rm/the_gnat_library id100}@anchor{39e} +@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{39e}@anchor{gnat_rm/the_gnat_library id100}@anchor{39f} @section @code{GNAT.SHA384} (@code{g-sha384.ads}) @@ -24525,7 +24540,7 @@ and the HMAC-SHA384 message authentication function as described in RFC 2104 and FIPS PUB 198. @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id101}@anchor{3a0} +@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3a0}@anchor{gnat_rm/the_gnat_library id101}@anchor{3a1} @section @code{GNAT.SHA512} (@code{g-sha512.ads}) @@ -24538,7 +24553,7 @@ and the HMAC-SHA512 message authentication function as described in RFC 2104 and FIPS PUB 198. @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3a1}@anchor{gnat_rm/the_gnat_library id102}@anchor{3a2} +@anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3a2}@anchor{gnat_rm/the_gnat_library id102}@anchor{3a3} @section @code{GNAT.Signals} (@code{g-signal.ads}) @@ -24550,7 +24565,7 @@ Provides the ability to manipulate the blocked status of signals on supported targets. @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3a3}@anchor{gnat_rm/the_gnat_library id103}@anchor{3a4} +@anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3a4}@anchor{gnat_rm/the_gnat_library id103}@anchor{3a5} @section @code{GNAT.Sockets} (@code{g-socket.ads}) @@ -24565,7 +24580,7 @@ on all native GNAT ports and on VxWorks cross ports. It is not implemented for the LynxOS cross port. @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3a5}@anchor{gnat_rm/the_gnat_library id104}@anchor{3a6} +@anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3a6}@anchor{gnat_rm/the_gnat_library id104}@anchor{3a7} @section @code{GNAT.Source_Info} (@code{g-souinf.ads}) @@ -24579,7 +24594,7 @@ subprograms yielding the date and time of the current compilation (like the C macros @code{__DATE__} and @code{__TIME__}) @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3a7}@anchor{gnat_rm/the_gnat_library id105}@anchor{3a8} +@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3a8}@anchor{gnat_rm/the_gnat_library id105}@anchor{3a9} @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads}) @@ -24591,7 +24606,7 @@ Provides a function for determining whether one string is a plausible near misspelling of another string. @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3a9}@anchor{gnat_rm/the_gnat_library id106}@anchor{3aa} +@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3aa}@anchor{gnat_rm/the_gnat_library id106}@anchor{3ab} @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads}) @@ -24604,7 +24619,7 @@ determining whether one string is a plausible near misspelling of another string. @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3ab}@anchor{gnat_rm/the_gnat_library id107}@anchor{3ac} +@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3ac}@anchor{gnat_rm/the_gnat_library id107}@anchor{3ad} @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads}) @@ -24620,7 +24635,7 @@ the SNOBOL4 dynamic pattern construction and matching capabilities, using the efficient algorithm developed by Robert Dewar for the SPITBOL system. @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3ad}@anchor{gnat_rm/the_gnat_library id108}@anchor{3ae} +@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3ae}@anchor{gnat_rm/the_gnat_library id108}@anchor{3af} @section @code{GNAT.Spitbol} (@code{g-spitbo.ads}) @@ -24635,7 +24650,7 @@ useful for constructing arbitrary mappings from strings in the style of the SNOBOL4 TABLE function. @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3af}@anchor{gnat_rm/the_gnat_library id109}@anchor{3b0} +@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3b0}@anchor{gnat_rm/the_gnat_library id109}@anchor{3b1} @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads}) @@ -24650,7 +24665,7 @@ for type @code{Standard.Boolean}, giving an implementation of sets of string values. @node GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol Table_VString g-sptavs ads,GNAT Spitbol Table_Boolean g-sptabo ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3b1}@anchor{gnat_rm/the_gnat_library id110}@anchor{3b2} +@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3b2}@anchor{gnat_rm/the_gnat_library id110}@anchor{3b3} @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads}) @@ -24667,7 +24682,7 @@ for type @code{Standard.Integer}, giving an implementation of maps from string to integer values. @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3b3}@anchor{gnat_rm/the_gnat_library id111}@anchor{3b4} +@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3b4}@anchor{gnat_rm/the_gnat_library id111}@anchor{3b5} @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads}) @@ -24684,7 +24699,7 @@ a variable length string type, giving an implementation of general maps from strings to strings. @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3b5}@anchor{gnat_rm/the_gnat_library id112}@anchor{3b6} +@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3b6}@anchor{gnat_rm/the_gnat_library id112}@anchor{3b7} @section @code{GNAT.SSE} (@code{g-sse.ads}) @@ -24696,7 +24711,7 @@ targets. It exposes vector component types together with a general introduction to the binding contents and use. @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3b7}@anchor{gnat_rm/the_gnat_library id113}@anchor{3b8} +@anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3b8}@anchor{gnat_rm/the_gnat_library id113}@anchor{3b9} @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads}) @@ -24705,7 +24720,7 @@ introduction to the binding contents and use. SSE vector types for use with SSE related intrinsics. @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3b9}@anchor{gnat_rm/the_gnat_library id114}@anchor{3ba} +@anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3ba}@anchor{gnat_rm/the_gnat_library id114}@anchor{3bb} @section @code{GNAT.String_Hash} (@code{g-strhas.ads}) @@ -24717,7 +24732,7 @@ Provides a generic hash function working on arrays of scalars. Both the scalar type and the hash result type are parameters. @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3bb}@anchor{gnat_rm/the_gnat_library id115}@anchor{3bc} +@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3bc}@anchor{gnat_rm/the_gnat_library id115}@anchor{3bd} @section @code{GNAT.Strings} (@code{g-string.ads}) @@ -24727,7 +24742,7 @@ Common String access types and related subprograms. Basically it defines a string access and an array of string access types. @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3bd}@anchor{gnat_rm/the_gnat_library id116}@anchor{3be} +@anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3be}@anchor{gnat_rm/the_gnat_library id116}@anchor{3bf} @section @code{GNAT.String_Split} (@code{g-strspl.ads}) @@ -24741,7 +24756,7 @@ to the resulting slices. This package is instantiated from @code{GNAT.Array_Split}. @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3bf}@anchor{gnat_rm/the_gnat_library id117}@anchor{3c0} +@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3c0}@anchor{gnat_rm/the_gnat_library id117}@anchor{3c1} @section @code{GNAT.Table} (@code{g-table.ads}) @@ -24761,7 +24776,7 @@ while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be used to define dynamic instances of the table. @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3c1}@anchor{gnat_rm/the_gnat_library id118}@anchor{3c2} +@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3c2}@anchor{gnat_rm/the_gnat_library id118}@anchor{3c3} @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads}) @@ -24778,7 +24793,7 @@ single global task lock. Appropriate for use in situations where contention between tasks is very rarely expected. @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3c3}@anchor{gnat_rm/the_gnat_library id119}@anchor{3c4} +@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3c4}@anchor{gnat_rm/the_gnat_library id119}@anchor{3c5} @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads}) @@ -24793,7 +24808,7 @@ represents the current date and time in ISO 8601 format. This is a very simple routine with minimal code and there are no dependencies on any other unit. @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3c5}@anchor{gnat_rm/the_gnat_library id120}@anchor{3c6} +@anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3c6}@anchor{gnat_rm/the_gnat_library id120}@anchor{3c7} @section @code{GNAT.Threads} (@code{g-thread.ads}) @@ -24810,7 +24825,7 @@ further details if your program has threads that are created by a non-Ada environment which then accesses Ada code. @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3c7}@anchor{gnat_rm/the_gnat_library id121}@anchor{3c8} +@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3c8}@anchor{gnat_rm/the_gnat_library id121}@anchor{3c9} @section @code{GNAT.Traceback} (@code{g-traceb.ads}) @@ -24822,7 +24837,7 @@ Provides a facility for obtaining non-symbolic traceback information, useful in various debugging situations. @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-utf_32 ads,GNAT Traceback g-traceb ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3c9}@anchor{gnat_rm/the_gnat_library id122}@anchor{3ca} +@anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3ca}@anchor{gnat_rm/the_gnat_library id122}@anchor{3cb} @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads}) @@ -24831,7 +24846,7 @@ in various debugging situations. @geindex Trace back facilities @node GNAT UTF_32 g-utf_32 ads,GNAT UTF_32_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-utf-32-ads}@anchor{3cb}@anchor{gnat_rm/the_gnat_library id123}@anchor{3cc} +@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-utf-32-ads}@anchor{3cc}@anchor{gnat_rm/the_gnat_library id123}@anchor{3cd} @section @code{GNAT.UTF_32} (@code{g-utf_32.ads}) @@ -24850,7 +24865,7 @@ lower case to upper case fold routine corresponding to the Ada 2005 rules for identifier equivalence. @node GNAT UTF_32_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-utf_32 ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-utf-32-spelling-checker-g-u3spch-ads}@anchor{3cd}@anchor{gnat_rm/the_gnat_library id124}@anchor{3ce} +@anchor{gnat_rm/the_gnat_library gnat-utf-32-spelling-checker-g-u3spch-ads}@anchor{3ce}@anchor{gnat_rm/the_gnat_library id124}@anchor{3cf} @section @code{GNAT.UTF_32_Spelling_Checker} (@code{g-u3spch.ads}) @@ -24863,7 +24878,7 @@ near misspelling of another wide wide string, where the strings are represented using the UTF_32_String type defined in System.Wch_Cnv. @node GNAT Wide_Spelling_Checker g-wispch ads,GNAT Wide_String_Split g-wistsp ads,GNAT UTF_32_Spelling_Checker g-u3spch ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3cf}@anchor{gnat_rm/the_gnat_library id125}@anchor{3d0} +@anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3d0}@anchor{gnat_rm/the_gnat_library id125}@anchor{3d1} @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads}) @@ -24875,7 +24890,7 @@ Provides a function for determining whether one wide string is a plausible near misspelling of another wide string. @node GNAT Wide_String_Split g-wistsp ads,GNAT Wide_Wide_Spelling_Checker g-zspche ads,GNAT Wide_Spelling_Checker g-wispch ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3d1}@anchor{gnat_rm/the_gnat_library id126}@anchor{3d2} +@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3d2}@anchor{gnat_rm/the_gnat_library id126}@anchor{3d3} @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads}) @@ -24889,7 +24904,7 @@ to the resulting slices. This package is instantiated from @code{GNAT.Array_Split}. @node GNAT Wide_Wide_Spelling_Checker g-zspche ads,GNAT Wide_Wide_String_Split g-zistsp ads,GNAT Wide_String_Split g-wistsp ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3d3}@anchor{gnat_rm/the_gnat_library id127}@anchor{3d4} +@anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3d4}@anchor{gnat_rm/the_gnat_library id127}@anchor{3d5} @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads}) @@ -24901,7 +24916,7 @@ Provides a function for determining whether one wide wide string is a plausible near misspelling of another wide wide string. @node GNAT Wide_Wide_String_Split g-zistsp ads,Interfaces C Extensions i-cexten ads,GNAT Wide_Wide_Spelling_Checker g-zspche ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3d5}@anchor{gnat_rm/the_gnat_library id128}@anchor{3d6} +@anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3d6}@anchor{gnat_rm/the_gnat_library id128}@anchor{3d7} @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads}) @@ -24915,7 +24930,7 @@ to the resulting slices. This package is instantiated from @code{GNAT.Array_Split}. @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id129}@anchor{3d7}@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3d8} +@anchor{gnat_rm/the_gnat_library id129}@anchor{3d8}@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3d9} @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads}) @@ -24926,7 +24941,7 @@ for use with either manually or automatically generated bindings to C libraries. @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id130}@anchor{3d9}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3da} +@anchor{gnat_rm/the_gnat_library id130}@anchor{3da}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3db} @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads}) @@ -24939,7 +24954,7 @@ This package is a binding for the most commonly used operations on C streams. @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id131}@anchor{3db}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3dc} +@anchor{gnat_rm/the_gnat_library id131}@anchor{3dc}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3dd} @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads}) @@ -24954,7 +24969,7 @@ from a packed decimal format compatible with that used on IBM mainframes. @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id132}@anchor{3dd}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3de} +@anchor{gnat_rm/the_gnat_library id132}@anchor{3de}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3df} @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads}) @@ -24970,7 +24985,7 @@ In particular, it interfaces with the VxWorks hardware interrupt facilities. @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id133}@anchor{3df}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e0} +@anchor{gnat_rm/the_gnat_library id133}@anchor{3e0}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e1} @section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads}) @@ -24986,7 +25001,7 @@ intConnect() with a custom routine for installing interrupt handlers. @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id134}@anchor{3e1}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3e2} +@anchor{gnat_rm/the_gnat_library id134}@anchor{3e2}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3e3} @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads}) @@ -25009,7 +25024,7 @@ function codes. A particular use of this package is to enable the use of Get_Immediate under VxWorks. @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id135}@anchor{3e3}@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3e4} +@anchor{gnat_rm/the_gnat_library id135}@anchor{3e4}@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3e5} @section @code{System.Address_Image} (@code{s-addima.ads}) @@ -25025,7 +25040,7 @@ function that gives an (implementation dependent) string which identifies an address. @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id136}@anchor{3e5}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3e6} +@anchor{gnat_rm/the_gnat_library id136}@anchor{3e6}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3e7} @section @code{System.Assertions} (@code{s-assert.ads}) @@ -25041,7 +25056,7 @@ by an run-time assertion failure, as well as the routine that is used internally to raise this assertion. @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id137}@anchor{3e7}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3e8} +@anchor{gnat_rm/the_gnat_library id137}@anchor{3e8}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3e9} @section @code{System.Atomic_Counters} (@code{s-atocou.ads}) @@ -25055,7 +25070,7 @@ on most targets, including all Alpha, AARCH64, ARM, ia64, PowerPC, SPARC V9, x86, and x86_64 platforms. @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id138}@anchor{3e9}@anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3ea} +@anchor{gnat_rm/the_gnat_library id138}@anchor{3ea}@anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3eb} @section @code{System.Memory} (@code{s-memory.ads}) @@ -25073,7 +25088,7 @@ calls to this unit may be made for low level allocation uses (for example see the body of @code{GNAT.Tables}). @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id139}@anchor{3eb}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3ec} +@anchor{gnat_rm/the_gnat_library id139}@anchor{3ec}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3ed} @section @code{System.Multiprocessors} (@code{s-multip.ads}) @@ -25086,7 +25101,7 @@ in GNAT we also make it available in Ada 95 and Ada 2005 (where it is technically an implementation-defined addition). @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id140}@anchor{3ed}@anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3ee} +@anchor{gnat_rm/the_gnat_library id140}@anchor{3ee}@anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3ef} @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads}) @@ -25099,7 +25114,7 @@ in GNAT we also make it available in Ada 95 and Ada 2005 (where it is technically an implementation-defined addition). @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id141}@anchor{3ef}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f0} +@anchor{gnat_rm/the_gnat_library id141}@anchor{3f0}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f1} @section @code{System.Partition_Interface} (@code{s-parint.ads}) @@ -25112,7 +25127,7 @@ is used primarily in a distribution context when using Annex E with @code{GLADE}. @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id142}@anchor{3f1}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3f2} +@anchor{gnat_rm/the_gnat_library id142}@anchor{3f2}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3f3} @section @code{System.Pool_Global} (@code{s-pooglo.ads}) @@ -25129,7 +25144,7 @@ declared. It uses malloc/free to allocate/free and does not attempt to do any automatic reclamation. @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id143}@anchor{3f3}@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3f4} +@anchor{gnat_rm/the_gnat_library id143}@anchor{3f4}@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3f5} @section @code{System.Pool_Local} (@code{s-pooloc.ads}) @@ -25146,7 +25161,7 @@ a list of allocated blocks, so that all storage allocated for the pool can be freed automatically when the pool is finalized. @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id144}@anchor{3f5}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3f6} +@anchor{gnat_rm/the_gnat_library id144}@anchor{3f6}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3f7} @section @code{System.Restrictions} (@code{s-restri.ads}) @@ -25162,7 +25177,7 @@ compiler determined information on which restrictions are violated by one or more packages in the partition. @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id145}@anchor{3f7}@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3f8} +@anchor{gnat_rm/the_gnat_library id145}@anchor{3f8}@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3f9} @section @code{System.Rident} (@code{s-rident.ads}) @@ -25178,7 +25193,7 @@ since the necessary instantiation is included in package System.Restrictions. @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id146}@anchor{3f9}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{3fa} +@anchor{gnat_rm/the_gnat_library id146}@anchor{3fa}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{3fb} @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads}) @@ -25194,7 +25209,7 @@ stream attributes are applied to string types, but the subprograms in this package can be used directly by application programs. @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id147}@anchor{3fb}@anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{3fc} +@anchor{gnat_rm/the_gnat_library id147}@anchor{3fc}@anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{3fd} @section @code{System.Unsigned_Types} (@code{s-unstyp.ads}) @@ -25207,7 +25222,7 @@ also contains some related definitions for other specialized types used by the compiler in connection with packed array types. @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id148}@anchor{3fd}@anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{3fe} +@anchor{gnat_rm/the_gnat_library id148}@anchor{3fe}@anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{3ff} @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads}) @@ -25228,7 +25243,7 @@ encoding method. It uses definitions in package @code{System.Wch_Con}. @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library -@anchor{gnat_rm/the_gnat_library id149}@anchor{3ff}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{400} +@anchor{gnat_rm/the_gnat_library id149}@anchor{400}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{401} @section @code{System.Wch_Con} (@code{s-wchcon.ads}) @@ -25240,7 +25255,7 @@ in ordinary strings. These definitions are used by the package @code{System.Wch_Cnv}. @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top -@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{401}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{402}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11} +@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{402}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{403}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11} @chapter Interfacing to Other Languages @@ -25258,7 +25273,7 @@ provided. @end menu @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages -@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{403}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{404} +@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{404}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{405} @section Interfacing to C @@ -25398,7 +25413,7 @@ of the length corresponding to the @code{type'Size} value in Ada. @end itemize @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages -@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{47}@anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{405} +@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{47}@anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{406} @section Interfacing to C++ @@ -25455,7 +25470,7 @@ The @code{External_Name} is the name of the C++ RTTI symbol. You can then cover a specific C++ exception in an exception handler. @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages -@anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{406}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{407} +@anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{407}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{408} @section Interfacing to COBOL @@ -25463,7 +25478,7 @@ Interfacing to COBOL is achieved as described in section B.4 of the Ada Reference Manual. @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages -@anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{408}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{409} +@anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{409}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{40a} @section Interfacing to Fortran @@ -25473,7 +25488,7 @@ multi-dimensional array causes the array to be stored in column-major order as required for convenient interface to Fortran. @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages -@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{40a}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{40b} +@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{40b}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{40c} @section Interfacing to non-GNAT Ada code @@ -25497,7 +25512,7 @@ values or simple record types without variants, or simple array types with fixed bounds. @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top -@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{40c}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{40d}@anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12} +@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{40d}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{40e}@anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12} @chapter Specialized Needs Annexes @@ -25538,7 +25553,7 @@ in Ada 2005) is fully implemented. @end table @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top -@anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{40e}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{40f}@anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13} +@anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{40f}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{410}@anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13} @chapter Implementation of Specific Ada Features @@ -25557,7 +25572,7 @@ facilities. @end menu @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{410}@anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{169} +@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{411}@anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{16a} @section Machine Code Insertions @@ -25725,7 +25740,7 @@ according to normal visibility rules. In particular if there is no qualification is required. @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{411}@anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{412} +@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{412}@anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{413} @section GNAT Implementation of Tasking @@ -25741,7 +25756,7 @@ to compliance with the Real-Time Systems Annex. @end menu @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking -@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{413}@anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{414} +@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{414}@anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{415} @subsection Mapping Ada Tasks onto the Underlying Kernel Threads @@ -25810,7 +25825,7 @@ support this functionality when the parent contains more than one task. @geindex Forking a new process @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking -@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{415}@anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{416} +@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{416}@anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{417} @subsection Ensuring Compliance with the Real-Time Annex @@ -25861,7 +25876,7 @@ placed at the end. @c Support_for_Locking_Policies @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking -@anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{417} +@anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{418} @subsection Support for Locking Policies @@ -25895,7 +25910,7 @@ then ceiling locking is used. Otherwise, the @code{Ceiling_Locking} policy is ignored. @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{418}@anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{419} +@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{419}@anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{41a} @section GNAT Implementation of Shared Passive Packages @@ -25993,7 +26008,7 @@ This is used to provide the required locking semantics for proper protected object synchronization. @node Code Generation for Array Aggregates,The Size of Discriminated Records with Default Discriminants,GNAT Implementation of Shared Passive Packages,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{41a}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{41b} +@anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{41b}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{41c} @section Code Generation for Array Aggregates @@ -26024,7 +26039,7 @@ component values and static subtypes also lead to simpler code. @end menu @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{41c}@anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{41d} +@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{41d}@anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{41e} @subsection Static constant aggregates with static bounds @@ -26071,7 +26086,7 @@ Zero2: constant two_dim := (others => (others => 0)); @end example @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{41e}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{41f} +@anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{41f}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{420} @subsection Constant aggregates with unconstrained nominal types @@ -26086,7 +26101,7 @@ Cr_Unc : constant One_Unc := (12,24,36); @end example @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{420}@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{421} +@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{421}@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{422} @subsection Aggregates with static bounds @@ -26114,7 +26129,7 @@ end loop; @end example @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{422}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{423} +@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{423}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{424} @subsection Aggregates with nonstatic bounds @@ -26125,7 +26140,7 @@ have to be applied to sub-arrays individually, if they do not have statically compatible subtypes. @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates -@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{424}@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{425} +@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{425}@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{426} @subsection Aggregates in assignment statements @@ -26167,7 +26182,7 @@ a temporary (created either by the front-end or the code generator) and then that temporary will be copied onto the target. @node The Size of Discriminated Records with Default Discriminants,Image Values For Nonscalar Types,Code Generation for Array Aggregates,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{426}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{427} +@anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{427}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{428} @section The Size of Discriminated Records with Default Discriminants @@ -26247,7 +26262,7 @@ say) must be consistent, so it is imperative that the object, once created, remain invariant. @node Image Values For Nonscalar Types,Strict Conformance to the Ada Reference Manual,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{428}@anchor{gnat_rm/implementation_of_specific_ada_features image-values-for-nonscalar-types}@anchor{429} +@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{429}@anchor{gnat_rm/implementation_of_specific_ada_features image-values-for-nonscalar-types}@anchor{42a} @section Image Values For Nonscalar Types @@ -26267,7 +26282,7 @@ control of image text is required for some type T, then T’Put_Image should be explicitly specified. @node Strict Conformance to the Ada Reference Manual,,Image Values For Nonscalar Types,Implementation of Specific Ada Features -@anchor{gnat_rm/implementation_of_specific_ada_features id15}@anchor{42a}@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{42b} +@anchor{gnat_rm/implementation_of_specific_ada_features id15}@anchor{42b}@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{42c} @section Strict Conformance to the Ada Reference Manual @@ -26294,7 +26309,7 @@ behavior (although at the cost of a significant performance penalty), so infinite and NaN values are properly generated. @node Implementation of Ada 2012 Features,GNAT language extensions,Implementation of Specific Ada Features,Top -@anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{42c}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{42d}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14} +@anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{42d}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{42e}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14} @chapter Implementation of Ada 2012 Features @@ -28460,7 +28475,7 @@ RM References: H.04 (8/1) @end itemize @node GNAT language extensions,Security Hardening Features,Implementation of Ada 2012 Features,Top -@anchor{gnat_rm/gnat_language_extensions doc}@anchor{42e}@anchor{gnat_rm/gnat_language_extensions gnat-language-extensions}@anchor{42f}@anchor{gnat_rm/gnat_language_extensions id1}@anchor{430} +@anchor{gnat_rm/gnat_language_extensions doc}@anchor{42f}@anchor{gnat_rm/gnat_language_extensions gnat-language-extensions}@anchor{430}@anchor{gnat_rm/gnat_language_extensions id1}@anchor{431} @chapter GNAT language extensions @@ -28491,7 +28506,7 @@ prototyping phase. @end menu @node How to activate the extended GNAT Ada superset,Curated Extensions,,GNAT language extensions -@anchor{gnat_rm/gnat_language_extensions how-to-activate-the-extended-gnat-ada-superset}@anchor{431} +@anchor{gnat_rm/gnat_language_extensions how-to-activate-the-extended-gnat-ada-superset}@anchor{432} @section How to activate the extended GNAT Ada superset @@ -28530,7 +28545,7 @@ for serious projects, and is only means as a playground/technology preview. @end cartouche @node Curated Extensions,Experimental Language Extensions,How to activate the extended GNAT Ada superset,GNAT language extensions -@anchor{gnat_rm/gnat_language_extensions curated-extensions}@anchor{432}@anchor{gnat_rm/gnat_language_extensions curated-language-extensions}@anchor{66} +@anchor{gnat_rm/gnat_language_extensions curated-extensions}@anchor{433}@anchor{gnat_rm/gnat_language_extensions curated-language-extensions}@anchor{66} @section Curated Extensions @@ -28547,7 +28562,7 @@ for serious projects, and is only means as a playground/technology preview. @end menu @node Conditional when constructs,Case pattern matching,,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{433} +@anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{434} @subsection Conditional when constructs @@ -28619,7 +28634,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst} @node Case pattern matching,Fixed lower bounds for array types and subtypes,Conditional when constructs,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions case-pattern-matching}@anchor{434} +@anchor{gnat_rm/gnat_language_extensions case-pattern-matching}@anchor{435} @subsection Case pattern matching @@ -28751,7 +28766,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-pattern-matching.rst} @node Fixed lower bounds for array types and subtypes,Prefixed-view notation for calls to primitive subprograms of untagged types,Case pattern matching,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions fixed-lower-bounds-for-array-types-and-subtypes}@anchor{435} +@anchor{gnat_rm/gnat_language_extensions fixed-lower-bounds-for-array-types-and-subtypes}@anchor{436} @subsection Fixed lower bounds for array types and subtypes @@ -28805,7 +28820,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-fixed-lower-bound.rst} @node Prefixed-view notation for calls to primitive subprograms of untagged types,Expression defaults for generic formal functions,Fixed lower bounds for array types and subtypes,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions prefixed-view-notation-for-calls-to-primitive-subprograms-of-untagged-types}@anchor{436} +@anchor{gnat_rm/gnat_language_extensions prefixed-view-notation-for-calls-to-primitive-subprograms-of-untagged-types}@anchor{437} @subsection Prefixed-view notation for calls to primitive subprograms of untagged types @@ -28858,7 +28873,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-prefixed-untagged.rst} @node Expression defaults for generic formal functions,String interpolation,Prefixed-view notation for calls to primitive subprograms of untagged types,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions expression-defaults-for-generic-formal-functions}@anchor{437} +@anchor{gnat_rm/gnat_language_extensions expression-defaults-for-generic-formal-functions}@anchor{438} @subsection Expression defaults for generic formal functions @@ -28887,7 +28902,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-expression-functions-as-default-for-generic-formal-function-parameters.rst} @node String interpolation,Constrained attribute for generic objects,Expression defaults for generic formal functions,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions string-interpolation}@anchor{438} +@anchor{gnat_rm/gnat_language_extensions string-interpolation}@anchor{439} @subsection String interpolation @@ -29053,7 +29068,7 @@ Here is a link to the original RFC : @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.rst} @node Constrained attribute for generic objects,Static aspect on intrinsic functions,String interpolation,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions constrained-attribute-for-generic-objects}@anchor{439} +@anchor{gnat_rm/gnat_language_extensions constrained-attribute-for-generic-objects}@anchor{43a} @subsection Constrained attribute for generic objects @@ -29061,7 +29076,7 @@ The @code{Constrained} attribute is permitted for objects of generic types. The result indicates whether the corresponding actual is constrained. @node Static aspect on intrinsic functions,,Constrained attribute for generic objects,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions static-aspect-on-intrinsic-functions}@anchor{43a} +@anchor{gnat_rm/gnat_language_extensions static-aspect-on-intrinsic-functions}@anchor{43b} @subsection @code{Static} aspect on intrinsic functions @@ -29070,7 +29085,7 @@ and the compiler will evaluate some of these intrinsics statically, in particular the @code{Shift_Left} and @code{Shift_Right} intrinsics. @node Experimental Language Extensions,,Curated Extensions,GNAT language extensions -@anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{67}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{43b} +@anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{67}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{43c} @section Experimental Language Extensions @@ -29081,7 +29096,7 @@ particular the @code{Shift_Left} and @code{Shift_Right} intrinsics. @end menu @node Pragma Storage_Model,Simpler accessibility model,,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions pragma-storage-model}@anchor{43c} +@anchor{gnat_rm/gnat_language_extensions pragma-storage-model}@anchor{43d} @subsection Pragma Storage_Model @@ -29096,7 +29111,7 @@ Here is a link to the full RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-storage-model.rst} @node Simpler accessibility model,,Pragma Storage_Model,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions simpler-accessibility-model}@anchor{43d} +@anchor{gnat_rm/gnat_language_extensions simpler-accessibility-model}@anchor{43e} @subsection Simpler accessibility model @@ -29109,7 +29124,7 @@ Here is a link to the full RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-simpler-accessibility.md} @node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top -@anchor{gnat_rm/security_hardening_features doc}@anchor{43e}@anchor{gnat_rm/security_hardening_features id1}@anchor{43f}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} +@anchor{gnat_rm/security_hardening_features doc}@anchor{43f}@anchor{gnat_rm/security_hardening_features id1}@anchor{440}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} @chapter Security Hardening Features @@ -29131,7 +29146,7 @@ change. @end menu @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features -@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{440} +@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{441} @section Register Scrubbing @@ -29161,7 +29176,7 @@ programming languages, see @cite{Using the GNU Compiler Collection (GCC)}. @c Stack Scrubbing: @node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{441} +@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{442} @section Stack Scrubbing @@ -29305,7 +29320,7 @@ Bar_Callable_Ptr. @c Hardened Conditionals: @node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{442} +@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{443} @section Hardened Conditionals @@ -29395,7 +29410,7 @@ be used with other programming languages supported by GCC. @c Hardened Booleans: @node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{443} +@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{444} @section Hardened Booleans @@ -29456,7 +29471,7 @@ and more details on that attribute, see @cite{Using the GNU Compiler Collection @c Control Flow Redundancy: @node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features -@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{444} +@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{445} @section Control Flow Redundancy @@ -29616,7 +29631,7 @@ see @cite{Using the GNU Compiler Collection (GCC)}. These options can be used with other programming languages supported by GCC. @node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top -@anchor{gnat_rm/obsolescent_features doc}@anchor{445}@anchor{gnat_rm/obsolescent_features id1}@anchor{446}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} +@anchor{gnat_rm/obsolescent_features doc}@anchor{446}@anchor{gnat_rm/obsolescent_features id1}@anchor{447}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} @chapter Obsolescent Features @@ -29635,7 +29650,7 @@ compatibility purposes. @end menu @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id2}@anchor{447}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{448} +@anchor{gnat_rm/obsolescent_features id2}@anchor{448}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{449} @section pragma No_Run_Time @@ -29648,7 +29663,7 @@ preferred usage is to use an appropriately configured run-time that includes just those features that are to be made accessible. @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id3}@anchor{449}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{44a} +@anchor{gnat_rm/obsolescent_features id3}@anchor{44a}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{44b} @section pragma Ravenscar @@ -29657,7 +29672,7 @@ The pragma @code{Ravenscar} has exactly the same effect as pragma is part of the new Ada 2005 standard. @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id4}@anchor{44b}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{44c} +@anchor{gnat_rm/obsolescent_features id4}@anchor{44c}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{44d} @section pragma Restricted_Run_Time @@ -29667,7 +29682,7 @@ preferred since the Ada 2005 pragma @code{Profile} is intended for this kind of implementation dependent addition. @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id5}@anchor{44d}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{44e} +@anchor{gnat_rm/obsolescent_features id5}@anchor{44e}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{44f} @section pragma Task_Info @@ -29693,7 +29708,7 @@ in the spec of package System.Task_Info in the runtime library. @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features -@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{44f}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{450} +@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{450}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{451} @section package System.Task_Info (@code{s-tasinf.ads}) @@ -29703,7 +29718,7 @@ to support the @code{Task_Info} pragma. The predefined Ada package standard replacement for GNAT’s @code{Task_Info} functionality. @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top -@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{451}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{452} +@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{452}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{453} @chapter Compatibility and Porting Guide @@ -29725,7 +29740,7 @@ applications developed in other Ada environments. @end menu @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{453}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{454} +@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{454}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{455} @section Writing Portable Fixed-Point Declarations @@ -29847,7 +29862,7 @@ If you follow this scheme you will be guaranteed that your fixed-point types will be portable. @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{455}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{456} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{456}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{457} @section Compatibility with Ada 83 @@ -29875,7 +29890,7 @@ following subsections treat the most likely issues to be encountered. @end menu @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{457}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{458} +@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{458}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{459} @subsection Legal Ada 83 programs that are illegal in Ada 95 @@ -29975,7 +29990,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration. @end itemize @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{45a} +@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{45a}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{45b} @subsection More deterministic semantics @@ -30003,7 +30018,7 @@ which open select branches are executed. @end itemize @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{45b}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{45c} +@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{45c}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{45d} @subsection Changed semantics @@ -30045,7 +30060,7 @@ covers only the restricted range. @end itemize @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{45d}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{45e} +@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{45e}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{45f} @subsection Other language compatibility issues @@ -30078,7 +30093,7 @@ include @code{pragma Interface} and the floating point type attributes @end itemize @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{45f}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{460} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{460}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{461} @section Compatibility between Ada 95 and Ada 2005 @@ -30150,7 +30165,7 @@ can declare a function returning a value from an anonymous access type. @end itemize @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{461}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{462} +@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{462}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{463} @section Implementation-dependent characteristics @@ -30173,7 +30188,7 @@ transition from certain Ada 83 compilers. @end menu @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{463}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{464} +@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{464}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{465} @subsection Implementation-defined pragmas @@ -30195,7 +30210,7 @@ avoiding compiler rejection of units that contain such pragmas; they are not relevant in a GNAT context and hence are not otherwise implemented. @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{465}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{466} +@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{466}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{467} @subsection Implementation-defined attributes @@ -30209,7 +30224,7 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and @code{Type_Class}. @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{467}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{468} +@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{468}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{469} @subsection Libraries @@ -30238,7 +30253,7 @@ be preferable to retrofit the application using modular types. @end itemize @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{469}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{46a} +@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{46a}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{46b} @subsection Elaboration order @@ -30274,7 +30289,7 @@ pragmas either globally (as an effect of the `-gnatE' switch) or locally @end itemize @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{46b}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{46c} +@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{46c}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{46d} @subsection Target-specific aspects @@ -30287,10 +30302,10 @@ on the robustness of the original design. Moreover, Ada 95 (and thus Ada 2005 and Ada 2012) are sometimes incompatible with typical Ada 83 compiler practices regarding implicit packing, the meaning of the Size attribute, and the size of access values. -GNAT’s approach to these issues is described in @ref{46d,,Representation Clauses}. +GNAT’s approach to these issues is described in @ref{46e,,Representation Clauses}. @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{46e}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{46f} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{46f}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{470} @section Compatibility with Other Ada Systems @@ -30333,7 +30348,7 @@ far beyond this minimal set, as described in the next section. @end itemize @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{470}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{46d} +@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{471}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{46e} @section Representation Clauses @@ -30426,7 +30441,7 @@ with thin pointers. @end itemize @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{471}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{472} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{472}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{473} @section Compatibility with HP Ada 83 @@ -30456,7 +30471,7 @@ extension of package System. @end itemize @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top -@anchor{share/gnu_free_documentation_license doc}@anchor{473}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{474} +@anchor{share/gnu_free_documentation_license doc}@anchor{474}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{475} @chapter GNU Free Documentation License diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index f119e9f..88123df 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -19,7 +19,7 @@ @copying @quotation -GNAT User's Guide for Native Platforms , May 09, 2023 +GNAT User's Guide for Native Platforms , Jun 01, 2023 AdaCore @@ -590,12 +590,12 @@ using the GNU make utility with GNAT. @item @ref{b,,GNAT Utility Programs} explains the various utility programs that -are included in the GNAT environment +are included in the GNAT environment. @item @ref{c,,GNAT and Program Execution} covers a number of topics related to -running, debugging, and tuning the performace of programs developed -with GNAT +running, debugging, and tuning the performance of programs developed +with GNAT. @end itemize Appendices cover several additional topics: @@ -606,7 +606,7 @@ Appendices cover several additional topics: @item @ref{d,,Platform-Specific Information} describes the different run-time library implementations and also presents information on how to use -GNAT on several specific platforms +GNAT on several specific platforms. @item @ref{e,,Example of Binder Output File} shows the source code for the binder @@ -1288,7 +1288,7 @@ lowercase equivalence. @item `ISO 8859-15 (Latin-9)' ISO 8859-15 (Latin-9) letters allowed in identifiers, with uppercase and -lowercase equivalence +lowercase equivalence. @end table @geindex code page 437 (IBM PC) @@ -3231,8 +3231,8 @@ default, that contains calls to the elaboration procedures of those compilation unit that require them, followed by a call to the main program. This Ada program is compiled to generate the object file for the main program. The name of -the Ada file is @code{b~xxx}.adb` (with the corresponding spec -@code{b~xxx}.ads`) where @code{xxx} is the name of the +the Ada file is @code{b~xxx.adb} (with the corresponding spec +@code{b~xxx.ads}) where @code{xxx} is the name of the main program unit. Finally, the linker is used to build the resulting executable program, @@ -5366,7 +5366,7 @@ elaboration of the GNAT components. Consult the documentation of the other Ada compiler for further details on elaboration. However, it is not possible to mix the tasking run time of GNAT and -HP Ada 83, All the tasking operations must either be entirely within +HP Ada 83, all the tasking operations must either be entirely within GNAT compiled sections of the program, or entirely within HP Ada 83 compiled sections of the program. @end table @@ -5537,24 +5537,20 @@ The corresponding operator declaration must have parameters and result type that have the same root numeric type (for example, all three are long_float types). This simplifies the definition of operations that use type checking to perform dimensional checks: -@end itemize @example - type Distance is new Long_Float; - type Time is new Long_Float; - type Velocity is new Long_Float; - function "/" (D : Distance; T : Time) - return Velocity; - pragma Import (Intrinsic, "/"); +type Distance is new Long_Float; +type Time is new Long_Float; +type Velocity is new Long_Float; +function "/" (D : Distance; T : Time) + return Velocity; +pragma Import (Intrinsic, "/"); +@end example This common idiom is often programmed with a generic definition and an explicit body. The pragma makes it simpler to introduce such declarations. It incurs no overhead in compilation time or code size, because it is implemented as a single machine instruction. -@end example - - -@itemize * @item General subprogram entities. This is used to bind an Ada subprogram @@ -5724,7 +5720,10 @@ $ gnatmake ada_unit -largs file1.o file2.o --LINK=g++ @item Using GNAT and G++ from two different GCC installations: If both -compilers are on the :envvar`PATH`, the previous method may be used. It is +compilers are on the +@geindex PATH +@geindex environment variable; PATH +@code{PATH}, the previous method may be used. It is important to note that environment variables such as @geindex C_INCLUDE_PATH @geindex environment variable; C_INCLUDE_PATH diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index a4c32e9..edb90a9 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -312,6 +312,7 @@ package body Inline is -- Remove all aspects and/or pragmas that have no meaning in inlined body -- Body_Decl. The analysis of these items is performed on the non-inlined -- body. The items currently removed are: + -- Always_Terminates -- Contract_Cases -- Global -- Depends @@ -5225,7 +5226,8 @@ package body Inline is end if; if Present (Item_Id) - and then Chars (Item_Id) in Name_Contract_Cases + and then Chars (Item_Id) in Name_Always_Terminates + | Name_Contract_Cases | Name_Global | Name_Depends | Name_Exceptional_Cases diff --git a/gcc/ada/libgnarl/s-osinte__qnx.adb b/gcc/ada/libgnarl/s-osinte__qnx.adb index bf08ecb..127d179 100644 --- a/gcc/ada/libgnarl/s-osinte__qnx.adb +++ b/gcc/ada/libgnarl/s-osinte__qnx.adb @@ -87,7 +87,7 @@ package body System.OS_Interface is (Prio : System.Any_Priority) return Interfaces.C.int is begin - return Interfaces.C.int (Prio) + 1; + return Interfaces.C.int (Prio); end To_Target_Priority; ----------------- diff --git a/gcc/ada/libgnat/a-strsup.ads b/gcc/ada/libgnat/a-strsup.ads index 7a8a2ba..2e0cd98 100644 --- a/gcc/ada/libgnat/a-strsup.ads +++ b/gcc/ada/libgnat/a-strsup.ads @@ -69,7 +69,7 @@ package Ada.Strings.Superbounded with SPARK_Mode is -- Leaving it out is more efficient. end record with - Predicate => + Ghost_Predicate => Current_Length <= Max_Length and then Data (1 .. Current_Length)'Initialized, Put_Image => Put_Image; diff --git a/gcc/ada/libgnat/s-stoele.ads b/gcc/ada/libgnat/s-stoele.ads index 3262d03..7de150d 100644 --- a/gcc/ada/libgnat/s-stoele.ads +++ b/gcc/ada/libgnat/s-stoele.ads @@ -43,6 +43,9 @@ package System.Storage_Elements is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada 2005, -- this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + pragma Annotate (GNATprove, Always_Return, Storage_Elements); type Storage_Offset is range -Memory_Size / 2 .. Memory_Size / 2 - 1; diff --git a/gcc/ada/libgnat/system-qnx-arm.ads b/gcc/ada/libgnat/system-qnx-arm.ads index 344bd61..1dd1a22 100644 --- a/gcc/ada/libgnat/system-qnx-arm.ads +++ b/gcc/ada/libgnat/system-qnx-arm.ads @@ -95,22 +95,20 @@ package System is -- Priority-related Declarations (RM D.1) - -- System priority is Ada priority + 1, so lies in the range 1 .. 63. - -- -- If the scheduling policy is SCHED_FIFO or SCHED_RR the runtime makes use -- of the entire range provided by the system. -- -- If the scheduling policy is SCHED_OTHER the only valid system priority -- is 1 and other values are simply ignored. - Max_Priority : constant Positive := 61; - Max_Interrupt_Priority : constant Positive := 62; + Max_Priority : constant Positive := 62; + Max_Interrupt_Priority : constant Positive := 63; - subtype Any_Priority is Integer range 0 .. 62; - subtype Priority is Any_Priority range 0 .. 61; - subtype Interrupt_Priority is Any_Priority range 62 .. 62; + subtype Any_Priority is Integer range 1 .. 63; + subtype Priority is Any_Priority range 1 .. 62; + subtype Interrupt_Priority is Any_Priority range 63 .. 63; - Default_Priority : constant Priority := 30; + Default_Priority : constant Priority := 10; private diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index ac50c84..b139862 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -1315,6 +1315,7 @@ begin | Pragma_Aggregate_Individually_Assign | Pragma_All_Calls_Remote | Pragma_Allow_Integer_Address + | Pragma_Always_Terminates | Pragma_Annotate | Pragma_Assert | Pragma_Assert_And_Cut diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 7304626..3918946 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1331,9 +1331,9 @@ package body Sem_Aggr is -- In this event we do not resolve Expr unless expansion is disabled. -- To know why, see the DELAYED COMPONENT RESOLUTION note above. -- - -- NOTE: In the case of "... => <>", we pass the in the - -- N_Component_Association node as Expr, since there is no Expression in - -- that case, and we need a Sloc for the error message. + -- NOTE: In the case of "... => <>", we pass the N_Component_Association + -- node as Expr, since there is no Expression and we need a Sloc for the + -- error message. procedure Resolve_Iterated_Component_Association (N : Node_Id; @@ -1790,7 +1790,7 @@ package body Sem_Aggr is Choice : Node_Id; Dummy : Boolean; Scop : Entity_Id; - Expr : Node_Id; + Expr : constant Node_Id := Expression (N); -- Start of processing for Resolve_Iterated_Component_Association @@ -1854,17 +1854,13 @@ package body Sem_Aggr is Set_Scope (Id, Scop); end if; - -- Analyze expression without expansion, to verify legality. + -- Analyze expression without expansion, to verify legality. -- When generating code, we then remove references to the index -- variable, because the expression will be analyzed anew after -- rewritting as a loop with a new index variable; when not -- generating code we leave the analyzed expression as it is. - Expr := Expression (N); - - Expander_Mode_Save_And_Set (False); Dummy := Resolve_Aggr_Expr (Expr, Single_Elmt => False); - Expander_Mode_Restore; if Operating_Mode /= Check_Semantics then Remove_References (Expr); @@ -2171,9 +2167,11 @@ package body Sem_Aggr is if Is_Type (E) and then Has_Predicates (E) then Freeze_Before (N, E); - if Has_Dynamic_Predicate_Aspect (E) then + if Has_Dynamic_Predicate_Aspect (E) + or else Has_Ghost_Predicate_Aspect (E) + then Error_Msg_NE - ("subtype& has dynamic predicate, not allowed " + ("subtype& has non-static predicate, not allowed " & "in aggregate choice", Choice, E); elsif not Is_OK_Static_Subtype (E) then @@ -2356,10 +2354,12 @@ package body Sem_Aggr is Resolve_Discrete_Subtype_Indication (Choice, Index_Base); if Has_Dynamic_Predicate_Aspect - (Entity (Subtype_Mark (Choice))) + (Entity (Subtype_Mark (Choice))) + or else Has_Ghost_Predicate_Aspect + (Entity (Subtype_Mark (Choice))) then Error_Msg_NE - ("subtype& has dynamic predicate, " + ("subtype& has non-static predicate, " & "not allowed in aggregate choice", Choice, Entity (Subtype_Mark (Choice))); end if; diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index f5ee275..7a47abd 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -41,6 +41,7 @@ with Exp_Dist; use Exp_Dist; with Exp_Util; use Exp_Util; with Expander; use Expander; with Freeze; use Freeze; +with Ghost; use Ghost; with Gnatvsn; use Gnatvsn; with Itypes; use Itypes; with Lib; use Lib; @@ -4783,8 +4784,9 @@ package body Sem_Attr is Loop_Decl : constant Node_Id := Label_Construct (Parent (Loop_Id)); function Check_Reference (Nod : Node_Id) return Traverse_Result; - -- Determine whether a reference mentions an entity declared - -- within the related loop. + -- Detect attribute 'Loop_Entry in prefix P and determine whether + -- a reference mentions an entity declared within the related + -- loop. function Declared_Within (Nod : Node_Id) return Boolean; -- Determine whether Nod appears in the subtree of Loop_Decl but @@ -4795,8 +4797,22 @@ package body Sem_Attr is --------------------- function Check_Reference (Nod : Node_Id) return Traverse_Result is + Orig_Nod : constant Node_Id := Original_Node (Nod); + -- Check presence of Loop_Entry in the prefix P by looking at + -- the original node for Nod, as it will have been rewritten + -- into its own prefix if the assertion is ignored (see code + -- below). + begin - if Nkind (Nod) = N_Identifier + if Is_Attribute_Loop_Entry (Orig_Nod) then + Error_Msg_Name_1 := Name_Loop_Entry; + Error_Msg_Name_2 := Name_Loop_Entry; + Error_Msg_N + ("attribute % cannot appear in the prefix of attribute %", + Nod); + return Abandon; + + elsif Nkind (Nod) = N_Identifier and then Present (Entity (Nod)) and then Declared_Within (Declaration_Node (Entity (Nod))) then @@ -8436,9 +8452,13 @@ package body Sem_Attr is -- However, the attribute Unconstrained_Array must be evaluated, -- since it is documented to be a static attribute (and can for -- example appear in a Compile_Time_Warning pragma). The frozen - -- status of the type does not affect its evaluation. + -- status of the type does not affect its evaluation. Likewise + -- for attributes intended to be used with generic definitions. - and then Id /= Attribute_Unconstrained_Array + and then Id not in Attribute_Unconstrained_Array + | Attribute_Has_Access_Values + | Attribute_Has_Discriminants + | Attribute_Has_Tagged_Values then return; end if; @@ -11068,6 +11088,12 @@ package body Sem_Attr is Set_Etype (N, Typ); end if; + -- A Ghost attribute must appear in a specific context + + if Is_Ghost_Attribute_Reference (N) then + Check_Ghost_Context (Empty, N); + end if; + -- Remaining processing depends on attribute case Attr_Id is diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index 0a47bf9..0842f94 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -3686,6 +3686,7 @@ package body Sem_Case is if not Is_Discrete_Type (E) or else not Has_Static_Predicate (E) or else Has_Dynamic_Predicate_Aspect (E) + or else Has_Ghost_Predicate_Aspect (E) then Bad_Predicated_Subtype_Use ("cannot use subtype& with non-static " diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 2562d1a0..f584a9f 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -261,9 +261,10 @@ package body Sem_Ch12 is -- as annotations: -- package subprogram [body] - -- Abstract_State Contract_Cases - -- Initial_Condition Depends - -- Initializes Exceptional_Cases + -- Abstract_State Always_Terminates + -- Initial_Condition Contract_Cases + -- Initializes Depends + -- Exceptional_Cases -- Extensions_Visible -- Global -- package body Post @@ -8178,6 +8179,7 @@ package body Sem_Ch12 is and then Is_Entity_Name (Name (Assoc)) then Set_Entity (New_N, Entity (Name (Assoc))); + Check_Private_View (N); elsif Nkind (Assoc) in N_Entity and then (Expander_Active @@ -15716,6 +15718,13 @@ package body Sem_Ch12 is -- This is the recursive procedure that does the work, once the -- enclosing generic scope has been established. + procedure Set_Global_Type (N : Node_Id; N2 : Node_Id); + -- If the type of N2 is global to the generic unit, save the type in + -- the generic node. Just as we perform name capture for explicit + -- references within the generic, we must capture the global types + -- of local entities because they may participate in resolution in + -- the instance. + --------------- -- Is_Global -- --------------- @@ -15909,67 +15918,12 @@ package body Sem_Ch12 is ------------------ procedure Reset_Entity (N : Node_Id) is - procedure Set_Global_Type (N : Node_Id; N2 : Node_Id); - -- If the type of N2 is global to the generic unit, save the type in - -- the generic node. Just as we perform name capture for explicit - -- references within the generic, we must capture the global types - -- of local entities because they may participate in resolution in - -- the instance. - function Top_Ancestor (E : Entity_Id) return Entity_Id; -- Find the ultimate ancestor of the current unit. If it is not a -- generic unit, then the name of the current unit in the prefix of -- an expanded name must be replaced with its generic homonym to -- ensure that it will be properly resolved in an instance. - --------------------- - -- Set_Global_Type -- - --------------------- - - procedure Set_Global_Type (N : Node_Id; N2 : Node_Id) is - Typ : constant Entity_Id := Etype (N2); - - begin - Set_Etype (N, Typ); - - -- If the entity of N is not the associated node, this is a - -- nested generic and it has an associated node as well, whose - -- type is already the full view (see below). Indicate that the - -- original node has a private view. - - if Entity (N) /= N2 and then Has_Private_View (Entity (N)) then - Set_Has_Private_View (N); - end if; - - -- If not a private type, nothing else to do - - if not Is_Private_Type (Typ) then - null; - - -- If it is a derivation of a private type in a context where no - -- full view is needed, nothing to do either. - - elsif No (Full_View (Typ)) and then Typ /= Etype (Typ) then - null; - - -- Otherwise mark the type for flipping and use the full view when - -- available. - - else - Set_Has_Private_View (N); - - if Present (Full_View (Typ)) then - Set_Etype (N2, Full_View (Typ)); - end if; - end if; - - if Is_Floating_Point_Type (Typ) - and then Has_Dimension_System (Typ) - then - Copy_Dimensions (N2, N); - end if; - end Set_Global_Type; - ------------------ -- Top_Ancestor -- ------------------ @@ -16573,7 +16527,7 @@ package body Sem_Ch12 is E := Entity (Name (N2)); if Present (E) and then Is_Global (E) then - Set_Etype (N, Etype (N2)); + Set_Global_Type (N, N2); else Set_Associated_Node (N, Empty); Set_Etype (N, Empty); @@ -16678,7 +16632,7 @@ package body Sem_Ch12 is E := Entity (Name (N2)); if Present (E) and then Is_Global (E) then - Set_Etype (N, Etype (N2)); + Set_Global_Type (N, N2); else Set_Associated_Node (N, Empty); Set_Etype (N, Empty); @@ -16845,6 +16799,54 @@ package body Sem_Ch12 is end if; end Save_References; + --------------------- + -- Set_Global_Type -- + --------------------- + + procedure Set_Global_Type (N : Node_Id; N2 : Node_Id) is + Typ : constant Entity_Id := Etype (N2); + + begin + Set_Etype (N, Typ); + + -- If the entity of N is not the associated node, this is a + -- nested generic and it has an associated node as well, whose + -- type is already the full view (see below). Indicate that the + -- original node has a private view. + + if Entity (N) /= N2 and then Has_Private_View (Entity (N)) then + Set_Has_Private_View (N); + end if; + + -- If not a private type, nothing else to do + + if not Is_Private_Type (Typ) then + null; + + -- If it is a derivation of a private type in a context where no + -- full view is needed, nothing to do either. + + elsif No (Full_View (Typ)) and then Typ /= Etype (Typ) then + null; + + -- Otherwise mark the type for flipping and use the full view when + -- available. + + else + Set_Has_Private_View (N); + + if Present (Full_View (Typ)) then + Set_Etype (N2, Full_View (Typ)); + end if; + end if; + + if Is_Floating_Point_Type (Typ) + and then Has_Dimension_System (Typ) + then + Copy_Dimensions (N2, N); + end if; + end Set_Global_Type; + -- Start of processing for Save_Global_References begin diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 85c9d92..6562732 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1407,21 +1407,39 @@ package body Sem_Ch13 is Is_Instance : Boolean := False); -- Subsidiary to the analysis of aspects -- Abstract_State + -- Always_Terminates -- Attach_Handler + -- Async_Readers + -- Async_Writers + -- Constant_After_Elaboration -- Contract_Cases + -- Convention + -- Default_Initial_Condition + -- Default_Storage_Pool -- Depends + -- Effective_Reads + -- Effective_Writes -- Exceptional_Cases + -- Extensions_Visible -- Ghost -- Global -- Initial_Condition -- Initializes + -- Max_Entry_Queue_Depth + -- Max_Entry_Queue_Length + -- Max_Queue_Length + -- No_Caching + -- Part_Of -- Post -- Pre -- Refined_Depends -- Refined_Global + -- Refined_Post -- Refined_State -- SPARK_Mode + -- Secondary_Stack_Size -- Subprogram_Variant + -- Volatile_Function -- Warnings -- Insert pragma Prag such that it mimics the placement of a source -- pragma of the same kind. Flag Is_Generic should be set when the @@ -1667,10 +1685,11 @@ package body Sem_Ch13 is -- analyzed right now. -- Note that there is a special handling for Pre, Post, Test_Case, - -- Contract_Cases, Exceptional_Cases and Subprogram_Variant aspects. - -- In these cases, we do not have to worry about delay issues, since the - -- pragmas themselves deal with delay of visibility for the expression - -- analysis. Thus, we just insert the pragma after the node N. + -- Contract_Cases, Always_Terminates, Exceptional_Cases and + -- Subprogram_Variant aspects. In these cases, we do not have to worry + -- about delay issues, since the pragmas themselves deal with delay of + -- visibility for the expression analysis. Thus, we just insert the + -- pragma after the node N. -- Loop through aspects @@ -3062,16 +3081,11 @@ package body Sem_Ch13 is Expression => Relocate_Node (Expr))), Pragma_Name => Name_Linker_Section); - -- Linker_Section does not need delaying, as its argument - -- must be a static string. Furthermore, if applied to - -- an object with an explicit initialization, the object - -- must be frozen in order to elaborate the initialization - -- code. (This is already done for types with implicit - -- initialization, such as protected types.) + -- No need to delay the processing if the entity is already + -- frozen. This should only happen for subprogram bodies. - if Nkind (N) = N_Object_Declaration - and then Has_Init_Expression (N) - then + if Is_Frozen (E) then + pragma Assert (Nkind (N) = N_Subprogram_Body); Delay_Required := False; end if; @@ -3108,6 +3122,7 @@ package body Sem_Ch13 is -- Dynamic_Predicate, Predicate, Static_Predicate when Aspect_Dynamic_Predicate + | Aspect_Ghost_Predicate | Aspect_Predicate | Aspect_Static_Predicate => @@ -3158,6 +3173,8 @@ package body Sem_Ch13 is elsif A_Id = Aspect_Static_Predicate then Set_Has_Static_Predicate_Aspect (E); + elsif A_Id = Aspect_Ghost_Predicate then + Set_Has_Ghost_Predicate_Aspect (E); end if; -- If the type is private, indicate that its completion @@ -3171,6 +3188,8 @@ package body Sem_Ch13 is Set_Has_Dynamic_Predicate_Aspect (Full_View (E)); elsif A_Id = Aspect_Static_Predicate then Set_Has_Static_Predicate_Aspect (Full_View (E)); + elsif A_Id = Aspect_Ghost_Predicate then + Set_Has_Ghost_Predicate_Aspect (Full_View (E)); end if; Set_Has_Delayed_Aspects (Full_View (E)); @@ -3216,8 +3235,9 @@ package body Sem_Ch13 is goto Continue; elsif not (Directly_Specified (E, Aspect_Dynamic_Predicate) - or else Directly_Specified (E, Aspect_Static_Predicate) - or else Directly_Specified (E, Aspect_Predicate)) + or else Directly_Specified (E, Aspect_Predicate) + or else Directly_Specified (E, Aspect_Ghost_Predicate) + or else Directly_Specified (E, Aspect_Static_Predicate)) then Error_Msg_N ("Predicate_Failure requires accompanying" & @@ -4291,9 +4311,9 @@ package body Sem_Ch13 is -- Case 4: Aspects requiring special handling - -- Pre/Post/Test_Case/Contract_Cases/Exceptional_Cases and - -- Subprogram_Variant whose corresponding pragmas take care - -- of the delay. + -- Pre/Post/Test_Case/Contract_Cases/Always_Terminates/ + -- Exceptional_Cases and Subprogram_Variant whose corresponding + -- pragmas take care of the delay. -- Pre/Post @@ -4525,6 +4545,19 @@ package body Sem_Ch13 is Insert_Pragma (Aitem); goto Continue; + -- Always_Terminates + + when Aspect_Always_Terminates => + Aitem := Make_Aitem_Pragma + (Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => Relocate_Node (Expr))), + Pragma_Name => Name_Always_Terminates); + + Decorate (Aspect, Aitem); + Insert_Pragma (Aitem); + goto Continue; + -- Exceptional_Cases when Aspect_Exceptional_Cases => @@ -4742,9 +4775,7 @@ package body Sem_Ch13 is -- For an aspect that applies to a type, indicate whether it -- appears on a partial view of the type. - if Is_Type (E) - and then Is_Private_Type (E) - then + if Is_Type (E) and then Is_Private_Type (E) then Set_Aspect_On_Partial_View (Aspect); end if; @@ -9945,7 +9976,7 @@ package body Sem_Ch13 is Expr : Node_Id; -- This is the expression for the result of the function. It is - -- is build by connecting the component predicates with AND THEN. + -- built by connecting the component predicates with AND THEN. Object_Name : Name_Id; -- Name for argument of Predicate procedure. Note that we use the same @@ -10095,6 +10126,16 @@ package body Sem_Ch13 is -- Start of processing for Add_Predicate begin + -- A ghost predicate is checked only when Ghost mode is enabled. + -- Add a condition for the presence of a predicate to be recorded, + -- which is needed to generate the corresponding predicate + -- function. + + if Is_Ignored_Ghost_Pragma (Prag) then + Add_Condition (New_Occurrence_Of (Standard_True, Sloc (Prag))); + return; + end if; + -- Mark corresponding SCO as enabled Set_SCO_Pragma_Enabled (Sloc (Prag)); @@ -10928,8 +10969,10 @@ package body Sem_Ch13 is -- also make its potential components accessible. if not Analyzed (Freeze_Expr) and then Inside_A_Generic then - if A_Id in Aspect_Dynamic_Predicate | Aspect_Predicate | - Aspect_Static_Predicate + if A_Id in Aspect_Dynamic_Predicate + | Aspect_Ghost_Predicate + | Aspect_Predicate + | Aspect_Static_Predicate then Push_Type (Ent); Preanalyze_Spec_Expression (Freeze_Expr, Standard_Boolean); @@ -10959,6 +11002,7 @@ package body Sem_Ch13 is if Present (Freeze_Expr) and then No (T) then if A_Id in Aspect_Dynamic_Predicate + | Aspect_Ghost_Predicate | Aspect_Predicate | Aspect_Priority | Aspect_Static_Predicate @@ -10987,6 +11031,7 @@ package body Sem_Ch13 is elsif A_Id in Aspect_CPU | Aspect_Dynamic_Predicate + | Aspect_Ghost_Predicate | Aspect_Predicate | Aspect_Priority | Aspect_Static_Predicate @@ -11240,6 +11285,7 @@ package body Sem_Ch13 is when Aspect_Dynamic_Predicate | Aspect_Invariant + | Aspect_Ghost_Predicate | Aspect_Predicate | Aspect_Static_Predicate | Aspect_Type_Invariant @@ -11294,6 +11340,7 @@ package body Sem_Ch13 is -- Here is the list of aspects that don't require delay analysis when Aspect_Abstract_State + | Aspect_Always_Terminates | Aspect_Annotate | Aspect_Async_Readers | Aspect_Async_Writers @@ -13249,6 +13296,7 @@ package body Sem_Ch13 is then if Get_Aspect_Id (Ritem) in Aspect_CPU | Aspect_Dynamic_Predicate + | Aspect_Ghost_Predicate | Aspect_Predicate | Aspect_Static_Predicate | Aspect_Priority @@ -15650,8 +15698,9 @@ package body Sem_Ch13 is null; when Aspect_Dynamic_Predicate - | Aspect_Static_Predicate + | Aspect_Ghost_Predicate | Aspect_Predicate + | Aspect_Static_Predicate => -- Preanalyze expression after type replacement to catch -- name resolution errors if the predicate function has diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 29733e9..a067711 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3253,13 +3253,6 @@ package body Sem_Ch3 is when N_Derived_Type_Definition => Derived_Type_Declaration (T, N, T /= Def_Id); - -- Inherit predicates from parent, and protect against illegal - -- derivations. - - if Is_Type (T) and then Has_Predicates (T) then - Set_Has_Predicates (Def_Id); - end if; - -- Save the scenario for examination by the ABE Processing -- phase. @@ -3659,9 +3652,11 @@ package body Sem_Ch3 is if not Is_Overloaded (E) then T := Etype (E); - if Has_Dynamic_Predicate_Aspect (T) then + if Has_Dynamic_Predicate_Aspect (T) + or else Has_Ghost_Predicate_Aspect (T) + then Error_Msg_N - ("subtype has dynamic predicate, " + ("subtype has non-static predicate, " & "not allowed in number declaration", N); end if; @@ -10122,15 +10117,9 @@ package body Sem_Ch3 is end if; end if; - -- We similarly inherit predicates. Note that for scalar derived types - -- the predicate is inherited from the first subtype, and not from its - -- (anonymous) base type. + -- We similarly inherit predicates - if Has_Predicates (Parent_Type) - or else Has_Predicates (First_Subtype (Parent_Type)) - then - Set_Has_Predicates (Derived_Type); - end if; + Inherit_Predicate_Flags (Derived_Type, Parent_Type, Only_Flags => True); -- The derived type inherits representation clauses from the parent -- type, and from any interfaces. diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index c76f287..b4b158a 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -1540,8 +1540,14 @@ package body Sem_Ch4 is Set_Etype (N, Full_View (Etype (N))); + -- If the call is within a thunk, the nonlimited view should be + -- analyzed eventually (see also Analyze_Return_Type). + elsif From_Limited_With (Etype (N)) and then Present (Non_Limited_View (Etype (N))) + and then + (Ekind (Non_Limited_View (Etype (N))) /= E_Incomplete_Type + or else Is_Thunk (Current_Scope)) then Set_Etype (N, Non_Limited_View (Etype (N))); @@ -3427,6 +3433,26 @@ package body Sem_Ch4 is Analyze_Set_Membership; + declare + Alt : Node_Id; + begin + Alt := First (Alternatives (N)); + while Present (Alt) loop + if Is_Entity_Name (Alt) and then Is_Type (Entity (Alt)) then + Check_Fully_Declared (Entity (Alt), Alt); + + if Has_Ghost_Predicate_Aspect (Entity (Alt)) then + Error_Msg_NE + ("subtype& has ghost predicate, " + & "not allowed in membership test", + Alt, Entity (Alt)); + end if; + end if; + + Next (Alt); + end loop; + end; + elsif Nkind (R) = N_Range or else (Nkind (R) = N_Attribute_Reference and then Attribute_Name (R) = Name_Range) @@ -3446,6 +3472,13 @@ package body Sem_Ch4 is Find_Type (R); Check_Fully_Declared (Entity (R), R); + if Has_Ghost_Predicate_Aspect (Entity (R)) then + Error_Msg_NE + ("subtype& has ghost predicate, " + & "not allowed in membership test", + R, Entity (R)); + end if; + elsif Ada_Version >= Ada_2012 and then Find_Interp then Op := Make_Op_Eq (Loc, Left_Opnd => L, Right_Opnd => R); Resolve_Membership_Equality (Op, Etype (L)); diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index f2fb0c7..fa36a5a 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -113,7 +113,7 @@ package body Sem_Ch5 is procedure Analyze_Assignment (N : Node_Id) is Lhs : constant Node_Id := Name (N); - Rhs : Node_Id := Expression (N); + Rhs : constant Node_Id := Expression (N); procedure Diagnose_Non_Variable_Lhs (N : Node_Id); -- N is the node for the left hand side of an assignment, and it is not @@ -137,27 +137,6 @@ package body Sem_Ch5 is -- nominal subtype. This procedure is used to deal with cases where the -- nominal subtype must be replaced by the actual subtype. - procedure Transform_BIP_Assignment (Typ : Entity_Id); - function Should_Transform_BIP_Assignment - (Typ : Entity_Id) return Boolean; - -- If the right-hand side of an assignment statement is a build-in-place - -- call we cannot build in place, so we insert a temp initialized with - -- the call, and transform the assignment statement to copy the temp. - -- Transform_BIP_Assignment does the transformation, and - -- Should_Transform_BIP_Assignment determines whether we should. - -- The same goes for qualified expressions and conversions whose - -- operand is such a call. - -- - -- This is only for nonlimited types; assignment statements are illegal - -- for limited types, but are generated internally for aggregates and - -- init procs. These limited-type are not really assignment statements - -- -- conceptually, they are initializations, so should not be - -- transformed. - -- - -- Similarly, for nonlimited types, aggregates and init procs generate - -- assignment statements that are really initializations. These are - -- marked No_Ctrl_Actions. - function Within_Function return Boolean; -- Determine whether the current scope is a function or appears within -- one. @@ -354,87 +333,6 @@ package body Sem_Ch5 is end if; end Set_Assignment_Type; - ------------------------------------- - -- Should_Transform_BIP_Assignment -- - ------------------------------------- - - function Should_Transform_BIP_Assignment - (Typ : Entity_Id) return Boolean - is - begin - if Expander_Active - and then not Is_Limited_View (Typ) - and then Is_Build_In_Place_Result_Type (Typ) - and then not No_Ctrl_Actions (N) - then - -- This function is called early, before name resolution is - -- complete, so we have to deal with things that might turn into - -- function calls later. N_Function_Call and N_Op nodes are the - -- obvious case. An N_Identifier or N_Expanded_Name is a - -- parameterless function call if it denotes a function. - -- Finally, an attribute reference can be a function call. - - declare - Unqual_Rhs : constant Node_Id := Unqual_Conv (Rhs); - begin - case Nkind (Unqual_Rhs) is - when N_Function_Call - | N_Op - => - return True; - - when N_Expanded_Name - | N_Identifier - => - return - Ekind (Entity (Unqual_Rhs)) in E_Function | E_Operator; - - -- T'Input will turn into a call whose result type is T - - when N_Attribute_Reference => - return Attribute_Name (Unqual_Rhs) = Name_Input; - - when others => - return False; - end case; - end; - else - return False; - end if; - end Should_Transform_BIP_Assignment; - - ------------------------------ - -- Transform_BIP_Assignment -- - ------------------------------ - - procedure Transform_BIP_Assignment (Typ : Entity_Id) is - - -- Tranform "X : [constant] T := F (...);" into: - -- - -- Temp : constant T := F (...); - -- X := Temp; - - Loc : constant Source_Ptr := Sloc (N); - Def_Id : constant Entity_Id := Make_Temporary (Loc, 'Y', Rhs); - Obj_Decl : constant Node_Id := - Make_Object_Declaration (Loc, - Defining_Identifier => Def_Id, - Constant_Present => True, - Object_Definition => New_Occurrence_Of (Typ, Loc), - Expression => Rhs, - Has_Init_Expression => True); - - begin - Set_Etype (Def_Id, Typ); - Set_Expression (N, New_Occurrence_Of (Def_Id, Loc)); - - -- At this point, Rhs is no longer equal to Expression (N), so: - - Rhs := Expression (N); - - Insert_Action (N, Obj_Decl); - end Transform_BIP_Assignment; - --------------------- -- Within_Function -- --------------------- @@ -610,56 +508,6 @@ package body Sem_Ch5 is end if; end if; - -- Deal with build-in-place calls for nonlimited types. We don't do this - -- later, because resolving the rhs tranforms it incorrectly for build- - -- in-place. - - if Should_Transform_BIP_Assignment (Typ => T1) then - - -- In certain cases involving user-defined concatenation operators, - -- we need to resolve the right-hand side before transforming the - -- assignment. - - case Nkind (Unqual_Conv (Rhs)) is - when N_Function_Call => - declare - Actual : Node_Id := - First (Parameter_Associations (Unqual_Conv (Rhs))); - Actual_Exp : Node_Id; - - begin - while Present (Actual) loop - if Nkind (Actual) = N_Parameter_Association then - Actual_Exp := Explicit_Actual_Parameter (Actual); - else - Actual_Exp := Actual; - end if; - - if Nkind (Actual_Exp) = N_Op_Concat then - Resolve (Rhs, T1); - exit; - end if; - - Next (Actual); - end loop; - end; - - when N_Attribute_Reference - | N_Expanded_Name - | N_Identifier - | N_Op - => - null; - - when others => - raise Program_Error; - end case; - - Transform_BIP_Assignment (Typ => T1); - end if; - - pragma Assert (not Should_Transform_BIP_Assignment (Typ => T1)); - -- The resulting assignment type is T1, so now we will resolve the left -- hand side of the assignment using this determined type. @@ -1303,8 +1151,6 @@ package body Sem_Ch5 is Full_Analysis := Save_Full_Analysis; Current_Assignment := Empty; end if; - - pragma Assert (not Should_Transform_BIP_Assignment (Typ => T1)); end if; end Analyze_Assignment; @@ -2859,10 +2705,10 @@ package body Sem_Ch5 is end if; end if; - if Present (Iterator_Filter (N)) then - -- Preanalyze the filter. Expansion will take place when enclosing - -- loop is expanded. + -- Preanalyze the filter. Expansion will take place when enclosing + -- loop is expanded. + if Present (Iterator_Filter (N)) then Preanalyze_And_Resolve (Iterator_Filter (N), Standard_Boolean); end if; end Analyze_Iterator_Specification; @@ -2969,7 +2815,8 @@ package body Sem_Ch5 is and then Has_Predicates (T) and then (not Has_Static_Predicate (T) or else not Is_Static_Subtype (T) - or else Has_Dynamic_Predicate_Aspect (T)) + or else Has_Dynamic_Predicate_Aspect (T) + or else Has_Ghost_Predicate_Aspect (T)) then -- Seems a confusing message for the case of a static predicate -- with a non-static subtype??? @@ -3577,8 +3424,11 @@ package body Sem_Ch5 is end; end if; + -- Preanalyze the filter. Expansion will take place when enclosing + -- loop is expanded. + if Present (Iterator_Filter (N)) then - Analyze_And_Resolve (Iterator_Filter (N), Standard_Boolean); + Preanalyze_And_Resolve (Iterator_Filter (N), Standard_Boolean); end if; -- A loop parameter cannot be effectively volatile (SPARK RM 7.1.3(4)). diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 1e18b98..dc81e47 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -15263,10 +15263,13 @@ package body Sem_Elab is -- Nothing to do for predefined primitives because they are -- artifacts of tagged type expansion and cannot override source -- primitives. Nothing to do as well for inherited primitives, as - -- the check concerns overriding ones. + -- the check concerns overriding ones. Finally, nothing to do for + -- abstract subprograms, because they have no body that could be + -- examined. if Is_Predefined_Dispatching_Operation (Prim) or else not Is_Overriding_Subprogram (Prim) + or else Is_Abstract_Subprogram (Prim) then return; end if; diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 4608b1b..f744ab3 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -434,6 +434,7 @@ package body Sem_Eval is if Is_Static_Expression (Expr) and then not Has_Dynamic_Predicate_Aspect (Typ) + and then not Has_Ghost_Predicate_Aspect (Typ) then if Static_Failure_Is_Error then Error_Msg_NE @@ -5673,12 +5674,15 @@ package body Sem_Eval is then return False; - -- If there is a dynamic predicate for the type (declared or inherited) - -- the expression is not static. + -- If there is a non-static predicate for the type (declared or + -- inherited) the expression is not static. elsif Has_Dynamic_Predicate_Aspect (Typ) or else (Is_Derived_Type (Typ) and then Has_Aspect (Typ, Aspect_Dynamic_Predicate)) + or else Has_Ghost_Predicate_Aspect (Typ) + or else (Is_Derived_Type (Typ) + and then Has_Aspect (Typ, Aspect_Ghost_Predicate)) or else (Has_Aspect (Typ, Aspect_Predicate) and then not Has_Static_Predicate (Typ)) then @@ -6372,10 +6376,13 @@ package body Sem_Eval is Etype (First_Formal (Entity (Name (Expr)))); begin - -- If the inherited predicate is dynamic, just ignore it. We can't - -- go trying to evaluate a dynamic predicate as a static one! + -- If the inherited predicate is not static, just ignore it. We + -- can't go trying to evaluate a dynamic predicate as a static + -- one! - if Has_Dynamic_Predicate_Aspect (Typ) then + if Has_Dynamic_Predicate_Aspect (Typ) + or else Has_Ghost_Predicate_Aspect (Typ) + then return True; -- Otherwise inherited predicate is static, check for match diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 0de410a..bcae43f 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -420,6 +420,81 @@ package body Sem_Prag is end if; end Adjust_External_Name_Case; + -------------------------------------------- + -- Analyze_Always_Terminates_In_Decl_Part -- + -------------------------------------------- + + procedure Analyze_Always_Terminates_In_Decl_Part + (N : Node_Id; + Freeze_Id : Entity_Id := Empty) + is + Subp_Decl : constant Node_Id := Find_Related_Declaration_Or_Body (N); + Spec_Id : constant Entity_Id := Unique_Defining_Entity (Subp_Decl); + Arg1 : constant Node_Id := + First (Pragma_Argument_Associations (N)); + + Saved_GM : constant Ghost_Mode_Type := Ghost_Mode; + Saved_IGR : constant Node_Id := Ignored_Ghost_Region; + -- Save the Ghost-related attributes to restore on exit + + Errors : Nat; + Restore_Scope : Boolean := False; + + begin + -- Do not analyze the pragma multiple times + + if Is_Analyzed_Pragma (N) then + return; + end if; + + if Present (Arg1) then + + -- Set the Ghost mode in effect from the pragma. Due to the delayed + -- analysis of the pragma, the Ghost mode at point of declaration and + -- point of analysis may not necessarily be the same. Use the mode in + -- effect at the point of declaration. + + Set_Ghost_Mode (N); + + -- Ensure that the subprogram and its formals are visible when + -- analyzing the expression of the pragma. + + if not In_Open_Scopes (Spec_Id) then + Restore_Scope := True; + + if Is_Generic_Subprogram (Spec_Id) then + Push_Scope (Spec_Id); + Install_Generic_Formals (Spec_Id); + else + Push_Scope (Spec_Id); + Install_Formals (Spec_Id); + end if; + end if; + + Errors := Serious_Errors_Detected; + Preanalyze_Assert_Expression (Expression (Arg1), Standard_Boolean); + + -- Emit a clarification message when the expression contains at least + -- one undefined reference, possibly due to contract freezing. + + if Errors /= Serious_Errors_Detected + and then Present (Freeze_Id) + and then Has_Undefined_Reference (Expression (Arg1)) + then + Contract_Freeze_Error (Spec_Id, Freeze_Id); + end if; + + if Restore_Scope then + End_Scope; + end if; + + Restore_Ghost_Region (Saved_GM, Saved_IGR); + end if; + + Set_Is_Analyzed_Pragma (N); + + end Analyze_Always_Terminates_In_Decl_Part; + ----------------------------------------- -- Analyze_Contract_Cases_In_Decl_Part -- ----------------------------------------- @@ -11279,7 +11354,10 @@ package body Sem_Prag is -- Warn that suppress of Elaboration_Check has no effect in SPARK - if C = Elaboration_Check and then SPARK_Mode = On then + if C = Elaboration_Check + and then Suppress_Case + and then SPARK_Mode = On + then Error_Pragma_Arg ("Suppress of Elaboration_Check ignored in SPARK??", "\elaboration checking rules are statically enforced " @@ -13199,6 +13277,165 @@ package body Sem_Prag is Opt.Allow_Integer_Address := True; end if; + ----------------------- + -- Always_Terminates -- + ----------------------- + + -- pragma Always_Terminates [ (boolean_EXPRESSION) ]; + + -- Characteristics: + + -- * Analysis - The annotation undergoes initial checks to verify + -- the legal placement and context. Secondary checks preanalyze the + -- expressions in: + + -- Analyze_Always_Terminates_Cases_In_Decl_Part + + -- * Expansion - The annotation is expanded during the expansion of + -- the related subprogram [body] contract as performed in: + + -- Expand_Subprogram_Contract + + -- * Template - The annotation utilizes the generic template of the + -- related subprogram [body] when it is: + + -- aspect on subprogram declaration + -- aspect on stand-alone subprogram body + -- pragma on stand-alone subprogram body + + -- The annotation must prepare its own template when it is: + + -- pragma on subprogram declaration + + -- * Globals - Capture of global references must occur after full + -- analysis. + + -- * Instance - The annotation is instantiated automatically when + -- the related generic subprogram [body] is instantiated except for + -- the "pragma on subprogram declaration" case. In that scenario + -- the annotation must instantiate itself. + + when Pragma_Always_Terminates => Always_Terminates : declare + Spec_Id : Entity_Id; + Subp_Decl : Node_Id; + Subp_Spec : Node_Id; + + begin + GNAT_Pragma; + Check_No_Identifiers; + Check_At_Most_N_Arguments (1); + + -- Ensure the proper placement of the pragma. Exceptional_Cases + -- must be associated with a subprogram declaration or a body that + -- acts as a spec. + + Subp_Decl := + Find_Related_Declaration_Or_Body (N, Do_Checks => True); + + -- Generic subprogram and package declaration + + if Nkind (Subp_Decl) in N_Generic_Declaration then + null; + + -- Package declaration + + elsif Nkind (Subp_Decl) = N_Package_Declaration then + null; + + -- Body acts as spec + + elsif Nkind (Subp_Decl) = N_Subprogram_Body + and then No (Corresponding_Spec (Subp_Decl)) + then + null; + + -- Body stub acts as spec + + elsif Nkind (Subp_Decl) = N_Subprogram_Body_Stub + and then No (Corresponding_Spec_Of_Stub (Subp_Decl)) + then + null; + + -- Subprogram + + elsif Nkind (Subp_Decl) = N_Subprogram_Declaration then + Subp_Spec := Specification (Subp_Decl); + + -- Pragma Always_Terminates is forbidden on null procedures, + -- as this may lead to potential ambiguities in behavior + -- when interface null procedures are involved. Also, it + -- just wouldn't make sense, because null procedures always + -- terminate anyway. + + if Nkind (Subp_Spec) = N_Procedure_Specification + and then Null_Present (Subp_Spec) + then + Error_Msg_N (Fix_Error + ("pragma % cannot apply to null procedure"), N); + return; + end if; + + -- Entry + + elsif Nkind (Subp_Decl) = N_Entry_Declaration then + null; + + else + Pragma_Misplaced; + end if; + + Spec_Id := Unique_Defining_Entity (Subp_Decl); + + -- Pragma Always_Terminates is not allowed on functions + + if Ekind (Spec_Id) = E_Function then + Error_Msg_N (Fix_Error + ("pragma % cannot apply to function"), N); + return; + + elsif Ekind (Spec_Id) = E_Generic_Function then + Error_Msg_N (Fix_Error + ("pragma % cannot apply to generic function"), N); + return; + end if; + + -- Pragma Always_Terminates applied to packages doesn't allow any + -- expression. + + if Is_Package_Or_Generic_Package (Spec_Id) + and then Arg_Count /= 0 + then + Error_Msg_N (Fix_Error + ("pragma % applied to package cannot have arguments"), N); + return; + end if; + + -- A pragma that applies to a Ghost entity becomes Ghost for the + -- purposes of legality checks and removal of ignored Ghost code. + + Mark_Ghost_Pragma (N, Spec_Id); + + -- Chain the pragma on the contract for further processing by + -- Analyze_Always_Terminates_In_Decl_Part. + + Add_Contract_Item (N, Defining_Entity (Subp_Decl)); + + -- Fully analyze the pragma when it appears inside a subprogram + -- body because it cannot benefit from forward references. + + if Nkind (Subp_Decl) in N_Subprogram_Body + | N_Subprogram_Body_Stub + then + -- The legality checks of pragma Always_Terminates are affected + -- by the SPARK mode in effect and the volatility of the + -- context. Analyze all pragmas in a specific order. + + Analyze_If_Present (Pragma_SPARK_Mode); + Analyze_If_Present (Pragma_Volatile_Function); + Analyze_Always_Terminates_In_Decl_Part (N); + end if; + end Always_Terminates; + -------------- -- Annotate -- -------------- @@ -13810,7 +14047,7 @@ package body Sem_Prag is begin GNAT_Pragma; Check_No_Identifiers; - Check_At_Most_N_Arguments (1); + Check_At_Most_N_Arguments (1); Obj_Or_Type_Decl := Find_Related_Context (N, Do_Checks => True); @@ -21964,10 +22201,21 @@ package body Sem_Prag is return; end if; - -- A pragma that applies to a Ghost entity becomes Ghost for the - -- purposes of legality checks and removal of ignored Ghost code. + -- A Ghost_Predicate aspect is always Ghost with a mode inherited + -- from the context. A Predicate pragma that applies to a Ghost + -- entity becomes Ghost for the purposes of legality checks and + -- removal of ignored Ghost code. - Mark_Ghost_Pragma (N, Typ); + if From_Aspect_Specification (N) + and then Get_Aspect_Id + (Chars (Identifier (Corresponding_Aspect (N)))) + = Aspect_Ghost_Predicate + then + Mark_Ghost_Pragma + (N, Name_To_Ghost_Mode (Policy_In_Effect (Name_Ghost))); + else + Mark_Ghost_Pragma (N, Typ); + end if; -- The remaining processing is simply to link the pragma on to -- the rep item chain, for processing when the type is frozen. @@ -31976,6 +32224,7 @@ package body Sem_Prag is Pragma_Aggregate_Individually_Assign => 0, Pragma_All_Calls_Remote => -1, Pragma_Allow_Integer_Address => -1, + Pragma_Always_Terminates => -1, Pragma_Annotate => 93, Pragma_Assert => -1, Pragma_Assert_And_Cut => -1, @@ -32462,6 +32711,7 @@ package body Sem_Prag is | Name_Debug | Name_Default_Initial_Condition | Name_Ghost + | Name_Ghost_Predicate | Name_Initial_Condition | Name_Invariant | Name_uInvariant diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads index 49c1d0b..e8e9856 100644 --- a/gcc/ada/sem_prag.ads +++ b/gcc/ada/sem_prag.ads @@ -38,6 +38,7 @@ package Sem_Prag is Aspect_Specifying_Pragma : constant array (Pragma_Id) of Boolean := (Pragma_Abstract_State => True, Pragma_All_Calls_Remote => True, + Pragma_Always_Terminates => True, Pragma_Annotate => True, Pragma_Async_Readers => True, Pragma_Async_Writers => True, @@ -133,7 +134,8 @@ package Sem_Prag is -- expression. Assertion_Expression_Pragma : constant array (Pragma_Id) of Boolean := - (Pragma_Assert => True, + (Pragma_Always_Terminates => True, + Pragma_Assert => True, Pragma_Assert_And_Cut => True, Pragma_Assume => True, Pragma_Check => True, @@ -210,7 +212,8 @@ package Sem_Prag is -- of subprogram bodies. Pragma_Significant_To_Subprograms : constant array (Pragma_Id) of Boolean := - (Pragma_Contract_Cases => True, + (Pragma_Always_Terminates => True, + Pragma_Contract_Cases => True, Pragma_Depends => True, Pragma_Exceptional_Cases => True, Pragma_Ghost => True, @@ -241,6 +244,13 @@ package Sem_Prag is procedure Analyze_Pragma (N : Node_Id); -- Analyze procedure for pragma reference node N + procedure Analyze_Always_Terminates_In_Decl_Part + (N : Node_Id; + Freeze_Id : Entity_Id := Empty); + -- Perform full analysis of delayed pragma Always_Terminates. Freeze_Id is + -- the entity of [generic] package body or [generic] subprogram body which + -- caused "freezing" of the related contract where the pragma resides. + procedure Analyze_Contract_Cases_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty); @@ -445,6 +455,7 @@ package Sem_Prag is (Prag : Node_Id; Do_Checks : Boolean := False) return Node_Id; -- Subsidiary to the analysis of pragmas + -- Always_Terminates -- Contract_Cases -- Depends -- Exceptional_Cases diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index c2a4bcb..41787f3 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -7290,14 +7290,14 @@ package body Sem_Res is Cannot_Inline ("cannot inline & (in default expression)?", N, Nam_UA); - -- Calls cannot be inlined inside quantified expressions, which - -- are left in expression form for GNATprove. Since these - -- expressions are only preanalyzed, we need to detect the failure - -- to inline outside of the case for Full_Analysis below. + -- Calls cannot be inlined inside potentially unevaluated + -- expressions, as this would create complex actions inside + -- expressions, that are not handled by GNATprove. - elsif In_Quantified_Expression (N) then + elsif Is_Potentially_Unevaluated (N) then Cannot_Inline - ("cannot inline & (in quantified expression)?", N, Nam_UA); + ("cannot inline & (in potentially unevaluated context)?", + N, Nam_UA); -- Inlining should not be performed during preanalysis @@ -7365,15 +7365,6 @@ package body Sem_Res is elsif No (Body_To_Inline (Nam_Decl)) then null; - -- Calls cannot be inlined inside potentially unevaluated - -- expressions, as this would create complex actions inside - -- expressions, that are not handled by GNATprove. - - elsif Is_Potentially_Unevaluated (N) then - Cannot_Inline - ("cannot inline & (in potentially unevaluated context)?", - N, Nam_UA); - -- Calls cannot be inlined inside the conditions of while -- loops, as this would create complex actions inside -- the condition, that are not handled by GNATprove. diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index d4006e4..8519b97 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -2229,7 +2229,7 @@ package body Sem_Type is Is_Immediately_Visible (Base_Type (Etype (Right_Opnd (N)))) and then Is_Potentially_Use_Visible (User_Subp) then - if It2.Nam = Predef_Subp then + if It1.Nam = Predef_Subp then return It1; else return It2; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 34ea064..3a64047d 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -958,10 +958,11 @@ package body Sem_Util is if Is_Generic_Actual_Type (Typ) then -- The restriction on loop parameters is only that the type - -- should have no dynamic predicates. + -- should only have static predicates. if Nkind (Parent (N)) = N_Loop_Parameter_Specification and then not Has_Dynamic_Predicate_Aspect (Typ) + and then not Has_Ghost_Predicate_Aspect (Typ) and then Is_OK_Static_Subtype (Typ) then return; @@ -995,6 +996,7 @@ package body Sem_Util is -- if the predicate is static. if not Has_Dynamic_Predicate_Aspect (Typ) + and then not Has_Ghost_Predicate_Aspect (Typ) and then Has_Static_Predicate (Typ) and then Nkind (N) = N_Attribute_Reference then @@ -2897,6 +2899,10 @@ package body Sem_Util is function Get_Record_Part (N : Node_Id) return Node_Id; -- Return the record part of this record type definition + --------------------- + -- Get_Record_Part -- + --------------------- + function Get_Record_Part (N : Node_Id) return Node_Id is Type_Def : constant Node_Id := Type_Definition (N); begin @@ -3291,9 +3297,7 @@ package body Sem_Util is & "in unspecified order", Node (Elmt_2)); - when N_In - | N_Not_In - => + when N_Membership_Test => Error_Msg_N ("value may be affected by call in other " & "alternative because they are evaluated " @@ -3305,7 +3309,7 @@ package body Sem_Util is ("value of actual may be affected by call in " & "other actual because they are evaluated " & "in unspecified order", - Node (Elmt_2)); + Node (Elmt_2)); end case; end if; @@ -14644,7 +14648,10 @@ package body Sem_Util is -- Inherit_Predicate_Flags -- ----------------------------- - procedure Inherit_Predicate_Flags (Subt, Par : Entity_Id) is + procedure Inherit_Predicate_Flags + (Subt, Par : Entity_Id; + Only_Flags : Boolean := False) + is begin if Ada_Version < Ada_2012 or else Present (Predicate_Function (Subt)) @@ -14657,6 +14664,8 @@ package body Sem_Util is (Subt, Has_Static_Predicate_Aspect (Par)); Set_Has_Dynamic_Predicate_Aspect (Subt, Has_Dynamic_Predicate_Aspect (Par)); + Set_Has_Ghost_Predicate_Aspect + (Subt, Has_Ghost_Predicate_Aspect (Par)); -- A named subtype does not inherit the predicate function of its -- parent but an itype declared for a loop index needs the discrete @@ -14664,7 +14673,10 @@ package body Sem_Util is -- A non-discrete type may has a static predicate (for example True) -- but has no static_discrete_predicate. - if Is_Itype (Subt) and then Present (Predicate_Function (Par)) then + if not Only_Flags + and then Is_Itype (Subt) + and then Present (Predicate_Function (Par)) + then Set_Subprograms_For_Type (Subt, Subprograms_For_Type (Par)); if Has_Static_Predicate (Par) and then Is_Discrete_Type (Par) then @@ -16141,9 +16153,25 @@ package body Sem_Util is ----------------------------- function Is_CPP_Constructor_Call (N : Node_Id) return Boolean is + Ret_Typ : Entity_Id; + begin - return Nkind (N) = N_Function_Call - and then Is_CPP_Class (Etype (Etype (N))) + if Nkind (N) /= N_Function_Call then + return False; + end if; + + Ret_Typ := Base_Type (Etype (N)); + + if Is_Class_Wide_Type (Ret_Typ) then + Ret_Typ := Root_Type (Ret_Typ); + end if; + + if Is_Private_Type (Ret_Typ) then + Ret_Typ := Underlying_Type (Ret_Typ); + end if; + + return Present (Ret_Typ) + and then Is_CPP_Class (Ret_Typ) and then Is_Constructor (Entity (Name (N))) and then Is_Imported (Entity (Name (N))); end Is_CPP_Constructor_Call; @@ -17570,21 +17598,6 @@ package body Sem_Util is and then Is_Derived_Type (Etype (E))); end Is_Inherited_Operation; - ------------------------------------- - -- Is_Inherited_Operation_For_Type -- - ------------------------------------- - - function Is_Inherited_Operation_For_Type - (E : Entity_Id; - Typ : Entity_Id) return Boolean - is - begin - -- Check that the operation has been created by the type declaration - - return Is_Inherited_Operation (E) - and then Defining_Identifier (Parent (E)) = Typ; - end Is_Inherited_Operation_For_Type; - -------------------------------------- -- Is_Inlinable_Expression_Function -- -------------------------------------- @@ -19569,7 +19582,8 @@ package body Sem_Util is elsif Nkind (Par) = N_Quantified_Expression then return Expr = Condition (Par); - elsif Nkind (Par) = N_Component_Association + elsif Nkind (Par) in N_Component_Association + | N_Iterated_Component_Association and then Expr = Expression (Par) and then Nkind (Parent (Par)) in N_Aggregate | N_Delta_Aggregate | N_Extension_Aggregate @@ -19711,10 +19725,15 @@ package body Sem_Util is then return True; - -- For component associations continue climbing; it may be part of - -- an array aggregate. + -- For component associations continue climbing; it may be part of an + -- array aggregate. For iterated component association we know that + -- it belongs to an array aggreate, but only its expression is + -- potentially unevaluated, not discrete choice list or iterator + -- specification. - elsif Nkind (Par) = N_Component_Association then + elsif Nkind (Par) in N_Component_Association + | N_Iterated_Component_Association + then null; -- If the context is not an expression, or if is the result of @@ -20561,7 +20580,8 @@ package body Sem_Util is Nam := Pragma_Name (Item); end if; - return Nam = Name_Contract_Cases + return Nam = Name_Always_Terminates + or else Nam = Name_Contract_Cases or else Nam = Name_Depends or else Nam = Name_Exceptional_Cases or else Nam = Name_Extensions_Visible @@ -30764,7 +30784,8 @@ package body Sem_Util is -- array_component_association or of -- a container_element_associatiation. - if Nkind (Par) = N_Component_Association + if Nkind (Par) in N_Component_Association + | N_Iterated_Component_Association and then Trailer = Expression (Par) then -- determine whether Par is part of an array aggregate diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index d1bbc6a..3751fb7 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -1699,9 +1699,14 @@ package Sem_Util is -- either the value is not yet known before back-end processing or it is -- not known at compile time after back-end processing. - procedure Inherit_Predicate_Flags (Subt, Par : Entity_Id); + procedure Inherit_Predicate_Flags + (Subt, Par : Entity_Id; + Only_Flags : Boolean := False); -- Propagate static and dynamic predicate flags from a parent to the - -- subtype in a subtype declaration with and without constraints. + -- subtype in a subtype declaration with and without constraints, or from + -- a parent to the derived type in a derived type declaration. Only_Flags + -- is True in the case of a derived type declaration to inherit only the + -- flags, not the predicate functions. procedure Inherit_Rep_Item_Chain (Typ : Entity_Id; From_Typ : Entity_Id); -- Inherit the rep item chain of type From_Typ without clobbering any @@ -2083,12 +2088,6 @@ package Sem_Util is -- E is a subprogram. Return True is E is an implicit operation inherited -- by a derived type declaration. - function Is_Inherited_Operation_For_Type - (E : Entity_Id; - Typ : Entity_Id) return Boolean; - -- E is a subprogram. Return True is E is an implicit operation inherited - -- by the derived type declaration for type Typ. - function Is_Inlinable_Expression_Function (Subp : Entity_Id) return Boolean; -- Return True if Subp is an expression function that fulfills all the -- following requirements for inlining: @@ -2350,6 +2349,7 @@ package Sem_Util is function Is_Subprogram_Contract_Annotation (Item : Node_Id) return Boolean; -- Determine whether aspect specification or pragma Item is one of the -- following subprogram contract annotations: + -- Always_Terminates -- Contract_Cases -- Depends -- Exceptional_Cases diff --git a/gcc/ada/set_targ.adb b/gcc/ada/set_targ.adb index b37c8b7..4165615 100644 --- a/gcc/ada/set_targ.adb +++ b/gcc/ada/set_targ.adb @@ -943,7 +943,7 @@ begin Long_Long_Size := Get_Long_Long_Size; Long_Size := Get_Long_Size; Maximum_Alignment := Get_Maximum_Alignment; - Max_Unaligned_Field := Get_Max_Unaligned_Field; + Max_Unaligned_Field := 1; Pointer_Size := Get_Pointer_Size; Short_Enums := Get_Short_Enums; Short_Size := Get_Short_Size; diff --git a/gcc/ada/set_targ.ads b/gcc/ada/set_targ.ads index 623de6a..4342059 100644 --- a/gcc/ada/set_targ.ads +++ b/gcc/ada/set_targ.ads @@ -74,7 +74,7 @@ package Set_Targ is Long_Long_Size : Pos; -- Standard.Long_Long_Integer'Size Long_Size : Pos; -- Standard.Long_Integer'Size Maximum_Alignment : Pos; -- Maximum permitted alignment - Max_Unaligned_Field : Pos; -- Maximum size for unaligned bit field + Max_Unaligned_Field : Pos; -- Kept only for backward compatibility Pointer_Size : Pos; -- System.Address'Size Short_Enums : Nat; -- Foreign enums use short size? Short_Size : Pos; -- Standard.Short_Integer'Size diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 0f698cd..8040a59 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1711,6 +1711,7 @@ package Sinfo is -- a source construct, applies to a generic unit or its body, and denotes -- one of the following contract-related annotations: -- Abstract_State + -- Always_Terminates -- Contract_Cases -- Depends -- Exceptional_Cases @@ -1908,6 +1909,11 @@ package Sinfo is -- Present in variable reference markers. Set when the original variable -- reference constitutes a write of the variable. + -- Iterator_Filter + -- Present in N_Loop_Parameter_Specification and N_Iterator_Specification + -- nodes for Ada 2022. It is used to store the condition present in the + -- eponymous Ada 2022 construct. + -- Itype -- Used in N_Itype_Reference node to reference an itype for which it is -- important to ensure that it is defined. See description of this node @@ -2067,12 +2073,14 @@ package Sinfo is -- is undefined and should not be read). -- No_Ctrl_Actions - -- Present in N_Assignment_Statement to indicate that no Finalize nor - -- Adjust should take place on this assignment even though the RHS is - -- controlled. Also indicates that the primitive _assign should not be - -- used for a tagged assignment. This is used in init procs and aggregate - -- expansions where the generated assignments are initializations, not - -- real assignments. + -- Present in N_Assignment_Statement to indicate that neither Finalize + -- nor Adjust should take place on this assignment even though the LHS + -- and RHS are controlled. Also to indicate that the primitive _assign + -- should not be used for a tagged assignment. This flag is used in init + -- proc and aggregate expansion where the generated assignments are + -- initializations, not real assignments. Note that it also suppresses + -- the creation of transient scopes around the N_Assignment_Statement, + -- in other words it disables all controlled actions for the assignment. -- No_Elaboration_Check -- NOTE: this flag is relevant only for the legacy ABE mechanism and @@ -2092,6 +2100,15 @@ package Sinfo is -- to generate the proper message (see Sem_Util.Check_Unused_Withs for -- full details). + -- No_Finalize_Actions + -- Present in N_Assignment_Statement to indicate that no Finalize should + -- take place on this assignment even though the LHS is controlled. Also + -- to indicate that the primitive _assign should not be used for a tagged + -- assignment. This flag is only used in aggregates expansion where the + -- generated assignments are initializations, not real assignments. Note + -- that, unlike the No_Ctrl_Actions flag, it does *not* suppress the + -- creation of transient scopes around the N_Assignment_Statement. + -- No_Initialization -- Present in N_Object_Declaration and N_Allocator to indicate that the -- object must not be initialized (by Initialize or call to an init @@ -2106,12 +2123,6 @@ package Sinfo is -- It is used to indicate that processing for extended overflow checking -- modes is not required (this is used to prevent infinite recursion). - -- No_Side_Effect_Removal - -- Present in N_Function_Call nodes. Set when a function call does not - -- require side effect removal. This attribute suppresses the generation - -- of a temporary to capture the result of the function which eventually - -- replaces the function call. - -- No_Truncation -- Present in N_Unchecked_Type_Conversion node. This flag has an effect -- only if the RM_Size of the source is greater than the RM_Size of the @@ -4934,6 +4945,7 @@ package Sinfo is -- Forwards_OK -- Backwards_OK -- No_Ctrl_Actions + -- No_Finalize_Actions -- Has_Target_Names -- Is_Elaboration_Code -- Componentwise_Assignment @@ -5560,7 +5572,6 @@ package Sinfo is -- Is_Elaboration_Warnings_OK_Node -- No_Elaboration_Check -- Is_Expanded_Build_In_Place_Call - -- No_Side_Effect_Removal -- Is_Known_Guaranteed_ABE -- plus fields for expression @@ -7973,6 +7984,7 @@ package Sinfo is -- establish dependencies between subprogram or package inputs and -- outputs. Currently the following pragmas appear in this list: -- Abstract_States + -- Always_Terminates -- Async_Readers -- Async_Writers -- Constant_After_Elaboration diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 9d17b43..5044abb 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -156,6 +156,7 @@ package Snames is Name_Dynamic_Predicate : constant Name_Id := N + $; Name_Exclusive_Functions : constant Name_Id := N + $; Name_Full_Access_Only : constant Name_Id := N + $; + Name_Ghost_Predicate : constant Name_Id := N + $; Name_Integer_Literal : constant Name_Id := N + $; Name_No_Controlled_Parts : constant Name_Id := N + $; Name_No_Task_Parts : constant Name_Id := N + $; @@ -502,6 +503,7 @@ package Snames is Name_Abort_Defer : constant Name_Id := N + $; -- GNAT Name_Abstract_State : constant Name_Id := N + $; -- GNAT Name_All_Calls_Remote : constant Name_Id := N + $; + Name_Always_Terminates : constant Name_Id := N + $; -- GNAT Name_Assert : constant Name_Id := N + $; -- Ada 05 Name_Assert_And_Cut : constant Name_Id := N + $; -- GNAT Name_Assume : constant Name_Id := N + $; -- GNAT @@ -1812,6 +1814,7 @@ package Snames is Pragma_Abort_Defer, Pragma_Abstract_State, Pragma_All_Calls_Remote, + Pragma_Always_Terminates, Pragma_Assert, Pragma_Assert_And_Cut, Pragma_Assume, diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb index 6e753ea..d470145 100644 --- a/gcc/ada/targparm.adb +++ b/gcc/ada/targparm.adb @@ -660,6 +660,14 @@ package body Targparm is Opt.Task_Dispatching_Policy_Sloc := System_Location; goto Line_Loop_Continue; + -- Allow "pragma Style_Checks (On);" and "pragma Style_Checks (Off);" + -- to make it possible to have long "pragma Restrictions" line. + + elsif Looking_At_Skip ("pragma Style_Checks (On);") or else + Looking_At_Skip ("pragma Style_Checks (Off);") + then + goto Line_Loop_Continue; + -- No other configuration pragmas are permitted elsif Looking_At ("pragma ") then diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads index aa91ee6..2127252 100644 --- a/gcc/ada/targparm.ads +++ b/gcc/ada/targparm.ads @@ -110,6 +110,10 @@ package Targparm is -- If a pragma Profile with a valid profile argument appears, then -- the appropriate restrictions and policy flags are set. + -- pragma Style_Checks is allowed with "On" or "Off" as an argument, in + -- order to make the conditions on pragma Restrictions documented in the + -- next paragraph easier to manage. + -- The only other pragma allowed is a pragma Restrictions that specifies -- a restriction that will be imposed on all units in the partition. Note -- that in this context, only one restriction can be specified in a single @@ -213,22 +217,7 @@ package Targparm is -- Control of Exception Handling -- ----------------------------------- - -- GNAT implements three methods of implementing exceptions: - - -- Front-End Longjmp/Setjmp Exceptions - - -- This approach uses longjmp/setjmp to handle exceptions. It - -- uses less storage, and can often propagate exceptions faster, - -- at the expense of (sometimes considerable) overhead in setting - -- up an exception handler. - - -- The generation of the setjmp and longjmp calls is handled by - -- the front end of the compiler (this includes gigi in the case - -- of the standard GCC back end). It does not use any back end - -- support (such as the GCC3 exception handling mechanism). When - -- this approach is used, the compiler generates special exception - -- handlers for handling cleanups (AT-END actions) when an exception - -- is raised. + -- GNAT provides two methods of implementing exceptions: -- Back-End Zero Cost Exceptions @@ -254,10 +243,10 @@ package Targparm is -- Control of Available Methods and Defaults - -- The following switches specify whether we're using a front-end or a - -- back-end mechanism and whether this is a zero-cost or a sjlj scheme. + -- The following switch specifies whether this is a zero-cost or a sjlj + -- scheme. - -- The per-switch default values correspond to the default value of + -- The default value corresponds to the default value of -- Opt.Exception_Mechanism. ZCX_By_Default_On_Target : Boolean := False; @@ -408,7 +397,7 @@ package Targparm is -- Control of Stack Checking -- ------------------------------- - -- GNAT provides three methods of implementing exceptions: + -- GNAT provides three methods of implementing stack checking: -- GCC Probing Mechanism diff --git a/gcc/ada/tbuild.adb b/gcc/ada/tbuild.adb index 2a8fc36..a8b0437 100644 --- a/gcc/ada/tbuild.adb +++ b/gcc/ada/tbuild.adb @@ -525,6 +525,38 @@ package body Tbuild is return Make_String_Literal (Sloc, Strval => End_String); end Make_String_Literal; + ------------------------- + -- Make_Suppress_Block -- + ------------------------- + + -- Generates the following expansion: + + -- declare + -- pragma Suppress (<check>); + -- begin + -- <stmts> + -- end; + + function Make_Suppress_Block + (Loc : Source_Ptr; + Check : Name_Id; + Stmts : List_Id) return Node_Id + is + begin + return + Make_Block_Statement (Loc, + Declarations => New_List ( + Make_Pragma (Loc, + Chars => Name_Suppress, + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => Make_Identifier (Loc, Check))))), + + Handled_Statement_Sequence => + Make_Handled_Sequence_Of_Statements (Loc, + Statements => Stmts)); + end Make_Suppress_Block; + -------------------- -- Make_Temporary -- -------------------- @@ -548,7 +580,7 @@ package body Tbuild is -- Generates the following expansion: -- declare - -- pragma Suppress (<check>); + -- pragma Unsuppress (<check>); -- begin -- <stmts> -- end; @@ -563,7 +595,7 @@ package body Tbuild is Make_Block_Statement (Loc, Declarations => New_List ( Make_Pragma (Loc, - Chars => Name_Suppress, + Chars => Name_Unsuppress, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Check))))), diff --git a/gcc/ada/tbuild.ads b/gcc/ada/tbuild.ads index 1b42fbd..bb2c70c 100644 --- a/gcc/ada/tbuild.ads +++ b/gcc/ada/tbuild.ads @@ -187,6 +187,13 @@ package Tbuild is -- A convenient form of Make_String_Literal, where the string value is -- given as a normal string instead of a String_Id value. + function Make_Suppress_Block + (Loc : Source_Ptr; + Check : Name_Id; + Stmts : List_Id) return Node_Id; + -- Build a block with a pragma Suppress on Check. Stmts is the statements + -- list that needs protection against the check activation. + function Make_Temporary (Loc : Source_Ptr; Id : Character; @@ -207,8 +214,8 @@ package Tbuild is (Loc : Source_Ptr; Check : Name_Id; Stmts : List_Id) return Node_Id; - -- Build a block with a pragma Suppress on 'Check'. Stmts is the statements - -- list that needs protection against the check + -- Build a block with a pragma Unsuppress on Check. Stmts is the statements + -- list that needs protection against the check suppression. function New_Constraint_Error (Loc : Source_Ptr) return Node_Id; -- This function builds a tree corresponding to the Ada statement diff --git a/gcc/ada/ttypes.ads b/gcc/ada/ttypes.ads index 953781d..28c6376 100644 --- a/gcc/ada/ttypes.ads +++ b/gcc/ada/ttypes.ads @@ -60,11 +60,10 @@ package Ttypes is -- Two approaches are used for handling target dependent values in the -- standard library packages. Package Standard is handled specially, -- being constructed internally (by package Stand). Target dependent - -- values needed in Stand are obtained by direct reference to Ttypes - -- and Ttypef. + -- values needed in Stand are obtained by direct reference to Ttypes. -- For package System, there is a separate version for each target, with - -- explicit declarations of the required, constants. + -- explicit declarations of the required constants. -- Historical note: Originally we had in mind dealing with target dependent -- differences by referencing appropriate attributes. Ada 95 already @@ -185,10 +184,6 @@ package Ttypes is Set_Targ.System_Allocator_Alignment; -- The alignment in storage units of addresses returned by malloc - Max_Unaligned_Field : constant Pos := Set_Targ.Max_Unaligned_Field; - -- The maximum supported size in bits for a field that is not aligned - -- on a storage unit boundary. - Bytes_Big_Endian : Boolean := Set_Targ.Bytes_BE /= 0; -- Important note: for Ada purposes, the important setting is the bytes -- endianness (Bytes_Big_Endian), not the bits value (Bits_Big_Endian). diff --git a/gcc/ada/vxworks7-cert-rtp-base-link.spec b/gcc/ada/vxworks7-cert-rtp-base-link.spec deleted file mode 100644 index 1d6ee49..0000000 --- a/gcc/ada/vxworks7-cert-rtp-base-link.spec +++ /dev/null @@ -1,2 +0,0 @@ -*base_link: ---defsym=__wrs_rtp_base=0x80000000 diff --git a/gcc/ada/vxworks7-cert-rtp-base-link__ppc64.spec b/gcc/ada/vxworks7-cert-rtp-base-link__ppc64.spec deleted file mode 100644 index 97332b8..0000000 --- a/gcc/ada/vxworks7-cert-rtp-base-link__ppc64.spec +++ /dev/null @@ -1,2 +0,0 @@ -*base_link: ---defsym=__wrs_rtp_base=0x40000000 diff --git a/gcc/ada/vxworks7-cert-rtp-base-link__x86.spec b/gcc/ada/vxworks7-cert-rtp-base-link__x86.spec deleted file mode 100644 index eafb582..0000000 --- a/gcc/ada/vxworks7-cert-rtp-base-link__x86.spec +++ /dev/null @@ -1,2 +0,0 @@ -*base_link: ---defsym=__wrs_rtp_base=0x400000 diff --git a/gcc/ada/vxworks7-cert-rtp-base-link__x86_64.spec b/gcc/ada/vxworks7-cert-rtp-base-link__x86_64.spec deleted file mode 100644 index dd28869..0000000 --- a/gcc/ada/vxworks7-cert-rtp-base-link__x86_64.spec +++ /dev/null @@ -1,2 +0,0 @@ -*base_link: ---defsym=__wrs_rtp_base=0x200000 diff --git a/gcc/ada/vxworks7-cert-rtp-link.spec b/gcc/ada/vxworks7-cert-rtp-link.spec deleted file mode 100644 index 9923c58..0000000 --- a/gcc/ada/vxworks7-cert-rtp-link.spec +++ /dev/null @@ -1,10 +0,0 @@ -*self_spec: -+ %{!nostdlib:-nodefaultlibs -nostartfiles} - -*link: -+ %{!nostdlib:%{mrtp:%{!shared: \ - %(base_link) \ - -l:certRtp.o \ - -L%:getenv(VSB_DIR /usr/lib/common/objcert) \ - -T%:getenv(VSB_DIR /usr/ldscripts/rtp.ld) \ - }}} diff --git a/gcc/ada/vxworks7-cert-rtp-link__ppcXX.spec b/gcc/ada/vxworks7-cert-rtp-link__ppcXX.spec deleted file mode 100644 index 8671cea..0000000 --- a/gcc/ada/vxworks7-cert-rtp-link__ppcXX.spec +++ /dev/null @@ -1,10 +0,0 @@ -*self_spec: -+ %{!nostdlib:-nodefaultlibs -nostartfiles} - -*link: -+ %{!nostdlib:%{mrtp:%{!shared: \ - %(base_link) \ - -lcert -lgnu \ - -L%:getenv(VSB_DIR /usr/lib/common/objcert) \ - -T%:getenv(VSB_DIR /usr/ldscripts/rtp.ld) \ - }}} diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 6ba50eb..10c4a59 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2023-06-13 David Malcolm <dmalcolm@redhat.com> + + PR c/84890 + * known-headers.cc + (suggest_missing_header::~suggest_missing_header): Reword note to + avoid negative tone of "forgetting". + 2023-06-07 Jason Merrill <jason@redhat.com> PR c++/58487 diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index cead199..0930a3c04 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1488,6 +1488,10 @@ Wsubobject-linkage C++ ObjC++ Var(warn_subobject_linkage) Warning Init(1) Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage. +Welaborated-enum-base +C++ ObjC++ Var(warn_elaborated_enum_base) Warning Init(1) +Warn if an additional enum-base is used in an elaborated-type-specifier. + Wduplicate-decl-specifier C ObjC Var(warn_duplicate_decl_specifier) Warning LangEnabledBy(C ObjC,Wall) Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier. diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc index de92cfd..3484c86 100644 --- a/gcc/c-family/known-headers.cc +++ b/gcc/c-family/known-headers.cc @@ -320,6 +320,6 @@ suggest_missing_header::~suggest_missing_header () maybe_add_include_fixit (&richloc, m_header_hint, true); inform (&richloc, "%qs is defined in header %qs;" - " did you forget to %<#include %s%>?", + " this is probably fixable by adding %<#include %s%>", m_name_str, m_header_hint, m_header_hint); } diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index d02017c..1d3700d 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2023-06-12 Tobias Burnus <tobias@codesourcery.com> + + * c-parser.cc (c_parser_omp_clause_map): Reword error message for + clearness especially with 'omp target (enter/exit) data.' + 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 72f6fba..24a6eb6 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -3182,7 +3182,19 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs, attrs_ok = true; if (kind == C_ID_ID) { - error_at (loc, "unknown type name %qE", value); + auto_diagnostic_group d; + name_hint hint = lookup_name_fuzzy (value, FUZZY_LOOKUP_TYPENAME, + loc); + if (const char *suggestion = hint.suggestion ()) + { + gcc_rich_location richloc (loc); + richloc.add_fixit_replace (suggestion); + error_at (&richloc, + "unknown type name %qE; did you mean %qs?", + value, suggestion); + } + else + error_at (loc, "unknown type name %qE", value); t.kind = ctsk_typedef; t.spec = error_mark_node; } @@ -17160,9 +17172,8 @@ c_parser_omp_clause_map (c_parser *parser, tree list) } else { - c_parser_error (parser, "%<#pragma omp target%> with " - "modifier other than %<always%>, %<close%> " - "or %<present%> on %<map%> clause"); + c_parser_error (parser, "%<map%> clause with map-type modifier other " + "than %<always%>, %<close%> or %<present%>"); parens.skip_until_found_close (parser); return list; } diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h index 9d5bf77..7e8f1ba 100644 --- a/gcc/config/aarch64/aarch64-opts.h +++ b/gcc/config/aarch64/aarch64-opts.h @@ -81,7 +81,8 @@ enum aarch64_tp_reg { AARCH64_TPIDR_EL0 = 0, AARCH64_TPIDR_EL1 = 1, AARCH64_TPIDR_EL2 = 2, - AARCH64_TPIDR_EL3 = 3 + AARCH64_TPIDR_EL3 = 3, + AARCH64_TPIDRRO_EL0 = 4 }; /* SVE vector register sizes. */ diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index 94ff3f1..e2b94ad 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -260,21 +260,17 @@ BUILTIN_VDQHS (TERNOP, mls_n, 0, NONE) BUILTIN_VDQHS (TERNOPU, mls_n, 0, NONE) - /* Implemented by aarch64_shrn<mode>". */ - BUILTIN_VQN (SHIFTIMM, shrn, 0, NONE) - BUILTIN_VQN (USHIFTIMM, shrn, 0, NONE) + BUILTIN_VQN (SHIFTIMM, shrn_n, 0, NONE) + BUILTIN_VQN (USHIFTIMM, shrn_n, 0, NONE) - /* Implemented by aarch64_shrn2<mode>. */ - BUILTIN_VQN (SHIFT2IMM, shrn2, 0, NONE) - BUILTIN_VQN (USHIFT2IMM, shrn2, 0, NONE) + BUILTIN_VQN (SHIFT2IMM, ushrn2_n, 0, NONE) + BUILTIN_VQN (USHIFT2IMM, ushrn2_n, 0, NONE) - /* Implemented by aarch64_rshrn<mode>". */ - BUILTIN_VQN (SHIFTIMM, rshrn, 0, NONE) - BUILTIN_VQN (USHIFTIMM, rshrn, 0, NONE) + BUILTIN_VQN (SHIFTIMM, rshrn_n, 0, NONE) + BUILTIN_VQN (USHIFTIMM, rshrn_n, 0, NONE) - /* Implemented by aarch64_rshrn2<mode>. */ - BUILTIN_VQN (SHIFT2IMM, rshrn2, 0, NONE) - BUILTIN_VQN (USHIFT2IMM, rshrn2, 0, NONE) + BUILTIN_VQN (SHIFT2IMM, rshrn2_n, 0, NONE) + BUILTIN_VQN (USHIFT2IMM, rshrn2_n, 0, NONE) /* Implemented by aarch64_<su>mlsl<mode>. */ BUILTIN_VD_BHSI (TERNOP, smlsl, 0, NONE) @@ -470,7 +466,6 @@ /* Implemented by aarch64_<sur>shll2_n<mode>. */ BUILTIN_VQW (SHIFTIMM, sshll2_n, 0, NONE) BUILTIN_VQW (SHIFTIMM, ushll2_n, 0, NONE) - /* Implemented by aarch64_<sur>q<r>shr<u>n_n<mode>. */ BUILTIN_VQN (SHIFTIMM, sqshrun_n, 0, NONE) BUILTIN_VQN (SHIFTIMM, sqrshrun_n, 0, NONE) BUILTIN_VQN (SHIFTIMM, sqshrn_n, 0, NONE) @@ -483,11 +478,10 @@ BUILTIN_SD_HSDI (USHIFTIMM, uqshrn_n, 0, NONE) BUILTIN_SD_HSDI (SHIFTIMM, sqrshrn_n, 0, NONE) BUILTIN_SD_HSDI (USHIFTIMM, uqrshrn_n, 0, NONE) - /* Implemented by aarch64_<sur>q<r>shr<u>n2_n<mode>. */ BUILTIN_VQN (SHIFT2IMM_UUSS, sqshrun2_n, 0, NONE) BUILTIN_VQN (SHIFT2IMM_UUSS, sqrshrun2_n, 0, NONE) - BUILTIN_VQN (SHIFT2IMM, sqshrn2_n, 0, NONE) - BUILTIN_VQN (USHIFT2IMM, uqshrn2_n, 0, NONE) + BUILTIN_VQN (SHIFT2IMM, sqsshrn2_n, 0, NONE) + BUILTIN_VQN (USHIFT2IMM, uqushrn2_n, 0, NONE) BUILTIN_VQN (SHIFT2IMM, sqrshrn2_n, 0, NONE) BUILTIN_VQN (USHIFT2IMM, uqrshrn2_n, 0, NONE) /* Implemented by aarch64_<sur>s<lr>i_n<mode>. */ diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 3cecc10..cd04cbd 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -910,6 +910,18 @@ [(set_attr "type" "neon_abd<q>")] ) +(define_expand "<su>abd<mode>3" + [(match_operand:VDQ_BHSI 0 "register_operand") + (USMAX:VDQ_BHSI + (match_operand:VDQ_BHSI 1 "register_operand") + (match_operand:VDQ_BHSI 2 "register_operand"))] + "TARGET_SIMD" + { + emit_insn (gen_aarch64_<su>abd<mode> (operands[0], operands[1], operands[2])); + DONE; + } +) + (define_insn "aarch64_<su>abdl<mode>" [(set (match_operand:<VWIDE> 0 "register_operand" "=w") (zero_extend:<VWIDE> @@ -1884,40 +1896,6 @@ } ) -(define_insn "*aarch64_<srn_op>shrn<mode><vczle><vczbe>" - [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (truncate:<VNARROWQ> - (SHIFTRT:VQN (match_operand:VQN 1 "register_operand" "w") - (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>"))))] - "TARGET_SIMD" - "shrn\\t%0.<Vntype>, %1.<Vtype>, %2" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_insn "*aarch64_<srn_op>shrn<mode>2_vect_le" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (match_operand:<VNARROWQ> 1 "register_operand" "0") - (truncate:<VNARROWQ> - (SHIFTRT:VQN (match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")))))] - "TARGET_SIMD && !BYTES_BIG_ENDIAN" - "shrn2\\t%0.<V2ntype>, %2.<Vtype>, %3" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_insn "*aarch64_<srn_op>shrn<mode>2_vect_be" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (truncate:<VNARROWQ> - (SHIFTRT:VQN (match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>"))) - (match_operand:<VNARROWQ> 1 "register_operand" "0")))] - "TARGET_SIMD && BYTES_BIG_ENDIAN" - "shrn2\\t%0.<V2ntype>, %2.<Vtype>, %3" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - (define_insn "*aarch64_<srn_op>topbits_shuffle<mode>_le" [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") (vec_concat:<VNARROWQ2> @@ -1946,173 +1924,6 @@ [(set_attr "type" "neon_permute<q>")] ) -(define_expand "aarch64_shrn<mode>" - [(set (match_operand:<VNARROWQ> 0 "register_operand") - (truncate:<VNARROWQ> - (lshiftrt:VQN (match_operand:VQN 1 "register_operand") - (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<vn_mode>"))))] - "TARGET_SIMD" - { - operands[2] = aarch64_simd_gen_const_vector_dup (<MODE>mode, - INTVAL (operands[2])); - } -) - -(define_insn "aarch64_rshrn<mode><vczle><vczbe>_insn" - [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (truncate:<VNARROWQ> - (lshiftrt:VQN - (plus:VQN (match_operand:VQN 1 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_rshrn_imm_vec")) - (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>"))))] - "TARGET_SIMD - && INTVAL (CONST_VECTOR_ELT (operands[3], 0)) - == (HOST_WIDE_INT_1 << (INTVAL (CONST_VECTOR_ELT (operands[2], 0)) - 1))" - "rshrn\\t%0.<Vntype>, %1.<Vtype>, %2" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_expand "aarch64_rshrn<mode>" - [(match_operand:<VNARROWQ> 0 "register_operand") - (match_operand:VQN 1 "register_operand") - (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<vn_mode>")] - "TARGET_SIMD" - { - if (INTVAL (operands[2]) == GET_MODE_UNIT_BITSIZE (<VNARROWQ>mode)) - { - rtx tmp0 = aarch64_gen_shareable_zero (<MODE>mode); - emit_insn (gen_aarch64_raddhn<mode> (operands[0], operands[1], tmp0)); - } - else - { - rtx shft - = aarch64_simd_gen_const_vector_dup (<MODE>mode, - HOST_WIDE_INT_1U - << (INTVAL (operands[2]) - 1)); - operands[2] = aarch64_simd_gen_const_vector_dup (<MODE>mode, - INTVAL (operands[2])); - emit_insn (gen_aarch64_rshrn<mode>_insn (operands[0], operands[1], - operands[2], shft)); - } - DONE; - } -) - -(define_insn "aarch64_shrn2<mode>_insn_le" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (match_operand:<VNARROWQ> 1 "register_operand" "0") - (truncate:<VNARROWQ> - (lshiftrt:VQN (match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")))))] - "TARGET_SIMD && !BYTES_BIG_ENDIAN" - "shrn2\\t%0.<V2ntype>, %2.<Vtype>, %3" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_insn "aarch64_shrn2<mode>_insn_be" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (truncate:<VNARROWQ> - (lshiftrt:VQN (match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 - "aarch64_simd_shift_imm_vec_<vn_mode>"))) - (match_operand:<VNARROWQ> 1 "register_operand" "0")))] - "TARGET_SIMD && BYTES_BIG_ENDIAN" - "shrn2\\t%0.<V2ntype>, %2.<Vtype>, %3" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_expand "aarch64_shrn2<mode>" - [(match_operand:<VNARROWQ2> 0 "register_operand") - (match_operand:<VNARROWQ> 1 "register_operand") - (match_operand:VQN 2 "register_operand") - (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<vn_mode>")] - "TARGET_SIMD" - { - operands[3] = aarch64_simd_gen_const_vector_dup (<MODE>mode, - INTVAL (operands[3])); - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_shrn2<mode>_insn_be (operands[0], operands[1], - operands[2], operands[3])); - else - emit_insn (gen_aarch64_shrn2<mode>_insn_le (operands[0], operands[1], - operands[2], operands[3])); - DONE; - } -) - -(define_insn "aarch64_rshrn2<mode>_insn_le" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (match_operand:<VNARROWQ> 1 "register_operand" "0") - (truncate:<VNARROWQ> - (lshiftrt:VQN - (plus:VQN (match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_rshrn_imm_vec")) - (match_operand:VQN 4 "aarch64_simd_shift_imm_vec_<vn_mode>")))))] - "TARGET_SIMD && !BYTES_BIG_ENDIAN - && INTVAL (CONST_VECTOR_ELT (operands[3], 0)) - == (HOST_WIDE_INT_1 << (INTVAL (CONST_VECTOR_ELT (operands[4], 0)) - 1))" - "rshrn2\\t%0.<V2ntype>, %2.<Vtype>, %4" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_insn "aarch64_rshrn2<mode>_insn_be" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (truncate:<VNARROWQ> - (lshiftrt:VQN - (plus:VQN (match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_rshrn_imm_vec")) - (match_operand:VQN 4 "aarch64_simd_shift_imm_vec_<vn_mode>"))) - (match_operand:<VNARROWQ> 1 "register_operand" "0")))] - "TARGET_SIMD && BYTES_BIG_ENDIAN - && INTVAL (CONST_VECTOR_ELT (operands[3], 0)) - == (HOST_WIDE_INT_1 << (INTVAL (CONST_VECTOR_ELT (operands[4], 0)) - 1))" - "rshrn2\\t%0.<V2ntype>, %2.<Vtype>, %4" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_expand "aarch64_rshrn2<mode>" - [(match_operand:<VNARROWQ2> 0 "register_operand") - (match_operand:<VNARROWQ> 1 "register_operand") - (match_operand:VQN 2 "register_operand") - (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<vn_mode>")] - "TARGET_SIMD" - { - if (INTVAL (operands[3]) == GET_MODE_UNIT_BITSIZE (<VNARROWQ2>mode)) - { - rtx tmp = aarch64_gen_shareable_zero (<MODE>mode); - emit_insn (gen_aarch64_raddhn2<mode> (operands[0], operands[1], - operands[2], tmp)); - } - else - { - rtx shft - = aarch64_simd_gen_const_vector_dup (<MODE>mode, - HOST_WIDE_INT_1U - << (INTVAL (operands[3]) - 1)); - - operands[3] = aarch64_simd_gen_const_vector_dup (<MODE>mode, - INTVAL (operands[3])); - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_rshrn2<mode>_insn_be (operands[0], - operands[1], - operands[2], - shft, - operands[3])); - else - emit_insn (gen_aarch64_rshrn2<mode>_insn_le (operands[0], - operands[1], - operands[2], - shft, - operands[3])); - } - DONE; - } -) - ;; Widening operations. (define_insn "aarch64_simd_vec_unpack<su>_lo_<mode>" @@ -6704,93 +6515,514 @@ ;; vq(r)shr(u)n_n -(define_insn "aarch64_<sur>q<r>shr<u>n_n<mode>" +(define_insn "aarch64_<shrn_op>shrn_n<mode>" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (unspec:<VNARROWQ> [(match_operand:SD_HSDI 1 "register_operand" "w") - (match_operand:SI 2 - "aarch64_simd_shift_imm_offset_<ve_mode>" "i")] - VQSHRN_N))] + (SAT_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:SD_HSDI + (match_operand:SD_HSDI 1 "register_operand" "w") + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>"))))] "TARGET_SIMD" - "<sur>q<r>shr<u>n\\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" - [(set_attr "type" "neon_sat_shift_imm_narrow_q")] + "<shrn_op>shrn\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + [(set_attr "type" "neon_shift_imm_narrow_q")] ) -(define_insn "aarch64_<sur>q<r>shr<u>n_n<mode>_insn<vczle><vczbe>" +(define_insn "*aarch64_<shrn_op><shrn_s>shrn_n<mode>_insn<vczle><vczbe>" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (unspec:<VNARROWQ> - [(match_operand:VQN 1 "register_operand" "w") - (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>")] - VQSHRN_N))] + (ALL_TRUNC:<VNARROWQ> + (SHIFTRT:VQN + (match_operand:VQN 1 "register_operand" "w") + (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>"))))] + "TARGET_SIMD && AARCH64_VALID_SHRN_OP (<ALL_TRUNC:CODE>, <SHIFTRT:CODE>)" + "<shrn_op>shrn\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_expand "aarch64_<shrn_op>shrn_n<mode>" + [(set (match_operand:<VNARROWQ> 0 "register_operand") + (ALL_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:VQN + (match_operand:VQN 1 "register_operand") + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>"))))] "TARGET_SIMD" - "<sur>q<r>shr<u>n\\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + { + operands[2] = aarch64_simd_gen_const_vector_dup (<MODE>mode, + INTVAL (operands[2])); + } +) + +(define_insn "*aarch64_<shrn_op>rshrn_n<mode>_insn<vczle><vczbe>" + [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") + (ALL_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:<V2XWIDE> + (plus:<V2XWIDE> + (<TRUNCEXTEND>:<V2XWIDE> + (match_operand:VQN 1 "register_operand" "w")) + (match_operand:<V2XWIDE> 3 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>"))))] + "TARGET_SIMD + && aarch64_const_vec_rnd_cst_p (operands[3], operands[2])" + "<shrn_op>rshrn\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" [(set_attr "type" "neon_shift_imm_narrow_q")] ) -(define_expand "aarch64_<sur>q<r>shr<u>n_n<mode>" +(define_insn "*aarch64_<shrn_op>rshrn_n<mode>_insn" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (unspec:<VNARROWQ> [(match_operand:VQN 1 "register_operand") - (match_operand:SI 2 - "aarch64_simd_shift_imm_offset_<ve_mode>")] - VQSHRN_N))] + (SAT_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:<DWI> + (plus:<DWI> + (<TRUNCEXTEND>:<DWI> + (match_operand:SD_HSDI 1 "register_operand" "w")) + (match_operand:<DWI> 3 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>"))))] + "TARGET_SIMD + && aarch64_const_vec_rnd_cst_p (operands[3], operands[2])" + "<shrn_op>rshrn\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_expand "aarch64_<shrn_op>rshrn_n<mode>" + [(set (match_operand:<VNARROWQ> 0 "register_operand") + (SAT_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:<V2XWIDE> + (plus:<V2XWIDE> + (<TRUNCEXTEND>:<V2XWIDE> + (match_operand:SD_HSDI 1 "register_operand")) + (match_dup 3)) + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>"))))] + "TARGET_SIMD" + { + /* Use this expander to create the rounding constant vector, which is + 1 << (shift - 1). Use wide_int here to ensure that the right TImode + RTL is generated when handling the DImode expanders. */ + int prec = GET_MODE_UNIT_PRECISION (<V2XWIDE>mode); + wide_int rnd_wi = wi::set_bit_in_zero (INTVAL (operands[2]) - 1, prec); + operands[3] = immed_wide_int_const (rnd_wi, GET_MODE_INNER (<V2XWIDE>mode)); + } +) + +(define_expand "aarch64_<shrn_op>rshrn_n<mode>" + [(set (match_operand:<VNARROWQ> 0 "register_operand") + (ALL_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:<V2XWIDE> + (plus:<V2XWIDE> + (<TRUNCEXTEND>:<V2XWIDE> + (match_operand:VQN 1 "register_operand")) + (match_dup 3)) + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>"))))] + "TARGET_SIMD" + { + if (<CODE> == TRUNCATE + && INTVAL (operands[2]) == GET_MODE_UNIT_BITSIZE (<VNARROWQ>mode)) + { + rtx tmp0 = aarch64_gen_shareable_zero (<MODE>mode); + emit_insn (gen_aarch64_raddhn<mode> (operands[0], operands[1], tmp0)); + DONE; + } + /* Use this expander to create the rounding constant vector, which is + 1 << (shift - 1). Use wide_int here to ensure that the right TImode + RTL is generated when handling the DImode expanders. */ + int prec = GET_MODE_UNIT_PRECISION (<V2XWIDE>mode); + wide_int rnd_wi = wi::set_bit_in_zero (INTVAL (operands[2]) - 1, prec); + operands[3] = immed_wide_int_const (rnd_wi, GET_MODE_INNER (<V2XWIDE>mode)); + operands[3] = gen_const_vec_duplicate (<V2XWIDE>mode, operands[3]); + operands[2] = gen_const_vec_duplicate (<MODE>mode, operands[2]); + } +) + +(define_insn "*aarch64_sqshrun_n<mode>_insn<vczle><vczbe>" + [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") + (truncate:<VNARROWQ> + (smin:VQN + (smax:VQN + (ashiftrt:VQN + (match_operand:VQN 1 "register_operand" "w") + (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>")) + (match_operand:VQN 3 "aarch64_simd_imm_zero")) + (match_operand:VQN 4 "aarch64_simd_umax_half_mode"))))] + "TARGET_SIMD" + "sqshrun\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_insn "aarch64_sqshrun_n<mode>_insn" + [(set (match_operand:SD_HSDI 0 "register_operand" "=w") + (smin:SD_HSDI + (smax:SD_HSDI + (ashiftrt:SD_HSDI + (match_operand:SD_HSDI 1 "register_operand" "w") + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>")) + (const_int 0)) + (const_int <half_mask>)))] + "TARGET_SIMD" + "sqshrun\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_expand "aarch64_sqshrun_n<mode>" + [(match_operand:<VNARROWQ> 0 "register_operand") + (match_operand:SD_HSDI 1 "register_operand") + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>")] + "TARGET_SIMD" + { + rtx dst = gen_reg_rtx (<MODE>mode); + emit_insn (gen_aarch64_sqshrun_n<mode>_insn (dst, operands[1], + operands[2])); + emit_move_insn (operands[0], gen_lowpart (<VNARROWQ>mode, dst)); + DONE; + } +) + +(define_expand "aarch64_sqshrun_n<mode>" + [(set (match_operand:<VNARROWQ> 0 "register_operand") + (truncate:<VNARROWQ> + (smin:VQN + (smax:VQN + (ashiftrt:VQN + (match_operand:VQN 1 "register_operand") + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>")) + (match_dup 3)) + (match_dup 4))))] "TARGET_SIMD" { operands[2] = aarch64_simd_gen_const_vector_dup (<MODE>mode, INTVAL (operands[2])); - emit_insn (gen_aarch64_<sur>q<r>shr<u>n_n<mode>_insn (operands[0], - operands[1], - operands[2])); + operands[3] = CONST0_RTX (<MODE>mode); + operands[4] + = aarch64_simd_gen_const_vector_dup (<MODE>mode, + GET_MODE_MASK (GET_MODE_INNER (<VNARROWQ>mode))); + } +) + +(define_insn "*aarch64_sqrshrun_n<mode>_insn<vczle><vczbe>" + [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") + (truncate:<VNARROWQ> + (smin:<V2XWIDE> + (smax:<V2XWIDE> + (ashiftrt:<V2XWIDE> + (plus:<V2XWIDE> + (sign_extend:<V2XWIDE> + (match_operand:VQN 1 "register_operand" "w")) + (match_operand:<V2XWIDE> 3 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>")) + (match_operand:<V2XWIDE> 4 "aarch64_simd_imm_zero")) + (match_operand:<V2XWIDE> 5 "aarch64_simd_umax_quarter_mode"))))] + "TARGET_SIMD + && aarch64_const_vec_rnd_cst_p (operands[3], operands[2])" + "sqrshrun\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_insn "aarch64_sqrshrun_n<mode>_insn" + [(set (match_operand:<V2XWIDE> 0 "register_operand" "=w") + (smin:<V2XWIDE> + (smax:<V2XWIDE> + (ashiftrt:<V2XWIDE> + (plus:<V2XWIDE> + (sign_extend:<V2XWIDE> + (match_operand:SD_HSDI 1 "register_operand" "w")) + (match_operand:<V2XWIDE> 3 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>")) + (const_int 0)) + (const_int <half_mask>)))] + "TARGET_SIMD + && aarch64_const_vec_rnd_cst_p (operands[3], operands[2])" + "sqrshrun\t%<vn2>0<Vmntype>, %<v>1<Vmtype>, %2" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_expand "aarch64_sqrshrun_n<mode>" + [(match_operand:<VNARROWQ> 0 "register_operand") + (match_operand:SD_HSDI 1 "register_operand") + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>")] + "TARGET_SIMD" + { + int prec = GET_MODE_UNIT_PRECISION (<V2XWIDE>mode); + wide_int rnd_wi = wi::set_bit_in_zero (INTVAL (operands[2]) - 1, prec); + rtx rnd = immed_wide_int_const (rnd_wi, <V2XWIDE>mode); + rtx dst = gen_reg_rtx (<V2XWIDE>mode); + emit_insn (gen_aarch64_sqrshrun_n<mode>_insn (dst, operands[1], operands[2], rnd)); + emit_move_insn (operands[0], gen_lowpart (<VNARROWQ>mode, dst)); + DONE; + } +) + +(define_expand "aarch64_sqrshrun_n<mode>" + [(set (match_operand:<VNARROWQ> 0 "register_operand") + (truncate:<VNARROWQ> + (smin:<V2XWIDE> + (smax:<V2XWIDE> + (ashiftrt:<V2XWIDE> + (plus:<V2XWIDE> + (sign_extend:<V2XWIDE> + (match_operand:VQN 1 "register_operand")) + (match_dup 3)) + (match_operand:SI 2 "aarch64_simd_shift_imm_offset_<ve_mode>")) + (match_dup 4)) + (match_dup 5))))] + "TARGET_SIMD" + { + int prec = GET_MODE_UNIT_PRECISION (<V2XWIDE>mode); + wide_int rnd_wi = wi::set_bit_in_zero (INTVAL (operands[2]) - 1, prec); + operands[3] = immed_wide_int_const (rnd_wi, GET_MODE_INNER (<V2XWIDE>mode)); + operands[3] = gen_const_vec_duplicate (<V2XWIDE>mode, operands[3]); + operands[2] = gen_const_vec_duplicate (<MODE>mode, operands[2]); + operands[4] = CONST0_RTX (<V2XWIDE>mode); + operands[5] + = gen_int_mode (GET_MODE_MASK (GET_MODE_INNER (<VNARROWQ>mode)), DImode); + operands[5] = gen_const_vec_duplicate (<V2XWIDE>mode, operands[5]); + } +) + +(define_insn "aarch64_<shrn_op><sra_op>shrn2_n<mode>_insn_le" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (match_operand:<VNARROWQ> 1 "register_operand" "0") + (ALL_TRUNC:<VNARROWQ> + (SHIFTRT:VQN + (match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")))))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN + && AARCH64_VALID_SHRN_OP (<ALL_TRUNC:CODE>, <SHIFTRT:CODE>)" + "<shrn_op>shrn2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_insn "aarch64_<shrn_op><sra_op>shrn2_n<mode>_insn_be" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (ALL_TRUNC:<VNARROWQ> + (SHIFTRT:VQN + (match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>"))) + (match_operand:<VNARROWQ> 1 "register_operand" "0")))] + "TARGET_SIMD && BYTES_BIG_ENDIAN + && AARCH64_VALID_SHRN_OP (<ALL_TRUNC:CODE>, <SHIFTRT:CODE>)" + "<shrn_op>shrn2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_expand "aarch64_<shrn_op><sra_op>shrn2_n<mode>" + [(match_operand:<VNARROWQ2> 0 "register_operand") + (match_operand:<VNARROWQ> 1 "register_operand") + (ALL_TRUNC:<VNARROWQ> + (SHIFTRT:VQN (match_operand:VQN 2 "register_operand"))) + (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<vn_mode>")] + "TARGET_SIMD && AARCH64_VALID_SHRN_OP (<ALL_TRUNC:CODE>, <SHIFTRT:CODE>)" + { + operands[3] = aarch64_simd_gen_const_vector_dup (<MODE>mode, + INTVAL (operands[3])); + + if (BYTES_BIG_ENDIAN) + emit_insn (gen_aarch64_<shrn_op><sra_op>shrn2_n<mode>_insn_be ( + operands[0], operands[1], operands[2], operands[3])); + else + emit_insn (gen_aarch64_<shrn_op><sra_op>shrn2_n<mode>_insn_le ( + operands[0], operands[1], operands[2], operands[3])); + DONE; + } +) + +(define_insn "aarch64_<shrn_op>rshrn2_n<mode>_insn_le" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (match_operand:<VNARROWQ> 1 "register_operand" "0") + (ALL_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:<V2XWIDE> + (plus:<V2XWIDE> + (<TRUNCEXTEND>:<V2XWIDE> + (match_operand:VQN 2 "register_operand" "w")) + (match_operand:<V2XWIDE> 4 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")))))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN + && aarch64_const_vec_rnd_cst_p (operands[4], operands[3])" + "<shrn_op>rshrn2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_insn "aarch64_<shrn_op>rshrn2_n<mode>_insn_be" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (ALL_TRUNC:<VNARROWQ> + (<TRUNC_SHIFT>:<V2XWIDE> + (plus:<V2XWIDE> + (<TRUNCEXTEND>:<V2XWIDE> + (match_operand:VQN 2 "register_operand" "w")) + (match_operand:<V2XWIDE> 4 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>"))) + (match_operand:<VNARROWQ> 1 "register_operand" "0")))] + "TARGET_SIMD && BYTES_BIG_ENDIAN + && aarch64_const_vec_rnd_cst_p (operands[4], operands[3])" + "<shrn_op>rshrn2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_expand "aarch64_<shrn_op>rshrn2_n<mode>" + [(match_operand:<VNARROWQ2> 0 "register_operand") + (match_operand:<VNARROWQ> 1 "register_operand") + (ALL_TRUNC:<VNARROWQ> (match_operand:VQN 2 "register_operand")) + (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<vn_mode>")] + "TARGET_SIMD" + { + if (<CODE> == TRUNCATE + && INTVAL (operands[3]) == GET_MODE_UNIT_BITSIZE (<VNARROWQ>mode)) + { + rtx tmp = aarch64_gen_shareable_zero (<MODE>mode); + emit_insn (gen_aarch64_raddhn2<mode> (operands[0], operands[1], + operands[2], tmp)); + DONE; + } + /* Use this expander to create the rounding constant vector, which is + 1 << (shift - 1). Use wide_int here to ensure that the right TImode + RTL is generated when handling the DImode expanders. */ + int prec = GET_MODE_UNIT_PRECISION (<V2XWIDE>mode); + wide_int rnd_wi = wi::set_bit_in_zero (INTVAL (operands[3]) - 1, prec); + rtx rnd = immed_wide_int_const (rnd_wi, GET_MODE_INNER (<V2XWIDE>mode)); + rnd = gen_const_vec_duplicate (<V2XWIDE>mode, rnd); + operands[3] = gen_const_vec_duplicate (<MODE>mode, operands[3]); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_aarch64_<shrn_op>rshrn2_n<mode>_insn_be (operands[0], + operands[1], + operands[2], + operands[3], + rnd)); + else + emit_insn (gen_aarch64_<shrn_op>rshrn2_n<mode>_insn_le (operands[0], + operands[1], + operands[2], + operands[3], + rnd)); DONE; } ) -(define_insn "aarch64_<sur>q<r>shr<u>n2_n<mode>_insn_le" +(define_insn "aarch64_sqshrun2_n<mode>_insn_le" [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") (vec_concat:<VNARROWQ2> (match_operand:<VNARROWQ> 1 "register_operand" "0") - (unspec:<VNARROWQ> [(match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 - "aarch64_simd_shift_imm_vec_<vn_mode>")] - VQSHRN_N)))] + (truncate:<VNARROWQ> + (smin:VQN + (smax:VQN + (ashiftrt:VQN + (match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")) + (match_operand:VQN 4 "aarch64_simd_imm_zero")) + (match_operand:VQN 5 "aarch64_simd_umax_half_mode")))))] "TARGET_SIMD && !BYTES_BIG_ENDIAN" - "<sur>q<r>shr<u>n2\\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" - [(set_attr "type" "neon_sat_shift_imm_narrow_q")] + "sqshrun2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] ) -(define_insn "aarch64_<sur>q<r>shr<u>n2_n<mode>_insn_be" +(define_insn "aarch64_sqshrun2_n<mode>_insn_be" [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") (vec_concat:<VNARROWQ2> - (unspec:<VNARROWQ> [(match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 - "aarch64_simd_shift_imm_vec_<vn_mode>")] - VQSHRN_N) + (truncate:<VNARROWQ> + (smin:VQN + (smax:VQN + (ashiftrt:VQN + (match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")) + (match_operand:VQN 4 "aarch64_simd_imm_zero")) + (match_operand:VQN 5 "aarch64_simd_umax_half_mode"))) (match_operand:<VNARROWQ> 1 "register_operand" "0")))] "TARGET_SIMD && BYTES_BIG_ENDIAN" - "<sur>q<r>shr<u>n2\\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" - [(set_attr "type" "neon_sat_shift_imm_narrow_q")] + "sqshrun2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] ) -(define_expand "aarch64_<sur>q<r>shr<u>n2_n<mode>" +(define_expand "aarch64_sqshrun2_n<mode>" [(match_operand:<VNARROWQ2> 0 "register_operand") (match_operand:<VNARROWQ> 1 "register_operand") - (unspec:<VNARROWQ> - [(match_operand:VQN 2 "register_operand") - (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<vn_mode>")] - VQSHRN_N)] + (match_operand:VQN 2 "register_operand") + (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<vn_mode>")] "TARGET_SIMD" { operands[3] = aarch64_simd_gen_const_vector_dup (<MODE>mode, INTVAL (operands[3])); - + rtx zeros = CONST0_RTX (<MODE>mode); + rtx half_umax + = aarch64_simd_gen_const_vector_dup (<MODE>mode, + GET_MODE_MASK (GET_MODE_INNER (<VNARROWQ>mode))); if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_<sur>q<r>shr<u>n2_n<mode>_insn_be (operands[0], - operands[1], operands[2], operands[3])); + emit_insn (gen_aarch64_sqshrun2_n<mode>_insn_be (operands[0], + operands[1], operands[2], operands[3], + zeros, half_umax)); else - emit_insn (gen_aarch64_<sur>q<r>shr<u>n2_n<mode>_insn_le (operands[0], - operands[1], operands[2], operands[3])); + emit_insn (gen_aarch64_sqshrun2_n<mode>_insn_le (operands[0], + operands[1], operands[2], operands[3], + zeros, half_umax)); DONE; } ) +(define_insn "aarch64_sqrshrun2_n<mode>_insn_le" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (match_operand:<VNARROWQ> 1 "register_operand" "0") + (truncate:<VNARROWQ> + (smin:<V2XWIDE> + (smax:<V2XWIDE> + (ashiftrt:<V2XWIDE> + (plus:<V2XWIDE> + (sign_extend:<V2XWIDE> + (match_operand:VQN 2 "register_operand" "w")) + (match_operand:<V2XWIDE> 4 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")) + (match_operand:<V2XWIDE> 5 "aarch64_simd_imm_zero")) + (match_operand:<V2XWIDE> 6 "aarch64_simd_umax_quarter_mode")))))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN + && aarch64_const_vec_rnd_cst_p (operands[4], operands[3])" + "sqrshrun2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_insn "aarch64_sqrshrun2_n<mode>_insn_be" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (truncate:<VNARROWQ> + (smin:<V2XWIDE> + (smax:<V2XWIDE> + (ashiftrt:<V2XWIDE> + (plus:<V2XWIDE> + (sign_extend:<V2XWIDE> + (match_operand:VQN 2 "register_operand" "w")) + (match_operand:<V2XWIDE> 4 "aarch64_simd_rsra_rnd_imm_vec")) + (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_<vn_mode>")) + (match_operand:<V2XWIDE> 5 "aarch64_simd_imm_zero")) + (match_operand:<V2XWIDE> 6 "aarch64_simd_umax_quarter_mode"))) + (match_operand:<VNARROWQ> 1 "register_operand" "0")))] + "TARGET_SIMD && BYTES_BIG_ENDIAN + && aarch64_const_vec_rnd_cst_p (operands[4], operands[3])" + "sqrshrun2\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3" + [(set_attr "type" "neon_shift_imm_narrow_q")] +) + +(define_expand "aarch64_sqrshrun2_n<mode>" + [(match_operand:<VNARROWQ2> 0 "register_operand") + (match_operand:<VNARROWQ> 1 "register_operand") + (match_operand:VQN 2 "register_operand") + (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<vn_mode>")] + "TARGET_SIMD" + { + int prec = GET_MODE_UNIT_PRECISION (<V2XWIDE>mode); + wide_int rnd_wi = wi::set_bit_in_zero (INTVAL (operands[3]) - 1, prec); + rtx rnd = immed_wide_int_const (rnd_wi, GET_MODE_INNER (<V2XWIDE>mode)); + rnd = gen_const_vec_duplicate (<V2XWIDE>mode, rnd); + rtx zero = CONST0_RTX (<V2XWIDE>mode); + rtx half_umax + = aarch64_simd_gen_const_vector_dup (<V2XWIDE>mode, + GET_MODE_MASK (GET_MODE_INNER (<VNARROWQ>mode))); + operands[3] = gen_const_vec_duplicate (<MODE>mode, operands[3]); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_aarch64_sqrshrun2_n<mode>_insn_be (operands[0], + operands[1], operands[2], operands[3], rnd, + zero, half_umax)); + else + emit_insn (gen_aarch64_sqrshrun2_n<mode>_insn_le (operands[0], + operands[1], operands[2], operands[3], rnd, + zero, half_umax)); + DONE; + } +) ;; cm(eq|ge|gt|lt|le) ;; Note, we have constraints for Dz and Z as different expanders diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc index cd9cace..95b4cb8 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc @@ -1056,6 +1056,139 @@ class svlast_impl : public quiet<function_base> public: CONSTEXPR svlast_impl (int unspec) : m_unspec (unspec) {} + bool is_lasta () const { return m_unspec == UNSPEC_LASTA; } + bool is_lastb () const { return m_unspec == UNSPEC_LASTB; } + + bool vect_all_same (tree v, int step) const + { + int i; + int nelts = vector_cst_encoded_nelts (v); + tree first_el = VECTOR_CST_ENCODED_ELT (v, 0); + + for (i = 0; i < nelts; i += step) + if (!operand_equal_p (VECTOR_CST_ENCODED_ELT (v, i), first_el, 0)) + return false; + + return true; + } + + /* Fold a svlast{a/b} call with constant predicate to a BIT_FIELD_REF. + BIT_FIELD_REF lowers to Advanced SIMD element extract, so we have to + ensure the index of the element being accessed is in the range of a + Advanced SIMD vector width. */ + gimple *fold (gimple_folder & f) const override + { + tree pred = gimple_call_arg (f.call, 0); + tree val = gimple_call_arg (f.call, 1); + + if (TREE_CODE (pred) == VECTOR_CST) + { + HOST_WIDE_INT pos; + int i = 0; + int step = f.type_suffix (0).element_bytes; + int step_1 = gcd (step, VECTOR_CST_NPATTERNS (pred)); + int npats = VECTOR_CST_NPATTERNS (pred); + unsigned enelts = vector_cst_encoded_nelts (pred); + tree b = NULL_TREE; + unsigned HOST_WIDE_INT nelts; + + /* We can optimize 2 cases common to variable and fixed-length cases + without a linear search of the predicate vector: + 1. LASTA if predicate is all true, return element 0. + 2. LASTA if predicate all false, return element 0. */ + if (is_lasta () && vect_all_same (pred, step_1)) + { + b = build3 (BIT_FIELD_REF, TREE_TYPE (f.lhs), val, + bitsize_int (step * BITS_PER_UNIT), bitsize_int (0)); + return gimple_build_assign (f.lhs, b); + } + + /* Handle the all-false case for LASTB where SVE VL == 128b - + return the highest numbered element. */ + if (is_lastb () && known_eq (BYTES_PER_SVE_VECTOR, 16) + && vect_all_same (pred, step_1) + && integer_zerop (VECTOR_CST_ENCODED_ELT (pred, 0))) + { + b = build3 (BIT_FIELD_REF, TREE_TYPE (f.lhs), val, + bitsize_int (step * BITS_PER_UNIT), + bitsize_int ((16 - step) * BITS_PER_UNIT)); + + return gimple_build_assign (f.lhs, b); + } + + /* Determine if there are any repeating non-zero elements in variable + length vectors. */ + if (!VECTOR_CST_NELTS (pred).is_constant (&nelts)) + { + /* If VECTOR_CST_NELTS_PER_PATTERN (pred) == 2 and every multiple of + 'step_1' in + [VECTOR_CST_NPATTERNS .. VECTOR_CST_ENCODED_NELTS - 1] + is zero, then we can treat the vector as VECTOR_CST_NPATTERNS + elements followed by all inactive elements. */ + if (VECTOR_CST_NELTS_PER_PATTERN (pred) == 2) + { + /* Restrict the scope of search to NPATS if vector is + variable-length for linear search later. */ + nelts = npats; + for (unsigned j = npats; j < enelts; j += step_1) + { + /* If there are active elements in the repeated pattern of a + variable-length vector, then return NULL as there is no + way to be sure statically if this falls within the + Advanced SIMD range. */ + if (!integer_zerop (VECTOR_CST_ENCODED_ELT (pred, j))) + return NULL; + } + } + else + /* If we're here, it means that for NELTS_PER_PATTERN != 2, there + is a repeating non-zero element. */ + return NULL; + } + + /* If we're here, it means either: + 1. The vector is variable-length and there's no active element in the + repeated part of the pattern, or + 2. The vector is fixed-length. + + Fall through to finding the last active element linearly for + for all cases where the last active element is known to be + within a statically-determinable range. */ + i = MAX ((int)nelts - step, 0); + for (; i >= 0; i -= step) + if (!integer_zerop (VECTOR_CST_ELT (pred, i))) + break; + + if (is_lastb ()) + { + /* For LASTB, the element is the last active element. */ + pos = i; + } + else + { + /* For LASTA, the element is one after last active element. */ + pos = i + step; + + /* If last active element is + last element, wrap-around and return first Advanced SIMD + element. */ + if (known_ge (pos, BYTES_PER_SVE_VECTOR)) + pos = 0; + } + + /* Out of Advanced SIMD range. */ + if (pos < 0 || pos > 15) + return NULL; + + b = build3 (BIT_FIELD_REF, TREE_TYPE (f.lhs), val, + bitsize_int (step * BITS_PER_UNIT), + bitsize_int (pos * BITS_PER_UNIT)); + + return gimple_build_assign (f.lhs, b); + } + return NULL; + } + rtx expand (function_expander &e) const override { diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index 2898b85..2de651a 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -4001,7 +4001,7 @@ ;; ------------------------------------------------------------------------- ;; Unpredicated integer absolute difference. -(define_expand "<su>abd<mode>_3" +(define_expand "<su>abd<mode>3" [(use (match_operand:SVE_I 0 "register_operand")) (USMAX:SVE_I (match_operand:SVE_I 1 "register_operand") @@ -6973,7 +6973,7 @@ { rtx ones = force_reg (<VSI2QI>mode, CONST1_RTX (<VSI2QI>mode)); rtx diff = gen_reg_rtx (<VSI2QI>mode); - emit_insn (gen_<su>abd<vsi2qi>_3 (diff, operands[1], operands[2])); + emit_insn (gen_<su>abd<vsi2qi>3 (diff, operands[1], operands[2])); emit_insn (gen_udot_prod<vsi2qi> (operands[0], diff, ones, operands[3])); DONE; } diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 1f1f27e..df37bde 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -22254,7 +22254,7 @@ aarch64_expand_vector_init_fallback (rtx target, rtx vals) and matches[X][1] with the count of duplicate elements (if X is the earliest element which has duplicates). */ - if (n_var == n_elts && n_elts <= 16) + if (n_var >= n_elts - 1 && n_elts <= 16) { int matches[16][2] = {0}; for (int i = 0; i < n_elts; i++) @@ -22271,12 +22271,23 @@ aarch64_expand_vector_init_fallback (rtx target, rtx vals) } int maxelement = 0; int maxv = 0; + rtx const_elem = NULL_RTX; + int const_elem_pos = 0; + for (int i = 0; i < n_elts; i++) - if (matches[i][1] > maxv) - { - maxelement = i; - maxv = matches[i][1]; - } + { + if (matches[i][1] > maxv) + { + maxelement = i; + maxv = matches[i][1]; + } + if (CONST_INT_P (XVECEXP (vals, 0, i)) + || CONST_DOUBLE_P (XVECEXP (vals, 0, i))) + { + const_elem_pos = i; + const_elem = XVECEXP (vals, 0, i); + } + } /* Create a duplicate of the most common element, unless all elements are equally useless to us, in which case just immediately set the @@ -22314,8 +22325,19 @@ aarch64_expand_vector_init_fallback (rtx target, rtx vals) vector register. For big-endian we want that position to hold the last element of VALS. */ maxelement = BYTES_BIG_ENDIAN ? n_elts - 1 : 0; - rtx x = force_reg (inner_mode, XVECEXP (vals, 0, maxelement)); - aarch64_emit_move (target, lowpart_subreg (mode, x, inner_mode)); + + /* If we have a single constant element, use that for duplicating + instead. */ + if (const_elem) + { + maxelement = const_elem_pos; + aarch64_emit_move (target, gen_vec_duplicate (mode, const_elem)); + } + else + { + rtx x = force_reg (inner_mode, XVECEXP (vals, 0, maxelement)); + aarch64_emit_move (target, lowpart_subreg (mode, x, inner_mode)); + } } else { @@ -27671,7 +27693,8 @@ aarch64_indirect_call_asm (rtx addr) const char * aarch64_output_load_tp (rtx dest) { - const char *tpidrs[] = {"tpidr_el0", "tpidr_el1", "tpidr_el2", "tpidr_el3"}; + const char *tpidrs[] = {"tpidr_el0", "tpidr_el1", "tpidr_el2", + "tpidr_el3", "tpidrro_el0"}; char buffer[64]; snprintf (buffer, sizeof (buffer), "mrs\t%%0, %s", tpidrs[aarch64_tpidr_register]); diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 801f9eb..a01f1ee 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -1297,4 +1297,9 @@ extern poly_uint16 aarch64_sve_vg; #define REG_ALLOC_ORDER {} #define ADJUST_REG_ALLOC_ORDER aarch64_adjust_reg_alloc_order () +#define AARCH64_VALID_SHRN_OP(T,S) \ +((T) == TRUNCATE \ + || ((T) == US_TRUNCATE && (S) == LSHIFTRT) \ + || ((T) == SS_TRUNCATE && (S) == ASHIFTRT)) + #endif /* GCC_AARCH64_H */ diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt index 025e52d..4a05804 100644 --- a/gcc/config/aarch64/aarch64.opt +++ b/gcc/config/aarch64/aarch64.opt @@ -105,14 +105,29 @@ EnumValue Enum(tp_reg) String(el0) Value(AARCH64_TPIDR_EL0) EnumValue +Enum(tp_reg) String(tpidr_el0) Value(AARCH64_TPIDR_EL0) + +EnumValue Enum(tp_reg) String(el1) Value(AARCH64_TPIDR_EL1) EnumValue +Enum(tp_reg) String(tpidr_el1) Value(AARCH64_TPIDR_EL1) + +EnumValue Enum(tp_reg) String(el2) Value(AARCH64_TPIDR_EL2) EnumValue +Enum(tp_reg) String(tpidr_el2) Value(AARCH64_TPIDR_EL2) + +EnumValue Enum(tp_reg) String(el3) Value(AARCH64_TPIDR_EL3) +EnumValue +Enum(tp_reg) String(tpidr_el3) Value(AARCH64_TPIDR_EL3) + +EnumValue +Enum(tp_reg) String(tpidrro_el0) Value(AARCH64_TPIDRRO_EL0) + mtp= Target RejectNegative Joined Enum(tp_reg) Var(aarch64_tpidr_reg) Init(AARCH64_TPIDR_EL0) Save Specify the thread pointer register. diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 0bb9839..0ace1ee 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -4755,42 +4755,42 @@ __extension__ extern __inline int8x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_n_s16 (int16x8_t __a, const int __b) { - return __builtin_aarch64_shrnv8hi (__a, __b); + return __builtin_aarch64_shrn_nv8hi (__a, __b); } __extension__ extern __inline int16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_n_s32 (int32x4_t __a, const int __b) { - return __builtin_aarch64_shrnv4si (__a, __b); + return __builtin_aarch64_shrn_nv4si (__a, __b); } __extension__ extern __inline int32x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_n_s64 (int64x2_t __a, const int __b) { - return __builtin_aarch64_shrnv2di (__a, __b); + return __builtin_aarch64_shrn_nv2di (__a, __b); } __extension__ extern __inline uint8x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_n_u16 (uint16x8_t __a, const int __b) { - return __builtin_aarch64_shrnv8hi_uus (__a, __b); + return __builtin_aarch64_shrn_nv8hi_uus (__a, __b); } __extension__ extern __inline uint16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_n_u32 (uint32x4_t __a, const int __b) { - return __builtin_aarch64_shrnv4si_uus (__a, __b); + return __builtin_aarch64_shrn_nv4si_uus (__a, __b); } __extension__ extern __inline uint32x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_n_u64 (uint64x2_t __a, const int __b) { - return __builtin_aarch64_shrnv2di_uus (__a, __b); + return __builtin_aarch64_shrn_nv2di_uus (__a, __b); } __extension__ extern __inline int32x4_t @@ -5469,42 +5469,42 @@ __extension__ extern __inline int8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vqshrn_high_n_s16 (int8x8_t __a, int16x8_t __b, const int __c) { - return __builtin_aarch64_sqshrn2_nv8hi (__a, __b, __c); + return __builtin_aarch64_sqsshrn2_nv8hi (__a, __b, __c); } __extension__ extern __inline int16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vqshrn_high_n_s32 (int16x4_t __a, int32x4_t __b, const int __c) { - return __builtin_aarch64_sqshrn2_nv4si (__a, __b, __c); + return __builtin_aarch64_sqsshrn2_nv4si (__a, __b, __c); } __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vqshrn_high_n_s64 (int32x2_t __a, int64x2_t __b, const int __c) { - return __builtin_aarch64_sqshrn2_nv2di (__a, __b, __c); + return __builtin_aarch64_sqsshrn2_nv2di (__a, __b, __c); } __extension__ extern __inline uint8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vqshrn_high_n_u16 (uint8x8_t __a, uint16x8_t __b, const int __c) { - return __builtin_aarch64_uqshrn2_nv8hi_uuus (__a, __b, __c); + return __builtin_aarch64_uqushrn2_nv8hi_uuus (__a, __b, __c); } __extension__ extern __inline uint16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vqshrn_high_n_u32 (uint16x4_t __a, uint32x4_t __b, const int __c) { - return __builtin_aarch64_uqshrn2_nv4si_uuus (__a, __b, __c); + return __builtin_aarch64_uqushrn2_nv4si_uuus (__a, __b, __c); } __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vqshrn_high_n_u64 (uint32x2_t __a, uint64x2_t __b, const int __c) { - return __builtin_aarch64_uqshrn2_nv2di_uuus (__a, __b, __c); + return __builtin_aarch64_uqushrn2_nv2di_uuus (__a, __b, __c); } __extension__ extern __inline uint8x16_t @@ -5532,84 +5532,84 @@ __extension__ extern __inline int8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_high_n_s16 (int8x8_t __a, int16x8_t __b, const int __c) { - return __builtin_aarch64_rshrn2v8hi (__a, __b, __c); + return __builtin_aarch64_rshrn2_nv8hi (__a, __b, __c); } __extension__ extern __inline int16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_high_n_s32 (int16x4_t __a, int32x4_t __b, const int __c) { - return __builtin_aarch64_rshrn2v4si (__a, __b, __c); + return __builtin_aarch64_rshrn2_nv4si (__a, __b, __c); } __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_high_n_s64 (int32x2_t __a, int64x2_t __b, const int __c) { - return __builtin_aarch64_rshrn2v2di (__a, __b, __c); + return __builtin_aarch64_rshrn2_nv2di (__a, __b, __c); } __extension__ extern __inline uint8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_high_n_u16 (uint8x8_t __a, uint16x8_t __b, const int __c) { - return __builtin_aarch64_rshrn2v8hi_uuus (__a, __b, __c); + return __builtin_aarch64_rshrn2_nv8hi_uuus (__a, __b, __c); } __extension__ extern __inline uint16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_high_n_u32 (uint16x4_t __a, uint32x4_t __b, const int __c) { - return __builtin_aarch64_rshrn2v4si_uuus (__a, __b, __c); + return __builtin_aarch64_rshrn2_nv4si_uuus (__a, __b, __c); } __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_high_n_u64 (uint32x2_t __a, uint64x2_t __b, const int __c) { - return __builtin_aarch64_rshrn2v2di_uuus (__a, __b, __c); + return __builtin_aarch64_rshrn2_nv2di_uuus (__a, __b, __c); } __extension__ extern __inline int8x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_n_s16 (int16x8_t __a, const int __b) { - return __builtin_aarch64_rshrnv8hi (__a, __b); + return __builtin_aarch64_rshrn_nv8hi (__a, __b); } __extension__ extern __inline int16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_n_s32 (int32x4_t __a, const int __b) { - return __builtin_aarch64_rshrnv4si (__a, __b); + return __builtin_aarch64_rshrn_nv4si (__a, __b); } __extension__ extern __inline int32x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_n_s64 (int64x2_t __a, const int __b) { - return __builtin_aarch64_rshrnv2di (__a, __b); + return __builtin_aarch64_rshrn_nv2di (__a, __b); } __extension__ extern __inline uint8x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_n_u16 (uint16x8_t __a, const int __b) { - return __builtin_aarch64_rshrnv8hi_uus (__a, __b); + return __builtin_aarch64_rshrn_nv8hi_uus (__a, __b); } __extension__ extern __inline uint16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_n_u32 (uint32x4_t __a, const int __b) { - return __builtin_aarch64_rshrnv4si_uus (__a, __b); + return __builtin_aarch64_rshrn_nv4si_uus (__a, __b); } __extension__ extern __inline uint32x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vrshrn_n_u64 (uint64x2_t __a, const int __b) { - return __builtin_aarch64_rshrnv2di_uus (__a, __b); + return __builtin_aarch64_rshrn_nv2di_uus (__a, __b); } __extension__ extern __inline uint32x2_t @@ -5630,42 +5630,42 @@ __extension__ extern __inline int8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_high_n_s16 (int8x8_t __a, int16x8_t __b, const int __c) { - return __builtin_aarch64_shrn2v8hi (__a, __b, __c); + return __builtin_aarch64_ushrn2_nv8hi (__a, __b, __c); } __extension__ extern __inline int16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_high_n_s32 (int16x4_t __a, int32x4_t __b, const int __c) { - return __builtin_aarch64_shrn2v4si (__a, __b, __c); + return __builtin_aarch64_ushrn2_nv4si (__a, __b, __c); } __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_high_n_s64 (int32x2_t __a, int64x2_t __b, const int __c) { - return __builtin_aarch64_shrn2v2di (__a, __b, __c); + return __builtin_aarch64_ushrn2_nv2di (__a, __b, __c); } __extension__ extern __inline uint8x16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_high_n_u16 (uint8x8_t __a, uint16x8_t __b, const int __c) { - return __builtin_aarch64_shrn2v8hi_uuus (__a, __b, __c); + return __builtin_aarch64_ushrn2_nv8hi_uuus (__a, __b, __c); } __extension__ extern __inline uint16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_high_n_u32 (uint16x4_t __a, uint32x4_t __b, const int __c) { - return __builtin_aarch64_shrn2v4si_uuus (__a, __b, __c); + return __builtin_aarch64_ushrn2_nv4si_uuus (__a, __b, __c); } __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vshrn_high_n_u64 (uint32x2_t __a, uint64x2_t __b, const int __c) { - return __builtin_aarch64_shrn2v2di_uuus (__a, __b, __c); + return __builtin_aarch64_ushrn2_nv2di_uuus (__a, __b, __c); } __extension__ extern __inline poly8x8_t diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 56ce125..7f9a512 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -645,12 +645,6 @@ UNSPEC_SQSHLU ; Used in aarch64-simd.md. UNSPEC_SQSHL ; Used in aarch64-simd.md. UNSPEC_UQSHL ; Used in aarch64-simd.md. - UNSPEC_SQSHRUN ; Used in aarch64-simd.md. - UNSPEC_SQRSHRUN ; Used in aarch64-simd.md. - UNSPEC_SQSHRN ; Used in aarch64-simd.md. - UNSPEC_UQSHRN ; Used in aarch64-simd.md. - UNSPEC_SQRSHRN ; Used in aarch64-simd.md. - UNSPEC_UQRSHRN ; Used in aarch64-simd.md. UNSPEC_SSHL ; Used in aarch64-simd.md. UNSPEC_USHL ; Used in aarch64-simd.md. UNSPEC_SRSHL ; Used in aarch64-simd.md. @@ -1532,7 +1526,8 @@ (define_mode_attr V2XWIDE [(V8QI "V8HI") (V4HI "V4SI") (V16QI "V16HI") (V8HI "V8SI") (V2SI "V2DI") (V4SI "V4DI") - (V2DI "V2TI") (DI "TI")]) + (V2DI "V2TI") (DI "TI") + (HI "SI") (SI "DI")]) ;; Predicate mode associated with VWIDE. (define_mode_attr VWIDE_PRED [(VNx8HF "VNx4BI") (VNx4SF "VNx2BI")]) @@ -2254,6 +2249,8 @@ ;; Signed and unsigned saturating truncations. (define_code_iterator SAT_TRUNC [ss_truncate us_truncate]) +(define_code_iterator ALL_TRUNC [ss_truncate us_truncate truncate]) + ;; SVE integer unary operations. (define_code_iterator SVE_INT_UNARY [abs neg not clrsb clz popcount (ss_abs "TARGET_SVE2") @@ -2339,6 +2336,10 @@ (define_code_attr SHIFTEXTEND [(ashiftrt "sign_extend") (lshiftrt "zero_extend")]) +(define_code_attr TRUNCEXTEND [(ss_truncate "sign_extend") + (us_truncate "zero_extend") + (truncate "zero_extend")]) + ;; For comparison operators we use the FCM* and CM* instructions. ;; As there are no CMLE or CMLT instructions which act on 3 vector ;; operands, we must use CMGE or CMGT and swap the order of the @@ -2391,6 +2392,8 @@ ;; op prefix for shift right and narrow. (define_code_attr srn_op [(ashiftrt "r") (lshiftrt "")]) +(define_code_attr shrn_s [(ashiftrt "s") (lshiftrt "")]) + ;; Map shift operators onto underlying bit-field instructions (define_code_attr bfshift [(ashift "ubfiz") (ashiftrt "sbfx") (lshiftrt "ubfx") (rotatert "extr")]) @@ -2428,6 +2431,12 @@ (ss_minus "sign_extend") (us_minus "zero_extend")]) +(define_code_attr TRUNC_SHIFT [(ss_truncate "ashiftrt") + (us_truncate "lshiftrt") (truncate "lshiftrt")]) + +(define_code_attr shrn_op [(ss_truncate "sq") + (us_truncate "uq") (truncate "")]) + ;; Whether a shift is left or right. (define_code_attr lr [(ashift "l") (ashiftrt "r") (lshiftrt "r")]) @@ -2645,10 +2654,6 @@ (define_int_iterator VQSHL_N [UNSPEC_SQSHLU UNSPEC_SQSHL UNSPEC_UQSHL]) -(define_int_iterator VQSHRN_N [UNSPEC_SQSHRUN UNSPEC_SQRSHRUN - UNSPEC_SQSHRN UNSPEC_UQSHRN - UNSPEC_SQRSHRN UNSPEC_UQRSHRN]) - (define_int_iterator SQRDMLH_AS [UNSPEC_SQRDMLAH UNSPEC_SQRDMLSH]) (define_int_iterator PERMUTE [UNSPEC_ZIP1 UNSPEC_ZIP2 @@ -3359,9 +3364,6 @@ (UNSPEC_URSHR "ur") (UNSPEC_SRSHR "sr") (UNSPEC_SQSHLU "s") (UNSPEC_SQSHL "s") (UNSPEC_UQSHL "u") - (UNSPEC_SQSHRUN "s") (UNSPEC_SQRSHRUN "s") - (UNSPEC_SQSHRN "s") (UNSPEC_UQSHRN "u") - (UNSPEC_SQRSHRN "s") (UNSPEC_UQRSHRN "u") (UNSPEC_USHL "u") (UNSPEC_SSHL "s") (UNSPEC_USHLL "u") (UNSPEC_SSHLL "s") (UNSPEC_URSHL "ur") (UNSPEC_SRSHL "sr") @@ -3373,9 +3375,6 @@ ]) (define_int_attr r [(UNSPEC_SQDMULH "") (UNSPEC_SQRDMULH "r") - (UNSPEC_SQSHRUN "") (UNSPEC_SQRSHRUN "r") - (UNSPEC_SQSHRN "") (UNSPEC_UQSHRN "") - (UNSPEC_SQRSHRN "r") (UNSPEC_UQRSHRN "r") (UNSPEC_SQSHL "") (UNSPEC_UQSHL "") (UNSPEC_SQRSHL "r")(UNSPEC_UQRSHL "r") (UNSPEC_SMULHS "") (UNSPEC_UMULHS "") @@ -3391,9 +3390,6 @@ (UNSPEC_SLI "l") (UNSPEC_SRI "r")]) (define_int_attr u [(UNSPEC_SQSHLU "u") (UNSPEC_SQSHL "") (UNSPEC_UQSHL "") - (UNSPEC_SQSHRUN "u") (UNSPEC_SQRSHRUN "u") - (UNSPEC_SQSHRN "") (UNSPEC_UQSHRN "") - (UNSPEC_SQRSHRN "") (UNSPEC_UQRSHRN "") (UNSPEC_SHADD "") (UNSPEC_UHADD "u") (UNSPEC_SRHADD "") (UNSPEC_URHADD "u")]) diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md index 9391aba..b31ba6e 100644 --- a/gcc/config/aarch64/predicates.md +++ b/gcc/config/aarch64/predicates.md @@ -599,10 +599,17 @@ (and (match_code "const_vector") (match_test "aarch64_const_vec_all_same_in_range_p (op, (HOST_WIDE_INT_1U - << (GET_MODE_UNIT_BITSIZE (mode) / 2)) - 1, + << (GET_MODE_UNIT_BITSIZE (mode) / 2)) - 1, (HOST_WIDE_INT_1U - << (GET_MODE_UNIT_BITSIZE (mode) / 2)) - 1)"))) + << (GET_MODE_UNIT_BITSIZE (mode) / 2)) - 1)"))) +(define_predicate "aarch64_simd_umax_quarter_mode" + (and (match_code "const_vector") + (match_test "aarch64_const_vec_all_same_in_range_p (op, + (HOST_WIDE_INT_1U + << (GET_MODE_UNIT_BITSIZE (mode) / 4)) - 1, + (HOST_WIDE_INT_1U + << (GET_MODE_UNIT_BITSIZE (mode) / 4)) - 1)"))) (define_predicate "aarch64_simd_shift_imm_vec_qi" (and (match_code "const_vector") (match_test "aarch64_const_vec_all_same_in_range_p (op, 1, 8)"))) diff --git a/gcc/config/arm/arm-opts.h b/gcc/config/arm/arm-opts.h index 9964fd2..174dbc5 100644 --- a/gcc/config/arm/arm-opts.h +++ b/gcc/config/arm/arm-opts.h @@ -61,7 +61,9 @@ enum float_abi_type enum arm_tp_type { TP_AUTO, TP_SOFT, - TP_CP15 + TP_TPIDRURW, + TP_TPIDRURO, + TP_TPIDRPRW }; /* Which TLS scheme to use. */ diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 61fcd67..7d73c66 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -182,6 +182,7 @@ extern bool arm_is_long_call_p (tree); extern int arm_emit_vector_const (FILE *, rtx); extern void arm_emit_fp16_const (rtx c); extern const char * arm_output_load_gr (rtx *); +extern const char * arm_output_load_tpidr (rtx, bool); extern const char *vfp_output_vstmd (rtx *); extern void arm_output_multireg_pop (rtx *, bool, rtx, bool, bool); extern void arm_set_return_address (rtx, rtx); diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index c3e731b..38f0839 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -3927,7 +3927,7 @@ arm_option_reconfigure_globals (void) if (target_thread_pointer == TP_AUTO) { if (arm_arch6k && !TARGET_THUMB1) - target_thread_pointer = TP_CP15; + target_thread_pointer = TP_TPIDRURO; else target_thread_pointer = TP_SOFT; } @@ -34648,4 +34648,34 @@ arm_get_mask_mode (machine_mode mode) return default_get_mask_mode (mode); } +/* Output assembly to read the thread pointer from the appropriate TPIDR + register into DEST. If PRED_P also emit the %? that can be used to + output the predication code. */ + +const char * +arm_output_load_tpidr (rtx dst, bool pred_p) +{ + char buf[64]; + int tpidr_coproc_num = -1; + switch (target_thread_pointer) + { + case TP_TPIDRURW: + tpidr_coproc_num = 2; + break; + case TP_TPIDRURO: + tpidr_coproc_num = 3; + break; + case TP_TPIDRPRW: + tpidr_coproc_num = 4; + break; + default: + gcc_unreachable (); + } + snprintf (buf, sizeof (buf), + "mrc%s\tp15, 0, %%0, c13, c0, %d\t@ load_tp_hard", + pred_p ? "%?" : "", tpidr_coproc_num); + output_asm_insn (buf, &dst); + return ""; +} + #include "gt-arm.h" diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 7d40b8b..4f54530 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -152,8 +152,8 @@ emission of floating point pcs attributes. */ #define TARGET_AAPCS_BASED \ (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS) -#define TARGET_HARD_TP (target_thread_pointer == TP_CP15) #define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT) +#define TARGET_HARD_TP !TARGET_SOFT_TP #define TARGET_GNU2_TLS (target_tls_dialect == TLS_GNU2) /* Only 16-bit thumb code. */ diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 2c7249f..2ac9723 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -12275,7 +12275,7 @@ [(set (match_operand:SI 0 "register_operand" "=r") (unspec:SI [(const_int 0)] UNSPEC_TLS))] "TARGET_HARD_TP" - "mrc%?\\tp15, 0, %0, c13, c0, 3\\t@ load_tp_hard" + "* return arm_output_load_tpidr (operands[0], true);" [(set_attr "predicable" "yes") (set_attr "type" "mrs")] ) @@ -12285,7 +12285,7 @@ [(set (match_operand:SI 0 "register_operand" "=r") (unspec_volatile:SI [(const_int 0)] VUNSPEC_MRC))] "TARGET_HARD_TP" - "mrc\\tp15, 0, %0, c13, c0, 3\\t@ reload_tp_hard" + "* return arm_output_load_tpidr (operands[0], false);" [(set_attr "type" "mrs")] ) diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt index 3a49b51..88299da 100644 --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -230,7 +230,16 @@ EnumValue Enum(arm_tp_type) String(auto) Value(TP_AUTO) EnumValue -Enum(arm_tp_type) String(cp15) Value(TP_CP15) +Enum(arm_tp_type) String(tpidrurw) Value(TP_TPIDRURW) + +EnumValue +Enum(arm_tp_type) String(cp15) Value(TP_TPIDRURO) + +EnumValue +Enum(arm_tp_type) String(tpidruro) Value(TP_TPIDRURO) + +EnumValue +Enum(arm_tp_type) String(tpidrprw) Value(TP_TPIDRPRW) mtpcs-frame Target Mask(TPCS_FRAME) diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 988c123..8b608bf 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -946,6 +946,18 @@ main (int argc, char **argv) else if (startswith (argv[i], STR)) gcn_stack_size = atoi (argv[i] + strlen (STR)); #undef STR + /* Translate host into offloading libraries. */ + else if (strcmp (argv[i], "-l_GCC_gfortran") == 0 + || strcmp (argv[i], "-l_GCC_m") == 0) + { + /* Elide '_GCC_'. */ + size_t i_dst = strlen ("-l"); + size_t i_src = strlen ("-l_GCC_"); + char c; + do + c = argv[i][i_dst++] = argv[i][i_src++]; + while (c != '\0'); + } } if (!(fopenacc ^ fopenmp)) diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md index aeda107..fd490f3 100644 --- a/gcc/config/i386/constraints.md +++ b/gcc/config/i386/constraints.md @@ -162,7 +162,9 @@ ;; g GOT memory operand. ;; m Vector memory operand ;; c Constant memory operand +;; k TLS address that allows insn using non-integer registers ;; n Memory operand without REX prefix +;; r Broadcast memory operand ;; s Sibcall memory operand, not valid for TARGET_X32 ;; w Call memory operand, not valid for TARGET_X32 ;; z Constant call address operand. diff --git a/gcc/config/i386/gcc-auto-profile b/gcc/config/i386/gcc-auto-profile index 5ab224b..04f7d35 100755 --- a/gcc/config/i386/gcc-auto-profile +++ b/gcc/config/i386/gcc-auto-profile @@ -43,8 +43,10 @@ model*:\ 47|\ model*:\ 37|\ model*:\ 44) E="cpu/event=0x88,umask=0x40/$FLAGS" ;; model*:\ 55|\ +model*:\ 74|\ model*:\ 77|\ model*:\ 76|\ +model*:\ 90|\ model*:\ 92|\ model*:\ 95|\ model*:\ 87|\ @@ -75,14 +77,19 @@ model*:\ 165|\ model*:\ 166|\ model*:\ 85|\ model*:\ 85) E="cpu/event=0xC4,umask=0x20/p$FLAGS" ;; +model*:\ 125|\ model*:\ 126|\ +model*:\ 167|\ model*:\ 140|\ model*:\ 141|\ model*:\ 143|\ +model*:\ 207|\ model*:\ 106|\ model*:\ 108) E="cpu/event=0xc4,umask=0x20/p$FLAGS" ;; model*:\ 134|\ -model*:\ 150) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;; +model*:\ 150|\ +model*:\ 156|\ +model*:\ 190) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;; *) echo >&2 "Unknown CPU. Run contrib/gen_autofdo_event.py --all --script to update script." exit 1 ;; diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 3a1444d..b20cb86 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -5358,19 +5358,19 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx *operands) if (GET_MODE_SIZE (mode) == 64) { gcc_assert (TARGET_AVX512F); - return "vpcmpeqd \t %t0, %t0, %t0"; + return "vpcmpeqd\t%t0, %t0, %t0"; } else if (GET_MODE_SIZE (mode) == 32) { gcc_assert (TARGET_AVX); - return "vpcmpeqd \t %x0, %x0, %x0"; + return "vpcmpeqd\t%x0, %x0, %x0"; } gcc_unreachable (); } else if (vector_all_ones_zero_extend_quarter_operand (x, mode)) { gcc_assert (TARGET_AVX512F); - return "vpcmpeqd \t %x0, %x0, %x0"; + return "vpcmpeqd\t%x0, %x0, %x0"; } gcc_unreachable (); diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 0929115..93794c1 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -6172,6 +6172,36 @@ (clobber (reg:CC FLAGS_REG))])] "split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[3]);") +(define_insn_and_split "*add<dwi>3_doubleword_concat" + [(set (match_operand:<DWI> 0 "register_operand" "=&r") + (plus:<DWI> + (any_or_plus:<DWI> + (ashift:<DWI> + (zero_extend:<DWI> + (match_operand:DWIH 2 "nonimmediate_operand" "rm")) + (match_operand:QI 3 "const_int_operand")) + (zero_extend:<DWI> + (match_operand:DWIH 4 "nonimmediate_operand" "rm"))) + (match_operand:<DWI> 1 "register_operand" "0"))) + (clobber (reg:CC FLAGS_REG))] + "INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT" + "#" + "&& reload_completed" + [(parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (plus:DWIH (match_dup 1) (match_dup 4)) + (match_dup 1))) + (set (match_dup 0) + (plus:DWIH (match_dup 1) (match_dup 4)))]) + (parallel [(set (match_dup 5) + (plus:DWIH + (plus:DWIH + (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) + (match_dup 6)) + (match_dup 2))) + (clobber (reg:CC FLAGS_REG))])] + "split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[5]);") + (define_insn "*add<mode>_1" [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r") (plus:SWI48 @@ -7733,6 +7763,25 @@ [(set (reg:CC FLAGS_REG) (compare:CC (match_dup 0) (match_dup 1)))]) +(define_peephole2 + [(set (match_operand:SWI 0 "general_reg_operand") + (match_operand:SWI 1 "memory_operand")) + (parallel [(set (reg:CC FLAGS_REG) + (compare:CC (match_dup 0) + (match_operand:SWI 2 "memory_operand"))) + (set (match_dup 0) + (minus:SWI (match_dup 0) (match_dup 2)))]) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (reg:CC FLAGS_REG) + (compare:CC (match_dup 1) (match_dup 0))) + (set (match_dup 1) + (minus:SWI (match_dup 1) (match_dup 0)))])]) + ;; decl %eax; cmpl $-1, %eax; jne .Lxx; can be optimized into ;; subl $1, %eax; jnc .Lxx; (define_peephole2 @@ -7818,6 +7867,59 @@ (set_attr "pent_pair" "pu") (set_attr "mode" "<MODE>")]) +(define_peephole2 + [(set (match_operand:SWI 0 "general_reg_operand") + (match_operand:SWI 1 "memory_operand")) + (parallel [(set (match_dup 0) + (plus:SWI + (plus:SWI + (match_operator:SWI 4 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") + (const_int 0)]) + (match_dup 0)) + (match_operand:SWI 2 "memory_operand"))) + (clobber (reg:CC FLAGS_REG))]) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (match_dup 1) + (plus:SWI (plus:SWI (match_op_dup 4 + [(match_dup 3) (const_int 0)]) + (match_dup 1)) + (match_dup 0))) + (clobber (reg:CC FLAGS_REG))])]) + +(define_peephole2 + [(set (match_operand:SWI 0 "general_reg_operand") + (match_operand:SWI 1 "memory_operand")) + (parallel [(set (match_dup 0) + (plus:SWI + (plus:SWI + (match_operator:SWI 4 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") + (const_int 0)]) + (match_dup 0)) + (match_operand:SWI 2 "memory_operand"))) + (clobber (reg:CC FLAGS_REG))]) + (set (match_operand:SWI 5 "general_reg_operand") (match_dup 0)) + (set (match_dup 1) (match_dup 5))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && peep2_reg_dead_p (4, operands[5]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2]) + && !reg_overlap_mentioned_p (operands[5], operands[1])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (match_dup 1) + (plus:SWI (plus:SWI (match_op_dup 4 + [(match_dup 3) (const_int 0)]) + (match_dup 1)) + (match_dup 0))) + (clobber (reg:CC FLAGS_REG))])]) + (define_insn "*add<mode>3_carry_0" [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") (plus:SWI @@ -7918,6 +8020,149 @@ (set_attr "pent_pair" "pu") (set_attr "mode" "<MODE>")]) +(define_peephole2 + [(parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (plus:SWI48 + (plus:SWI48 + (match_operator:SWI48 4 "ix86_carry_flag_operator" + [(match_operand 2 "flags_reg_operand") + (const_int 0)]) + (match_operand:SWI48 0 "general_reg_operand")) + (match_operand:SWI48 1 "memory_operand"))) + (plus:<DWI> + (zero_extend:<DWI> (match_dup 1)) + (match_operator:<DWI> 3 "ix86_carry_flag_operator" + [(match_dup 2) (const_int 0)])))) + (set (match_dup 0) + (plus:SWI48 (plus:SWI48 (match_op_dup 4 + [(match_dup 2) (const_int 0)]) + (match_dup 0)) + (match_dup 1)))]) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (2, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1])" + [(parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (plus:SWI48 + (plus:SWI48 + (match_op_dup 4 + [(match_dup 2) (const_int 0)]) + (match_dup 1)) + (match_dup 0))) + (plus:<DWI> + (zero_extend:<DWI> (match_dup 0)) + (match_op_dup 3 + [(match_dup 2) (const_int 0)])))) + (set (match_dup 1) + (plus:SWI48 (plus:SWI48 (match_op_dup 4 + [(match_dup 2) (const_int 0)]) + (match_dup 1)) + (match_dup 0)))])]) + +(define_peephole2 + [(set (match_operand:SWI48 0 "general_reg_operand") + (match_operand:SWI48 1 "memory_operand")) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (plus:SWI48 + (plus:SWI48 + (match_operator:SWI48 5 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") + (const_int 0)]) + (match_dup 0)) + (match_operand:SWI48 2 "memory_operand"))) + (plus:<DWI> + (zero_extend:<DWI> (match_dup 2)) + (match_operator:<DWI> 4 "ix86_carry_flag_operator" + [(match_dup 3) (const_int 0)])))) + (set (match_dup 0) + (plus:SWI48 (plus:SWI48 (match_op_dup 5 + [(match_dup 3) (const_int 0)]) + (match_dup 0)) + (match_dup 2)))]) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (plus:SWI48 + (plus:SWI48 + (match_op_dup 5 + [(match_dup 3) (const_int 0)]) + (match_dup 1)) + (match_dup 0))) + (plus:<DWI> + (zero_extend:<DWI> (match_dup 0)) + (match_op_dup 4 + [(match_dup 3) (const_int 0)])))) + (set (match_dup 1) + (plus:SWI48 (plus:SWI48 (match_op_dup 5 + [(match_dup 3) (const_int 0)]) + (match_dup 1)) + (match_dup 0)))])]) + +(define_peephole2 + [(parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (plus:SWI48 + (plus:SWI48 + (match_operator:SWI48 4 "ix86_carry_flag_operator" + [(match_operand 2 "flags_reg_operand") + (const_int 0)]) + (match_operand:SWI48 0 "general_reg_operand")) + (match_operand:SWI48 1 "memory_operand"))) + (plus:<DWI> + (zero_extend:<DWI> (match_dup 1)) + (match_operator:<DWI> 3 "ix86_carry_flag_operator" + [(match_dup 2) (const_int 0)])))) + (set (match_dup 0) + (plus:SWI48 (plus:SWI48 (match_op_dup 4 + [(match_dup 2) (const_int 0)]) + (match_dup 0)) + (match_dup 1)))]) + (set (match_operand:QI 5 "general_reg_operand") + (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) + (set (match_operand:SWI48 6 "general_reg_operand") + (zero_extend:SWI48 (match_dup 5))) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (4, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[5]) + && !reg_overlap_mentioned_p (operands[5], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[6]) + && !reg_overlap_mentioned_p (operands[6], operands[1])" + [(parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (plus:SWI48 + (plus:SWI48 + (match_op_dup 4 + [(match_dup 2) (const_int 0)]) + (match_dup 1)) + (match_dup 0))) + (plus:<DWI> + (zero_extend:<DWI> (match_dup 0)) + (match_op_dup 3 + [(match_dup 2) (const_int 0)])))) + (set (match_dup 1) + (plus:SWI48 (plus:SWI48 (match_op_dup 4 + [(match_dup 2) (const_int 0)]) + (match_dup 1)) + (match_dup 0)))]) + (set (match_dup 5) (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) + (set (match_dup 6) (zero_extend:SWI48 (match_dup 5)))]) + (define_expand "addcarry<mode>_0" [(parallel [(set (reg:CCC FLAGS_REG) @@ -7988,6 +8233,59 @@ (set_attr "pent_pair" "pu") (set_attr "mode" "<MODE>")]) +(define_peephole2 + [(set (match_operand:SWI 0 "general_reg_operand") + (match_operand:SWI 1 "memory_operand")) + (parallel [(set (match_dup 0) + (minus:SWI + (minus:SWI + (match_dup 0) + (match_operator:SWI 4 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") + (const_int 0)])) + (match_operand:SWI 2 "memory_operand"))) + (clobber (reg:CC FLAGS_REG))]) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (match_dup 1) + (minus:SWI (minus:SWI (match_dup 1) + (match_op_dup 4 + [(match_dup 3) (const_int 0)])) + (match_dup 0))) + (clobber (reg:CC FLAGS_REG))])]) + +(define_peephole2 + [(set (match_operand:SWI 0 "general_reg_operand") + (match_operand:SWI 1 "memory_operand")) + (parallel [(set (match_dup 0) + (minus:SWI + (minus:SWI + (match_dup 0) + (match_operator:SWI 4 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") + (const_int 0)])) + (match_operand:SWI 2 "memory_operand"))) + (clobber (reg:CC FLAGS_REG))]) + (set (match_operand:SWI 5 "general_reg_operand") (match_dup 0)) + (set (match_dup 1) (match_dup 5))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && peep2_reg_dead_p (4, operands[5]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2]) + && !reg_overlap_mentioned_p (operands[5], operands[1])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (match_dup 1) + (minus:SWI (minus:SWI (match_dup 1) + (match_op_dup 4 + [(match_dup 3) (const_int 0)])) + (match_dup 0))) + (clobber (reg:CC FLAGS_REG))])]) + (define_insn "*sub<mode>3_carry_0" [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") (minus:SWI @@ -8113,13 +8411,13 @@ [(set (reg:CCC FLAGS_REG) (compare:CCC (zero_extend:<DWI> - (match_operand:SWI48 1 "nonimmediate_operand" "0")) + (match_operand:SWI48 1 "nonimmediate_operand" "0,0")) (plus:<DWI> (match_operator:<DWI> 4 "ix86_carry_flag_operator" [(match_operand 3 "flags_reg_operand") (const_int 0)]) (zero_extend:<DWI> - (match_operand:SWI48 2 "nonimmediate_operand" "rm"))))) - (set (match_operand:SWI48 0 "register_operand" "=r") + (match_operand:SWI48 2 "nonimmediate_operand" "r,rm"))))) + (set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r") (minus:SWI48 (minus:SWI48 (match_dup 1) (match_operator:SWI48 5 "ix86_carry_flag_operator" @@ -8132,6 +8430,154 @@ (set_attr "pent_pair" "pu") (set_attr "mode" "<MODE>")]) +(define_peephole2 + [(set (match_operand:SWI48 0 "general_reg_operand") + (match_operand:SWI48 1 "memory_operand")) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> (match_dup 0)) + (plus:<DWI> + (match_operator:<DWI> 4 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") (const_int 0)]) + (zero_extend:<DWI> + (match_operand:SWI48 2 "memory_operand"))))) + (set (match_dup 0) + (minus:SWI48 + (minus:SWI48 + (match_dup 0) + (match_operator:SWI48 5 "ix86_carry_flag_operator" + [(match_dup 3) (const_int 0)])) + (match_dup 2)))]) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> (match_dup 1)) + (plus:<DWI> (match_op_dup 4 + [(match_dup 3) (const_int 0)]) + (zero_extend:<DWI> (match_dup 0))))) + (set (match_dup 1) + (minus:SWI48 (minus:SWI48 (match_dup 1) + (match_op_dup 5 + [(match_dup 3) (const_int 0)])) + (match_dup 0)))])]) + +(define_peephole2 + [(set (match_operand:SWI48 6 "general_reg_operand") + (match_operand:SWI48 7 "memory_operand")) + (set (match_operand:SWI48 8 "general_reg_operand") + (match_operand:SWI48 9 "memory_operand")) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (match_operand:SWI48 0 "general_reg_operand")) + (plus:<DWI> + (match_operator:<DWI> 4 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") (const_int 0)]) + (zero_extend:<DWI> + (match_operand:SWI48 2 "general_reg_operand"))))) + (set (match_dup 0) + (minus:SWI48 + (minus:SWI48 + (match_dup 0) + (match_operator:SWI48 5 "ix86_carry_flag_operator" + [(match_dup 3) (const_int 0)])) + (match_dup 2)))]) + (set (match_operand:SWI48 1 "memory_operand") (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (4, operands[0]) + && peep2_reg_dead_p (3, operands[2]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[2], operands[1]) + && !reg_overlap_mentioned_p (operands[6], operands[9]) + && (rtx_equal_p (operands[6], operands[0]) + ? (rtx_equal_p (operands[7], operands[1]) + && rtx_equal_p (operands[8], operands[2])) + : (rtx_equal_p (operands[8], operands[0]) + && rtx_equal_p (operands[9], operands[1]) + && rtx_equal_p (operands[6], operands[2])))" + [(set (match_dup 0) (match_dup 9)) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> (match_dup 1)) + (plus:<DWI> (match_op_dup 4 + [(match_dup 3) (const_int 0)]) + (zero_extend:<DWI> (match_dup 0))))) + (set (match_dup 1) + (minus:SWI48 (minus:SWI48 (match_dup 1) + (match_op_dup 5 + [(match_dup 3) (const_int 0)])) + (match_dup 0)))])] +{ + if (!rtx_equal_p (operands[6], operands[0])) + operands[9] = operands[7]; +}) + +(define_peephole2 + [(set (match_operand:SWI48 6 "general_reg_operand") + (match_operand:SWI48 7 "memory_operand")) + (set (match_operand:SWI48 8 "general_reg_operand") + (match_operand:SWI48 9 "memory_operand")) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> + (match_operand:SWI48 0 "general_reg_operand")) + (plus:<DWI> + (match_operator:<DWI> 4 "ix86_carry_flag_operator" + [(match_operand 3 "flags_reg_operand") (const_int 0)]) + (zero_extend:<DWI> + (match_operand:SWI48 2 "general_reg_operand"))))) + (set (match_dup 0) + (minus:SWI48 + (minus:SWI48 + (match_dup 0) + (match_operator:SWI48 5 "ix86_carry_flag_operator" + [(match_dup 3) (const_int 0)])) + (match_dup 2)))]) + (set (match_operand:QI 10 "general_reg_operand") + (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) + (set (match_operand:SWI48 11 "general_reg_operand") + (zero_extend:SWI48 (match_dup 10))) + (set (match_operand:SWI48 1 "memory_operand") (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (6, operands[0]) + && peep2_reg_dead_p (3, operands[2]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[2], operands[1]) + && !reg_overlap_mentioned_p (operands[6], operands[9]) + && !reg_overlap_mentioned_p (operands[0], operands[10]) + && !reg_overlap_mentioned_p (operands[10], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[11]) + && !reg_overlap_mentioned_p (operands[11], operands[1]) + && (rtx_equal_p (operands[6], operands[0]) + ? (rtx_equal_p (operands[7], operands[1]) + && rtx_equal_p (operands[8], operands[2])) + : (rtx_equal_p (operands[8], operands[0]) + && rtx_equal_p (operands[9], operands[1]) + && rtx_equal_p (operands[6], operands[2])))" + [(set (match_dup 0) (match_dup 9)) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (zero_extend:<DWI> (match_dup 1)) + (plus:<DWI> (match_op_dup 4 + [(match_dup 3) (const_int 0)]) + (zero_extend:<DWI> (match_dup 0))))) + (set (match_dup 1) + (minus:SWI48 (minus:SWI48 (match_dup 1) + (match_op_dup 5 + [(match_dup 3) (const_int 0)])) + (match_dup 0)))]) + (set (match_dup 10) (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) + (set (match_dup 11) (zero_extend:SWI48 (match_dup 10)))] +{ + if (!rtx_equal_p (operands[6], operands[0])) + operands[9] = operands[7]; +}) + (define_expand "subborrow<mode>_0" [(parallel [(set (reg:CC FLAGS_REG) @@ -8142,6 +8588,67 @@ (minus:SWI48 (match_dup 1) (match_dup 2)))])] "ix86_binary_operator_ok (MINUS, <MODE>mode, operands)") +(define_expand "uaddc<mode>5" + [(match_operand:SWI48 0 "register_operand") + (match_operand:SWI48 1 "register_operand") + (match_operand:SWI48 2 "register_operand") + (match_operand:SWI48 3 "register_operand") + (match_operand:SWI48 4 "nonmemory_operand")] + "" +{ + rtx cf = gen_rtx_REG (CCCmode, FLAGS_REG), pat, pat2; + if (operands[4] == const0_rtx) + emit_insn (gen_addcarry<mode>_0 (operands[0], operands[2], operands[3])); + else + { + rtx op4 = copy_to_mode_reg (QImode, + convert_to_mode (QImode, operands[4], 1)); + emit_insn (gen_addqi3_cconly_overflow (op4, constm1_rtx)); + pat = gen_rtx_LTU (<DWI>mode, cf, const0_rtx); + pat2 = gen_rtx_LTU (<MODE>mode, cf, const0_rtx); + emit_insn (gen_addcarry<mode> (operands[0], operands[2], operands[3], + cf, pat, pat2)); + } + rtx cc = gen_reg_rtx (QImode); + pat = gen_rtx_LTU (QImode, cf, const0_rtx); + emit_insn (gen_rtx_SET (cc, pat)); + emit_insn (gen_zero_extendqi<mode>2 (operands[1], cc)); + DONE; +}) + +(define_expand "usubc<mode>5" + [(match_operand:SWI48 0 "register_operand") + (match_operand:SWI48 1 "register_operand") + (match_operand:SWI48 2 "register_operand") + (match_operand:SWI48 3 "register_operand") + (match_operand:SWI48 4 "nonmemory_operand")] + "" +{ + rtx cf, pat, pat2; + if (operands[4] == const0_rtx) + { + cf = gen_rtx_REG (CCmode, FLAGS_REG); + emit_insn (gen_subborrow<mode>_0 (operands[0], operands[2], + operands[3])); + } + else + { + cf = gen_rtx_REG (CCCmode, FLAGS_REG); + rtx op4 = copy_to_mode_reg (QImode, + convert_to_mode (QImode, operands[4], 1)); + emit_insn (gen_addqi3_cconly_overflow (op4, constm1_rtx)); + pat = gen_rtx_LTU (<DWI>mode, cf, const0_rtx); + pat2 = gen_rtx_LTU (<MODE>mode, cf, const0_rtx); + emit_insn (gen_subborrow<mode> (operands[0], operands[2], operands[3], + cf, pat, pat2)); + } + rtx cc = gen_reg_rtx (QImode); + pat = gen_rtx_LTU (QImode, cf, const0_rtx); + emit_insn (gen_rtx_SET (cc, pat)); + emit_insn (gen_zero_extendqi<mode>2 (operands[1], cc)); + DONE; +}) + (define_mode_iterator CC_CCC [CC CCC]) ;; Pre-reload splitter to optimize @@ -8154,7 +8661,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Set the carry flag from the carry flag. (define_insn_and_split "*setccc" @@ -8163,7 +8671,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Set the carry flag from the carry flag. (define_insn_and_split "*setcc_qi_negqi_ccc_1_<mode>" @@ -8172,7 +8681,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Set the carry flag from the carry flag. (define_insn_and_split "*setcc_qi_negqi_ccc_2_<mode>" @@ -8182,7 +8692,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Overflow setting add instructions @@ -8241,6 +8752,27 @@ (match_dup 1))) (set (match_dup 1) (plus:SWI (match_dup 1) (match_dup 0)))])]) +(define_peephole2 + [(set (match_operand:SWI 0 "general_reg_operand") + (match_operand:SWI 1 "memory_operand")) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (plus:SWI (match_dup 0) + (match_operand:SWI 2 "memory_operand")) + (match_dup 0))) + (set (match_dup 0) (plus:SWI (match_dup 0) (match_dup 2)))]) + (set (match_dup 1) (match_dup 0))] + "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) + && peep2_reg_dead_p (3, operands[0]) + && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2])" + [(set (match_dup 0) (match_dup 2)) + (parallel [(set (reg:CCC FLAGS_REG) + (compare:CCC + (plus:SWI (match_dup 1) (match_dup 0)) + (match_dup 1))) + (set (match_dup 1) (plus:SWI (match_dup 1) (match_dup 0)))])]) + (define_insn "*addsi3_zext_cc_overflow_1" [(set (reg:CCC FLAGS_REG) (compare:CCC diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h index 3a21cec..0146ed4 100644 --- a/gcc/config/i386/mingw-w64.h +++ b/gcc/config/i386/mingw-w64.h @@ -25,7 +25,27 @@ along with GCC; see the file COPYING3. If not see #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \ "%{municode:-DUNICODE} " \ "%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \ - "%{" SPEC_PTHREAD2 ":-U_REENTRANT} " + "%{" SPEC_PTHREAD2 ":-U_REENTRANT} " \ + "%{mcrtdll=crtdll*:-U__MSVCRT__ -D__CRTDLL__} " \ + "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \ + "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \ + "%{mcrtdll=msvcrt40*:-D__MSVCRT_VERSION__=0x400} " \ + "%{mcrtdll=msvcrt-os*:-D__MSVCRT_VERSION__=0x700} " \ + "%{mcrtdll=msvcr70*:-D__MSVCRT_VERSION__=0x700} " \ + "%{mcrtdll=msvcr71*:-D__MSVCRT_VERSION__=0x701} " \ + "%{mcrtdll=msvcr80*:-D__MSVCRT_VERSION__=0x800} " \ + "%{mcrtdll=msvcr90*:-D__MSVCRT_VERSION__=0x900} " \ + "%{mcrtdll=msvcr100*:-D__MSVCRT_VERSION__=0xA00} " \ + "%{mcrtdll=msvcr110*:-D__MSVCRT_VERSION__=0xB00} " \ + "%{mcrtdll=msvcr120*:-D__MSVCRT_VERSION__=0xC00} " \ + "%{mcrtdll=ucrt*:-D_UCRT} " + +#undef REAL_LIBGCC_SPEC +#define REAL_LIBGCC_SPEC \ + "%{mthreads:-lmingwthrd} -lmingw32 \ + " SHARED_LIBGCC_SPEC " \ + -lmingwex %{!mcrtdll=*:-lmsvcrt} %{mcrtdll=*:-l%*} \ + -lkernel32 " MCFGTHREAD_SPEC #undef STARTFILE_SPEC #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ diff --git a/gcc/config/i386/mingw.opt b/gcc/config/i386/mingw.opt index 0ae026a..dd66a50 100644 --- a/gcc/config/i386/mingw.opt +++ b/gcc/config/i386/mingw.opt @@ -18,6 +18,10 @@ ; along with GCC; see the file COPYING3. If not see ; <http://www.gnu.org/licenses/>. +mcrtdll= +Target RejectNegative Joined +Preprocess, compile or link with specified C RunTime DLL library. + pthread Driver diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index 6a55baa..a1ee001 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -89,7 +89,20 @@ along with GCC; see the file COPYING3. If not see #undef CPP_SPEC #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \ "%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \ - "%{" SPEC_PTHREAD2 ": } " + "%{" SPEC_PTHREAD2 ": } " \ + "%{mcrtdll=crtdll*:-U__MSVCRT__ -D__CRTDLL__} " \ + "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \ + "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \ + "%{mcrtdll=msvcrt40*:-D__MSVCRT_VERSION__=0x400} " \ + "%{mcrtdll=msvcrt-os*:-D__MSVCRT_VERSION__=0x700} " \ + "%{mcrtdll=msvcr70*:-D__MSVCRT_VERSION__=0x700} " \ + "%{mcrtdll=msvcr71*:-D__MSVCRT_VERSION__=0x701} " \ + "%{mcrtdll=msvcr80*:-D__MSVCRT_VERSION__=0x800} " \ + "%{mcrtdll=msvcr90*:-D__MSVCRT_VERSION__=0x900} " \ + "%{mcrtdll=msvcr100*:-D__MSVCRT_VERSION__=0xA00} " \ + "%{mcrtdll=msvcr110*:-D__MSVCRT_VERSION__=0xB00} " \ + "%{mcrtdll=msvcr120*:-D__MSVCRT_VERSION__=0xC00} " \ + "%{mcrtdll=ucrt*:-D_UCRT} " /* For Windows applications, include more libraries, but always include kernel32. */ @@ -184,11 +197,18 @@ along with GCC; see the file COPYING3. If not see #define REAL_LIBGCC_SPEC \ "%{mthreads:-lmingwthrd} -lmingw32 \ " SHARED_LIBGCC_SPEC " \ - -lmoldname -lmingwex -lmsvcrt -lkernel32 " MCFGTHREAD_SPEC + %{mcrtdll=crtdll*:-lcoldname} %{!mcrtdll=crtdll*:-lmoldname} \ + -lmingwex %{!mcrtdll=*:-lmsvcrt} %{mcrtdll=*:-l%*} \ + -lkernel32 " MCFGTHREAD_SPEC #undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ - %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \ +#define STARTFILE_SPEC " \ + %{shared|mdll:%{mcrtdll=crtdll*:dllcrt1%O%s}} \ + %{shared|mdll:%{!mcrtdll=crtdll*:dllcrt2%O%s}} \ + %{!shared:%{!mdll:%{mcrtdll=crtdll*:crt1%O%s}}} \ + %{!shared:%{!mdll:%{!mcrtdll=crtdll*:crt2%O%s}}} \ + %{pg:%{mcrtdll=crtdll*:gcrt1%O%s}} \ + %{pg:%{!mcrtdll=crtdll*:gcrt2%O%s}} \ crtbegin.o%s \ %{fvtable-verify=none:%s; \ fvtable-verify=preinit:vtv_start.o%s; \ diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 7d4b4ec..70d7410 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -1333,7 +1333,7 @@ (define_insn "mov<mode>_internal" [(set (match_operand:VMOVE 0 "nonimmediate_operand" - "=v,v ,v,v ,m") + "=v,v ,x,v ,m") (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand" " C,<sseconstm1>,BH,vm,v"))] "TARGET_SSE @@ -25922,9 +25922,9 @@ "TARGET_AVX512F" { /* There is no DF broadcast (in AVX-512*) to 128b register. - Mimic it with integer variant. */ + Mimic it with vmovddup, just like vec_dupv2df<mask_name> does. */ if (<MODE>mode == V2DFmode) - return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"; + return "vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"; return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}"; } diff --git a/gcc/config/loongarch/loongarch-def.c b/gcc/config/loongarch/loongarch-def.c index fc4ebbe..6729c85 100644 --- a/gcc/config/loongarch/loongarch-def.c +++ b/gcc/config/loongarch/loongarch-def.c @@ -72,6 +72,18 @@ loongarch_cpu_cache[N_TUNE_TYPES] = { }, }; +struct loongarch_align +loongarch_cpu_align[N_TUNE_TYPES] = { + [CPU_LOONGARCH64] = { + .function = "32", + .label = "16", + }, + [CPU_LA464] = { + .function = "32", + .label = "16", + }, +}; + /* The following properties cannot be looked up directly using "cpucfg". So it is necessary to provide a default value for "unknown native" tune targets (i.e. -mtune=native while PRID does not correspond to diff --git a/gcc/config/loongarch/loongarch-def.h b/gcc/config/loongarch/loongarch-def.h index 778b140..fb8bb88 100644 --- a/gcc/config/loongarch/loongarch-def.h +++ b/gcc/config/loongarch/loongarch-def.h @@ -144,6 +144,7 @@ extern int loongarch_cpu_issue_rate[]; extern int loongarch_cpu_multipass_dfa_lookahead[]; extern struct loongarch_cache loongarch_cpu_cache[]; +extern struct loongarch_align loongarch_cpu_align[]; extern struct loongarch_rtx_cost_data loongarch_cpu_rtx_cost_data[]; #ifdef __cplusplus diff --git a/gcc/config/loongarch/loongarch-tune.h b/gcc/config/loongarch/loongarch-tune.h index ba31c4f..5c03262 100644 --- a/gcc/config/loongarch/loongarch-tune.h +++ b/gcc/config/loongarch/loongarch-tune.h @@ -48,4 +48,12 @@ struct loongarch_cache { int simultaneous_prefetches; /* number of parallel prefetch */ }; +/* Alignment for functions and labels for best performance. For new uarchs + the value should be measured via benchmarking. See the documentation for + -falign-functions and -falign-labels in invoke.texi for the format. */ +struct loongarch_align { + const char *function; /* default value for -falign-functions */ + const char *label; /* default value for -falign-labels */ +}; + #endif /* LOONGARCH_TUNE_H */ diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index eb73d11..5b8b93e 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -6249,6 +6249,12 @@ loongarch_option_override_internal (struct gcc_options *opts) && !opts->x_optimize_size) opts->x_flag_prefetch_loop_arrays = 1; + if (opts->x_flag_align_functions && !opts->x_str_align_functions) + opts->x_str_align_functions = loongarch_cpu_align[LARCH_ACTUAL_TUNE].function; + + if (opts->x_flag_align_labels && !opts->x_str_align_labels) + opts->x_str_align_labels = loongarch_cpu_align[LARCH_ACTUAL_TUNE].label; + if (TARGET_DIRECT_EXTERN_ACCESS && flag_shlib) error ("%qs cannot be used for compiling a shared library", "-mdirect-extern-access"); diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h index 829acda..eca7232 100644 --- a/gcc/config/loongarch/loongarch.h +++ b/gcc/config/loongarch/loongarch.h @@ -1073,7 +1073,7 @@ typedef struct { /* The base cost of a memcpy call, for MOVE_RATIO and friends. These values were determined experimentally by benchmarking with CSiBE. */ -#define LARCH_CALL_RATIO 8 +#define LARCH_CALL_RATIO 6 /* Any loop-based implementation of cpymemsi will have at least LARCH_MAX_MOVE_OPS_PER_LOOP_ITER memory-to-memory diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index 816a943..b37e070 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -2895,6 +2895,10 @@ } [(set_attr "type" "branch")]) +;; Micro-architecture unconditionally treats a "jr $ra" as "return from subroutine", +;; non-returning indirect jumps through $ra would interfere with both subroutine +;; return prediction and the more general indirect branch prediction. + (define_expand "indirect_jump" [(set (pc) (match_operand 0 "register_operand"))] "" @@ -2905,7 +2909,7 @@ }) (define_insn "@indirect_jump<mode>" - [(set (pc) (match_operand:P 0 "register_operand" "r"))] + [(set (pc) (match_operand:P 0 "register_operand" "e"))] "" "jr\t%0" [(set_attr "type" "jump") @@ -2928,7 +2932,7 @@ (define_insn "@tablejump<mode>" [(set (pc) - (match_operand:P 0 "register_operand" "r")) + (match_operand:P 0 "register_operand" "e")) (use (label_ref (match_operand 1 "" "")))] "" "jr\t%0" diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index c1d1691..999127a 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -498,6 +498,9 @@ static int mips_base_target_flags; /* The default compression mode. */ unsigned int mips_base_compression_flags; +/* The default code readable setting. */ +enum mips_code_readable_setting mips_base_code_readable; + /* The ambient values of other global variables. */ static int mips_base_schedule_insns; /* flag_schedule_insns */ static int mips_base_reorder_blocks_and_partition; /* flag_reorder... */ @@ -602,6 +605,7 @@ const enum reg_class mips_regno_to_class[FIRST_PSEUDO_REGISTER] = { ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS }; +static tree mips_handle_code_readable_attr (tree *, tree, tree, int, bool *); static tree mips_handle_interrupt_attr (tree *, tree, tree, int, bool *); static tree mips_handle_use_shadow_register_set_attr (tree *, tree, tree, int, bool *); @@ -623,6 +627,8 @@ static const struct attribute_spec mips_attribute_table[] = { { "micromips", 0, 0, true, false, false, false, NULL, NULL }, { "nomicromips", 0, 0, true, false, false, false, NULL, NULL }, { "nocompression", 0, 0, true, false, false, false, NULL, NULL }, + { "code_readable", 0, 1, true, false, false, false, + mips_handle_code_readable_attr, NULL }, /* Allow functions to be specified as interrupt handlers */ { "interrupt", 0, 1, false, true, true, false, mips_handle_interrupt_attr, NULL }, @@ -1310,6 +1316,81 @@ mips_use_debug_exception_return_p (tree type) TYPE_ATTRIBUTES (type)) != NULL; } + +/* Verify the arguments to a code_readable attribute. */ + +static tree +mips_handle_code_readable_attr (tree *node ATTRIBUTE_UNUSED, tree name, + tree args, int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) +{ + if (!is_attribute_p ("code_readable", name) || args == NULL) + return NULL_TREE; + + if (TREE_CODE (TREE_VALUE (args)) != STRING_CST) + { + warning (OPT_Wattributes, + "%qE attribute requires a string argument", name); + *no_add_attrs = true; + } + else if (strcmp (TREE_STRING_POINTER (TREE_VALUE (args)), "no") != 0 + && strcmp (TREE_STRING_POINTER (TREE_VALUE (args)), "pcrel") != 0 + && strcmp (TREE_STRING_POINTER (TREE_VALUE (args)), "yes") != 0) + { + warning (OPT_Wattributes, + "argument to %qE attribute is neither no, pcrel nor yes", name); + *no_add_attrs = true; + } + + return NULL_TREE; +} + +/* Determine the code_readable setting for a function if it has one. Set + *valid to true if we have a properly formed argument and + return the result. If there's no argument, return GCC's default. + Otherwise, leave valid false and return mips_base_code_readable. In + that case the result should be unused anyway. */ + +static enum mips_code_readable_setting +mips_get_code_readable_attr (tree decl) +{ + tree attr; + + if (decl == NULL) + return mips_base_code_readable; + + attr = lookup_attribute ("code_readable", DECL_ATTRIBUTES (decl)); + + if (attr != NULL) + { + if (TREE_VALUE (attr) != NULL_TREE) + { + const char * str; + + str = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))); + if (strcmp (str, "no") == 0) + return CODE_READABLE_NO; + else if (strcmp (str, "pcrel") == 0) + return CODE_READABLE_PCREL; + else if (strcmp (str, "yes") == 0) + return CODE_READABLE_YES; + + /* mips_handle_code_readable_attr will have verified the + arguments are correct before adding the attribute. */ + gcc_unreachable (); + } + + /* Just like GCC's default -mcode-readable= setting, the + presence of the code_readable attribute implies that a + function can read data from the instruction stream by + default. */ + return CODE_READABLE_YES; + } + + return mips_base_code_readable; +} + + /* Return the set of compression modes that are explicitly required by the attributes in ATTRIBUTES. */ @@ -19917,12 +19998,25 @@ mips_set_compression_mode (unsigned int compression_mode) /* Implement TARGET_SET_CURRENT_FUNCTION. Decide whether the current function should use the MIPS16 or microMIPS ISA and switch modes - accordingly. */ + accordingly. Also set the current code_readable mode. */ static void mips_set_current_function (tree fndecl) { + enum mips_code_readable_setting old_code_readable = mips_code_readable; + mips_set_compression_mode (mips_get_compress_mode (fndecl)); + + mips_code_readable = mips_get_code_readable_attr (fndecl); + + /* Since the mips_code_readable setting has potentially changed, the + relocation tables must be reinitialized. Otherwise GCC will not + split symbols for functions that are code_readable ("no") when others + are code_readable ("yes") and ICE later on in places such as + mips_emit_move. Ditto for similar paired cases. It must be restored + to its previous state as well. */ + if (old_code_readable != mips_code_readable) + mips_init_relocs (); } /* Allocate a chunk of memory for per-function machine-dependent data. */ @@ -20054,6 +20148,7 @@ mips_option_override (void) were generating uncompressed code. */ mips_base_compression_flags = TARGET_COMPRESSION; target_flags &= ~TARGET_COMPRESSION; + mips_base_code_readable = mips_code_readable; /* -mno-float overrides -mhard-float and -msoft-float. */ if (TARGET_NO_FLOAT) diff --git a/gcc/config/moxie/uclinux.h b/gcc/config/moxie/uclinux.h index f7bb62e..a7d3710 100644 --- a/gcc/config/moxie/uclinux.h +++ b/gcc/config/moxie/uclinux.h @@ -32,11 +32,3 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #undef TARGET_LIBC_HAS_FUNCTION #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function - -/* Like the definition in gcc.cc, but for purposes of uClinux, every link is - static. */ -#define MFWRAP_SPEC " %{fmudflap|fmudflapth: \ - --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc\ - --wrap=mmap --wrap=munmap --wrap=alloca\ - %{fmudflapth: --wrap=pthread_create\ -}} %{fmudflap|fmudflapth: --wrap=main}" diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc index 6cdea45..aaea9fb 100644 --- a/gcc/config/nvptx/mkoffload.cc +++ b/gcc/config/nvptx/mkoffload.cc @@ -649,6 +649,18 @@ main (int argc, char **argv) else if (strcmp (argv[i], "-dumpbase") == 0 && i + 1 < argc) dumppfx = argv[++i]; + /* Translate host into offloading libraries. */ + else if (strcmp (argv[i], "-l_GCC_gfortran") == 0 + || strcmp (argv[i], "-l_GCC_m") == 0) + { + /* Elide '_GCC_'. */ + size_t i_dst = strlen ("-l"); + size_t i_src = strlen ("-l_GCC_"); + char c; + do + c = argv[i][i_dst++] = argv[i][i_src++]; + while (c != '\0'); + } } if (!(fopenacc ^ fopenmp)) fatal_error (input_location, "either %<-fopenacc%> or %<-fopenmp%> " diff --git a/gcc/config/riscv/autovec-opt.md b/gcc/config/riscv/autovec-opt.md index aef28e4..fb1b072 100644 --- a/gcc/config/riscv/autovec-opt.md +++ b/gcc/config/riscv/autovec-opt.md @@ -37,9 +37,9 @@ (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr, vr")) (match_operand:VWEXTI 3 "register_operand" " vr, vr")) (match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred_vf2 (<CODE>, <MODE>mode); @@ -132,9 +132,9 @@ (bitmanip_bitwise:VB (not:VB (match_operand:VB 2 "register_operand" " vr")) (match_operand:VB 1 "register_operand" " vr")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred_not (<CODE>, <MODE>mode); @@ -159,9 +159,9 @@ (any_bitwise:VB (match_operand:VB 1 "register_operand" " vr") (match_operand:VB 2 "register_operand" " vr"))))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred_n (<CODE>, <MODE>mode); @@ -346,9 +346,9 @@ (match_operand:VWEXTI 1 "register_operand" " vr,vr") (any_extend:VWEXTI (match_operand:<V_DOUBLE_TRUNC> 2 "vector_shift_operand" " vr,vk")))))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred_narrow (<any_shiftrt:CODE>, <MODE>mode); @@ -364,9 +364,9 @@ (any_shiftrt:VWEXTI (match_operand:VWEXTI 1 "register_operand" " vr") (match_operand:<VEL> 2 "csr_operand" " rK"))))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { operands[2] = gen_lowpart (Pmode, operands[2]); diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md index eadc2c5..c23a625 100644 --- a/gcc/config/riscv/autovec.md +++ b/gcc/config/riscv/autovec.md @@ -155,9 +155,9 @@ (any_shift:VI (match_operand:VI 1 "register_operand" " vr") (match_operand:<VEL> 2 "csr_operand" " rK")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { operands[2] = gen_lowpart (Pmode, operands[2]); @@ -180,9 +180,9 @@ (any_shift:VI (match_operand:VI 1 "register_operand" " vr,vr") (match_operand:VI 2 "vector_shift_operand" " vr,vk")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { riscv_vector::emit_vlmax_insn (code_for_pred (<CODE>, <MODE>mode), @@ -205,9 +205,9 @@ [(set (match_operand:VB 0 "register_operand" "=vr") (any_bitwise:VB (match_operand:VB 1 "register_operand" " vr") (match_operand:VB 2 "register_operand" " vr")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred (<CODE>, <MODE>mode); @@ -227,9 +227,9 @@ (define_insn_and_split "one_cmpl<mode>2" [(set (match_operand:VB 0 "register_operand" "=vr") (not:VB (match_operand:VB 1 "register_operand" " vr")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred_not (<MODE>mode); @@ -366,9 +366,9 @@ [(set (match_operand:VWEXTI 0 "register_operand" "=&vr") (any_extend:VWEXTI (match_operand:<V_DOUBLE_TRUNC> 1 "register_operand" "vr")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred_vf2 (<CODE>, <MODE>mode); @@ -409,9 +409,9 @@ [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vr") (truncate:<V_DOUBLE_TRUNC> (match_operand:VWEXTI 1 "register_operand" " vr")))] - "TARGET_VECTOR" + "TARGET_VECTOR && can_create_pseudo_p ()" "#" - "&& can_create_pseudo_p ()" + "&& 1" [(const_int 0)] { insn_code icode = code_for_pred_trunc (<MODE>mode); diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index 6db3a46..b23a9c1 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -303,4 +303,6 @@ th_mempair_output_move (rtx[4], bool, machine_mode, RTX_CODE); #endif extern bool riscv_use_divmod_expander (void); +void riscv_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); + #endif /* ! GCC_RISCV_PROTOS_H */ diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index e1b85a5..6421e93 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -399,10 +399,17 @@ rvv_builder::get_merge_scalar_mask (unsigned int index_in_pattern) const { unsigned HOST_WIDE_INT mask = 0; unsigned HOST_WIDE_INT base_mask = (1ULL << index_in_pattern); + /* Here we construct a mask pattern that will later be broadcast + to a vector register. The maximum broadcast size for vmv.v.x/vmv.s.x + is determined by the length of a vector element (ELEN) and not by + XLEN so make sure we do not exceed it. One example is -march=zve32* + which mandates ELEN == 32 but can be combined with -march=rv64 + with XLEN == 64. */ + unsigned int elen = TARGET_VECTOR_ELEN_64 ? 64 : 32; - gcc_assert (BITS_PER_WORD % npatterns () == 0); + gcc_assert (elen % npatterns () == 0); - int limit = BITS_PER_WORD / npatterns (); + int limit = elen / npatterns (); for (int i = 0; i < limit; i++) mask |= base_mask << (i * npatterns ()); @@ -457,6 +464,9 @@ rvv_builder::single_step_npatterns_p () const { 2, 2, 2, 2, 4, 4, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, ... } E.g. NPATTERNS = 8: { 2, 2, 2, 2, 2, 2, 2, 2, 8, 8, 8, 8, 8, 8, 8, 8, ... } + We only check ele[0] ~ ele[NPATTERNS - 1] whether they are the same. + We don't need to check the elements[n] with n >= NPATTERNS since + they don't belong to the same pattern. */ bool rvv_builder::npatterns_all_equal_p () const @@ -836,6 +846,47 @@ emit_vlmax_masked_gather_mu_insn (rtx target, rtx op, rtx sel, rtx mask) emit_vlmax_masked_mu_insn (icode, RVV_BINOP_MU, ops); } +/* According to RVV ISA spec (16.5.1. Synthesizing vdecompress): + https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc + + There is no inverse vdecompress provided, as this operation can be readily + synthesized using iota and a masked vrgather: + + Desired functionality of 'vdecompress' + 7 6 5 4 3 2 1 0 # vid + + e d c b a # packed vector of 5 elements + 1 0 0 1 1 1 0 1 # mask vector of 8 elements + p q r s t u v w # destination register before vdecompress + + e q r d c b v a # result of vdecompress + # v0 holds mask + # v1 holds packed data + # v11 holds input expanded vector and result + viota.m v10, v0 # Calc iota from mask in v0 + vrgather.vv v11, v1, v10, v0.t # Expand into destination + p q r s t u v w # v11 destination register + e d c b a # v1 source vector + 1 0 0 1 1 1 0 1 # v0 mask vector + + 4 4 4 3 2 1 1 0 # v10 result of viota.m + e q r d c b v a # v11 destination after vrgather using viota.m under mask +*/ +static void +emit_vlmax_decompress_insn (rtx target, rtx op0, rtx op1, rtx mask) +{ + machine_mode data_mode = GET_MODE (target); + machine_mode sel_mode = related_int_vector_mode (data_mode).require (); + if (GET_MODE_INNER (data_mode) == QImode) + sel_mode = get_vector_mode (HImode, GET_MODE_NUNITS (data_mode)).require (); + + rtx sel = gen_reg_rtx (sel_mode); + rtx iota_ops[] = {sel, mask}; + emit_vlmax_insn (code_for_pred_iota (sel_mode), RVV_UNOP, iota_ops); + emit_vlmax_gather_insn (target, op0, sel); + emit_vlmax_masked_gather_mu_insn (target, op1, sel, mask); +} + /* Emit merge instruction. */ static machine_mode @@ -1210,7 +1261,6 @@ struct mode_vtype_group ratio_for_min_vlen64[MODE##mode] = RATIO_FOR_MIN_VLEN64; \ vlmul_for_for_vlen128[MODE##mode] = VLMUL_FOR_MIN_VLEN128; \ ratio_for_for_vlen128[MODE##mode] = RATIO_FOR_MIN_VLEN128; -#include "riscv-vector-switch.def" #define TUPLE_ENTRY(MODE, REQUIREMENT, SUBPART_MODE, NF, VLMUL_FOR_MIN_VLEN32, \ RATIO_FOR_MIN_VLEN32, VLMUL_FOR_MIN_VLEN64, \ RATIO_FOR_MIN_VLEN64, VLMUL_FOR_MIN_VLEN128, \ @@ -1224,6 +1274,8 @@ struct mode_vtype_group vlmul_for_for_vlen128[MODE##mode] = VLMUL_FOR_MIN_VLEN128; \ ratio_for_for_vlen128[MODE##mode] = RATIO_FOR_MIN_VLEN128; #include "riscv-vector-switch.def" +#undef ENTRY +#undef TUPLE_ENTRY } }; @@ -1883,7 +1935,7 @@ expand_vector_init_merge_repeating_sequence (rtx target, rtx mask = gen_reg_rtx (mask_mode); rtx dup = gen_reg_rtx (dup_mode); - if (full_nelts <= BITS_PER_WORD) /* vmv.s.x. */ + if (full_nelts <= builder.inner_bits_size ()) /* vmv.s.x. */ { rtx ops[] = {dup, gen_scalar_move_mask (dup_mask_mode), RVV_VUNDEF (dup_mode), merge_mask}; @@ -1893,7 +1945,8 @@ expand_vector_init_merge_repeating_sequence (rtx target, else /* vmv.v.x. */ { rtx ops[] = {dup, force_reg (GET_MODE_INNER (dup_mode), merge_mask)}; - rtx vl = gen_int_mode (CEIL (full_nelts, BITS_PER_WORD), Pmode); + rtx vl = gen_int_mode (CEIL (full_nelts, builder.inner_bits_size ()), + Pmode); emit_nonvlmax_integer_move_insn (code_for_pred_broadcast (dup_mode), ops, vl); } @@ -2337,6 +2390,125 @@ struct expand_vec_perm_d bool testing_p; }; +/* Recognize the patterns that we can use merge operation to shuffle the + vectors. The value of Each element (index i) in selector can only be + either i or nunits + i. We will check the pattern is actually monotonic. + + E.g. + v = VEC_PERM_EXPR (v0, v1, selector), + selector = { 0, nunits + 1, 2, nunits + 3, 4, nunits + 5, ... } + + We can transform such pattern into: + + v = vcond_mask (v0, v1, mask), + mask = { 0, 1, 0, 1, 0, 1, ... }. */ + +static bool +shuffle_merge_patterns (struct expand_vec_perm_d *d) +{ + machine_mode vmode = d->vmode; + machine_mode sel_mode = related_int_vector_mode (vmode).require (); + int n_patterns = d->perm.encoding ().npatterns (); + poly_int64 vec_len = d->perm.length (); + + for (int i = 0; i < n_patterns; ++i) + if (!known_eq (d->perm[i], i) && !known_eq (d->perm[i], vec_len + i)) + return false; + + /* Check the pattern is monotonic here, otherwise, return false. */ + for (int i = n_patterns; i < n_patterns * 2; i++) + if (!d->perm.series_p (i, n_patterns, i, n_patterns) + && !d->perm.series_p (i, n_patterns, vec_len + i, n_patterns)) + return false; + + if (d->testing_p) + return true; + + machine_mode mask_mode = get_mask_mode (vmode).require (); + rtx mask = gen_reg_rtx (mask_mode); + + rtx sel = vec_perm_indices_to_rtx (sel_mode, d->perm); + + /* MASK = SELECTOR < NUNTIS ? 1 : 0. */ + rtx x = gen_int_mode (vec_len, GET_MODE_INNER (sel_mode)); + insn_code icode = code_for_pred_cmp_scalar (sel_mode); + rtx cmp = gen_rtx_fmt_ee (LTU, mask_mode, sel, x); + rtx ops[] = {mask, cmp, sel, x}; + emit_vlmax_cmp_insn (icode, ops); + + /* TARGET = MASK ? OP0 : OP1. */ + emit_insn (gen_vcond_mask (vmode, vmode, d->target, d->op0, d->op1, mask)); + return true; +} + +/* Recognize decompress patterns: + + 1. VEC_PERM_EXPR op0 and op1 + with isel = { 0, nunits, 1, nunits + 1, ... }. + Decompress op0 and op1 vector with the mask = { 0, 1, 0, 1, ... }. + + 2. VEC_PERM_EXPR op0 and op1 + with isel = { 1/2 nunits, 3/2 nunits, 1/2 nunits+1, 3/2 nunits+1,... }. + Slide down op0 and op1 with OFFSET = 1/2 nunits. + Decompress op0 and op1 vector with the mask = { 0, 1, 0, 1, ... }. +*/ +static bool +shuffle_decompress_patterns (struct expand_vec_perm_d *d) +{ + poly_uint64 nelt = d->perm.length (); + machine_mode mask_mode = get_mask_mode (d->vmode).require (); + + /* For constant size indices, we dont't need to handle it here. + Just leave it to vec_perm<mode>. */ + if (d->perm.length ().is_constant ()) + return false; + + poly_uint64 first = d->perm[0]; + if ((maybe_ne (first, 0U) && maybe_ne (first * 2, nelt)) + || !d->perm.series_p (0, 2, first, 1) + || !d->perm.series_p (1, 2, first + nelt, 1)) + return false; + + /* Permuting two SEW8 variable-length vectors need vrgatherei16.vv. + Otherwise, it could overflow the index range. */ + machine_mode sel_mode = related_int_vector_mode (d->vmode).require (); + if (GET_MODE_INNER (d->vmode) == QImode + && !get_vector_mode (HImode, nelt).exists (&sel_mode)) + return false; + + /* Success! */ + if (d->testing_p) + return true; + + rtx op0, op1; + if (known_eq (first, 0U)) + { + op0 = d->op0; + op1 = d->op1; + } + else + { + op0 = gen_reg_rtx (d->vmode); + op1 = gen_reg_rtx (d->vmode); + insn_code icode = code_for_pred_slide (UNSPEC_VSLIDEDOWN, d->vmode); + rtx ops0[] = {op0, d->op0, gen_int_mode (first, Pmode)}; + rtx ops1[] = {op1, d->op1, gen_int_mode (first, Pmode)}; + emit_vlmax_insn (icode, RVV_BINOP, ops0); + emit_vlmax_insn (icode, RVV_BINOP, ops1); + } + /* Generate { 0, 1, .... } mask. */ + rtx vid = gen_reg_rtx (sel_mode); + rtx vid_repeat = gen_reg_rtx (sel_mode); + emit_insn (gen_vec_series (sel_mode, vid, const0_rtx, const1_rtx)); + rtx and_ops[] = {vid_repeat, vid, const1_rtx}; + emit_vlmax_insn (code_for_pred_scalar (AND, sel_mode), RVV_BINOP, and_ops); + rtx const_vec = gen_const_vector_dup (sel_mode, 1); + rtx mask = gen_reg_rtx (mask_mode); + expand_vec_cmp (mask, EQ, vid_repeat, const_vec); + emit_vlmax_decompress_insn (d->target, op0, op1, mask); + return true; +} + /* Recognize the pattern that can be shuffled by generic approach. */ static bool @@ -2369,6 +2541,8 @@ shuffle_generic_patterns (struct expand_vec_perm_d *d) return true; } +/* This function recognizes and supports different permutation patterns + and enable VLA SLP auto-vectorization. */ static bool expand_vec_perm_const_1 (struct expand_vec_perm_d *d) { @@ -2388,6 +2562,10 @@ expand_vec_perm_const_1 (struct expand_vec_perm_d *d) { if (d->vmode == d->op_mode) { + if (shuffle_merge_patterns (d)) + return true; + if (shuffle_decompress_patterns (d)) + return true; if (shuffle_generic_patterns (d)) return true; return false; @@ -2398,6 +2576,8 @@ expand_vec_perm_const_1 (struct expand_vec_perm_d *d) return false; } +/* This function implements TARGET_VECTORIZE_VEC_PERM_CONST by using RVV + * instructions. */ bool expand_vec_perm_const (machine_mode vmode, machine_mode op_mode, rtx target, rtx op0, rtx op1, const vec_perm_indices &sel) diff --git a/gcc/config/riscv/riscv-vector-builtins-types.def b/gcc/config/riscv/riscv-vector-builtins-types.def index db8e61f..4926bd8 100644 --- a/gcc/config/riscv/riscv-vector-builtins-types.def +++ b/gcc/config/riscv/riscv-vector-builtins-types.def @@ -1091,6 +1091,7 @@ DEF_RVV_LMUL1_OPS (vuint8m1_t, 0) DEF_RVV_LMUL1_OPS (vuint16m1_t, 0) DEF_RVV_LMUL1_OPS (vuint32m1_t, 0) DEF_RVV_LMUL1_OPS (vuint64m1_t, RVV_REQUIRE_ELEN_64) +DEF_RVV_LMUL1_OPS (vfloat16m1_t, RVV_REQUIRE_ELEN_FP_16) DEF_RVV_LMUL1_OPS (vfloat32m1_t, RVV_REQUIRE_ELEN_FP_32) DEF_RVV_LMUL1_OPS (vfloat64m1_t, RVV_REQUIRE_ELEN_FP_64) @@ -1102,6 +1103,7 @@ DEF_RVV_LMUL2_OPS (vuint8m2_t, 0) DEF_RVV_LMUL2_OPS (vuint16m2_t, 0) DEF_RVV_LMUL2_OPS (vuint32m2_t, 0) DEF_RVV_LMUL2_OPS (vuint64m2_t, RVV_REQUIRE_ELEN_64) +DEF_RVV_LMUL2_OPS (vfloat16m2_t, RVV_REQUIRE_ELEN_FP_16) DEF_RVV_LMUL2_OPS (vfloat32m2_t, RVV_REQUIRE_ELEN_FP_32) DEF_RVV_LMUL2_OPS (vfloat64m2_t, RVV_REQUIRE_ELEN_FP_64) @@ -1113,6 +1115,7 @@ DEF_RVV_LMUL4_OPS (vuint8m4_t, 0) DEF_RVV_LMUL4_OPS (vuint16m4_t, 0) DEF_RVV_LMUL4_OPS (vuint32m4_t, 0) DEF_RVV_LMUL4_OPS (vuint64m4_t, RVV_REQUIRE_ELEN_64) +DEF_RVV_LMUL4_OPS (vfloat16m4_t, RVV_REQUIRE_ELEN_FP_16) DEF_RVV_LMUL4_OPS (vfloat32m4_t, RVV_REQUIRE_ELEN_FP_32) DEF_RVV_LMUL4_OPS (vfloat64m4_t, RVV_REQUIRE_ELEN_FP_64) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index cae9be0..7066dea 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -4340,7 +4340,7 @@ get_first_vsetvl_before_rvv_insns (basic_block cfg_bb) bool pass_vsetvl::global_eliminate_vsetvl_insn (const bb_info *bb) const { - rtx_insn *vsetvl_rinsn; + rtx_insn *vsetvl_rinsn = NULL; vector_insn_info dem = vector_insn_info (); const auto &block_info = get_block_info (bb); basic_block cfg_bb = bb->cfg_bb (); diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index de30bf4..e5ae4e8 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -3795,6 +3795,99 @@ riscv_pass_fpr_pair (machine_mode mode, unsigned regno1, GEN_INT (offset2)))); } +/* Use the TYPE_SIZE to distinguish the type with vector_size attribute and + intrinsic vector type. Because we can't get the decl for the params. */ + +static bool +riscv_scalable_vector_type_p (const_tree type) +{ + tree size = TYPE_SIZE (type); + if (size && TREE_CODE (size) == INTEGER_CST) + return false; + + /* For the data type like vint32m1_t, the size code is POLY_INT_CST. */ + return true; +} + +static bool +riscv_arg_has_vector (const_tree type) +{ + bool is_vector = false; + + switch (TREE_CODE (type)) + { + case RECORD_TYPE: + if (!COMPLETE_TYPE_P (type)) + break; + + for (tree f = TYPE_FIELDS (type); f; f = DECL_CHAIN (f)) + if (TREE_CODE (f) == FIELD_DECL) + { + tree field_type = TREE_TYPE (f); + if (!TYPE_P (field_type)) + break; + + /* Ignore it if it's fixed length vector. */ + if (VECTOR_TYPE_P (field_type)) + is_vector = riscv_scalable_vector_type_p (field_type); + else + is_vector = riscv_arg_has_vector (field_type); + } + + break; + + case VECTOR_TYPE: + is_vector = riscv_scalable_vector_type_p (type); + break; + + default: + is_vector = false; + break; + } + + return is_vector; +} + +/* Pass the type to check whether it's a vector type or contains vector type. + Only check the value type and no checking for vector pointer type. */ + +static void +riscv_pass_in_vector_p (const_tree type) +{ + static int warned = 0; + + if (type && riscv_arg_has_vector (type) && !warned) + { + warning (OPT_Wpsabi, "ABI for the scalable vector type is currently in " + "experimental stage and may changes in the upcoming version of " + "GCC."); + warned = 1; + } +} + +/* Initialize a variable CUM of type CUMULATIVE_ARGS + for a call to a function whose data type is FNTYPE. + For a library call, FNTYPE is 0. */ + +void +riscv_init_cumulative_args (CUMULATIVE_ARGS *cum, + tree fntype ATTRIBUTE_UNUSED, + rtx libname ATTRIBUTE_UNUSED, + tree fndecl, + int caller ATTRIBUTE_UNUSED) +{ + memset (cum, 0, sizeof (*cum)); + + if (fndecl) + { + const tree_function_decl &fn + = FUNCTION_DECL_CHECK (fndecl)->function_decl; + + if (fn.built_in_class == NOT_BUILT_IN) + cum->rvv_psabi_warning = 1; + } +} + /* Fill INFO with information about a single argument, and return an RTL pattern to pass or return the argument. CUM is the cumulative state for earlier arguments. MODE is the mode of this argument and @@ -3816,13 +3909,19 @@ riscv_get_arg_info (struct riscv_arg_info *info, const CUMULATIVE_ARGS *cum, info->gpr_offset = cum->num_gprs; info->fpr_offset = cum->num_fprs; - /* TODO: Currently, it will cause an ICE for --param - riscv-autovec-preference=fixed-vlmax. So, we just return NULL_RTX here - let GCC generate loads/stores. Ideally, we should either warn the user not - to use an RVV vector type as function argument or support the calling - convention directly. */ + if (cum->rvv_psabi_warning) + { + /* Only check existing of vector type. */ + riscv_pass_in_vector_p (type); + } + + /* All current vector arguments and return values are passed through the + function stack. Ideally, we should either warn the user not to use an RVV + vector type as function argument or support a calling convention + with better performance. */ if (riscv_v_ext_mode_p (mode)) return NULL_RTX; + if (named) { riscv_aggregate_field fields[2]; @@ -3973,7 +4072,18 @@ riscv_function_value (const_tree type, const_tree func, machine_mode mode) } memset (&args, 0, sizeof args); - return riscv_get_arg_info (&info, &args, mode, type, true, true); + + const_tree arg_type = type; + if (func && DECL_RESULT (func)) + { + const tree_function_decl &fn = FUNCTION_DECL_CHECK (func)->function_decl; + if (fn.built_in_class == NOT_BUILT_IN) + args.rvv_psabi_warning = 1; + + arg_type = TREE_TYPE (DECL_RESULT (func)); + } + + return riscv_get_arg_info (&info, &args, mode, arg_type, true, true); } /* Implement TARGET_PASS_BY_REFERENCE. */ @@ -3996,6 +4106,13 @@ riscv_pass_by_reference (cumulative_args_t cum_v, const function_arg_info &arg) return false; } + /* All current vector arguments and return values are passed through the + function stack. Ideally, we should either warn the user not to use an RVV + vector type as function argument or support a calling convention + with better performance. */ + if (riscv_v_ext_mode_p (arg.mode)) + return true; + /* Pass by reference if the data do not fit in two integer registers. */ return !IN_RANGE (size, 0, 2 * UNITS_PER_WORD); } diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index 4541255..bfd9b75 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -677,6 +677,8 @@ typedef struct { /* Number of floating-point registers used so far, likewise. */ unsigned int num_fprs; + + int rvv_psabi_warning; } CUMULATIVE_ARGS; /* Initialize a variable CUM of type CUMULATIVE_ARGS @@ -684,7 +686,8 @@ typedef struct { For a library call, FNTYPE is 0. */ #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ - memset (&(CUM), 0, sizeof (CUM)) + riscv_init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (INDIRECT), \ + (N_NAMED_ARGS) != -1) #define EPILOGUE_USES(REGNO) riscv_epilogue_uses (REGNO) diff --git a/gcc/config/riscv/vector-iterators.md b/gcc/config/riscv/vector-iterators.md index 234b712..8c71c9e 100644 --- a/gcc/config/riscv/vector-iterators.md +++ b/gcc/config/riscv/vector-iterators.md @@ -447,21 +447,24 @@ ]) (define_mode_iterator V_WHOLE [ - (VNx4QI "TARGET_MIN_VLEN == 32") VNx8QI VNx16QI VNx32QI (VNx64QI "TARGET_MIN_VLEN > 32") (VNx128QI "TARGET_MIN_VLEN >= 128") - (VNx2HI "TARGET_MIN_VLEN == 32") VNx4HI VNx8HI VNx16HI (VNx32HI "TARGET_MIN_VLEN > 32") (VNx64HI "TARGET_MIN_VLEN >= 128") - (VNx1SI "TARGET_MIN_VLEN == 32") VNx2SI VNx4SI VNx8SI (VNx16SI "TARGET_MIN_VLEN > 32") (VNx32SI "TARGET_MIN_VLEN >= 128") + (VNx4QI "TARGET_MIN_VLEN == 32") (VNx8QI "TARGET_MIN_VLEN < 128") VNx16QI VNx32QI + (VNx64QI "TARGET_MIN_VLEN > 32") (VNx128QI "TARGET_MIN_VLEN >= 128") + (VNx2HI "TARGET_MIN_VLEN == 32") (VNx4HI "TARGET_MIN_VLEN < 128") VNx8HI VNx16HI + (VNx32HI "TARGET_MIN_VLEN > 32") (VNx64HI "TARGET_MIN_VLEN >= 128") + (VNx1SI "TARGET_MIN_VLEN == 32") (VNx2SI "TARGET_MIN_VLEN < 128") VNx4SI VNx8SI + (VNx16SI "TARGET_MIN_VLEN > 32") (VNx32SI "TARGET_MIN_VLEN >= 128") (VNx1DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN < 128") (VNx2DI "TARGET_VECTOR_ELEN_64") (VNx4DI "TARGET_VECTOR_ELEN_64") (VNx8DI "TARGET_VECTOR_ELEN_64") (VNx16DI "TARGET_VECTOR_ELEN_64 && TARGET_MIN_VLEN >= 128") (VNx2HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN == 32") - (VNx4HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN == 64") + (VNx4HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN < 128") (VNx8HF "TARGET_VECTOR_ELEN_FP_16") (VNx16HF "TARGET_VECTOR_ELEN_FP_16") (VNx32HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN > 32") (VNx64HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN >= 128") (VNx1SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN == 32") - (VNx2SF "TARGET_VECTOR_ELEN_FP_32") + (VNx2SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN < 128") (VNx4SF "TARGET_VECTOR_ELEN_FP_32") (VNx8SF "TARGET_VECTOR_ELEN_FP_32") (VNx16SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN > 32") @@ -481,8 +484,8 @@ (VNx2HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN > 32") (VNx4HF "TARGET_VECTOR_ELEN_FP_16 && TARGET_MIN_VLEN >= 128") - (VNx1SI "TARGET_MIN_VLEN > 32 && TARGET_MIN_VLEN < 128") (VNx2SI "TARGET_MIN_VLEN >= 128") - (VNx1SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN > 32 && TARGET_MIN_VLEN < 128") + (VNx1SI "TARGET_MIN_VLEN == 64") (VNx2SI "TARGET_MIN_VLEN >= 128") + (VNx1SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN == 64") (VNx2SF "TARGET_VECTOR_ELEN_FP_32 && TARGET_MIN_VLEN >= 128") ]) diff --git a/gcc/config/sh/divtab.cc b/gcc/config/sh/divtab.cc deleted file mode 100644 index a69dd54..0000000 --- a/gcc/config/sh/divtab.cc +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright (C) 2003-2023 Free Software Foundation, Inc. - -This file is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3, or (at your option) any -later version. - -This file is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -<http://www.gnu.org/licenses/>. */ - - -/* Calculate division table for SH5Media integer division - Contributed by Joern Rennecke - joern.rennecke@superh.com */ - -#include <stdio.h> -#include <math.h> - -#define BITS 5 -#define N_ENTRIES (1 << BITS) -#define CUTOFF_BITS 20 - -#define BIAS (-330) - -double max_defect = 0.; -double max_defect_x; - -double min_defect = 1e9; -double min_defect_x; - -double max_defect2 = 0.; -double max_defect2_x; - -double min_defect2 = 0.; -double min_defect2_x; - -double min_defect3 = 01e9; -double min_defect3_x; -int min_defect3_val; - -double max_defect3 = 0.; -double max_defect3_x; -int max_defect3_val; - -static double -note_defect3 (int val, double d2, double y2d, double x) -{ - int cutoff_val = val >> CUTOFF_BITS; - double cutoff; - double defect; - - if (val < 0) - cutoff_val++; - cutoff = (cutoff_val * (1<<CUTOFF_BITS) - val) * y2d; - defect = cutoff + val * d2; - if (val < 0) - defect = - defect; - if (defect > max_defect3) - { - max_defect3 = defect; - max_defect3_x = x; - max_defect3_val = val; - } - if (defect < min_defect3) - { - min_defect3 = defect; - min_defect3_x = x; - min_defect3_val = val; - } -} - -/* This function assumes 32-bit integers. */ -static double -calc_defect (double x, int constant, int factor) -{ - double y0 = (constant - (int) floor ((x * factor * 64.))) / 16384.; - double y1 = 2 * y0 -y0 * y0 * (x + BIAS / (1.*(1LL<<30))); - double y2d0, y2d; - int y2d1; - double d, d2; - - y1 = floor (y1 * (1024 * 1024 * 1024)) / (1024 * 1024 * 1024); - d = y1 - 1 / x; - if (d > max_defect) - { - max_defect = d; - max_defect_x = x; - } - if (d < min_defect) - { - min_defect = d; - min_defect_x = x; - } - y2d0 = floor (y1 * x * (1LL << 60-16)); - y2d1 = (int) (long long) y2d0; - y2d = - floor ((y1 - y0 / (1<<30-14)) * y2d1) / (1LL<<44); - d2 = y1 + y2d - 1/x; - if (d2 > max_defect2) - { - max_defect2 = d2; - max_defect2_x = x; - } - if (d2 < min_defect2) - { - min_defect2 = d2; - min_defect2_x = x; - } - /* zero times anything is trivially zero. */ - note_defect3 ((1 << CUTOFF_BITS) - 1, d2, y2d, x); - note_defect3 (1 << CUTOFF_BITS, d2, y2d, x); - note_defect3 ((1U << 31) - (1 << CUTOFF_BITS), d2, y2d, x); - note_defect3 ((1U << 31) - 1, d2, y2d, x); - note_defect3 (-1, d2, y2d, x); - note_defect3 (-(1 << CUTOFF_BITS), d2, y2d, x); - note_defect3 ((1U << 31) - (1 << CUTOFF_BITS) + 1, d2, y2d, x); - note_defect3 (-(1U << 31), d2, y2d, x); - return d; -} - -int -main () -{ - int i; - unsigned char factors[N_ENTRIES]; - short constants[N_ENTRIES]; - int steps = N_ENTRIES / 2; - double step = 1. / steps; - double eps30 = 1. / (1024 * 1024 * 1024); - - for (i = 0; i < N_ENTRIES; i++) - { - double x_low = (i < steps ? 1. : -3.) + i * step; - double x_high = x_low + step - eps30; - double x_med; - int factor, constant; - double low_defect, med_defect, high_defect, max_defect; - - factor = (1./x_low- 1./x_high) / step * 256. + 0.5; - if (factor == 256) - factor = 255; - factors[i] = factor; - /* Use minimum of error function for x_med. */ - x_med = sqrt (256./factor); - if (x_low < 0) - x_med = - x_med; - low_defect = 1. / x_low + x_low * factor / 256.; - high_defect = 1. / x_high + x_high * factor / 256.; - med_defect = 1. / x_med + x_med * factor / 256.; - max_defect - = ((low_defect > high_defect) ^ (x_med < 0)) ? low_defect : high_defect; - constant = (med_defect + max_defect) * 0.5 * 16384. + 0.5; - if (constant < -32768 || constant > 32767) - abort (); - constants[i] = constant; - calc_defect (x_low, constant, factor); - calc_defect (x_med, constant, factor); - calc_defect (x_high, constant, factor); - } - printf ("/* This table has been generated by divtab.cc .\n"); - printf ("Defects for bias %d:\n", BIAS); - printf (" Max defect: %e at %e\n", max_defect, max_defect_x); - printf (" Min defect: %e at %e\n", min_defect, min_defect_x); - printf (" Max 2nd step defect: %e at %e\n", max_defect2, max_defect2_x); - printf (" Min 2nd step defect: %e at %e\n", min_defect2, min_defect2_x); - printf (" Max div defect: %e at %d:%e\n", max_defect3, max_defect3_val, - max_defect3_x); - printf (" Min div defect: %e at %d:%e\n", min_defect3, min_defect3_val, - min_defect3_x); - printf (" Defect at 1: %e\n", - calc_defect (1., constants[0], factors[0])); - printf (" Defect at -2: %e */\n", - calc_defect (-2., constants[steps], factors[steps])); - printf ("\t.section\t.rodata\n"); - printf ("\t.balign 2\n"); - printf ("/* negative division constants */\n"); - for (i = steps; i < 2 * steps; i++) - printf ("\t.word\t%d\n", constants[i]); - printf ("/* negative division factors */\n"); - for (i = steps; i < 2*steps; i++) - printf ("\t.byte\t%d\n", factors[i]); - printf ("\t.skip %d\n", steps); - printf ("\t.global GLOBAL(div_table):\n"); - printf ("GLOBAL(div_table):\n"); - printf ("\t.skip %d\n", steps); - printf ("/* positive division factors */\n"); - for (i = 0; i < steps; i++) - printf ("\t.byte\t%d\n", factors[i]); - printf ("/* positive division constants */\n"); - for (i = 0; i < steps; i++) - printf ("\t.word\t%d\n", constants[i]); - exit (0); -} diff --git a/gcc/configure b/gcc/configure index f0f226c..3f6ae7a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -632,10 +632,10 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS CET_HOST_FLAGS -NO_PIE_FLAG -NO_PIE_CFLAGS -enable_default_pie +LD_PICFLAG PICFLAG +enable_default_pie +enable_host_pie enable_host_shared enable_plugin pluginlibs @@ -1033,6 +1033,7 @@ enable_link_serialization enable_version_specific_runtime_libs enable_plugin enable_host_shared +enable_host_pie enable_libquadmath_support with_linker_hash_style with_diagnostics_color @@ -1795,6 +1796,7 @@ Optional Features: in a compiler-specific directory --enable-plugin enable plugin support --enable-host-shared build host code as shared libraries + --enable-host-pie build host code as PIE --disable-libquadmath-support disable libquadmath support for Fortran --enable-default-pie enable Position Independent Executable as default @@ -32102,13 +32104,17 @@ fi # Enable --enable-host-shared # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PICFLAG=-fPIC -else - PICFLAG= + enableval=$enable_host_shared; fi +# Enable --enable-host-pie +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; +fi + # Check whether --enable-libquadmath-support was given. @@ -32262,10 +32268,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_c_no_fpie" >&5 $as_echo "$gcc_cv_c_no_fpie" >&6; } -if test "$gcc_cv_c_no_fpie" = "yes"; then - NO_PIE_CFLAGS="-fno-PIE" -fi - # Check if -no-pie works. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -no-pie option" >&5 @@ -32290,11 +32292,28 @@ rm -f core conftest.err conftest.$ac_objext \ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 $as_echo "$gcc_cv_no_pie" >&6; } -if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +elif test x$gcc_cv_c_no_fpie = xyes; then + PICFLAG=-fno-PIE +else + PICFLAG= +fi + +if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie +elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie +else + LD_PICFLAG= fi + + # Enable Intel CET on Intel CET enabled host if jit is enabled. # Check whether --enable-cet was given. if test "${enable_cet+set}" = set; then : diff --git a/gcc/configure.ac b/gcc/configure.ac index fdae333..2ce2599 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -7430,11 +7430,14 @@ fi # Enable --enable-host-shared AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PICFLAG=-fPIC], [PICFLAG=]) + [build host code as shared libraries])]) AC_SUBST(enable_host_shared) -AC_SUBST(PICFLAG) +# Enable --enable-host-pie +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])]) +AC_SUBST(enable_host_pie) AC_ARG_ENABLE(libquadmath-support, [AS_HELP_STRING([--disable-libquadmath-support], @@ -7556,10 +7559,6 @@ AC_CACHE_CHECK([for -fno-PIE option], [gcc_cv_c_no_fpie=yes], [gcc_cv_c_no_fpie=no]) CXXFLAGS="$saved_CXXFLAGS"]) -if test "$gcc_cv_c_no_fpie" = "yes"; then - NO_PIE_CFLAGS="-fno-PIE" -fi -AC_SUBST([NO_PIE_CFLAGS]) # Check if -no-pie works. AC_CACHE_CHECK([for -no-pie option], @@ -7570,10 +7569,27 @@ AC_CACHE_CHECK([for -no-pie option], [gcc_cv_no_pie=yes], [gcc_cv_no_pie=no]) LDFLAGS="$saved_LDFLAGS"]) -if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +elif test x$gcc_cv_c_no_fpie = xyes; then + PICFLAG=-fno-PIE +else + PICFLAG= fi -AC_SUBST([NO_PIE_FLAG]) + +if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie +elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie +else + LD_PICFLAG= +fi + +AC_SUBST([PICFLAG]) +AC_SUBST([LD_PICFLAG]) # Enable Intel CET on Intel CET enabled host if jit is enabled. GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 04cae62..9261bfa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,38 @@ +2023-06-14 Jason Merrill <jason@redhat.com> + + DR 2327 + PR c++/86521 + * call.cc (joust_maybe_elide_copy): Don't change cand. + (joust): Move the elided tiebreaker later. + +2023-06-13 David Malcolm <dmalcolm@redhat.com> + + PR c/84890 + * name-lookup.cc (missing_std_header::~missing_std_header): Reword + note to avoid negative tone of "forgetting". + +2023-06-13 Jason Merrill <jason@redhat.com> + + * tree.cc (build_target_expr): Check TYPE_HAS_MUTABLE_P. + +2023-06-12 Tobias Burnus <tobias@codesourcery.com> + + * parser.cc (cp_parser_omp_clause_map): Reword error message for + clearness especially with 'omp target (enter/exit) data.' + * semantics.cc (handle_omp_array_sections): Handle + GOMP_MAP_{ALWAYS_,}PRESENT_{TO,TOFROM,FROM,ALLOC} enum values. + +2023-06-12 Jason Merrill <jason@redhat.com> + + PR c++/105838 + * call.cc (convert_like_internal) [ck_list]: Use + maybe_init_list_as_array. + * constexpr.cc (cxx_eval_vec_init_1): Init might have + a different type. + * tree.cc (build_vec_init_elt): Likewise. + * init.cc (build_vec_init): Handle from_array from a + TARGET_EXPR. Retain TARGET_EXPR of a different type. + 2023-06-11 Patrick Palka <ppalka@redhat.com> PR c++/110122 diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 68cf878..15a3d6f 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -12560,11 +12560,11 @@ add_warning (struct z_candidate *winner, struct z_candidate *loser) } /* CAND is a constructor candidate in joust in C++17 and up. If it copies a - prvalue returned from a conversion function, replace CAND with the candidate - for the conversion and return true. Otherwise, return false. */ + prvalue returned from a conversion function, return true. Otherwise, return + false. */ static bool -joust_maybe_elide_copy (z_candidate *&cand) +joust_maybe_elide_copy (z_candidate *cand) { tree fn = cand->fn; if (!DECL_COPY_CONSTRUCTOR_P (fn) && !DECL_MOVE_CONSTRUCTOR_P (fn)) @@ -12580,10 +12580,7 @@ joust_maybe_elide_copy (z_candidate *&cand) (conv->type, DECL_CONTEXT (fn))); z_candidate *uc = conv->cand; if (DECL_CONV_FN_P (uc->fn)) - { - cand = uc; - return true; - } + return true; } return false; } @@ -12735,27 +12732,6 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, } } - /* Handle C++17 copy elision in [over.match.ctor] (direct-init) context. The - standard currently says that only constructors are candidates, but if one - copies a prvalue returned by a conversion function we want to treat the - conversion as the candidate instead. - - Clang does something similar, as discussed at - http://lists.isocpp.org/core/2017/10/3166.php - http://lists.isocpp.org/core/2019/03/5721.php */ - int elided_tiebreaker = 0; - if (len == 1 && cxx_dialect >= cxx17 - && DECL_P (cand1->fn) - && DECL_COMPLETE_CONSTRUCTOR_P (cand1->fn) - && !(cand1->flags & LOOKUP_ONLYCONVERTING)) - { - bool elided1 = joust_maybe_elide_copy (cand1); - bool elided2 = joust_maybe_elide_copy (cand2); - /* As a tiebreaker below we will prefer a constructor to a conversion - operator exposed this way. */ - elided_tiebreaker = elided2 - elided1; - } - for (i = 0; i < len; ++i) { conversion *t1 = cand1->convs[i + off1]; @@ -12917,11 +12893,6 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, if (winner) return winner; - /* Put this tiebreaker first, so that we don't try to look at second_conv of - a constructor candidate that doesn't have one. */ - if (elided_tiebreaker) - return elided_tiebreaker; - /* DR 495 moved this tiebreaker above the template ones. */ /* or, if not that, the context is an initialization by user-defined conversion (see @@ -12958,6 +12929,25 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, } } + /* DR2327: C++17 copy elision in [over.match.ctor] (direct-init) context. + The standard currently says that only constructors are candidates, but if + one copies a prvalue returned by a conversion function we prefer that. + + Clang does something similar, as discussed at + http://lists.isocpp.org/core/2017/10/3166.php + http://lists.isocpp.org/core/2019/03/5721.php */ + if (len == 1 && cxx_dialect >= cxx17 + && DECL_P (cand1->fn) + && DECL_COMPLETE_CONSTRUCTOR_P (cand1->fn) + && !(cand1->flags & LOOKUP_ONLYCONVERTING)) + { + bool elided1 = joust_maybe_elide_copy (cand1); + bool elided2 = joust_maybe_elide_copy (cand2); + winner = elided1 - elided2; + if (winner) + return winner; + } + /* or, if not that, F1 is a non-template function and F2 is a template function specialization. */ diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index b8ca730..53b6870 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -6760,7 +6760,7 @@ class missing_std_header : public deferred_diagnostic maybe_add_include_fixit (&richloc, header, true); inform (&richloc, "%<std::%s%> is defined in header %qs;" - " did you forget to %<#include %s%>?", + " this is probably fixable by adding %<#include %s%>", m_name_str, header, header); } else diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 09cba71..dd3665c8 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -21028,11 +21028,13 @@ cp_parser_enum_specifier (cp_parser* parser) /* Check for the `:' that denotes a specified underlying type in C++0x. Note that a ':' could also indicate a bitfield width, however. */ + location_t colon_loc = UNKNOWN_LOCATION; if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) { cp_decl_specifier_seq type_specifiers; /* Consume the `:'. */ + colon_loc = cp_lexer_peek_token (parser->lexer)->location; cp_lexer_consume_token (parser->lexer); auto tdf @@ -21081,10 +21083,13 @@ cp_parser_enum_specifier (cp_parser* parser) && cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) { if (has_underlying_type) - cp_parser_commit_to_tentative_parse (parser); - cp_parser_error (parser, "expected %<;%> or %<{%>"); - if (has_underlying_type) - return error_mark_node; + pedwarn (colon_loc, + OPT_Welaborated_enum_base, + "declaration of enumeration with " + "fixed underlying type and no enumerator list is " + "only permitted as a standalone declaration"); + else + cp_parser_error (parser, "expected %<;%> or %<{%>"); } } @@ -40625,9 +40630,8 @@ cp_parser_omp_clause_map (cp_parser *parser, tree list) } else { - cp_parser_error (parser, "%<#pragma omp target%> with " - "modifier other than %<always%>, %<close%> " - "or %<present%> on %<map%> clause"); + cp_parser_error (parser, "%<map%> clause with map-type modifier other" + " than %<always%>, %<close%> or %<present%>"); cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, /*or_comma=*/false, diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index a2e74a5..8fb47fd 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -5819,6 +5819,13 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort) case GOMP_MAP_ALWAYS_TO: case GOMP_MAP_ALWAYS_FROM: case GOMP_MAP_ALWAYS_TOFROM: + case GOMP_MAP_PRESENT_ALLOC: + case GOMP_MAP_PRESENT_TO: + case GOMP_MAP_PRESENT_FROM: + case GOMP_MAP_PRESENT_TOFROM: + case GOMP_MAP_ALWAYS_PRESENT_TO: + case GOMP_MAP_ALWAYS_PRESENT_FROM: + case GOMP_MAP_ALWAYS_PRESENT_TOFROM: case GOMP_MAP_RELEASE: case GOMP_MAP_DELETE: case GOMP_MAP_FORCE_TO: diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 751c9ad..799183d 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -522,6 +522,7 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain) if (CP_TYPE_CONST_NON_VOLATILE_P (type) && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) && !VOID_TYPE_P (TREE_TYPE (value)) + && !TYPE_HAS_MUTABLE_P (type) && reduced_constant_expression_p (value)) TREE_READONLY (decl) = true; diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 8ed7364..8748283 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,7 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * Make-lang.in: Remove NO_PIE_CFLAGS. + 2023-06-05 Iain Buclaw <ibuclaw@gdcproject.org> * gdc.texi (Warnings): Document -Wextra and -Wmismatched-special-enum. diff --git a/gcc/d/Make-lang.in b/gcc/d/Make-lang.in index 1679fb8..4fbf209 100644 --- a/gcc/d/Make-lang.in +++ b/gcc/d/Make-lang.in @@ -64,7 +64,7 @@ ALL_DFLAGS = $(DFLAGS-$@) $(GDCFLAGS) -fversion=IN_GCC $(CHECKING_DFLAGS) \ $(PICFLAG) $(ALIASING_FLAGS) $(NOEXCEPTION_DFLAGS) $(COVERAGE_FLAGS) \ $(WARN_DFLAGS) -DCOMPILE.base = $(GDC) $(NO_PIE_CFLAGS) -c $(ALL_DFLAGS) -o $@ +DCOMPILE.base = $(GDC) -c $(ALL_DFLAGS) -o $@ DCOMPILE = $(DCOMPILE.base) -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(*F).TPo DPOSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(*F).TPo $(@D)/$(DEPDIR)/$(*F).Po DLINKER = $(GDC) $(NO_PIE_FLAG) -lstdc++ diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index cdbd4b3..e01e244 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -5670,6 +5670,23 @@ command line (@pxref{MIPS Options}). This function attribute instructs the compiler to generate a hazard barrier return that clears all execution and instruction hazards while returning, instead of generating a normal return instruction. + +@item code_readable +@cindex @code{code_readable} function attribute, MIPS +For MIPS targets that support PC-relative addressing modes, this attribute +can be used to control how an object is addressed. The attribute takes +a single optional argument: + +@table @samp +@item no +The function should not read the instruction stream as data. +@item yes +The function can read the instruction stream as data. +@item pcrel +The function can read the instruction stream in a pc-relative mode. +@end table + +If there is no argument supplied, the default of @code{"yes"} applies. @end table @node MSP430 Function Attributes diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 7bcf978..a38d293 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1075,14 +1075,26 @@ code. @item --enable-host-shared Specify that the @emph{host} code should be built into position-independent -machine code (with -fPIC), allowing it to be used within shared libraries, -but yielding a slightly slower compiler. +machine code (with @option{-fPIC}), allowing it to be used within shared +libraries, but yielding a slightly slower compiler. This option is required when building the libgccjit.so library. Contrast with @option{--enable-shared}, which affects @emph{target} libraries. +@item --enable-host-pie +Specify that the @emph{host} executables should be built into +position-independent executables (with @option{-fPIE} and @option{-pie}), +yielding a slightly slower compiler (but faster than +@option{--enable-host-shared}). Position-independent executables are loaded +at random addresses each time they are executed, therefore provide additional +protection against Return Oriented Programming (ROP) attacks. + +@option{--enable-host-pie}) may be used with @option{--enable-host-shared}), +in which case @option{-fPIC} is used when compiling, and @option{-pie} when +linking. + @item @anchor{with-gnu-as}--with-gnu-as Specify that the compiler should assume that the assembler it finds is the GNU assembler. However, this does not modify diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0870f7a..fafdee3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -254,7 +254,8 @@ in the following sections. -Wdelete-non-virtual-dtor -Wno-deprecated-array-compare -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion --Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base +-Weffc++ -Wno-elaborated-enum-base +-Wno-exceptions -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor -Wno-init-list-lifetime -Winvalid-constexpr -Winvalid-imported-macros -Wno-invalid-offsetof -Wno-literal-suffix @@ -1458,7 +1459,7 @@ See RS/6000 and PowerPC Options. -munroll-only-small-loops -mlam=@var{choice}} @emph{x86 Windows Options} -@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll +@gccoptlist{-mconsole -mcrtdll=@var{library} -mcygwin -mno-cygwin -mdll -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows -fno-set-stack-executable} @@ -2716,9 +2717,8 @@ the @option{-foffload-options=@var{target-list}=@var{options}} form. The Typical command lines are @smallexample --foffload-options=-lgfortran -foffload-options=-lm --foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic --foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm +-foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic +-foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-O3 @end smallexample @opindex fopenacc @@ -3846,6 +3846,15 @@ bool b = e <= 3.7; @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled by @option{-Wenum-conversion}. +@opindex Welaborated-enum-base +@opindex Wno-elaborated-enum-base +@item -Wno-elaborated-enum-base +For C++11 and above, warn if an (invalid) additional enum-base is used +in an elaborated-type-specifier. That is, if an enum with given +underlying type and no enumerator list is used in a declaration other +than just a standalone declaration of the enum. Enabled by default. This +warning is upgraded to an error with -pedantic-errors. + @opindex Winit-list-lifetime @opindex Wno-init-list-lifetime @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)} @@ -6055,6 +6064,7 @@ errors by @option{-pedantic-errors}. For instance: -Wchanges-meaning @r{(C++)} -Wcomma-subscript @r{(C++23 or later)} -Wdeclaration-after-statement @r{(C90 or earlier)} +-Welaborated-enum-base @r{(C++11 or later)} -Wimplicit-int @r{(C99 or later)} -Wimplicit-function-declaration @r{(C99 or later)} -Wincompatible-pointer-types @@ -20235,12 +20245,12 @@ addresses and sizes of sections. Programs can be statically linked only. The @item -mtp=@var{name} @opindex mtp Specify the system register to use as a thread pointer. The valid values -are @samp{el0}, @samp{el1}, @samp{el2}, @samp{el3}. These correspond to -using the @samp{tpidr_el0}, @samp{tpidr_el1}, @samp{tpidr_el2}, -@samp{tpidr_el3} registers accordingly. The default setting is @samp{el0}. -It is recommended to compile all code intended to interoperate with the same -value of this option to avoid accessing a different thread pointer from the -wrong exception level. +are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2}, +@samp{tpidr_el3}. For backwards compatibility the aliases @samp{el0}, +@samp{el1}, @samp{el2}, @samp{el3} are also accepted. +The default setting is @samp{tpidr_el0}. It is recommended to compile all +code intended to interoperate with the same value of this option to avoid +accessing a different thread pointer from the wrong exception level. @opindex mstrict-align @opindex mno-strict-align @@ -22645,12 +22655,15 @@ by default. @opindex mtp @item -mtp=@var{name} -Specify the access model for the thread local storage pointer. The valid -models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, -@samp{cp15}, which fetches the thread pointer from @code{cp15} directly -(supported in the arm6k architecture), and @samp{auto}, which uses the -best available method for the selected processor. The default setting is -@samp{auto}. +Specify the access model for the thread local storage pointer. The model +@samp{soft} generates calls to @code{__aeabi_read_tp}. Other accepted +models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch +the thread pointer from the corresponding system register directly +(supported from the arm6k architecture and later). These system registers +are accessed through the CP15 co-processor interface and the argument +@samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}. +The argument @samp{auto} uses the best available method for the selected +processor. The default setting is @samp{auto}. @opindex mtls-dialect @item -mtls-dialect=@var{dialect} @@ -34290,6 +34303,28 @@ required for console applications. This option is available for Cygwin and MinGW targets and is enabled by default on those targets. +@opindex mcrtdll +@item -mcrtdll=@var{library} +Preprocess, compile or link with specified C RunTime DLL @var{library}. +This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__} +and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose +start file for CRT @var{library} and link with CRT @var{library}. +Recognized CRT library names for proprocessor are: +@code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40}, +@code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90}, +@code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}. +If this options is not specified then the default MinGW import library +@code{msvcrt} is used for linking and no other adjustment for +preprocessor is done. MinGW import library @code{msvcrt} is just a +symlink to (or a copy of) another MinGW CRT import library +chosen during MinGW compilation. MinGW import library @code{msvcrt-os} +is for Windows system CRT DLL library @code{msvcrt.dll} and +in most cases is the default MinGW import library. +Generally speaking, changing the CRT DLL requires recompiling +the entire MinGW CRT. This option is for experimental and testing +purposes only. +This option is available for MinGW targets. + @opindex mdll @item -mdll This option is available for Cygwin and MinGW targets. It diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 95f7fe1..a43fd65 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5224,6 +5224,22 @@ is taken only on unsigned overflow. @item @samp{usubv@var{m}4}, @samp{umulv@var{m}4} Similar, for other unsigned arithmetic operations. +@cindex @code{uaddc@var{m}5} instruction pattern +@item @samp{uaddc@var{m}5} +Adds unsigned operands 2, 3 and 4 (where the last operand is guaranteed to +have only values 0 or 1) together, sets operand 0 to the result of the +addition of the 3 operands and sets operand 1 to 1 iff there was +overflow on the unsigned additions, and to 0 otherwise. So, it is +an addition with carry in (operand 4) and carry out (operand 1). +All operands have the same mode. + +@cindex @code{usubc@var{m}5} instruction pattern +@item @samp{usubc@var{m}5} +Similarly to @samp{uaddc@var{m}5}, except subtracts unsigned operands 3 +and 4 from operand 2 instead of adding them. So, it is +a subtraction with carry/borrow in (operand 4) and carry/borrow out +(operand 1). All operands have the same mode. + @cindex @code{addptr@var{m}3} instruction pattern @item @samp{addptr@var{m}3} Like @code{add@var{m}3} but is guaranteed to only be used for address @@ -5809,6 +5825,16 @@ Other shift and rotate instructions, analogous to the Vector shift and rotate instructions that take vectors as operand 2 instead of a scalar type. +@cindex @code{uabd@var{m}} instruction pattern +@cindex @code{sabd@var{m}} instruction pattern +@item @samp{uabd@var{m}}, @samp{sabd@var{m}} +Signed and unsigned absolute difference instructions. These +instructions find the difference between operands 1 and 2 +then return the absolute value. A C code equivalent would be: +@smallexample +op0 = op1 > op2 ? op1 - op2 : op2 - op1; +@end smallexample + @cindex @code{avg@var{m}3_floor} instruction pattern @cindex @code{uavg@var{m}3_floor} instruction pattern @item @samp{avg@var{m}3_floor} diff --git a/gcc/expr.cc b/gcc/expr.cc index 868fa6e..62cd8fa 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -7531,8 +7531,11 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, } /* Inform later passes that the old value is dead. */ - if (!cleared && !vector && REG_P (target)) - emit_move_insn (target, CONST0_RTX (mode)); + if (!cleared && !vector && REG_P (target) && maybe_gt (n_elts, 1u)) + { + emit_move_insn (target, CONST0_RTX (mode)); + cleared = 1; + } if (MEM_P (target)) alias = MEM_ALIAS_SET (target); diff --git a/gcc/fold-const-call.cc b/gcc/fold-const-call.cc index 663eae2..04be3d2 100644 --- a/gcc/fold-const-call.cc +++ b/gcc/fold-const-call.cc @@ -1669,6 +1669,7 @@ fold_const_call (combined_fn fn, tree type, tree arg0, tree arg1) { const char *p0, *p1; char c; + tree_code subcode; switch (fn) { case CFN_BUILT_IN_STRSPN: @@ -1738,6 +1739,46 @@ fold_const_call (combined_fn fn, tree type, tree arg0, tree arg1) case CFN_FOLD_LEFT_PLUS: return fold_const_fold_left (type, arg0, arg1, PLUS_EXPR); + case CFN_UBSAN_CHECK_ADD: + case CFN_ADD_OVERFLOW: + subcode = PLUS_EXPR; + goto arith_overflow; + + case CFN_UBSAN_CHECK_SUB: + case CFN_SUB_OVERFLOW: + subcode = MINUS_EXPR; + goto arith_overflow; + + case CFN_UBSAN_CHECK_MUL: + case CFN_MUL_OVERFLOW: + subcode = MULT_EXPR; + goto arith_overflow; + + arith_overflow: + if (integer_cst_p (arg0) && integer_cst_p (arg1)) + { + tree itype + = TREE_CODE (type) == COMPLEX_TYPE ? TREE_TYPE (type) : type; + bool ovf = false; + tree r = int_const_binop (subcode, fold_convert (itype, arg0), + fold_convert (itype, arg1)); + if (!r || TREE_CODE (r) != INTEGER_CST) + return NULL_TREE; + if (arith_overflowed_p (subcode, itype, arg0, arg1)) + ovf = true; + if (TREE_OVERFLOW (r)) + r = drop_tree_overflow (r); + if (itype == type) + { + if (ovf) + return NULL_TREE; + return r; + } + else + return build_complex (type, r, build_int_cst (itype, ovf)); + } + return NULL_TREE; + default: return fold_const_call_1 (fn, type, arg0, arg1); } @@ -1896,6 +1937,30 @@ fold_const_call (combined_fn fn, tree type, tree arg0, tree arg1, tree arg2) return NULL_TREE; } + case CFN_UADDC: + case CFN_USUBC: + if (integer_cst_p (arg0) && integer_cst_p (arg1) && integer_cst_p (arg2)) + { + tree itype = TREE_TYPE (type); + bool ovf = false; + tree_code subcode = fn == CFN_UADDC ? PLUS_EXPR : MINUS_EXPR; + tree r = int_const_binop (subcode, fold_convert (itype, arg0), + fold_convert (itype, arg1)); + if (!r) + return NULL_TREE; + if (arith_overflowed_p (subcode, itype, arg0, arg1)) + ovf = true; + tree r2 = int_const_binop (subcode, r, fold_convert (itype, arg2)); + if (!r2 || TREE_CODE (r2) != INTEGER_CST) + return NULL_TREE; + if (arith_overflowed_p (subcode, itype, r, arg2)) + ovf = true; + if (TREE_OVERFLOW (r2)) + r2 = drop_tree_overflow (r2); + return build_complex (type, r2, build_int_cst (itype, ovf)); + } + return NULL_TREE; + default: return fold_const_call_1 (fn, type, arg0, arg1, arg2); } diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 84b0d06..3aa6851 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -8796,16 +8796,13 @@ native_interpret_vector_part (tree type, const unsigned char *bytes, static tree native_interpret_vector (tree type, const unsigned char *ptr, unsigned int len) { - tree etype; - unsigned int size; - unsigned HOST_WIDE_INT count; + unsigned HOST_WIDE_INT size; - etype = TREE_TYPE (type); - size = GET_MODE_SIZE (SCALAR_TYPE_MODE (etype)); - if (!TYPE_VECTOR_SUBPARTS (type).is_constant (&count) - || size * count > len) + if (!tree_to_poly_uint64 (TYPE_SIZE_UNIT (type)).is_constant (&size) + || size > len) return NULL_TREE; + unsigned HOST_WIDE_INT count = TYPE_VECTOR_SUBPARTS (type).to_constant (); return native_interpret_vector_part (type, ptr, len, count, 1); } @@ -12301,13 +12298,6 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, tem, build_int_cst (TREE_TYPE (tem), 0)); } - if (integer_zerop (arg1) - && tree_expr_nonzero_p (arg0)) - { - tree res = constant_boolean_node (code==NE_EXPR, type); - return omit_one_operand_loc (loc, type, res, arg0); - } - if (TREE_CODE (arg0) == BIT_XOR_EXPR && TREE_CODE (arg1) == BIT_XOR_EXPR) { diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 859bd72..7c6474e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2023-06-13 Harald Anlauf <anlauf@gmx.de> + Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/86277 + * trans-array.cc (gfc_trans_allocate_array_storage): When passing a + zero-sized array with fixed (= non-dynamic) size, allocate temporary + by the caller, not by the callee. + 2023-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> * f95-lang.cc (gfc_init_builtin_functions): Add fmax() and diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index e1c75e9..e7c51ba 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -1117,7 +1117,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, desc = info->descriptor; info->offset = gfc_index_zero_node; - if (size == NULL_TREE || integer_zerop (size)) + if (size == NULL_TREE || (dynamic && integer_zerop (size))) { /* A callee allocated array. */ gfc_conv_descriptor_data_set (pre, desc, null_pointer_node); @@ -47,6 +47,9 @@ compilation is specified by a string called a "spec". */ #include "opts-jobserver.h" #include "common/common-target.h" +#ifndef MATH_LIBRARY +#define MATH_LIBRARY "m" +#endif /* Manage the manipulation of env vars. @@ -1146,12 +1149,12 @@ proper position among the other output files. */ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ %:include(libgomp.spec)%(link_gomp)}\ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\ - %(mflib) " STACK_SPLIT_SPEC "\ + " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\ %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}" @@ -4117,6 +4120,48 @@ next_item: } } +/* Forward certain options to offloading compilation. */ + +static void +forward_offload_option (size_t opt_index, const char *arg, bool validated) +{ + switch (opt_index) + { + case OPT_l: + /* Use a '_GCC_' prefix and standard name ('-l_GCC_m' irrespective of the + host's 'MATH_LIBRARY', for example), so that the 'mkoffload's can tell + this has been synthesized here, and translate/drop as necessary. */ + /* Note that certain libraries ('-lc', '-lgcc', '-lgomp', for example) + are injected by default in offloading compilation, and therefore not + forwarded here. */ + /* GCC libraries. */ + if (/* '-lgfortran' */ strcmp (arg, "gfortran") == 0 ) + save_switch (concat ("-foffload-options=-l_GCC_", arg, NULL), + 0, NULL, validated, true); + /* Other libraries. */ + else + { + /* The case will need special consideration where on the host + '!need_math', but for offloading compilation still need + '-foffload-options=-l_GCC_m'. The problem is that we don't get + here anything like '-lm', because it's not synthesized in + 'gcc/fortran/gfortranspec.cc:lang_specific_driver', for example. + Generally synthesizing '-foffload-options=-l_GCC_m' etc. in the + language specific drivers is non-trivial, needs very careful + review of their options handling. However, this issue is not + actually relevant for the current set of supported host/offloading + configurations. */ + int need_math = (MATH_LIBRARY[0] != '\0'); + if (/* '-lm' */ (need_math && strcmp (arg, MATH_LIBRARY) == 0)) + save_switch ("-foffload-options=-l_GCC_m", + 0, NULL, validated, true); + } + break; + default: + gcc_unreachable (); + } +} + /* Handle a driver option; arguments and return value as for handle_option. */ @@ -4375,6 +4420,17 @@ driver_handle_option (struct gcc_options *opts, /* POSIX allows separation of -l and the lib arg; canonicalize by concatenating -l with its arg */ add_infile (concat ("-l", arg, NULL), "*"); + + /* Forward to offloading compilation '-l[...]' flags for standard, + well-known libraries. */ + /* Doing this processing here means that we don't get to see libraries + injected via specs, such as '-lquadmath' injected via + '[build]/[target]/libgfortran/libgfortran.spec'. However, this issue + is not actually relevant for the current set of host/offloading + configurations. */ + if (ENABLE_OFFLOADING) + forward_offload_option (opt_index, arg, validated); + do_save = false; break; diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 581575b..55e8056 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -5585,6 +5585,7 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) enum tree_code subcode = ERROR_MARK; tree result = NULL_TREE; bool cplx_result = false; + bool uaddc_usubc = false; tree overflow = NULL_TREE; switch (gimple_call_internal_fn (stmt)) { @@ -5658,6 +5659,16 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) subcode = MULT_EXPR; cplx_result = true; break; + case IFN_UADDC: + subcode = PLUS_EXPR; + cplx_result = true; + uaddc_usubc = true; + break; + case IFN_USUBC: + subcode = MINUS_EXPR; + cplx_result = true; + uaddc_usubc = true; + break; case IFN_MASK_LOAD: changed |= gimple_fold_partial_load (gsi, stmt, true); break; @@ -5677,6 +5688,7 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) { tree arg0 = gimple_call_arg (stmt, 0); tree arg1 = gimple_call_arg (stmt, 1); + tree arg2 = NULL_TREE; tree type = TREE_TYPE (arg0); if (cplx_result) { @@ -5685,9 +5697,26 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) type = NULL_TREE; else type = TREE_TYPE (TREE_TYPE (lhs)); + if (uaddc_usubc) + arg2 = gimple_call_arg (stmt, 2); } if (type == NULL_TREE) ; + else if (uaddc_usubc) + { + if (!integer_zerop (arg2)) + ; + /* x = y + 0 + 0; x = y - 0 - 0; */ + else if (integer_zerop (arg1)) + result = arg0; + /* x = 0 + y + 0; */ + else if (subcode != MINUS_EXPR && integer_zerop (arg0)) + result = arg1; + /* x = y - y - 0; */ + else if (subcode == MINUS_EXPR + && operand_equal_p (arg0, arg1, 0)) + result = integer_zero_node; + } /* x = y + 0; x = y - 0; x = y * 0; */ else if (integer_zerop (arg1)) result = subcode == MULT_EXPR ? integer_zero_node : arg0; @@ -5702,22 +5731,6 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) result = arg0; else if (subcode == MULT_EXPR && integer_onep (arg0)) result = arg1; - else if (TREE_CODE (arg0) == INTEGER_CST - && TREE_CODE (arg1) == INTEGER_CST) - { - if (cplx_result) - result = int_const_binop (subcode, fold_convert (type, arg0), - fold_convert (type, arg1)); - else - result = int_const_binop (subcode, arg0, arg1); - if (result && arith_overflowed_p (subcode, type, arg0, arg1)) - { - if (cplx_result) - overflow = build_one_cst (type); - else - result = NULL_TREE; - } - } if (result) { if (result == integer_zero_node) diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index 173d9f3..d072460 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -489,6 +489,8 @@ adjust_imagpart_expr (vrange &res, const gimple *stmt) case IFN_ADD_OVERFLOW: case IFN_SUB_OVERFLOW: case IFN_MUL_OVERFLOW: + case IFN_UADDC: + case IFN_USUBC: case IFN_ATOMIC_COMPARE_EXCHANGE: { int_range<2> r; @@ -506,7 +508,8 @@ adjust_imagpart_expr (vrange &res, const gimple *stmt) && gimple_assign_rhs_code (def_stmt) == COMPLEX_CST) { tree cst = gimple_assign_rhs1 (def_stmt); - if (TREE_CODE (cst) == COMPLEX_CST) + if (TREE_CODE (cst) == COMPLEX_CST + && TREE_CODE (TREE_TYPE (TREE_TYPE (cst))) == INTEGER_TYPE) { wide_int w = wi::to_wide (TREE_IMAGPART (cst)); int_range<1> imag (TREE_TYPE (TREE_IMAGPART (cst)), w, w); @@ -533,7 +536,8 @@ adjust_realpart_expr (vrange &res, const gimple *stmt) && gimple_assign_rhs_code (def_stmt) == COMPLEX_CST) { tree cst = gimple_assign_rhs1 (def_stmt); - if (TREE_CODE (cst) == COMPLEX_CST) + if (TREE_CODE (cst) == COMPLEX_CST + && TREE_CODE (TREE_TYPE (TREE_TYPE (cst))) == INTEGER_TYPE) { wide_int imag = wi::to_wide (TREE_REALPART (cst)); int_range<2> tmp (TREE_TYPE (TREE_REALPART (cst)), imag, imag); diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc index a1c8d51..abc70cd 100644 --- a/gcc/gimple-range-gori.cc +++ b/gcc/gimple-range-gori.cc @@ -1478,7 +1478,7 @@ gori_compute::condexpr_adjust (vrange &r1, vrange &r2, gimple *, tree cond, tree type = TREE_TYPE (gimple_assign_rhs1 (cond_def)); if (!range_compatible_p (type, TREE_TYPE (gimple_assign_rhs2 (cond_def)))) return false; - range_op_handler hand (gimple_assign_rhs_code (cond_def), type); + range_op_handler hand (gimple_assign_rhs_code (cond_def)); if (!hand) return false; diff --git a/gcc/gimple-range-op.cc b/gcc/gimple-range-op.cc index b6b10e4..72c7b86 100644 --- a/gcc/gimple-range-op.cc +++ b/gcc/gimple-range-op.cc @@ -94,28 +94,14 @@ gimple_range_base_of_assignment (const gimple *stmt) // If statement is supported by range-ops, set the CODE and return the TYPE. -static tree -get_code_and_type (gimple *s, enum tree_code &code) +static inline enum tree_code +get_code (gimple *s) { - tree type = NULL_TREE; - code = NOP_EXPR; - if (const gassign *ass = dyn_cast<const gassign *> (s)) - { - code = gimple_assign_rhs_code (ass); - // The LHS of a comparison is always an int, so we must look at - // the operands. - if (TREE_CODE_CLASS (code) == tcc_comparison) - type = TREE_TYPE (gimple_assign_rhs1 (ass)); - else - type = TREE_TYPE (gimple_assign_lhs (ass)); - } - else if (const gcond *cond = dyn_cast<const gcond *> (s)) - { - code = gimple_cond_code (cond); - type = TREE_TYPE (gimple_cond_lhs (cond)); - } - return type; + return gimple_assign_rhs_code (ass); + if (const gcond *cond = dyn_cast<const gcond *> (s)) + return gimple_cond_code (cond); + return ERROR_MARK; } // If statement S has a supported range_op handler return TRUE. @@ -123,9 +109,8 @@ get_code_and_type (gimple *s, enum tree_code &code) bool gimple_range_op_handler::supported_p (gimple *s) { - enum tree_code code; - tree type = get_code_and_type (s, code); - if (type && range_op_handler (code, type)) + enum tree_code code = get_code (s); + if (range_op_handler (code)) return true; if (is_a <gcall *> (s) && gimple_range_op_handler (s)) return true; @@ -136,23 +121,21 @@ gimple_range_op_handler::supported_p (gimple *s) gimple_range_op_handler::gimple_range_op_handler (gimple *s) { - enum tree_code code; - tree type = get_code_and_type (s, code); + range_op_handler oper (get_code (s)); m_stmt = s; m_op1 = NULL_TREE; m_op2 = NULL_TREE; - if (type) - set_op_handler (code, type); - if (m_operator) + if (oper) switch (gimple_code (m_stmt)) { case GIMPLE_COND: m_op1 = gimple_cond_lhs (m_stmt); m_op2 = gimple_cond_rhs (m_stmt); // Check that operands are supported types. One check is enough. - if (!Value_Range::supports_type_p (TREE_TYPE (m_op1))) - m_operator = NULL; + if (Value_Range::supports_type_p (TREE_TYPE (m_op1))) + m_operator = oper.range_op (); + gcc_checking_assert (m_operator); return; case GIMPLE_ASSIGN: m_op1 = gimple_range_base_of_assignment (m_stmt); @@ -171,7 +154,9 @@ gimple_range_op_handler::gimple_range_op_handler (gimple *s) m_op2 = gimple_assign_rhs2 (m_stmt); // Check that operands are supported types. One check is enough. if ((m_op1 && !Value_Range::supports_type_p (TREE_TYPE (m_op1)))) - m_operator = NULL; + return; + m_operator = oper.range_op (); + gcc_checking_assert (m_operator); return; default: gcc_unreachable (); @@ -183,6 +168,7 @@ gimple_range_op_handler::gimple_range_op_handler (gimple *s) maybe_builtin_call (); else maybe_non_standard (); + gcc_checking_assert (m_operator); } // Calculate what we can determine of the range of this unary @@ -382,11 +368,10 @@ public: const frange &rh, relation_trio) const override { frange neg; - range_op_handler abs_op (ABS_EXPR, type); - range_op_handler neg_op (NEGATE_EXPR, type); - if (!abs_op || !abs_op.fold_range (r, type, lh, frange (type))) + if (!range_op_handler (ABS_EXPR).fold_range (r, type, lh, frange (type))) return false; - if (!neg_op || !neg_op.fold_range (neg, type, r, frange (type))) + if (!range_op_handler (NEGATE_EXPR).fold_range (neg, type, r, + frange (type))) return false; bool signbit; @@ -1091,14 +1076,11 @@ public: virtual bool fold_range (irange &r, tree type, const irange &lh, const irange &rh, relation_trio rel) const { - range_op_handler handler (m_code, type); - gcc_checking_assert (handler); - bool saved_flag_wrapv = flag_wrapv; // Pretend the arithmetic is wrapping. If there is any overflow, // we'll complain, but will actually do wrapping operation. flag_wrapv = 1; - bool result = handler.fold_range (r, type, lh, rh, rel); + bool result = range_op_handler (m_code).fold_range (r, type, lh, rh, rel); flag_wrapv = saved_flag_wrapv; // If for both arguments vrp_valueize returned non-NULL, this should @@ -1186,8 +1168,11 @@ public: void gimple_range_op_handler::maybe_non_standard () { - range_operator *signed_op = ptr_op_widen_mult_signed; - range_operator *unsigned_op = ptr_op_widen_mult_unsigned; + range_op_handler signed_op (OP_WIDEN_MULT_SIGNED); + gcc_checking_assert (signed_op); + range_op_handler unsigned_op (OP_WIDEN_MULT_UNSIGNED); + gcc_checking_assert (unsigned_op); + if (gimple_code (m_stmt) == GIMPLE_ASSIGN) switch (gimple_assign_rhs_code (m_stmt)) { @@ -1213,9 +1198,9 @@ gimple_range_op_handler::maybe_non_standard () std::swap (m_op1, m_op2); if (signed1 || signed2) - m_operator = signed_op; + m_operator = signed_op.range_op (); else - m_operator = unsigned_op; + m_operator = unsigned_op.range_op (); break; } default: @@ -1248,8 +1233,6 @@ gimple_range_op_handler::maybe_builtin_call () m_operator = &op_cfn_constant_p; else if (frange::supports_p (TREE_TYPE (m_op1))) m_operator = &op_cfn_constant_float_p; - else - m_operator = NULL; break; CASE_FLT_FN (CFN_BUILT_IN_SIGNBIT): diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 91640de..0e24b91 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -12479,7 +12479,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) kind = GOMP_MAP_FORCE_PRESENT; break; case GOVD_MAP_FORCE_PRESENT | GOVD_MAP_ALLOC_ONLY: - kind = GOMP_MAP_PRESENT_ALLOC; + kind = GOMP_MAP_FORCE_PRESENT; break; default: gcc_unreachable (); @@ -12797,6 +12797,17 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, break; case OMP_CLAUSE_MAP: + switch (OMP_CLAUSE_MAP_KIND (c)) + { + case GOMP_MAP_PRESENT_ALLOC: + case GOMP_MAP_PRESENT_TO: + case GOMP_MAP_PRESENT_FROM: + case GOMP_MAP_PRESENT_TOFROM: + OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_FORCE_PRESENT); + break; + default: + break; + } if (code == OMP_TARGET_EXIT_DATA && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALWAYS_POINTER) { diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc index da9b944..208bdf4 100644 --- a/gcc/internal-fn.cc +++ b/gcc/internal-fn.cc @@ -2776,6 +2776,44 @@ expand_MUL_OVERFLOW (internal_fn, gcall *stmt) expand_arith_overflow (MULT_EXPR, stmt); } +/* Expand UADDC STMT. */ + +static void +expand_UADDC (internal_fn ifn, gcall *stmt) +{ + tree lhs = gimple_call_lhs (stmt); + tree arg1 = gimple_call_arg (stmt, 0); + tree arg2 = gimple_call_arg (stmt, 1); + tree arg3 = gimple_call_arg (stmt, 2); + tree type = TREE_TYPE (arg1); + machine_mode mode = TYPE_MODE (type); + insn_code icode = optab_handler (ifn == IFN_UADDC + ? uaddc5_optab : usubc5_optab, mode); + rtx op1 = expand_normal (arg1); + rtx op2 = expand_normal (arg2); + rtx op3 = expand_normal (arg3); + rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); + rtx re = gen_reg_rtx (mode); + rtx im = gen_reg_rtx (mode); + class expand_operand ops[5]; + create_output_operand (&ops[0], re, mode); + create_output_operand (&ops[1], im, mode); + create_input_operand (&ops[2], op1, mode); + create_input_operand (&ops[3], op2, mode); + create_input_operand (&ops[4], op3, mode); + expand_insn (icode, 5, ops); + write_complex_part (target, re, false, false); + write_complex_part (target, im, true, false); +} + +/* Expand USUBC STMT. */ + +static void +expand_USUBC (internal_fn ifn, gcall *stmt) +{ + expand_UADDC (ifn, stmt); +} + /* This should get folded in tree-vectorizer.cc. */ static void @@ -4049,6 +4087,7 @@ commutative_ternary_fn_p (internal_fn fn) case IFN_FMS: case IFN_FNMA: case IFN_FNMS: + case IFN_UADDC: return true; default: diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def index 5d638de..9da5f31 100644 --- a/gcc/internal-fn.def +++ b/gcc/internal-fn.def @@ -192,6 +192,9 @@ DEF_INTERNAL_OPTAB_FN (FMS, ECF_CONST, fms, ternary) DEF_INTERNAL_OPTAB_FN (FNMA, ECF_CONST, fnma, ternary) DEF_INTERNAL_OPTAB_FN (FNMS, ECF_CONST, fnms, ternary) +DEF_INTERNAL_SIGNED_OPTAB_FN (ABD, ECF_CONST | ECF_NOTHROW, first, + sabd, uabd, binary) + DEF_INTERNAL_SIGNED_OPTAB_FN (AVG_FLOOR, ECF_CONST | ECF_NOTHROW, first, savg_floor, uavg_floor, binary) DEF_INTERNAL_SIGNED_OPTAB_FN (AVG_CEIL, ECF_CONST | ECF_NOTHROW, first, @@ -416,6 +419,8 @@ DEF_INTERNAL_FN (ASAN_POISON_USE, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL) DEF_INTERNAL_FN (ADD_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (SUB_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (MUL_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) +DEF_INTERNAL_FN (UADDC, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) +DEF_INTERNAL_FN (USUBC, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (TSAN_FUNC_EXIT, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (VA_ARG, ECF_NOTHROW | ECF_LEAF, NULL) DEF_INTERNAL_FN (VEC_CONVERT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index d77b9ea..f0a314c 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -1924,7 +1924,7 @@ ipa_vr_operation_and_type_effects (vrange &dst_vr, if (!irange::supports_p (dst_type) || !irange::supports_p (src_type)) return false; - range_op_handler handler (operation, dst_type); + range_op_handler handler (operation); if (!handler) return false; @@ -1990,7 +1990,7 @@ ipa_value_range_from_jfunc (vrange &vr, Value_Range res (vr_type); tree op = ipa_get_jf_pass_through_operand (jfunc); Value_Range op_vr (vr_type); - range_op_handler handler (operation, vr_type); + range_op_handler handler (operation); ipa_range_set_and_normalize (op_vr, op); @@ -2786,7 +2786,7 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc, tree op = ipa_get_jf_pass_through_operand (jfunc); Value_Range op_vr (TREE_TYPE (op)); Value_Range op_res (operand_type); - range_op_handler handler (operation, operand_type); + range_op_handler handler (operation); ipa_range_set_and_normalize (op_vr, op); diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc index cf41620..a301396 100644 --- a/gcc/ipa-fnsummary.cc +++ b/gcc/ipa-fnsummary.cc @@ -491,7 +491,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, value_range res; if (!op->val[0]) { - range_op_handler handler (op->code, op->type); + range_op_handler handler (op->code); if (!handler || !res.supports_type_p (op->type) || !handler.fold_range (res, op->type, vr, @@ -501,7 +501,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, else if (!op->val[1]) { value_range op0; - range_op_handler handler (op->code, op->type); + range_op_handler handler (op->code); ipa_range_set_and_normalize (op0, op->val[0]); @@ -520,7 +520,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, { value_range res; value_range val_vr; - range_op_handler handler (c->code, boolean_type_node); + range_op_handler handler (c->code); ipa_range_set_and_normalize (val_vr, c->val); diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc index 6a3901e..bc84938 100644 --- a/gcc/ira-lives.cc +++ b/gcc/ira-lives.cc @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see #include "ira-int.h" #include "sparseset.h" #include "function-abi.h" +#include "except.h" /* The code in this file is similar to one in global but the code works on the allocno basis and creates live ranges instead of @@ -1383,14 +1384,24 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) SET_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj)); SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj)); } - if (can_throw_internal (insn)) + eh_region r; + eh_landing_pad lp; + rtx_code_label *landing_label; + basic_block landing_bb; + if (can_throw_internal (insn) + && (r = get_eh_region_from_rtx (insn)) != NULL + && (lp = gen_eh_landing_pad (r)) != NULL + && (landing_label = lp->landing_pad) != NULL + && (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL + && (r->type != ERT_CLEANUP + || bitmap_bit_p (df_get_live_in (landing_bb), + ALLOCNO_REGNO (a)))) { - OBJECT_CONFLICT_HARD_REGS (obj) - |= callee_abi.mode_clobbers (ALLOCNO_MODE (a)); - OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) - |= callee_abi.mode_clobbers (ALLOCNO_MODE (a)); + HARD_REG_SET new_conflict_regs + = callee_abi.mode_clobbers (ALLOCNO_MODE (a)); + OBJECT_CONFLICT_HARD_REGS (obj) |= new_conflict_regs; + OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= new_conflict_regs; } - if (sparseset_bit_p (allocnos_processed, num)) continue; sparseset_set_bit (allocnos_processed, num); diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 2067dc8..41e38a85 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,56 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * Make-lang.in: New var, GM2_PICFLAGS. Use it. + +2023-06-13 Gaius Mulley <gaiusmod2@gmail.com> + + * Make-lang.in (check-format-error): New rule. + * gm2-compiler/M2MetaError.mod (op): Add calls InternalError if + digits are detected. + * gm2-compiler/M2Quads.mod (BuildForToByDo): Bugfix to format + specifier. + (BuildLengthFunction): Bugfix to format specifiers. + (BuildOddFunction): Bugfix to format specifiers. + (BuildAbsFunction): Bugfix to format specifiers. + (BuildCapFunction): Bugfix to format specifiers. + (BuildChrFunction): Bugfix to format specifiers. + (BuildOrdFunction): Bugfix to format specifiers. + (BuildMakeAdrFunction): Bugfix to format specifiers. + (BuildSizeFunction): Bugfix to format specifiers. + (BuildBitSizeFunction): Bugfix to format specifiers. + * tools-src/checkmeta.py: New file. + +2023-06-12 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/110189 + * gm2-compiler/M2Quads.mod (BuildAbsFunction): Replace abort + format specifier. + (BuildValFunction): Replace abort format specifier. + (BuildCastFunction): Replace abort format specifier. + (BuildMinFunction): Replace abort format specifier. + (BuildMaxFunction): Replace abort format specifier. + (BuildTruncFunction): Replace abort format specifier. + * gm2-compiler/P3Build.bnf (Pass1): Remove. + (Pass2): Remove. + (Pass3): Remove. + (Expect): Add Pass1. + (AsmStatement): Remove Pass3. + (AsmOperands): Remove Pass3. + (AsmOperandSpec): Remove Pass3. + (AsmInputElement): Remove Pass3. + (AsmOutputElement): Remove Pass3. + (AsmTrashList): Remove Pass3. + +2023-06-12 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/110126 + * gm2-compiler/M2Quads.def (BuildAsmElement): Remove + trash parameter. + (BuildAsmTrash): New procedure. + * gm2-compiler/M2Quads.mod (BuildAsmTrash): New procedure. + (BuildAsmElement): Remove trash parameter. + * gm2-compiler/P3Build.bnf (AsmTrashList): Rewrite. + 2023-06-08 Gaius Mulley <gaiusmod2@gmail.com> PR modula2/110126 diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 973afef..15da74a 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -478,6 +478,11 @@ GM2_MIN_FLAGS=$(GM2_G) $(GM2_OS) \ -Wpedantic-cast -Wpedantic-param-names -fno-exceptions \ -ffunction-sections -fdata-sections $(GM2_CPP) +# ALL_LINKERFLAGS may include -pie (when GCC is configured with +# --enable-host-pie), so use -fPIE if needed. (It would not be +# a good idea to override CFLAGS.) +GM2_PICFLAGS = $(PICFLAG) + O2=-O2 -g SO_O2=-O2 -g -fPIC SO=-O0 -g -fPIC @@ -593,6 +598,13 @@ m2/gm2-gcc/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-gcc/%.def $(MCDEPS) -test -d $(@D) || $(mkinstalldirs) $(@D) $(MC) -o=$@ $(srcdir)/m2/gm2-gcc/$*.def +ifeq ($(HAVE_PYTHON),yes) +check-format-error: + $(PYTHON) $(srcdir)/m2/tools-src/checkmeta.py -s $(srcdir)/m2/gm2-compiler +else +check-format-error: +endif + # The following tables define the source files which are translated into C using mc # and defines the system interface C files. @@ -1355,23 +1367,23 @@ m2/boot-bin/mc$(exeext): $(BUILD-MC-BOOT-O) $(BUILD-MC-INTERFACE-O) \ m2/mc-boot/$(SRC_PREFIX)%.o: m2/mc-boot/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CXXFLAGS) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@ + $(CXX) $(CXXFLAGS) $(GM2_PICFLAGS) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@ m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CXXFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ + $(CXX) $(CXXFLAGS) $(GM2_PICFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CXXFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ + $(CXX) $(CXXFLAGS) $(GM2_PICFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ m2/mc-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit -test -d $(@D) || $(mkinstalldirs) $(@D) unset CC ; $(M2LINK) -s --langc++ --exit --name m2/mc-boot/main.cc $(srcdir)/m2/init/mcinit - $(CXX) $(CXXFLAGS) -g -c -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) m2/mc-boot/main.cc -o $@ + $(CXX) $(CXXFLAGS) $(GM2_PICFLAGS) -g -c -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) m2/mc-boot/main.cc -o $@ mcflex.o: mcflex.c m2/gm2-libs/gm2-libs-host.h - $(CC) $(CFLAGS) -I$(srcdir)/m2/mc -g -c $< -o $@ # remember that mcReserved.h is copied into m2/mc + $(CC) $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2/mc -g -c $< -o $@ # remember that mcReserved.h is copied into m2/mc mcflex.c: $(srcdir)/m2/mc/mc.flex flex -t $< > $@ @@ -1379,17 +1391,17 @@ mcflex.c: $(srcdir)/m2/mc/mc.flex m2/gm2-libs-boot/M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D) || $(mkinstalldirs) $(@D) $(MC) --suppress-noreturn -o=m2/gm2-libs-boot/M2RTS.c $(srcdir)/m2/gm2-libs/M2RTS.mod - $(COMPILER) -c -DIN_GCC $(CFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/M2RTS.c -o $@ + $(COMPILER) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/M2RTS.c -o $@ m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D) || $(mkinstalldirs) $(@D) $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs-boot/$*.mod - $(COMPILER) -c -DIN_GCC $(CFLAGS) $(MCINCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(COMPILER) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MCINCLUDES) m2/gm2-libs-boot/$*.c -o $@ m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D) || $(mkinstalldirs) $(@D) $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs/$*.mod - $(COMPILER) -c -DIN_GCC $(CFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(COMPILER) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@ m2/gm2-libs-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS) -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1397,49 +1409,49 @@ m2/gm2-libs-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS) m2/gm2-libs-boot/RTcodummy.o: $(srcdir)/m2/gm2-libs-ch/RTcodummy.c m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/RTintdummy.o: $(srcdir)/m2/gm2-libs-ch/RTintdummy.c m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DHAVE_CONFIG_H $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@ + $(CXX) -c -DHAVE_CONFIG_H $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@ m2/gm2-libs-boot/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ m2/gm2-libs-boot/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c m2/gm2-libs-boot/$(SRC_PREFIX)errno.h m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c $(BUILD-LIBS-BOOT-H) m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/SysExceptions.o: $(srcdir)/m2/gm2-libs-ch/SysExceptions.c \ m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-boot/SysStorage.o: $(srcdir)/m2/gm2-libs/SysStorage.mod $(MCDEPS) $(BUILD-BOOT-H) -test -d $(@D) || $(mkinstalldirs) $(@D) $(MC) -o=m2/gm2-libs-boot/SysStorage.c $(srcdir)/m2/gm2-libs/SysStorage.mod - $(COMPILER) -DIN_GCC -c $(CFLAGS) \ + $(COMPILER) -DIN_GCC -c $(CFLAGS) $(GM2_PICFLAGS) \ -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) \ m2/gm2-libs-boot/SysStorage.c -o m2/gm2-libs-boot/SysStorage.o @@ -1512,7 +1524,7 @@ m2/gm2-compiler/%.o: m2/gm2-compiler/%.mod m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.c m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -DBUILD_GM2_LIBS_TARGET -DBUILD_GM2_LIBS -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -DBUILD_GM2_LIBS_TARGET -DBUILD_GM2_LIBS -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.mod -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1614,15 +1626,15 @@ m2/gm2-libs/%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H) m2/gm2-libs/%.o: $(srcdir)/m2/gm2-libs-ch/%.c m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -DBUILD_GM2_LIBS -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -DBUILD_GM2_LIBS -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs/%.o: $(srcdir)/m2/gm2-libs-ch/%.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ m2/gm2-libs/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ + $(CXX) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ m2/gm2-libs-boot/libgm2.a: m2/boot-bin/mc$(exeext) $(BUILD-LIBS-BOOT) -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1722,11 +1734,11 @@ include m2/Make-maintainer else m2/pge-boot/%.o: m2/pge-boot/%.c m2/gm2-libs/gm2-libs-host.h m2/gm2config.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(CXX) $(CFLAGS) $(GM2_PICFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ m2/pge-boot/%.o: m2/pge-boot/%.cc m2/gm2-libs/gm2-libs-host.h m2/gm2config.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CXXFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(CXX) $(CXXFLAGS) $(GM2_PICFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ $(PGE): $(BUILD-PGE-O) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PGE-O) -lm diff --git a/gcc/m2/gm2-compiler/M2MetaError.mod b/gcc/m2/gm2-compiler/M2MetaError.mod index 5f794a2..97b56cc 100644 --- a/gcc/m2/gm2-compiler/M2MetaError.mod +++ b/gcc/m2/gm2-compiler/M2MetaError.mod @@ -1529,7 +1529,11 @@ BEGIN DEC (eb.ini) | 'u': eb.quotes := FALSE | ':': ifNonNulThen (eb, sym) ; - DEC (eb.ini) + DEC (eb.ini) | + '1': InternalError ('incorrect format spec, expecting %1 rather than % spec 1') | + '2': InternalError ('incorrect format spec, expecting %2 rather than % spec 2') | + '3': InternalError ('incorrect format spec, expecting %3 rather than % spec 3') | + '4': InternalError ('incorrect format spec, expecting %4 rather than % spec 4') ELSE InternalFormat (eb, 'expecting one of [akqtdnpsuCDEFKNOPQRSTUWXYZ:<>%]', __LINE__) diff --git a/gcc/m2/gm2-compiler/M2Quads.def b/gcc/m2/gm2-compiler/M2Quads.def index 493111e..fcb59bb 100644 --- a/gcc/m2/gm2-compiler/M2Quads.def +++ b/gcc/m2/gm2-compiler/M2Quads.def @@ -144,7 +144,7 @@ EXPORT QUALIFIED StartBuildDefFile, StartBuildModFile, EndBuildFile, IsAutoPushOn, PushAutoOn, PushAutoOff, PopAuto, PushInConstExpression, PopInConstExpression, IsInConstExpression, - MustCheckOverflow, BuildAsmElement ; + MustCheckOverflow, BuildAsmElement, BuildAsmTrash ; TYPE @@ -2734,7 +2734,29 @@ PROCEDURE IsInConstExpression () : BOOLEAN ; |------------------| |------------------| *) -PROCEDURE BuildAsmElement (input, output, trash: BOOLEAN) ; +PROCEDURE BuildAsmElement (input, output: BOOLEAN) ; + + +(* + BuildAsmTrash - the stack is expected to contain: + + + Entry Exit + ===== ==== + + Ptr -> + +------------------+ + | expr | tokpos | + |------------------| +------------------+ + | CurrentInterface | | CurrentInterface | + |------------------| |------------------| + | CurrentAsm | | CurrentAsm | + |------------------| |------------------| + | n | | n | + |------------------| |------------------| +*) + +PROCEDURE BuildAsmTrash ; END M2Quads. diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index 8639d5e..a27c3e1 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -4411,18 +4411,18 @@ BEGIN IdSym := RequestSym (idtok, Id) ; IF NOT IsExpressionCompatible (GetSType (e1), GetSType (e2)) THEN - MetaError2 ('incompatible types found in {%EkFOR} loop header, initial expression {%E1tsad} and final expression {%E2tsad}', + MetaError2 ('incompatible types found in {%EkFOR} loop header, initial expression {%1tsad} and final expression {%2tsad}', e1, e2) ; CheckExpressionCompatible (idtok, GetSType (e1), GetSType (e2)) END ; IF NOT IsExpressionCompatible( GetSType (e1), ByType) THEN - MetaError2 ('incompatible types found in {%EkFOR} loop header, initial expression {%E1tsad} and {%kBY} {%E2tsad}', + MetaError2 ('incompatible types found in {%EkFOR} loop header, initial expression {%1tsad} and {%kBY} {%2tsad}', e2, BySym) ; CheckExpressionCompatible (e1tok, GetSType (e1), ByType) ELSIF NOT IsExpressionCompatible (GetSType (e2), ByType) THEN - MetaError2 ('incompatible types found in {%EkFOR} loop header, final expression {%E1tsad} and {%kBY} {%E2tsad}', + MetaError2 ('incompatible types found in {%EkFOR} loop header, final expression {%1tsad} and {%kBY} {%2tsad}', e2, BySym) ; CheckExpressionCompatible (e1tok, GetSType (e2), ByType) END ; @@ -8290,7 +8290,7 @@ BEGIN Type := GetSType (Param) ; (* get the type from the symbol, not the stack *) IF NoOfParam # 1 THEN - MetaErrorT1 (functok, 'base procedure {%E1kLENGTH} expects 1 parameter, seen {%1En} parameters', NoOfParam) + MetaErrorT1 (functok, 'base procedure {%1EkLENGTH} expects 1 parameter, seen {%1n} parameters', NoOfParam) END ; IF NoOfParam >= 1 THEN @@ -8333,7 +8333,7 @@ BEGIN PopT (NoOfParam) ; PopN (NoOfParam + 1) ; PushTtok (MakeConstLit (combinedtok, MakeKey ('0'), Cardinal), combinedtok) ; - MetaErrorT0 (functok, 'no procedure Length found for substitution to the standard function {%E1kLENGTH} which is required to calculate non constant string lengths') + MetaErrorT0 (functok, 'no procedure Length found for substitution to the standard function {%1EkLENGTH} which is required to calculate non constant string lengths') END END ELSE @@ -8427,13 +8427,13 @@ BEGIN PushTtok (Res, combinedtok) ELSE MetaErrorT1 (combinedtok, - 'the parameter to {%E1kODD} must be a variable or constant, seen {%E1ad}', + 'the parameter to {%1EkODD} must be a variable or constant, seen {%1ad}', Var) ; PushTtok (False, combinedtok) END ELSE MetaErrorT1 (functok, - 'the pseudo procedure {%E1kODD} only has one parameter, seen {%E1n} parameters', + 'the pseudo procedure {%1EkODD} only has one parameter, seen {%1n} parameters', NoOfParam) ; PushTtok (False, functok) END @@ -8501,12 +8501,12 @@ BEGIN PushTFtok (Res, GetSType (Var), combinedtok) ELSE MetaErrorT1 (combinedtok, - 'the parameter to {%A1kABS} must be a variable or constant, seen {%E1ad}', + 'the parameter to {%AkABS} must be a variable or constant, seen {%1ad}', Var) END ELSE MetaErrorT1 (functok, - 'the pseudo procedure {%A1kABS} only has one parameter, seen {%E1n} parameters', + 'the pseudo procedure {%AkABS} only has one parameter, seen {%1n} parameters', NoOfParam) END END BuildAbsFunction ; @@ -8561,12 +8561,12 @@ BEGIN PushTFtok (Res, Char, combinedtok) ELSE MetaErrorT1 (functok, - 'the parameter to {%A1kCAP} must be a variable or constant, seen {%E1ad}', + 'the parameter to {%AkCAP} must be a variable or constant, seen {%1ad}', Var) END ELSE MetaErrorT1 (functok, - 'the pseudo procedure {%A1kCAP} only has one parameter, seen {%E1n} parameters', + 'the pseudo procedure {%AkCAP} only has one parameter, seen {%1n} parameters', NoOfParam) END END BuildCapFunction ; @@ -8631,12 +8631,12 @@ BEGIN BuildConvertFunction ELSE MetaErrorT1 (functok, - 'the parameter to {%A1kCHR} must be a variable or constant, seen {%E1ad}', + 'the parameter to {%AkCHR} must be a variable or constant, seen {%1ad}', Var) END ELSE MetaErrorT1 (functok, - 'the pseudo procedure {%A1kCHR} only has one parameter, seen {%E1n} parameters', + 'the pseudo procedure {%AkCHR} only has one parameter, seen {%1n} parameters', NoOfParam) END END BuildChrFunction ; @@ -8702,12 +8702,12 @@ BEGIN BuildConvertFunction ELSE MetaErrorT2 (functok, - 'the parameter to {%A1k%a} must be a variable or constant, seen {%2ad}', + 'the parameter to {%1Ak%a} must be a variable or constant, seen {%2ad}', Sym, Var) END ELSE MetaErrorT2 (functok, - 'the pseudo procedure {%A1k%a} only has one parameter, seen {%2n} parameters', + 'the pseudo procedure {%1Ak%a} only has one parameter, seen {%2n} parameters', Sym, NoOfParam) END END BuildOrdFunction ; @@ -8773,13 +8773,13 @@ BEGIN ELSE combinedtok := MakeVirtualTok (functok, optok, optok) ; MetaErrorT2 (combinedtok, - 'the parameter to {%E1k%a} must be a variable or constant, seen {%2ad}', + 'the parameter to {%1Ek%a} must be a variable or constant, seen {%2ad}', Sym, Var) ; PushTtok (combinedtok, MakeConstLit (combinedtok, MakeKey ('0'), ZType)) END ELSE MetaErrorT2 (functok, - 'the pseudo procedure {%E1k%a} only has one parameter, seen {%2n} parameters', + 'the pseudo procedure {%1Ek%a} only has one parameter, seen {%2n} parameters', Sym, NoOfParam) ; PushTtok (functok, MakeConstLit (functok, MakeKey ('0'), ZType)) END @@ -8846,7 +8846,7 @@ BEGIN AreConst := FALSE ; ELSIF NOT IsConst (OperandT (i)) THEN - MetaError1 ('problem in the {%E1N} argument for {%EkMAKEADR}, all arguments to {%EkMAKEADR} must be either variables or constants', i) + MetaError1 ('problem in the {%1EN} argument for {%kMAKEADR}, all arguments to {%kMAKEADR} must be either variables or constants', i) END ; INC (i) END ; @@ -8858,7 +8858,7 @@ BEGIN PopN (NoOfParameters+1) ; PushTFtok (ReturnVar, GetSType (MakeAdr), resulttok) ELSE - MetaError1 ('the pseudo procedure {%EkMAKEADR} requires at least one parameter, seen {%E1n}', NoOfParameters) ; + MetaError1 ('the pseudo procedure {%EkMAKEADR} requires at least one parameter, seen {%1n}', NoOfParameters) ; PopN (1) ; PushTFtok (Nil, GetSType (MakeAdr), functok) END @@ -8928,14 +8928,14 @@ BEGIN GenQuad (LogicalShiftOp, returnVar, varSet, derefExp) ; PushTFtok (returnVar, GetSType (varSet), combinedtok) ELSE - MetaError1 ('SYSTEM procedure {%E1kSHIFT} expects a constant or variable which has a type of SET as its first parameter, seen {%E1ad}', + MetaError1 ('SYSTEM procedure {%1EkSHIFT} expects a constant or variable which has a type of SET as its first parameter, seen {%1ad}', varSet) ; PushTFtok (MakeConstLit (combinedtok, MakeKey ('0'), Cardinal), Cardinal, combinedtok) END ELSE combinedtok := MakeVirtualTok (functok, functok, paramtok) ; MetaErrorT1 (functok, - 'the pseudo procedure {%EkSHIFT} requires at least two parameters, seen {%E1n}', + 'the pseudo procedure {%kSHIFT} requires at least two parameters, seen {%1En}', NoOfParam) ; PopN (NoOfParam + 1) ; PushTFtok (MakeConstLit (combinedtok, MakeKey ('0'), Cardinal), Cardinal, combinedtok) @@ -9072,7 +9072,7 @@ BEGIN THEN (* not sensible to try and recover when we dont know the return type. *) MetaErrorT1 (typetok, - 'undeclared type found in builtin procedure function {%AkVAL} {%A1ad}', + 'undeclared type found in builtin procedure function {%AkVAL} {%1ad}', Type) (* non recoverable error. *) ELSIF (IsSet (Type) OR IsEnumeration (Type) OR IsSubrange (Type) OR @@ -9090,7 +9090,7 @@ BEGIN ELSE (* not sensible to try and recover when we dont know the return type. *) MetaErrorT0 (functok, - 'the builtin procedure {%AkVAL} has thw following formal parameter declaration {%kVAL} (type, expression)') + 'the builtin procedure {%AkVAL} has the following formal parameter declaration {%kVAL} (type, expression)') (* non recoverable error. *) END ELSE @@ -9182,7 +9182,7 @@ BEGIN ELSE (* not sensible to try and recover when we dont know the return type. *) MetaErrorT0 (functok, - 'the second parameter to the builtin procedure {%AkCAST} must either be a variable, constant or a procedure. The formal parameters to cast are CAST(type, variable or constant or procedure)') + 'the second parameter to the builtin procedure {%AkCAST} must either be a variable, constant or a procedure. The formal parameters to cast are {%kCAST} (type, variable or constant or procedure)') (* non recoverable error. *) END ELSE @@ -9257,12 +9257,12 @@ BEGIN IF IsUnknown (Type) THEN (* we cannot recover if we dont have a type. *) - MetaErrorT1 (typetok, 'undeclared type {%A1ad} found in {%kCONVERT}', Type) + MetaErrorT1 (typetok, 'undeclared type {%1Aad} found in {%kCONVERT}', Type) (* non recoverable error. *) ELSIF IsUnknown (Exp) THEN (* we cannot recover if we dont have a type. *) - MetaErrorT1 (typetok, 'unknown {%A1d} {%1ad} found in {%kCONVERT}', Exp) + MetaErrorT1 (typetok, 'unknown {%1Ad} {%1ad} found in {%kCONVERT}', Exp) (* non recoverable error. *) ELSIF (IsSet (Type) OR IsEnumeration (Type) OR IsSubrange (Type) OR IsType (Type) OR IsPointer (Type) OR IsProcType (Type) OR IsRecord (Type)) AND @@ -9350,7 +9350,7 @@ BEGIN ELSIF GetSType (type) = NulSym THEN MetaErrorT1 (tok, - 'unable to obtain the {%AkMIN} value for type {%1Aad}', type) ; + 'unable to obtain the {%AkMIN} value for type {%1ad}', type) ; (* non recoverable error. *) InternalError ('MetaErrorT1 {%AkMIN} should call abort') ELSE @@ -9388,7 +9388,7 @@ BEGIN ELSIF GetSType (type) = NulSym THEN MetaErrorT1 (tok, - 'unable to obtain the {%AkMAX} value for type {%1Aad}', type) ; + 'unable to obtain the {%AkMAX} value for type {%1ad}', type) ; (* non recoverable error. *) InternalError ('MetaErrorT1 {%AkMAX} should call abort') ELSE @@ -9444,14 +9444,14 @@ BEGIN ELSE (* we dont know the type therefore cannot fake a return. *) MetaErrorT1 (vartok, - 'parameter to {%AkMIN} must be a type or a variable, seen {%1Aad}', + 'parameter to {%AkMIN} must be a type or a variable, seen {%1ad}', Var) (* non recoverable error. *) END ELSE (* we dont know the type therefore cannot fake a return. *) MetaErrorT1 (functok, - 'the pseudo builtin procedure function {%AkMIN} only has one parameter, seen {%1An}', + 'the pseudo builtin procedure function {%AkMIN} only has one parameter, seen {%1n}', NoOfParam) (* non recoverable error. *) END @@ -9505,14 +9505,14 @@ BEGIN ELSE (* we dont know the type therefore cannot fake a return. *) MetaErrorT1 (vartok, - 'parameter to {%AkMAX} must be a type or a variable, seen {%1Aad}', + 'parameter to {%AkMAX} must be a type or a variable, seen {%1ad}', Var) (* non recoverable error. *) ; END ELSE (* we dont know the type therefore cannot fake a return. *) MetaErrorT1 (functok, - 'the pseudo builtin procedure function {%AkMAX} only has one parameter, seen {%1An}', + 'the pseudo builtin procedure function {%AkMAX} only has one parameter, seen {%1n}', NoOfParam) (* non recoverable error. *) END @@ -9600,7 +9600,7 @@ BEGIN ELSE (* we dont know the type therefore cannot fake a return. *) MetaErrorT1 (functok, - 'the pseudo builtin procedure function {%AkTRUNC} only has one parameter, seen {%1An}', NoOfParam) + 'the pseudo builtin procedure function {%AkTRUNC} only has one parameter, seen {%1n}', NoOfParam) (* non recoverable error. *) END END BuildTruncFunction ; @@ -10071,18 +10071,18 @@ BEGIN THEN paramtok := OperandTok (1) ; resulttok := MakeVirtualTok (functok, functok, paramtok) ; - BuildSizeCheckEnd (ProcSym) ; (* quadruple generation now on *) + BuildSizeCheckEnd (ProcSym) ; (* Quadruple generation now on. *) ReturnVar := MakeTemporary (resulttok, ImmediateValue) ; GenQuadO (resulttok, SizeOp, ReturnVar, NulSym, OperandT(1), TRUE) ELSIF IsVar (OperandT (1)) THEN - BuildSizeCheckEnd (ProcSym) ; (* quadruple generation now on *) + BuildSizeCheckEnd (ProcSym) ; (* Quadruple generation now on. *) Type := GetSType (OperandT (1)) ; paramtok := OperandTok (1) ; resulttok := MakeVirtualTok (functok, functok, paramtok) ; IF IsUnbounded (Type) THEN - (* eg. SIZE(a) ; where a is unbounded dereference HIGH and multiply by the TYPE *) + (* Eg. SIZE(a) ; where a is unbounded dereference HIGH and multiply by the TYPE. *) dim := OperandD (1) ; IF dim = 0 THEN @@ -10095,18 +10095,18 @@ BEGIN IF Type = NulSym THEN MetaErrorT1 (resulttok, - 'cannot get the type and size of {%E1ad}', OperandT (1)) + 'cannot get the type and size of {%1Ead}', OperandT (1)) END ; GenQuadO (resulttok, SizeOp, ReturnVar, NulSym, Type, TRUE) END ELSE resulttok := functok ; MetaErrorT1 (resulttok, - '{%E}SYSTEM procedure {%kSIZE} expects a variable as its parameter, seen {%E1d}', + '{%E}SYSTEM procedure {%kSIZE} expects a variable as its parameter, seen {%1Ed}', OperandT (1)) ; ReturnVar := MakeConstLit (resulttok, MakeKey('0'), Cardinal) END ; - PopN (NoOfParam+1) ; (* destroy the arguments and function *) + PopN (NoOfParam+1) ; (* Destroy the arguments and function. *) PushTFtok (ReturnVar, GetSType(ProcSym), resulttok) END BuildSizeFunction ; @@ -10165,7 +10165,7 @@ BEGIN GenQuadO (resulttok, SizeOp, ReturnVar, NulSym, GetSType (OperandT (1)), FALSE) ELSE MetaErrorT1 (resulttok, - '{%E}SYSTEM procedure function {%kTSIZE} expects a variable as its first parameter, seen {%E1d}', + '{%E}SYSTEM procedure function {%kTSIZE} expects a variable as its first parameter, seen {%1Ed}', OperandT (1)) ; ReturnVar := MakeConstLit (resulttok, MakeKey ('0'), Cardinal) END @@ -10188,7 +10188,7 @@ BEGIN ELSE resulttok := MakeVirtualTok (functok, functok, paramtok) ; MetaErrorT1 (resulttok, - '{%E}SYSTEM procedure function {%kTSIZE} expects the first parameter to be a record type, seen {%E1d}', + '{%E}SYSTEM procedure function {%kTSIZE} expects the first parameter to be a record type, seen {%1d}', Record) ; ReturnVar := MakeConstLit (resulttok, MakeKey ('0'), Cardinal) END @@ -10252,7 +10252,7 @@ BEGIN GenQuadO (resulttok, StandardFunctionOp, ReturnVar, ProcSym, OperandT(1), FALSE) ELSE MetaErrorT1 (resulttok, - '{%E}SYSTEM procedure function {%kTBITSIZE} expects a variable as its first parameter, seen {%E1d}', + '{%E}SYSTEM procedure function {%kTBITSIZE} expects a variable as its first parameter, seen {%1d}', OperandT (1)) ; ReturnVar := MakeConstLit (resulttok, MakeKey ('0'), Cardinal) END @@ -10275,7 +10275,7 @@ BEGIN ELSE resulttok := MakeVirtualTok (functok, functok, paramtok) ; MetaErrorT1 (resulttok, - '{%E}SYSTEM procedure function {%kTBITSIZE} expects the first parameter to be a record type, seen {%E1d}', + '{%E}SYSTEM procedure function {%kTBITSIZE} expects the first parameter to be a record type, seen {%1d}', Record) ; ReturnVar := MakeConstLit (resulttok, MakeKey ('0'), Cardinal) END @@ -14421,7 +14421,7 @@ END AddVarientEquality ; |------------------| |------------------| *) -PROCEDURE BuildAsmElement (input, output, trash: BOOLEAN) ; +PROCEDURE BuildAsmElement (input, output: BOOLEAN) ; VAR n, str, expr, tokpos, CurrentInterface, @@ -14449,15 +14449,53 @@ BEGIN PutRegInterface (tokpos, CurrentInterface, n, name, str, expr, 0, NextQuad) END ; - IF trash + PushT (n) ; + PushT (CurrentAsm) ; + PushT (CurrentInterface) +END BuildAsmElement ; + + +(* + BuildAsmTrash - the stack is expected to contain: + + + Entry Exit + ===== ==== + + Ptr -> + +------------------+ + | expr | tokpos | + |------------------| +------------------+ + | CurrentInterface | | CurrentInterface | + |------------------| |------------------| + | CurrentAsm | | CurrentAsm | + |------------------| |------------------| + | n | | n | + |------------------| |------------------| +*) + +PROCEDURE BuildAsmTrash ; +VAR + n, expr, tokpos, + CurrentInterface, + CurrentAsm : CARDINAL ; +BEGIN + PopTtok (expr, tokpos) ; + PopT (CurrentInterface) ; + PopT (CurrentAsm) ; + Assert (IsGnuAsm (CurrentAsm) OR IsGnuAsmVolatile (CurrentAsm)) ; + PopT (n) ; + INC (n) ; + IF CurrentInterface = NulSym THEN - PutRegInterface (tokpos, CurrentInterface, n, name, str, expr, - 0, NextQuad) + CurrentInterface := MakeRegInterface () END ; + PutRegInterface (tokpos, CurrentInterface, n, NulName, NulSym, expr, + 0, NextQuad) ; PushT (n) ; PushT (CurrentAsm) ; PushT (CurrentInterface) -END BuildAsmElement ; +END BuildAsmTrash ; (* diff --git a/gcc/m2/gm2-compiler/P3Build.bnf b/gcc/m2/gm2-compiler/P3Build.bnf index 8fbe191..e50620e 100644 --- a/gcc/m2/gm2-compiler/P3Build.bnf +++ b/gcc/m2/gm2-compiler/P3Build.bnf @@ -126,7 +126,7 @@ FROM M2Quads IMPORT PushT, PopT, PushTF, PopTF, PopNothing, Annotate, BuildRetry, DisplayStack, AddVarientRange, AddVarientEquality, - BuildAsmElement, + BuildAsmElement, BuildAsmTrash, BeginVarient, EndVarient, BeginVarientList, EndVarientList, PushInConstExpression, PopInConstExpression, IsInConstExpression, BuildDefaultFieldAlignment, BuildPragmaField, @@ -179,9 +179,6 @@ IMPORT M2Error ; CONST Debugging = FALSE ; - Pass1 = FALSE ; (* permanently disabled for the time being *) - Pass2 = FALSE ; - Pass3 = TRUE ; (* permanently disabled for the time being *) DebugAsm = FALSE ; VAR @@ -368,6 +365,8 @@ END PeepToken ; *) PROCEDURE Expect (t: toktype; stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; +CONST + Pass1 = FALSE ; BEGIN IF currenttoken=t THEN @@ -1463,108 +1462,84 @@ Definition := "CONST" { ConstantDeclaration ";" } | DefProcedureHeading ";" =: AsmStatement := % VAR CurrentAsm: CARDINAL ; % - 'ASM' % IF Pass3 - THEN - PushAutoOn ; - PushT(0) ; (* operand count *) - PushT(MakeGnuAsm()) - END + 'ASM' % PushAutoOn ; + PushT(0) ; (* operand count *) + PushT(MakeGnuAsm()) % - [ 'VOLATILE' % IF Pass3 - THEN - PopT(CurrentAsm) ; - PutGnuAsmVolatile(CurrentAsm) ; - PushT(CurrentAsm) - END + [ 'VOLATILE' % PopT(CurrentAsm) ; + PutGnuAsmVolatile(CurrentAsm) ; + PushT(CurrentAsm) % - ] '(' AsmOperands % IF Pass3 - THEN - PopNothing ; (* throw away interface sym *) - BuildInline ; - PopNothing ; (* throw away count *) - PopAuto - END + ] '(' AsmOperands % PopNothing ; (* throw away interface sym *) + BuildInline ; + PopNothing ; (* throw away count *) + PopAuto % ')' =: AsmOperands := % VAR CurrentAsm, count: CARDINAL ; str: CARDINAL ; % - ConstExpression % IF Pass3 + ConstExpression % PopT(str) ; + PopT(CurrentAsm) ; + Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; + PopT(count) ; + IF DebugAsm THEN - PopT(str) ; - PopT(CurrentAsm) ; - Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; - PopT(count) ; - IF DebugAsm - THEN - printf1('1: count of asm operands: %d\n', count) - END ; - PushT(count) ; - (* adds the name/instruction for this asm *) - PutGnuAsm(CurrentAsm, str) ; - PushT(CurrentAsm) ; - PushT(NulSym) (* the InterfaceSym *) - END + printf1('1: count of asm operands: %d\n', count) + END ; + PushT(count) ; + (* adds the name/instruction for this asm *) + PutGnuAsm(CurrentAsm, str) ; + PushT(CurrentAsm) ; + PushT(NulSym) (* the InterfaceSym *) % ( AsmOperandSpec | % (* epsilon *) - IF Pass3 - THEN - PutGnuAsmSimple(CurrentAsm) - END + PutGnuAsmSimple(CurrentAsm) % ) =: AsmOperandSpec := % VAR CurrentAsm, outputs, inputs, trash, count: CARDINAL ; % - ':' AsmOutputList % IF Pass3 + ':' AsmOutputList % PopT(outputs) ; + PopT(CurrentAsm) ; + Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; + PopT(count) ; + IF DebugAsm THEN - PopT(outputs) ; - PopT(CurrentAsm) ; - Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; - PopT(count) ; - IF DebugAsm - THEN - printf1('2: output count of asm operands: %d\n', count) - END ; - PutGnuAsmOutput(CurrentAsm, outputs) ; - PushT(0) ; (* reset count *) - PushT(CurrentAsm) ; - PushT(NulSym) (* the InterfaceSym *) - END + printf1('2: output count of asm operands: %d\n', count) + END ; + PutGnuAsmOutput(CurrentAsm, outputs) ; + PushT(0) ; (* reset count *) + PushT(CurrentAsm) ; + PushT(NulSym) (* the InterfaceSym *) % - [ ':' AsmInputList % IF Pass3 + [ ':' AsmInputList % PopT(inputs) ; + PopT(CurrentAsm) ; + Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; + PopT(count) ; + IF DebugAsm THEN - PopT(inputs) ; - PopT(CurrentAsm) ; - Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; - PopT(count) ; - IF DebugAsm - THEN - printf1('3: input count of asm operands: %d\n', count) - END ; - PutGnuAsmInput(CurrentAsm, inputs) ; - PushT(0) ; (* reset count *) - PushT(CurrentAsm) ; - PushT(NulSym) (* the InterfaceSym *) - END + printf1('3: input count of asm operands: %d\n', count) + END ; + PutGnuAsmInput(CurrentAsm, inputs) ; + PushT(0) ; (* reset count *) + PushT(CurrentAsm) ; + PushT(NulSym) (* the InterfaceSym *) % - [ ':' AsmTrashList % IF Pass3 + [ ':' AsmTrashList % PopT(trash) ; + PopT(CurrentAsm) ; + Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; + PopT(count) ; + IF DebugAsm THEN - PopT(trash) ; - PopT(CurrentAsm) ; - Assert(IsGnuAsm(CurrentAsm) OR IsGnuAsmVolatile(CurrentAsm)) ; - PopT(count) ; - IF DebugAsm - THEN - printf1('4: trash count of asm operands: %d\n', count) - END ; - PutGnuAsmTrash(CurrentAsm, trash) ; - PushT(0) ; (* reset count *) - PushT(CurrentAsm) ; - PushT(NulSym) (* the InterfaceSym *) - END + printf1('4: trash count of asm operands: %d\n', count) + END ; + PutGnuAsmTrash(CurrentAsm, trash) ; + PushT(0) ; (* reset count *) + PushT(CurrentAsm) ; + PushT(NulSym) (* the InterfaceSym *) % ] ] =: @@ -1578,53 +1553,27 @@ NamedOperand := '[' Ident ']' =: AsmOperandName := ( NamedOperand | % IF IsAutoPushOn() THEN - PushTF(NulName, identtok) + PushTF (NulName, identtok) END % ) =: AsmInputElement := AsmOperandName - ConstExpression '(' Expression % IF Pass3 - THEN - BuildAsmElement (TRUE, FALSE, FALSE) - END + ConstExpression '(' Expression % BuildAsmElement (TRUE, FALSE) % ')' =: AsmOutputElement := AsmOperandName - ConstExpression '(' Expression % IF Pass3 - THEN - BuildAsmElement (FALSE, TRUE, FALSE) - END + ConstExpression '(' Expression % BuildAsmElement (FALSE, TRUE) % ')' =: -AsmTrashList := % VAR expr, tokpos : CARDINAL ; % - [ ConstExpression % IF Pass3 - THEN - PopTtok (expr, tokpos) ; - PushT (NulSym) ; - PushTtok (expr, tokpos) ; - BuildAsmElement (FALSE, FALSE, TRUE) ; - PopTtok (expr, tokpos) ; - PopNothing ; - PushTtok (expr, tokpos) ; - END - +AsmTrashList := [ ConstExpression % BuildAsmTrash % - ] { ',' ConstExpression % IF Pass3 - THEN - PopTtok (expr, tokpos) ; - PushT (NulSym) ; - PushTtok (expr, tokpos) ; - BuildAsmElement (FALSE, FALSE, TRUE) ; - PopTtok (expr, tokpos) ; - PopNothing ; - PushTtok (expr, tokpos) ; - END + ] { ',' ConstExpression % BuildAsmTrash % } =: diff --git a/gcc/m2/tools-src/checkmeta.py b/gcc/m2/tools-src/checkmeta.py new file mode 100644 index 0000000..01e5883 --- /dev/null +++ b/gcc/m2/tools-src/checkmeta.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 + +# utility to check meta errors for simple format spec mistakes. + +# Copyright (C) 2016-2023 Free Software Foundation, Inc. +# +# This file is part of GNU Modula-2. +# +# GNU Modula-2 is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Modula-2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Modula-2; see the file COPYING. If not, write to the +# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +import argparse +import os +import pathlib +import sys + + +exit_code = 0 + + +def visit_dir(directory, ext, func): + # visit_dir - call func for each file below, dir, matching extension, ext. + list_of_files = os.listdir(directory) + list_of_files.sort() + for filename in list_of_files: + path = pathlib.Path(filename) + full = os.path.join(directory, filename) + if path.suffix == ext: + func(full) + + +def check_format_spec(filename, line, no): + global exit_code + + percent = line.find('%') + if percent >= 0: + specifier = False + for ch in line[percent:]: + if ch in ['{', '%']: + pass + elif ch in ['1', '2', '3', '4']: + if specifier: + sys.stderr.write('%s:%d: format specifier error, the symbol position digit must be before the specifier: %s\n' % (filename, no, line)) + exit_code = 1 + else: + specifier = True + + +def search_format(filename, line, no): + cbra = line.find('{') + while cbra >= 0: + colon = line.find(':', cbra) + end = line.find('}', cbra) + if end >= 0: + if (colon >= 0) and (colon < end): + end = colon + check_format_spec(filename, line[cbra:end], no) + cbra = line.find('{', end) + else: + return + + +def check_string_quote (filename, line, no, quote): + end = line.find(quote, 1) + if end > 0: + search_format(filename, line[1:end], no) + + +def check_string (filename, line, no): + quote = line.find("'") + if quote >= 0: + check_string_quote(filename, line[quote:], no, "'") + quote = line.find('"') + if quote >= 0: + check_string_quote(filename, line[quote:], no, '"') + + +def check_meta_spec (filename): + lines = open(filename).readlines() + extra = 0 + for no, line in enumerate(lines): + if extra > 0: + extra -= 1 + check_string(filename, line, no+1) + elif "Meta" in line: + meta = line.find("Meta") + if meta >= 0: + bra = line.find("(", meta) + if bra >= 0: + check_string(filename, line[bra:], no+1) + extra = 1 + + +def handle_arguments(): + # handle_arguments create and return the args object. + parser = argparse.ArgumentParser() + parser.add_argument('-s', '--srcdir', + help='set source directory.', + default='.', action='store') + args = parser.parse_args() + return args + + +def main(): + args = handle_arguments() + visit_dir(args.srcdir, '.mod', check_meta_spec) + visit_dir(args.srcdir, '.bnf', check_meta_spec) + sys.exit(exit_code) + + +main() diff --git a/gcc/match.pd b/gcc/match.pd index a17d683..2dd2382 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -6120,8 +6120,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (cmp @0 (bit_xor @1 (convert @2))))) (simplify - (cmp (convert? addr@0) integer_zerop) - (if (tree_single_nonzero_warnv_p (@0, NULL)) + (cmp (nop_convert? @0) integer_zerop) + (if (tree_expr_nonzero_p (@0)) { constant_boolean_node (cmp == NE_EXPR, type); })) /* (X & C) op (Y & C) into (X ^ Y) & C op 0. */ @@ -6410,6 +6410,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (cmp == GT_EXPR) (lt (view_convert:st @0) { build_zero_cst (st); }))))))))))) +/* unsigned < (typeof unsigned)(unsigned != 0) is always false. */ +(simplify + (lt:c @0 (convert (ne @0 integer_zerop))) + (if (TYPE_UNSIGNED (TREE_TYPE (@0))) + { constant_boolean_node (false, type); })) + +/* x != (typeof x)(x == 0) is always true. */ +(simplify + (ne:c @0 (convert (eq @0 integer_zerop))) + { constant_boolean_node (true, type); }) + (for cmp (unordered ordered unlt unle ungt unge uneq ltgt) /* If the second operand is NaN, the result is constant. */ (simplify diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index 1857b5b..b882df0 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -12800,10 +12800,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) case GOMP_MAP_ALWAYS_TO: case GOMP_MAP_ALWAYS_FROM: case GOMP_MAP_ALWAYS_TOFROM: - case GOMP_MAP_PRESENT_ALLOC: - case GOMP_MAP_PRESENT_FROM: - case GOMP_MAP_PRESENT_TO: - case GOMP_MAP_PRESENT_TOFROM: + case GOMP_MAP_FORCE_PRESENT: case GOMP_MAP_ALWAYS_PRESENT_FROM: case GOMP_MAP_ALWAYS_PRESENT_TO: case GOMP_MAP_ALWAYS_PRESENT_TOFROM: @@ -12822,7 +12819,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) case GOMP_MAP_FORCE_TO: case GOMP_MAP_FORCE_FROM: case GOMP_MAP_FORCE_TOFROM: - case GOMP_MAP_FORCE_PRESENT: case GOMP_MAP_FORCE_DEVICEPTR: case GOMP_MAP_DEVICE_RESIDENT: case GOMP_MAP_LINK: @@ -13349,10 +13345,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) case GOMP_MAP_ALWAYS_TO: case GOMP_MAP_ALWAYS_FROM: case GOMP_MAP_ALWAYS_TOFROM: - case GOMP_MAP_PRESENT_ALLOC: - case GOMP_MAP_PRESENT_TO: - case GOMP_MAP_PRESENT_FROM: - case GOMP_MAP_PRESENT_TOFROM: case GOMP_MAP_ALWAYS_PRESENT_TO: case GOMP_MAP_ALWAYS_PRESENT_FROM: case GOMP_MAP_ALWAYS_PRESENT_TOFROM: @@ -13397,13 +13389,13 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) case OMP_CLAUSE_TO: tkind = (OMP_CLAUSE_MOTION_PRESENT (c) - ? GOMP_MAP_PRESENT_TO : GOMP_MAP_TO); + ? GOMP_MAP_ALWAYS_PRESENT_TO : GOMP_MAP_TO); tkind_zero = tkind; break; case OMP_CLAUSE_FROM: tkind = (OMP_CLAUSE_MOTION_PRESENT (c) - ? GOMP_MAP_PRESENT_FROM : GOMP_MAP_FROM); + ? GOMP_MAP_ALWAYS_PRESENT_FROM : GOMP_MAP_FROM); tkind_zero = tkind; break; default: diff --git a/gcc/optabs.def b/gcc/optabs.def index f31b69c..22b31be 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -260,6 +260,8 @@ OPTAB_D (uaddv4_optab, "uaddv$I$a4") OPTAB_D (usubv4_optab, "usubv$I$a4") OPTAB_D (umulv4_optab, "umulv$I$a4") OPTAB_D (negv3_optab, "negv$I$a3") +OPTAB_D (uaddc5_optab, "uaddc$I$a5") +OPTAB_D (usubc5_optab, "usubc$I$a5") OPTAB_D (addptr3_optab, "addptr$a3") OPTAB_D (spaceship_optab, "spaceship$a3") @@ -359,6 +361,8 @@ OPTAB_D (mask_fold_left_plus_optab, "mask_fold_left_plus_$a") OPTAB_D (extract_last_optab, "extract_last_$a") OPTAB_D (fold_extract_last_optab, "fold_extract_last_$a") +OPTAB_D (uabd_optab, "uabd$a3") +OPTAB_D (sabd_optab, "sabd$a3") OPTAB_D (savg_floor_optab, "avg$a3_floor") OPTAB_D (uavg_floor_optab, "uavg$a3_floor") OPTAB_D (savg_ceil_optab, "avg$a3_ceil") diff --git a/gcc/postreload.cc b/gcc/postreload.cc index 20e138b..d5f3670 100644 --- a/gcc/postreload.cc +++ b/gcc/postreload.cc @@ -1899,6 +1899,79 @@ move2add_use_add3_insn (scalar_int_mode mode, rtx reg, rtx sym, rtx off, return changed; } +/* Perform any invalidations necessary for INSN. */ + +static void +reload_cse_move2add_invalidate (rtx_insn *insn) +{ + for (rtx note = REG_NOTES (insn); note; note = XEXP (note, 1)) + { + if (REG_NOTE_KIND (note) == REG_INC + && REG_P (XEXP (note, 0))) + { + /* Reset the information about this register. */ + int regno = REGNO (XEXP (note, 0)); + if (regno < FIRST_PSEUDO_REGISTER) + { + move2add_record_mode (XEXP (note, 0)); + reg_mode[regno] = VOIDmode; + } + } + } + + /* There are no REG_INC notes for SP autoinc. */ + subrtx_var_iterator::array_type array; + FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (insn), NONCONST) + { + rtx mem = *iter; + if (mem + && MEM_P (mem) + && GET_RTX_CLASS (GET_CODE (XEXP (mem, 0))) == RTX_AUTOINC) + { + if (XEXP (XEXP (mem, 0), 0) == stack_pointer_rtx) + reg_mode[STACK_POINTER_REGNUM] = VOIDmode; + } + } + + note_stores (insn, move2add_note_store, insn); + + /* If INSN is a conditional branch, we try to extract an + implicit set out of it. */ + if (any_condjump_p (insn)) + { + rtx cnd = fis_get_condition (insn); + + if (cnd != NULL_RTX + && GET_CODE (cnd) == NE + && REG_P (XEXP (cnd, 0)) + && !reg_set_p (XEXP (cnd, 0), insn) + /* The following two checks, which are also in + move2add_note_store, are intended to reduce the + number of calls to gen_rtx_SET to avoid memory + allocation if possible. */ + && SCALAR_INT_MODE_P (GET_MODE (XEXP (cnd, 0))) + && REG_NREGS (XEXP (cnd, 0)) == 1 + && CONST_INT_P (XEXP (cnd, 1))) + { + rtx implicit_set = gen_rtx_SET (XEXP (cnd, 0), XEXP (cnd, 1)); + move2add_note_store (SET_DEST (implicit_set), implicit_set, insn); + } + } + + /* If this is a CALL_INSN, all call used registers are stored with + unknown values. */ + if (CALL_P (insn)) + { + function_abi callee_abi = insn_callee_abi (insn); + for (int i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--) + if (reg_mode[i] != VOIDmode + && reg_mode[i] != BLKmode + && callee_abi.clobbers_reg_p (reg_mode[i], i)) + /* Reset the information about this register. */ + reg_mode[i] = VOIDmode; + } +} + /* Convert move insns with constant inputs to additions if they are cheaper. Return true if any changes were made. */ static bool @@ -1921,7 +1994,7 @@ reload_cse_move2add (rtx_insn *first) move2add_luid = 2; for (insn = first; insn; insn = NEXT_INSN (insn), move2add_luid++) { - rtx set, note; + rtx set; if (LABEL_P (insn)) { @@ -2041,6 +2114,12 @@ reload_cse_move2add (rtx_insn *first) delete_insn (insn); changed |= success; insn = next; + /* Make sure to perform any invalidations related to + NEXT/INSN since we're going to bypass the normal + flow with the continue below. + + Do this before recording the new mode/offset. */ + reload_cse_move2add_invalidate (insn); move2add_record_mode (reg); reg_offset[regno] = trunc_int_for_mode (added_offset + base_offset, @@ -2094,74 +2173,7 @@ reload_cse_move2add (rtx_insn *first) continue; } } - - for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) - { - if (REG_NOTE_KIND (note) == REG_INC - && REG_P (XEXP (note, 0))) - { - /* Reset the information about this register. */ - int regno = REGNO (XEXP (note, 0)); - if (regno < FIRST_PSEUDO_REGISTER) - { - move2add_record_mode (XEXP (note, 0)); - reg_mode[regno] = VOIDmode; - } - } - } - - /* There are no REG_INC notes for SP autoinc. */ - subrtx_var_iterator::array_type array; - FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (insn), NONCONST) - { - rtx mem = *iter; - if (mem - && MEM_P (mem) - && GET_RTX_CLASS (GET_CODE (XEXP (mem, 0))) == RTX_AUTOINC) - { - if (XEXP (XEXP (mem, 0), 0) == stack_pointer_rtx) - reg_mode[STACK_POINTER_REGNUM] = VOIDmode; - } - } - - note_stores (insn, move2add_note_store, insn); - - /* If INSN is a conditional branch, we try to extract an - implicit set out of it. */ - if (any_condjump_p (insn)) - { - rtx cnd = fis_get_condition (insn); - - if (cnd != NULL_RTX - && GET_CODE (cnd) == NE - && REG_P (XEXP (cnd, 0)) - && !reg_set_p (XEXP (cnd, 0), insn) - /* The following two checks, which are also in - move2add_note_store, are intended to reduce the - number of calls to gen_rtx_SET to avoid memory - allocation if possible. */ - && SCALAR_INT_MODE_P (GET_MODE (XEXP (cnd, 0))) - && REG_NREGS (XEXP (cnd, 0)) == 1 - && CONST_INT_P (XEXP (cnd, 1))) - { - rtx implicit_set = - gen_rtx_SET (XEXP (cnd, 0), XEXP (cnd, 1)); - move2add_note_store (SET_DEST (implicit_set), implicit_set, insn); - } - } - - /* If this is a CALL_INSN, all call used registers are stored with - unknown values. */ - if (CALL_P (insn)) - { - function_abi callee_abi = insn_callee_abi (insn); - for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--) - if (reg_mode[i] != VOIDmode - && reg_mode[i] != BLKmode - && callee_abi.clobbers_reg_p (reg_mode[i], i)) - /* Reset the information about this register. */ - reg_mode[i] = VOIDmode; - } + reload_cse_move2add_invalidate (insn); } return changed; } diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 757484a..238a326 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -158,6 +158,16 @@ range_operator::fold_range (irange &r ATTRIBUTE_UNUSED, } bool +range_operator::fold_range (frange &r ATTRIBUTE_UNUSED, + tree type ATTRIBUTE_UNUSED, + const irange &lh ATTRIBUTE_UNUSED, + const irange &rh ATTRIBUTE_UNUSED, + relation_trio) const +{ + return false; +} + +bool range_operator::op1_range (frange &r ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED, const frange &lhs ATTRIBUTE_UNUSED, @@ -250,7 +260,7 @@ maybe_isnan (const frange &op1, const frange &op2) // Floating version of relop_early_resolve that takes into account NAN // and -ffinite-math-only. -inline bool +static inline bool frelop_early_resolve (irange &r, tree type, const frange &op1, const frange &op2, relation_trio rel, relation_kind my_rel) @@ -267,7 +277,7 @@ frelop_early_resolve (irange &r, tree type, // Set VALUE to its next real value, or INF if the operation overflows. -inline void +void frange_nextafter (enum machine_mode mode, REAL_VALUE_TYPE &value, const REAL_VALUE_TYPE &inf) @@ -2244,7 +2254,7 @@ operator_plus::op1_range (frange &r, tree type, const frange &lhs, { if (lhs.undefined_p ()) return false; - range_op_handler minus (MINUS_EXPR, type); + range_op_handler minus (MINUS_EXPR); if (!minus) return false; frange wlhs = float_widen_lhs_range (type, lhs); @@ -2361,7 +2371,7 @@ operator_mult::op1_range (frange &r, tree type, { if (lhs.undefined_p ()) return false; - range_op_handler rdiv (RDIV_EXPR, type); + range_op_handler rdiv (RDIV_EXPR); if (!rdiv) return false; frange wlhs = float_widen_lhs_range (type, lhs); @@ -2687,7 +2697,7 @@ namespace selftest // Build an frange from string endpoints. -inline frange +static inline frange frange_float (const char *lb, const char *ub, tree type = float_type_node) { REAL_VALUE_TYPE min, max; @@ -2716,7 +2726,7 @@ range_op_float_tests () ASSERT_EQ (r, r1); // [-INF,+INF] + [-INF,+INF] could be a NAN. - range_op_handler plus (PLUS_EXPR, float_type_node); + range_op_handler plus (PLUS_EXPR); r0.set_varying (float_type_node); r1.set_varying (float_type_node); r0.clear_nan (); diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h index 52b8570..6944742 100644 --- a/gcc/range-op-mixed.h +++ b/gcc/range-op-mixed.h @@ -22,6 +22,31 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_RANGE_OP_MIXED_H #define GCC_RANGE_OP_MIXED_H +void update_known_bitmask (irange &, tree_code, const irange &, const irange &); +bool minus_op1_op2_relation_effect (irange &lhs_range, tree type, + const irange &, const irange &, + relation_kind rel); + + +// Return TRUE if 0 is within [WMIN, WMAX]. + +inline bool +wi_includes_zero_p (tree type, const wide_int &wmin, const wide_int &wmax) +{ + signop sign = TYPE_SIGN (type); + return wi::le_p (wmin, 0, sign) && wi::ge_p (wmax, 0, sign); +} + +// Return TRUE if [WMIN, WMAX] is the singleton 0. + +inline bool +wi_zero_p (tree type, const wide_int &wmin, const wide_int &wmax) +{ + unsigned prec = TYPE_PRECISION (type); + return wmin == wmax && wi::eq_p (wmin, wi::zero (prec)); +} + + enum bool_range_state { BRS_FALSE, BRS_TRUE, BRS_EMPTY, BRS_FULL }; bool_range_state get_bool_state (vrange &r, const vrange &lhs, tree val_type); @@ -214,26 +239,27 @@ public: using range_operator::op1_op2_relation; bool fold_range (irange &r, tree type, const irange &op1, const irange &op2, - relation_trio = TRIO_VARYING) const; + relation_trio = TRIO_VARYING) const final override; bool fold_range (irange &r, tree type, const frange &op1, const frange &op2, relation_trio = TRIO_VARYING) const final override; bool op1_range (irange &r, tree type, const irange &lhs, const irange &op2, - relation_trio = TRIO_VARYING) const; + relation_trio = TRIO_VARYING) const final override; bool op1_range (frange &r, tree type, const irange &lhs, const frange &op2, relation_trio = TRIO_VARYING) const final override; bool op2_range (irange &r, tree type, const irange &lhs, const irange &op1, - relation_trio = TRIO_VARYING) const; + relation_trio = TRIO_VARYING) const final override; bool op2_range (frange &r, tree type, const irange &lhs, const frange &op1, relation_trio = TRIO_VARYING) const final override; relation_kind op1_op2_relation (const irange &lhs) const final override; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const; + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override; }; class operator_ge : public range_operator @@ -501,4 +527,120 @@ public: relation_kind kind) const final override; }; +class operator_addr_expr : public range_operator +{ +public: + using range_operator::fold_range; + using range_operator::op1_range; + bool fold_range (irange &r, tree type, + const irange &op1, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; +}; + +class operator_bitwise_not : public range_operator +{ +public: + using range_operator::fold_range; + using range_operator::op1_range; + bool fold_range (irange &r, tree type, + const irange &lh, const irange &rh, + relation_trio rel = TRIO_VARYING) const final override; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; +}; + +class operator_bitwise_xor : public range_operator +{ +public: + using range_operator::op1_range; + using range_operator::op2_range; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override; + bool op2_range (irange &r, tree type, + const irange &lhs, const irange &op1, + relation_trio rel = TRIO_VARYING) const final override; + bool op1_op2_relation_effect (irange &lhs_range, + tree type, + const irange &op1_range, + const irange &op2_range, + relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override; +private: + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const final override; +}; + +class operator_bitwise_and : public range_operator +{ +public: + using range_operator::op1_range; + using range_operator::op2_range; + using range_operator::lhs_op1_relation; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const override; + bool op2_range (irange &r, tree type, + const irange &lhs, const irange &op1, + relation_trio rel = TRIO_VARYING) const override; + relation_kind lhs_op1_relation (const irange &lhs, + const irange &op1, const irange &op2, + relation_kind) const override; + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const override; +protected: + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const override; + void simple_op1_range_solver (irange &r, tree type, + const irange &lhs, + const irange &op2) const; +}; + +class operator_bitwise_or : public range_operator +{ +public: + using range_operator::op1_range; + using range_operator::op2_range; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const override; + bool op2_range (irange &r, tree type, + const irange &lhs, const irange &op1, + relation_trio rel = TRIO_VARYING) const override; + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const override; +protected: + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const override; +}; + +class operator_min : public range_operator +{ +public: + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const override; +protected: + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const override; +}; + +class operator_max : public range_operator +{ +public: + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const override; +protected: + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const override; +}; #endif // GCC_RANGE_OP_MIXED_H diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc new file mode 100644 index 0000000..ea66fe9 --- /dev/null +++ b/gcc/range-op-ptr.cc @@ -0,0 +1,430 @@ +/* Code for range operators. + Copyright (C) 2017-2023 Free Software Foundation, Inc. + Contributed by Andrew MacLeod <amacleod@redhat.com> + and Aldy Hernandez <aldyh@redhat.com>. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "backend.h" +#include "insn-codes.h" +#include "rtl.h" +#include "tree.h" +#include "gimple.h" +#include "cfghooks.h" +#include "tree-pass.h" +#include "ssa.h" +#include "optabs-tree.h" +#include "gimple-pretty-print.h" +#include "diagnostic-core.h" +#include "flags.h" +#include "fold-const.h" +#include "stor-layout.h" +#include "calls.h" +#include "cfganal.h" +#include "gimple-iterator.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-walk.h" +#include "tree-cfg.h" +#include "wide-int.h" +#include "value-relation.h" +#include "range-op.h" +#include "tree-ssa-ccp.h" +#include "range-op-mixed.h" + +class pointer_plus_operator : public range_operator +{ + using range_operator::op2_range; +public: + virtual void wi_fold (irange &r, tree type, + const wide_int &lh_lb, + const wide_int &lh_ub, + const wide_int &rh_lb, + const wide_int &rh_ub) const; + virtual bool op2_range (irange &r, tree type, + const irange &lhs, + const irange &op1, + relation_trio = TRIO_VARYING) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, POINTER_PLUS_EXPR, lh, rh); } +} op_pointer_plus; + +void +pointer_plus_operator::wi_fold (irange &r, tree type, + const wide_int &lh_lb, + const wide_int &lh_ub, + const wide_int &rh_lb, + const wide_int &rh_ub) const +{ + // Check for [0,0] + const, and simply return the const. + if (lh_lb == 0 && lh_ub == 0 && rh_lb == rh_ub) + { + r.set (type, rh_lb, rh_lb); + return; + } + + // For pointer types, we are really only interested in asserting + // whether the expression evaluates to non-NULL. + // + // With -fno-delete-null-pointer-checks we need to be more + // conservative. As some object might reside at address 0, + // then some offset could be added to it and the same offset + // subtracted again and the result would be NULL. + // E.g. + // static int a[12]; where &a[0] is NULL and + // ptr = &a[6]; + // ptr -= 6; + // ptr will be NULL here, even when there is POINTER_PLUS_EXPR + // where the first range doesn't include zero and the second one + // doesn't either. As the second operand is sizetype (unsigned), + // consider all ranges where the MSB could be set as possible + // subtractions where the result might be NULL. + if ((!wi_includes_zero_p (type, lh_lb, lh_ub) + || !wi_includes_zero_p (type, rh_lb, rh_ub)) + && !TYPE_OVERFLOW_WRAPS (type) + && (flag_delete_null_pointer_checks + || !wi::sign_mask (rh_ub))) + r = range_nonzero (type); + else if (lh_lb == lh_ub && lh_lb == 0 + && rh_lb == rh_ub && rh_lb == 0) + r = range_zero (type); + else + r.set_varying (type); +} + +bool +pointer_plus_operator::op2_range (irange &r, tree type, + const irange &lhs ATTRIBUTE_UNUSED, + const irange &op1 ATTRIBUTE_UNUSED, + relation_trio trio) const +{ + relation_kind rel = trio.lhs_op1 (); + r.set_varying (type); + + // If the LHS and OP1 are equal, the op2 must be zero. + if (rel == VREL_EQ) + r.set_zero (type); + // If the LHS and OP1 are not equal, the offset must be non-zero. + else if (rel == VREL_NE) + r.set_nonzero (type); + else + return false; + return true; +} + +class pointer_min_max_operator : public range_operator +{ +public: + virtual void wi_fold (irange & r, tree type, + const wide_int &lh_lb, const wide_int &lh_ub, + const wide_int &rh_lb, const wide_int &rh_ub) const; +} op_ptr_min_max; + +void +pointer_min_max_operator::wi_fold (irange &r, tree type, + const wide_int &lh_lb, + const wide_int &lh_ub, + const wide_int &rh_lb, + const wide_int &rh_ub) const +{ + // For MIN/MAX expressions with pointers, we only care about + // nullness. If both are non null, then the result is nonnull. + // If both are null, then the result is null. Otherwise they + // are varying. + if (!wi_includes_zero_p (type, lh_lb, lh_ub) + && !wi_includes_zero_p (type, rh_lb, rh_ub)) + r = range_nonzero (type); + else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub)) + r = range_zero (type); + else + r.set_varying (type); +} + +class pointer_and_operator : public range_operator +{ +public: + virtual void wi_fold (irange &r, tree type, + const wide_int &lh_lb, const wide_int &lh_ub, + const wide_int &rh_lb, const wide_int &rh_ub) const; +} op_pointer_and; + +void +pointer_and_operator::wi_fold (irange &r, tree type, + const wide_int &lh_lb, + const wide_int &lh_ub, + const wide_int &rh_lb ATTRIBUTE_UNUSED, + const wide_int &rh_ub ATTRIBUTE_UNUSED) const +{ + // For pointer types, we are really only interested in asserting + // whether the expression evaluates to non-NULL. + if (wi_zero_p (type, lh_lb, lh_ub) || wi_zero_p (type, lh_lb, lh_ub)) + r = range_zero (type); + else + r.set_varying (type); +} + + +class pointer_or_operator : public range_operator +{ +public: + using range_operator::op1_range; + using range_operator::op2_range; + virtual bool op1_range (irange &r, tree type, + const irange &lhs, + const irange &op2, + relation_trio rel = TRIO_VARYING) const; + virtual bool op2_range (irange &r, tree type, + const irange &lhs, + const irange &op1, + relation_trio rel = TRIO_VARYING) const; + virtual void wi_fold (irange &r, tree type, + const wide_int &lh_lb, const wide_int &lh_ub, + const wide_int &rh_lb, const wide_int &rh_ub) const; +} op_pointer_or; + +bool +pointer_or_operator::op1_range (irange &r, tree type, + const irange &lhs, + const irange &op2 ATTRIBUTE_UNUSED, + relation_trio) const +{ + if (lhs.undefined_p ()) + return false; + if (lhs.zero_p ()) + { + r.set_zero (type); + return true; + } + r.set_varying (type); + return true; +} + +bool +pointer_or_operator::op2_range (irange &r, tree type, + const irange &lhs, + const irange &op1, + relation_trio) const +{ + return pointer_or_operator::op1_range (r, type, lhs, op1); +} + +void +pointer_or_operator::wi_fold (irange &r, tree type, + const wide_int &lh_lb, + const wide_int &lh_ub, + const wide_int &rh_lb, + const wide_int &rh_ub) const +{ + // For pointer types, we are really only interested in asserting + // whether the expression evaluates to non-NULL. + if (!wi_includes_zero_p (type, lh_lb, lh_ub) + && !wi_includes_zero_p (type, rh_lb, rh_ub)) + r = range_nonzero (type); + else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub)) + r = range_zero (type); + else + r.set_varying (type); +} + +class operator_pointer_diff : public range_operator +{ + virtual bool op1_op2_relation_effect (irange &lhs_range, + tree type, + const irange &op1_range, + const irange &op2_range, + relation_kind rel) const; + void update_bitmask (irange &r, const irange &lh, const irange &rh) const + { update_known_bitmask (r, POINTER_DIFF_EXPR, lh, rh); } +} op_pointer_diff; + +bool +operator_pointer_diff::op1_op2_relation_effect (irange &lhs_range, tree type, + const irange &op1_range, + const irange &op2_range, + relation_kind rel) const +{ + return minus_op1_op2_relation_effect (lhs_range, type, op1_range, op2_range, + rel); +} + +// ---------------------------------------------------------------------- +// Hybrid operators for the 4 operations which integer and pointers share, +// but which have different implementations. Simply check the type in +// the call and choose the appropriate method. +// Once there is a PRANGE signature, simply add the appropriate +// prototypes in the rmixed range class, and remove these hybrid classes. + +class hybrid_and_operator : public operator_bitwise_and +{ +public: + using range_operator::op1_range; + using range_operator::op2_range; + using range_operator::lhs_op1_relation; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_bitwise_and::op1_range (r, type, lhs, op2, rel); + else + return false; + } + bool op2_range (irange &r, tree type, + const irange &lhs, const irange &op1, + relation_trio rel = TRIO_VARYING) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_bitwise_and::op2_range (r, type, lhs, op1, rel); + else + return false; + } + relation_kind lhs_op1_relation (const irange &lhs, + const irange &op1, const irange &op2, + relation_kind rel) const final override + { + if (!lhs.undefined_p () && INTEGRAL_TYPE_P (lhs.type ())) + return operator_bitwise_and::lhs_op1_relation (lhs, op1, op2, rel); + else + return VREL_VARYING; + } + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override + { + if (!r.undefined_p () && INTEGRAL_TYPE_P (r.type ())) + operator_bitwise_and::update_bitmask (r, lh, rh); + } + + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_bitwise_and::wi_fold (r, type, lh_lb, lh_ub, + rh_lb, rh_ub); + else + return op_pointer_and.wi_fold (r, type, lh_lb, lh_ub, rh_lb, rh_ub); + } +} op_hybrid_and; + +// Temporary class which dispatches routines to either the INT version or +// the pointer version depending on the type. Once PRANGE is a range +// class, we can remove the hybrid. + +class hybrid_or_operator : public operator_bitwise_or +{ +public: + using range_operator::op1_range; + using range_operator::op2_range; + using range_operator::lhs_op1_relation; + bool op1_range (irange &r, tree type, + const irange &lhs, const irange &op2, + relation_trio rel = TRIO_VARYING) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_bitwise_or::op1_range (r, type, lhs, op2, rel); + else + return op_pointer_or.op1_range (r, type, lhs, op2, rel); + } + bool op2_range (irange &r, tree type, + const irange &lhs, const irange &op1, + relation_trio rel = TRIO_VARYING) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_bitwise_or::op2_range (r, type, lhs, op1, rel); + else + return op_pointer_or.op2_range (r, type, lhs, op1, rel); + } + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override + { + if (!r.undefined_p () && INTEGRAL_TYPE_P (r.type ())) + operator_bitwise_or::update_bitmask (r, lh, rh); + } + + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_bitwise_or::wi_fold (r, type, lh_lb, lh_ub, + rh_lb, rh_ub); + else + return op_pointer_or.wi_fold (r, type, lh_lb, lh_ub, rh_lb, rh_ub); + } +} op_hybrid_or; + +// Temporary class which dispatches routines to either the INT version or +// the pointer version depending on the type. Once PRANGE is a range +// class, we can remove the hybrid. + +class hybrid_min_operator : public operator_min +{ +public: + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override + { + if (!r.undefined_p () && INTEGRAL_TYPE_P (r.type ())) + operator_min::update_bitmask (r, lh, rh); + } + + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_min::wi_fold (r, type, lh_lb, lh_ub, rh_lb, rh_ub); + else + return op_ptr_min_max.wi_fold (r, type, lh_lb, lh_ub, rh_lb, rh_ub); + } +} op_hybrid_min; + +class hybrid_max_operator : public operator_max +{ +public: + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override + { + if (!r.undefined_p () && INTEGRAL_TYPE_P (r.type ())) + operator_max::update_bitmask (r, lh, rh); + } + + void wi_fold (irange &r, tree type, const wide_int &lh_lb, + const wide_int &lh_ub, const wide_int &rh_lb, + const wide_int &rh_ub) const final override + { + if (INTEGRAL_TYPE_P (type)) + return operator_max::wi_fold (r, type, lh_lb, lh_ub, rh_lb, rh_ub); + else + return op_ptr_min_max.wi_fold (r, type, lh_lb, lh_ub, rh_lb, rh_ub); + } +} op_hybrid_max; + +// Initialize any pointer operators to the primary table + +void +range_op_table::initialize_pointer_ops () +{ + set (POINTER_PLUS_EXPR, op_pointer_plus); + set (POINTER_DIFF_EXPR, op_pointer_diff); + set (BIT_AND_EXPR, op_hybrid_and); + set (BIT_IOR_EXPR, op_hybrid_or); + set (MIN_EXPR, op_hybrid_min); + set (MAX_EXPR, op_hybrid_max); +} diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 028631c..f0dff53 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -49,16 +49,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-ccp.h" #include "range-op-mixed.h" -integral_table integral_tree_table; -pointer_table pointer_tree_table; - -// Instantiate a range_op_table for unified operations. -class unified_table : public range_op_table -{ - public: - unified_table (); -} unified_tree_table; - // Instantiate the operators which apply to multiple types here. operator_equal op_equal; @@ -75,10 +65,20 @@ operator_abs op_abs; operator_minus op_minus; operator_negate op_negate; operator_mult op_mult; +operator_addr_expr op_addr; +operator_bitwise_not op_bitwise_not; +operator_bitwise_xor op_bitwise_xor; +operator_bitwise_and op_bitwise_and; +operator_bitwise_or op_bitwise_or; +operator_min op_min; +operator_max op_max; + +// Instantaite a range operator table. +range_op_table operator_table; // Invoke the initialization routines for each class of range. -unified_table::unified_table () +range_op_table::range_op_table () { initialize_integral_ops (); initialize_pointer_ops (); @@ -102,49 +102,63 @@ unified_table::unified_table () set (MINUS_EXPR, op_minus); set (NEGATE_EXPR, op_negate); set (MULT_EXPR, op_mult); -} -// The tables are hidden and accessed via a simple extern function. + // Occur in both integer and pointer tables, but currently share + // integral implementation. + set (ADDR_EXPR, op_addr); + set (BIT_NOT_EXPR, op_bitwise_not); + set (BIT_XOR_EXPR, op_bitwise_xor); -range_operator * -get_op_handler (enum tree_code code, tree type) -{ - if (unified_tree_table[code]) - { - // Should not be in any other table if it is in the unified table. - gcc_checking_assert (!pointer_tree_table[code]); - gcc_checking_assert (!integral_tree_table[code]); - return unified_tree_table[code]; - } + // These are in both integer and pointer tables, but pointer has a different + // implementation. + // If commented out, there is a hybrid version in range-op-ptr.cc which + // is used until there is a pointer range class. Then we can simply + // uncomment the operator here and use the unified version. - if (POINTER_TYPE_P (type)) - return pointer_tree_table[code]; - if (INTEGRAL_TYPE_P (type)) - return integral_tree_table[code]; - return NULL; + // set (BIT_AND_EXPR, op_bitwise_and); + // set (BIT_IOR_EXPR, op_bitwise_or); + // set (MIN_EXPR, op_min); + // set (MAX_EXPR, op_max); } +// Instantiate a default range operator for opcodes with no entry. + +range_operator default_operator; + +// Create a default range_op_handler. + range_op_handler::range_op_handler () { - m_operator = NULL; + m_operator = &default_operator; } -void -range_op_handler::set_op_handler (tree_code code, tree type) +// Create a range_op_handler for CODE. Use a default operatoer if CODE +// does not have an entry. + +range_op_handler::range_op_handler (unsigned code) { - m_operator = get_op_handler (code, type); + m_operator = operator_table[code]; + if (!m_operator) + m_operator = &default_operator; } -range_op_handler::range_op_handler (tree_code code, tree type) +// Return TRUE if this handler has a non-default operator. + +range_op_handler::operator bool () const { - set_op_handler (code, type); + return m_operator != &default_operator; } -// Constructing without a type must come from the unified table. +// Return a pointer to the range operator assocaited with this handler. +// If it is a default operator, return NULL. +// This is the equivalent of indexing the range table. -range_op_handler::range_op_handler (tree_code code) +range_operator * +range_op_handler::range_op () const { - m_operator = unified_tree_table[code]; + if (m_operator != &default_operator) + return m_operator; + return NULL; } // Create a dispatch pattern for value range discriminators LHS, OP1, and OP2. @@ -205,6 +219,10 @@ range_op_handler::fold_range (vrange &r, tree type, return m_operator->fold_range (as_a <frange> (r), type, as_a <frange> (lh), as_a <frange> (rh), rel); + case RO_FII: + return m_operator->fold_range (as_a <frange> (r), type, + as_a <irange> (lh), + as_a <irange> (rh), rel); default: return false; } @@ -369,7 +387,7 @@ irange_to_masked_value (const irange &r, widest_int &value, widest_int &mask) // Update the known bitmasks in R when applying the operation CODE to // LH and RH. -static void +void update_known_bitmask (irange &r, tree_code code, const irange &lh, const irange &rh) { @@ -432,24 +450,6 @@ get_shift_range (irange &r, tree type, const irange &op) return true; } -// Return TRUE if 0 is within [WMIN, WMAX]. - -static inline bool -wi_includes_zero_p (tree type, const wide_int &wmin, const wide_int &wmax) -{ - signop sign = TYPE_SIGN (type); - return wi::le_p (wmin, 0, sign) && wi::ge_p (wmax, 0, sign); -} - -// Return TRUE if [WMIN, WMAX] is the singleton 0. - -static inline bool -wi_zero_p (tree type, const wide_int &wmin, const wide_int &wmax) -{ - unsigned prec = TYPE_PRECISION (type); - return wmin == wmax && wi::eq_p (wmin, wi::zero (prec)); -} - // Default wide_int fold operation returns [MIN, MAX]. void @@ -1701,7 +1701,7 @@ operator_plus::op1_range (irange &r, tree type, if (lhs.undefined_p ()) return false; // Start with the default operation. - range_op_handler minus (MINUS_EXPR, type); + range_op_handler minus (MINUS_EXPR); if (!minus) return false; bool res = minus.fold_range (r, type, lhs, op2); @@ -1730,7 +1730,6 @@ public: const wide_int &rh_lb, const wide_int &rh_ub) const; } op_widen_plus_signed; -range_operator *ptr_op_widen_plus_signed = &op_widen_plus_signed; void operator_widen_plus_signed::wi_fold (irange &r, tree type, @@ -1764,7 +1763,6 @@ public: const wide_int &rh_lb, const wide_int &rh_ub) const; } op_widen_plus_unsigned; -range_operator *ptr_op_widen_plus_unsigned = &op_widen_plus_unsigned; void operator_widen_plus_unsigned::wi_fold (irange &r, tree type, @@ -1832,7 +1830,7 @@ operator_minus::lhs_op1_relation (const irange &, const irange &op1, // LHS of the expression. If so, apply it to LHS_RANGE. This is a helper // function for both MINUS_EXPR and POINTER_DIFF_EXPR. -static bool +bool minus_op1_op2_relation_effect (irange &lhs_range, tree type, const irange &op1_range ATTRIBUTE_UNUSED, const irange &op2_range ATTRIBUTE_UNUSED, @@ -1917,7 +1915,7 @@ operator_minus::op1_range (irange &r, tree type, if (lhs.undefined_p ()) return false; // Start with the default operation. - range_op_handler minus (PLUS_EXPR, type); + range_op_handler minus (PLUS_EXPR); if (!minus) return false; bool res = minus.fold_range (r, type, lhs, op2); @@ -1939,41 +1937,13 @@ operator_minus::op2_range (irange &r, tree type, return fold_range (r, type, op1, lhs); } - -class operator_pointer_diff : public range_operator -{ - virtual bool op1_op2_relation_effect (irange &lhs_range, - tree type, - const irange &op1_range, - const irange &op2_range, - relation_kind rel) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, POINTER_DIFF_EXPR, lh, rh); } -} op_pointer_diff; - -bool -operator_pointer_diff::op1_op2_relation_effect (irange &lhs_range, tree type, - const irange &op1_range, - const irange &op2_range, - relation_kind rel) const +void +operator_min::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { - return minus_op1_op2_relation_effect (lhs_range, type, op1_range, op2_range, - rel); + update_known_bitmask (r, MIN_EXPR, lh, rh); } - -class operator_min : public range_operator -{ -public: - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, MIN_EXPR, lh, rh); } -} op_min; - void operator_min::wi_fold (irange &r, tree type, const wide_int &lh_lb, const wide_int &lh_ub, @@ -1986,17 +1956,12 @@ operator_min::wi_fold (irange &r, tree type, } -class operator_max : public range_operator +void +operator_max::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { -public: - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, MAX_EXPR, lh, rh); } -} op_max; + update_known_bitmask (r, MAX_EXPR, lh, rh); +} void operator_max::wi_fold (irange &r, tree type, @@ -2088,8 +2053,7 @@ operator_mult::op1_range (irange &r, tree type, wide_int offset; if (op2.singleton_p (offset) && offset != 0) - return range_op_handler (TRUNC_DIV_EXPR, type).fold_range (r, type, - lhs, op2); + return range_op_handler (TRUNC_DIV_EXPR).fold_range (r, type, lhs, op2); return false; } @@ -2222,7 +2186,6 @@ public: const wide_int &rh_ub) const; } op_widen_mult_signed; -range_operator *ptr_op_widen_mult_signed = &op_widen_mult_signed; void operator_widen_mult_signed::wi_fold (irange &r, tree type, @@ -2255,7 +2218,6 @@ public: const wide_int &rh_ub) const; } op_widen_mult_unsigned; -range_operator *ptr_op_widen_mult_unsigned = &op_widen_mult_unsigned; void operator_widen_mult_unsigned::wi_fold (irange &r, tree type, @@ -2417,7 +2379,7 @@ operator_exact_divide::op1_range (irange &r, tree type, // the time however. // If op2 is a multiple of 2, we would be able to set some non-zero bits. if (op2.singleton_p (offset) && offset != 0) - return range_op_handler (MULT_EXPR, type).fold_range (r, type, lhs, op2); + return range_op_handler (MULT_EXPR).fold_range (r, type, lhs, op2); return false; } @@ -2443,7 +2405,8 @@ public: tree type, const wide_int &, const wide_int &) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override { update_known_bitmask (r, LSHIFT_EXPR, lh, rh); } } op_lshift; @@ -2474,7 +2437,8 @@ public: const irange &op1, const irange &op2, relation_kind rel) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const + void update_bitmask (irange &r, const irange &lh, + const irange &rh) const final override { update_known_bitmask (r, RSHIFT_EXPR, lh, rh); } } op_rshift; @@ -2988,9 +2952,8 @@ operator_cast::op1_range (irange &r, tree type, // Add this to the unsigned LHS range(s). int_range_max lim_range (type, lim, lim); int_range_max lhs_neg; - range_op_handler (PLUS_EXPR, type).fold_range (lhs_neg, type, - converted_lhs, - lim_range); + range_op_handler (PLUS_EXPR).fold_range (lhs_neg, type, + converted_lhs, lim_range); // lhs_neg now has all the negative versions of the LHS. // Now union in all the values from SIGNED MIN (0x80000) to // lim-1 in order to fill in all the ranges with the upper @@ -3112,37 +3075,12 @@ operator_logical_and::op2_range (irange &r, tree type, } -class operator_bitwise_and : public range_operator +void +operator_bitwise_and::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { - using range_operator::op1_range; - using range_operator::op2_range; - using range_operator::lhs_op1_relation; -public: - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; - virtual bool op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio rel = TRIO_VARYING) const; - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - virtual relation_kind lhs_op1_relation (const irange &lhs, - const irange &op1, - const irange &op2, - relation_kind) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, BIT_AND_EXPR, lh, rh); } -private: - void simple_op1_range_solver (irange &r, tree type, - const irange &lhs, - const irange &op2) const; -} op_bitwise_and; - + update_known_bitmask (r, BIT_AND_EXPR, lh, rh); +} // Optimize BIT_AND_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR of signed types // by considering the number of leading redundant sign bit copies. @@ -3617,27 +3555,12 @@ operator_logical_or::op2_range (irange &r, tree type, } -class operator_bitwise_or : public range_operator +void +operator_bitwise_or::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { - using range_operator::op1_range; - using range_operator::op2_range; -public: - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; - virtual bool op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio rel = TRIO_VARYING) const; - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, BIT_IOR_EXPR, lh, rh); } -} op_bitwise_or; + update_known_bitmask (r, BIT_IOR_EXPR, lh, rh); +} void operator_bitwise_or::wi_fold (irange &r, tree type, @@ -3725,33 +3648,12 @@ operator_bitwise_or::op2_range (irange &r, tree type, return operator_bitwise_or::op1_range (r, type, lhs, op1); } - -class operator_bitwise_xor : public range_operator +void +operator_bitwise_xor::update_bitmask (irange &r, const irange &lh, + const irange &rh) const { - using range_operator::op1_range; - using range_operator::op2_range; -public: - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; - virtual bool op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio rel = TRIO_VARYING) const; - virtual bool op1_op2_relation_effect (irange &lhs_range, - tree type, - const irange &op1_range, - const irange &op2_range, - relation_kind rel) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, BIT_XOR_EXPR, lh, rh); } -} op_bitwise_xor; + update_known_bitmask (r, BIT_XOR_EXPR, lh, rh); +} void operator_bitwise_xor::wi_fold (irange &r, tree type, @@ -4075,21 +3977,6 @@ operator_logical_not::op1_range (irange &r, } -class operator_bitwise_not : public range_operator -{ - using range_operator::fold_range; - using range_operator::op1_range; -public: - virtual bool fold_range (irange &r, tree type, - const irange &lh, - const irange &rh, - relation_trio rel = TRIO_VARYING) const; - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; -} op_bitwise_not; - bool operator_bitwise_not::fold_range (irange &r, tree type, const irange &lh, @@ -4105,7 +3992,7 @@ operator_bitwise_not::fold_range (irange &r, tree type, // ~X is simply -1 - X. int_range<1> minusone (type, wi::minus_one (TYPE_PRECISION (type)), wi::minus_one (TYPE_PRECISION (type))); - return range_op_handler (MINUS_EXPR, type).fold_range (r, type, minusone, lh); + return range_op_handler (MINUS_EXPR).fold_range (r, type, minusone, lh); } bool @@ -4351,8 +4238,8 @@ operator_negate::fold_range (irange &r, tree type, if (empty_range_varying (r, type, lh, rh)) return true; // -X is simply 0 - X. - return range_op_handler (MINUS_EXPR, type).fold_range (r, type, - range_zero (type), lh); + return range_op_handler (MINUS_EXPR).fold_range (r, type, + range_zero (type), lh); } bool @@ -4366,21 +4253,6 @@ operator_negate::op1_range (irange &r, tree type, } -class operator_addr_expr : public range_operator -{ - using range_operator::fold_range; - using range_operator::op1_range; -public: - virtual bool fold_range (irange &r, tree type, - const irange &op1, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; -} op_addr; - bool operator_addr_expr::fold_range (irange &r, tree type, const irange &lh, @@ -4408,214 +4280,7 @@ operator_addr_expr::op1_range (irange &r, tree type, { return operator_addr_expr::fold_range (r, type, lhs, op2); } - - -class pointer_plus_operator : public range_operator -{ - using range_operator::op2_range; -public: - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const; - virtual bool op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio = TRIO_VARYING) const; - void update_bitmask (irange &r, const irange &lh, const irange &rh) const - { update_known_bitmask (r, POINTER_PLUS_EXPR, lh, rh); } -} op_pointer_plus; - -void -pointer_plus_operator::wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const -{ - // Check for [0,0] + const, and simply return the const. - if (lh_lb == 0 && lh_ub == 0 && rh_lb == rh_ub) - { - r.set (type, rh_lb, rh_lb); - return; - } - - // For pointer types, we are really only interested in asserting - // whether the expression evaluates to non-NULL. - // - // With -fno-delete-null-pointer-checks we need to be more - // conservative. As some object might reside at address 0, - // then some offset could be added to it and the same offset - // subtracted again and the result would be NULL. - // E.g. - // static int a[12]; where &a[0] is NULL and - // ptr = &a[6]; - // ptr -= 6; - // ptr will be NULL here, even when there is POINTER_PLUS_EXPR - // where the first range doesn't include zero and the second one - // doesn't either. As the second operand is sizetype (unsigned), - // consider all ranges where the MSB could be set as possible - // subtractions where the result might be NULL. - if ((!wi_includes_zero_p (type, lh_lb, lh_ub) - || !wi_includes_zero_p (type, rh_lb, rh_ub)) - && !TYPE_OVERFLOW_WRAPS (type) - && (flag_delete_null_pointer_checks - || !wi::sign_mask (rh_ub))) - r = range_nonzero (type); - else if (lh_lb == lh_ub && lh_lb == 0 - && rh_lb == rh_ub && rh_lb == 0) - r = range_zero (type); - else - r.set_varying (type); -} - -bool -pointer_plus_operator::op2_range (irange &r, tree type, - const irange &lhs ATTRIBUTE_UNUSED, - const irange &op1 ATTRIBUTE_UNUSED, - relation_trio trio) const -{ - relation_kind rel = trio.lhs_op1 (); - r.set_varying (type); - - // If the LHS and OP1 are equal, the op2 must be zero. - if (rel == VREL_EQ) - r.set_zero (type); - // If the LHS and OP1 are not equal, the offset must be non-zero. - else if (rel == VREL_NE) - r.set_nonzero (type); - else - return false; - return true; -} - -class pointer_min_max_operator : public range_operator -{ -public: - virtual void wi_fold (irange & r, tree type, - const wide_int &lh_lb, const wide_int &lh_ub, - const wide_int &rh_lb, const wide_int &rh_ub) const; -} op_ptr_min_max; - -void -pointer_min_max_operator::wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const -{ - // For MIN/MAX expressions with pointers, we only care about - // nullness. If both are non null, then the result is nonnull. - // If both are null, then the result is null. Otherwise they - // are varying. - if (!wi_includes_zero_p (type, lh_lb, lh_ub) - && !wi_includes_zero_p (type, rh_lb, rh_ub)) - r = range_nonzero (type); - else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub)) - r = range_zero (type); - else - r.set_varying (type); -} - - -class pointer_and_operator : public range_operator -{ -public: - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, const wide_int &lh_ub, - const wide_int &rh_lb, const wide_int &rh_ub) const; -} op_pointer_and; - -void -pointer_and_operator::wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb ATTRIBUTE_UNUSED, - const wide_int &rh_ub ATTRIBUTE_UNUSED) const -{ - // For pointer types, we are really only interested in asserting - // whether the expression evaluates to non-NULL. - if (wi_zero_p (type, lh_lb, lh_ub) || wi_zero_p (type, lh_lb, lh_ub)) - r = range_zero (type); - else - r.set_varying (type); -} - - -class pointer_or_operator : public range_operator -{ - using range_operator::op1_range; - using range_operator::op2_range; -public: - virtual bool op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2, - relation_trio rel = TRIO_VARYING) const; - virtual bool op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio rel = TRIO_VARYING) const; - virtual void wi_fold (irange &r, tree type, - const wide_int &lh_lb, const wide_int &lh_ub, - const wide_int &rh_lb, const wide_int &rh_ub) const; -} op_pointer_or; - -bool -pointer_or_operator::op1_range (irange &r, tree type, - const irange &lhs, - const irange &op2 ATTRIBUTE_UNUSED, - relation_trio) const -{ - if (lhs.undefined_p ()) - return false; - if (lhs.zero_p ()) - { - r.set_zero (type); - return true; - } - r.set_varying (type); - return true; -} - -bool -pointer_or_operator::op2_range (irange &r, tree type, - const irange &lhs, - const irange &op1, - relation_trio) const -{ - return pointer_or_operator::op1_range (r, type, lhs, op1); -} - -void -pointer_or_operator::wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const -{ - // For pointer types, we are really only interested in asserting - // whether the expression evaluates to non-NULL. - if (!wi_includes_zero_p (type, lh_lb, lh_ub) - && !wi_includes_zero_p (type, rh_lb, rh_ub)) - r = range_nonzero (type); - else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub)) - r = range_zero (type); - else - r.set_varying (type); -} -integral_table::integral_table () -{ - set (MIN_EXPR, op_min); - set (MAX_EXPR, op_max); - set (BIT_AND_EXPR, op_bitwise_and); - set (BIT_IOR_EXPR, op_bitwise_or); - set (BIT_XOR_EXPR, op_bitwise_xor); - set (BIT_NOT_EXPR, op_bitwise_not); - set (ADDR_EXPR, op_addr); -} - // Initialize any integral operators to the primary table void @@ -4635,28 +4300,11 @@ range_op_table::initialize_integral_ops () set (IMAGPART_EXPR, op_unknown); set (REALPART_EXPR, op_unknown); set (ABSU_EXPR, op_absu); -} - -pointer_table::pointer_table () -{ - set (BIT_AND_EXPR, op_pointer_and); - set (BIT_IOR_EXPR, op_pointer_or); - set (MIN_EXPR, op_ptr_min_max); - set (MAX_EXPR, op_ptr_min_max); + set (OP_WIDEN_MULT_SIGNED, op_widen_mult_signed); + set (OP_WIDEN_MULT_UNSIGNED, op_widen_mult_unsigned); + set (OP_WIDEN_PLUS_SIGNED, op_widen_plus_signed); + set (OP_WIDEN_PLUS_UNSIGNED, op_widen_plus_unsigned); - set (ADDR_EXPR, op_addr); - - set (BIT_NOT_EXPR, op_bitwise_not); - set (BIT_XOR_EXPR, op_bitwise_xor); -} - -// Initialize any pointer operators to the primary table - -void -range_op_table::initialize_pointer_ops () -{ - set (POINTER_PLUS_EXPR, op_pointer_plus); - set (POINTER_DIFF_EXPR, op_pointer_diff); } #if CHECKING_P diff --git a/gcc/range-op.h b/gcc/range-op.h index 0f5ee41..af94c27 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -72,6 +72,10 @@ public: const frange &lh, const frange &rh, relation_trio = TRIO_VARYING) const; + virtual bool fold_range (frange &r, tree type, + const irange &lh, + const irange &rh, + relation_trio = TRIO_VARYING) const; // Return the range for op[12] in the general case. LHS is the range for // the LHS of the expression, OP[12]is the range for the other @@ -185,9 +189,9 @@ class range_op_handler { public: range_op_handler (); - range_op_handler (enum tree_code code, tree type); - range_op_handler (enum tree_code code); - inline operator bool () const { return m_operator != NULL; } + range_op_handler (unsigned); + operator bool () const; + range_operator *range_op () const; bool fold_range (vrange &r, tree type, const vrange &lh, @@ -213,7 +217,6 @@ public: protected: unsigned dispatch_kind (const vrange &lhs, const vrange &op1, const vrange& op2) const; - void set_op_handler (enum tree_code code, tree type); range_operator *m_operator; }; @@ -226,9 +229,8 @@ range_cast (vrange &r, tree type) Value_Range tmp (r); Value_Range varying (type); varying.set_varying (type); - range_op_handler op (CONVERT_EXPR, type); // Call op_convert, if it fails, the result is varying. - if (!op || !op.fold_range (r, type, tmp, varying)) + if (!range_op_handler (CONVERT_EXPR).fold_range (r, type, tmp, varying)) { r.set_varying (type); return false; @@ -249,9 +251,8 @@ range_cast (Value_Range &r, tree type) // Ensure we are in the correct mode for the call to fold. r.set_type (type); - range_op_handler op (CONVERT_EXPR, type); // Call op_convert, if it fails, the result is varying. - if (!op || !op.fold_range (r, type, tmp, varying)) + if (!range_op_handler (CONVERT_EXPR).fold_range (r, type, tmp, varying)) { r.set_varying (type); return false; @@ -265,60 +266,37 @@ extern void wi_set_zero_nonzero_bits (tree type, wide_int &maybe_nonzero, wide_int &mustbe_nonzero); +// These are extra operators that do not fit in the normal scheme of things. +// Add them to the end of the tree-code vector, and provide a name for +// each allowing for easy access when required. + +#define OP_WIDEN_MULT_SIGNED ((unsigned) MAX_TREE_CODES) +#define OP_WIDEN_MULT_UNSIGNED ((unsigned) MAX_TREE_CODES + 1) +#define OP_WIDEN_PLUS_SIGNED ((unsigned) MAX_TREE_CODES + 2) +#define OP_WIDEN_PLUS_UNSIGNED ((unsigned) MAX_TREE_CODES + 3) +#define RANGE_OP_TABLE_SIZE ((unsigned) MAX_TREE_CODES + 4) + // This implements the range operator tables as local objects. class range_op_table { public: - range_operator *operator[] (enum tree_code code); - void set (enum tree_code code, range_operator &op); + range_op_table (); + inline range_operator *operator[] (unsigned code) + { + gcc_checking_assert (code < RANGE_OP_TABLE_SIZE); + return m_range_tree[code]; + } protected: - range_operator *m_range_tree[MAX_TREE_CODES]; + inline void set (unsigned code, range_operator &op) + { + gcc_checking_assert (code < RANGE_OP_TABLE_SIZE); + gcc_checking_assert (m_range_tree[code] == NULL); + m_range_tree[code] = &op; + } + range_operator *m_range_tree[RANGE_OP_TABLE_SIZE]; void initialize_integral_ops (); void initialize_pointer_ops (); void initialize_float_ops (); }; - - -// Return a pointer to the range_operator instance, if there is one -// associated with tree_code CODE. - -inline range_operator * -range_op_table::operator[] (enum tree_code code) -{ - gcc_checking_assert (code > 0 && code < MAX_TREE_CODES); - return m_range_tree[code]; -} - -// Add OP to the handler table for CODE. - -inline void -range_op_table::set (enum tree_code code, range_operator &op) -{ - gcc_checking_assert (m_range_tree[code] == NULL); - m_range_tree[code] = &op; -} - -// This holds the range op tables - -class integral_table : public range_op_table -{ -public: - integral_table (); -}; -extern integral_table integral_tree_table; - -// Instantiate a range op table for pointer operations. - -class pointer_table : public range_op_table -{ -public: - pointer_table (); -}; -extern pointer_table pointer_tree_table; - -extern range_operator *ptr_op_widen_mult_signed; -extern range_operator *ptr_op_widen_mult_unsigned; -extern range_operator *ptr_op_widen_plus_signed; -extern range_operator *ptr_op_widen_plus_unsigned; #endif // GCC_RANGE_OP_H diff --git a/gcc/regcprop.cc b/gcc/regcprop.cc index f426f4f..6cbfadb 100644 --- a/gcc/regcprop.cc +++ b/gcc/regcprop.cc @@ -422,7 +422,12 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode, It's unclear if we need to do the same for other special registers. */ if (regno == STACK_POINTER_REGNUM) - return NULL_RTX; + { + if (orig_mode == new_mode) + return stack_pointer_rtx; + else + return NULL_RTX; + } if (orig_mode == new_mode) return gen_raw_REG (new_mode, regno); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 138f217..34bad04 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,332 @@ +2023-06-15 Andrew Pinski <apinski@marvell.com> + + PR tree-optimization/110266 + * gcc.c-torture/compile/pr110266.c: New test. + +2023-06-15 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/110266 + * gcc.dg/pr110266.c: New. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/80753 + * c-c++-common/missing-header-5.c: New test. + +2023-06-15 Thomas Schwinge <thomas@codesourcery.com> + + * c-c++-common/Wfree-nonheap-object-3.c: Fix 'dg-warning' for C++. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/79173 + * gcc.target/i386/pr79173-1.c: New test. + * gcc.target/i386/pr79173-2.c: New test. + * gcc.target/i386/pr79173-3.c: New test. + * gcc.target/i386/pr79173-4.c: New test. + * gcc.target/i386/pr79173-5.c: New test. + * gcc.target/i386/pr79173-6.c: New test. + * gcc.target/i386/pr79173-7.c: New test. + * gcc.target/i386/pr79173-8.c: New test. + * gcc.target/i386/pr79173-9.c: New test. + * gcc.target/i386/pr79173-10.c: New test. + +2023-06-15 Oluwatamilore Adebayo <oluwatamilore.adebayo@arm.com> + + * gcc.target/aarch64/abd.h: New file. + * gcc.target/aarch64/abd_2.c: New test. + * gcc.target/aarch64/abd_3.c: New test. + * gcc.target/aarch64/abd_4.c: New test. + * gcc.target/aarch64/abd_none_2.c: New test. + * gcc.target/aarch64/abd_none_3.c: New test. + * gcc.target/aarch64/abd_none_4.c: New test. + * gcc.target/aarch64/abd_run_1.c: New test. + * gcc.target/aarch64/sve/abd_1.c: New test. + * gcc.target/aarch64/sve/abd_none_1.c: New test. + * gcc.target/aarch64/sve/abd_2.c: New test. + * gcc.target/aarch64/sve/abd_none_2.c: New test. + +2023-06-15 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-1.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-2.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-3.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-4.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-5.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-6.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-7.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-1.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-2.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-3.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-4.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-5.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-6.c: New test. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-7.c: New test. + +2023-06-15 Lehua Ding <lehua.ding@rivai.ai> + + PR target/110119 + * gcc.target/riscv/rvv/base/pr110119-1.c: New test. + * gcc.target/riscv/rvv/base/pr110119-2.c: New test. + +2023-06-14 Jason Merrill <jason@redhat.com> + + DR 2327 + PR c++/86521 + * g++.dg/cpp0x/overload-conv-4.C: Remove warnings. + * g++.dg/cpp1z/elide7.C: New test. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * gfortran.fortran-torture/execute/math.f90: Enhance for optional + OpenACC 'serial', OpenMP 'target' usage. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * c-c++-common/Wfree-nonheap-object-2.c: Tighten 'dg-warning' + alternatives. + * c-c++-common/Wfree-nonheap-object-3.c: Likewise. + * c-c++-common/Wfree-nonheap-object.c: Likewise. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * g++.dg/warn/Wfree-nonheap-object.s: Remove. + +2023-06-14 liuhongt <hongtao.liu@intel.com> + + * gcc.target/i386/pr110227.c: New test. + +2023-06-13 David Malcolm <dmalcolm@redhat.com> + + PR c/84890 + * g++.dg/cpp2a/srcloc3.C: Update expected message. + * g++.dg/lookup/missing-std-include-2.C: Likewise. + * g++.dg/lookup/missing-std-include-3.C: Likewise. + * g++.dg/lookup/missing-std-include-6.C: Likewise. + * g++.dg/lookup/missing-std-include.C: Likewise. + * g++.dg/spellcheck-inttypes.C: Likewise. + * g++.dg/spellcheck-stdint.C: Likewise. + * g++.dg/spellcheck-stdlib.C: Likewise. + * gcc.dg/spellcheck-inttypes.c: Likewise. + * gcc.dg/spellcheck-stdbool.c: Likewise. + * gcc.dg/spellcheck-stdint.c: Likewise. + * gcc.dg/spellcheck-stdlib.c: Likewise. + +2023-06-13 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * gfortran.dg/data_array_7.f90: New test. + +2023-06-13 Harald Anlauf <anlauf@gmx.de> + Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/86277 + * gfortran.dg/zero_sized_14.f90: New test. + * gfortran.dg/zero_sized_15.f90: New test. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/autovec/partial/slp-10.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp-11.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp-13.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp-14.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp-15.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-10.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-11.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-13.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-14.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-15.c: New test. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/autovec/partial/slp-12.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-12.c: New test. + +2023-06-13 Jason Merrill <jason@redhat.com> + + * g++.dg/tree-ssa/initlist-opt6.C: New test. + +2023-06-13 Yanzhang Wang <yanzhang.wang@intel.com> + Kito Cheng <kito.cheng@sifive.com> + + * g++.target/riscv/rvv/base/pr109244.C: Add the -Wno-psabi. + * g++.target/riscv/rvv/base/pr109535.C: Same + * gcc.target/riscv/rvv/base/binop_vx_constraint-120.c: Same + * gcc.target/riscv/rvv/base/integer_compare_insn_shortcut.c: Same + * gcc.target/riscv/rvv/base/mask_insn_shortcut.c: Same + * gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c: Same + * gcc.target/riscv/rvv/base/pr110109-2.c: Same + * gcc.target/riscv/rvv/base/scalar_move-9.c: Same + * gcc.target/riscv/rvv/base/spill-10.c: Same + * gcc.target/riscv/rvv/base/spill-11.c: Same + * gcc.target/riscv/rvv/base/spill-9.c: Same + * gcc.target/riscv/rvv/base/vlmul_ext-1.c: Same + * gcc.target/riscv/rvv/base/zero_base_load_store_optimization.c: Same + * gcc.target/riscv/rvv/base/zvfh-intrinsic.c: Same + * gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c: Same + * gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c: Same + * gcc.target/riscv/rvv/vsetvl/vsetvl-1.c: Same + * gcc.target/riscv/vector-abi-1.c: New test. + * gcc.target/riscv/vector-abi-2.c: New test. + * gcc.target/riscv/vector-abi-3.c: New test. + * gcc.target/riscv/vector-abi-4.c: New test. + * gcc.target/riscv/vector-abi-5.c: New test. + * gcc.target/riscv/vector-abi-6.c: New test. + +2023-06-13 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/arm/mtp.c: New test. + * gcc.target/arm/mtp_1.c: New test. + * gcc.target/arm/mtp_2.c: New test. + * gcc.target/arm/mtp_3.c: New test. + * gcc.target/arm/mtp_4.c: New test. + +2023-06-13 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/108779 + * gcc.target/aarch64/mtp_5.c: New test. + * gcc.target/aarch64/mtp_6.c: New test. + * gcc.target/aarch64/mtp_7.c: New test. + * gcc.target/aarch64/mtp_8.c: New test. + * gcc.target/aarch64/mtp_9.c: New test. + +2023-06-13 Richard Biener <rguenther@suse.de> + + PR middle-end/110232 + * gcc.target/i386/pr110232.c: New testcase. + +2023-06-13 Ajit Kumar Agarwal <aagarwa1@linux.ibm.com> + + PR testsuite/109880 + * gcc.target/powerpc/fold-vec-extract-int.p8.c: Update test. + +2023-06-13 Kewen Lin <linkw@linux.ibm.com> + + PR testsuite/110230 + PR target/109932 + * gcc.target/powerpc/pr109932-1.c: Adjust with int128 effective target. + * gcc.target/powerpc/pr109932-2.c: Ditto. + +2023-06-13 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c: + Adjust dg-do to comiple for asm checking. + +2023-06-13 Tejas Belagod <tbelagod@arm.com> + + PR target/96339 + * gcc.target/aarch64/sve/acle/general-c/svlast.c: New. + * gcc.target/aarch64/sve/acle/general-c/svlast128_run.c: New. + * gcc.target/aarch64/sve/acle/general-c/svlast256_run.c: New. + * gcc.target/aarch64/sve/pcs/return_4.c (caller_bf16): Fix asm + to expect optimized code for function body. + * gcc.target/aarch64/sve/pcs/return_4_128.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_4_256.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_4_512.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_4_1024.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_4_2048.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_5.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_5_128.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_5_256.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_5_512.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_5_1024.c (caller_bf16): Likewise. + * gcc.target/aarch64/sve/pcs/return_5_2048.c (caller_bf16): Likewise. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c: New test. + +2023-06-13 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/autovec/partial/slp-8.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp-9.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-8.c: New test. + * gcc.target/riscv/rvv/autovec/partial/slp_run-9.c: New test. + +2023-06-12 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/110189 + * gm2/pim/fail/foovaltype.mod: New test. + +2023-06-12 Jeff Law <jlaw@ventanamicro.com> + + PR rtl-optimization/101188 + * gcc.c-torture/execute/pr101188.c: New test + +2023-06-12 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> + + * gcc.target/aarch64/vec-init-single-const.c: New test. + * gcc.target/aarch64/vec-init-single-const-be.c: Likewise. + * gcc.target/aarch64/vec-init-single-const-2.c: Likewise. + +2023-06-12 Tobias Burnus <tobias@codesourcery.com> + + * c-c++-common/gomp/defaultmap-4.c: Update scan-tree-dump. + * c-c++-common/gomp/map-9.c: Likewise. + * gfortran.dg/gomp/defaultmap-8.f90: Likewise. + * gfortran.dg/gomp/map-11.f90: Likewise. + * gfortran.dg/gomp/target-update-1.f90: Likewise. + * gfortran.dg/gomp/map-12.f90: Likewise; also check original dump. + * c-c++-common/gomp/map-6.c: Update dg-error and also check + clause error with 'target (enter/exit) data'. + +2023-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/vsetvl/vsetvl-23.c: Adjust test checking. + +2023-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c: Add new test cases. + * gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c: Likewise. + +2023-06-12 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/autovec/binop/narrow-1.c: New test. + * gcc.target/riscv/rvv/autovec/binop/narrow-2.c: New test. + * gcc.target/riscv/rvv/autovec/binop/narrow-3.c: New test. + * gcc.target/riscv/rvv/autovec/binop/narrow_run-1.c: New test. + * gcc.target/riscv/rvv/autovec/binop/narrow_run-2.c: New test. + * gcc.target/riscv/rvv/autovec/binop/narrow_run-3.c: New test. + +2023-06-12 Juzhe-Zhong <juzhe.zhong@rivai.ai> + + * gcc.target/riscv/rvv/autovec/zvfhmin-1.c: New test. + +2023-06-12 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * gcc.dg/vect/pr110142.c: New test. + +2023-06-12 liuhongt <hongtao.liu@intel.com> + + * gcc.target/i386/vec_pack_fp16-1.c: New test. + * gcc.target/i386/vec_pack_fp16-2.c: New test. + * gcc.target/i386/vec_pack_fp16-3.c: New test. + +2023-06-12 Jason Merrill <jason@redhat.com> + + PR c++/105838 + * g++.dg/tree-ssa/initlist-opt5.C: New test. + +2023-06-12 Kewen Lin <linkw@linux.ibm.com> + + PR target/109932 + * gcc.target/powerpc/pr109932-1.c: New test. + * gcc.target/powerpc/pr109932-2.c: New test. + +2023-06-12 Kewen Lin <linkw@linux.ibm.com> + + PR target/110011 + * gcc.target/powerpc/pr110011.c: New test. + +2023-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c: Add test cases. + * gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c: Ditto. + +2023-06-12 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c: Add new test cases. + * gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c: Add new test cases. + 2023-06-11 Patrick Palka <ppalka@redhat.com> PR c++/110122 diff --git a/gcc/testsuite/c-c++-common/Wfree-nonheap-object-2.c b/gcc/testsuite/c-c++-common/Wfree-nonheap-object-2.c index 0aedf1b..a2dbd18 100644 --- a/gcc/testsuite/c-c++-common/Wfree-nonheap-object-2.c +++ b/gcc/testsuite/c-c++-common/Wfree-nonheap-object-2.c @@ -32,7 +32,7 @@ void test_nowarn_int (int n) inline void dealloc_long (long *p) { - __builtin_free (p); // { dg-warning "'__builtin_free|void __builtin_free\\(void\\*\\)' called on pointer 'p|<unknown>' with nonzero offset" } + __builtin_free (p); // { dg-warning "'(__builtin_free|void __builtin_free\\(void\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } } __attribute__ ((malloc (dealloc_long))) diff --git a/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c b/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c index 41a5b50..23d89a3 100644 --- a/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c +++ b/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c @@ -22,7 +22,7 @@ void test_nowarn_int (int n) { int *p = alloc_int (n); - __builtin_free (p + 1); // { dg-warning "'__builtin_free|void __builtin_free\\(void\\*\\)' called on pointer 'p|<unknown>' with nonzero offset" } + __builtin_free (p + 1); // { dg-warning "'(__builtin_free|void __builtin_free\\(void\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } } } @@ -42,7 +42,7 @@ void test_nowarn_long (int n) { long *p = alloc_long (n); - dealloc_long (p + 1); // { dg-warning "'dealloc_long' called on pointer 'p|<unknown>' with nonzero offset" } + dealloc_long (p + 1); // { dg-warning "'(dealloc_long|void dealloc_long\\(long int\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } } } @@ -50,7 +50,7 @@ void test_nowarn_long (int n) inline __attribute__ ((always_inline)) void dealloc_float (float *p) // { dg-message "deallocation function declared here" } { - __builtin_free (p); // { dg-warning "'__builtin_free|void __builtin_free\\(void\\*\\)' called on pointer 'p|<unknown>' with nonzero offset" } + __builtin_free (p); // { dg-warning "'(__builtin_free|void __builtin_free\\(void\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } } __attribute__ ((malloc (dealloc_float))) diff --git a/gcc/testsuite/c-c++-common/Wfree-nonheap-object.c b/gcc/testsuite/c-c++-common/Wfree-nonheap-object.c index dfbb296..5f1e3fb 100644 --- a/gcc/testsuite/c-c++-common/Wfree-nonheap-object.c +++ b/gcc/testsuite/c-c++-common/Wfree-nonheap-object.c @@ -37,14 +37,14 @@ void test_nowarm (void) void test_warn (void) { char *p = f (); - free (p + 1); // { dg-warning "'free|void free\\(void\\*\\)' called on pointer 'p|<unknown>' with nonzero offset" } + free (p + 1); // { dg-warning "'(free|void free\\(void\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } p = g (); - free (p + 2); // { dg-warning "'free|void free\\(void\\*\\)' called on pointer 'p|<unknown>' with nonzero offset" } + free (p + 2); // { dg-warning "'(free|void free\\(void\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } p = f (); - __builtin_free (p + 3); // { dg-warning "'__builtin_free|void __builtin_free\\(void\\*\\)' called on pointer 'p|<unknown>' with nonzero offset" } + __builtin_free (p + 3); // { dg-warning "'(__builtin_free|void __builtin_free\\(void\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } p = g (); - __builtin_free (p + 4); // { dg-warning "'__builtin_free|void __builtin_free\\(void\\*\\)' called on pointer 'p|<unknown>' with nonzero offset" } + __builtin_free (p + 4); // { dg-warning "'(__builtin_free|void __builtin_free\\(void\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } } diff --git a/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c b/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c index 1afff7e..b84f89b 100644 --- a/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c +++ b/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c @@ -20,5 +20,5 @@ foo (void) c[i] = a[i] + b[i]; } -/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(present,alloc:c \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(present,alloc:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(present,alloc:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\)" "gimple" } } */ -/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(present,alloc:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(present,alloc:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:c \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/map-6.c b/gcc/testsuite/c-c++-common/gomp/map-6.c index 8c5b7f7..5152d9d 100644 --- a/gcc/testsuite/c-c++-common/gomp/map-6.c +++ b/gcc/testsuite/c-c++-common/gomp/map-6.c @@ -13,12 +13,22 @@ foo (void) #pragma omp target map (to:a) ; - #pragma omp target map (a to: b) /* { dg-error "'#pragma omp target' with modifier other than 'always', 'close' or 'present'" } */ + #pragma omp target map (a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */ ; - #pragma omp target map (close, a to: b) /* { dg-error "'#pragma omp target' with modifier other than 'always', 'close' or 'present'" } */ + #pragma omp target map (close, a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */ ; + #pragma omp target enter data map(b7) map (close, a to: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */ + ; + + #pragma omp target exit data map(b7) map (close, a from: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */ + ; + + #pragma omp target data map(b7) map (close, a from: b) /* { dg-error "'map' clause with map-type modifier other than 'always', 'close' or 'present'" } */ + ; + + #pragma omp target map (close a) /* { dg-error "'close' undeclared" "" { target c } } */ /* { dg-error "'close' has not been declared" "" { target c++ } .-1 } */ /* { dg-error "expected '\\)' before 'a'" "" { target *-*-* } .-2 } */ diff --git a/gcc/testsuite/c-c++-common/gomp/map-9.c b/gcc/testsuite/c-c++-common/gomp/map-9.c index 4b4bd6d..fcf3125 100644 --- a/gcc/testsuite/c-c++-common/gomp/map-9.c +++ b/gcc/testsuite/c-c++-common/gomp/map-9.c @@ -25,8 +25,8 @@ foo (void) c[i] = a[i] + b[i]; } -/* { dg-final { scan-tree-dump "pragma omp target enter data map\\(present,to:b \\\[len: \[0-9\]+\\\]\\) map\\(present,to:a \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ -/* { dg-final { scan-tree-dump "pragma omp target data map\\(present,to:b \\\[len: \[0-9\]+\\\]\\) map\\(present,to:a \\\[len: \[0-9\]+\\\]\\) map\\(always,present,from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ -/* { dg-final { scan-tree-dump "pragma omp target.*map\\(present,from:c \\\[len: \[0-9\]+\\\]\\) map\\(present,to:b \\\[len: \[0-9\]+\\\]\\) map\\(present,to:a \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target enter data map\\(force_present:b \\\[len: \[0-9\]+\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target data map\\(force_present:b \\\[len: \[0-9\]+\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\) map\\(always,present,from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target.*map\\(force_present:c \\\[len: \[0-9\]+\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "pragma omp target exit data map\\(always,present,from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ -/* { dg-final { scan-tree-dump "pragma omp target.*map\\(present,to:b \\\[len: \[0-9\]+\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\) map\\(to:a \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target.*map\\(force_present:b \\\[len: \[0-9\]+\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\) map\\(to:a \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/missing-header-5.c b/gcc/testsuite/c-c++-common/missing-header-5.c new file mode 100644 index 0000000..aa36c68 --- /dev/null +++ b/gcc/testsuite/c-c++-common/missing-header-5.c @@ -0,0 +1,15 @@ +/* PR preprocessor/80753 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#if __has_include("nonexistent.h") +# error +#endif + +#include "nonexistent.h" + +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ + +/* This declaration should not receive any diagnostic. */ +foo bar; diff --git a/gcc/testsuite/c-c++-common/spellcheck-pr107583.c b/gcc/testsuite/c-c++-common/spellcheck-pr107583.c new file mode 100644 index 0000000..86a9e7d --- /dev/null +++ b/gcc/testsuite/c-c++-common/spellcheck-pr107583.c @@ -0,0 +1,10 @@ +struct s1 { + time_t mytime; /* { dg-error "unknown type name 'time_t'" "c error" { target c } } */ + /* { dg-error "'time_t' does not name a type" "c++ error" { target c++ } .-1 } */ + /* { dg-message "'time_t' is defined in header" "hint" { target *-*-* } .-2 } */ +}; + +struct s2 { + unsinged i; /* { dg-error "unknown type name 'unsinged'; did you mean 'unsigned'." "c error" { target c } } */ + /* { dg-error "'unsinged' does not name a type; did you mean 'unsigned'." "c++ error" { target c++ } .-1 } */ +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/elab-enum-base.C b/gcc/testsuite/g++.dg/cpp0x/elab-enum-base.C new file mode 100644 index 0000000..57141f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/elab-enum-base.C @@ -0,0 +1,7 @@ +// { dg-do compile { target c++11 } } +// { dg-options "" } +// Empty dg-options to override -pedantic-errors. + +typedef long CFIndex; +typedef enum CFComparisonResult : CFIndex CFComparisonResult; +// { dg-warning "declaration of enumeration with fixed underlying type" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp0x/enum40.C b/gcc/testsuite/g++.dg/cpp0x/enum40.C index cfdf2a4..d3ffeb6 100644 --- a/gcc/testsuite/g++.dg/cpp0x/enum40.C +++ b/gcc/testsuite/g++.dg/cpp0x/enum40.C @@ -4,23 +4,25 @@ void foo () { - enum : int a alignas; // { dg-error "expected" } + enum : int a alignas; // { dg-error "declaration of enum" } + // { dg-error {expected '\(' before ';'} "" { target *-*-* } .-1 } } void bar () { - enum : int a; // { dg-error "expected" } + enum : int a; // { dg-error "declaration of enum" } } void baz () { - enum class a : int b alignas; // { dg-error "expected" } + enum class a : int b alignas; // { dg-error "declaration of enum" } + // { dg-error {expected '\(' before ';'} "" { target *-*-* } .-1 } } void qux () { - enum class a : int b; // { dg-error "expected" } + enum class a : int b; // { dg-error "declaration of enum" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C index 01bf563..8ad3f73 100644 --- a/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C @@ -23,7 +23,7 @@ enum class E7 : int; //ok enum class E3 e3; // { dg-error "scoped enum must not use" } enum struct E3 e4; // { dg-error "scoped enum must not use" } -enum E5 : int e5; // { dg-error "expected|invalid type" } +enum E5 : int e5; // { dg-error "declaration of enumeration with fixed underlying type|invalid type" } enum E6 : int { a, b, c }; // { dg-message "previous definition" } enum E6 : int { a, b, c }; // { dg-error "multiple definition" } diff --git a/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C b/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C index 6fcdbba..d2663e6 100644 --- a/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C +++ b/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C @@ -17,7 +17,6 @@ B f (A x) { // C++14: we call B::B(A const &) - // C++17: we call A::operator B() - return B(x); // { dg-warning "choosing .A::operator B\\(\\). over .B::B\\(const A&\\)" "" { target c++17 } } - // { dg-warning "for conversion from .A. to .B." "" { target c++17 } .-1 } + // C++17: now the same + return B(x); } diff --git a/gcc/testsuite/g++.dg/cpp1z/elide7.C b/gcc/testsuite/g++.dg/cpp1z/elide7.C new file mode 100644 index 0000000..2d8cc65 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/elide7.C @@ -0,0 +1,14 @@ +// DR2327: In direct-initialization, prefer a constructor even if it requires a +// qualification conversion. + +// { dg-do compile { target c++11 } } + +struct Dog; +struct Cat { + Cat(const Dog&); +}; +struct Dog { + operator Cat() = delete; +}; + +Cat cat(Dog{}); diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc3.C b/gcc/testsuite/g++.dg/cpp2a/srcloc3.C index 324e03c..c843e07 100644 --- a/gcc/testsuite/g++.dg/cpp2a/srcloc3.C +++ b/gcc/testsuite/g++.dg/cpp2a/srcloc3.C @@ -1,5 +1,5 @@ // { dg-do compile { target c++20 } } auto x = __builtin_source_location (); // { dg-error "'source_location' is not a member of 'std'" } -// { dg-message "std::source_location' is defined in header '<source_location>'; did you forget to '#include <source_location>'" "" { target *-*-* } .-1 } +// { dg-message "std::source_location' is defined in header '<source_location>'; this is probably fixable by adding '#include <source_location>'" "" { target *-*-* } .-1 } // { dg-message "using '__builtin_source_location'" "" { target *-*-* } .-2 } diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C index 51c604a..fa1ec0b 100644 --- a/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C @@ -16,10 +16,10 @@ namespace std void test (void) { std::string s ("hello world"); // { dg-error ".string. is not a member of .std." } - // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::string. is defined in header .<string>.; this is probably fixable by adding .#include <string>." "" { target *-*-* } .-1 } std::cout << 10; // { dg-error ".cout. is not a member of .std." } - // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::cout. is defined in header .<iostream>.; this is probably fixable by adding .#include <iostream>." "" { target *-*-* } .-1 } } /* Same again, to test idempotency of the added "#include" fix-it. */ @@ -27,10 +27,10 @@ void test (void) void test_2 (void) { std::string s ("hello again"); // { dg-error ".string. is not a member of .std." } - // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::string. is defined in header .<string>.; this is probably fixable by adding .#include <string>." "" { target *-*-* } .-1 } std::cout << 10; // { dg-error ".cout. is not a member of .std." } - // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::cout. is defined in header .<iostream>.; this is probably fixable by adding .#include <iostream>." "" { target *-*-* } .-1 } } /* Verify the output from -fdiagnostics-generate-patch. diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C index 23f868d..ee567ed 100644 --- a/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C @@ -7,7 +7,7 @@ void test () { std::string test; // { dg-error ".string. is not a member of .std." } - // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::string. is defined in header .<string>.; this is probably fixable by adding .#include <string>." "" { target *-*-* } .-1 } } #include <string> diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C index a8f2747..e6f5ec0 100644 --- a/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C @@ -55,12 +55,12 @@ void test_move(T&& arg) void test_array () { std::array a; // { dg-error ".array. is not a member of .std." } - // { dg-message ".std::array. is defined in header .<array>.; did you forget to .#include <array>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::array. is defined in header .<array>.; this is probably fixable by adding .#include <array>." "" { target *-*-* } .-1 } } void test_tuple () { std::tuple<int,float> p; // { dg-error ".tuple. is not a member of .std." } - // { dg-message ".std::tuple. is defined in header .<tuple>.; did you forget to .#include <tuple>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::tuple. is defined in header .<tuple>.; this is probably fixable by adding .#include <tuple>." "" { target *-*-* } .-1 } // { dg-error "expected primary-expression before .int." "" { target *-*-* } .-2 } } diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include.C b/gcc/testsuite/g++.dg/lookup/missing-std-include.C index 0fcc72b..f28618b 100644 --- a/gcc/testsuite/g++.dg/lookup/missing-std-include.C +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include.C @@ -1,30 +1,30 @@ void test (void) { std::string s ("hello world"); // { dg-error ".string. is not a member of .std." } - // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::string. is defined in header .<string>.; this is probably fixable by adding .#include <string>." "" { target *-*-* } .-1 } std::wstring ws ("hello world"); // { dg-error ".wstring. is not a member of .std." } - // { dg-message ".std::wstring. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::wstring. is defined in header .<string>.; this is probably fixable by adding .#include <string>." "" { target *-*-* } .-1 } std::cout << 10; // { dg-error ".cout. is not a member of .std." } - // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::cout. is defined in header .<iostream>.; this is probably fixable by adding .#include <iostream>." "" { target *-*-* } .-1 } int i; std::cin >> i; // { dg-error ".cin. is not a member of .std." } - // { dg-message ".std::cin. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::cin. is defined in header .<iostream>.; this is probably fixable by adding .#include <iostream>." "" { target *-*-* } .-1 } std::deque a; // { dg-error ".deque. is not a member of .std." } - // { dg-message ".std::deque. is defined in header .<deque>.; did you forget to .#include <deque>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::deque. is defined in header .<deque>.; this is probably fixable by adding .#include <deque>." "" { target *-*-* } .-1 } std::vector<int> v; // { dg-error ".vector. is not a member of .std." } - // { dg-message ".std::vector. is defined in header .<vector>.; did you forget to .#include <vector>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::vector. is defined in header .<vector>.; this is probably fixable by adding .#include <vector>." "" { target *-*-* } .-1 } // { dg-error "expected primary-expression before .int." "" { target *-*-* } .-2 } std::list<int> lst; // { dg-error ".list. is not a member of .std." } - // { dg-message ".std::list. is defined in header .<list>.; did you forget to .#include <list>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::list. is defined in header .<list>.; this is probably fixable by adding .#include <list>." "" { target *-*-* } .-1 } // { dg-error "expected primary-expression before .int." "" { target *-*-* } .-2 } std::pair<int,float> p; // { dg-error ".pair. is not a member of .std." } - // { dg-message ".std::pair. is defined in header .<utility>.; did you forget to .#include <utility>.?" "" { target *-*-* } .-1 } + // { dg-message ".std::pair. is defined in header .<utility>.; this is probably fixable by adding .#include <utility>." "" { target *-*-* } .-1 } // { dg-error "expected primary-expression before .int." "" { target *-*-* } .-2 } } diff --git a/gcc/testsuite/g++.dg/spellcheck-inttypes.C b/gcc/testsuite/g++.dg/spellcheck-inttypes.C index fea3096..541d668 100644 --- a/gcc/testsuite/g++.dg/spellcheck-inttypes.C +++ b/gcc/testsuite/g++.dg/spellcheck-inttypes.C @@ -16,68 +16,68 @@ uintptr_t up; /* As an identifier. */ const char *hex8_fmt = PRIx8; /* { dg-error "'PRIx8' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx8' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx8' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *hex16_fmt = PRIx16; /* { dg-error "'PRIx16' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx16' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx16' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *hex32_fmt = PRIx32; /* { dg-error "'PRIx32' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx32' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx32' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *hex64_fmt = PRIx64; /* { dg-error "'PRIx64' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx64' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx64' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *hexptr_fmt = PRIxPTR; /* { dg-error "'PRIxPTR' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIxPTR' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIxPTR' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ /* As a part of a string-literal. */ const char *dec8msg_fmt = "Provide %" PRId8 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId8' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId8' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *dec16msg_fmt = "Provide %" PRId16 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId16' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId16' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *dec32msg_fmt = "Provide %" PRId32 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId32' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId32' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *dec64msg_fmt = "Provide %" PRId64 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId64' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId64' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ const char *decptrmsg_fmt = "Provide %" PRIdPTR "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRIdPTR' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIdPTR' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ void test_printf (void) { printf ("some format strings %s, %s, %s, %s, %s, %s\n", PRId8, /* { dg-error "'PRId8' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRId8' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId8' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ PRIi16, /* { dg-error "'PRIi16' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIi16' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIi16' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ PRIo32, /* { dg-error "'PRIo32' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIo32' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo32' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ PRIu64, /* { dg-error "'PRIu64' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIu64' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIu64' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ PRIx32, /* { dg-error "'PRIx32' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx32' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx32' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ PRIoPTR); /* { dg-error "'PRIoPTR' was not declared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIoPTR' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIoPTR' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo8 "\n", i8); /* { dg-error "expected" } */ -/* { dg-message "'PRIo8' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo8' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo16 "\n", i16); /* { dg-error "expected" } */ -/* { dg-message "'PRIo16' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo16' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo32 "\n", i32); /* { dg-error "expected" } */ -/* { dg-message "'PRIo32' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo32' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo64 "\n", i64); /* { dg-error "expected" } */ -/* { dg-message "'PRIo64' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo64' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIoPTR "\n", ip); /* { dg-error "expected" } */ -/* { dg-message "'PRIoPTR' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIoPTR' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ } void test_scanf (void) { scanf ("%" SCNu8 "\n", &i8); /* { dg-error "expected" } */ -/* { dg-message "'SCNu8' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu8' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNu16 "\n", &i16); /* { dg-error "expected" } */ -/* { dg-message "'SCNu16' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu16' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNu32 "\n", &i32); /* { dg-error "expected" } */ -/* { dg-message "'SCNu32' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu32' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNu64 "\n", &i64); /* { dg-error "expected" } */ -/* { dg-message "'SCNu64' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu64' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNuPTR "\n", &ip); /* { dg-error "expected" } */ -/* { dg-message "'SCNuPTR' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNuPTR' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNxPTR "\n", &up); /* { dg-error "expected" } */ -/* { dg-message "'SCNxPTR' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNxPTR' is defined in header '<cinttypes>'; this is probably fixable by adding '#include <cinttypes>'" "replacement note" { target *-*-* } .-1 } */ } diff --git a/gcc/testsuite/g++.dg/spellcheck-stdint.C b/gcc/testsuite/g++.dg/spellcheck-stdint.C index b9ce3b7..aa9c7e6 100644 --- a/gcc/testsuite/g++.dg/spellcheck-stdint.C +++ b/gcc/testsuite/g++.dg/spellcheck-stdint.C @@ -2,19 +2,19 @@ /* Missing <cstdint>. */ char c = INT8_MAX; // { dg-error "'INT8_MAX' was not declared" } -// { dg-message "'INT8_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT8_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } short s = INT16_MAX; // { dg-error "'INT16_MAX' was not declared" } -// { dg-message "'INT16_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } int i = INT32_MAX; // { dg-error "'INT32_MAX' was not declared" } -// { dg-message "'INT32_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } long l = INT64_MAX; // { dg-error "'INT64_MAX' was not declared" } -// { dg-message "'INT64_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT64_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } intptr_t test_intptr (void) // { dg-error "'intptr_t' does not name a type" } -// { dg-message "'intptr_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'intptr_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } { return 0; } @@ -22,11 +22,11 @@ intptr_t test_intptr (void) // { dg-error "'intptr_t' does not name a type" } int test_intptr_max (void) { return (int) INTPTR_MAX; // { dg-error "'INTPTR_MAX' was not declared" } -// { dg-message "'INTPTR_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'INTPTR_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } } uintptr_t test_uintptr (void) // { dg-error "'uintptr_t' does not name a type" } -// { dg-message "'uintptr_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'uintptr_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } { return 0; } @@ -34,35 +34,35 @@ uintptr_t test_uintptr (void) // { dg-error "'uintptr_t' does not name a type" } unsigned int test_uintptr_max (void) { return (unsigned int) UINTPTR_MAX; // { dg-error "'UINTPTR_MAX' was not declared" } -// { dg-message "'UINTPTR_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'UINTPTR_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } } int8_t i8; // { dg-error "'int8_t' does not name a type" } -// { dg-message "'int8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'int8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } int16_t i16; // { dg-error "'int16_t' does not name a type" } -// { dg-message "'int16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'int16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } int32_t i32; // { dg-error "'int32_t' does not name a type" } -// { dg-message "'int32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'int32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } int64_t i64; // { dg-error "'int64_t' does not name a type" } -// { dg-message "'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } +// { dg-message "'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } void test_uint_t (void) { char bu8[(unsigned int)UINT8_MAX]; // { dg-error "'UINT8_MAX' was not declared" } - // { dg-message "'UINT8_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT8_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } char bu16[(unsigned int)UINT16_MAX]; // { dg-error "'UINT16_MAX' was not declared" } - // { dg-message "'UINT16_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } char bu32[(unsigned int)UINT32_MAX]; // { dg-error "'UINT32_MAX' was not declared" } - // { dg-message "'UINT32_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } char bu64[(unsigned int)UINT64_MAX]; // { dg-error "'UINT64_MAX' was not declared" } - // { dg-message "'UINT64_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT64_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } auto ui8 = (uint8_t) 8; // { dg-error "'uint8_t' was not declared" } - // { dg-message "'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } auto ui16 = (uint16_t) 16; // { dg-error "'uint16_t' was not declared" } - // { dg-message "'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } auto ui32 = (uint32_t) 32; // { dg-error "'uint32_t' was not declared" } - // { dg-message "'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } auto ui64 = (uint64_t) 64; // { dg-error "'uint64_t' was not declared" } - // { dg-message "'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?" "" { target *-*-* } .-1 } + // { dg-message "'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'" "" { target *-*-* } .-1 } } diff --git a/gcc/testsuite/g++.dg/spellcheck-stdlib.C b/gcc/testsuite/g++.dg/spellcheck-stdlib.C index 7a70641..fd0f3a9 100644 --- a/gcc/testsuite/g++.dg/spellcheck-stdlib.C +++ b/gcc/testsuite/g++.dg/spellcheck-stdlib.C @@ -1,40 +1,40 @@ /* Missing <cstddef>. */ void *ptr = NULL; // { dg-error "'NULL' was not declared" } -// { dg-message "'NULL' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?" "" { target *-*-* } .-1 } +// { dg-message "'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'" "" { target *-*-* } .-1 } ptrdiff_t pd; // { dg-error "'ptrdiff_t' does not name a type" } -// { dg-message "'ptrdiff_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?" "" { target *-*-* } .-1 } +// { dg-message "'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'" "" { target *-*-* } .-1 } size_t sz; // { dg-error "'size_t' does not name a type" } -// { dg-message "'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?" "" { target *-*-* } .-1 } +// { dg-message "'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'" "" { target *-*-* } .-1 } /* Missing <cstdio>. */ void test_cstdio (void) { FILE *f; // { dg-error "'FILE' was not declared in this scope" } - // { dg-message "'FILE' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?" "" { target *-*-* } .-1 } + // { dg-message "'FILE' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'" "" { target *-*-* } .-1 } // { dg-error "'f' was not declared in this scope" "" { target *-*-* } .-2 } // { dg-bogus "suggested alternative: 'if'" "PR c++/80567" { target *-*-* } .-3 } char buf[BUFSIZ]; // { dg-error "'BUFSIZ' was not declared" } - // { dg-message "'BUFSIZ' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?" "" { target *-*-* } .-1 } + // { dg-message "'BUFSIZ' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'" "" { target *-*-* } .-1 } char buf2[FILENAME_MAX]; // { dg-error "'FILENAME_MAX' was not declared" } - // { dg-message "'FILENAME_MAX' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?" "" { target *-*-* } .-1 } + // { dg-message "'FILENAME_MAX' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'" "" { target *-*-* } .-1 } stderr; // { dg-error "'stderr' was not declared" } - // { dg-message "'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?" "" { target *-*-* } .-1 } + // { dg-message "'stderr' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'" "" { target *-*-* } .-1 } stdin; // { dg-error "'stdin' was not declared" } - // { dg-message "'stdin' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?" "" { target *-*-* } .-1 } + // { dg-message "'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'" "" { target *-*-* } .-1 } stdout; // { dg-error "'stdout' was not declared" } - // { dg-message "'stdout' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?" "" { target *-*-* } .-1 } + // { dg-message "'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'" "" { target *-*-* } .-1 } EOF; // { dg-error "'EOF' was not declared" } - // { dg-message "'EOF' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?" "" { target *-*-* } .-1 } + // { dg-message "'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'" "" { target *-*-* } .-1 } fopen ("test.txt"); // { dg-error "'fopen' was not declared" } // { dg-message "'#include <cstdio>'" "" { target *-*-* } .-1 } @@ -57,7 +57,7 @@ void test_cstdio (void) int test_cerrno (void) { return errno; // { dg-error "'errno' was not declared" } - // { dg-message "'errno' is defined in header '<cerrno>'; did you forget to '#include <cerrno>'?" "" { target *-*-* } .-1 } + // { dg-message "'errno' is defined in header '<cerrno>'; this is probably fixable by adding '#include <cerrno>'" "" { target *-*-* } .-1 } } /* Missing <cstdarg>. */ @@ -65,7 +65,7 @@ int test_cerrno (void) void test_cstdarg (void) { va_list ap; // { dg-error "'va_list'" } - // { dg-message "'va_list' is defined in header '<cstdarg>'; did you forget to '#include <cstdarg>'?" "" { target *-*-* } .-1 } + // { dg-message "'va_list' is defined in header '<cstdarg>'; this is probably fixable by adding '#include <cstdarg>'" "" { target *-*-* } .-1 } } /* Missing <climits>. */ @@ -74,13 +74,13 @@ int test_INT_MAX (void) return INT_MAX; // { dg-line INT_MAX_line } // { dg-error "'INT_MAX' was not declared" "" { target *-*-* } INT_MAX_line } // { dg-bogus "__INT_MAX__" "" { target *-*-* } INT_MAX_line } - // { dg-message "'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?" "" { target *-*-* } INT_MAX_line } + // { dg-message "'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'" "" { target *-*-* } INT_MAX_line } } /* Missing <cfloat>. */ float test_FLT_MAX = FLT_MAX; // { dg-line FLT_MAX_line } // { dg-error "'FLT_MAX' was not declared" "" { target *-*-* } FLT_MAX_line } -// { dg-message "'FLT_MAX' is defined in header '<cfloat>'; did you forget to '#include <cfloat>'?" "" { target *-*-* } FLT_MAX_line } +// { dg-message "'FLT_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'" "" { target *-*-* } FLT_MAX_line } /* Missing <cstring>. */ diff --git a/gcc/testsuite/g++.dg/tree-ssa/initlist-opt6.C b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt6.C new file mode 100644 index 0000000..ea1bf5d --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt6.C @@ -0,0 +1,18 @@ +// { dg-do compile { target c++11 } } +// { dg-additional-options -fdump-tree-gimple } +// { dg-final { scan-tree-dump-not {static const struct S} "gimple" } } + +// Test that mutable prevents putting this init-list array in rodata. + +#include <initializer_list> + +struct S { + constexpr S(int i) : i(i) {} + mutable int i; +}; + +void f(std::initializer_list<S>); + +int main() { + f({1,2,3}); +} diff --git a/gcc/testsuite/g++.dg/warn/Wfree-nonheap-object.s b/gcc/testsuite/g++.dg/warn/Wfree-nonheap-object.s deleted file mode 100644 index e69de29..0000000 --- a/gcc/testsuite/g++.dg/warn/Wfree-nonheap-object.s +++ /dev/null diff --git a/gcc/testsuite/g++.target/riscv/rvv/base/pr109244.C b/gcc/testsuite/g++.target/riscv/rvv/base/pr109244.C index eebfc23..b0ce04f 100644 --- a/gcc/testsuite/g++.target/riscv/rvv/base/pr109244.C +++ b/gcc/testsuite/g++.target/riscv/rvv/base/pr109244.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64d -O2" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O2 -Wno-psabi" } */ typedef int a; using c = float; template < typename > using e = int; diff --git a/gcc/testsuite/g++.target/riscv/rvv/base/pr109535.C b/gcc/testsuite/g++.target/riscv/rvv/base/pr109535.C index 7013cfc..aec613f 100644 --- a/gcc/testsuite/g++.target/riscv/rvv/base/pr109535.C +++ b/gcc/testsuite/g++.target/riscv/rvv/base/pr109535.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -Wno-psabi" } */ typedef long size_t; typedef signed char int8_t; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr110266.c b/gcc/testsuite/gcc.c-torture/compile/pr110266.c new file mode 100644 index 0000000..92af0c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr110266.c @@ -0,0 +1,9 @@ +double PsyBufferUpdate(int n) +{ + if (n == 4) + { + _Complex double t = __builtin_cexpi(n); + return __real t * __imag t; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr101188.c b/gcc/testsuite/gcc.c-torture/execute/pr101188.c new file mode 100644 index 0000000..1bdb50b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr101188.c @@ -0,0 +1,61 @@ +/* { dg-require-effective-target indirect_calls } */ +typedef __UINT8_TYPE__ uint8_t; +typedef __UINT16_TYPE__ uint16_t; + +typedef uint8_t (*fn1)(void *a); +typedef void (*fn2)(void *a, int *arg); + +struct S +{ + uint8_t buffer[64]; + uint16_t n; + fn2 f2; + void *a; + fn1 f1; +}; + +volatile uint16_t x; + +void __attribute__((__noinline__,__noclone__)) +foo (uint16_t n) +{ + x = n; +} + +void __attribute__((__noinline__,__noclone__)) +testfn (struct S *self) +{ + int arg; + + foo (self->n); + self->n++; + self->f2 (self->a, &arg); + self->buffer[0] = self->f1 (self->a); +} + +static unsigned char myfn2_called = 0; + +static void +myfn2 (void *a, int *arg) +{ + myfn2_called = 1; +} + +static uint8_t +myfn1 (void *a) +{ + return 0; +} + +int main (void) +{ + struct S s; + s.n = 0; + s.f2 = myfn2; + s.f1 = myfn1; + testfn (&s); + if (myfn2_called != 1) + __builtin_abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/pr110266.c b/gcc/testsuite/gcc.dg/pr110266.c new file mode 100644 index 0000000..0b2acb5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr110266.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include <math.h> + +int Hann_i, PsyBufferUpdate_psyInfo_0, PsyBufferUpdate_i; +double *mdct_data; +double PsyBufferUpdate_sfreq; +void PsyBufferUpdate() { + if (PsyBufferUpdate_psyInfo_0 == 4) + for (; Hann_i;) + ; + { + double xr_0 = cos(PsyBufferUpdate_psyInfo_0); + PsyBufferUpdate_sfreq = sin(PsyBufferUpdate_psyInfo_0); + for (; PsyBufferUpdate_psyInfo_0; PsyBufferUpdate_i++) + mdct_data[PsyBufferUpdate_i] = xr_0 * PsyBufferUpdate_sfreq; + } +} + diff --git a/gcc/testsuite/gcc.dg/spellcheck-inttypes.c b/gcc/testsuite/gcc.dg/spellcheck-inttypes.c index 611d7f0..24e0754 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-inttypes.c +++ b/gcc/testsuite/gcc.dg/spellcheck-inttypes.c @@ -17,66 +17,66 @@ uintptr_t up; /* As an identifier. */ const char *hex8_fmt = PRIx8; /* { dg-error "'PRIx8' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx8' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx8' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *hex16_fmt = PRIx16; /* { dg-error "'PRIx16' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx16' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx16' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *hex32_fmt = PRIx32; /* { dg-error "'PRIx32' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx32' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx32' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *hex64_fmt = PRIx64; /* { dg-error "'PRIx64' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIx64' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIx64' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *hexptr_fmt = PRIxPTR; /* { dg-error "'PRIxPTR' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIxPTR' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIxPTR' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ /* As a part of a string-literal. */ const char *dec8msg_fmt = "Provide %" PRId8 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId8' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId8' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *dec16msg_fmt = "Provide %" PRId16 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId16' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId16' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *dec32msg_fmt = "Provide %" PRId32 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId32' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId32' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *dec64msg_fmt = "Provide %" PRId64 "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRId64' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId64' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ const char *decptrmsg_fmt = "Provide %" PRIdPTR "\n"; /* { dg-error "expected" "expected string-literal" { target *-*-* } } */ -/* { dg-message "'PRIdPTR' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIdPTR' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ void test_printf (void) { printf ("some format strings %s, %s, %s, %s, %s, %s\n", PRId8, /* { dg-error "'PRId8' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRId8' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRId8' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ PRIi16, /* { dg-error "'PRIi16' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIi16' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIi16' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ PRIo32, /* { dg-error "'PRIo32' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIo32' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo32' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ PRIu64, /* { dg-error "'PRIu64' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIu64' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIu64' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ PRIoPTR); /* { dg-error "'PRIoPTR' undeclared" "undeclared identifier" { target *-*-* } } */ -/* { dg-message "'PRIoPTR' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIoPTR' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo8 "\n", i8); /* { dg-error "expected" } */ -/* { dg-message "'PRIo8' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo8' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo16 "\n", i16); /* { dg-error "expected" } */ -/* { dg-message "'PRIo16' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo16' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo32 "\n", i32); /* { dg-error "expected" } */ -/* { dg-message "'PRIo32' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo32' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIo64 "\n", i64); /* { dg-error "expected" } */ -/* { dg-message "'PRIo64' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIo64' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ printf ("%" PRIoPTR "\n", ip); /* { dg-error "expected" } */ -/* { dg-message "'PRIoPTR' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'PRIoPTR' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ } void test_scanf (void) { scanf ("%" SCNu8 "\n", &i8); /* { dg-error "expected" } */ -/* { dg-message "'SCNu8' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu8' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNu16 "\n", &i16); /* { dg-error "expected" } */ -/* { dg-message "'SCNu16' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu16' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNu32 "\n", &i32); /* { dg-error "expected" } */ -/* { dg-message "'SCNu32' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu32' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNu64 "\n", &i64); /* { dg-error "expected" } */ -/* { dg-message "'SCNu64' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNu64' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNuPTR "\n", &ip); /* { dg-error "expected" } */ -/* { dg-message "'SCNuPTR' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNuPTR' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ scanf ("%" SCNxPTR "\n", &up); /* { dg-error "expected" } */ -/* { dg-message "'SCNxPTR' is defined in header '<inttypes.h>'; did you forget to '#include <inttypes.h>'?" "replacement note" { target *-*-* } .-1 } */ +/* { dg-message "'SCNxPTR' is defined in header '<inttypes.h>'; this is probably fixable by adding '#include <inttypes.h>'" "replacement note" { target *-*-* } .-1 } */ } diff --git a/gcc/testsuite/gcc.dg/spellcheck-stdbool.c b/gcc/testsuite/gcc.dg/spellcheck-stdbool.c index 01f12da..088896b 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-stdbool.c +++ b/gcc/testsuite/gcc.dg/spellcheck-stdbool.c @@ -2,16 +2,16 @@ /* Missing <stdbool.h>. */ bool b; /* { dg-error "unknown type name 'bool'" } */ -/* { dg-message "'bool' is defined in header '<stdbool.h>'; did you forget to '#include <stdbool.h>'?" "" { target *-*-* } .-1 } */ +/* { dg-message "'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'" "" { target *-*-* } .-1 } */ int test_true (void) { return true; /* { dg-error "'true' undeclared" } */ - /* { dg-message "'true' is defined in header '<stdbool.h>'; did you forget to '#include <stdbool.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'" "" { target *-*-* } .-1 } */ } int test_false (void) { return false; /* { dg-error "'false' undeclared" } */ - /* { dg-message "'false' is defined in header '<stdbool.h>'; did you forget to '#include <stdbool.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'" "" { target *-*-* } .-1 } */ } diff --git a/gcc/testsuite/gcc.dg/spellcheck-stdint.c b/gcc/testsuite/gcc.dg/spellcheck-stdint.c index 852c869..f891594 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-stdint.c +++ b/gcc/testsuite/gcc.dg/spellcheck-stdint.c @@ -2,61 +2,61 @@ /* Missing <stdint.h>. */ char c = INT8_MAX; // { dg-error "'INT8_MAX' undeclared" } -// { dg-message "'INT8_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT8_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } short s = INT16_MAX; // { dg-error "'INT16_MAX' undeclared" } -// { dg-message "'INT16_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT16_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } int i = INT32_MAX; // { dg-error "'INT32_MAX' undeclared" } -// { dg-message "'INT32_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT32_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } long l = INT64_MAX; // { dg-error "'INT64_MAX' undeclared" } -// { dg-message "'INT64_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'INT64_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } intptr_t test_intptr (void) // { dg-error "unknown type name 'intptr_t'" } -// { dg-message "'intptr_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'intptr_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } { return INTPTR_MAX; // { dg-error "'INTPTR_MAX' undeclared" } -// { dg-message "'INTPTR_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'INTPTR_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } } uintptr_t test_uintptr (void) // { dg-error "unknown type name 'uintptr_t'" } -// { dg-message "'uintptr_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'uintptr_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } { return UINTPTR_MAX; // { dg-error "'UINTPTR_MAX' undeclared" } -// { dg-message "'UINTPTR_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'UINTPTR_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } } int8_t i8; // { dg-error "unknown type name 'int8_t'" } -// { dg-message "'int8_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'int8_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } int16_t i16; // { dg-error "unknown type name 'int16_t'" } -// { dg-message "'int16_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'int16_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } int32_t i32; // { dg-error "unknown type name 'int32_t'" } -// { dg-message "'int32_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'int32_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } int64_t i64; // { dg-error "unknown type name 'int64_t'" } -// { dg-message "'int64_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } +// { dg-message "'int64_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } void test_uint_t (void) { char bu8[(unsigned int)UINT8_MAX]; // { dg-error "'UINT8_MAX' undeclared" } - // { dg-message "'UINT8_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT8_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } char bu16[(unsigned int)UINT16_MAX]; // { dg-error "'UINT16_MAX' undeclared" } - // { dg-message "'UINT16_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT16_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } char bu32[(unsigned int)UINT32_MAX]; // { dg-error "'UINT32_MAX' undeclared" } - // { dg-message "'UINT32_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT32_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } char bu64[(unsigned int)UINT64_MAX]; // { dg-error "'UINT64_MAX' undeclared" } - // { dg-message "'UINT64_MAX' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-1 } + // { dg-message "'UINT64_MAX' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-1 } char ui8 = (uint8_t) 8; // { dg-error "'uint8_t' undeclared" } // { dg-error "expected" "" { target *-*-* } .-1 } - // { dg-message "'uint8_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-2 } + // { dg-message "'uint8_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-2 } short ui16 = (uint16_t) 16; // { dg-error "'uint16_t' undeclared" } // { dg-error "expected" "" { target *-*-* } .-1 } - // { dg-message "'uint16_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-2 } + // { dg-message "'uint16_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-2 } int ui32 = (uint32_t) 32; // { dg-error "'uint32_t' undeclared" } // { dg-error "expected" "" { target *-*-* } .-1 } - // { dg-message "'uint32_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-2 } + // { dg-message "'uint32_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-2 } long ui64 = (uint64_t) 64; // { dg-error "'uint64_t' undeclared" } // { dg-error "expected" "" { target *-*-* } .-1 } - // { dg-message "'uint64_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?" "" { target *-*-* } .-2 } + // { dg-message "'uint64_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'" "" { target *-*-* } .-2 } } diff --git a/gcc/testsuite/gcc.dg/spellcheck-stdlib.c b/gcc/testsuite/gcc.dg/spellcheck-stdlib.c index 7297a92..3459fad 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-stdlib.c +++ b/gcc/testsuite/gcc.dg/spellcheck-stdlib.c @@ -1,41 +1,41 @@ /* Missing <stddef.h>. */ void *ptr = NULL; /* { dg-error "'NULL' undeclared here" } */ -/* { dg-message "'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?" "" { target *-*-* } .-1 } */ +/* { dg-message "'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */ ptrdiff_t pd; /* { dg-error "unknown type name 'ptrdiff_t'" } */ -/* { dg-message "'ptrdiff_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?" "" { target *-*-* } .-1 } */ +/* { dg-message "'ptrdiff_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */ wchar_t wc; /* { dg-error "unknown type name 'wchar_t'" } */ -/* { dg-message "'wchar_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?" "" { target *-*-* } .-1 } */ +/* { dg-message "'wchar_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */ size_t sz; /* { dg-error "unknown type name 'size_t'" } */ -/* { dg-message "'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?" "" { target *-*-* } .-1 } */ +/* { dg-message "'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */ /* Missing <stdio.h>. */ void test_stdio_h (void) { FILE *f; /* { dg-error "unknown type name 'FILE'" } */ - /* { dg-message "'FILE' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'FILE' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */ char buf[BUFSIZ]; /* { dg-error "'BUFSIZ' undeclared" } */ - /* { dg-message "'BUFSIZ' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'BUFSIZ' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */ char buf2[FILENAME_MAX]; /* { dg-error "'FILENAME_MAX' undeclared" } */ - /* { dg-message "'FILENAME_MAX' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'FILENAME_MAX' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */ stderr; /* { dg-error "'stderr' undeclared" } */ - /* { dg-message "'stderr' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'stderr' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */ stdin; /* { dg-error "'stdin' undeclared" } */ - /* { dg-message "'stdin' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */ stdout; /* { dg-error "'stdout' undeclared" } */ - /* { dg-message "'stdout' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'stdout' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */ EOF; /* { dg-error "'EOF' undeclared" } */ - /* { dg-message "'EOF' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */ } /* Missing <stdlib.h>. */ @@ -43,9 +43,9 @@ void test_stdio_h (void) void test_stdlib (int i) { i = EXIT_SUCCESS; /* { dg-error "'EXIT_SUCCESS' undeclared" } */ - /* { dg-message "'EXIT_SUCCESS' is defined in header '<stdlib.h>'; did you forget to '#include <stdlib.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'EXIT_SUCCESS' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'" "" { target *-*-* } .-1 } */ i = EXIT_FAILURE; /* { dg-error "'EXIT_FAILURE' undeclared" } */ - /* { dg-message "'EXIT_FAILURE' is defined in header '<stdlib.h>'; did you forget to '#include <stdlib.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'EXIT_FAILURE' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'" "" { target *-*-* } .-1 } */ } /* Missing <errno.h>. */ @@ -53,7 +53,7 @@ void test_stdlib (int i) int test_errno_h (void) { return errno; /* { dg-error "'errno' undeclared" } */ - /* { dg-message "'errno' is defined in header '<errno.h>'; did you forget to '#include <errno.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'errno' is defined in header '<errno.h>'; this is probably fixable by adding '#include <errno.h>'" "" { target *-*-* } .-1 } */ } /* Missing <stdarg.h>. */ @@ -61,7 +61,7 @@ int test_errno_h (void) void test_stdarg_h (void) { va_list ap; /* { dg-error "unknown type name 'va_list'" } */ - /* { dg-message "'va_list' is defined in header '<stdarg.h>'; did you forget to '#include <stdarg.h>'?" "" { target *-*-* } .-1 } */ + /* { dg-message "'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'" "" { target *-*-* } .-1 } */ } /* Missing <limits.h>. */ @@ -70,10 +70,10 @@ int test_INT_MAX (void) return INT_MAX; /* { dg-line INT_MAX_line } */ /* { dg-error "'INT_MAX' undeclared" "" { target *-*-* } INT_MAX_line } */ /* { dg-bogus "__INT_MAX__" "" { target *-*-* } INT_MAX_line } */ - /* { dg-message "'INT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?" "" { target *-*-* } INT_MAX_line } */ + /* { dg-message "'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'" "" { target *-*-* } INT_MAX_line } */ } /* Missing <float.h>. */ float test_FLT_MAX = FLT_MAX; /* { dg-line FLT_MAX_line } */ /* { dg-error "'FLT_MAX' undeclared" "" { target *-*-* } FLT_MAX_line } */ -/* { dg-message "'FLT_MAX' is defined in header '<float.h>'; did you forget to '#include <float.h>'?" "" { target *-*-* } FLT_MAX_line } */ +/* { dg-message "'FLT_MAX' is defined in header '<float.h>'; this is probably fixable by adding '#include <float.h>'" "" { target *-*-* } FLT_MAX_line } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr110269.c b/gcc/testsuite/gcc.dg/tree-ssa/pr110269.c new file mode 100644 index 0000000..c68a6f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr110269.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ccp2 -fdump-tree-optimized" } */ + +void foo(void); +static int a = 1, c; +static int *b = &a; +static int **d = &b; +static int ***e = &d; +void __assert_fail() __attribute__((__noreturn__)); +static int f() { + if (a) return a; + for (; c;) *e = 0; + if (b) __assert_fail(); + return 6; +} +int main() { + if (f()) { + *d = 0; + if (b == 0) + ; + else { + __builtin_unreachable(); + __assert_fail(); + } + } + if (b == 0) + ; + else + foo(); + ; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 2 "ccp2" } } */ +/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd.h b/gcc/testsuite/gcc.target/aarch64/abd.h new file mode 100644 index 0000000..b95fd90 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd.h @@ -0,0 +1,68 @@ +#ifdef ABD_IDIOM + +#define TEST1(S, TYPE) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE (S TYPE * restrict a, \ + S TYPE * restrict b, \ + S TYPE * restrict out) { \ + for (int i = 0; i < N; i++) { \ + signed TYPE diff = b[i] - a[i]; \ + out[i] = diff > 0 ? diff : -diff; \ +} } + +#define TEST2(S, TYPE1, TYPE2) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE1##_##TYPE2 \ + (S TYPE1 * restrict a, \ + S TYPE1 * restrict b, \ + S TYPE2 * restrict out) { \ + for (int i = 0; i < N; i++) { \ + signed TYPE2 diff = b[i] - a[i]; \ + out[i] = diff > 0 ? diff : -diff; \ +} } + +#define TEST3(S, TYPE1, TYPE2, TYPE3) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE2##_##TYPE3 \ + (S TYPE1 * restrict a, \ + S TYPE2 * restrict b, \ + S TYPE3 * restrict out) { \ + for (int i = 0; i < N; i++) { \ + signed TYPE3 diff = b[i] - a[i]; \ + out[i] = diff > 0 ? diff : -diff; \ +} } + +#endif + +#ifdef ABD_ABS + +#define TEST1(S, TYPE) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE (S TYPE * restrict a, \ + S TYPE * restrict b, \ + S TYPE * restrict out) { \ + for (int i = 0; i < N; i++) \ + out[i] = __builtin_abs(a[i] - b[i]); \ +} + +#define TEST2(S, TYPE1, TYPE2) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE1##_##TYPE2 \ + (S TYPE1 * restrict a, \ + S TYPE1 * restrict b, \ + S TYPE2 * restrict out) { \ + for (int i = 0; i < N; i++) \ + out[i] = __builtin_abs(a[i] - b[i]); \ +} + +#define TEST3(S, TYPE1, TYPE2, TYPE3) \ +__attribute__((noipa)) \ +void fn_##S##_##TYPE1##_##TYPE2##_##TYPE3 \ + (S TYPE1 * restrict a, \ + S TYPE2 * restrict b, \ + S TYPE3 * restrict out) { \ + for (int i = 0; i < N; i++) \ + out[i] = __builtin_abs(a[i] - b[i]); \ +} + +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/abd_2.c b/gcc/testsuite/gcc.target/aarch64/abd_2.c new file mode 100644 index 0000000..c0d41fb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_2.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, short) +TEST2(signed, char, int) +TEST2(signed, short, int) + +TEST3(signed, char, int, short) +TEST3(signed, char, short, int) + +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s" 5 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 4 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_3.c b/gcc/testsuite/gcc.target/aarch64/abd_3.c new file mode 100644 index 0000000..4873c64 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_3.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ + +#pragma GCC target "arch=armv8-a" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, short) +TEST2(signed, char, int) +TEST2(signed, short, int) + +TEST3(signed, char, int, short) +TEST3(signed, char, short, int) + +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s" 5 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 4 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 4 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_4.c b/gcc/testsuite/gcc.target/aarch64/abd_4.c new file mode 100644 index 0000000..98aa730 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_4.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_IDIOM +#include "abd.h" + +TEST1(signed, int) + +TEST2(signed, char, short) +TEST2(signed, char, int) +TEST2(signed, short, int) + +TEST3(signed, char, short, int) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s" 1 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 3 } } */ +/* { dg-final { scan-assembler-times "sabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 2 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 2 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_none_2.c b/gcc/testsuite/gcc.target/aarch64/abd_none_2.c new file mode 100644 index 0000000..658e742 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_none_2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(unsigned, int) +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_none_3.c b/gcc/testsuite/gcc.target/aarch64/abd_none_3.c new file mode 100644 index 0000000..14cfdcb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_none_3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ + +#pragma GCC target "arch=armv8-a" +#define N 1024 + +#define ABD_ABS +#include "abd.h" + +TEST1(unsigned, int) +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_none_4.c b/gcc/testsuite/gcc.target/aarch64/abd_none_4.c new file mode 100644 index 0000000..d612216 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_none_4.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 1024 + +#define ABD_IDIOM +#include "abd.h" + +TEST1(signed, short) +TEST1(signed, char) + +TEST3(signed, char, int, short) + +TEST1(unsigned, int) +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/abd_run_1.c b/gcc/testsuite/gcc.target/aarch64/abd_run_1.c new file mode 100644 index 0000000..7bb0a80 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/abd_run_1.c @@ -0,0 +1,93 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" +#define N 16 + +#define ABD_ABS +#include "abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST1(unsigned, int) +TEST1(unsigned, short) +TEST1(unsigned, char) + +#define EMPTY { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +#define sA { -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50 } +#define uA { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 } +#define B { 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 } +#define GOLD { 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75 } + +typedef signed char s8; +typedef unsigned char u8; +typedef signed short s16; +typedef unsigned short u16; +typedef signed int s32; +typedef unsigned int u32; + +s8 sc_out[] = EMPTY; +u8 uc_out[] = EMPTY; +s16 ss_out[] = EMPTY; +u16 us_out[] = EMPTY; +s32 si_out[] = EMPTY; +u32 ui_out[] = EMPTY; + +s8 sc_A[] = sA; +s8 sc_B[] = B; +u8 uc_A[] = uA; +u8 uc_B[] = B; + +s16 ss_A[] = sA; +s16 ss_B[] = B; +u16 us_A[] = uA; +u16 us_B[] = B; + +s32 si_A[] = sA; +s32 si_B[] = B; +u32 ui_A[] = uA; +u32 ui_B[] = B; + +s8 sc_gold[] = GOLD; +u8 uc_gold[] = GOLD; +s16 ss_gold[] = GOLD; +u16 us_gold[] = GOLD; +s32 si_gold[] = GOLD; +u32 ui_gold[] = GOLD; + +extern void abort (void); + +#define CLEAR(arr) \ +for (int i = 0; i < N; i++) \ + arr[i] = 0; + +#define COMPARE(A, B) \ +for (int i = 0; i < N; i++) \ + if (A[i] != B[i]) \ + abort(); + +int main () +{ + fn_signed_char (sc_A, sc_B, sc_out); + COMPARE (sc_out, sc_gold); + + fn_unsigned_char (uc_A, uc_B, uc_out); + COMPARE (uc_out, uc_gold); + + fn_signed_short (ss_A, ss_B, ss_out); + COMPARE (ss_out, ss_gold) + + fn_unsigned_short (us_A, us_B, us_out); + COMPARE (us_out, us_gold) + + fn_signed_int (si_A, si_B, si_out); + COMPARE (si_out, si_gold); + + fn_unsigned_int (ui_A, ui_B, ui_out); + COMPARE (ui_out, ui_gold); + + return 0; +} + diff --git a/gcc/testsuite/gcc.target/aarch64/mtp_5.c b/gcc/testsuite/gcc.target/aarch64/mtp_5.c new file mode 100644 index 0000000..72bd861 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mtp_5.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidrro_el0" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrs\tx[0-9]+, tpidrro_el0} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mtp_6.c b/gcc/testsuite/gcc.target/aarch64/mtp_6.c new file mode 100644 index 0000000..0cdee12 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mtp_6.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidr_el0" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrs\tx[0-9]+, tpidr_el0} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mtp_7.c b/gcc/testsuite/gcc.target/aarch64/mtp_7.c new file mode 100644 index 0000000..2e4a1a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mtp_7.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidr_el1" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrs\tx[0-9]+, tpidr_el1} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mtp_8.c b/gcc/testsuite/gcc.target/aarch64/mtp_8.c new file mode 100644 index 0000000..810fe38 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mtp_8.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidr_el2" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrs\tx[0-9]+, tpidr_el2} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mtp_9.c b/gcc/testsuite/gcc.target/aarch64/mtp_9.c new file mode 100644 index 0000000..934cc18 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mtp_9.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidr_el3" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrs\tx[0-9]+, tpidr_el3} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_1.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_1.c new file mode 100644 index 0000000..e49006f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_1.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_ABS +#include "../abd.h" + +TEST1(signed, int) +TEST1(signed, short) +TEST1(signed, char) + +TEST2(signed, char, int) +TEST2(signed, char, short) +TEST2(signed, short, int) + +TEST3(signed, char, int, short) +TEST3(signed, char, short, int) + +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST2(unsigned, char, short) +TEST2(unsigned, char, int) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.s, p\[0-9\]/m, z\[0-9\]+\.s, z\[0-9\]+\.s" 2 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 3 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 3 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 3 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_2.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_2.c new file mode 100644 index 0000000..ea64fa8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_2.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_IDIOM +#include "../abd.h" + +TEST1(signed, int) + +TEST2(signed, char, int) +TEST2(signed, char, short) +TEST2(signed, short, int) + +TEST3(signed, char, short, int) + +TEST2(unsigned, char, int) +TEST2(unsigned, char, short) +TEST2(unsigned, short, int) + +TEST3(unsigned, char, short, int) + +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.s, p\[0-9\]/m, z\[0-9\]+\.s, z\[0-9\]+\.s" 1 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 2 } } */ +/* { dg-final { scan-assembler-times "sabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 2 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.h, p\[0-9\]/m, z\[0-9\]+\.h, z\[0-9\]+\.h" 2 } } */ +/* { dg-final { scan-assembler-times "uabd\\tz\[0-9\]+\.b, p\[0-9\]/m, z\[0-9\]+\.b, z\[0-9\]+\.b" 2 } } */ + +/* { dg-final { scan-assembler-not {\tabs\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_none_1.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_1.c new file mode 100644 index 0000000..a4c2053c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_ABS +#include "../abd.h" + +TEST1(unsigned, int) +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/abd_none_2.c b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_2.c new file mode 100644 index 0000000..4862db9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/abd_none_2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#define N 1024 + +#define ABD_IDIOM +#include "../abd.h" + +TEST1(signed, short) +TEST1(signed, char) + +TEST3(signed, char, int, short) + +TEST1(unsigned, int) +TEST1(unsigned, short) +TEST1(unsigned, char) + +TEST3(unsigned, char, int, short) + +/* { dg-final { scan-assembler-not {\tsabd\t} } } */ +/* { dg-final { scan-assembler-not {\tuabd\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast.c new file mode 100644 index 0000000..fdbe5e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast.c @@ -0,0 +1,63 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -msve-vector-bits=256" } */ + +#include <stdint.h> +#include "arm_sve.h" + +#define NAME(name, size, pat, sign, ab) \ + name ## _ ## size ## _ ## pat ## _ ## sign ## _ ## ab + +#define NAMEF(name, size, pat, sign, ab) \ + name ## _ ## size ## _ ## pat ## _ ## sign ## _ ## ab ## _false + +#define SVTYPE(size, sign) \ + sv ## sign ## int ## size ## _t + +#define STYPE(size, sign) sign ## int ## size ##_t + +#define SVELAST_DEF(size, pat, sign, ab, su) \ + STYPE (size, sign) __attribute__((noinline)) \ + NAME (foo, size, pat, sign, ab) (SVTYPE (size, sign) x) \ + { \ + return svlast ## ab (svptrue_pat_b ## size (pat), x); \ + } \ + STYPE (size, sign) __attribute__((noinline)) \ + NAMEF (foo, size, pat, sign, ab) (SVTYPE (size, sign) x) \ + { \ + return svlast ## ab (svpfalse (), x); \ + } + +#define ALL_PATS(SIZE, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL1, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL2, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL3, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL4, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL5, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL6, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL7, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL8, SIGN, AB, SU) \ + SVELAST_DEF (SIZE, SV_VL16, SIGN, AB, SU) + +#define ALL_SIGN(SIZE, AB) \ + ALL_PATS (SIZE, , AB, s) \ + ALL_PATS (SIZE, u, AB, u) + +#define ALL_SIZE(AB) \ + ALL_SIGN (8, AB) \ + ALL_SIGN (16, AB) \ + ALL_SIGN (32, AB) \ + ALL_SIGN (64, AB) + +#define ALL_POS() \ + ALL_SIZE (a) \ + ALL_SIZE (b) + + +ALL_POS() + +/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.b} 52 } } */ +/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.h} 50 } } */ +/* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s} 12 } } */ +/* { dg-final { scan-assembler-times {\tfmov\tw0, s0} 24 } } */ +/* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d} 4 } } */ +/* { dg-final { scan-assembler-times {\tfmov\tx0, d0} 32 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast128_run.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast128_run.c new file mode 100644 index 0000000..5e1e930 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast128_run.c @@ -0,0 +1,313 @@ +/* { dg-do run { target aarch64_sve128_hw } } */ +/* { dg-options "-O3 -msve-vector-bits=128 -std=gnu99" } */ + +#include "svlast.c" + +int +main (void) +{ + int8_t res_8_SV_VL1__a = 1; + int8_t res_8_SV_VL2__a = 2; + int8_t res_8_SV_VL3__a = 3; + int8_t res_8_SV_VL4__a = 4; + int8_t res_8_SV_VL5__a = 5; + int8_t res_8_SV_VL6__a = 6; + int8_t res_8_SV_VL7__a = 7; + int8_t res_8_SV_VL8__a = 8; + int8_t res_8_SV_VL16__a = 0; + uint8_t res_8_SV_VL1_u_a = 1; + uint8_t res_8_SV_VL2_u_a = 2; + uint8_t res_8_SV_VL3_u_a = 3; + uint8_t res_8_SV_VL4_u_a = 4; + uint8_t res_8_SV_VL5_u_a = 5; + uint8_t res_8_SV_VL6_u_a = 6; + uint8_t res_8_SV_VL7_u_a = 7; + uint8_t res_8_SV_VL8_u_a = 8; + uint8_t res_8_SV_VL16_u_a = 0; + int16_t res_16_SV_VL1__a = 1; + int16_t res_16_SV_VL2__a = 2; + int16_t res_16_SV_VL3__a = 3; + int16_t res_16_SV_VL4__a = 4; + int16_t res_16_SV_VL5__a = 5; + int16_t res_16_SV_VL6__a = 6; + int16_t res_16_SV_VL7__a = 7; + int16_t res_16_SV_VL8__a = 0; + int16_t res_16_SV_VL16__a = 0; + uint16_t res_16_SV_VL1_u_a = 1; + uint16_t res_16_SV_VL2_u_a = 2; + uint16_t res_16_SV_VL3_u_a = 3; + uint16_t res_16_SV_VL4_u_a = 4; + uint16_t res_16_SV_VL5_u_a = 5; + uint16_t res_16_SV_VL6_u_a = 6; + uint16_t res_16_SV_VL7_u_a = 7; + uint16_t res_16_SV_VL8_u_a = 0; + uint16_t res_16_SV_VL16_u_a = 0; + int32_t res_32_SV_VL1__a = 1; + int32_t res_32_SV_VL2__a = 2; + int32_t res_32_SV_VL3__a = 3; + int32_t res_32_SV_VL4__a = 0; + int32_t res_32_SV_VL5__a = 0; + int32_t res_32_SV_VL6__a = 0; + int32_t res_32_SV_VL7__a = 0; + int32_t res_32_SV_VL8__a = 0; + int32_t res_32_SV_VL16__a = 0; + uint32_t res_32_SV_VL1_u_a = 1; + uint32_t res_32_SV_VL2_u_a = 2; + uint32_t res_32_SV_VL3_u_a = 3; + uint32_t res_32_SV_VL4_u_a = 0; + uint32_t res_32_SV_VL5_u_a = 0; + uint32_t res_32_SV_VL6_u_a = 0; + uint32_t res_32_SV_VL7_u_a = 0; + uint32_t res_32_SV_VL8_u_a = 0; + uint32_t res_32_SV_VL16_u_a = 0; + int64_t res_64_SV_VL1__a = 1; + int64_t res_64_SV_VL2__a = 0; + int64_t res_64_SV_VL3__a = 0; + int64_t res_64_SV_VL4__a = 0; + int64_t res_64_SV_VL5__a = 0; + int64_t res_64_SV_VL6__a = 0; + int64_t res_64_SV_VL7__a = 0; + int64_t res_64_SV_VL8__a = 0; + int64_t res_64_SV_VL16__a = 0; + uint64_t res_64_SV_VL1_u_a = 1; + uint64_t res_64_SV_VL2_u_a = 0; + uint64_t res_64_SV_VL3_u_a = 0; + uint64_t res_64_SV_VL4_u_a = 0; + uint64_t res_64_SV_VL5_u_a = 0; + uint64_t res_64_SV_VL6_u_a = 0; + uint64_t res_64_SV_VL7_u_a = 0; + uint64_t res_64_SV_VL8_u_a = 0; + uint64_t res_64_SV_VL16_u_a = 0; + int8_t res_8_SV_VL1__b = 0; + int8_t res_8_SV_VL2__b = 1; + int8_t res_8_SV_VL3__b = 2; + int8_t res_8_SV_VL4__b = 3; + int8_t res_8_SV_VL5__b = 4; + int8_t res_8_SV_VL6__b = 5; + int8_t res_8_SV_VL7__b = 6; + int8_t res_8_SV_VL8__b = 7; + int8_t res_8_SV_VL16__b = 15; + uint8_t res_8_SV_VL1_u_b = 0; + uint8_t res_8_SV_VL2_u_b = 1; + uint8_t res_8_SV_VL3_u_b = 2; + uint8_t res_8_SV_VL4_u_b = 3; + uint8_t res_8_SV_VL5_u_b = 4; + uint8_t res_8_SV_VL6_u_b = 5; + uint8_t res_8_SV_VL7_u_b = 6; + uint8_t res_8_SV_VL8_u_b = 7; + uint8_t res_8_SV_VL16_u_b = 15; + int16_t res_16_SV_VL1__b = 0; + int16_t res_16_SV_VL2__b = 1; + int16_t res_16_SV_VL3__b = 2; + int16_t res_16_SV_VL4__b = 3; + int16_t res_16_SV_VL5__b = 4; + int16_t res_16_SV_VL6__b = 5; + int16_t res_16_SV_VL7__b = 6; + int16_t res_16_SV_VL8__b = 7; + int16_t res_16_SV_VL16__b = 7; + uint16_t res_16_SV_VL1_u_b = 0; + uint16_t res_16_SV_VL2_u_b = 1; + uint16_t res_16_SV_VL3_u_b = 2; + uint16_t res_16_SV_VL4_u_b = 3; + uint16_t res_16_SV_VL5_u_b = 4; + uint16_t res_16_SV_VL6_u_b = 5; + uint16_t res_16_SV_VL7_u_b = 6; + uint16_t res_16_SV_VL8_u_b = 7; + uint16_t res_16_SV_VL16_u_b = 7; + int32_t res_32_SV_VL1__b = 0; + int32_t res_32_SV_VL2__b = 1; + int32_t res_32_SV_VL3__b = 2; + int32_t res_32_SV_VL4__b = 3; + int32_t res_32_SV_VL5__b = 3; + int32_t res_32_SV_VL6__b = 3; + int32_t res_32_SV_VL7__b = 3; + int32_t res_32_SV_VL8__b = 3; + int32_t res_32_SV_VL16__b = 3; + uint32_t res_32_SV_VL1_u_b = 0; + uint32_t res_32_SV_VL2_u_b = 1; + uint32_t res_32_SV_VL3_u_b = 2; + uint32_t res_32_SV_VL4_u_b = 3; + uint32_t res_32_SV_VL5_u_b = 3; + uint32_t res_32_SV_VL6_u_b = 3; + uint32_t res_32_SV_VL7_u_b = 3; + uint32_t res_32_SV_VL8_u_b = 3; + uint32_t res_32_SV_VL16_u_b = 3; + int64_t res_64_SV_VL1__b = 0; + int64_t res_64_SV_VL2__b = 1; + int64_t res_64_SV_VL3__b = 1; + int64_t res_64_SV_VL4__b = 1; + int64_t res_64_SV_VL5__b = 1; + int64_t res_64_SV_VL6__b = 1; + int64_t res_64_SV_VL7__b = 1; + int64_t res_64_SV_VL8__b = 1; + int64_t res_64_SV_VL16__b = 1; + uint64_t res_64_SV_VL1_u_b = 0; + uint64_t res_64_SV_VL2_u_b = 1; + uint64_t res_64_SV_VL3_u_b = 1; + uint64_t res_64_SV_VL4_u_b = 1; + uint64_t res_64_SV_VL5_u_b = 1; + uint64_t res_64_SV_VL6_u_b = 1; + uint64_t res_64_SV_VL7_u_b = 1; + uint64_t res_64_SV_VL8_u_b = 1; + uint64_t res_64_SV_VL16_u_b = 1; + + int8_t res_8_SV_VL1__a_false = 0; + int8_t res_8_SV_VL2__a_false = 0; + int8_t res_8_SV_VL3__a_false = 0; + int8_t res_8_SV_VL4__a_false = 0; + int8_t res_8_SV_VL5__a_false = 0; + int8_t res_8_SV_VL6__a_false = 0; + int8_t res_8_SV_VL7__a_false = 0; + int8_t res_8_SV_VL8__a_false = 0; + int8_t res_8_SV_VL16__a_false = 0; + uint8_t res_8_SV_VL1_u_a_false = 0; + uint8_t res_8_SV_VL2_u_a_false = 0; + uint8_t res_8_SV_VL3_u_a_false = 0; + uint8_t res_8_SV_VL4_u_a_false = 0; + uint8_t res_8_SV_VL5_u_a_false = 0; + uint8_t res_8_SV_VL6_u_a_false = 0; + uint8_t res_8_SV_VL7_u_a_false = 0; + uint8_t res_8_SV_VL8_u_a_false = 0; + uint8_t res_8_SV_VL16_u_a_false = 0; + int16_t res_16_SV_VL1__a_false = 0; + int16_t res_16_SV_VL2__a_false = 0; + int16_t res_16_SV_VL3__a_false = 0; + int16_t res_16_SV_VL4__a_false = 0; + int16_t res_16_SV_VL5__a_false = 0; + int16_t res_16_SV_VL6__a_false = 0; + int16_t res_16_SV_VL7__a_false = 0; + int16_t res_16_SV_VL8__a_false = 0; + int16_t res_16_SV_VL16__a_false = 0; + uint16_t res_16_SV_VL1_u_a_false = 0; + uint16_t res_16_SV_VL2_u_a_false = 0; + uint16_t res_16_SV_VL3_u_a_false = 0; + uint16_t res_16_SV_VL4_u_a_false = 0; + uint16_t res_16_SV_VL5_u_a_false = 0; + uint16_t res_16_SV_VL6_u_a_false = 0; + uint16_t res_16_SV_VL7_u_a_false = 0; + uint16_t res_16_SV_VL8_u_a_false = 0; + uint16_t res_16_SV_VL16_u_a_false = 0; + int32_t res_32_SV_VL1__a_false = 0; + int32_t res_32_SV_VL2__a_false = 0; + int32_t res_32_SV_VL3__a_false = 0; + int32_t res_32_SV_VL4__a_false = 0; + int32_t res_32_SV_VL5__a_false = 0; + int32_t res_32_SV_VL6__a_false = 0; + int32_t res_32_SV_VL7__a_false = 0; + int32_t res_32_SV_VL8__a_false = 0; + int32_t res_32_SV_VL16__a_false = 0; + uint32_t res_32_SV_VL1_u_a_false = 0; + uint32_t res_32_SV_VL2_u_a_false = 0; + uint32_t res_32_SV_VL3_u_a_false = 0; + uint32_t res_32_SV_VL4_u_a_false = 0; + uint32_t res_32_SV_VL5_u_a_false = 0; + uint32_t res_32_SV_VL6_u_a_false = 0; + uint32_t res_32_SV_VL7_u_a_false = 0; + uint32_t res_32_SV_VL8_u_a_false = 0; + uint32_t res_32_SV_VL16_u_a_false = 0; + int64_t res_64_SV_VL1__a_false = 0; + int64_t res_64_SV_VL2__a_false = 0; + int64_t res_64_SV_VL3__a_false = 0; + int64_t res_64_SV_VL4__a_false = 0; + int64_t res_64_SV_VL5__a_false = 0; + int64_t res_64_SV_VL6__a_false = 0; + int64_t res_64_SV_VL7__a_false = 0; + int64_t res_64_SV_VL8__a_false = 0; + int64_t res_64_SV_VL16__a_false = 0; + uint64_t res_64_SV_VL1_u_a_false = 0; + uint64_t res_64_SV_VL2_u_a_false = 0; + uint64_t res_64_SV_VL3_u_a_false = 0; + uint64_t res_64_SV_VL4_u_a_false = 0; + uint64_t res_64_SV_VL5_u_a_false = 0; + uint64_t res_64_SV_VL6_u_a_false = 0; + uint64_t res_64_SV_VL7_u_a_false = 0; + uint64_t res_64_SV_VL8_u_a_false = 0; + uint64_t res_64_SV_VL16_u_a_false = 0; + int8_t res_8_SV_VL1__b_false = 15; + int8_t res_8_SV_VL2__b_false = 15; + int8_t res_8_SV_VL3__b_false = 15; + int8_t res_8_SV_VL4__b_false = 15; + int8_t res_8_SV_VL5__b_false = 15; + int8_t res_8_SV_VL6__b_false = 15; + int8_t res_8_SV_VL7__b_false = 15; + int8_t res_8_SV_VL8__b_false = 15; + int8_t res_8_SV_VL16__b_false = 15; + uint8_t res_8_SV_VL1_u_b_false = 15; + uint8_t res_8_SV_VL2_u_b_false = 15; + uint8_t res_8_SV_VL3_u_b_false = 15; + uint8_t res_8_SV_VL4_u_b_false = 15; + uint8_t res_8_SV_VL5_u_b_false = 15; + uint8_t res_8_SV_VL6_u_b_false = 15; + uint8_t res_8_SV_VL7_u_b_false = 15; + uint8_t res_8_SV_VL8_u_b_false = 15; + uint8_t res_8_SV_VL16_u_b_false = 15; + int16_t res_16_SV_VL1__b_false = 7; + int16_t res_16_SV_VL2__b_false = 7; + int16_t res_16_SV_VL3__b_false = 7; + int16_t res_16_SV_VL4__b_false = 7; + int16_t res_16_SV_VL5__b_false = 7; + int16_t res_16_SV_VL6__b_false = 7; + int16_t res_16_SV_VL7__b_false = 7; + int16_t res_16_SV_VL8__b_false = 7; + int16_t res_16_SV_VL16__b_false = 7; + uint16_t res_16_SV_VL1_u_b_false = 7; + uint16_t res_16_SV_VL2_u_b_false = 7; + uint16_t res_16_SV_VL3_u_b_false = 7; + uint16_t res_16_SV_VL4_u_b_false = 7; + uint16_t res_16_SV_VL5_u_b_false = 7; + uint16_t res_16_SV_VL6_u_b_false = 7; + uint16_t res_16_SV_VL7_u_b_false = 7; + uint16_t res_16_SV_VL8_u_b_false = 7; + uint16_t res_16_SV_VL16_u_b_false = 7; + int32_t res_32_SV_VL1__b_false = 3; + int32_t res_32_SV_VL2__b_false = 3; + int32_t res_32_SV_VL3__b_false = 3; + int32_t res_32_SV_VL4__b_false = 3; + int32_t res_32_SV_VL5__b_false = 3; + int32_t res_32_SV_VL6__b_false = 3; + int32_t res_32_SV_VL7__b_false = 3; + int32_t res_32_SV_VL8__b_false = 3; + int32_t res_32_SV_VL16__b_false = 3; + uint32_t res_32_SV_VL1_u_b_false = 3; + uint32_t res_32_SV_VL2_u_b_false = 3; + uint32_t res_32_SV_VL3_u_b_false = 3; + uint32_t res_32_SV_VL4_u_b_false = 3; + uint32_t res_32_SV_VL5_u_b_false = 3; + uint32_t res_32_SV_VL6_u_b_false = 3; + uint32_t res_32_SV_VL7_u_b_false = 3; + uint32_t res_32_SV_VL8_u_b_false = 3; + uint32_t res_32_SV_VL16_u_b_false = 3; + int64_t res_64_SV_VL1__b_false = 1; + int64_t res_64_SV_VL2__b_false = 1; + int64_t res_64_SV_VL3__b_false = 1; + int64_t res_64_SV_VL4__b_false = 1; + int64_t res_64_SV_VL5__b_false = 1; + int64_t res_64_SV_VL6__b_false = 1; + int64_t res_64_SV_VL7__b_false = 1; + int64_t res_64_SV_VL8__b_false = 1; + int64_t res_64_SV_VL16__b_false = 1; + uint64_t res_64_SV_VL1_u_b_false = 1; + uint64_t res_64_SV_VL2_u_b_false = 1; + uint64_t res_64_SV_VL3_u_b_false = 1; + uint64_t res_64_SV_VL4_u_b_false = 1; + uint64_t res_64_SV_VL5_u_b_false = 1; + uint64_t res_64_SV_VL6_u_b_false = 1; + uint64_t res_64_SV_VL7_u_b_false = 1; + uint64_t res_64_SV_VL8_u_b_false = 1; + uint64_t res_64_SV_VL16_u_b_false = 1; + +#undef SVELAST_DEF +#define SVELAST_DEF(size, pat, sign, ab, su) \ + if (NAME (foo, size, pat, sign, ab) \ + (svindex_ ## su ## size (0, 1)) != \ + NAME (res, size, pat, sign, ab)) \ + __builtin_abort (); \ + if (NAMEF (foo, size, pat, sign, ab) \ + (svindex_ ## su ## size (0, 1)) != \ + NAMEF (res, size, pat, sign, ab)) \ + __builtin_abort (); + + ALL_POS () + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast256_run.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast256_run.c new file mode 100644 index 0000000..f6ba7ea --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast256_run.c @@ -0,0 +1,314 @@ +/* { dg-do run { target aarch64_sve256_hw } } */ +/* { dg-options "-O3 -msve-vector-bits=256 -std=gnu99" } */ + +#include "svlast.c" + +int +main (void) +{ + int8_t res_8_SV_VL1__a = 1; + int8_t res_8_SV_VL2__a = 2; + int8_t res_8_SV_VL3__a = 3; + int8_t res_8_SV_VL4__a = 4; + int8_t res_8_SV_VL5__a = 5; + int8_t res_8_SV_VL6__a = 6; + int8_t res_8_SV_VL7__a = 7; + int8_t res_8_SV_VL8__a = 8; + int8_t res_8_SV_VL16__a = 16; + uint8_t res_8_SV_VL1_u_a = 1; + uint8_t res_8_SV_VL2_u_a = 2; + uint8_t res_8_SV_VL3_u_a = 3; + uint8_t res_8_SV_VL4_u_a = 4; + uint8_t res_8_SV_VL5_u_a = 5; + uint8_t res_8_SV_VL6_u_a = 6; + uint8_t res_8_SV_VL7_u_a = 7; + uint8_t res_8_SV_VL8_u_a = 8; + uint8_t res_8_SV_VL16_u_a = 16; + int16_t res_16_SV_VL1__a = 1; + int16_t res_16_SV_VL2__a = 2; + int16_t res_16_SV_VL3__a = 3; + int16_t res_16_SV_VL4__a = 4; + int16_t res_16_SV_VL5__a = 5; + int16_t res_16_SV_VL6__a = 6; + int16_t res_16_SV_VL7__a = 7; + int16_t res_16_SV_VL8__a = 8; + int16_t res_16_SV_VL16__a = 0; + uint16_t res_16_SV_VL1_u_a = 1; + uint16_t res_16_SV_VL2_u_a = 2; + uint16_t res_16_SV_VL3_u_a = 3; + uint16_t res_16_SV_VL4_u_a = 4; + uint16_t res_16_SV_VL5_u_a = 5; + uint16_t res_16_SV_VL6_u_a = 6; + uint16_t res_16_SV_VL7_u_a = 7; + uint16_t res_16_SV_VL8_u_a = 8; + uint16_t res_16_SV_VL16_u_a = 0; + int32_t res_32_SV_VL1__a = 1; + int32_t res_32_SV_VL2__a = 2; + int32_t res_32_SV_VL3__a = 3; + int32_t res_32_SV_VL4__a = 4; + int32_t res_32_SV_VL5__a = 5; + int32_t res_32_SV_VL6__a = 6; + int32_t res_32_SV_VL7__a = 7; + int32_t res_32_SV_VL8__a = 0; + int32_t res_32_SV_VL16__a = 0; + uint32_t res_32_SV_VL1_u_a = 1; + uint32_t res_32_SV_VL2_u_a = 2; + uint32_t res_32_SV_VL3_u_a = 3; + uint32_t res_32_SV_VL4_u_a = 4; + uint32_t res_32_SV_VL5_u_a = 5; + uint32_t res_32_SV_VL6_u_a = 6; + uint32_t res_32_SV_VL7_u_a = 7; + uint32_t res_32_SV_VL8_u_a = 0; + uint32_t res_32_SV_VL16_u_a = 0; + int64_t res_64_SV_VL1__a = 1; + int64_t res_64_SV_VL2__a = 2; + int64_t res_64_SV_VL3__a = 3; + int64_t res_64_SV_VL4__a = 0; + int64_t res_64_SV_VL5__a = 0; + int64_t res_64_SV_VL6__a = 0; + int64_t res_64_SV_VL7__a = 0; + int64_t res_64_SV_VL8__a = 0; + int64_t res_64_SV_VL16__a = 0; + uint64_t res_64_SV_VL1_u_a = 1; + uint64_t res_64_SV_VL2_u_a = 2; + uint64_t res_64_SV_VL3_u_a = 3; + uint64_t res_64_SV_VL4_u_a = 0; + uint64_t res_64_SV_VL5_u_a = 0; + uint64_t res_64_SV_VL6_u_a = 0; + uint64_t res_64_SV_VL7_u_a = 0; + uint64_t res_64_SV_VL8_u_a = 0; + uint64_t res_64_SV_VL16_u_a = 0; + int8_t res_8_SV_VL1__b = 0; + int8_t res_8_SV_VL2__b = 1; + int8_t res_8_SV_VL3__b = 2; + int8_t res_8_SV_VL4__b = 3; + int8_t res_8_SV_VL5__b = 4; + int8_t res_8_SV_VL6__b = 5; + int8_t res_8_SV_VL7__b = 6; + int8_t res_8_SV_VL8__b = 7; + int8_t res_8_SV_VL16__b = 15; + uint8_t res_8_SV_VL1_u_b = 0; + uint8_t res_8_SV_VL2_u_b = 1; + uint8_t res_8_SV_VL3_u_b = 2; + uint8_t res_8_SV_VL4_u_b = 3; + uint8_t res_8_SV_VL5_u_b = 4; + uint8_t res_8_SV_VL6_u_b = 5; + uint8_t res_8_SV_VL7_u_b = 6; + uint8_t res_8_SV_VL8_u_b = 7; + uint8_t res_8_SV_VL16_u_b = 15; + int16_t res_16_SV_VL1__b = 0; + int16_t res_16_SV_VL2__b = 1; + int16_t res_16_SV_VL3__b = 2; + int16_t res_16_SV_VL4__b = 3; + int16_t res_16_SV_VL5__b = 4; + int16_t res_16_SV_VL6__b = 5; + int16_t res_16_SV_VL7__b = 6; + int16_t res_16_SV_VL8__b = 7; + int16_t res_16_SV_VL16__b = 15; + uint16_t res_16_SV_VL1_u_b = 0; + uint16_t res_16_SV_VL2_u_b = 1; + uint16_t res_16_SV_VL3_u_b = 2; + uint16_t res_16_SV_VL4_u_b = 3; + uint16_t res_16_SV_VL5_u_b = 4; + uint16_t res_16_SV_VL6_u_b = 5; + uint16_t res_16_SV_VL7_u_b = 6; + uint16_t res_16_SV_VL8_u_b = 7; + uint16_t res_16_SV_VL16_u_b = 15; + int32_t res_32_SV_VL1__b = 0; + int32_t res_32_SV_VL2__b = 1; + int32_t res_32_SV_VL3__b = 2; + int32_t res_32_SV_VL4__b = 3; + int32_t res_32_SV_VL5__b = 4; + int32_t res_32_SV_VL6__b = 5; + int32_t res_32_SV_VL7__b = 6; + int32_t res_32_SV_VL8__b = 7; + int32_t res_32_SV_VL16__b = 7; + uint32_t res_32_SV_VL1_u_b = 0; + uint32_t res_32_SV_VL2_u_b = 1; + uint32_t res_32_SV_VL3_u_b = 2; + uint32_t res_32_SV_VL4_u_b = 3; + uint32_t res_32_SV_VL5_u_b = 4; + uint32_t res_32_SV_VL6_u_b = 5; + uint32_t res_32_SV_VL7_u_b = 6; + uint32_t res_32_SV_VL8_u_b = 7; + uint32_t res_32_SV_VL16_u_b = 7; + int64_t res_64_SV_VL1__b = 0; + int64_t res_64_SV_VL2__b = 1; + int64_t res_64_SV_VL3__b = 2; + int64_t res_64_SV_VL4__b = 3; + int64_t res_64_SV_VL5__b = 3; + int64_t res_64_SV_VL6__b = 3; + int64_t res_64_SV_VL7__b = 3; + int64_t res_64_SV_VL8__b = 3; + int64_t res_64_SV_VL16__b = 3; + uint64_t res_64_SV_VL1_u_b = 0; + uint64_t res_64_SV_VL2_u_b = 1; + uint64_t res_64_SV_VL3_u_b = 2; + uint64_t res_64_SV_VL4_u_b = 3; + uint64_t res_64_SV_VL5_u_b = 3; + uint64_t res_64_SV_VL6_u_b = 3; + uint64_t res_64_SV_VL7_u_b = 3; + uint64_t res_64_SV_VL8_u_b = 3; + uint64_t res_64_SV_VL16_u_b = 3; + + int8_t res_8_SV_VL1__a_false = 0; + int8_t res_8_SV_VL2__a_false = 0; + int8_t res_8_SV_VL3__a_false = 0; + int8_t res_8_SV_VL4__a_false = 0; + int8_t res_8_SV_VL5__a_false = 0; + int8_t res_8_SV_VL6__a_false = 0; + int8_t res_8_SV_VL7__a_false = 0; + int8_t res_8_SV_VL8__a_false = 0; + int8_t res_8_SV_VL16__a_false = 0; + uint8_t res_8_SV_VL1_u_a_false = 0; + uint8_t res_8_SV_VL2_u_a_false = 0; + uint8_t res_8_SV_VL3_u_a_false = 0; + uint8_t res_8_SV_VL4_u_a_false = 0; + uint8_t res_8_SV_VL5_u_a_false = 0; + uint8_t res_8_SV_VL6_u_a_false = 0; + uint8_t res_8_SV_VL7_u_a_false = 0; + uint8_t res_8_SV_VL8_u_a_false = 0; + uint8_t res_8_SV_VL16_u_a_false = 0; + int16_t res_16_SV_VL1__a_false = 0; + int16_t res_16_SV_VL2__a_false = 0; + int16_t res_16_SV_VL3__a_false = 0; + int16_t res_16_SV_VL4__a_false = 0; + int16_t res_16_SV_VL5__a_false = 0; + int16_t res_16_SV_VL6__a_false = 0; + int16_t res_16_SV_VL7__a_false = 0; + int16_t res_16_SV_VL8__a_false = 0; + int16_t res_16_SV_VL16__a_false = 0; + uint16_t res_16_SV_VL1_u_a_false = 0; + uint16_t res_16_SV_VL2_u_a_false = 0; + uint16_t res_16_SV_VL3_u_a_false = 0; + uint16_t res_16_SV_VL4_u_a_false = 0; + uint16_t res_16_SV_VL5_u_a_false = 0; + uint16_t res_16_SV_VL6_u_a_false = 0; + uint16_t res_16_SV_VL7_u_a_false = 0; + uint16_t res_16_SV_VL8_u_a_false = 0; + uint16_t res_16_SV_VL16_u_a_false = 0; + int32_t res_32_SV_VL1__a_false = 0; + int32_t res_32_SV_VL2__a_false = 0; + int32_t res_32_SV_VL3__a_false = 0; + int32_t res_32_SV_VL4__a_false = 0; + int32_t res_32_SV_VL5__a_false = 0; + int32_t res_32_SV_VL6__a_false = 0; + int32_t res_32_SV_VL7__a_false = 0; + int32_t res_32_SV_VL8__a_false = 0; + int32_t res_32_SV_VL16__a_false = 0; + uint32_t res_32_SV_VL1_u_a_false = 0; + uint32_t res_32_SV_VL2_u_a_false = 0; + uint32_t res_32_SV_VL3_u_a_false = 0; + uint32_t res_32_SV_VL4_u_a_false = 0; + uint32_t res_32_SV_VL5_u_a_false = 0; + uint32_t res_32_SV_VL6_u_a_false = 0; + uint32_t res_32_SV_VL7_u_a_false = 0; + uint32_t res_32_SV_VL8_u_a_false = 0; + uint32_t res_32_SV_VL16_u_a_false = 0; + int64_t res_64_SV_VL1__a_false = 0; + int64_t res_64_SV_VL2__a_false = 0; + int64_t res_64_SV_VL3__a_false = 0; + int64_t res_64_SV_VL4__a_false = 0; + int64_t res_64_SV_VL5__a_false = 0; + int64_t res_64_SV_VL6__a_false = 0; + int64_t res_64_SV_VL7__a_false = 0; + int64_t res_64_SV_VL8__a_false = 0; + int64_t res_64_SV_VL16__a_false = 0; + uint64_t res_64_SV_VL1_u_a_false = 0; + uint64_t res_64_SV_VL2_u_a_false = 0; + uint64_t res_64_SV_VL3_u_a_false = 0; + uint64_t res_64_SV_VL4_u_a_false = 0; + uint64_t res_64_SV_VL5_u_a_false = 0; + uint64_t res_64_SV_VL6_u_a_false = 0; + uint64_t res_64_SV_VL7_u_a_false = 0; + uint64_t res_64_SV_VL8_u_a_false = 0; + uint64_t res_64_SV_VL16_u_a_false = 0; + int8_t res_8_SV_VL1__b_false = 31; + int8_t res_8_SV_VL2__b_false = 31; + int8_t res_8_SV_VL3__b_false = 31; + int8_t res_8_SV_VL4__b_false = 31; + int8_t res_8_SV_VL5__b_false = 31; + int8_t res_8_SV_VL6__b_false = 31; + int8_t res_8_SV_VL7__b_false = 31; + int8_t res_8_SV_VL8__b_false = 31; + int8_t res_8_SV_VL16__b_false = 31; + uint8_t res_8_SV_VL1_u_b_false = 31; + uint8_t res_8_SV_VL2_u_b_false = 31; + uint8_t res_8_SV_VL3_u_b_false = 31; + uint8_t res_8_SV_VL4_u_b_false = 31; + uint8_t res_8_SV_VL5_u_b_false = 31; + uint8_t res_8_SV_VL6_u_b_false = 31; + uint8_t res_8_SV_VL7_u_b_false = 31; + uint8_t res_8_SV_VL8_u_b_false = 31; + uint8_t res_8_SV_VL16_u_b_false = 31; + int16_t res_16_SV_VL1__b_false = 15; + int16_t res_16_SV_VL2__b_false = 15; + int16_t res_16_SV_VL3__b_false = 15; + int16_t res_16_SV_VL4__b_false = 15; + int16_t res_16_SV_VL5__b_false = 15; + int16_t res_16_SV_VL6__b_false = 15; + int16_t res_16_SV_VL7__b_false = 15; + int16_t res_16_SV_VL8__b_false = 15; + int16_t res_16_SV_VL16__b_false = 15; + uint16_t res_16_SV_VL1_u_b_false = 15; + uint16_t res_16_SV_VL2_u_b_false = 15; + uint16_t res_16_SV_VL3_u_b_false = 15; + uint16_t res_16_SV_VL4_u_b_false = 15; + uint16_t res_16_SV_VL5_u_b_false = 15; + uint16_t res_16_SV_VL6_u_b_false = 15; + uint16_t res_16_SV_VL7_u_b_false = 15; + uint16_t res_16_SV_VL8_u_b_false = 15; + uint16_t res_16_SV_VL16_u_b_false = 15; + int32_t res_32_SV_VL1__b_false = 7; + int32_t res_32_SV_VL2__b_false = 7; + int32_t res_32_SV_VL3__b_false = 7; + int32_t res_32_SV_VL4__b_false = 7; + int32_t res_32_SV_VL5__b_false = 7; + int32_t res_32_SV_VL6__b_false = 7; + int32_t res_32_SV_VL7__b_false = 7; + int32_t res_32_SV_VL8__b_false = 7; + int32_t res_32_SV_VL16__b_false = 7; + uint32_t res_32_SV_VL1_u_b_false = 7; + uint32_t res_32_SV_VL2_u_b_false = 7; + uint32_t res_32_SV_VL3_u_b_false = 7; + uint32_t res_32_SV_VL4_u_b_false = 7; + uint32_t res_32_SV_VL5_u_b_false = 7; + uint32_t res_32_SV_VL6_u_b_false = 7; + uint32_t res_32_SV_VL7_u_b_false = 7; + uint32_t res_32_SV_VL8_u_b_false = 7; + uint32_t res_32_SV_VL16_u_b_false = 7; + int64_t res_64_SV_VL1__b_false = 3; + int64_t res_64_SV_VL2__b_false = 3; + int64_t res_64_SV_VL3__b_false = 3; + int64_t res_64_SV_VL4__b_false = 3; + int64_t res_64_SV_VL5__b_false = 3; + int64_t res_64_SV_VL6__b_false = 3; + int64_t res_64_SV_VL7__b_false = 3; + int64_t res_64_SV_VL8__b_false = 3; + int64_t res_64_SV_VL16__b_false = 3; + uint64_t res_64_SV_VL1_u_b_false = 3; + uint64_t res_64_SV_VL2_u_b_false = 3; + uint64_t res_64_SV_VL3_u_b_false = 3; + uint64_t res_64_SV_VL4_u_b_false = 3; + uint64_t res_64_SV_VL5_u_b_false = 3; + uint64_t res_64_SV_VL6_u_b_false = 3; + uint64_t res_64_SV_VL7_u_b_false = 3; + uint64_t res_64_SV_VL8_u_b_false = 3; + uint64_t res_64_SV_VL16_u_b_false = 3; + + +#undef SVELAST_DEF +#define SVELAST_DEF(size, pat, sign, ab, su) \ + if (NAME (foo, size, pat, sign, ab) \ + (svindex_ ## su ## size (0 ,1)) != \ + NAME (res, size, pat, sign, ab)) \ + __builtin_abort (); \ + if (NAMEF (foo, size, pat, sign, ab) \ + (svindex_ ## su ## size (0 ,1)) != \ + NAMEF (res, size, pat, sign, ab)) \ + __builtin_abort (); + + ALL_POS () + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4.c index 1e38371..91fdd3c 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4.c @@ -186,8 +186,6 @@ CALLER (f16, __SVFloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, all -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_1024.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_1024.c index 491c35a..7d824ca 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_1024.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_1024.c @@ -186,8 +186,6 @@ CALLER (f16, __SVFloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl128 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_128.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_128.c index eebb913..e0aa3a5 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_128.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_128.c @@ -186,8 +186,6 @@ CALLER (f16, __SVFloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl16 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_2048.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_2048.c index 73c3b2e..3238015 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_2048.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_2048.c @@ -186,8 +186,6 @@ CALLER (f16, __SVFloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl256 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_256.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_256.c index 29744c8..5086109 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_256.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_256.c @@ -186,8 +186,6 @@ CALLER (f16, __SVFloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl32 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_512.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_512.c index cf25c31..300dacc 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_512.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_4_512.c @@ -186,8 +186,6 @@ CALLER (f16, __SVFloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl64 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5.c index 9ad3e22..0a840a3 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5.c @@ -186,8 +186,6 @@ CALLER (f16, svfloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, all -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_1024.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_1024.c index d573e5f..18cefbf 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_1024.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_1024.c @@ -186,8 +186,6 @@ CALLER (f16, svfloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl128 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_128.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_128.c index 200b0eb..c622ed5 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_128.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_128.c @@ -186,8 +186,6 @@ CALLER (f16, svfloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl16 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_2048.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_2048.c index f6f8858..3286280 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_2048.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_2048.c @@ -186,8 +186,6 @@ CALLER (f16, svfloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl256 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_256.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_256.c index e62f59c..3c6afa2 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_256.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_256.c @@ -186,8 +186,6 @@ CALLER (f16, svfloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl32 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_512.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_512.c index 483558c..bb7d3eb 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_512.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/return_5_512.c @@ -186,8 +186,6 @@ CALLER (f16, svfloat16_t) ** caller_bf16: ** ... ** bl callee_bf16 -** ptrue (p[0-7])\.b, vl64 -** lasta h0, \1, z0\.h ** ldp x29, x30, \[sp\], 16 ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/vec-init-single-const-2.c b/gcc/testsuite/gcc.target/aarch64/vec-init-single-const-2.c new file mode 100644 index 0000000..f4dcab4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vec-init-single-const-2.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include <arm_neon.h> + +/* In case where there are no duplicate elements in vector initializer, + check that the constant is used for duplication. */ + +int8x16_t f_s8(int8_t a0, int8_t a1, int8_t a2, int8_t a3, int8_t a4, + int8_t a5, int8_t a6, int8_t a7, int8_t a8, int8_t a9, + int8_t a10, int8_t a11, int8_t a12, int8_t a13, int8_t a14) +{ + return (int8x16_t) { a0, a1, a2, a3, a4, a5, a6, a7, + a8, a9, a10, a11, a12, a13, a14, 1 }; +} + +int16x8_t f_s16(int16_t a0, int16_t a1, int16_t a2, int16_t a3, int16_t a4, + int16_t a5, int16_t a6) +{ + return (int16x8_t) { a0, a1, a2, a3, a4, a5, a6, 1 }; +} + +int32x4_t f_s32(int32_t a0, int32_t a1, int32_t a2) +{ + return (int32x4_t) { a0, a1, a2, 1 }; +} + +/* { dg-final { scan-assembler {\tmovi\tv[0-9]+\.8b, 0x1} } } */ +/* { dg-final { scan-assembler {\tmovi\tv[0-9]+\.4h, 0x1} } } */ +/* { dg-final { scan-assembler {\tmovi\tv[0-9]+\.2s, 0x1} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/vec-init-single-const-be.c b/gcc/testsuite/gcc.target/aarch64/vec-init-single-const-be.c new file mode 100644 index 0000000..3140e00 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vec-init-single-const-be.c @@ -0,0 +1,58 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { be } } } } */ + +#include <arm_neon.h> + +/* +** f_s8: +** dup v0.16b, w0 +** movi (v[0-9]+)\.8b, 0x1 +** ins v0.b\[0\], \1\.b\[0\] +** ret +*/ + +int8x16_t f_s8(int8_t x) +{ + return (int8x16_t) { x, x, x, x, x, x, x, x, + x, x, x, x, x, x, x, 1 }; +} + +/* +** f_s16: +** dup v0.8h, w0 +** movi (v[0-9]+)\.4h, 0x1 +** ins v0.h\[0\], \1\.h\[0\] +** ret +*/ + +int16x8_t f_s16(int16_t x) +{ + return (int16x8_t) { x, x, x, x, x, x, x, 1 }; +} + +/* +** f_s32: +** dup v0.4s, w0 +** movi (v[0-9]+)\.2s, 0x1 +** ins v0.s\[0\], \1\.s\[0\] +** ret +*/ + +int32x4_t f_s32(int32_t x) +{ + return (int32x4_t) { x, x, x, 1 }; +} + +/* +** f_s64: +** adrp x[0-9]+, .LC[0-9]+ +** ldr q0, \[x[0-9]+, #:lo12:.LC[0-9]+\] +** ins v0\.d\[1\], x0 +** ret +*/ + +int64x2_t f_s64(int64_t x) +{ + return (int64x2_t) { x, 1 }; +} diff --git a/gcc/testsuite/gcc.target/aarch64/vec-init-single-const.c b/gcc/testsuite/gcc.target/aarch64/vec-init-single-const.c new file mode 100644 index 0000000..274b0b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vec-init-single-const.c @@ -0,0 +1,58 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ + +#include <arm_neon.h> + +/* +** f_s8: +** dup v0.16b, w0 +** movi (v[0-9]+)\.8b, 0x1 +** ins v0.b\[15\], \1\.b\[0\] +** ret +*/ + +int8x16_t f_s8(int8_t x) +{ + return (int8x16_t) { x, x, x, x, x, x, x, x, + x, x, x, x, x, x, x, 1 }; +} + +/* +** f_s16: +** dup v0.8h, w0 +** movi (v[0-9]+)\.4h, 0x1 +** ins v0.h\[7\], \1\.h\[0\] +** ret +*/ + +int16x8_t f_s16(int16_t x) +{ + return (int16x8_t) { x, x, x, x, x, x, x, 1 }; +} + +/* +** f_s32: +** dup v0.4s, w0 +** movi (v[0-9]+)\.2s, 0x1 +** ins v0.s\[3\], \1\.s\[0\] +** ret +*/ + +int32x4_t f_s32(int32_t x) +{ + return (int32x4_t) { x, x, x, 1 }; +} + +/* +** f_s64: +** adrp x[0-9]+, .LC[0-9]+ +** ldr q0, \[x[0-9]+, #:lo12:.LC[0-9]+\] +** ins v0\.d\[0\], x0 +** ret +*/ + +int64x2_t f_s64(int64_t x) +{ + return (int64x2_t) { x, 1 }; +} diff --git a/gcc/testsuite/gcc.target/arm/mtp.c b/gcc/testsuite/gcc.target/arm/mtp.c new file mode 100644 index 0000000..d994c37 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mtp.c @@ -0,0 +1,8 @@ +__thread int i; + +int +foo (void) +{ + return i; +} + diff --git a/gcc/testsuite/gcc.target/arm/mtp_1.c b/gcc/testsuite/gcc.target/arm/mtp_1.c new file mode 100644 index 0000000..678d27d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mtp_1.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=cp15" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrc\tp15, 0, r3, c13, c0, 3} 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/mtp_2.c b/gcc/testsuite/gcc.target/arm/mtp_2.c new file mode 100644 index 0000000..bcb308f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mtp_2.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidrprw" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrc\tp15, 0, r3, c13, c0, 4} 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/mtp_3.c b/gcc/testsuite/gcc.target/arm/mtp_3.c new file mode 100644 index 0000000..7d5cea3 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mtp_3.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidruro" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrc\tp15, 0, r3, c13, c0, 3} 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/mtp_4.c b/gcc/testsuite/gcc.target/arm/mtp_4.c new file mode 100644 index 0000000..068078d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mtp_4.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O -mtp=tpidrurw" } */ + +#include "mtp.c" + +/* { dg-final { scan-assembler-times {mrc\tp15, 0, r3, c13, c0, 2} 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr110227.c b/gcc/testsuite/gcc.target/i386/pr110227.c new file mode 100644 index 0000000..9b59f5b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr110227.c @@ -0,0 +1,11 @@ +/* { dg-do assemble { target { ! ia32 } } } */ +/* { dg-options " -O2 -mavx512vl" } */ + +#include <immintrin.h> + +void f() +{ + __m256i mask = _mm256_set_epi32(0, 0, 0, 0, -1, -1, -1, -1); + register __m256i reg asm("xmm16") = mask; + asm(""::"v"(reg)); +} diff --git a/gcc/testsuite/gcc.target/i386/pr110232.c b/gcc/testsuite/gcc.target/i386/pr110232.c new file mode 100644 index 0000000..43b74b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr110232.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=znver4 --param vect-partial-vector-usage=2 -fno-vect-cost-model -fdump-tree-vect" } */ + +int a[4096]; + +void foo () +{ + for (int i = 1; i < 4095; ++i) + a[i] = 42; +} + +/* { dg-final { scan-tree-dump-not "VIEW_CONVERT_EXPR" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr31985.c b/gcc/testsuite/gcc.target/i386/pr31985.c new file mode 100644 index 0000000..a6de1b5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr31985.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2" } */ + +void test_c (unsigned int a, unsigned int b, unsigned int c, unsigned int d) +{ + volatile unsigned int x, y; + unsigned long long __a = b | ((unsigned long long)a << 32); + unsigned long long __b = d | ((unsigned long long)c << 32); + unsigned long long __c = __a + __b; + x = (unsigned int)(__c & 0xffffffff); + y = (unsigned int)(__c >> 32); +} + +/* { dg-final { scan-assembler-times "movl" 4 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr79173-1.c b/gcc/testsuite/gcc.target/i386/pr79173-1.c new file mode 100644 index 0000000..af01830 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-1.c @@ -0,0 +1,59 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "subq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "subl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ + +static unsigned long +uaddc (unsigned long x, unsigned long y, unsigned long carry_in, unsigned long *carry_out) +{ + unsigned long r; + unsigned long c1 = __builtin_add_overflow (x, y, &r); + unsigned long c2 = __builtin_add_overflow (r, carry_in, &r); + *carry_out = c1 + c2; + return r; +} + +static unsigned long +usubc (unsigned long x, unsigned long y, unsigned long carry_in, unsigned long *carry_out) +{ + unsigned long r; + unsigned long c1 = __builtin_sub_overflow (x, y, &r); + unsigned long c2 = __builtin_sub_overflow (r, carry_in, &r); + *carry_out = c1 + c2; + return r; +} + +void +foo (unsigned long *p, unsigned long *q) +{ + unsigned long c; + p[0] = uaddc (p[0], q[0], 0, &c); + p[1] = uaddc (p[1], q[1], c, &c); + p[2] = uaddc (p[2], q[2], c, &c); + p[3] = uaddc (p[3], q[3], c, &c); +} + +void +bar (unsigned long *p, unsigned long *q) +{ + unsigned long c; + p[0] = usubc (p[0], q[0], 0, &c); + p[1] = usubc (p[1], q[1], c, &c); + p[2] = usubc (p[2], q[2], c, &c); + p[3] = usubc (p[3], q[3], c, &c); +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-10.c b/gcc/testsuite/gcc.target/i386/pr79173-10.c new file mode 100644 index 0000000..fb43dd3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-10.c @@ -0,0 +1,31 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "subl\t%e\[^\n\r]*, \\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 4\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 8\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 12\\\(%\[^\n\r]*\\\)" 1 } } */ + +#include <x86intrin.h> + +unsigned int +foo (unsigned int *p, unsigned int *q) +{ + unsigned char c = _addcarry_u32 (0, p[0], q[0], &p[0]); + c = _addcarry_u32 (c, p[1], q[1], &p[1]); + c = _addcarry_u32 (c, p[2], q[2], &p[2]); + return _addcarry_u32 (c, p[3], q[3], &p[3]); +} + +unsigned int +bar (unsigned int *p, unsigned int *q) +{ + unsigned char c = _subborrow_u32 (0, p[0], q[0], &p[0]); + c = _subborrow_u32 (c, p[1], q[1], &p[1]); + c = _subborrow_u32 (c, p[2], q[2], &p[2]); + return _subborrow_u32 (c, p[3], q[3], &p[3]); +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-2.c b/gcc/testsuite/gcc.target/i386/pr79173-2.c new file mode 100644 index 0000000..f10eeb8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-2.c @@ -0,0 +1,59 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "subq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "subl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ + +static unsigned long +uaddc (unsigned long x, unsigned long y, _Bool carry_in, _Bool *carry_out) +{ + unsigned long r; + _Bool c1 = __builtin_add_overflow (x, y, &r); + _Bool c2 = __builtin_add_overflow (r, carry_in, &r); + *carry_out = c1 | c2; + return r; +} + +static unsigned long +usubc (unsigned long x, unsigned long y, _Bool carry_in, _Bool *carry_out) +{ + unsigned long r; + _Bool c1 = __builtin_sub_overflow (x, y, &r); + _Bool c2 = __builtin_sub_overflow (r, carry_in, &r); + *carry_out = c1 | c2; + return r; +} + +void +foo (unsigned long *p, unsigned long *q) +{ + _Bool c; + p[0] = uaddc (p[0], q[0], 0, &c); + p[1] = uaddc (p[1], q[1], c, &c); + p[2] = uaddc (p[2], q[2], c, &c); + p[3] = uaddc (p[3], q[3], c, &c); +} + +void +bar (unsigned long *p, unsigned long *q) +{ + _Bool c; + p[0] = usubc (p[0], q[0], 0, &c); + p[1] = usubc (p[1], q[1], c, &c); + p[2] = usubc (p[2], q[2], c, &c); + p[3] = usubc (p[3], q[3], c, &c); +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-3.c b/gcc/testsuite/gcc.target/i386/pr79173-3.c new file mode 100644 index 0000000..2cdf4e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-3.c @@ -0,0 +1,61 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "subq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "subl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ + +static unsigned long +uaddc (unsigned long x, unsigned long y, unsigned long carry_in, unsigned long *carry_out) +{ + unsigned long r; + unsigned long c1 = __builtin_add_overflow (x, y, &r); + unsigned long c2 = __builtin_add_overflow (r, carry_in, &r); + *carry_out = c1 + c2; + return r; +} + +static unsigned long +usubc (unsigned long x, unsigned long y, unsigned long carry_in, unsigned long *carry_out) +{ + unsigned long r; + unsigned long c1 = __builtin_sub_overflow (x, y, &r); + unsigned long c2 = __builtin_sub_overflow (r, carry_in, &r); + *carry_out = c1 + c2; + return r; +} + +unsigned long +foo (unsigned long *p, unsigned long *q) +{ + unsigned long c; + p[0] = uaddc (p[0], q[0], 0, &c); + p[1] = uaddc (p[1], q[1], c, &c); + p[2] = uaddc (p[2], q[2], c, &c); + p[3] = uaddc (p[3], q[3], c, &c); + return c; +} + +unsigned long +bar (unsigned long *p, unsigned long *q) +{ + unsigned long c; + p[0] = usubc (p[0], q[0], 0, &c); + p[1] = usubc (p[1], q[1], c, &c); + p[2] = usubc (p[2], q[2], c, &c); + p[3] = usubc (p[3], q[3], c, &c); + return c; +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-4.c b/gcc/testsuite/gcc.target/i386/pr79173-4.c new file mode 100644 index 0000000..2152489 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-4.c @@ -0,0 +1,61 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "subq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "subl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ + +static unsigned long +uaddc (unsigned long x, unsigned long y, _Bool carry_in, _Bool *carry_out) +{ + unsigned long r; + _Bool c1 = __builtin_add_overflow (x, y, &r); + _Bool c2 = __builtin_add_overflow (r, carry_in, &r); + *carry_out = c1 ^ c2; + return r; +} + +static unsigned long +usubc (unsigned long x, unsigned long y, _Bool carry_in, _Bool *carry_out) +{ + unsigned long r; + _Bool c1 = __builtin_sub_overflow (x, y, &r); + _Bool c2 = __builtin_sub_overflow (r, carry_in, &r); + *carry_out = c1 ^ c2; + return r; +} + +_Bool +foo (unsigned long *p, unsigned long *q) +{ + _Bool c; + p[0] = uaddc (p[0], q[0], 0, &c); + p[1] = uaddc (p[1], q[1], c, &c); + p[2] = uaddc (p[2], q[2], c, &c); + p[3] = uaddc (p[3], q[3], c, &c); + return c; +} + +_Bool +bar (unsigned long *p, unsigned long *q) +{ + _Bool c; + p[0] = usubc (p[0], q[0], 0, &c); + p[1] = usubc (p[1], q[1], c, &c); + p[2] = usubc (p[2], q[2], c, &c); + p[3] = usubc (p[3], q[3], c, &c); + return c; +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-5.c b/gcc/testsuite/gcc.target/i386/pr79173-5.c new file mode 100644 index 0000000..eb3ddd2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-5.c @@ -0,0 +1,32 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ + +static unsigned long +uaddc (unsigned long x, unsigned long y, unsigned long carry_in, unsigned long *carry_out) +{ + unsigned long r = x + y; + unsigned long c1 = r < x; + r += carry_in; + unsigned long c2 = r < carry_in; + *carry_out = c1 + c2; + return r; +} + +void +foo (unsigned long *p, unsigned long *q) +{ + unsigned long c; + p[0] = uaddc (p[0], q[0], 0, &c); + p[1] = uaddc (p[1], q[1], c, &c); + p[2] = uaddc (p[2], q[2], c, &c); + p[3] = uaddc (p[3], q[3], c, &c); +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-6.c b/gcc/testsuite/gcc.target/i386/pr79173-6.c new file mode 100644 index 0000000..d91ba5a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-6.c @@ -0,0 +1,33 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 { target lp64 } } } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%e\[^\n\r]*\\\)" 1 { target ia32 } } } */ + +static unsigned long +uaddc (unsigned long x, unsigned long y, unsigned long carry_in, unsigned long *carry_out) +{ + unsigned long r = x + y; + unsigned long c1 = r < x; + r += carry_in; + unsigned long c2 = r < carry_in; + *carry_out = c1 + c2; + return r; +} + +unsigned long +foo (unsigned long *p, unsigned long *q) +{ + unsigned long c; + p[0] = uaddc (p[0], q[0], 0, &c); + p[1] = uaddc (p[1], q[1], c, &c); + p[2] = uaddc (p[2], q[2], c, &c); + p[3] = uaddc (p[3], q[3], c, &c); + return c; +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-7.c b/gcc/testsuite/gcc.target/i386/pr79173-7.c new file mode 100644 index 0000000..48eb101 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-7.c @@ -0,0 +1,31 @@ +/* PR middle-end/79173 */ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "subq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 } } */ + +#include <x86intrin.h> + +void +foo (unsigned long long *p, unsigned long long *q) +{ + unsigned char c = _addcarry_u64 (0, p[0], q[0], &p[0]); + c = _addcarry_u64 (c, p[1], q[1], &p[1]); + c = _addcarry_u64 (c, p[2], q[2], &p[2]); + _addcarry_u64 (c, p[3], q[3], &p[3]); +} + +void +bar (unsigned long long *p, unsigned long long *q) +{ + unsigned char c = _subborrow_u64 (0, p[0], q[0], &p[0]); + c = _subborrow_u64 (c, p[1], q[1], &p[1]); + c = _subborrow_u64 (c, p[2], q[2], &p[2]); + _subborrow_u64 (c, p[3], q[3], &p[3]); +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-8.c b/gcc/testsuite/gcc.target/i386/pr79173-8.c new file mode 100644 index 0000000..c61c016 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-8.c @@ -0,0 +1,31 @@ +/* PR middle-end/79173 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addl\t%e\[^\n\r]*, \\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 4\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 8\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcl\t%e\[^\n\r]*, 12\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "subl\t%e\[^\n\r]*, \\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 4\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 8\\\(%\[^\n\r]*\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbl\t%e\[^\n\r]*, 12\\\(%\[^\n\r]*\\\)" 1 } } */ + +#include <x86intrin.h> + +void +foo (unsigned int *p, unsigned int *q) +{ + unsigned char c = _addcarry_u32 (0, p[0], q[0], &p[0]); + c = _addcarry_u32 (c, p[1], q[1], &p[1]); + c = _addcarry_u32 (c, p[2], q[2], &p[2]); + _addcarry_u32 (c, p[3], q[3], &p[3]); +} + +void +bar (unsigned int *p, unsigned int *q) +{ + unsigned char c = _subborrow_u32 (0, p[0], q[0], &p[0]); + c = _subborrow_u32 (c, p[1], q[1], &p[1]); + c = _subborrow_u32 (c, p[2], q[2], &p[2]); + _subborrow_u32 (c, p[3], q[3], &p[3]); +} diff --git a/gcc/testsuite/gcc.target/i386/pr79173-9.c b/gcc/testsuite/gcc.target/i386/pr79173-9.c new file mode 100644 index 0000000..3847629 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79173-9.c @@ -0,0 +1,31 @@ +/* PR middle-end/79173 */ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -fno-stack-protector -masm=att" } */ +/* { dg-final { scan-assembler-times "addq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "adcq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "subq\t%r\[^\n\r]*, \\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 8\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 16\\\(%rdi\\\)" 1 } } */ +/* { dg-final { scan-assembler-times "sbbq\t%r\[^\n\r]*, 24\\\(%rdi\\\)" 1 } } */ + +#include <x86intrin.h> + +unsigned long long +foo (unsigned long long *p, unsigned long long *q) +{ + unsigned char c = _addcarry_u64 (0, p[0], q[0], &p[0]); + c = _addcarry_u64 (c, p[1], q[1], &p[1]); + c = _addcarry_u64 (c, p[2], q[2], &p[2]); + return _addcarry_u64 (c, p[3], q[3], &p[3]); +} + +unsigned long long +bar (unsigned long long *p, unsigned long long *q) +{ + unsigned char c = _subborrow_u64 (0, p[0], q[0], &p[0]); + c = _subborrow_u64 (c, p[1], q[1], &p[1]); + c = _subborrow_u64 (c, p[2], q[2], &p[2]); + return _subborrow_u64 (c, p[3], q[3], &p[3]); +} diff --git a/gcc/testsuite/gcc.target/mips/code-readable-attr-1.c b/gcc/testsuite/gcc.target/mips/code-readable-attr-1.c new file mode 100644 index 0000000..4ccb27c --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/code-readable-attr-1.c @@ -0,0 +1,51 @@ +/* { dg-options "(-mips16) -mgp32 addressing=absolute" } */ +/* { dg-skip-if ".half requires -O" { *-*-* } { "-O0" } { "" } } */ + +volatile int x1; +volatile int x2; +volatile int x3; +volatile int x4; +volatile int x5; +volatile int x6; +volatile int x7; +volatile int x8; +volatile int x9; +volatile int x10; +volatile int x11; + +MIPS16 __attribute__ ((code_readable)) int +foo (int i, volatile int *x) +{ + switch (i) + { + case 1: return x1 + x[0]; + case 2: return x2 + x[1]; + case 3: return x3 + x[2]; + case 4: return x4 + x[3]; + case 5: return x5 + x[4]; + case 6: return x6 + x[5]; + case 7: return x7 + x[6]; + case 8: return x8 + x[7]; + case 9: return x9 + x[8]; + case 10: return x10 + x[9]; + case 11: return x11 + x[10]; + default: return 0; + } +} + +extern int k[]; + +MIPS16 __attribute__ ((code_readable)) int * +bar (void) +{ + return k; +} + +/* { dg-final { scan-assembler "\tla\t" } } */ +/* { dg-final { scan-assembler "\t\\.half\t" } } */ +/* { dg-final { scan-assembler-not "%hi\\(\[^)\]*L" } } */ +/* { dg-final { scan-assembler-not "%lo\\(\[^)\]*L" } } */ + +/* { dg-final { scan-assembler "\t\\.word\tk\n" } } */ +/* { dg-final { scan-assembler-not "%hi\\(k\\)" } } */ +/* { dg-final { scan-assembler-not "%lo\\(k\\)" } } */ diff --git a/gcc/testsuite/gcc.target/mips/code-readable-attr-2.c b/gcc/testsuite/gcc.target/mips/code-readable-attr-2.c new file mode 100644 index 0000000..c7dd511 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/code-readable-attr-2.c @@ -0,0 +1,49 @@ +/* { dg-options "(-mips16) -mgp32 addressing=absolute" } */ + +volatile int x1; +volatile int x2; +volatile int x3; +volatile int x4; +volatile int x5; +volatile int x6; +volatile int x7; +volatile int x8; +volatile int x9; +volatile int x10; +volatile int x11; + +MIPS16 __attribute__((code_readable ("pcrel"))) int +foo (int i, volatile int *x) +{ + switch (i) + { + case 1: return x1 + x[0]; + case 2: return x2 + x[1]; + case 3: return x3 + x[2]; + case 4: return x4 + x[3]; + case 5: return x5 + x[4]; + case 6: return x6 + x[5]; + case 7: return x7 + x[6]; + case 8: return x8 + x[7]; + case 9: return x9 + x[8]; + case 10: return x10 + x[9]; + case 11: return x11 + x[10]; + default: return 0; + } +} + +extern int k[]; + +MIPS16 __attribute__((code_readable ("pcrel"))) int * +bar (void) +{ + return k; +} + +/* { dg-final { scan-assembler-not "\tla\t" } } */ +/* { dg-final { scan-assembler-not "\t\\.half\t" } } */ +/* { dg-final { scan-assembler "\t\\.word\t\[^\n\]*L" } } */ + +/* { dg-final { scan-assembler "\t\\.word\tk\n" } } */ +/* { dg-final { scan-assembler-not "%hi\\(k\\)" } } */ +/* { dg-final { scan-assembler-not "%lo\\(k\\)" } } */ diff --git a/gcc/testsuite/gcc.target/mips/code-readable-attr-3.c b/gcc/testsuite/gcc.target/mips/code-readable-attr-3.c new file mode 100644 index 0000000..99c13a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/code-readable-attr-3.c @@ -0,0 +1,50 @@ +/* { dg-options "(-mips16) -mgp32 addressing=absolute" } */ + +volatile int x1; +volatile int x2; +volatile int x3; +volatile int x4; +volatile int x5; +volatile int x6; +volatile int x7; +volatile int x8; +volatile int x9; +volatile int x10; +volatile int x11; + +MIPS16 __attribute__((code_readable ("no"))) int +foo (int i, volatile int *x) +{ + switch (i) + { + case 1: return x1 + x[0]; + case 2: return x2 + x[1]; + case 3: return x3 + x[2]; + case 4: return x4 + x[3]; + case 5: return x5 + x[4]; + case 6: return x6 + x[5]; + case 7: return x7 + x[6]; + case 8: return x8 + x[7]; + case 9: return x9 + x[8]; + case 10: return x10 + x[9]; + case 11: return x11 + x[10]; + default: return 0; + } +} + +extern int k[]; + +MIPS16 __attribute__((code_readable ("no"))) int * +bar (void) +{ + return k; +} + +/* { dg-final { scan-assembler-not "\tla\t" } } */ +/* { dg-final { scan-assembler-not "\t\\.half\t" } } */ +/* { dg-final { scan-assembler "%hi\\(\[^)\]*L" } } */ +/* { dg-final { scan-assembler "%lo\\(\[^)\]*L" } } */ + +/* { dg-final { scan-assembler-not "\t\\.word\tk\n" } } */ +/* { dg-final { scan-assembler "%hi\\(k\\)" } } */ +/* { dg-final { scan-assembler "%lo\\(k\\)" } } */ diff --git a/gcc/testsuite/gcc.target/mips/code-readable-attr-4.c b/gcc/testsuite/gcc.target/mips/code-readable-attr-4.c new file mode 100644 index 0000000..4058ba1 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/code-readable-attr-4.c @@ -0,0 +1,51 @@ +/* { dg-options "(-mips16) -mabi=eabi -mgp64" } */ +/* { dg-skip-if ".half requires -O" { *-*-* } { "-O0" } { "" } } */ + +volatile int x1; +volatile int x2; +volatile int x3; +volatile int x4; +volatile int x5; +volatile int x6; +volatile int x7; +volatile int x8; +volatile int x9; +volatile int x10; +volatile int x11; + +MIPS16 __attribute__((code_readable ("yes"))) int +foo (int i, volatile int *x) +{ + switch (i) + { + case 1: return x1 + x[0]; + case 2: return x2 + x[1]; + case 3: return x3 + x[2]; + case 4: return x4 + x[3]; + case 5: return x5 + x[4]; + case 6: return x6 + x[5]; + case 7: return x7 + x[6]; + case 8: return x8 + x[7]; + case 9: return x9 + x[8]; + case 10: return x10 + x[9]; + case 11: return x11 + x[10]; + default: return 0; + } +} + +extern int k[]; + +MIPS16 __attribute__((code_readable ("yes"))) int * +bar (void) +{ + return k; +} + +/* { dg-final { scan-assembler "\tdla\t" } } */ +/* { dg-final { scan-assembler "\t\\.half\t" } } */ +/* { dg-final { scan-assembler-not "%hi\\(\[^)\]*L" } } */ +/* { dg-final { scan-assembler-not "%lo\\(\[^)\]*L" } } */ + +/* { dg-final { scan-assembler "\t\\.dword\tk\n" } } */ +/* { dg-final { scan-assembler-not "%hi\\(k\\)" } } */ +/* { dg-final { scan-assembler-not "%lo\\(k\\)" } } */ diff --git a/gcc/testsuite/gcc.target/mips/code-readable-attr-5.c b/gcc/testsuite/gcc.target/mips/code-readable-attr-5.c new file mode 100644 index 0000000..0a547a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/code-readable-attr-5.c @@ -0,0 +1,5 @@ +/* { dg-options "(-mips16) isa_rev<=5" } */ + + __attribute__((code_readable ("magic"))) int foo () {} /* { dg-warning "argument to 'code_readable' attribute is neither no, pcrel nor yes" } */ + + __attribute__((code_readable (1))) int * bar () {} /* { dg-warning "'code_readable' attribute requires a string argument" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c index 75eaf25..f5f9533 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c @@ -13,8 +13,8 @@ /* { dg-final { scan-assembler-times {\mvspltw\M} 3 { target lp64 } } } */ /* { dg-final { scan-assembler-times {\mmfvsrwz\M} 3 { target lp64 } } } */ -/* { dg-final { scan-assembler-times {\mrldicl\M} 7 { target { le } } } } */ -/* { dg-final { scan-assembler-times {\mrldicl\M} 4 { target { lp64 && be } } } } */ +/* { dg-final { scan-assembler-times {\mrldicl\M} 5 { target { le } } } } */ +/* { dg-final { scan-assembler-times {\mrldicl\M} 2 { target { lp64 && be } } } } */ /* { dg-final { scan-assembler-times {\msubfic\M} 3 { target { le } } } } */ /* { dg-final { scan-assembler-times {\msldi\M} 3 { target lp64 } } } */ /* { dg-final { scan-assembler-times {\mmtvsrd\M} 3 { target lp64 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr109932-1.c b/gcc/testsuite/gcc.target/powerpc/pr109932-1.c index 3e3f9ea..374d9f6 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr109932-1.c +++ b/gcc/testsuite/gcc.target/powerpc/pr109932-1.c @@ -1,3 +1,4 @@ +/* { dg-require-effective-target int128 } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-maltivec -mno-vsx" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr109932-2.c b/gcc/testsuite/gcc.target/powerpc/pr109932-2.c index 3e3f9ea..374d9f6 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr109932-2.c +++ b/gcc/testsuite/gcc.target/powerpc/pr109932-2.c @@ -1,3 +1,4 @@ +/* { dg-require-effective-target int128 } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-maltivec -mno-vsx" } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-10.c new file mode 100644 index 0000000..c521561 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-10.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model -fdump-tree-optimized-details" } */ + +#include <stdint-gcc.h> + +#define VEC_PERM(TYPE) \ + TYPE __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i * 2] += 10; \ + a[i * 2 + 1] += 17; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) + +/* { dg-final { scan-tree-dump-times "{ 10, 17, ... }" 8 "optimized" } } */ +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ + diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-11.c new file mode 100644 index 0000000..ccb5ab6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-11.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model -fdump-tree-optimized-details" } */ + +#include <stdint-gcc.h> + +#define VEC_PERM(TYPE) \ + TYPE __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i * 4] += 41; \ + a[i * 4 + 1] += 25; \ + a[i * 4 + 2] += 31; \ + a[i * 4 + 3] += 62; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) + +/* { dg-final { scan-tree-dump "{ 41, 25, 31, 62, ... }" "optimized" } } */ +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-12.c new file mode 100644 index 0000000..03529f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-12.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include <stdint-gcc.h> + +#define VEC_PERM(TYPE) \ + TYPE __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i * 8] += 99; \ + a[i * 8 + 1] += 11; \ + a[i * 8 + 2] += 17; \ + a[i * 8 + 3] += 80; \ + a[i * 8 + 4] += 63; \ + a[i * 8 + 5] += 37; \ + a[i * 8 + 6] += 24; \ + a[i * 8 + 7] += 81; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-13.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-13.c new file mode 100644 index 0000000..807cb49 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-13.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include <stdint-gcc.h> + +#define VEC_PERM(TYPE) \ + void __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, TYPE *restrict b, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i * 2] += 1; \ + a[i * 2 + 1] += 2; \ + b[i * 4] += 3; \ + b[i * 4 + 1] += 4; \ + b[i * 4 + 2] += 5; \ + b[i * 4 + 3] += 6; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-14.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-14.c new file mode 100644 index 0000000..e0d089e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-14.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include <stdint-gcc.h> + +#define VEC_PERM(TYPE) \ + void __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, TYPE *restrict b, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i] += 1; \ + b[i * 4] += 2; \ + b[i * 4 + 1] += 3; \ + b[i * 4 + 2] += 4; \ + b[i * 4 + 3] += 5; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-15.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-15.c new file mode 100644 index 0000000..731b028 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-15.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include <stdint-gcc.h> + +#define N1 (19 * 2) + +#define VEC_PERM(TYPE) \ + void __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, TYPE *restrict b) \ + { \ + for (int i = 0; i < N1; ++i) \ + { \ + a[i] += 1; \ + b[i * 4] += 2; \ + b[i * 4 + 1] += 3; \ + b[i * 4 + 2] += 4; \ + b[i * 4 + 3] += 5; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-8.c new file mode 100644 index 0000000..2568d69 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-8.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model -fdump-tree-optimized-details" } */ + +#include <stdint.h> + +#define VEC_PERM(TYPE) \ + TYPE __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, TYPE b, TYPE c, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i * 2] += b; \ + a[i * 2 + 1] += c; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) + +/* { dg-final { scan-tree-dump-times "\.VEC_PERM" 2 "optimized" } } */ +/* { dg-final { scan-assembler-times {viota.m} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-9.c new file mode 100644 index 0000000..d410e57 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-9.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model -fdump-tree-optimized-details" } */ + +#include <stdint.h> + +#define VEC_PERM(TYPE) \ + TYPE __attribute__ ((noinline, noclone)) \ + vec_slp_##TYPE (TYPE *restrict a, TYPE b, TYPE c, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i * 4] += b; \ + a[i * 4 + 1] += c; \ + a[i * 4 + 2] += b; \ + a[i * 4 + 3] += c; \ + } \ + } + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) + +TEST_ALL (VEC_PERM) + +/* { dg-final { scan-assembler-times {viota.m} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-10.c new file mode 100644 index 0000000..be95309 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-10.c @@ -0,0 +1,33 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-10.c" + +#define N (103 * 2) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N], b[2] = { 10, 17 }; \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + asm volatile ("" ::: "memory"); \ + } \ + vec_slp_##TYPE (a, N / 2); \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + TYPE orig = i * 2 + i % 5; \ + TYPE expected = orig + b[i % 2]; \ + if (a[i] != expected) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-11.c new file mode 100644 index 0000000..a48b186 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-11.c @@ -0,0 +1,33 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-11.c" + +#define N (77 * 4) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N], b[4] = { 41, 25, 31, 62 }; \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + asm volatile ("" ::: "memory"); \ + } \ + vec_slp_##TYPE (a, N / 4); \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + TYPE orig = i * 2 + i % 5; \ + TYPE expected = orig + b[i % 4]; \ + if (a[i] != expected) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-12.c new file mode 100644 index 0000000..af892ad --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-12.c @@ -0,0 +1,32 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-12.c" + +#define N (59 * 8) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N], b[8] = { 99, 11, 17, 80, 63, 37, 24, 81 }; \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + asm volatile ("" ::: "memory"); \ + } \ + vec_slp_##TYPE (a, N / 8); \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + TYPE orig = i * 2 + i % 5; \ + TYPE expected = orig + b[i % 8]; \ + if (a[i] != expected) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-13.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-13.c new file mode 100644 index 0000000..251054e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-13.c @@ -0,0 +1,47 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-13.c" + +#define N1 (103 * 2) +#define N2 (111 * 2) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N2], b[N2 * 2]; \ + for (unsigned int i = 0; i < N2; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + b[i * 2] = i * 3 + i % 7; \ + b[i * 2 + 1] = i * 5 + i % 9; \ + } \ + vec_slp_##TYPE (a, b, N1 / 2); \ + for (unsigned int i = 0; i < N2; ++i) \ + { \ + TYPE orig_a = i * 2 + i % 5; \ + TYPE orig_b1 = i * 3 + i % 7; \ + TYPE orig_b2 = i * 5 + i % 9; \ + TYPE expected_a = orig_a; \ + TYPE expected_b1 = orig_b1; \ + TYPE expected_b2 = orig_b2; \ + if (i < N1) \ + { \ + expected_a += i & 1 ? 2 : 1; \ + expected_b1 += i & 1 ? 5 : 3; \ + expected_b2 += i & 1 ? 6 : 4; \ + } \ + if (a[i] != expected_a \ + || b[i * 2] != expected_b1 \ + || b[i * 2 + 1] != expected_b2) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-14.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-14.c new file mode 100644 index 0000000..d0f7f0b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-14.c @@ -0,0 +1,57 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-14.c" + +#define N1 (103 * 2) +#define N2 (111 * 2) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N2], b[N2 * 4]; \ + for (unsigned int i = 0; i < N2; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + b[i * 4] = i * 3 + i % 7; \ + b[i * 4 + 1] = i * 5 + i % 9; \ + b[i * 4 + 2] = i * 7 + i % 11; \ + b[i * 4 + 3] = i * 9 + i % 13; \ + } \ + vec_slp_##TYPE (a, b, N1); \ + for (unsigned int i = 0; i < N2; ++i) \ + { \ + TYPE orig_a = i * 2 + i % 5; \ + TYPE orig_b1 = i * 3 + i % 7; \ + TYPE orig_b2 = i * 5 + i % 9; \ + TYPE orig_b3 = i * 7 + i % 11; \ + TYPE orig_b4 = i * 9 + i % 13; \ + TYPE expected_a = orig_a; \ + TYPE expected_b1 = orig_b1; \ + TYPE expected_b2 = orig_b2; \ + TYPE expected_b3 = orig_b3; \ + TYPE expected_b4 = orig_b4; \ + if (i < N1) \ + { \ + expected_a += 1; \ + expected_b1 += 2; \ + expected_b2 += 3; \ + expected_b3 += 4; \ + expected_b4 += 5; \ + } \ + if (a[i] != expected_a \ + || b[i * 4] != expected_b1 \ + || b[i * 4 + 1] != expected_b2 \ + || b[i * 4 + 2] != expected_b3 \ + || b[i * 4 + 3] != expected_b4) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-15.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-15.c new file mode 100644 index 0000000..df14f11 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-15.c @@ -0,0 +1,56 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-15.c" + +#define N2 (31 * 2) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N2], b[N2 * 4]; \ + for (unsigned int i = 0; i < N2; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + b[i * 4] = i * 3 + i % 7; \ + b[i * 4 + 1] = i * 5 + i % 9; \ + b[i * 4 + 2] = i * 7 + i % 11; \ + b[i * 4 + 3] = i * 9 + i % 13; \ + } \ + vec_slp_##TYPE (a, b); \ + for (unsigned int i = 0; i < N2; ++i) \ + { \ + TYPE orig_a = i * 2 + i % 5; \ + TYPE orig_b1 = i * 3 + i % 7; \ + TYPE orig_b2 = i * 5 + i % 9; \ + TYPE orig_b3 = i * 7 + i % 11; \ + TYPE orig_b4 = i * 9 + i % 13; \ + TYPE expected_a = orig_a; \ + TYPE expected_b1 = orig_b1; \ + TYPE expected_b2 = orig_b2; \ + TYPE expected_b3 = orig_b3; \ + TYPE expected_b4 = orig_b4; \ + if (i < N1) \ + { \ + expected_a += 1; \ + expected_b1 += 2; \ + expected_b2 += 3; \ + expected_b3 += 4; \ + expected_b4 += 5; \ + } \ + if (a[i] != expected_a \ + || b[i * 4] != expected_b1 \ + || b[i * 4 + 1] != expected_b2 \ + || b[i * 4 + 2] != expected_b3 \ + || b[i * 4 + 3] != expected_b4) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} + +/* This testcase is from aarch64 and floating-point operations are removed. + TODO: We will add floating-point operations back and make them as common test in the future. */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-8.c new file mode 100644 index 0000000..39ae513 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-8.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-8.c" + +#define N (103 * 2) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N], b[2] = { 3, 11 }; \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + asm volatile ("" ::: "memory"); \ + } \ + vec_slp_##TYPE (a, b[0], b[1], N / 2); \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + TYPE orig = i * 2 + i % 5; \ + TYPE expected = orig + b[i % 2]; \ + if (a[i] != expected) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-9.c new file mode 100644 index 0000000..791cfbc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp_run-9.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-additional-options "--param riscv-autovec-preference=scalable -fno-vect-cost-model" } */ + +#include "slp-9.c" + +#define N (103 * 4) + +#define HARNESS(TYPE) \ + { \ + TYPE a[N], b[2] = { 3, 11 }; \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + a[i] = i * 2 + i % 5; \ + asm volatile ("" ::: "memory"); \ + } \ + vec_slp_##TYPE (a, b[0], b[1], N / 4); \ + for (unsigned int i = 0; i < N; ++i) \ + { \ + TYPE orig = i * 2 + i % 5; \ + TYPE expected = orig + b[i % 2]; \ + if (a[i] != expected) \ + __builtin_abort (); \ + } \ + } + +int __attribute__ ((optimize (1))) +main (void) +{ + TEST_ALL (HARNESS) +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c new file mode 100644 index 0000000..c32c31e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c99 -O3 -march=rv64gcv_zvl128b -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> +#include <assert.h> + +/* This would cause us to emit a vl1r.v for VNx4HImode even when + the hardware vector size vl > 64. */ + +typedef int16_t V __attribute__((vector_size (128))); + +int main () +{ + V v; + for (int i = 0; i < sizeof (v) / sizeof (v[0]); i++) + (v)[i] = i; + V res = v; + for (int i = 0; i < sizeof (v) / sizeof (v[0]); i++) + assert (res[i] == i); +} + +/* { dg-final { scan-assembler-not {vl[1248]r.v} } } */ +/* { dg-final { scan-assembler-times {vl[1248]re16.v} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-1.c new file mode 100644 index 0000000..efeb23e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-1.c @@ -0,0 +1,101 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> + +typedef int8_t vnx16qi __attribute__((vector_size (16))); +typedef int16_t vnx8hi __attribute__((vector_size (16))); +typedef int32_t vnx4si __attribute__((vector_size (16))); +typedef int64_t vnx2di __attribute__((vector_size (16))); +typedef uint8_t vnx16uqi __attribute__((vector_size (16))); +typedef uint16_t vnx8uhi __attribute__((vector_size (16))); +typedef uint32_t vnx4usi __attribute__((vector_size (16))); +typedef uint64_t vnx2udi __attribute__((vector_size (16))); + +typedef _Float16 vnx8hf __attribute__((vector_size (16))); +typedef float vnx4sf __attribute__((vector_size (16))); +typedef double vnx2df __attribute__((vector_size (16))); + +#define MASK_16 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31 +#define MASK_8 0, 9, 2, 11, 4, 13, 6, 15 +#define MASK_4 0, 5, 2, 7 +#define MASK_2 0, 3 + +void __attribute__ ((noipa)) +merge0 (vnx16qi x, vnx16qi y, vnx16qi *out) +{ + vnx16qi v = __builtin_shufflevector ((vnx16qi) x, (vnx16qi) y, MASK_16); + *(vnx16qi*)out = v; +} + +void __attribute__ ((noipa)) +merge1 (vnx16uqi x, vnx16uqi y, vnx16uqi *out) +{ + vnx16uqi v = __builtin_shufflevector ((vnx16uqi) x, (vnx16uqi) y, MASK_16); + *(vnx16uqi*)out = v; +} + +void __attribute__ ((noipa)) +merge2 (vnx8hi x, vnx8hi y, vnx8hi *out) +{ + vnx8hi v = __builtin_shufflevector ((vnx8hi) x, (vnx8hi) y, MASK_8); + *(vnx8hi*)out = v; +} + +void __attribute__ ((noipa)) +merge3 (vnx8uhi x, vnx8uhi y, vnx8uhi *out) +{ + vnx8uhi v = __builtin_shufflevector ((vnx8uhi) x, (vnx8uhi) y, MASK_8); + *(vnx8uhi*)out = v; +} + +void __attribute__ ((noipa)) +merge4 (vnx4si x, vnx4si y, vnx4si *out) +{ + vnx4si v = __builtin_shufflevector ((vnx4si) x, (vnx4si) y, MASK_4); + *(vnx4si*)out = v; +} + +void __attribute__ ((noipa)) +merge5 (vnx4usi x, vnx4usi y, vnx4usi *out) +{ + vnx4usi v = __builtin_shufflevector ((vnx4usi) x, (vnx4usi) y, MASK_4); + *(vnx4usi*)out = v; +} + +void __attribute__ ((noipa)) +merge6 (vnx2di x, vnx2di y, vnx2di *out) +{ + vnx2di v = __builtin_shufflevector ((vnx2di) x, (vnx2di) y, MASK_2); + *(vnx2di*)out = v; +} + +void __attribute__ ((noipa)) +merge7 (vnx2udi x, vnx2udi y, vnx2udi *out) +{ + vnx2udi v = __builtin_shufflevector ((vnx2udi) x, (vnx2udi) y, MASK_2); + *(vnx2udi*)out = v; +} + +void __attribute__ ((noipa)) +merge8 (vnx8hf x, vnx8hf y, vnx8hf *out) +{ + vnx8hf v = __builtin_shufflevector ((vnx8hf) x, (vnx8hf) y, MASK_8); + *(vnx8hf*)out = v; +} + +void __attribute__ ((noipa)) +merge9 (vnx4sf x, vnx4sf y, vnx4sf *out) +{ + vnx4sf v = __builtin_shufflevector ((vnx4sf) x, (vnx4sf) y, MASK_4); + *(vnx4sf*)out = v; +} + +void __attribute__ ((noipa)) +merge10 (vnx2df x, vnx2df y, vnx2df *out) +{ + vnx2df v = __builtin_shufflevector ((vnx2df) x, (vnx2df) y, MASK_2); + *(vnx2df*)out = v; +} + +/* { dg-final { scan-assembler-times {\tvmerge.vvm} 11 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-2.c new file mode 100644 index 0000000..35b2aa8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-2.c @@ -0,0 +1,103 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> + +typedef int8_t vnx32qi __attribute__((vector_size (32))); +typedef int16_t vnx16hi __attribute__((vector_size (32))); +typedef int32_t vnx8si __attribute__((vector_size (32))); +typedef int64_t vnx4di __attribute__((vector_size (32))); +typedef uint8_t vnx32uqi __attribute__((vector_size (32))); +typedef uint16_t vnx16uhi __attribute__((vector_size (32))); +typedef uint32_t vnx8usi __attribute__((vector_size (32))); +typedef uint64_t vnx4udi __attribute__((vector_size (32))); + +typedef _Float16 vnx16hf __attribute__((vector_size (32))); +typedef float vnx8sf __attribute__((vector_size (32))); +typedef double vnx4df __attribute__((vector_size (32))); + +#define MASK_32 0, 33, 2, 35, 4, 37, 6, 39, 8, 41, \ + 10, 43, 12, 45, 14, 47, 16, 49, 18, 51, \ + 20, 53, 22, 55, 24, 57, 26, 59, 28, 61, 30, 63 +#define MASK_16 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31 +#define MASK_8 0, 9, 2, 11, 4, 13, 6, 15 +#define MASK_4 0, 5, 2, 7 + +void __attribute__ ((noipa)) +merge0 (vnx32qi x, vnx32qi y, vnx32qi *out) +{ + vnx32qi v = __builtin_shufflevector ((vnx32qi) x, (vnx32qi) y, MASK_32); + *(vnx32qi*)out = v; +} + +void __attribute__ ((noipa)) +merge1 (vnx32uqi x, vnx32uqi y, vnx32uqi *out) +{ + vnx32uqi v = __builtin_shufflevector ((vnx32uqi) x, (vnx32uqi) y, MASK_32); + *(vnx32uqi*)out = v; +} + +void __attribute__ ((noipa)) +merge2 (vnx16hi x, vnx16hi y, vnx16hi *out) +{ + vnx16hi v = __builtin_shufflevector ((vnx16hi) x, (vnx16hi) y, MASK_16); + *(vnx16hi*)out = v; +} + +void __attribute__ ((noipa)) +merge3 (vnx16uhi x, vnx16uhi y, vnx16uhi *out) +{ + vnx16uhi v = __builtin_shufflevector ((vnx16uhi) x, (vnx16uhi) y, MASK_16); + *(vnx16uhi*)out = v; +} + +void __attribute__ ((noipa)) +merge4 (vnx8si x, vnx8si y, vnx8si *out) +{ + vnx8si v = __builtin_shufflevector ((vnx8si) x, (vnx8si) y, MASK_8); + *(vnx8si*)out = v; +} + +void __attribute__ ((noipa)) +merge5 (vnx8usi x, vnx8usi y, vnx8usi *out) +{ + vnx8usi v = __builtin_shufflevector ((vnx8usi) x, (vnx8usi) y, MASK_8); + *(vnx8usi*)out = v; +} + +void __attribute__ ((noipa)) +merge6 (vnx4di x, vnx4di y, vnx4di *out) +{ + vnx4di v = __builtin_shufflevector ((vnx4di) x, (vnx4di) y, MASK_4); + *(vnx4di*)out = v; +} + +void __attribute__ ((noipa)) +merge7 (vnx4udi x, vnx4udi y, vnx4udi *out) +{ + vnx4udi v = __builtin_shufflevector ((vnx4udi) x, (vnx4udi) y, MASK_4); + *(vnx4udi*)out = v; +} + +void __attribute__ ((noipa)) +merge8 (vnx16hf x, vnx16hf y, vnx16hf *out) +{ + vnx16hf v = __builtin_shufflevector ((vnx16hf) x, (vnx16hf) y, MASK_16); + *(vnx16hf*)out = v; +} + +void __attribute__ ((noipa)) +merge9 (vnx8sf x, vnx8sf y, vnx8sf *out) +{ + vnx8sf v = __builtin_shufflevector ((vnx8sf) x, (vnx8sf) y, MASK_8); + *(vnx8sf*)out = v; +} + +void __attribute__ ((noipa)) +merge10 (vnx4df x, vnx4df y, vnx4df *out) +{ + vnx4df v = __builtin_shufflevector ((vnx4df) x, (vnx4df) y, MASK_4); + *(vnx4df*)out = v; +} + +/* { dg-final { scan-assembler-times {\tvmerge.vvm} 11 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-3.c new file mode 100644 index 0000000..957d5b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-3.c @@ -0,0 +1,109 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> + +typedef int8_t vnx64qi __attribute__((vector_size (64))); +typedef int16_t vnx32hi __attribute__((vector_size (64))); +typedef int32_t vnx16si __attribute__((vector_size (64))); +typedef int64_t vnx8di __attribute__((vector_size (64))); +typedef uint8_t vnx64uqi __attribute__((vector_size (64))); +typedef uint16_t vnx32uhi __attribute__((vector_size (64))); +typedef uint32_t vnx16usi __attribute__((vector_size (64))); +typedef uint64_t vnx8udi __attribute__((vector_size (64))); + +typedef _Float16 vnx32hf __attribute__((vector_size (64))); +typedef float vnx16sf __attribute__((vector_size (64))); +typedef double vnx8df __attribute__((vector_size (64))); + +#define MASK_64 0, 65, 2, 67, 4, 69, 6, 71, 8, 73, \ + 10, 75, 12, 77, 14, 79, 16, 81, 18, 83, \ + 20, 85, 22, 87, 24, 89, 26, 91, 28, 93, 30, 95, \ + 32, 97, 34, 99, 36, 101, 38, 103, 40, 105, \ + 42, 107, 44, 109, 46, 111, 48, 113, 50, 115, \ + 52, 117, 54, 119, 56, 121, 58, 123, 60, 125, \ + 62, 127 +#define MASK_32 0, 33, 2, 35, 4, 37, 6, 39, 8, 41, \ + 10, 43, 12, 45, 14, 47, 16, 49, 18, 51, \ + 20, 53, 22, 55, 24, 57, 26, 59, 28, 61, 30, 63 +#define MASK_16 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31 +#define MASK_8 0, 9, 2, 11, 4, 13, 6, 15 + +void __attribute__ ((noipa)) +merge0 (vnx64qi x, vnx64qi y, vnx64qi *out) +{ + vnx64qi v = __builtin_shufflevector ((vnx64qi) x, (vnx64qi) y, MASK_64); + *(vnx64qi*)out = v; +} + +void __attribute__ ((noipa)) +merge1 (vnx64uqi x, vnx64uqi y, vnx64uqi *out) +{ + vnx64uqi v = __builtin_shufflevector ((vnx64uqi) x, (vnx64uqi) y, MASK_64); + *(vnx64uqi*)out = v; +} + +void __attribute__ ((noipa)) +merge2 (vnx32hi x, vnx32hi y, vnx32hi *out) +{ + vnx32hi v = __builtin_shufflevector ((vnx32hi) x, (vnx32hi) y, MASK_32); + *(vnx32hi*)out = v; +} + +void __attribute__ ((noipa)) +merge3 (vnx32uhi x, vnx32uhi y, vnx32uhi *out) +{ + vnx32uhi v = __builtin_shufflevector ((vnx32uhi) x, (vnx32uhi) y, MASK_32); + *(vnx32uhi*)out = v; +} + +void __attribute__ ((noipa)) +merge4 (vnx16si x, vnx16si y, vnx16si *out) +{ + vnx16si v = __builtin_shufflevector ((vnx16si) x, (vnx16si) y, MASK_16); + *(vnx16si*)out = v; +} + +void __attribute__ ((noipa)) +merge5 (vnx16usi x, vnx16usi y, vnx16usi *out) +{ + vnx16usi v = __builtin_shufflevector ((vnx16usi) x, (vnx16usi) y, MASK_16); + *(vnx16usi*)out = v; +} + +void __attribute__ ((noipa)) +merge6 (vnx8di x, vnx8di y, vnx8di *out) +{ + vnx8di v = __builtin_shufflevector ((vnx8di) x, (vnx8di) y, MASK_8); + *(vnx8di*)out = v; +} + +void __attribute__ ((noipa)) +merge7 (vnx8udi x, vnx8udi y, vnx8udi *out) +{ + vnx8udi v = __builtin_shufflevector ((vnx8udi) x, (vnx8udi) y, MASK_8); + *(vnx8udi*)out = v; +} + +void __attribute__ ((noipa)) +merge8 (vnx32hf x, vnx32hf y, vnx32hf *out) +{ + vnx32hf v = __builtin_shufflevector ((vnx32hf) x, (vnx32hf) y, MASK_32); + *(vnx32hf*)out = v; +} + +void __attribute__ ((noipa)) +merge9 (vnx16sf x, vnx16sf y, vnx16sf *out) +{ + vnx16sf v = __builtin_shufflevector ((vnx16sf) x, (vnx16sf) y, MASK_16); + *(vnx16sf*)out = v; +} + +void __attribute__ ((noipa)) +merge10 (vnx8df x, vnx8df y, vnx8df *out) +{ + vnx8df v = __builtin_shufflevector ((vnx8df) x, (vnx8df) y, MASK_8); + *(vnx8df*)out = v; +} + +/* { dg-final { scan-assembler-times {\tvmerge.vvm} 11 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-4.c new file mode 100644 index 0000000..398d0dc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-4.c @@ -0,0 +1,122 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> + +typedef int8_t vnx128qi __attribute__((vector_size (128))); +typedef int16_t vnx64hi __attribute__((vector_size (128))); +typedef int32_t vnx32si __attribute__((vector_size (128))); +typedef int64_t vnx16di __attribute__((vector_size (128))); +typedef uint8_t vnx128uqi __attribute__((vector_size (128))); +typedef uint16_t vnx64uhi __attribute__((vector_size (128))); +typedef uint32_t vnx32usi __attribute__((vector_size (128))); +typedef uint64_t vnx16udi __attribute__((vector_size (128))); + +typedef _Float16 vnx64hf __attribute__((vector_size (128))); +typedef float vnx32sf __attribute__((vector_size (128))); +typedef double vnx16df __attribute__((vector_size (128))); + +#define MASK_128 0, 129, 2, 131, 4, 133, 6, 135, 8, 137, \ + 10, 139, 12, 141, 14, 143, 16, 145, 18, 147, \ + 20, 149, 22, 151, 24, 153, 26, 155, 28, 157, 30, 159, \ + 32, 161, 34, 163, 36, 165, 38, 167, 40, 169, \ + 42, 171, 44, 173, 46, 175, 48, 177, 50, 179, \ + 52, 181, 54, 183, 56, 185, 58, 187, 60, 189, \ + 62, 191, \ + 64, 193, 66, 195, 68, 197, 70, 199, 72, 201, \ + 74, 203, 76, 205, 78, 207, 80, 209, 82, 211, \ + 84, 213, 86, 215, 88, 217, 90, 219, 92, 221, 94, 223, \ + 96, 225, 98, 227, 100, 229, 102, 231, 104, 233, \ + 106, 235, 108, 237, 110, 239, 112, 241, 114, 243, \ + 116, 245, 118, 247, 120, 249, 122, 251, 124, 253, \ + 126, 255 +#define MASK_64 0, 65, 2, 67, 4, 69, 6, 71, 8, 73, \ + 10, 75, 12, 77, 14, 79, 16, 81, 18, 83, \ + 20, 85, 22, 87, 24, 89, 26, 91, 28, 93, 30, 95, \ + 32, 97, 34, 99, 36, 101, 38, 103, 40, 105, \ + 42, 107, 44, 109, 46, 111, 48, 113, 50, 115, \ + 52, 117, 54, 119, 56, 121, 58, 123, 60, 125, \ + 62, 127 +#define MASK_32 0, 33, 2, 35, 4, 37, 6, 39, 8, 41, \ + 10, 43, 12, 45, 14, 47, 16, 49, 18, 51, \ + 20, 53, 22, 55, 24, 57, 26, 59, 28, 61, 30, 63 +#define MASK_16 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31 + +void __attribute__ ((noipa)) +merge0 (vnx128qi x, vnx128qi y, vnx128qi *out) +{ + vnx128qi v = __builtin_shufflevector ((vnx128qi) x, (vnx128qi) y, MASK_128); + *(vnx128qi*)out = v; +} + +void __attribute__ ((noipa)) +merge1 (vnx128uqi x, vnx128uqi y, vnx128uqi *out) +{ + vnx128uqi v = __builtin_shufflevector ((vnx128uqi) x, (vnx128uqi) y, MASK_128); + *(vnx128uqi*)out = v; +} + +void __attribute__ ((noipa)) +merge2 (vnx64hi x, vnx64hi y, vnx64hi *out) +{ + vnx64hi v = __builtin_shufflevector ((vnx64hi) x, (vnx64hi) y, MASK_64); + *(vnx64hi*)out = v; +} + +void __attribute__ ((noipa)) +merge3 (vnx64uhi x, vnx64uhi y, vnx64uhi *out) +{ + vnx64uhi v = __builtin_shufflevector ((vnx64uhi) x, (vnx64uhi) y, MASK_64); + *(vnx64uhi*)out = v; +} + +void __attribute__ ((noipa)) +merge4 (vnx32si x, vnx32si y, vnx32si *out) +{ + vnx32si v = __builtin_shufflevector ((vnx32si) x, (vnx32si) y, MASK_32); + *(vnx32si*)out = v; +} + +void __attribute__ ((noipa)) +merge5 (vnx32usi x, vnx32usi y, vnx32usi *out) +{ + vnx32usi v = __builtin_shufflevector ((vnx32usi) x, (vnx32usi) y, MASK_32); + *(vnx32usi*)out = v; +} + +void __attribute__ ((noipa)) +merge6 (vnx16di x, vnx16di y, vnx16di *out) +{ + vnx16di v = __builtin_shufflevector ((vnx16di) x, (vnx16di) y, MASK_16); + *(vnx16di*)out = v; +} + +void __attribute__ ((noipa)) +merge7 (vnx16udi x, vnx16udi y, vnx16udi *out) +{ + vnx16udi v = __builtin_shufflevector ((vnx16udi) x, (vnx16udi) y, MASK_16); + *(vnx16udi*)out = v; +} + +void __attribute__ ((noipa)) +merge8 (vnx64hf x, vnx64hf y, vnx64hf *out) +{ + vnx64hf v = __builtin_shufflevector ((vnx64hf) x, (vnx64hf) y, MASK_64); + *(vnx64hf*)out = v; +} + +void __attribute__ ((noipa)) +merge9 (vnx32sf x, vnx32sf y, vnx32sf *out) +{ + vnx32sf v = __builtin_shufflevector ((vnx32sf) x, (vnx32sf) y, MASK_32); + *(vnx32sf*)out = v; +} + +void __attribute__ ((noipa)) +merge10 (vnx16df x, vnx16df y, vnx16df *out) +{ + vnx16df v = __builtin_shufflevector ((vnx16df) x, (vnx16df) y, MASK_16); + *(vnx16df*)out = v; +} + +/* dg-final scan-assembler-times {\tvmerge.vvm} 11 */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-5.c new file mode 100644 index 0000000..4d1b9e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-5.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> + +typedef int8_t vnx8qi __attribute__((vector_size (8))); +typedef int16_t vnx4hi __attribute__((vector_size (8))); +typedef int32_t vnx2si __attribute__((vector_size (8))); +typedef uint8_t vnx8uqi __attribute__((vector_size (8))); +typedef uint16_t vnx4uhi __attribute__((vector_size (8))); +typedef uint32_t vnx2usi __attribute__((vector_size (8))); + +typedef _Float16 vnx4hf __attribute__((vector_size (8))); +typedef float vnx2sf __attribute__((vector_size (8))); + +#define MASK_8 0, 9, 2, 11, 4, 13, 6, 15 +#define MASK_4 0, 5, 2, 7 +#define MASK_2 0, 3 + +void __attribute__ ((noipa)) +merge0 (vnx8qi x, vnx8qi y, vnx8qi *out) +{ + vnx8qi v = __builtin_shufflevector ((vnx8qi) x, (vnx8qi) y, MASK_8); + *(vnx8qi *)out = v; +} + +void __attribute__ ((noipa)) +merge1 (vnx8uqi x, vnx8uqi y, vnx8uqi *out) +{ + vnx8uqi v = __builtin_shufflevector ((vnx8uqi) x, (vnx8uqi) y, MASK_8); + *(vnx8uqi *)out = v; +} + +void __attribute__ ((noipa)) +merge2 (vnx4hi x, vnx4hi y, vnx4hi *out) +{ + vnx4hi v = __builtin_shufflevector ((vnx4hi) x, (vnx4hi) y, MASK_4); + *(vnx4hi *)out = v; +} + +void __attribute__ ((noipa)) +merge3 (vnx4uhi x, vnx4uhi y, vnx4uhi *out) +{ + vnx4uhi v = __builtin_shufflevector ((vnx4uhi) x, (vnx4uhi) y, MASK_4); + *(vnx4uhi *)out = v; +} + +void __attribute__ ((noipa)) +merge4 (vnx2si x, vnx2si y, vnx2si *out) +{ + vnx2si v = __builtin_shufflevector ((vnx2si) x, (vnx2si) y, MASK_2); + *(vnx2si *)out = v; +} + +void __attribute__ ((noipa)) +merge5 (vnx2usi x, vnx2usi y, vnx2usi *out) +{ + vnx2usi v = __builtin_shufflevector ((vnx2usi) x, (vnx2usi) y, MASK_2); + *(vnx2usi *)out = v; +} + +void __attribute__ ((noipa)) +merge6 (vnx4hf x, vnx4hf y, vnx4hf *out) +{ + vnx4hf v = __builtin_shufflevector ((vnx4hf) x, (vnx4hf) y, MASK_4); + *(vnx4hf *)out = v; +} + +void __attribute__ ((noipa)) +merge7 (vnx2sf x, vnx2sf y, vnx2sf *out) +{ + vnx2sf v = __builtin_shufflevector ((vnx2sf) x, (vnx2sf) y, MASK_2); + *(vnx2sf *)out = v; +} + +/* { dg-final { scan-assembler-times {\tvmerge.vvm} 8 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-6.c new file mode 100644 index 0000000..43acea6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-6.c @@ -0,0 +1,51 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> + +typedef int8_t vnx4qi __attribute__((vector_size (4))); +typedef int16_t vnx2hi __attribute__((vector_size (4))); +typedef uint8_t vnx4uqi __attribute__((vector_size (4))); +typedef uint16_t vnx2uhi __attribute__((vector_size (4))); + +typedef _Float16 vnx2hf __attribute__((vector_size (4))); + +#define MASK_4 0, 5, 2, 7 +#define MASK_2 0, 3 + +void __attribute__ ((noipa)) +merge0 (vnx4qi x, vnx4qi y, vnx4qi *out) +{ + vnx4qi v = __builtin_shufflevector ((vnx4qi) x, (vnx4qi) y, MASK_4); + *(vnx4qi*)out = v; +} + +void __attribute__ ((noipa)) +merge1 (vnx4uqi x, vnx4uqi y, vnx4uqi *out) +{ + vnx4uqi v = __builtin_shufflevector ((vnx4uqi) x, (vnx4uqi) y, MASK_4); + *(vnx4uqi*)out = v; +} + +void __attribute__ ((noipa)) +merge2 (vnx2hi x, vnx2hi y, vnx2hi *out) +{ + vnx2hi v = __builtin_shufflevector ((vnx2hi) x, (vnx2hi) y, MASK_2); + *(vnx2hi*)out = v; +} + +void __attribute__ ((noipa)) +merge3 (vnx2uhi x, vnx2uhi y, vnx2uhi *out) +{ + vnx2uhi v = __builtin_shufflevector ((vnx2uhi) x, (vnx2uhi) y, MASK_2); + *(vnx2uhi*)out = v; +} + +void __attribute__ ((noipa)) +merge6 (vnx2hf x, vnx2hf y, vnx2hf *out) +{ + vnx2hf v = __builtin_shufflevector ((vnx2hf) x, (vnx2hf) y, MASK_2); + *(vnx2hf*)out = v; +} + +/* { dg-final { scan-assembler-times {\tvmerge.vvm} 5 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-7.c new file mode 100644 index 0000000..2f38c3d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-7.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint-gcc.h> + +typedef int8_t vnx2qi __attribute__((vector_size (2))); +typedef uint8_t vnx2uqi __attribute__((vector_size (2))); + +#define MASK_2 0, 3 + +void __attribute__ ((noipa)) +merge0 (vnx2qi x, vnx2qi y, vnx2qi *out) +{ + vnx2qi v = __builtin_shufflevector ((vnx2qi) x, (vnx2qi) y, MASK_2); + *(vnx2qi *)out = v; +} + +void __attribute__ ((noipa)) +merge1 (vnx2uqi x, vnx2uqi y, vnx2uqi *out) +{ + vnx2uqi v = __builtin_shufflevector ((vnx2uqi) x, (vnx2uqi) y, MASK_2); + *(vnx2uqi *)out = v; +} + +/* { dg-final { scan-assembler-times {\tvmerge.vvm} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-1.c new file mode 100644 index 0000000..7449f63 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-1.c @@ -0,0 +1,119 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include "merge-1.c" + +int main(void) +{ + vnx16qi vnx16qi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16qi vnx16qi_y= {201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216}; + vnx16qi vnx16qi_expect= {1,202,3,204,5,206,7,208,9,210,11,212,13,214,15,216}; + vnx16qi vnx16qi_real; + merge0(vnx16qi_x,vnx16qi_y, &vnx16qi_real); + for(int i=0; i<16; i++) + if(vnx16qi_real[i]!=vnx16qi_expect[i]) { + __builtin_abort(); + } + + vnx16uqi vnx16uqi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16uqi vnx16uqi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; + vnx16uqi vnx16uqi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116}; + vnx16uqi vnx16uqi_real; + merge1(vnx16uqi_x,vnx16uqi_y, &vnx16uqi_real); + for(int i=0; i<16; i++) + if(vnx16uqi_real[i]!=vnx16uqi_expect[i]) { + __builtin_abort(); + } + + vnx8hi vnx8hi_x= {1,2,3,4,5,6,7,8}; + vnx8hi vnx8hi_y= {101,102,103,104,105,106,107,108}; + vnx8hi vnx8hi_expect= {1,102,3,104,5,106,7,108}; + vnx8hi vnx8hi_real; + merge2(vnx8hi_x,vnx8hi_y, &vnx8hi_real); + for(int i=0; i<8; i++) + if(vnx8hi_real[i]!=vnx8hi_expect[i]) { + __builtin_abort(); + } + + vnx8uhi vnx8uhi_x= {1,2,3,4,5,6,7,8}; + vnx8uhi vnx8uhi_y= {101,102,103,104,105,106,107,108}; + vnx8uhi vnx8uhi_expect= {1,102,3,104,5,106,7,108}; + vnx8uhi vnx8uhi_real; + merge3(vnx8uhi_x,vnx8uhi_y, &vnx8uhi_real); + for(int i=0; i<8; i++) + if(vnx8uhi_real[i]!=vnx8uhi_expect[i]) { + __builtin_abort(); + } + + vnx4si vnx4si_x= {1,2,3,4}; + vnx4si vnx4si_y= {101,102,103,104}; + vnx4si vnx4si_expect= {1,102,3,104}; + vnx4si vnx4si_real; + merge4(vnx4si_x,vnx4si_y,&vnx4si_real); + for(int i=0; i<4; i++) + if(vnx4si_real[i]!=vnx4si_expect[i]) { + __builtin_abort(); + } + + vnx4usi vnx4usi_x= {1,2,3,4}; + vnx4usi vnx4usi_y= {101,102,103,104}; + vnx4usi vnx4usi_expect= {1,102,3,104}; + vnx4usi vnx4usi_real; + merge5(vnx4usi_x,vnx4usi_y,&vnx4usi_real); + for(int i=0; i<4; i++) + if(vnx4usi_real[i]!=vnx4usi_expect[i]) { + __builtin_abort(); + } + + vnx2di vnx2di_x= {1,2}; + vnx2di vnx2di_y= {101,102}; + vnx2di vnx2di_expect= {1,102}; + vnx2di vnx2di_real; + merge6(vnx2di_x,vnx2di_y,&vnx2di_real); + for(int i=0; i<2; i++) + if(vnx2di_real[i]!=vnx2di_expect[i]) { + __builtin_abort(); + } + + vnx2udi vnx2udi_x= {1,2}; + vnx2udi vnx2udi_y= {101,102}; + vnx2udi vnx2udi_expect= {1,102}; + vnx2udi vnx2udi_real; + merge7(vnx2udi_x,vnx2udi_y,&vnx2udi_real); + for(int i=0; i<2; i++) + if(vnx2udi_real[i]!=vnx2udi_expect[i]) { + __builtin_abort(); + } + + vnx8hf vnx8hf_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0}; + vnx8hf vnx8hf_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1}; + vnx8hf vnx8hf_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1}; + vnx8hf vnx8hf_real; + merge8(vnx8hf_x,vnx8hf_y,&vnx8hf_real); + for(int i=0; i<8; i++) + if(vnx8hf_real[i]!=vnx8hf_expect[i]) { + __builtin_abort(); + } + + vnx4sf vnx4sf_x= {1.0,2.0,3.0,4.0}; + vnx4sf vnx4sf_y= {1.1,2.1,3.1,4.1}; + vnx4sf vnx4sf_expect= {1.0,2.1,3.0,4.1}; + vnx4sf vnx4sf_real; + merge9(vnx4sf_x,vnx4sf_y,&vnx4sf_real); + for(int i=0; i<4; i++) + if(vnx4sf_real[i]!=vnx4sf_expect[i]) { + __builtin_abort(); + } + + vnx2df vnx2df_x= {1.0,2.0}; + vnx2df vnx2df_y= {1.1,2.1}; + vnx2df vnx2df_expect= {1.0,2.1}; + vnx2df vnx2df_real; + merge10(vnx2df_x,vnx2df_y,&vnx2df_real); + for(int i=0; i<2; i++) + if(vnx2df_real[i]!=vnx2df_expect[i]) { + __builtin_abort(); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-2.c new file mode 100644 index 0000000..248a304 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-2.c @@ -0,0 +1,121 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include "merge-2.c" + +int main(void) +{ + vnx32qi vnx32qi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; + vnx32qi vnx32qi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132}; + vnx32qi vnx32qi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132}; + vnx32qi vnx32qi_real; + merge0(vnx32qi_x,vnx32qi_y,&vnx32qi_real); + for(int i=0; i<32; i++) + if(vnx32qi_real[i]!=vnx32qi_expect[i]) { + __builtin_abort(); + } + + vnx32uqi vnx32uqi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; + vnx32uqi vnx32uqi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132}; + vnx32uqi vnx32uqi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132}; + vnx32uqi vnx32uqi_real; + merge1(vnx32uqi_x,vnx32uqi_y,&vnx32uqi_real); + for(int i=0; i<32; i++) + if(vnx32uqi_real[i]!=vnx32uqi_expect[i]) { + __builtin_abort(); + } + + + vnx16hi vnx16hi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16hi vnx16hi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; + vnx16hi vnx16hi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116}; + vnx16hi vnx16hi_real; + merge2(vnx16hi_x,vnx16hi_y,&vnx16hi_real); + for(int i=0; i<16; i++) + if(vnx16hi_real[i]!=vnx16hi_expect[i]) { + __builtin_abort(); + } + + vnx16uhi vnx16uhi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16uhi vnx16uhi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; + vnx16uhi vnx16uhi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116}; + vnx16uhi vnx16uhi_real; + merge3(vnx16uhi_x,vnx16uhi_y,&vnx16uhi_real); + for(int i=0; i<16; i++) + if(vnx16uhi_real[i]!=vnx16uhi_expect[i]) { + __builtin_abort(); + } + + vnx8si vnx8si_x= {1,2,3,4,5,6,7,8}; + vnx8si vnx8si_y= {101,102,103,104,105,106,107,108}; + vnx8si vnx8si_expect= {1,102,3,104,5,106,7,108}; + vnx8si vnx8si_real; + merge4(vnx8si_x,vnx8si_y,&vnx8si_real); + for(int i=0; i<8; i++) + if(vnx8si_real[i]!=vnx8si_expect[i]) { + __builtin_abort(); + } + + vnx8usi vnx8usi_x= {1,2,3,4,5,6,7,8}; + vnx8usi vnx8usi_y= {101,102,103,104,105,106,107,108}; + vnx8usi vnx8usi_expect= {1,102,3,104,5,106,7,108}; + vnx8usi vnx8usi_real; + merge5(vnx8usi_x,vnx8usi_y,&vnx8usi_real); + for(int i=0; i<8; i++) + if(vnx8usi_real[i]!=vnx8usi_expect[i]) { + __builtin_abort(); + } + + vnx4di vnx4di_x= {1,2,3,4}; + vnx4di vnx4di_y= {101,102,103,104}; + vnx4di vnx4di_expect= {1,102,3,104}; + vnx4di vnx4di_real; + merge6(vnx4di_x,vnx4di_y,&vnx4di_real); + for(int i=0; i<4; i++) + if(vnx4di_real[i]!=vnx4di_expect[i]) { + __builtin_abort(); + } + + vnx4udi vnx4udi_x= {1,2,3,4}; + vnx4udi vnx4udi_y= {101,102,103,104}; + vnx4udi vnx4udi_expect= {1,102,3,104}; + vnx4udi vnx4udi_real; + merge7(vnx4udi_x,vnx4udi_y,&vnx4udi_real); + for(int i=0; i<4; i++) + if(vnx4udi_real[i]!=vnx4udi_expect[i]) { + __builtin_abort(); + } + + + vnx16hf vnx16hf_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0}; + vnx16hf vnx16hf_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1}; + vnx16hf vnx16hf_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1,9.0,10.1,11.0,12.1,13.0,14.1,15.0,16.1}; + vnx16hf vnx16hf_real; + merge8(vnx16hf_x,vnx16hf_y,&vnx16hf_real); + for(int i=0; i<8; i++) + if(vnx16hf_real[i]!=vnx16hf_expect[i]) { + __builtin_abort(); + } + + vnx8sf vnx8sf_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0}; + vnx8sf vnx8sf_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1}; + vnx8sf vnx8sf_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1}; + vnx8sf vnx8sf_real; + merge9(vnx8sf_x,vnx8sf_y,&vnx8sf_real); + for(int i=0; i<4; i++) + if(vnx8sf_real[i]!=vnx8sf_expect[i]) { + __builtin_abort(); + } + + vnx4df vnx4df_x= {1.0,2.0,3.0,4.0}; + vnx4df vnx4df_y= {1.1,2.1,3.1,4.1}; + vnx4df vnx4df_expect= {1.0,2.1,3.0,4.1}; + vnx4df vnx4df_real; + merge10(vnx4df_x,vnx4df_y,&vnx4df_real); + for(int i=0; i<2; i++) + if(vnx4df_real[i]!=vnx4df_expect[i]) { + __builtin_abort(); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-3.c new file mode 100644 index 0000000..a587dd4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-3.c @@ -0,0 +1,150 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include "merge-3.c" + +int main(void) +{ + vnx64qi vnx64qi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,\ + 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,\ + 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,\ + 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 + }; + vnx64qi vnx64qi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,\ + 117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,\ + 133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,\ + 149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + }; + vnx64qi vnx64qi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,\ + 17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132,\ + 33,134,35,136,37,138,39,140,41,142,43,144,45,146,47,148,\ + 49,150,51,152,53,154,55,156,57,158,59,160,61,162,63,164, + }; + vnx64qi vnx64qi_real; + merge0(vnx64qi_x,vnx64qi_y,&vnx64qi_real); + for(int i=0; i<64; i++) + if(vnx64qi_real[i]!=vnx64qi_expect[i]) { + __builtin_abort(); + } + + vnx64uqi vnx64uqi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,\ + 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,\ + 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,\ + 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 + }; + vnx64uqi vnx64uqi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,\ + 117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,\ + 133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,\ + 149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + }; + vnx64uqi vnx64uqi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,\ + 17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132,\ + 33,134,35,136,37,138,39,140,41,142,43,144,45,146,47,148,\ + 49,150,51,152,53,154,55,156,57,158,59,160,61,162,63,164, + }; + vnx64uqi vnx64uqi_real; + merge1(vnx64uqi_x,vnx64uqi_y,&vnx64uqi_real); + for(int i=0; i<64; i++) + if(vnx64uqi_real[i]!=vnx64uqi_expect[i]) { + __builtin_abort(); + } + + vnx32hi vnx32hi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; + vnx32hi vnx32hi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132}; + vnx32hi vnx32hi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132}; + vnx32hi vnx32hi_real; + merge2(vnx32hi_x,vnx32hi_y,&vnx32hi_real); + for(int i=0; i<32; i++) + if(vnx32hi_real[i]!=vnx32hi_expect[i]) { + __builtin_abort(); + } + + vnx32uhi vnx32uhi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; + vnx32uhi vnx32uhi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132}; + vnx32uhi vnx32uhi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132}; + vnx32uhi vnx32uhi_real; + merge3(vnx32uhi_x,vnx32uhi_y,&vnx32uhi_real); + for(int i=0; i<32; i++) + if(vnx32uhi_real[i]!=vnx32uhi_expect[i]) { + __builtin_abort(); + } + + + vnx16si vnx16si_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16si vnx16si_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; + vnx16si vnx16si_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116}; + vnx16si vnx16si_real; + merge4(vnx16si_x,vnx16si_y,&vnx16si_real); + for(int i=0; i<16; i++) + if(vnx16si_real[i]!=vnx16si_expect[i]) { + __builtin_abort(); + } + + vnx16usi vnx16usi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16usi vnx16usi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; + vnx16usi vnx16usi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116}; + vnx16usi vnx16usi_real; + merge5(vnx16usi_x,vnx16usi_y,&vnx16usi_real); + for(int i=0; i<16; i++) + if(vnx16usi_real[i]!=vnx16usi_expect[i]) { + __builtin_abort(); + } + + vnx8di vnx8di_x= {1,2,3,4,5,6,7,8}; + vnx8di vnx8di_y= {101,102,103,104,105,106,107,108}; + vnx8di vnx8di_expect= {1,102,3,104,5,106,7,108}; + vnx8di vnx8di_real; + merge6(vnx8di_x,vnx8di_y,&vnx8di_real); + for(int i=0; i<8; i++) + if(vnx8di_real[i]!=vnx8di_expect[i]) { + __builtin_abort(); + } + + vnx8udi vnx8udi_x= {1,2,3,4,5,6,7,8}; + vnx8udi vnx8udi_y= {101,102,103,104,105,106,107,108}; + vnx8udi vnx8udi_expect= {1,102,3,104,5,106,7,108}; + vnx8udi vnx8udi_real; + merge7(vnx8udi_x,vnx8udi_y,&vnx8udi_real); + for(int i=0; i<8; i++) + if(vnx8udi_real[i]!=vnx8udi_expect[i]) { + __builtin_abort(); + } + + vnx32hf vnx32hf_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,\ + 17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0 + }; + vnx32hf vnx32hf_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1,\ + 17.1,18.1,19.1,20.1,21.1,22.1,23.1,24.1,25.1,26.1,27.1,28.1,29.1,30.1,31.1,32.1 + }; + vnx32hf vnx32hf_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1,9.0,10.1,11.0,12.1,13.0,14.1,15.0,16.1,\ + 17.0,18.1,19.0,20.1,21.0,22.1,23.0,24.1,25.0,26.1,27.0,28.1,29.0,30.1,31.0,32.1 + }; + vnx32hf vnx32hf_real; + merge8(vnx32hf_x,vnx32hf_y,&vnx32hf_real); + for(int i=0; i<32; i++) + if(vnx32hf_real[i]!=vnx32hf_expect[i]) { + __builtin_abort(); + } + + vnx16sf vnx16sf_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0}; + vnx16sf vnx16sf_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1}; + vnx16sf vnx16sf_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1,9.0,10.1,11.0,12.1,13.0,14.1,15.0,16.1}; + vnx16sf vnx16sf_real; + merge9(vnx16sf_x,vnx16sf_y,&vnx16sf_real); + for(int i=0; i<16; i++) + if(vnx16sf_real[i]!=vnx16sf_expect[i]) { + __builtin_abort(); + } + + vnx8df vnx8df_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0}; + vnx8df vnx8df_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1}; + vnx8df vnx8df_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1}; + vnx8df vnx8df_real; + merge10(vnx8df_x,vnx8df_y,&vnx8df_real); + for(int i=0; i<8; i++) + if(vnx8df_real[i]!=vnx8df_expect[i]) { + __builtin_abort(); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-4.c new file mode 100644 index 0000000..18dedb0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-4.c @@ -0,0 +1,210 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include "merge-4.c" + +int main(void) +{ + vnx128qi vnx128qi_x= {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\ + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,\ + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,\ + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,\ + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,\ + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,\ + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,\ + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127 + }; + vnx128qi vnx128qi_y= {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,\ + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,\ + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,\ + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,\ + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,\ + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,\ + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,\ + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 + }; + vnx128qi vnx128qi_expect= {0,129,2,131,4,133,6,135,8,137,10,139,12,141,14,143,\ + 16,145,18,147,20,149,22,151,24,153,26,155,28,157,30,159,\ + 32,161,34,163,36,165,38,167,40,169,42,171,44,173,46,175,\ + 48,177,50,179,52,181,54,183,56,185,58,187,60,189,62,191,\ + 64,193,66,195,68,197,70,199,72,201,74,203,76,205,78,207,\ + 80,209,82,211,84,213,86,215,88,217,90,219,92,221,94,223,\ + 96,225,98,227,100,229,102,231,104,233,106,235,108,237,110,239,\ + 112,241,114,243,116,245,118,247,120,249,122,251,124,253,126,255 + }; + vnx128qi vnx128qi_real; + merge0(vnx128qi_x,vnx128qi_y,&vnx128qi_real); + for(int i=0; i<128; i++) + if(vnx128qi_real[i]!=vnx128qi_expect[i]) { + __builtin_abort(); + } + + vnx128uqi vnx128uqi_x= {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\ + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,\ + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,\ + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,\ + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,\ + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,\ + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,\ + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127 + }; + vnx128uqi vnx128uqi_y= {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,\ + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,\ + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,\ + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,\ + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,\ + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,\ + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,\ + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 + }; + vnx128uqi vnx128uqi_expect= {0,129,2,131,4,133,6,135,8,137,10,139,12,141,14,143,\ + 16,145,18,147,20,149,22,151,24,153,26,155,28,157,30,159,\ + 32,161,34,163,36,165,38,167,40,169,42,171,44,173,46,175,\ + 48,177,50,179,52,181,54,183,56,185,58,187,60,189,62,191,\ + 64,193,66,195,68,197,70,199,72,201,74,203,76,205,78,207,\ + 80,209,82,211,84,213,86,215,88,217,90,219,92,221,94,223,\ + 96,225,98,227,100,229,102,231,104,233,106,235,108,237,110,239,\ + 112,241,114,243,116,245,118,247,120,249,122,251,124,253,126,255 + }; + vnx128uqi vnx128uqi_real; + merge1(vnx128uqi_x,vnx128uqi_y,&vnx128uqi_real); + for(int i=0; i<128; i++) + if(vnx128uqi_real[i]!=vnx128uqi_expect[i]) { + __builtin_abort(); + } + + vnx64hi vnx64hi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,\ + 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,\ + 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,\ + 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 + }; + vnx64hi vnx64hi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,\ + 117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,\ + 133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,\ + 149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + }; + vnx64hi vnx64hi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,\ + 17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132,\ + 33,134,35,136,37,138,39,140,41,142,43,144,45,146,47,148,\ + 49,150,51,152,53,154,55,156,57,158,59,160,61,162,63,164, + }; + vnx64hi vnx64hi_real; + merge2(vnx64hi_x,vnx64hi_y,&vnx64hi_real); + for(int i=0; i<64; i++) + if(vnx64hi_real[i]!=vnx64hi_expect[i]) { + __builtin_abort(); + } + + vnx64uhi vnx64uhi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,\ + 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,\ + 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,\ + 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 + }; + vnx64uhi vnx64uhi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,\ + 117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,\ + 133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,\ + 149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164 + }; + vnx64uhi vnx64uhi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,\ + 17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132,\ + 33,134,35,136,37,138,39,140,41,142,43,144,45,146,47,148,\ + 49,150,51,152,53,154,55,156,57,158,59,160,61,162,63,164, + }; + vnx64uhi vnx64uhi_real; + merge3(vnx64uhi_x,vnx64uhi_y,&vnx64uhi_real); + for(int i=0; i<64; i++) + if(vnx64uhi_real[i]!=vnx64uhi_expect[i]) { + __builtin_abort(); + } + + vnx32si vnx32si_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; + vnx32si vnx32si_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132}; + vnx32si vnx32si_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132}; + vnx32si vnx32si_real; + merge4(vnx32si_x,vnx32si_y,&vnx32si_real); + for(int i=0; i<32; i++) + if(vnx32si_real[i]!=vnx32si_expect[i]) { + __builtin_abort(); + } + + vnx32usi vnx32usi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; + vnx32usi vnx32usi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132}; + vnx32usi vnx32usi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116,17,118,19,120,21,122,23,124,25,126,27,128,29,130,31,132}; + vnx32usi vnx32usi_real; + merge5(vnx32usi_x,vnx32usi_y,&vnx32usi_real); + for(int i=0; i<32; i++) + if(vnx32usi_real[i]!=vnx32usi_expect[i]) { + __builtin_abort(); + } + + + vnx16di vnx16di_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16di vnx16di_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; + vnx16di vnx16di_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116}; + vnx16di vnx16di_real; + merge6(vnx16di_x,vnx16di_y,&vnx16di_real); + for(int i=0; i<16; i++) + if(vnx16di_real[i]!=vnx16di_expect[i]) { + __builtin_abort(); + } + + vnx16udi vnx16udi_x= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + vnx16udi vnx16udi_y= {101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116}; + vnx16udi vnx16udi_expect= {1,102,3,104,5,106,7,108,9,110,11,112,13,114,15,116}; + vnx16udi vnx16udi_real; + merge7(vnx16udi_x,vnx16udi_y,&vnx16udi_real); + for(int i=0; i<16; i++) + if(vnx16udi_real[i]!=vnx16udi_expect[i]) { + __builtin_abort(); + } + + vnx64hf vnx64hf_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,\ + 17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,\ + 33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,\ + 49.0,50.0,51.0,52.0,53.0,54.0,55.0,56.0,57.0,58.0,59.0,60.0,61.0,62.0,63.0,64.0 + }; + vnx64hf vnx64hf_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1,\ + 17.1,18.1,19.1,20.1,21.1,22.1,23.1,24.1,25.1,26.1,27.1,28.1,29.1,30.1,31.1,32.1,\ + 33.1,34.1,35.1,36.1,37.1,38.1,39.1,40.1,41.1,42.1,43.1,44.1,45.1,46.1,47.1,48.1,\ + 49.1,50.1,51.1,52.1,53.1,54.1,55.1,56.1,57.1,58.1,59.1,60.1,61.1,62.1,63.1,64.1 + }; + vnx64hf vnx64hf_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1,9.0,10.1,11.0,12.1,13.0,14.1,15.0,16.1,\ + 17.0,18.1,19.0,20.1,21.0,22.1,23.0,24.1,25.0,26.1,27.0,28.1,29.0,30.1,31.0,32.1,\ + 33.0,34.1,35.0,36.1,37.0,38.1,39.0,40.1,41.0,42.1,43.0,44.1,45.0,46.1,47.0,48.1,\ + 49.0,50.1,51.0,52.1,53.0,54.1,55.0,56.1,57.0,58.1,59.0,60.1,61.0,62.1,63.0,64.1 + }; + vnx64hf vnx64hf_real; + merge8(vnx64hf_x,vnx64hf_y,&vnx64hf_real); + for(int i=0; i<64; i++) + if(vnx64hf_real[i]!=vnx64hf_expect[i]) { + __builtin_abort(); + } + + vnx32sf vnx32sf_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,\ + 17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0 + }; + vnx32sf vnx32sf_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1,\ + 17.1,18.1,19.1,20.1,21.1,22.1,23.1,24.1,25.1,26.1,27.1,28.1,29.1,30.1,31.1,32.1 + }; + vnx32sf vnx32sf_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1,9.0,10.1,11.0,12.1,13.0,14.1,15.0,16.1,\ + 17.0,18.1,19.0,20.1,21.0,22.1,23.0,24.1,25.0,26.1,27.0,28.1,29.0,30.1,31.0,32.1 + }; + vnx32sf vnx32sf_real; + merge9(vnx32sf_x,vnx32sf_y,&vnx32sf_real); + for(int i=0; i<32; i++) + if(vnx32sf_real[i]!=vnx32sf_expect[i]) { + __builtin_abort(); + } + + vnx16df vnx16df_x= {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0}; + vnx16df vnx16df_y= {1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1}; + vnx16df vnx16df_expect= {1.0,2.1,3.0,4.1,5.0,6.1,7.0,8.1,9.0,10.1,11.0,12.1,13.0,14.1,15.0,16.1}; + vnx16df vnx16df_real; + merge10(vnx16df_x,vnx16df_y,&vnx16df_real); + for(int i=0; i<16; i++) + if(vnx16df_real[i]!=vnx16df_expect[i]) { + __builtin_abort(); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-5.c new file mode 100644 index 0000000..61dbd5b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-5.c @@ -0,0 +1,89 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include "merge-5.c" + +int main(void) +{ + vnx8qi vnx8qi_x= {1,2,3,4,5,6,7,8}; + vnx8qi vnx8qi_y= {101,102,103,104,105,106,107,108}; + vnx8qi vnx8qi_expect= {1,102,3,104,5,106,7,108}; + vnx8qi vnx8qi_real; + merge0(vnx8qi_x,vnx8qi_y,&vnx8qi_real); + for(int i=0; i<8; i++) + if(vnx8qi_real[i]!=vnx8qi_expect[i]) { + __builtin_abort(); + } + + vnx8uqi vnx8uqi_x= {1,2,3,4,5,6,7,8}; + vnx8uqi vnx8uqi_y= {101,102,103,104,105,106,107,108}; + vnx8uqi vnx8uqi_expect= {1,102,3,104,5,106,7,108}; + vnx8uqi vnx8uqi_real; + merge1(vnx8uqi_x,vnx8uqi_y,&vnx8uqi_real); + for(int i=0; i<8; i++) + if(vnx8uqi_real[i]!=vnx8uqi_expect[i]) { + __builtin_abort(); + } + + vnx4hi vnx4hi_x= {1,2,3,4}; + vnx4hi vnx4hi_y= {101,102,103,104}; + vnx4hi vnx4hi_expect= {1,102,3,104}; + vnx4hi vnx4hi_real; + merge2(vnx4hi_x,vnx4hi_y,&vnx4hi_real); + for(int i=0; i<4; i++) + if(vnx4hi_real[i]!=vnx4hi_expect[i]) { + __builtin_abort(); + } + + vnx4uhi vnx4uhi_x= {1,2,3,4}; + vnx4uhi vnx4uhi_y= {101,102,103,104}; + vnx4uhi vnx4uhi_expect= {1,102,3,104}; + vnx4uhi vnx4uhi_real; + merge3(vnx4uhi_x,vnx4uhi_y,&vnx4uhi_real); + for(int i=0; i<4; i++) + if(vnx4uhi_real[i]!=vnx4uhi_expect[i]) { + __builtin_abort(); + } + + vnx2si vnx2si_x= {1,2}; + vnx2si vnx2si_y= {101,102}; + vnx2si vnx2si_expect= {1,102}; + vnx2si vnx2si_real; + merge4(vnx2si_x,vnx2si_y,&vnx2si_real); + for(int i=0; i<2; i++) + if(vnx2si_real[i]!=vnx2si_expect[i]) { + __builtin_abort(); + } + + vnx2usi vnx2usi_x= {1,2}; + vnx2usi vnx2usi_y= {101,102}; + vnx2usi vnx2usi_expect= {1,102}; + vnx2usi vnx2usi_real; + merge5(vnx2usi_x,vnx2usi_y,&vnx2usi_real); + for(int i=0; i<2; i++) + if(vnx2usi_real[i]!=vnx2usi_expect[i]) { + __builtin_abort(); + } + + vnx4hf vnx4hf_x= {1.0,2.0,3.0,4.0}; + vnx4hf vnx4hf_y= {1.1,2.1,3.1,4.1}; + vnx4hf vnx4hf_expect= {1.0,2.1,3.0,4.1}; + vnx4hf vnx4hf_real; + merge6(vnx4hf_x,vnx4hf_y,&vnx4hf_real); + for(int i=0; i<4; i++) + if(vnx4hf_real[i]!=vnx4hf_expect[i]) { + __builtin_abort(); + } + + vnx2sf vnx2sf_x= {1.0,2.0}; + vnx2sf vnx2sf_y= {1.1,2.1}; + vnx2sf vnx2sf_expect= {1.0,2.1}; + vnx2sf vnx2sf_real; + merge7(vnx2sf_x,vnx2sf_y,&vnx2sf_real); + for(int i=0; i<2; i++) + if(vnx2sf_real[i]!=vnx2sf_expect[i]) { + __builtin_abort(); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-6.c new file mode 100644 index 0000000..da7c462 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-6.c @@ -0,0 +1,59 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include "merge-6.c" + +int main(void) +{ + vnx4qi vnx4qi_x= {1,2,3,4}; + vnx4qi vnx4qi_y= {101,102,103,104}; + vnx4qi vnx4qi_expect= {1,102,3,104}; + vnx4qi vnx4qi_real; + merge0(vnx4qi_x,vnx4qi_y,&vnx4qi_real); + for(int i=0; i<4; i++) + if(vnx4qi_real[i]!=vnx4qi_expect[i]) { + __builtin_abort(); + } + + vnx4uqi vnx4uqi_x= {1,2,3,4}; + vnx4uqi vnx4uqi_y= {101,102,103,104}; + vnx4uqi vnx4uqi_expect= {1,102,3,104}; + vnx4uqi vnx4uqi_real; + merge1(vnx4uqi_x,vnx4uqi_y,&vnx4uqi_real); + for(int i=0; i<4; i++) + if(vnx4uqi_real[i]!=vnx4uqi_expect[i]) { + __builtin_abort(); + } + + vnx2hi vnx2hi_x= {1,2}; + vnx2hi vnx2hi_y= {101,102}; + vnx2hi vnx2hi_expect= {1,102}; + vnx2hi vnx2hi_real; + merge2(vnx2hi_x,vnx2hi_y,&vnx2hi_real); + for(int i=0; i<2; i++) + if(vnx2hi_real[i]!=vnx2hi_expect[i]) { + __builtin_abort(); + } + + vnx2uhi vnx2uhi_x= {1,2}; + vnx2uhi vnx2uhi_y= {101,102}; + vnx2uhi vnx2uhi_expect= {1,102}; + vnx2uhi vnx2uhi_real; + merge3(vnx2uhi_x,vnx2uhi_y,&vnx2uhi_real); + for(int i=0; i<2; i++) + if(vnx2uhi_real[i]!=vnx2uhi_expect[i]) { + __builtin_abort(); + } + + vnx2hf vnx2hf_x= {1.0,2.0}; + vnx2hf vnx2hf_y= {1.1,2.1}; + vnx2hf vnx2hf_expect= {1.0,2.1}; + vnx2hf vnx2hf_real; + merge6(vnx2hf_x,vnx2hf_y,&vnx2hf_real); + for(int i=0; i<2; i++) + if(vnx2hf_real[i]!=vnx2hf_expect[i]) { + __builtin_abort(); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-7.c new file mode 100644 index 0000000..7aaa6b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-7.c @@ -0,0 +1,29 @@ +/* { dg-do run { target { riscv_vector } } } */ +/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */ + +#include "merge-7.c" + +int main(void) +{ + vnx2qi vnx2qi_x= {1,2}; + vnx2qi vnx2qi_y= {101,102}; + vnx2qi vnx2qi_expect= {1,102}; + vnx2qi vnx2qi_real; + merge0(vnx2qi_x,vnx2qi_y,&vnx2qi_real); + for(int i=0; i<2; i++) + if(vnx2qi_real[i]!=vnx2qi_expect[i]) { + __builtin_abort(); + } + + vnx2uqi vnx2uqi_x= {1,2}; + vnx2uqi vnx2uqi_y= {101,102}; + vnx2uqi vnx2uqi_expect= {1,102}; + vnx2uqi vnx2uqi_real; + merge1(vnx2uqi_x,vnx2uqi_y,&vnx2uqi_real); + for(int i=0; i<2; i++) + if(vnx2uqi_real[i]!=vnx2uqi_expect[i]) { + __builtin_abort(); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/binop_vx_constraint-120.c b/gcc/testsuite/gcc.target/riscv/rvv/base/binop_vx_constraint-120.c index 809b185..cc37346 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/binop_vx_constraint-120.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/binop_vx_constraint-120.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -Wno-psabi" } */ #include "riscv_vector.h" vint16mf4_t test___riscv_vwmulsu_vx_i16mf4(vbool64_t mask, vint16mf4_t merge, vint8mf8_t op1,int8_t op2,size_t vl) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/integer_compare_insn_shortcut.c b/gcc/testsuite/gcc.target/riscv/rvv/base/integer_compare_insn_shortcut.c index 1bca846..2942e0b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/integer_compare_insn_shortcut.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/integer_compare_insn_shortcut.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64 -O3" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c index 57d0241..a6df121 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64 -O3" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c b/gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c index 9563c8d..276173d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64 -O3" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ #include "riscv_vector.h" vbool1_t test_vreinterpret_v_i8m1_b1 (vint8m1_t src) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr110109-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110109-2.c index e8b5bf8..c1df69ac 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr110109-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110109-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -march=rv32gcv -mabi=ilp32d" } */ +/* { dg-options "-O3 -march=rv32gcv -mabi=ilp32d -Wno-psabi" } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-1.c new file mode 100644 index 0000000..f16502b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv --param=riscv-autovec-preference=fixed-vlmax" } */ + +#include "riscv_vector.h" + +typedef int8_t vnx2qi __attribute__ ((vector_size (2))); + +__attribute__ ((noipa)) vnx2qi +f_vnx2qi (int8_t a, int8_t b, int8_t *out) +{ + vnx2qi v = {a, b}; + return v; +} + +__attribute__ ((noipa)) vnx2qi +f_vnx2qi_2 (vnx2qi a, int8_t *out) +{ + return a; +} + +__attribute__ ((noipa)) vint32m1_t +f_vint32m1 (int8_t *a, int8_t *out) +{ + vint32m1_t v = *(vint32m1_t *) a; + return v; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-2.c new file mode 100644 index 0000000..b233ff1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110119-2.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gczve32x --param=riscv-autovec-preference=fixed-vlmax" } */ + +#include <stdint.h> +#include "riscv_vector.h" + +__attribute__ ((noipa)) vint32m1x3_t +foo1 (int32_t *in, int vl) +{ + vint32m1x3_t v = __riscv_vlseg3e32_v_i32m1x3 (in, vl); + return v; +} + +__attribute__ ((noipa)) void +foo2 (vint32m1x3_t a, int32_t *out, int vl) +{ + __riscv_vsseg3e32_v_i32m1x3 (out, a, vl); +} + +__attribute__ ((noipa)) vint32m1x3_t +foo3 (vint32m1x3_t a, int32_t *out, int32_t *in, int vl) +{ + __riscv_vsseg3e32_v_i32m1x3 (out, a, vl); + vint32m1x3_t v = __riscv_vlseg3e32_v_i32m1x3 (in, vl); + return v; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/scalar_move-9.c b/gcc/testsuite/gcc.target/riscv/rvv/base/scalar_move-9.c index 80ee1b5..9c310bb 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/scalar_move-9.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/scalar_move-9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv32gcv -mabi=ilp32d -fno-schedule-insns -fno-schedule-insns2 -O3" } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32d -fno-schedule-insns -fno-schedule-insns2 -O3 -Wno-psabi" } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-10.c b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-10.c index d37857e..89c96c8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-10.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-10.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv32gcv -mabi=ilp32 -mpreferred-stack-boundary=3 -fno-schedule-insns -fno-schedule-insns2 -O3" } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -mpreferred-stack-boundary=3 -fno-schedule-insns -fno-schedule-insns2 -O3 -Wno-psabi" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-11.c b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-11.c index aa2e5e7..179be1c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-11.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-11.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-msave-restore -march=rv32gc_zve64d -mabi=ilp32 -msave-restore -fno-schedule-insns -fno-schedule-insns2 -O3" } */ +/* { dg-options "-msave-restore -march=rv32gc_zve64d -mabi=ilp32 -msave-restore -fno-schedule-insns -fno-schedule-insns2 -O3 -Wno-psabi" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c index ec67357..5464a29 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv32gc_zve64d -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -O3" } */ +/* { dg-options "-march=rv32gc_zve64d -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -O3 -Wno-psabi" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c index 501d98c..51f4fac 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2 -Wno-psabi" } */ #include <riscv_vector.h> diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zero_base_load_store_optimization.c b/gcc/testsuite/gcc.target/riscv/rvv/base/zero_base_load_store_optimization.c index fbcfb7b..b27e5cc 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/zero_base_load_store_optimization.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zero_base_load_store_optimization.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv -mabi=lp64 -O3" } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-intrinsic.c b/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-intrinsic.c index c951644..0e7c7cd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-intrinsic.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-intrinsic.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3" } */ +/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3 -Wno-psabi" } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c b/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c index c3ed419..9ae7966 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvfh-over-zvfhmin.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3" } */ +/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3 -Wno-psabi" } */ #include "riscv_vector.h" @@ -61,6 +61,14 @@ vfloat16m8_t test_vundefined_f16m8() { return __riscv_vundefined_f16m8(); } +vfloat16m2_t test_vset_v_f16m1_f16m2(vfloat16m2_t dest, size_t index, vfloat16m1_t val) { + return __riscv_vset_v_f16m1_f16m2(dest, 0, val); +} + +vfloat16m4_t test_vget_v_f16m8_f16m4(vfloat16m8_t src, size_t index) { + return __riscv_vget_v_f16m8_f16m4(src, 0); +} + /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 } } */ /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e16,\s*m4,\s*t[au],\s*m[au]} 2 } } */ /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e16,\s*m8,\s*t[au],\s*m[au]} 1 } } */ @@ -71,7 +79,10 @@ vfloat16m8_t test_vundefined_f16m8() { /* { dg-final { scan-assembler-times {vfncvt\.f\.f\.w\s+v[0-9]+,\s*v[0-9]+} 2 } } */ /* { dg-final { scan-assembler-times {vle16\.v\s+v[0-9]+,\s*0\([0-9ax]+\)} 7 } } */ /* { dg-final { scan-assembler-times {vse16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 6 } } */ -/* { dg-final { scan-assembler-times {vl4re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 1 } } */ +/* { dg-final { scan-assembler-times {vl1re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 1 } } */ +/* { dg-final { scan-assembler-times {vl2re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 1 } } */ +/* { dg-final { scan-assembler-times {vl4re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 3 } } */ /* { dg-final { scan-assembler-times {vl8re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 1 } } */ -/* { dg-final { scan-assembler-times {vs4r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 1 } } */ +/* { dg-final { scan-assembler-times {vs2r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 1 } } */ +/* { dg-final { scan-assembler-times {vs4r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 3 } } */ /* { dg-final { scan-assembler-times {vs8r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 5 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c b/gcc/testsuite/gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c index 8d39a2e..fc70c54 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64 -O3" } */ +/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64 -O3 -Wno-psabi" } */ #include "riscv_vector.h" @@ -165,6 +165,22 @@ vfloat16m8_t test_vundefined_f16m8() { return __riscv_vundefined_f16m8(); } +vfloat16m2_t test_vset_v_f16m1_f16m2(vfloat16m2_t dest, size_t index, vfloat16m1_t val) { + return __riscv_vset_v_f16m1_f16m2(dest, 0, val); +} + +vfloat16m8_t test_vset_v_f16m4_f16m8(vfloat16m8_t dest, size_t index, vfloat16m4_t val) { + return __riscv_vset_v_f16m4_f16m8(dest, 0, val); +} + +vfloat16m1_t test_vget_v_f16m2_f16m1(vfloat16m2_t src, size_t index) { + return __riscv_vget_v_f16m2_f16m1(src, 0); +} + +vfloat16m4_t test_vget_v_f16m8_f16m4(vfloat16m8_t src, size_t index) { + return __riscv_vget_v_f16m8_f16m4(src, 0); +} + /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 } } */ /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 } } */ /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e16,\s*m1,\s*t[au],\s*m[au]} 2 } } */ @@ -180,11 +196,11 @@ vfloat16m8_t test_vundefined_f16m8() { /* { dg-final { scan-assembler-times {vfncvt\.f\.f\.w\s+v[0-9]+,\s*v[0-9]+} 5 } } */ /* { dg-final { scan-assembler-times {vle16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 20 } } */ /* { dg-final { scan-assembler-times {vse16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 15 } } */ -/* { dg-final { scan-assembler-times {vl1re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 3 } } */ -/* { dg-final { scan-assembler-times {vl2re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 3 } } */ -/* { dg-final { scan-assembler-times {vl8re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 4 } } */ -/* { dg-final { scan-assembler-times {vl4re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 3 } } */ -/* { dg-final { scan-assembler-times {vs1r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 4 } } */ -/* { dg-final { scan-assembler-times {vs2r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 4 } } */ -/* { dg-final { scan-assembler-times {vs4r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 4 } } */ -/* { dg-final { scan-assembler-times {vs8r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 12 } } */ +/* { dg-final { scan-assembler-times {vl1re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 5 } } */ +/* { dg-final { scan-assembler-times {vl2re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 4 } } */ +/* { dg-final { scan-assembler-times {vl8re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 5 } } */ +/* { dg-final { scan-assembler-times {vl4re16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 5 } } */ +/* { dg-final { scan-assembler-times {vs1r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 5 } } */ +/* { dg-final { scan-assembler-times {vs2r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 5 } } */ +/* { dg-final { scan-assembler-times {vs4r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 5 } } */ +/* { dg-final { scan-assembler-times {vs8r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 13 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-1.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-1.c index b82e249..0e76f67 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -Wno-psabi" } */ #include "riscv_vector.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-23.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-23.c index 66c90ac..f3420be 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-23.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-23.c @@ -34,4 +34,4 @@ void f(int8_t *base, int8_t *out, size_t vl, size_t m, size_t k) { /* { dg-final { scan-assembler-times {slli\s+[a-x0-9]+,\s*[a-x0-9]+,\s*4} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ /* { dg-final { scan-assembler-times {srli\s+[a-x0-9]+,\s*[a-x0-9]+,\s*8} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ /* { dg-final { scan-assembler-times {vsetvli} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-g" no-opts "-funroll-loops" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 5 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/vector-abi-1.c b/gcc/testsuite/gcc.target/riscv/vector-abi-1.c new file mode 100644 index 0000000..969f142 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/vector-abi-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -march=rv64gcv -mabi=lp64d" } */ + +#include "riscv_vector.h" + +void +fun (vint32m1_t a) { } /* { dg-warning "the scalable vector type" } */ + +void +bar () +{ + vint32m1_t a; + fun (a); +} diff --git a/gcc/testsuite/gcc.target/riscv/vector-abi-2.c b/gcc/testsuite/gcc.target/riscv/vector-abi-2.c new file mode 100644 index 0000000..63d97d3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/vector-abi-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ + +#include "riscv_vector.h" + +vint32m1_t +fun (vint32m1_t* a) { return *a; } /* { dg-warning "the scalable vector type" } */ + +void +bar () +{ + vint32m1_t a; + fun (&a); +} diff --git a/gcc/testsuite/gcc.target/riscv/vector-abi-3.c b/gcc/testsuite/gcc.target/riscv/vector-abi-3.c new file mode 100644 index 0000000..90ece60 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/vector-abi-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "riscv_vector.h" + +vint32m1_t* +fun (vint32m1_t* a) { return a; } /* { dg-bogus "the scalable vector type" } */ + +void +bar () +{ + vint32m1_t a; + fun (&a); +} diff --git a/gcc/testsuite/gcc.target/riscv/vector-abi-4.c b/gcc/testsuite/gcc.target/riscv/vector-abi-4.c new file mode 100644 index 0000000..ecf6d4c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/vector-abi-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include "riscv_vector.h" + +typedef int v4si __attribute__ ((vector_size (16))); + +v4si +fun (v4si a) { return a; } /* { dg-bogus "the scalable vector type" } */ + +void +bar () +{ + v4si a; + fun (a); +} diff --git a/gcc/testsuite/gcc.target/riscv/vector-abi-5.c b/gcc/testsuite/gcc.target/riscv/vector-abi-5.c new file mode 100644 index 0000000..6053e07 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/vector-abi-5.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +typedef int v4si __attribute__ ((vector_size (16))); +struct A { int a; v4si b; }; + +void +fun (struct A a) {} /* { dg-bogus "the scalable vector type" } */ + +void +bar () +{ + struct A a; + fun (a); +} diff --git a/gcc/testsuite/gcc.target/riscv/vector-abi-6.c b/gcc/testsuite/gcc.target/riscv/vector-abi-6.c new file mode 100644 index 0000000..63bc4a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/vector-abi-6.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ +#include "riscv_vector.h" + +void +foo(int32_t *in1, int32_t *in2, int32_t *in3, int32_t *out, + size_t n, int cond) { + size_t vl; + if (cond) + vl = __riscv_vsetvlmax_e32m1(); + else + vl = __riscv_vsetvlmax_e16mf2(); + for (size_t i = 0; i < n; i += 1) + { + vint32m1_t a = __riscv_vle32_v_i32m1(in1, vl); /* { dg-bogus "the scalable vector type" } */ + vint32m1_t b = __riscv_vle32_v_i32m1_tu(a, in2, vl); + vint32m1_t c = __riscv_vle32_v_i32m1_tu(b, in3, vl); + __riscv_vse32_v_i32m1(out, c, vl); + } +} diff --git a/gcc/testsuite/gfortran.dg/data_array_7.f90 b/gcc/testsuite/gfortran.dg/data_array_7.f90 new file mode 100644 index 0000000..56cd6ad --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_array_7.f90 @@ -0,0 +1,26 @@ +! { dg-do run } +! +! Checking for "The new features of Fortran 2008" feature 5.6 + + implicit none + integer :: a(6) + integer :: b(6) + integer(kind=4) :: i + + ! Fortran 2008: Subscripts in a data statement can be any constant expression + data a(kind("foo")) / 1 / + data a(sum([1, 2, 3]) / 3) / 2 / + data a(len("foo")) / 3 / + data a(kind(i)) / 4 / + data a(int(7.0 * atan(1.0)):6) / 5, 6 / + + ! Fortran 2008: nested implied-do limits in a data statement can be any constant expression + data (b(i), i = kind("foo"), sum([-1, 1, 2])) / 1, 2 / + data (b(i), i = len("foo"), kind(i)) / 3, 4 / + data (b(i), i = int(7.0 * atan(1.0)), 6) / 5, 6 / + + ! Check that data was correctly filled + if (any(a /= [(i, i = 1, 6)])) stop 1 + if (any(b /= [(i, i = 1, 6)])) stop 1 + +end diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 index 669a623..e26d1e0 100644 --- a/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 @@ -22,5 +22,5 @@ program main !$omp end target end program -! { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\).*map\\(present,alloc:c \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(present,alloc:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(present,alloc:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\)" "gimple" } } -! { dg-final { scan-tree-dump "pragma omp target.*map\\(present,alloc:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(present,alloc:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\) defaultmap\\(present:aggregate\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\).*map\\(force_present:c \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target.*map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\) defaultmap\\(present:aggregate\\)" "gimple" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/map-11.f90 b/gcc/testsuite/gfortran.dg/gomp/map-11.f90 index 9eb956f..7ef9d46 100644 --- a/gcc/testsuite/gfortran.dg/gomp/map-11.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/map-11.f90 @@ -27,8 +27,8 @@ program main !$omp end target end program -! { dg-final { scan-tree-dump "pragma omp target enter data map\\(present,to:a \\\[len: \[0-9\]+\\\]\\) map\\(present,to:b \\\[len: \[0-9\]+\\\]\\)" "gimple" } } -! { dg-final { scan-tree-dump "pragma omp target data map\\(present,to:a \\\[len: \[0-9\]+\\\]\\) map\\(present,to:b \\\[len: \[0-9\]+\\\]\\) map\\(always,present,from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } -! { dg-final { scan-tree-dump "pragma omp target.*map\\(present,to:a \\\[len: \[0-9\]+\\\]\\) map\\(present,to:b \\\[len: \[0-9\]+\\\]\\) map\\(present,from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target enter data map\\(force_present:a \\\[len: \[0-9\]+\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target data map\\(force_present:a \\\[len: \[0-9\]+\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\) map\\(always,present,from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target.*map\\(force_present:a \\\[len: \[0-9\]+\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\) map\\(force_present:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } ! { dg-final { scan-tree-dump "pragma omp target exit data map\\(always,present,from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } -! { dg-final { scan-tree-dump "pragma omp target.*map\\(present,to:b \\\[len: \[0-9\]+\\\]\\) map\\(to:a \\\[len: \[0-9\]+\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target.*map\\(force_present:b \\\[len: \[0-9\]+\\\]\\) map\\(to:a \\\[len: \[0-9\]+\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/map-12.f90 b/gcc/testsuite/gfortran.dg/gomp/map-12.f90 index 74bd01f..ac9a0f8 100644 --- a/gcc/testsuite/gfortran.dg/gomp/map-12.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/map-12.f90 @@ -1,4 +1,4 @@ -! { dg-additional-options "-fdump-tree-omplower" } +! { dg-additional-options "-fdump-tree-omplower -fdump-tree-original" } subroutine foo implicit none @@ -40,28 +40,29 @@ subroutine foo !$omp target exit data map(present,always,close,delete: a) map(close,present,always,release:b) map(always close present,from:b1) end subroutine +! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(tofrom:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(always,tofrom:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(present,tofrom:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(always,present,tofrom:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(alloc:a\\) map\\(to:b\\) map\\(to:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(alloc:a\\) map\\(always,to:b\\) map\\(always,to:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(present,alloc:a\\) map\\(present,to:b\\) map\\(present,to:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(present,alloc:a\\) map\\(always,present,to:b\\) map\\(always,present,to:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(delete:a\\) map\\(release:b\\) map\\(from:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(delete:a\\) map\\(release:b\\) map\\(always,from:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(delete:a\\) map\\(release:b\\) map\\(present,from:b1\\)\[\r\n\]" 2 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(delete:a\\) map\\(release:b\\) map\\(always,present,from:b1\\)\[\r\n\]" 2 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(always,tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } ! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(always,tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(present,tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(present,tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } +! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(force_present:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } ! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(always,present,tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target data map\\(always,present,tofrom:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(to:b \\\[len: 4\\\]\\) map\\(to:b1 \\\[len: 4\\\]\\) map\\(alloc:a \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } ! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(to:b \\\[len: 4\\\]\\) map\\(to:b1 \\\[len: 4\\\]\\) map\\(alloc:a \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } ! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(always,to:b \\\[len: 4\\\]\\) map\\(always,to:b1 \\\[len: 4\\\]\\) map\\(alloc:a \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(always,to:b \\\[len: 4\\\]\\) map\\(always,to:b1 \\\[len: 4\\\]\\) map\\(alloc:a \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(present,alloc:a \\\[len: 4\\\]\\) map\\(present,to:b \\\[len: 4\\\]\\) map\\(present,to:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(present,alloc:a \\\[len: 4\\\]\\) map\\(present,to:b \\\[len: 4\\\]\\) map\\(present,to:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(present,alloc:a \\\[len: 4\\\]\\) map\\(always,present,to:b \\\[len: 4\\\]\\) map\\(always,present,to:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(present,alloc:a \\\[len: 4\\\]\\) map\\(always,present,to:b \\\[len: 4\\\]\\) map\\(always,present,to:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } +! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(force_present:a \\\[len: 4\\\]\\) map\\(force_present:b \\\[len: 4\\\]\\) map\\(force_present:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } +! { dg-final { scan-tree-dump-times "#pragma omp target enter data map\\(force_present:a \\\[len: 4\\\]\\) map\\(always,present,to:b \\\[len: 4\\\]\\) map\\(always,present,to:b1 \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } ! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } ! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(always,from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(always,from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(present,from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(present,from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } -! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(always,present,from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } +! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(force_present:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } ! { dg-final { scan-tree-dump-times "#pragma omp target exit data map\\(always,present,from:b1 \\\[len: 4\\\]\\) map\\(delete:a \\\[len: 4\\\]\\) map\\(release:b \\\[len: 4\\\]\\)\[\r\n\]" 2 "omplower" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/target-update-1.f90 b/gcc/testsuite/gfortran.dg/gomp/target-update-1.f90 index f99bffe..a9db2f1 100644 --- a/gcc/testsuite/gfortran.dg/gomp/target-update-1.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/target-update-1.f90 @@ -10,4 +10,4 @@ program main !$omp target update to(c) to(present: a) from(d) from(present: b) to(e) end program -! { dg-final { scan-tree-dump "#pragma omp target update to\\(c \\\[len: \[0-9\]+\\\]\\) to\\(present:a \\\[len: \[0-9\]+\\\]\\) to\\(e \\\[len: \[0-9\]+\\\]\\) from\\(present:b \\\[len: \[0-9\]+\\\]\\) from\\(d \\\[len: \[0-9\]+\\\]\\)" "gimple" } } +! { dg-final { scan-tree-dump "#pragma omp target update to\\(c \\\[len: \[0-9\]+\\\]\\) to\\(present:a \\\[len: \[0-9\]+\\\]\\) to\\(e \\\[len: \[0-9\]+\\\]\\) from\\(d \\\[len: \[0-9\]+\\\]\\) from\\(present:b \\\[len: \[0-9\]+\\\]\\)" "gimple" } } diff --git a/gcc/testsuite/gfortran.dg/zero_sized_14.f90 b/gcc/testsuite/gfortran.dg/zero_sized_14.f90 new file mode 100644 index 0000000..32c7ae2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/zero_sized_14.f90 @@ -0,0 +1,181 @@ +! { dg-do run } +! PR fortran/86277 +! +! Check proper detection of presence of optional array dummy arguments +! for zero-sized actual array arguments or array constructors: +! tests for REAL (as non-character intrinsic type) and empty derived type + +program test + implicit none + real, parameter :: m(0) = 42. + real, parameter :: n(1) = 23. + real :: x(0) = 1. + real :: z(1) = 2. + real :: w(0) + real, pointer :: p(:) + real, allocatable :: y(:) + integer :: k = 0, l = 0 ! Test/failure counter + type dt + ! Empty type + end type dt + type(dt), parameter :: t0(0) = dt() + type(dt), parameter :: t1(1) = dt() + type(dt) :: t2(0) = dt() + type(dt) :: t3(1) = dt() + type(dt) :: t4(0) + type(dt), allocatable :: tt(:) + ! + allocate (p(0)) + allocate (y(0)) + allocate (tt(0)) + call a0 () + call a1 () + call a2 () + call a3 () + call all_missing () + print *, "Total tests:", k, " failed:", l +contains + subroutine a0 () + print *, "Variables as actual argument" + call i (m) + call i (n) + call i (x) + call i (w) + call i (y) + call i (p) + call j (t0) + call j (t1) + call j (t2) + call j (t3) + call j (t4) + call j (tt) + print *, "Array section as actual argument" + call i (m(1:0)) + call i (n(1:0)) + call i (x(1:0)) + call i (w(1:0)) + call i (z(1:0)) + call i (p(1:0)) + call j (t0(1:0)) + call j (t1(1:0)) + call j (t2(1:0)) + call j (t3(1:0)) + call j (t4(1:0)) + call j (tt(1:0)) + end subroutine a0 + ! + subroutine a1 () + print *, "Explicit temporary as actual argument" + call i ((m)) + call i ((n)) + call i ((n(1:0))) + call i ((x)) + call i ((w)) + call i ((z(1:0))) + call i ((y)) + call i ((p)) + call i ((p(1:0))) + call j ((t0)) + call j ((t1)) + call j ((tt)) + call j ((t1(1:0))) + call j ((tt(1:0))) + end subroutine a1 + ! + subroutine a2 () + print *, "Array constructor as actual argument" + call i ([m]) + call i ([n]) + call i ([x]) + call i ([w]) + call i ([z]) + call i ([m(1:0)]) + call i ([n(1:0)]) + call i ([m,n(1:0)]) + call i ([x(1:0)]) + call i ([w(1:0)]) + call i ([z(1:0)]) + call i ([y]) + call i ([p]) + call i ([y,y]) + call i ([p,p]) + call i ([y(1:0)]) + call i ([p(1:0)]) + call j ([t0]) + call j ([t0,t0]) + call j ([t1]) + call j ([tt]) + call j ([tt,tt]) + call j ([t1(1:0)]) + call j ([tt(1:0)]) + end subroutine a2 + ! + subroutine a3 () + print *, "Array constructor with type-spec as actual argument" + call i ([real:: ]) + call i ([real:: 7]) + call i ([real:: m]) + call i ([real:: n]) + call i ([real:: x]) + call i ([real:: w]) + call i ([real:: m(1:0)]) + call i ([real:: n(1:0)]) + call i ([real:: m,n(1:0)]) + call i ([real:: x(1:0)]) + call i ([real:: w(1:0)]) + call i ([real:: z(1:0)]) + call i ([real:: y]) + call i ([real:: p]) + call i ([real:: y,y]) + call i ([real:: p,p]) + call i ([real:: y(1:0)]) + call i ([real:: p(1:0)]) + call j ([ dt :: ]) + call j ([ dt :: t0]) + call j ([ dt :: t0,t0]) + call j ([ dt :: t1]) + call j ([ dt :: tt]) + call j ([ dt :: tt,tt]) + call j ([ dt :: t1(1:0)]) + call j ([ dt :: tt(1:0)]) + end subroutine a3 + ! + subroutine i (arg) + real, optional, intent(in) :: arg(:) + logical :: t + t = present (arg) + k = k + 1 + print *, 'test', k, merge (" ok", "FAIL", t) + if (.not. t) l = l + 1 + if (.not. t) stop k + end subroutine i + ! + subroutine j (arg) + type(dt), optional, intent(in) :: arg(:) + logical :: t + t = present (arg) + k = k + 1 + print *, 'test', k, merge (" ok", "FAIL", t) + if (.not. t) l = l + 1 + if (.not. t) stop k + end subroutine j + ! + subroutine all_missing (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + real, optional, intent(in) :: arg1(:) + real, optional, allocatable :: arg2(:) + real, optional, pointer :: arg3(:) + character(*), optional, intent(in) :: arg4(:) + character(*), optional, allocatable :: arg5(:) + character(*), optional, pointer :: arg6(:) + character(:), optional, pointer :: arg7(:) + character(:), optional, allocatable :: arg8(:) + if (present (arg1)) stop 101 + if (present (arg2)) stop 102 + if (present (arg3)) stop 103 + if (present (arg4)) stop 104 + if (present (arg5)) stop 105 + if (present (arg6)) stop 106 + if (present (arg7)) stop 107 + if (present (arg8)) stop 108 + end subroutine all_missing +end program diff --git a/gcc/testsuite/gfortran.dg/zero_sized_15.f90 b/gcc/testsuite/gfortran.dg/zero_sized_15.f90 new file mode 100644 index 0000000..c7d12ae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/zero_sized_15.f90 @@ -0,0 +1,114 @@ +! { dg-do run } +! PR fortran/86277 +! +! Check proper detection of presence of optional array dummy arguments +! for zero-sized actual array arguments or array constructors: +! tests for CHARACTER + +program test + implicit none + character(0), parameter :: c0(0) = "" + character(0), parameter :: c1(1) = "" + character(1), parameter :: d0(0) = "" + character(1), parameter :: d1(1) = "" + character(0) :: w0(0) + character(0) :: w1(1) + character(:), allocatable :: cc(:) + integer :: k = 0, l = 0 ! Test/failure counter + ! + allocate (character(0) :: cc(0)) + call a0 () + call a1 () + call a2 () + call a3 () + print *, "Total tests:", k, " failed:", l +contains + subroutine a0 () + print *, "Variables as actual argument" + call i (c0) + call i (c1) + call i (d0) + call i (d1) + call i (w0) + call i (w1) + call i (cc) + print *, "Array section as actual argument" + call i (c1(1:0)) + call i (c1(1:0)(1:0)) + call i (w1(1:0)) + call i (w1(1:0)(1:0)) + call i (cc(1:0)) + call i (cc(1:0)(1:0)) + end subroutine a0 + ! + subroutine a1 () + print *, "Explicit temporary as actual argument" + call i ((c0)) + call i ((c1)) + call i ((d0)) + call i ((d1)) + call i ((w0)) + call i ((w1)) + call i ((cc)) + call i ((c1(1:0))) + call i ((c1(1:0)(1:0))) + call i ((w1(1:0))) + call i ((w1(1:0)(1:0))) + call i ((cc(1:0))) + call i ((cc(1:0)(1:0))) + end subroutine a1 + ! + subroutine a2 () + print *, "Array constructor as actual argument" + call i ([c0]) + call i ([c1]) + call i ([d0]) + call i ([d1]) + call i ([w0]) + call i ([w1]) + call i ([cc]) + call i ([c0,c0]) + call i ([c1,c1]) + call i ([d0,d0]) + call i ([cc,cc]) + call i ([c1(1:0)]) + call i ([c1(1:0)(1:0)]) + call i ([w1(1:0)]) + call i ([w1(1:0)(1:0)]) + call i ([cc(1:0)]) + call i ([cc(1:0)(1:0)]) + end subroutine a2 + ! + subroutine a3 () + print *, "Array constructor with type-spec as actual argument" + call i ([character(0) :: ]) + call i ([character(0) :: ""]) + call i ([character(0) :: c0]) + call i ([character(0) :: c1]) + call i ([character(0) :: d0]) + call i ([character(0) :: d1]) + call i ([character(0) :: w0]) + call i ([character(0) :: w1]) + call i ([character(0) :: cc]) + call i ([character(0) :: c0,c0]) + call i ([character(0) :: c1,c1]) + call i ([character(0) :: d0,d0]) + call i ([character(0) :: cc,cc]) + call i ([character(0) :: c1(1:0)]) + call i ([character(0) :: c1(1:0)(1:0)]) + call i ([character(0) :: w1(1:0)]) + call i ([character(0) :: w1(1:0)(1:0)]) + call i ([character(0) :: cc(1:0)]) + call i ([character(0) :: cc(1:0)(1:0)]) + end subroutine a3 + ! + subroutine i(arg) + character(*), optional, intent(in) :: arg(:) + logical :: t + t = present (arg) + k = k + 1 + print *, 'test', k, merge (" ok", "FAIL", t) + if (.not. t) l = l + 1 + if (.not. t) stop k + end subroutine i +end program diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 index 17cc78f..6c97eba 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 @@ -1,9 +1,15 @@ ! Program to test mathematical intrinsics + +! This file is also 'include'd in: +! - 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90' (thus the '!$omp' directives) +! - 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90' (thus the '!$acc' directives) + subroutine dotest (n, val4, val8, known) implicit none real(kind=4) val4, known real(kind=8) val8 integer n + !$acc routine seq if (abs (val4 - known) .gt. 0.001) STOP 1 if (abs (real (val8, kind=4) - known) .gt. 0.001) STOP 2 @@ -14,17 +20,20 @@ subroutine dotestc (n, val4, val8, known) complex(kind=4) val4, known complex(kind=8) val8 integer n + !$acc routine seq + if (abs (val4 - known) .gt. 0.001) STOP 3 if (abs (cmplx (val8, kind=4) - known) .gt. 0.001) STOP 4 end subroutine -program testmath +subroutine testmath implicit none real(kind=4) r, two4, half4 real(kind=8) q, two8, half8 complex(kind=4) cr complex(kind=8) cq external dotest, dotestc + !$acc routine seq two4 = 2.0 two8 = 2.0_8 @@ -96,5 +105,16 @@ program testmath cq = log ((-1.0_8, -1.0_8)) call dotestc (21, cr, cq, (0.3466, -2.3562)) -end program +end subroutine +program main + implicit none + external testmath + + !$acc serial + !$omp target + call testmath + !$acc end serial + !$omp end target + +end program diff --git a/gcc/testsuite/gm2/pim/fail/foovaltype.mod b/gcc/testsuite/gm2/pim/fail/foovaltype.mod new file mode 100644 index 0000000..10a3d8e --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/foovaltype.mod @@ -0,0 +1,7 @@ +MODULE foovaltype; + +VAR x: INTEGER; + +BEGIN + x := VAL(abcd, 0); +END foovaltype. diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc index b576cce..6d3b7c2 100644 --- a/gcc/tree-data-ref.cc +++ b/gcc/tree-data-ref.cc @@ -593,7 +593,7 @@ compute_distributive_range (tree type, value_range &op0_range, gcc_assert (INTEGRAL_TYPE_P (type) && !TYPE_OVERFLOW_TRAPS (type)); if (result_range) { - range_op_handler op (code, type); + range_op_handler op (code); if (!op.fold_range (*result_range, type, op0_range, op1_range)) result_range->set_varying (type); } @@ -640,7 +640,7 @@ compute_distributive_range (tree type, value_range &op0_range, range_cast (op0_range, ssizetype); range_cast (op1_range, ssizetype); value_range wide_range; - range_op_handler op (code, ssizetype); + range_op_handler op (code); bool saved_flag_wrapv = flag_wrapv; flag_wrapv = 1; if (!op.fold_range (wide_range, ssizetype, op0_range, op1_range)) diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc index 79ed956..e1bc04b8 100644 --- a/gcc/tree-ssa-alias.cc +++ b/gcc/tree-ssa-alias.cc @@ -2829,6 +2829,9 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref, bool tbaa_p) ao_ref_init_from_ptr_and_size (&rhs_ref, gimple_call_arg (call, 0), TYPE_SIZE_UNIT (TREE_TYPE (lhs))); + /* We cannot make this a known-size access since otherwise + we disambiguate against refs to decls that are smaller. */ + rhs_ref.size = -1; rhs_ref.ref_alias_set = rhs_ref.base_alias_set = tbaa_p ? get_deref_alias_set (TREE_TYPE (gimple_call_arg (call, 1))) : 0; @@ -3072,6 +3075,9 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p) ao_ref lhs_ref; ao_ref_init_from_ptr_and_size (&lhs_ref, gimple_call_arg (call, 0), TYPE_SIZE_UNIT (TREE_TYPE (rhs))); + /* We cannot make this a known-size access since otherwise + we disambiguate against refs to decls that are smaller. */ + lhs_ref.size = -1; lhs_ref.ref_alias_set = lhs_ref.base_alias_set = tbaa_p ? get_deref_alias_set (TREE_TYPE (gimple_call_arg (call, 1))) : 0; diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc index d77e541..2949957 100644 --- a/gcc/tree-ssa-dce.cc +++ b/gcc/tree-ssa-dce.cc @@ -1481,6 +1481,14 @@ eliminate_unnecessary_stmts (bool aggressive) case IFN_MUL_OVERFLOW: maybe_optimize_arith_overflow (&gsi, MULT_EXPR); break; + case IFN_UADDC: + if (integer_zerop (gimple_call_arg (stmt, 2))) + maybe_optimize_arith_overflow (&gsi, PLUS_EXPR); + break; + case IFN_USUBC: + if (integer_zerop (gimple_call_arg (stmt, 2))) + maybe_optimize_arith_overflow (&gsi, MINUS_EXPR); + break; default: break; } diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc index 7fdef3b..22252be 100644 --- a/gcc/tree-ssa-loop-ch.cc +++ b/gcc/tree-ssa-loop-ch.cc @@ -642,6 +642,7 @@ ch_base::copy_headers (function *fun) if (stmt_can_terminate_bb_p (gsi_stmt (bsi))) precise = false; } + free (bbs); } if (precise && get_max_loop_iterations_int (loop) == 1) diff --git a/gcc/tree-ssa-loop-unswitch.cc b/gcc/tree-ssa-loop-unswitch.cc index 47255a4..619b50f 100644 --- a/gcc/tree-ssa-loop-unswitch.cc +++ b/gcc/tree-ssa-loop-unswitch.cc @@ -139,7 +139,7 @@ struct unswitch_predicate count = EDGE_SUCC (bb, 0)->count ().max (EDGE_SUCC (bb, 1)->count ()); if (irange::supports_p (TREE_TYPE (lhs))) { - auto range_op = range_op_handler (code, TREE_TYPE (lhs)); + auto range_op = range_op_handler (code); int_range<2> rhs_range (TREE_TYPE (rhs)); if (CONSTANT_CLASS_P (rhs)) { diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index 9c9ca57..b2764d4 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -4441,6 +4441,496 @@ match_arith_overflow (gimple_stmt_iterator *gsi, gimple *stmt, return false; } +/* Helper of match_uaddc_usubc. Look through an integral cast + which should preserve [0, 1] range value (unless source has + 1-bit signed type) and the cast has single use. */ + +static gimple * +uaddc_cast (gimple *g) +{ + if (!gimple_assign_cast_p (g)) + return g; + tree op = gimple_assign_rhs1 (g); + if (TREE_CODE (op) == SSA_NAME + && INTEGRAL_TYPE_P (TREE_TYPE (op)) + && (TYPE_PRECISION (TREE_TYPE (op)) > 1 + || TYPE_UNSIGNED (TREE_TYPE (op))) + && has_single_use (gimple_assign_lhs (g))) + return SSA_NAME_DEF_STMT (op); + return g; +} + +/* Helper of match_uaddc_usubc. Look through a NE_EXPR + comparison with 0 which also preserves [0, 1] value range. */ + +static gimple * +uaddc_ne0 (gimple *g) +{ + if (is_gimple_assign (g) + && gimple_assign_rhs_code (g) == NE_EXPR + && integer_zerop (gimple_assign_rhs2 (g)) + && TREE_CODE (gimple_assign_rhs1 (g)) == SSA_NAME + && has_single_use (gimple_assign_lhs (g))) + return SSA_NAME_DEF_STMT (gimple_assign_rhs1 (g)); + return g; +} + +/* Return true if G is {REAL,IMAG}PART_EXPR PART with SSA_NAME + operand. */ + +static bool +uaddc_is_cplxpart (gimple *g, tree_code part) +{ + return (is_gimple_assign (g) + && gimple_assign_rhs_code (g) == part + && TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (g), 0)) == SSA_NAME); +} + +/* Try to match e.g. + _29 = .ADD_OVERFLOW (_3, _4); + _30 = REALPART_EXPR <_29>; + _31 = IMAGPART_EXPR <_29>; + _32 = .ADD_OVERFLOW (_30, _38); + _33 = REALPART_EXPR <_32>; + _34 = IMAGPART_EXPR <_32>; + _35 = _31 + _34; + as + _36 = .UADDC (_3, _4, _38); + _33 = REALPART_EXPR <_36>; + _35 = IMAGPART_EXPR <_36>; + or + _22 = .SUB_OVERFLOW (_6, _5); + _23 = REALPART_EXPR <_22>; + _24 = IMAGPART_EXPR <_22>; + _25 = .SUB_OVERFLOW (_23, _37); + _26 = REALPART_EXPR <_25>; + _27 = IMAGPART_EXPR <_25>; + _28 = _24 | _27; + as + _29 = .USUBC (_6, _5, _37); + _26 = REALPART_EXPR <_29>; + _288 = IMAGPART_EXPR <_29>; + provided _38 or _37 above have [0, 1] range + and _3, _4 and _30 or _6, _5 and _23 are unsigned + integral types with the same precision. Whether + or | or ^ is + used on the IMAGPART_EXPR results doesn't matter, with one of + added or subtracted operands in [0, 1] range at most one + .ADD_OVERFLOW or .SUB_OVERFLOW will indicate overflow. */ + +static bool +match_uaddc_usubc (gimple_stmt_iterator *gsi, gimple *stmt, tree_code code) +{ + tree rhs[4]; + rhs[0] = gimple_assign_rhs1 (stmt); + rhs[1] = gimple_assign_rhs2 (stmt); + rhs[2] = NULL_TREE; + rhs[3] = NULL_TREE; + tree type = TREE_TYPE (rhs[0]); + if (!INTEGRAL_TYPE_P (type) || !TYPE_UNSIGNED (type)) + return false; + + if (code != BIT_IOR_EXPR && code != BIT_XOR_EXPR) + { + /* If overflow flag is ignored on the MSB limb, we can end up with + the most significant limb handled as r = op1 + op2 + ovf1 + ovf2; + or r = op1 - op2 - ovf1 - ovf2; or various equivalent expressions + thereof. Handle those like the ovf = ovf1 + ovf2; case to recognize + the limb below the MSB, but also create another .UADDC/.USUBC call + for the last limb. + + First look through assignments with the same rhs code as CODE, + with the exception that subtraction of a constant is canonicalized + into addition of its negation. rhs[0] will be minuend for + subtractions and one of addends for addition, all other assigned + rhs[i] operands will be subtrahends or other addends. */ + while (TREE_CODE (rhs[0]) == SSA_NAME && !rhs[3]) + { + gimple *g = SSA_NAME_DEF_STMT (rhs[0]); + if (has_single_use (rhs[0]) + && is_gimple_assign (g) + && (gimple_assign_rhs_code (g) == code + || (code == MINUS_EXPR + && gimple_assign_rhs_code (g) == PLUS_EXPR + && TREE_CODE (gimple_assign_rhs2 (g)) == INTEGER_CST))) + { + tree r2 = gimple_assign_rhs2 (g); + if (gimple_assign_rhs_code (g) != code) + { + r2 = const_unop (NEGATE_EXPR, TREE_TYPE (r2), r2); + if (!r2) + break; + } + rhs[0] = gimple_assign_rhs1 (g); + tree &r = rhs[2] ? rhs[3] : rhs[2]; + r = r2; + } + else + break; + } + while (TREE_CODE (rhs[1]) == SSA_NAME && !rhs[3]) + { + gimple *g = SSA_NAME_DEF_STMT (rhs[1]); + if (has_single_use (rhs[1]) + && is_gimple_assign (g) + && gimple_assign_rhs_code (g) == PLUS_EXPR) + { + rhs[1] = gimple_assign_rhs1 (g); + if (rhs[2]) + rhs[3] = gimple_assign_rhs2 (g); + else + rhs[2] = gimple_assign_rhs2 (g); + } + else + break; + } + /* If there are just 3 addends or one minuend and two subtrahends, + check for UADDC or USUBC being pattern recognized earlier. + Say r = op1 + op2 + ovf1 + ovf2; where the (ovf1 + ovf2) part + got pattern matched earlier as __imag__ .UADDC (arg1, arg2, arg3) + etc. */ + if (rhs[2] && !rhs[3]) + { + for (int i = (code == MINUS_EXPR ? 1 : 0); i < 3; ++i) + if (TREE_CODE (rhs[i]) == SSA_NAME) + { + gimple *im = uaddc_cast (SSA_NAME_DEF_STMT (rhs[i])); + im = uaddc_ne0 (im); + if (uaddc_is_cplxpart (im, IMAGPART_EXPR)) + { + /* We found one of the 3 addends or 2 subtrahends to be + __imag__ of something, verify it is .UADDC/.USUBC. */ + tree rhs1 = gimple_assign_rhs1 (im); + gimple *ovf = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs1, 0)); + if (gimple_call_internal_p (ovf, code == PLUS_EXPR + ? IFN_UADDC : IFN_USUBC) + && (optab_handler (code == PLUS_EXPR + ? uaddc5_optab : usubc5_optab, + TYPE_MODE (type)) + != CODE_FOR_nothing)) + { + /* And in that case build another .UADDC/.USUBC + call for the most significand limb addition. + Overflow bit is ignored here. */ + if (i != 2) + std::swap (rhs[i], rhs[2]); + gimple *g + = gimple_build_call_internal (code == PLUS_EXPR + ? IFN_UADDC + : IFN_USUBC, + 3, rhs[0], rhs[1], + rhs[2]); + tree nlhs = make_ssa_name (build_complex_type (type)); + gimple_call_set_lhs (g, nlhs); + gsi_insert_before (gsi, g, GSI_SAME_STMT); + tree ilhs = gimple_assign_lhs (stmt); + g = gimple_build_assign (ilhs, REALPART_EXPR, + build1 (REALPART_EXPR, + TREE_TYPE (ilhs), + nlhs)); + gsi_replace (gsi, g, true); + return true; + } + } + } + return false; + } + if (code == MINUS_EXPR && !rhs[2]) + return false; + if (code == MINUS_EXPR) + /* Code below expects rhs[0] and rhs[1] to have the IMAGPART_EXPRs. + So, for MINUS_EXPR swap the single added rhs operand (others are + subtracted) to rhs[3]. */ + std::swap (rhs[0], rhs[3]); + } + /* Walk from both operands of STMT (for +/- even sometimes from + all the 4 addends or 3 subtrahends), see through casts and != 0 + statements which would preserve [0, 1] range of values and + check which is initialized from __imag__. */ + gimple *im1 = NULL, *im2 = NULL; + for (int i = 0; i < (code == MINUS_EXPR ? 3 : 4); i++) + if (rhs[i] && TREE_CODE (rhs[i]) == SSA_NAME) + { + gimple *im = uaddc_cast (SSA_NAME_DEF_STMT (rhs[i])); + im = uaddc_ne0 (im); + if (uaddc_is_cplxpart (im, IMAGPART_EXPR)) + { + if (im1 == NULL) + { + im1 = im; + if (i != 0) + std::swap (rhs[0], rhs[i]); + } + else + { + im2 = im; + if (i != 1) + std::swap (rhs[1], rhs[i]); + break; + } + } + } + /* If we don't find at least two, punt. */ + if (!im2) + return false; + /* Check they are __imag__ of .ADD_OVERFLOW or .SUB_OVERFLOW call results, + either both .ADD_OVERFLOW or both .SUB_OVERFLOW and that we have + uaddc5/usubc5 named pattern for the corresponding mode. */ + gimple *ovf1 + = SSA_NAME_DEF_STMT (TREE_OPERAND (gimple_assign_rhs1 (im1), 0)); + gimple *ovf2 + = SSA_NAME_DEF_STMT (TREE_OPERAND (gimple_assign_rhs1 (im2), 0)); + internal_fn ifn; + if (!is_gimple_call (ovf1) + || !gimple_call_internal_p (ovf1) + || ((ifn = gimple_call_internal_fn (ovf1)) != IFN_ADD_OVERFLOW + && ifn != IFN_SUB_OVERFLOW) + || !gimple_call_internal_p (ovf2, ifn) + || optab_handler (ifn == IFN_ADD_OVERFLOW ? uaddc5_optab : usubc5_optab, + TYPE_MODE (type)) == CODE_FOR_nothing + || (rhs[2] + && optab_handler (code == PLUS_EXPR ? uaddc5_optab : usubc5_optab, + TYPE_MODE (type)) == CODE_FOR_nothing)) + return false; + tree arg1, arg2, arg3 = NULL_TREE; + gimple *re1 = NULL, *re2 = NULL; + /* On one of the two calls, one of the .ADD_OVERFLOW/.SUB_OVERFLOW arguments + should be initialized from __real__ of the other of the two calls. + Though, for .SUB_OVERFLOW, it has to be the first argument, not the + second one. */ + for (int i = (ifn == IFN_ADD_OVERFLOW ? 1 : 0); i >= 0; --i) + for (gimple *ovf = ovf1; ovf; ovf = (ovf == ovf1 ? ovf2 : NULL)) + { + tree arg = gimple_call_arg (ovf, i); + if (TREE_CODE (arg) != SSA_NAME) + continue; + re1 = SSA_NAME_DEF_STMT (arg); + if (uaddc_is_cplxpart (re1, REALPART_EXPR) + && (SSA_NAME_DEF_STMT (TREE_OPERAND (gimple_assign_rhs1 (re1), 0)) + == (ovf == ovf1 ? ovf2 : ovf1))) + { + if (ovf == ovf1) + { + /* Make sure ovf2 is the .*_OVERFLOW call with argument + initialized from __real__ of ovf1. */ + std::swap (rhs[0], rhs[1]); + std::swap (im1, im2); + std::swap (ovf1, ovf2); + } + arg3 = gimple_call_arg (ovf, 1 - i); + i = -1; + break; + } + } + if (!arg3) + return false; + arg1 = gimple_call_arg (ovf1, 0); + arg2 = gimple_call_arg (ovf1, 1); + if (!types_compatible_p (type, TREE_TYPE (arg1))) + return false; + int kind[2] = { 0, 0 }; + /* At least one of arg2 and arg3 should have type compatible + with arg1/rhs[0], and the other one should have value in [0, 1] + range. If both are in [0, 1] range and type compatible with + arg1/rhs[0], try harder to find after looking through casts, + != 0 comparisons which one is initialized to __imag__ of + .{ADD,SUB}_OVERFLOW or .U{ADD,SUB}C call results. */ + for (int i = 0; i < 2; ++i) + { + tree arg = i == 0 ? arg2 : arg3; + if (types_compatible_p (type, TREE_TYPE (arg))) + kind[i] = 1; + if (!INTEGRAL_TYPE_P (TREE_TYPE (arg)) + || (TYPE_PRECISION (TREE_TYPE (arg)) == 1 + && !TYPE_UNSIGNED (TREE_TYPE (arg)))) + continue; + if (tree_zero_one_valued_p (arg)) + kind[i] |= 2; + if (TREE_CODE (arg) == SSA_NAME) + { + gimple *g = SSA_NAME_DEF_STMT (arg); + if (gimple_assign_cast_p (g)) + { + tree op = gimple_assign_rhs1 (g); + if (TREE_CODE (op) == SSA_NAME + && INTEGRAL_TYPE_P (TREE_TYPE (op))) + g = SSA_NAME_DEF_STMT (op); + } + g = uaddc_ne0 (g); + if (!uaddc_is_cplxpart (g, IMAGPART_EXPR)) + continue; + g = SSA_NAME_DEF_STMT (TREE_OPERAND (gimple_assign_rhs1 (g), 0)); + if (!is_gimple_call (g) || !gimple_call_internal_p (g)) + continue; + switch (gimple_call_internal_fn (g)) + { + case IFN_ADD_OVERFLOW: + case IFN_SUB_OVERFLOW: + case IFN_UADDC: + case IFN_USUBC: + break; + default: + continue; + } + kind[i] |= 4; + } + } + /* Make arg2 the one with compatible type and arg3 the one + with [0, 1] range. If both is true for both operands, + prefer as arg3 result of __imag__ of some ifn. */ + if ((kind[0] & 1) == 0 || ((kind[1] & 1) != 0 && kind[0] > kind[1])) + { + std::swap (arg2, arg3); + std::swap (kind[0], kind[1]); + } + if ((kind[0] & 1) == 0 || (kind[1] & 6) == 0) + return false; + if (!has_single_use (gimple_assign_lhs (im1)) + || !has_single_use (gimple_assign_lhs (im2)) + || !has_single_use (gimple_assign_lhs (re1)) + || num_imm_uses (gimple_call_lhs (ovf1)) != 2) + return false; + /* Check that ovf2's result is used in __real__ and set re2 + to that statement. */ + use_operand_p use_p; + imm_use_iterator iter; + tree lhs = gimple_call_lhs (ovf2); + FOR_EACH_IMM_USE_FAST (use_p, iter, lhs) + { + gimple *use_stmt = USE_STMT (use_p); + if (is_gimple_debug (use_stmt)) + continue; + if (use_stmt == im2) + continue; + if (re2) + return false; + if (!uaddc_is_cplxpart (use_stmt, REALPART_EXPR)) + return false; + re2 = use_stmt; + } + /* Build .UADDC/.USUBC call which will be placed before the stmt. */ + gimple_stmt_iterator gsi2 = gsi_for_stmt (ovf2); + gimple *g; + if ((kind[1] & 1) == 0) + { + if (TREE_CODE (arg3) == INTEGER_CST) + arg3 = fold_convert (type, arg3); + else + { + g = gimple_build_assign (make_ssa_name (type), NOP_EXPR, arg3); + gsi_insert_before (&gsi2, g, GSI_SAME_STMT); + arg3 = gimple_assign_lhs (g); + } + } + g = gimple_build_call_internal (ifn == IFN_ADD_OVERFLOW + ? IFN_UADDC : IFN_USUBC, + 3, arg1, arg2, arg3); + tree nlhs = make_ssa_name (TREE_TYPE (lhs)); + gimple_call_set_lhs (g, nlhs); + gsi_insert_before (&gsi2, g, GSI_SAME_STMT); + /* In the case where stmt is | or ^ of two overflow flags + or addition of those, replace stmt with __imag__ of the above + added call. In case of arg1 + arg2 + (ovf1 + ovf2) or + arg1 - arg2 - (ovf1 + ovf2) just emit it before stmt. */ + tree ilhs = rhs[2] ? make_ssa_name (type) : gimple_assign_lhs (stmt); + g = gimple_build_assign (ilhs, IMAGPART_EXPR, + build1 (IMAGPART_EXPR, TREE_TYPE (ilhs), nlhs)); + if (rhs[2]) + gsi_insert_before (gsi, g, GSI_SAME_STMT); + else + gsi_replace (gsi, g, true); + /* Remove some statements which can't be kept in the IL because they + use SSA_NAME whose setter is going to be removed too. */ + tree rhs1 = rhs[1]; + for (int i = 0; i < 2; i++) + if (rhs1 == gimple_assign_lhs (im2)) + break; + else + { + g = SSA_NAME_DEF_STMT (rhs1); + rhs1 = gimple_assign_rhs1 (g); + gsi2 = gsi_for_stmt (g); + gsi_remove (&gsi2, true); + } + gcc_checking_assert (rhs1 == gimple_assign_lhs (im2)); + gsi2 = gsi_for_stmt (im2); + gsi_remove (&gsi2, true); + /* Replace the re2 statement with __real__ of the newly added + .UADDC/.USUBC call. */ + gsi2 = gsi_for_stmt (re2); + tree rlhs = gimple_assign_lhs (re2); + g = gimple_build_assign (rlhs, REALPART_EXPR, + build1 (REALPART_EXPR, TREE_TYPE (rlhs), nlhs)); + gsi_replace (&gsi2, g, true); + if (rhs[2]) + { + /* If this is the arg1 + arg2 + (ovf1 + ovf2) or + arg1 - arg2 - (ovf1 + ovf2) case for the most significant limb, + replace stmt with __real__ of another .UADDC/.USUBC call which + handles the most significant limb. Overflow flag from this is + ignored. */ + g = gimple_build_call_internal (code == PLUS_EXPR + ? IFN_UADDC : IFN_USUBC, + 3, rhs[3], rhs[2], ilhs); + nlhs = make_ssa_name (TREE_TYPE (lhs)); + gimple_call_set_lhs (g, nlhs); + gsi_insert_before (gsi, g, GSI_SAME_STMT); + ilhs = gimple_assign_lhs (stmt); + g = gimple_build_assign (ilhs, REALPART_EXPR, + build1 (REALPART_EXPR, TREE_TYPE (ilhs), nlhs)); + gsi_replace (gsi, g, true); + } + if (TREE_CODE (arg3) == SSA_NAME) + { + /* When pattern recognizing the second least significant limb + above (i.e. first pair of .{ADD,SUB}_OVERFLOW calls for one limb), + check if the [0, 1] range argument (i.e. carry in) isn't the + result of another .{ADD,SUB}_OVERFLOW call (one handling the + least significant limb). Again look through casts and != 0. */ + gimple *im3 = SSA_NAME_DEF_STMT (arg3); + for (int i = 0; i < 2; ++i) + { + gimple *im4 = uaddc_cast (im3); + if (im4 == im3) + break; + else + im3 = im4; + } + im3 = uaddc_ne0 (im3); + if (uaddc_is_cplxpart (im3, IMAGPART_EXPR)) + { + gimple *ovf3 + = SSA_NAME_DEF_STMT (TREE_OPERAND (gimple_assign_rhs1 (im3), 0)); + if (gimple_call_internal_p (ovf3, ifn)) + { + lhs = gimple_call_lhs (ovf3); + arg1 = gimple_call_arg (ovf3, 0); + arg2 = gimple_call_arg (ovf3, 1); + if (types_compatible_p (type, TREE_TYPE (TREE_TYPE (lhs))) + && types_compatible_p (type, TREE_TYPE (arg1)) + && types_compatible_p (type, TREE_TYPE (arg2))) + { + /* And if it is initialized from result of __imag__ + of .{ADD,SUB}_OVERFLOW call, replace that + call with .U{ADD,SUB}C call with the same arguments, + just 0 added as third argument. This isn't strictly + necessary, .ADD_OVERFLOW (x, y) and .UADDC (x, y, 0) + produce the same result, but may result in better + generated code on some targets where the backend can + better prepare in how the result will be used. */ + g = gimple_build_call_internal (ifn == IFN_ADD_OVERFLOW + ? IFN_UADDC : IFN_USUBC, + 3, arg1, arg2, + build_zero_cst (type)); + gimple_call_set_lhs (g, lhs); + gsi2 = gsi_for_stmt (ovf3); + gsi_replace (&gsi2, g, true); + } + } + } + } + return true; +} + /* Return true if target has support for divmod. */ static bool @@ -5068,8 +5558,9 @@ math_opts_dom_walker::after_dom_children (basic_block bb) case PLUS_EXPR: case MINUS_EXPR: - if (!convert_plusminus_to_widen (&gsi, stmt, code)) - match_arith_overflow (&gsi, stmt, code, m_cfg_changed_p); + if (!convert_plusminus_to_widen (&gsi, stmt, code) + && !match_arith_overflow (&gsi, stmt, code, m_cfg_changed_p)) + match_uaddc_usubc (&gsi, stmt, code); break; case BIT_NOT_EXPR: @@ -5085,6 +5576,11 @@ math_opts_dom_walker::after_dom_children (basic_block bb) convert_mult_to_highpart (as_a<gassign *> (stmt), &gsi); break; + case BIT_IOR_EXPR: + case BIT_XOR_EXPR: + match_uaddc_usubc (&gsi, stmt, code); + break; + default:; } } diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index ab21f70..60bc9be 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -782,6 +782,83 @@ vect_split_statement (vec_info *vinfo, stmt_vec_info stmt2_info, tree new_rhs, } } +/* Look for the following pattern + X = x[i] + Y = y[i] + DIFF = X - Y + DAD = ABS_EXPR<DIFF> + + ABS_STMT should point to a statement of code ABS_EXPR or ABSU_EXPR. + HALF_TYPE and UNPROM will be set should the statement be found to + be a widened operation. + DIFF_STMT will be set to the MINUS_EXPR + statement that precedes the ABS_STMT unless vect_widened_op_tree + succeeds. + */ +static bool +vect_recog_absolute_difference (vec_info *vinfo, gassign *abs_stmt, + tree *half_type, + vect_unpromoted_value unprom[2], + gassign **diff_stmt) +{ + if (!abs_stmt) + return false; + + /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi + inside the loop (in case we are analyzing an outer-loop). */ + enum tree_code code = gimple_assign_rhs_code (abs_stmt); + if (code != ABS_EXPR && code != ABSU_EXPR) + return false; + + tree abs_oprnd = gimple_assign_rhs1 (abs_stmt); + tree abs_type = TREE_TYPE (abs_oprnd); + if (!abs_oprnd) + return false; + if (!ANY_INTEGRAL_TYPE_P (abs_type) + || TYPE_OVERFLOW_WRAPS (abs_type) + || TYPE_UNSIGNED (abs_type)) + return false; + + /* Peel off conversions from the ABS input. This can involve sign + changes (e.g. from an unsigned subtraction to a signed ABS input) + or signed promotion, but it can't include unsigned promotion. + (Note that ABS of an unsigned promotion should have been folded + away before now anyway.) */ + vect_unpromoted_value unprom_diff; + abs_oprnd = vect_look_through_possible_promotion (vinfo, abs_oprnd, + &unprom_diff); + if (!abs_oprnd) + return false; + if (TYPE_PRECISION (unprom_diff.type) != TYPE_PRECISION (abs_type) + && TYPE_UNSIGNED (unprom_diff.type)) + return false; + + /* We then detect if the operand of abs_expr is defined by a minus_expr. */ + stmt_vec_info diff_stmt_vinfo = vect_get_internal_def (vinfo, abs_oprnd); + if (!diff_stmt_vinfo) + return false; + + /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi + inside the loop (in case we are analyzing an outer-loop). */ + if (vect_widened_op_tree (vinfo, diff_stmt_vinfo, + MINUS_EXPR, IFN_VEC_WIDEN_MINUS, + false, 2, unprom, half_type)) + return true; + + /* Failed to find a widen operation so we check for a regular MINUS_EXPR. */ + gassign *diff = dyn_cast <gassign *> (STMT_VINFO_STMT (diff_stmt_vinfo)); + if (diff_stmt && diff + && gimple_assign_rhs_code (diff) == MINUS_EXPR + && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (abs_oprnd))) + { + *diff_stmt = diff; + *half_type = NULL_TREE; + return true; + } + + return false; +} + /* Convert UNPROM to TYPE and return the result, adding new statements to STMT_INFO's pattern definition statements if no better way is available. VECTYPE is the vector form of TYPE. @@ -1320,41 +1397,28 @@ vect_recog_sad_pattern (vec_info *vinfo, /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi inside the loop (in case we are analyzing an outer-loop). */ gassign *abs_stmt = dyn_cast <gassign *> (abs_stmt_vinfo->stmt); - if (!abs_stmt - || (gimple_assign_rhs_code (abs_stmt) != ABS_EXPR - && gimple_assign_rhs_code (abs_stmt) != ABSU_EXPR)) - return NULL; + vect_unpromoted_value unprom[2]; - tree abs_oprnd = gimple_assign_rhs1 (abs_stmt); - tree abs_type = TREE_TYPE (abs_oprnd); - if (TYPE_UNSIGNED (abs_type)) - return NULL; + if (!abs_stmt) + { + gcall *abd_stmt = dyn_cast <gcall *> (abs_stmt_vinfo->stmt); + if (!abd_stmt + || !gimple_call_internal_p (abd_stmt) + || gimple_call_internal_fn (abd_stmt) != IFN_ABD) + return NULL; - /* Peel off conversions from the ABS input. This can involve sign - changes (e.g. from an unsigned subtraction to a signed ABS input) - or signed promotion, but it can't include unsigned promotion. - (Note that ABS of an unsigned promotion should have been folded - away before now anyway.) */ - vect_unpromoted_value unprom_diff; - abs_oprnd = vect_look_through_possible_promotion (vinfo, abs_oprnd, - &unprom_diff); - if (!abs_oprnd) - return NULL; - if (TYPE_PRECISION (unprom_diff.type) != TYPE_PRECISION (abs_type) - && TYPE_UNSIGNED (unprom_diff.type)) - return NULL; + tree abd_oprnd0 = gimple_call_arg (abd_stmt, 0); + tree abd_oprnd1 = gimple_call_arg (abd_stmt, 1); - /* We then detect if the operand of abs_expr is defined by a minus_expr. */ - stmt_vec_info diff_stmt_vinfo = vect_get_internal_def (vinfo, abs_oprnd); - if (!diff_stmt_vinfo) - return NULL; + if (!vect_look_through_possible_promotion (vinfo, abd_oprnd0, &unprom[0]) + || !vect_look_through_possible_promotion (vinfo, abd_oprnd1, + &unprom[1])) + return NULL; - /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi - inside the loop (in case we are analyzing an outer-loop). */ - vect_unpromoted_value unprom[2]; - if (!vect_widened_op_tree (vinfo, diff_stmt_vinfo, MINUS_EXPR, - IFN_VEC_WIDEN_MINUS, - false, 2, unprom, &half_type)) + half_type = unprom[0].type; + } + else if (!vect_recog_absolute_difference (vinfo, abs_stmt, &half_type, + unprom, NULL)) return NULL; vect_pattern_detected ("vect_recog_sad_pattern", last_stmt); @@ -1376,6 +1440,112 @@ vect_recog_sad_pattern (vec_info *vinfo, return pattern_stmt; } +/* Function vect_recog_abd_pattern + + Try to find the following ABsolute Difference (ABD) pattern: + + VTYPE x, y, out; + type diff; + loop i in range: + S1 diff = x[i] - y[i] + S2 out[i] = ABS_EXPR <diff>; + + where 'type' is a integer and 'VTYPE' is a vector of integers + the same size as 'type' + + Input: + + * STMT_VINFO: The stmt from which the pattern search begins + + Output: + + * TYPE_out: The type of the output of this pattern + + * Return value: A new stmt that will be used to replace the sequence of + stmts that constitute the pattern; either SABD or UABD: + SABD_EXPR<x, y, out> + UABD_EXPR<x, y, out> + */ + +static gimple * +vect_recog_abd_pattern (vec_info *vinfo, + stmt_vec_info stmt_vinfo, tree *type_out) +{ + /* Look for the following patterns + X = x[i] + Y = y[i] + DIFF = X - Y + DAD = ABS_EXPR<DIFF> + out[i] = DAD + + In which + - X, Y, DIFF, DAD all have the same type + - x, y, out are all vectors of the same type + */ + + gassign *last_stmt = dyn_cast <gassign *> (STMT_VINFO_STMT (stmt_vinfo)); + if (!last_stmt) + return NULL; + + tree out_type = TREE_TYPE (gimple_assign_lhs (last_stmt)); + + vect_unpromoted_value unprom[2]; + gassign *diff_stmt; + tree half_type; + if (!vect_recog_absolute_difference (vinfo, last_stmt, &half_type, + unprom, &diff_stmt)) + return NULL; + + tree abd_type = out_type, vectype; + tree abd_oprnds[2]; + bool extend = false; + if (half_type) + { + vectype = get_vectype_for_scalar_type (vinfo, half_type); + abd_type = half_type; + extend = TYPE_PRECISION (abd_type) < TYPE_PRECISION (out_type); + } + else + { + unprom[0].op = gimple_assign_rhs1 (diff_stmt); + unprom[1].op = gimple_assign_rhs2 (diff_stmt); + tree signed_out = signed_type_for (out_type); + vectype = get_vectype_for_scalar_type (vinfo, signed_out); + } + + vect_pattern_detected ("vect_recog_abd_pattern", last_stmt); + + if (!vectype + || !direct_internal_fn_supported_p (IFN_ABD, vectype, + OPTIMIZE_FOR_SPEED)) + return NULL; + + vect_convert_inputs (vinfo, stmt_vinfo, 2, abd_oprnds, + TREE_TYPE (vectype), unprom, vectype); + + *type_out = get_vectype_for_scalar_type (vinfo, out_type); + + tree abd_result = vect_recog_temp_ssa_var (abd_type, NULL); + gcall *abd_stmt = gimple_build_call_internal (IFN_ABD, 2, + abd_oprnds[0], abd_oprnds[1]); + gimple_call_set_lhs (abd_stmt, abd_result); + gimple_set_location (abd_stmt, gimple_location (last_stmt)); + + if (!extend) + return abd_stmt; + + gimple *stmt = abd_stmt; + if (!TYPE_UNSIGNED (abd_type)) + { + tree unsign = unsigned_type_for (abd_type); + tree unsign_vectype = get_vectype_for_scalar_type (vinfo, unsign); + stmt = vect_convert_output (vinfo, stmt_vinfo, unsign, stmt, + unsign_vectype); + } + + return vect_convert_output (vinfo, stmt_vinfo, out_type, stmt, vectype); +} + /* Recognize an operation that performs ORIG_CODE on widened inputs, so that it can be treated as though it had the form: @@ -6452,6 +6622,7 @@ struct vect_recog_func static vect_recog_func vect_vect_recog_func_ptrs[] = { { vect_recog_bitfield_ref_pattern, "bitfield_ref" }, { vect_recog_bit_insert_pattern, "bit_insert" }, + { vect_recog_abd_pattern, "abd" }, { vect_recog_over_widening_pattern, "over_widening" }, /* Must come after over_widening, which narrows the shift as much as possible beforehand. */ diff --git a/gcc/value-query.cc b/gcc/value-query.cc index a84f164..adef934 100644 --- a/gcc/value-query.cc +++ b/gcc/value-query.cc @@ -228,8 +228,7 @@ range_query::get_tree_range (vrange &r, tree expr, gimple *stmt) if (COMPARISON_CLASS_P (expr) && !Value_Range::supports_type_p (TREE_TYPE (op0))) return false; - range_op_handler op (TREE_CODE (expr), - BINARY_CLASS_P (expr) ? type : TREE_TYPE (op0)); + range_op_handler op (TREE_CODE (expr)); if (op) { Value_Range r0 (TREE_TYPE (op0)); @@ -245,7 +244,7 @@ range_query::get_tree_range (vrange &r, tree expr, gimple *stmt) } if (UNARY_CLASS_P (expr)) { - range_op_handler op (TREE_CODE (expr), type); + range_op_handler op (TREE_CODE (expr)); tree op0_type = TREE_TYPE (TREE_OPERAND (expr, 0)); if (op && Value_Range::supports_type_p (op0_type)) { diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index 65cf769..7df2cd6 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -218,7 +218,7 @@ relation_oracle::validate_relation (relation_kind rel, vrange &op1, vrange &op2) return VREL_VARYING; // If there is no handler, leave the relation as is. - range_op_handler handler (code, t1); + range_op_handler handler (code); if (!handler) return rel; diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc index 86c1bf8..ac4a83c 100644 --- a/gcc/vr-values.cc +++ b/gcc/vr-values.cc @@ -292,8 +292,8 @@ range_of_var_in_loop (vrange &v, tree name, class loop *l, gimple *stmt, wide_int w = wide_int::from (nit, TYPE_PRECISION (type), TYPE_SIGN (type)); int_range<1> niter (type, w, w); int_range_max max_step; - range_op_handler mult_handler (MULT_EXPR, type); - range_op_handler plus_handler (PLUS_EXPR, type); + range_op_handler mult_handler (MULT_EXPR); + range_op_handler plus_handler (PLUS_EXPR); if (!mult_handler.fold_range (max_step, type, niter, rstep) || !plus_handler.fold_range (max_init, type, rinit, max_step)) return false; @@ -317,7 +317,7 @@ simplify_using_ranges::fold_cond_with_ops (enum tree_code code, tree type = TREE_TYPE (op0); int_range<1> res; - range_op_handler handler (code, type); + range_op_handler handler (code); if (handler && handler.fold_range (res, type, r0, r1)) { if (res == range_true (type)) diff --git a/include/ChangeLog b/include/ChangeLog index 7ddfaeb..cceb75f 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2023-06-12 Tobias Burnus <tobias@codesourcery.com> + + * gomp-constants.h (enum gomp_map_kind): Change the enum values + GOMP_MAP_PRESENT_{TO,TOFROM,FROM,ALLOC} to be compiler only. + (GOMP_MAP_PRESENT_P): Update to include also GOMP_MAP_FORCE_PRESENT. + 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> diff --git a/include/gomp-constants.h b/include/gomp-constants.h index 49b7dd8..8d4e8e8 100644 --- a/include/gomp-constants.h +++ b/include/gomp-constants.h @@ -136,14 +136,6 @@ enum gomp_map_kind device. */ GOMP_MAP_ALWAYS_TOFROM = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_TOFROM), - /* Must already be present. */ - GOMP_MAP_PRESENT_ALLOC = (GOMP_MAP_FLAG_PRESENT | GOMP_MAP_ALLOC), - /* Must already be present, copy to device. */ - GOMP_MAP_PRESENT_TO = (GOMP_MAP_FLAG_PRESENT | GOMP_MAP_TO), - /* Must already be present, copy from device. */ - GOMP_MAP_PRESENT_FROM = (GOMP_MAP_FLAG_PRESENT | GOMP_MAP_FROM), - /* Must already be present, copy to and from device. */ - GOMP_MAP_PRESENT_TOFROM = (GOMP_MAP_FLAG_PRESENT | GOMP_MAP_TOFROM), /* Must already be present, unconditionally copy to device. */ GOMP_MAP_ALWAYS_PRESENT_TO = (GOMP_MAP_FLAG_ALWAYS_PRESENT | GOMP_MAP_TO), @@ -205,7 +197,13 @@ enum gomp_map_kind /* An attach or detach operation. Rewritten to the appropriate type during gimplification, depending on directive (i.e. "enter data" or parallel/kernels region vs. "exit data"). */ - GOMP_MAP_ATTACH_DETACH = (GOMP_MAP_LAST | 3) + GOMP_MAP_ATTACH_DETACH = (GOMP_MAP_LAST | 3), + /* Must already be present - all of following map to GOMP_MAP_FORCE_PRESENT + as no data transfer is needed. */ + GOMP_MAP_PRESENT_ALLOC = (GOMP_MAP_LAST | 4), + GOMP_MAP_PRESENT_TO = (GOMP_MAP_LAST | 5), + GOMP_MAP_PRESENT_FROM = (GOMP_MAP_LAST | 6), + GOMP_MAP_PRESENT_TOFROM = (GOMP_MAP_LAST | 7) }; #define GOMP_MAP_COPY_TO_P(X) \ @@ -243,7 +241,8 @@ enum gomp_map_kind (((X) & GOMP_MAP_FLAG_SPECIAL_BITS) == GOMP_MAP_FLAG_FORCE) #define GOMP_MAP_PRESENT_P(X) \ - (((X) & GOMP_MAP_FLAG_PRESENT) == GOMP_MAP_FLAG_PRESENT) + (((X) & GOMP_MAP_FLAG_PRESENT) == GOMP_MAP_FLAG_PRESENT \ + || (X) == GOMP_MAP_FORCE_PRESENT) /* Asynchronous behavior. Keep in sync with diff --git a/intl/ChangeLog b/intl/ChangeLog index 60d604a..52660f6 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,10 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * Makefile.in: Use @PICFLAG@ in COMPILE as well. + * configure.ac (--enable-host-shared): Don't set PICFLAG here. + (--enable-host-pie): New check. Set PICFLAG after this check. + * configure: Regenerate. + 2022-11-23 Marek Polacek <polacek@redhat.com> Revert: diff --git a/intl/Makefile.in b/intl/Makefile.in index 409d693..5beebdc 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -54,7 +54,7 @@ CTAGS = @CTAGS@ ETAGS = @ETAGS@ MKID = @MKID@ -COMPILE = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(DEFS-$@) $(INCLUDES) +COMPILE = $(CC) -c $(CPPFLAGS) $(CFLAGS) @PICFLAG@ $(DEFS) $(DEFS-$@) $(INCLUDES) HEADERS = \ gmo.h \ diff --git a/intl/configure b/intl/configure index 03f4048..79bb583 100755 --- a/intl/configure +++ b/intl/configure @@ -623,6 +623,8 @@ ac_header_list= ac_subst_vars='LTLIBOBJS LIBOBJS PICFLAG +enable_host_pie +enable_host_shared BISON3_NO BISON3_YES INCINTL @@ -731,6 +733,7 @@ with_libintl_prefix with_libintl_type enable_maintainer_mode enable_host_shared +enable_host_pie ' ac_precious_vars='build_alias host_alias @@ -1356,6 +1359,7 @@ Optional Features: --disable-rpath do not hardcode runtime library paths --enable-maintainer-mode enable rules only needed by maintainers --enable-host-shared build host code as shared libraries + --enable-host-pie build host code as PIE Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -6852,15 +6856,31 @@ fi +# Enable --enable-host-shared. # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PICFLAG=-fPIC + enableval=$enable_host_shared; +fi + + + +# Enable --enable-host-pie. +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; +fi + + + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE else PICFLAG= fi - ac_config_files="$ac_config_files Makefile config.intl" cat >confcache <<\_ACEOF diff --git a/intl/configure.ac b/intl/configure.ac index 16a740a..81aa831 100644 --- a/intl/configure.ac +++ b/intl/configure.ac @@ -83,10 +83,25 @@ fi AC_SUBST(BISON3_YES) AC_SUBST(BISON3_NO) +# Enable --enable-host-shared. AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PICFLAG=-fPIC], [PICFLAG=]) + [build host code as shared libraries])]) +AC_SUBST(enable_host_shared) + +# Enable --enable-host-pie. +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])]) +AC_SUBST(enable_host_pie) + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi AC_SUBST(PICFLAG) AC_CONFIG_FILES(Makefile config.intl) diff --git a/libcody/ChangeLog b/libcody/ChangeLog index d1c7a82..5da0d8b 100644 --- a/libcody/ChangeLog +++ b/libcody/ChangeLog @@ -1,3 +1,11 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * Makefile.in: Pass LD_PICFLAG to LDFLAGS. + * configure.ac (--enable-host-shared): Don't set PICFLAG here. + (--enable-host-pie): New check. Set PICFLAG and LD_PICFLAG after this + check. + * configure: Regenerate. + 2022-11-23 Marek Polacek <polacek@redhat.com> Revert: diff --git a/libcody/Makefile.in b/libcody/Makefile.in index bb87468..cb01b00 100644 --- a/libcody/Makefile.in +++ b/libcody/Makefile.in @@ -31,7 +31,7 @@ endif CXXOPTS += $(filter-out -DHAVE_CONFIG_H,@DEFS@) -include config.h # Linker options -LDFLAGS := @LDFLAGS@ +LDFLAGS := @LDFLAGS@ @LD_PICFLAG@ LIBS := @LIBS@ # Per-source & per-directory compile flags (warning: recursive) diff --git a/libcody/configure b/libcody/configure index da52a5c..0e536c0 100755 --- a/libcody/configure +++ b/libcody/configure @@ -591,7 +591,10 @@ configure_args AR RANLIB EXCEPTIONS +LD_PICFLAG PICFLAG +enable_host_pie +enable_host_shared OBJEXT EXEEXT ac_ct_CXX @@ -653,6 +656,7 @@ enable_maintainer_mode with_compiler enable_checking enable_host_shared +enable_host_pie enable_exceptions ' ac_precious_vars='build_alias @@ -1286,6 +1290,7 @@ Optional Features: yes,no,all,none,release. Flags are: misc,valgrind or other strings --enable-host-shared build host code as shared libraries + --enable-host-pie build host code as PIE --enable-exceptions enable exceptions & rtti Optional Packages: @@ -2635,11 +2640,34 @@ fi # Enable --enable-host-shared. # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PICFLAG=-fPIC + enableval=$enable_host_shared; +fi + + + +# Enable --enable-host-pie. +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; +fi + + + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE else PICFLAG= fi +if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie +else + LD_PICFLAG= +fi + + # Check whether --enable-exceptions was given. diff --git a/libcody/configure.ac b/libcody/configure.ac index 960191e..14e8dd4 100644 --- a/libcody/configure.ac +++ b/libcody/configure.ac @@ -63,9 +63,31 @@ fi # Enable --enable-host-shared. AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PICFLAG=-fPIC], [PICFLAG=]) + [build host code as shared libraries])]) +AC_SUBST(enable_host_shared) + +# Enable --enable-host-pie. +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])]) +AC_SUBST(enable_host_pie) + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi + +if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie +else + LD_PICFLAG= +fi + AC_SUBST(PICFLAG) +AC_SUBST(LD_PICFLAG) NMS_ENABLE_EXCEPTIONS diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 847db36..8bbd1ac 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,18 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * configure.ac (--enable-host-shared): Don't set PICFLAG here. + (--enable-host-pie): New check. Set PICFLAG after this check. + * configure: Regenerate. + +2023-06-15 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/80753 + * files.cc (struct _cpp_file): Add deferred_error bitfield. + (_cpp_find_file): When finding a file in cache with deferred_error + set in _cpp_FFK_NORMAL mode, call open_file_failed and clear the flag. + Set deferred_error in _cpp_FFK_HAS_INCLUDE mode if open_file_failed + hasn't been called. + 2023-04-30 Jeff Law <jlaw@ventanamicro> Revert: diff --git a/libcpp/configure b/libcpp/configure index e9937cd..1389dda 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -625,6 +625,8 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS CET_HOST_FLAGS PICFLAG +enable_host_pie +enable_host_shared MAINT USED_CATALOGS PACKAGE @@ -738,6 +740,7 @@ enable_maintainer_mode enable_checking enable_canonical_system_headers enable_host_shared +enable_host_pie enable_cet enable_valgrind_annotations ' @@ -1379,6 +1382,7 @@ Optional Features: --enable-canonical-system-headers enable or disable system headers canonicalization --enable-host-shared build host code as shared libraries + --enable-host-pie build host code as PIE --enable-cet enable Intel CET in host libraries [default=auto] --enable-valgrind-annotations enable valgrind runtime interaction @@ -7605,7 +7609,23 @@ esac # Enable --enable-host-shared. # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PICFLAG=-fPIC + enableval=$enable_host_shared; +fi + + + +# Enable --enable-host-pie. +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; +fi + + + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE else PICFLAG= fi diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 89ac99b..b29b4d6 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -211,8 +211,23 @@ esac # Enable --enable-host-shared. AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PICFLAG=-fPIC], [PICFLAG=]) + [build host code as shared libraries])]) +AC_SUBST(enable_host_shared) + +# Enable --enable-host-pie. +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])]) +AC_SUBST(enable_host_pie) + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi + AC_SUBST(PICFLAG) # Enable Intel CET on Intel CET enabled host if jit is enabled. diff --git a/libcpp/files.cc b/libcpp/files.cc index 3f8a810..43a8894 100644 --- a/libcpp/files.cc +++ b/libcpp/files.cc @@ -109,6 +109,10 @@ struct _cpp_file /* If this file is implicitly preincluded. */ bool implicit_preinclude : 1; + /* Set if a header wasn't found with __has_include or __has_include_next + and error should be emitted if it is included normally. */ + bool deferred_error : 1; + /* > 0: Known C++ Module header unit, <0: known not. ==0, unknown */ int header_unit : 2; }; @@ -523,7 +527,14 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, cpp_file_hash_entry *entry = search_cache ((struct cpp_file_hash_entry *) *hash_slot, start_dir); if (entry) - return entry->u.file; + { + if (entry->u.file->deferred_error && kind == _cpp_FFK_NORMAL) + { + open_file_failed (pfile, entry->u.file, angle_brackets, loc); + entry->u.file->deferred_error = false; + } + return entry->u.file; + } _cpp_file *file = make_cpp_file (start_dir, fname); file->implicit_preinclude @@ -589,6 +600,8 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, if (kind != _cpp_FFK_HAS_INCLUDE) open_file_failed (pfile, file, angle_brackets, loc); + else + file->deferred_error = true; break; } diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index b2125e3..a209d92 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,9 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * configure.ac (--enable-host-shared): Don't set PICFLAG here. + (--enable-host-pie): New check. Set PICFLAG after this check. + * configure: Regenerate. + 2022-11-23 Marek Polacek <polacek@redhat.com> Revert: diff --git a/libdecnumber/configure b/libdecnumber/configure index fb6db05..84bc4ff 100755 --- a/libdecnumber/configure +++ b/libdecnumber/configure @@ -626,6 +626,8 @@ ac_subst_vars='LTLIBOBJS LIBOBJS CET_HOST_FLAGS PICFLAG +enable_host_pie +enable_host_shared ADDITIONAL_OBJS enable_decimal_float target_os @@ -706,6 +708,7 @@ enable_werror_always enable_maintainer_mode enable_decimal_float enable_host_shared +enable_host_pie enable_cet ' ac_precious_vars='build_alias @@ -1338,6 +1341,7 @@ Optional Features: or 'dpd' choses which decimal floating point format to use --enable-host-shared build host code as shared libraries + --enable-host-pie build host code as PIE --enable-cet enable Intel CET in host libraries [default=auto] Some influential environment variables: @@ -5186,7 +5190,23 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h # Enable --enable-host-shared. # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PICFLAG=-fPIC + enableval=$enable_host_shared; +fi + + + +# Enable --enable-host-pie. +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; +fi + + + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE else PICFLAG= fi diff --git a/libdecnumber/configure.ac b/libdecnumber/configure.ac index aafd06f..30a51ca 100644 --- a/libdecnumber/configure.ac +++ b/libdecnumber/configure.ac @@ -100,8 +100,23 @@ AC_C_BIGENDIAN # Enable --enable-host-shared. AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PICFLAG=-fPIC], [PICFLAG=]) + [build host code as shared libraries])]) +AC_SUBST(enable_host_shared) + +# Enable --enable-host-pie. +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])]) +AC_SUBST(enable_host_pie) + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi + AC_SUBST(PICFLAG) # Enable Intel CET on Intel CET enabled host if jit is enabled. diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 7b355b9..9c4da89 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,93 @@ +2023-06-15 Tobias Burnus <tobias@codesourcery.com> + + * env.c (gomp_def_allocator_envvar): New var. + (parse_allocator): Handle OpenMP 5.1 syntax. + (cleanup_env): New. + (omp_display_env): Output gomp_def_allocator_envvar + for an allocator with traits. + * libgomp.texi (OMP_ALLOCATOR, OMP_AFFINITY_FORMAT, + OMP_DISPLAY_AFFINITY): New. + * testsuite/libgomp.c/allocator-1.c: New test. + * testsuite/libgomp.c/allocator-2.c: New test. + * testsuite/libgomp.c/allocator-3.c: New test. + * testsuite/libgomp.c/allocator-4.c: New test. + * testsuite/libgomp.c/allocator-5.c: New test. + * testsuite/libgomp.c/allocator-6.c: New test. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * target.c (resolve_device): Align a + 'OMP_TARGET_OFFLOAD=mandatory' diagnostic with others. + * testsuite/libgomp.c/target-51.c: Adjust. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/libgomp.fortran/fortran.exp (lang_link_flags): Don't + set. + * testsuite/libgomp.oacc-fortran/fortran.exp (lang_link_flags): + Likewise. + * testsuite/libgomp.c/simd-math-1.c: Remove + '-foffload-options=-lm'. + * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90: + Likewise. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New. + * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90: + Likewise. + +2023-06-14 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/libgomp.c/target-51.c: Fix typo. + +2023-06-14 Tobias Burnus <tobias@codesourcery.com> + + * env.c (gomp_default_icv_values): Init default_device_var to + an nonconforming value - INT_MIN. + (initialize_env): After env-var parsing, set default_device_var to + device 0 unless OMP_TARGET_OFFLOAD=mandatory. + (omp_display_env): If default_device_var is INT_MIN, call + gomp_init_targets_once. + * icv-device.c (omp_get_default_device): Likewise. + * libgomp.texi (OMP_DEFAULT_DEVICE): Update init description. + (OpenMP 5.2 Impl. Status): Mark OMP_TARGET_OFFLOAD=mandatory as 'Y'. + * target.c (resolve_device): Improve error message device-num < 0 + with 'mandatory' and no no-host devices available. + (gomp_target_init): Set default-device-var if INT_MIN. + * testsuite/libgomp.c/target-48.c: New test. + * testsuite/libgomp.c/target-49.c: New test. + * testsuite/libgomp.c/target-50.c: New test. + * testsuite/libgomp.c/target-50a.c: New test. + * testsuite/libgomp.c/target-51.c: New test. + * testsuite/libgomp.c/target-52.c: New test. + * testsuite/libgomp.c/target-53.c: New test. + * testsuite/libgomp.c/target-54.c: New test. + +2023-06-13 Tobias Burnus <tobias@codesourcery.com> + + PR libgomp/109837 + * testsuite/libgomp.c-c++-common/requires-unified-addr-1.c: New test. + * testsuite/libgomp.fortran/requires-unified-addr-1.f90: New test. + +2023-06-12 Tobias Burnus <tobias@codesourcery.com> + + * target.c (gomp_to_device_kind_p, gomp_map_vars_internal): Replace + GOMP_MAP_PRESENT_{FROM,TO,TOFROM,ACLLOC} by GOMP_MAP_FORCE_PRESENT. + (gomp_map_vars_internal, gomp_update): Likewise; unify and improve + error message. + * testsuite/libgomp.c-c++-common/target-present-2.c: Update for + changed error message. + * testsuite/libgomp.fortran/target-present-1.f90: Likewise. + * testsuite/libgomp.fortran/target-present-2.f90: Likewise. + * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. + * testsuite/libgomp.c-c++-common/target-present-1.c: Likewise and + extend testcase to check that data is copied when needed. + * testsuite/libgomp.c-c++-common/target-present-3.c: Likewise. + * testsuite/libgomp.fortran/target-present-3.f90: Likewise. + 2023-06-07 Thomas Schwinge <thomas@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> diff --git a/libgomp/env.c b/libgomp/env.c index e7a035b..f24484d 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -62,13 +62,14 @@ #include "secure_getenv.h" #include "environ.h" -/* Default values of ICVs according to the OpenMP standard. */ +/* Default values of ICVs according to the OpenMP standard, + except for default-device-var. */ const struct gomp_default_icv gomp_default_icv_values = { .nthreads_var = 1, .thread_limit_var = UINT_MAX, .run_sched_var = GFS_DYNAMIC, .run_sched_chunk_size = 1, - .default_device_var = 0, + .default_device_var = INT_MIN, .max_active_levels_var = 1, .bind_var = omp_proc_bind_false, .nteams_var = 0, @@ -111,6 +112,7 @@ unsigned long gomp_bind_var_list_len; void **gomp_places_list; unsigned long gomp_places_list_len; uintptr_t gomp_def_allocator = omp_default_mem_alloc; +char *gomp_def_allocator_envvar = NULL; int gomp_debug_var; unsigned int gomp_num_teams_var; int gomp_nteams_var; @@ -1232,8 +1234,12 @@ parse_affinity (bool ignore) static bool parse_allocator (const char *env, const char *val, void *const params[]) { + const char *orig_val = val; uintptr_t *ret = (uintptr_t *) params[0]; *ret = omp_default_mem_alloc; + bool memspace = false; + size_t ntraits = 0; + omp_alloctrait_t *traits; if (val == NULL) return false; @@ -1242,28 +1248,169 @@ parse_allocator (const char *env, const char *val, void *const params[]) ++val; if (0) ; -#define C(v) \ +#define C(v, m) \ else if (strncasecmp (val, #v, sizeof (#v) - 1) == 0) \ { \ *ret = v; \ val += sizeof (#v) - 1; \ - } - C (omp_default_mem_alloc) - C (omp_large_cap_mem_alloc) - C (omp_const_mem_alloc) - C (omp_high_bw_mem_alloc) - C (omp_low_lat_mem_alloc) - C (omp_cgroup_mem_alloc) - C (omp_pteam_mem_alloc) - C (omp_thread_mem_alloc) + memspace = m; \ + } + C (omp_default_mem_alloc, false) + C (omp_large_cap_mem_alloc, false) + C (omp_const_mem_alloc, false) + C (omp_high_bw_mem_alloc, false) + C (omp_low_lat_mem_alloc, false) + C (omp_cgroup_mem_alloc, false) + C (omp_pteam_mem_alloc, false) + C (omp_thread_mem_alloc, false) + C (omp_default_mem_space, true) + C (omp_large_cap_mem_space, true) + C (omp_const_mem_space, true) + C (omp_high_bw_mem_space, true) + C (omp_low_lat_mem_space, true) #undef C else - val = "X"; + goto invalid; + if (memspace && *val == ':') + { + ++val; + const char *cp = val; + while (*cp != '\0') + { + if (*cp == '=') + ++ntraits; + ++cp; + } + traits = gomp_alloca (ntraits * sizeof (omp_alloctrait_t)); + size_t n = 0; + while (*val != '\0') + { +#define C(v) \ + else if (strncasecmp (val, #v "=", sizeof (#v)) == 0) \ + { \ + val += sizeof (#v); \ + traits[n].key = omp_atk_ ## v; +#define V(v) \ + else if (strncasecmp (val, #v, sizeof (#v) - 1) == 0) \ + { \ + val += sizeof (#v) - 1; \ + traits[n].value = omp_atv_ ## v; \ + } + if (0) + ; + C (sync_hint) + if (0) + ; + V (contended) + V (uncontended) + V (serialized) + V (private) + else + goto invalid; + } + C (alignment) + char *end; + errno = 0; + traits[n].value = strtol (val, &end, 10); + if (errno || end == val || traits[n].value <= 0) + goto invalid; + val = end; + } + C (access) + if (0) + ; + V (all) + V (cgroup) + V (pteam) + V (thread) + else + goto invalid; + } + C (pool_size) + char *end; + errno = 0; + traits[n].value = strtol (val, &end, 10); + if (errno || end == val || traits[n].value <= 0) + goto invalid; + val = end; + } + C (fallback) + if (0) + ; + V (default_mem_fb) + V (null_fb) + V (abort_fb) + V (allocator_fb) + else + goto invalid; + } + /* Ignore fb_data, which expects an allocator handle. */ + C (pinned) + if (0) + ; + V (true) + V (false) + else + goto invalid; + } + C (partition) + if (0) + ; + V (environment) + V (nearest) + V (blocked) + V (interleaved) + else + goto invalid; + } + else + goto invalid; + if (*val != ',') + break; + ++val; + ++n; + if (*val == '\0') + goto invalid; + } +#undef C +#undef V + } + else if (memspace) + switch (*ret) + { + case omp_default_mem_space: *ret = omp_default_mem_alloc; break; + case omp_large_cap_mem_space: *ret = omp_large_cap_mem_alloc; break; + case omp_const_mem_space: *ret = omp_const_mem_alloc; break; + case omp_high_bw_mem_space: *ret = omp_high_bw_mem_alloc; break; + case omp_low_lat_mem_space: *ret = omp_low_lat_mem_alloc; break; + default: __builtin_unreachable (); + } while (isspace ((unsigned char) *val)) ++val; if (*val == '\0') - return true; - print_env_var_error (env, val); + { + if (ntraits) + { + *ret = omp_init_allocator (*ret, ntraits, traits); + if (*ret == omp_null_allocator) + { + gomp_error ("Allocator of environment variable %.*s cannot be " + "created, using omp_default_mem_alloc instead", + (int) (orig_val - env - 1), env); + *ret = omp_default_mem_alloc; + } + else + gomp_def_allocator_envvar = strdup (orig_val); + } + return true; + } +invalid: + int len = (orig_val - env - 1); + if (*val == '\0') + gomp_error ("Missing value at the end of environment variable %s", env); + else + gomp_error ("Invalid value for environment variable %.*s when parsing: %s", + len, env, val); *ret = omp_default_mem_alloc; return false; } @@ -1614,6 +1761,10 @@ omp_display_env (int verbose) struct gomp_icv_list *none = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_NO_SUFFIX); + if (none->icvs.default_device_var == INT_MIN) + /* This implies OMP_TARGET_OFFLOAD=mandatory. */ + gomp_init_targets_once (); + fputs ("\nOPENMP DISPLAY ENVIRONMENT BEGIN\n", stderr); fputs (" _OPENMP = '201511'\n", stderr); @@ -1779,7 +1930,11 @@ omp_display_env (int verbose) C (omp_pteam_mem_alloc) C (omp_thread_mem_alloc) #undef C - default: break; + /* For an OMP_ALLOCATOR with traits, '' will be output. */ + default: + if (gomp_def_allocator_envvar) + fputs (gomp_def_allocator_envvar, stderr); + break; } fputs ("'\n", stderr); @@ -2031,6 +2186,16 @@ startswith (const char *str, const char *prefix) return strncmp (str, prefix, strlen (prefix)) == 0; } +static void __attribute__((destructor)) +cleanup_env (void) +{ + if (gomp_def_allocator_envvar != NULL) + { + free (gomp_def_allocator_envvar); + omp_destroy_allocator (gomp_def_allocator); + } +} + static void __attribute__((constructor)) initialize_env (void) { @@ -2213,6 +2378,10 @@ initialize_env (void) gomp_global_icv.max_active_levels_var = gomp_supported_active_levels; } + if (gomp_global_icv.default_device_var == INT_MIN + && gomp_target_offload_var != GOMP_TARGET_OFFLOAD_MANDATORY) + none->icvs.default_device_var = gomp_global_icv.default_device_var = 0; + /* Process GOMP_* variables and dependencies between parsed ICVs. */ parse_int_secure ("GOMP_DEBUG", &gomp_debug_var, true); diff --git a/libgomp/icv-device.c b/libgomp/icv-device.c index a2bbedc..b48ea3b 100644 --- a/libgomp/icv-device.c +++ b/libgomp/icv-device.c @@ -27,6 +27,7 @@ expected to replace. */ #include "libgomp.h" +#include <limits.h> void omp_set_default_device (int device_num) @@ -41,6 +42,9 @@ int omp_get_default_device (void) { struct gomp_task_icv *icv = gomp_icv (false); + if (icv->default_device_var == INT_MIN) + /* This implies OMP_TARGET_OFFLOAD=mandatory. */ + gomp_init_targets_once (); return icv->default_device_var; } diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index a3d370a..1c57f5a 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -423,7 +423,7 @@ to address of matching mapped list item per 5.1, Sect. 2.21.7.2 @tab N @tab @item Conforming device numbers and @code{omp_initial_device} and @code{omp_invalid_device} enum/PARAMETER @tab Y @tab @item Initial value of @emph{default-device-var} ICV with - @code{OMP_TARGET_OFFLOAD=mandatory} @tab N @tab + @code{OMP_TARGET_OFFLOAD=mandatory} @tab Y @tab @item @emph{interop_types} in any position of the modifier list for the @code{init} clause of the @code{interop} construct @tab N @tab @end multitable @@ -1937,7 +1937,10 @@ section 4 of the OpenMP specification in version 4.5, while those beginning with @env{GOMP_} are GNU extensions. @menu +* OMP_ALLOCATOR:: Set the default allocator +* OMP_AFFINITY_FORMAT:: Set the format string used for affinity display * OMP_CANCELLATION:: Set whether cancellation is activated +* OMP_DISPLAY_AFFINITY:: Display thread affinity information * OMP_DISPLAY_ENV:: Show OpenMP version and environment variables * OMP_DEFAULT_DEVICE:: Set the device used in target regions * OMP_DYNAMIC:: Dynamic adjustment of threads @@ -1962,6 +1965,125 @@ beginning with @env{GOMP_} are GNU extensions. @end menu +@node OMP_ALLOCATOR +@section @env{OMP_ALLOCATOR} -- Set the default allocator +@cindex Environment Variable +@table @asis +@item @emph{Description}: +Sets the default allocator that is used when no allocator has been specified +in the @code{allocate} or @code{allocator} clause or if an OpenMP memory +routine is invoked with the @code{omp_null_allocator} allocator. +If unset, @code{omp_default_mem_alloc} is used. + +The value can either be a predefined allocator or a predefined memory space +or a predefined memory space followed by a colon and a comma-separated list +of memory trait and value pairs, separated by @code{=}. + +@multitable @columnfractions .45 .45 +@headitem Predefined allocators @tab Predefined memory spaces +@item omp_default_mem_alloc @tab omp_default_mem_space +@item omp_large_cap_mem_alloc @tab omp_large_cap_mem_space +@item omp_const_mem_alloc @tab omp_const_mem_space +@item omp_high_bw_mem_alloc @tab omp_high_bw_mem_space +@item omp_low_lat_mem_alloc @tab omp_low_lat_mem_space +@item omp_cgroup_mem_alloc @tab -- +@item omp_pteam_mem_alloc @tab -- +@item omp_thread_mem_alloc @tab -- +@end multitable + +@multitable @columnfractions .30 .60 +@headitem Trait @tab Allowed values +@item @code{sync_hint} @tab @code{contended}, @code{uncontended}, + @code{serialized}, @code{private} +@item @code{alignment} @tab Positive integer being a power of two +@item @code{access} @tab @code{all}, @code{cgroup}, + @code{pteam}, @code{thread} +@item @code{pool_size} @tab Positive integer +@item @code{fallback} @tab @code{default_mem_fb}, @code{null_fb}, + @code{abort_fb}, @code{allocator_fb} +@item @code{fb_data} @tab @emph{unsupported as it needs an allocator handle} +@item @code{pinned} @tab @code{true}, @code{false} +@item @code{partition} @tab @code{environment}, @code{nearest}, + @code{blocked}, @code{interleaved} +@end multitable + +Examples: +@smallexample +OMP_ALLOCATOR=omp_high_bw_mem_alloc +OMP_ALLOCATOR=omp_large_cap_mem_space +OMP_ALLOCATR=omp_low_lat_mem_space:pinned=true,partition=nearest +@end smallexample + +@c @item @emph{See also}: + +@item @emph{Reference}: +@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.21 +@end table + + + +@node OMP_AFFINITY_FORMAT +@section @env{OMP_AFFINITY_FORMAT} -- Set the format string used for affinity display +@cindex Environment Variable +@table @asis +@item @emph{Description}: +Sets the format string used when displaying OpenMP thread affinity information. +Special values are output using @code{%} followed by an optional size +specification and then either the single-character field type or its long +name enclosed in curly braces; using @code{%%} will display a literal percent. +The size specification consists of an optional @code{0.} or @code{.} followed +by a positive integer, specifing the minimal width of the output. With +@code{0.} and numerical values, the output is padded with zeros on the left; +with @code{.}, the output is padded by spaces on the left; otherwise, the +output is padded by spaces on the right. If unset, the value is +``@code{level %L thread %i affinity %A}''. + +Supported field types are: + +@multitable @columnfractions .10 .25 .60 +@item t @tab team_num @tab value returned by @code{omp_get_team_num} +@item T @tab num_teams @tab value returned by @code{omp_get_num_teams} +@item L @tab nesting_level @tab value returned by @code{omp_get_level} +@item n @tab thread_num @tab value returned by @code{omp_get_thread_num} +@item N @tab num_threads @tab value returned by @code{omp_get_num_threads} +@item a @tab ancestor_tnum + @tab value returned by + @code{omp_get_ancestor_thread_num(omp_get_level()-1)} +@item H @tab host @tab name of the host that executes the thread +@item P @tab process_id @tab process identifier +@item i @tab native_thread_id @tab native thread identifier +@item A @tab thread_affinity + @tab comma separated list of integer values or ranges, representing the + processors on which a process might execute, subject to affinity + mechanisms +@end multitable + +For instance, after setting + +@smallexample +OMP_AFFINITY_FORMAT="%0.2a!%n!%.4L!%N;%.2t;%0.2T;%@{team_num@};%@{num_teams@};%A" +@end smallexample + +with either @code{OMP_DISPLAY_AFFINITY} being set or when calling +@code{omp_display_affinity} with @code{NULL} or an empty string, the program +might display the following: + +@smallexample +00!0! 1!4; 0;01;0;1;0-11 +00!3! 1!4; 0;01;0;1;0-11 +00!2! 1!4; 0;01;0;1;0-11 +00!1! 1!4; 0;01;0;1;0-11 +@end smallexample + +@item @emph{See also}: +@ref{OMP_DISPLAY_AFFINITY} + +@item @emph{Reference}: +@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.14 +@end table + + + @node OMP_CANCELLATION @section @env{OMP_CANCELLATION} -- Set whether cancellation is activated @cindex Environment Variable @@ -1979,6 +2101,26 @@ if unset, cancellation is disabled and the @code{cancel} construct is ignored. +@node OMP_DISPLAY_AFFINITY +@section @env{OMP_DISPLAY_AFFINITY} -- Display thread affinity information +@cindex Environment Variable +@table @asis +@item @emph{Description}: +If set to @code{FALSE} or if unset, affinity displaying is disabled. +If set to @code{TRUE}, the runtime will display affinity information about +OpenMP threads in a parallel region upon entering the region and every time +any change occurs. + +@item @emph{See also}: +@ref{OMP_AFFINITY_FORMAT} + +@item @emph{Reference}: +@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.13 +@end table + + + + @node OMP_DISPLAY_ENV @section @env{OMP_DISPLAY_ENV} -- Show OpenMP version and environment variables @cindex Environment Variable @@ -2006,6 +2148,8 @@ Set to choose the device which is used in a @code{target} region, unless the value is overridden by @code{omp_set_default_device} or by a @code{device} clause. The value shall be the nonnegative device number. If no device with the given device number exists, the code is executed on the host. If unset, +@env{OMP_TARGET_OFFLOAD} is @code{mandatory} and no non-host devices are +available, it is set to @code{omp_invalid_device}. Otherwise, if unset, device number 0 will be used. diff --git a/libgomp/target.c b/libgomp/target.c index a9e8005..b6a7214 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -138,6 +138,10 @@ gomp_get_num_devices (void) static struct gomp_device_descr * resolve_device (int device_id, bool remapped) { + /* Get number of devices and thus ensure that 'gomp_init_targets_once' was + called, which must be done before using default_device_var. */ + int num_devices = gomp_get_num_devices (); + if (remapped && device_id == GOMP_DEVICE_ICV) { struct gomp_task_icv *icv = gomp_icv (false); @@ -150,7 +154,11 @@ resolve_device (int device_id, bool remapped) if (device_id == (remapped ? GOMP_DEVICE_HOST_FALLBACK : omp_initial_device)) return NULL; - if (device_id == omp_invalid_device) + if (gomp_target_offload_var == GOMP_TARGET_OFFLOAD_MANDATORY + && num_devices == 0) + gomp_fatal ("OMP_TARGET_OFFLOAD is set to MANDATORY, " + "but only the host device is available"); + else if (device_id == omp_invalid_device) gomp_fatal ("omp_invalid_device encountered"); else if (gomp_target_offload_var == GOMP_TARGET_OFFLOAD_MANDATORY) gomp_fatal ("OMP_TARGET_OFFLOAD is set to MANDATORY, " @@ -158,10 +166,10 @@ resolve_device (int device_id, bool remapped) return NULL; } - else if (device_id >= gomp_get_num_devices ()) + else if (device_id >= num_devices) { if (gomp_target_offload_var == GOMP_TARGET_OFFLOAD_MANDATORY - && device_id != num_devices_openmp) + && device_id != num_devices) gomp_fatal ("OMP_TARGET_OFFLOAD is set to MANDATORY, " "but device not found"); @@ -358,8 +366,8 @@ gomp_to_device_kind_p (int kind) case GOMP_MAP_FORCE_ALLOC: case GOMP_MAP_FORCE_FROM: case GOMP_MAP_ALWAYS_FROM: - case GOMP_MAP_PRESENT_FROM: case GOMP_MAP_ALWAYS_PRESENT_FROM: + case GOMP_MAP_FORCE_PRESENT: return false; default: return true; @@ -1699,37 +1707,29 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, i = j - 1; break; case GOMP_MAP_FORCE_PRESENT: + case GOMP_MAP_ALWAYS_PRESENT_TO: + case GOMP_MAP_ALWAYS_PRESENT_FROM: + case GOMP_MAP_ALWAYS_PRESENT_TOFROM: { /* We already looked up the memory region above and it was missing. */ size_t size = k->host_end - k->host_start; gomp_mutex_unlock (&devicep->lock); #ifdef HAVE_INTTYPES_H - gomp_fatal ("present clause: !acc_is_present (%p, " - "%"PRIu64" (0x%"PRIx64"))", - (void *) k->host_start, - (uint64_t) size, (uint64_t) size); + gomp_fatal ("present clause: not present on the device " + "(addr: %p, size: %"PRIu64" (0x%"PRIx64"), " + "dev: %d)", (void *) k->host_start, + (uint64_t) size, (uint64_t) size, + devicep->target_id); #else - gomp_fatal ("present clause: !acc_is_present (%p, " - "%lu (0x%lx))", (void *) k->host_start, - (unsigned long) size, (unsigned long) size); + gomp_fatal ("present clause: not present on the device " + "(addr: %p, size: %lu (0x%lx), dev: %d)", + (void *) k->host_start, + (unsigned long) size, (unsigned long) size, + devicep->target_id); #endif } break; - case GOMP_MAP_PRESENT_ALLOC: - case GOMP_MAP_PRESENT_TO: - case GOMP_MAP_PRESENT_FROM: - case GOMP_MAP_PRESENT_TOFROM: - case GOMP_MAP_ALWAYS_PRESENT_TO: - case GOMP_MAP_ALWAYS_PRESENT_FROM: - case GOMP_MAP_ALWAYS_PRESENT_TOFROM: - /* We already looked up the memory region above and it - was missing. */ - gomp_mutex_unlock (&devicep->lock); - gomp_fatal ("present clause: not present on the device " - "(%p, %d)", - (void *) k->host_start, devicep->target_id); - break; case GOMP_MAP_FORCE_DEVICEPTR: assert (k->host_end - k->host_start == sizeof (void *)); gomp_copy_host2dev (devicep, aq, @@ -2149,9 +2149,18 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum, void **hostaddrs, /* We already looked up the memory region above and it was missing. */ gomp_mutex_unlock (&devicep->lock); +#ifdef HAVE_INTTYPES_H gomp_fatal ("present clause: not present on the device " - "(%p, %d)", - (void *) hostaddrs[i], devicep->target_id); + "(addr: %p, size: %"PRIu64" (0x%"PRIx64"), " + "dev: %d)", (void *) hostaddrs[i], + (uint64_t) sizes[i], (uint64_t) sizes[i], + devicep->target_id); +#else + gomp_fatal ("present clause: not present on the device " + "(addr: %p, size: %lu (0x%lx), dev: %d)", + (void *) hostaddrs[i], (unsigned long) sizes[i], + (unsigned long) sizes[i], devicep->target_id); +#endif } } } @@ -3465,9 +3474,7 @@ gomp_target_rev (uint64_t fn_ptr, uint64_t mapnum, uint64_t devaddrs_ptr, case GOMP_MAP_FORCE_TOFROM: case GOMP_MAP_ALWAYS_TO: case GOMP_MAP_ALWAYS_TOFROM: - case GOMP_MAP_PRESENT_FROM: - case GOMP_MAP_PRESENT_TO: - case GOMP_MAP_PRESENT_TOFROM: + case GOMP_MAP_FORCE_PRESENT: case GOMP_MAP_ALWAYS_PRESENT_FROM: case GOMP_MAP_ALWAYS_PRESENT_TO: case GOMP_MAP_ALWAYS_PRESENT_TOFROM: @@ -3710,8 +3717,6 @@ gomp_target_rev (uint64_t fn_ptr, uint64_t mapnum, uint64_t devaddrs_ptr, case GOMP_MAP_FORCE_TOFROM: case GOMP_MAP_ALWAYS_FROM: case GOMP_MAP_ALWAYS_TOFROM: - case GOMP_MAP_PRESENT_FROM: - case GOMP_MAP_PRESENT_TOFROM: case GOMP_MAP_ALWAYS_PRESENT_FROM: case GOMP_MAP_ALWAYS_PRESENT_TOFROM: copy = true; @@ -5187,6 +5192,15 @@ gomp_target_init (void) if (devs[i].capabilities & GOMP_OFFLOAD_CAP_OPENACC_200) goacc_register (&devs[i]); } + if (gomp_global_icv.default_device_var == INT_MIN) + { + /* This implies OMP_TARGET_OFFLOAD=mandatory. */ + struct gomp_icv_list *none; + none = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_NO_SUFFIX); + gomp_global_icv.default_device_var = (num_devs_openmp + ? 0 : omp_invalid_device); + none->icvs.default_device_var = gomp_global_icv.default_device_var; + } num_devices = num_devs; num_devices_openmp = num_devs_openmp; diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-unified-addr-1.c b/libgomp/testsuite/libgomp.c-c++-common/requires-unified-addr-1.c new file mode 100644 index 0000000..bff0a6b --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-unified-addr-1.c @@ -0,0 +1,74 @@ +/* PR libgomp/109837 */ + +#include <assert.h> +#include <omp.h> +#include <stdio.h> +#include <stdlib.h> + +#pragma omp requires unified_address + +#define N 15 + +void +test_device (int dev) +{ + struct st { + int *ptr; + int n; + }; + struct st s; + + s.n = 10; + s.ptr = (int *) omp_target_alloc (sizeof (int)*s.n, dev); + int *ptr1 = (int *) omp_target_alloc (sizeof (int)*N, dev); + assert (s.ptr != NULL); + assert (ptr1 != NULL); + + int q[4] = {1,2,3,4}; + int *qptr; + #pragma omp target enter data map(q) device(device_num: dev) + #pragma omp target data use_device_addr(q) device(device_num: dev) + qptr = q; + + #pragma omp target map(to:s) device(device_num: dev) + for (int i = 0; i < s.n; i++) + s.ptr[i] = 23*i; + + int *ptr2 = &s.ptr[3]; + + #pragma omp target firstprivate(qptr) map(tofrom:ptr2) device(device_num: dev) + for (int i = 0; i < 4; i++) + *(qptr++) = ptr2[i]; + + #pragma omp target exit data map(q) device(device_num: dev) + for (int i = 0; i < 4; i++) + q[i] = 23 * (i+3); + + #pragma omp target map(to: ptr1) device(device_num: dev) + for (int i = 0; i < N; i++) + ptr1[i] = 11*i; + + int *ptr3 = (int *) malloc (sizeof (int)*N); + assert (0 == omp_target_memcpy(ptr3, ptr1, N * sizeof(int), 0, 0, + omp_get_initial_device(), dev)); + for (int i = 0; i < N; i++) + assert (ptr3[i] == 11*i); + + free (ptr3); + omp_target_free (ptr1, dev); + omp_target_free (s.ptr, dev); +} + +int +main() +{ + int ntgts = omp_get_num_devices(); + if (ntgts) + fprintf (stderr, "Offloading devices exist\n"); /* { dg-output "Offloading devices exist(\n|\r\n|\r)" { target offload_device } } */ + else + fprintf (stderr, "Only host fallback\n"); /* { dg-output "Only host fallback(\n|\r\n|\r)" { target { ! offload_device } } } */ + + for (int i = 0; i <= ntgts; i++) + test_device (i); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c index aa34319..5eaa9cd 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-1.c @@ -4,24 +4,34 @@ int main (void) { - int a[N], b[N], c[N]; + int a[N], b[N], c[N], d[N]; for (int i = 0; i < N; i++) { a[i] = i * 2; b[i] = i * 3 + 1; + d[i] = i * 5; } - #pragma omp target enter data map (alloc: a, c) - /* a has already been allocated, so this should be okay. */ - #pragma omp target map (present, to: a) + #pragma omp target enter data map (alloc: c, d) map(to: a) + #pragma omp target map (present, always, to: d) + for (int i = 0; i < N; i++) + if (d[i] != i * 5) + __builtin_abort (); + + /* a has already been mapped and 'c' allocated so this should be okay. */ + #pragma omp target map (present, to: a) map(present, always, from: c) for (int i = 0; i < N; i++) c[i] = a[i]; + for (int i = 0; i < N; i++) + if (c[i] != i * 2) + __builtin_abort (); + fprintf (stderr, "CheCKpOInT\n"); /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ /* b has not been allocated, so this should result in an error. */ - /* { dg-output "libgomp: present clause: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } */ + /* { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } */ /* { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */ #pragma omp target map (present, to: b) for (int i = 0; i < N; i++) diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c index ad11023..07ae90b 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-2.c @@ -21,7 +21,7 @@ int main (void) /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ /* b has not been allocated, so this should result in an error. */ - /* { dg-output "libgomp: present clause: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } */ + /* { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } */ /* { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */ #pragma omp target defaultmap (present) for (int i = 0; i < N; i++) diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c index 455519a..582247d 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-3.c @@ -16,11 +16,24 @@ int main (void) /* This should work as a has already been allocated. */ #pragma omp target update to (present: a) + #pragma omp target map(present,alloc: a, c) + for (int i = 0; i < N; i++) { + if (a[i] != i * 2) + __builtin_abort (); + c[i] = 23*i; + } + + #pragma omp target update from(present : c) + for (int i = 0; i < N; i++) { + if (c[i] != 23*i) + __builtin_abort (); + } + fprintf (stderr, "CheCKpOInT\n"); /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ /* This should fail as b has not been allocated. */ - /* { dg-output "libgomp: present clause: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } */ + /* { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } */ /* { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } */ #pragma omp target update to (present: b) diff --git a/libgomp/testsuite/libgomp.c/allocator-1.c b/libgomp/testsuite/libgomp.c/allocator-1.c new file mode 100644 index 0000000..2757792 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/allocator-1.c @@ -0,0 +1,15 @@ +/* { dg-set-target-env-var OMP_ALLOCATOR "omp_large_cap_mem_alloc" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* { dg-output ".\\\[host\\\] OMP_ALLOCATOR = 'omp_large_cap_mem_alloc'.*" } */ + +#include <omp.h> + +int +main () +{ + omp_allocator_handle_t m = omp_get_default_allocator (); + if (m != omp_large_cap_mem_alloc) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/allocator-2.c b/libgomp/testsuite/libgomp.c/allocator-2.c new file mode 100644 index 0000000..ac680e5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/allocator-2.c @@ -0,0 +1,17 @@ +/* { dg-set-target-env-var OMP_ALLOCATOR "omp_large_cap_mem_space" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* Expect omp_large_cap_mem_alloc as allocator for omp_large_cap_mem_space. */ +/* { dg-output ".\\\[host\\\] OMP_ALLOCATOR = 'omp_large_cap_mem_alloc'.*" } */ +#include <omp.h> + +int +main () +{ + omp_allocator_handle_t m = omp_get_default_allocator (); + /* Without traits, omp_large_cap_mem_space implies + omp_large_cap_mem_alloc. */ + if (m != omp_large_cap_mem_alloc) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/allocator-3.c b/libgomp/testsuite/libgomp.c/allocator-3.c new file mode 100644 index 0000000..a28f4e75 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/allocator-3.c @@ -0,0 +1,27 @@ +/* { dg-set-target-env-var OMP_ALLOCATOR " omp_default_mem_space:alignment=512,pinned=false,access=all " } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* We copied the environment string; hence, it may contain white space. */ +/* { dg-output ".\\\[host\\\] OMP_ALLOCATOR = ' omp_default_mem_space:alignment=512,pinned=false,access=all '.*" } */ + +#include <stdint.h> +#include <omp.h> + +int +main () +{ + int *a, *b; + a = omp_alloc (sizeof (int) * 1024, omp_null_allocator); + + omp_allocator_handle_t m = omp_get_default_allocator (); + b = omp_alloc (sizeof (int) * 1024, m); + + if ((uintptr_t) a % 512 != 0) + __builtin_abort (); + + if ((uintptr_t) b % 512 != 0) + __builtin_abort (); + omp_free (a, omp_null_allocator); + omp_free (b, m); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/allocator-4.c b/libgomp/testsuite/libgomp.c/allocator-4.c new file mode 100644 index 0000000..e5d0b09 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/allocator-4.c @@ -0,0 +1,15 @@ +/* { dg-set-target-env-var OMP_ALLOCATOR "omp_const_mem_space:alignment=3,pinned=" } */ + +/* { dg-output ".*libgomp: Missing value at the end of environment variable OMP_ALLOCATOR=omp_const_mem_space:alignment=3,pinned=.*" } */ +/* OMP_ALLOCATOR syntax error -> use omp_default_mem_alloc. */ + +#include <omp.h> + +int +main () +{ + omp_allocator_handle_t m = omp_get_default_allocator (); + if (m != omp_default_mem_alloc) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/allocator-5.c b/libgomp/testsuite/libgomp.c/allocator-5.c new file mode 100644 index 0000000..0f900cf --- /dev/null +++ b/libgomp/testsuite/libgomp.c/allocator-5.c @@ -0,0 +1,15 @@ +/* { dg-set-target-env-var OMP_ALLOCATOR "omp_const_mem_space:access=none,pinned=false" } */ + +/* { dg-output ".*libgomp: Invalid value for environment variable OMP_ALLOCATOR when parsing: none,pinned=false.*" } */ +/* OMP_ALLOCATOR syntax error -> use omp_default_mem_alloc. */ + +#include <omp.h> + +int +main () +{ + omp_allocator_handle_t m = omp_get_default_allocator (); + if (m != omp_default_mem_alloc) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/allocator-6.c b/libgomp/testsuite/libgomp.c/allocator-6.c new file mode 100644 index 0000000..7c99e0e --- /dev/null +++ b/libgomp/testsuite/libgomp.c/allocator-6.c @@ -0,0 +1,15 @@ +/* { dg-set-target-env-var OMP_ALLOCATOR "omp_default_mem_space:alignment=3" } */ + +/* { dg-output ".*libgomp: Allocator of environment variable OMP_ALLOCATOR cannot be created, using omp_default_mem_alloc instead.*" } */ +/* OMP_ALLOCATOR's alignment is not power of 2 -> use omp_default_mem_alloc. */ + +#include <omp.h> + +int +main () +{ + omp_allocator_handle_t m = omp_get_default_allocator (); + if (m != omp_default_mem_alloc) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/simd-math-1.c b/libgomp/testsuite/libgomp.c/simd-math-1.c index 947bf60..dd2077c 100644 --- a/libgomp/testsuite/libgomp.c/simd-math-1.c +++ b/libgomp/testsuite/libgomp.c/simd-math-1.c @@ -4,7 +4,6 @@ /* { dg-do run } */ /* { dg-options "-O2 -ftree-vectorize -fno-math-errno" } */ /* { dg-additional-options -foffload-options=amdgcn-amdhsa=-mstack-size=3000000 { target offload_target_amdgcn } } */ -/* { dg-additional-options -foffload-options=-lm } */ #undef PRINT_RESULT #define VERBOSE 0 diff --git a/libgomp/testsuite/libgomp.c/target-48.c b/libgomp/testsuite/libgomp.c/target-48.c new file mode 100644 index 0000000..8e95c1c --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-48.c @@ -0,0 +1,31 @@ +/* Check OMP_TARGET_OFFLOAD on systems with no available non-host devices; + omp_invalid_device == -4 with GCC. */ + +/* { dg-do run { target { ! offload_device } } } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ + +/* { dg-output ".*OMP_DEFAULT_DEVICE = '-4'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" } */ + +#include <omp.h> + +int +main () +{ + if (omp_get_default_device () != omp_invalid_device) + __builtin_abort (); + + omp_set_default_device (omp_initial_device); + + /* The spec is a bit unclear whether the line above sets the device number + (a) to -1 (= omp_initial_device) or + (b) to omp_get_initial_device() == omp_get_num_devices(). Therefore, + we accept either value. */ + + if (omp_get_default_device() != omp_get_initial_device() + && omp_get_default_device() != omp_initial_device) + __builtin_abort (); + + omp_display_env (0); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-49.c b/libgomp/testsuite/libgomp.c/target-49.c new file mode 100644 index 0000000..970cb91 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-49.c @@ -0,0 +1,18 @@ +/* Check OMP_TARGET_OFFLOAD on systems with no available non-host devices, + which is enforced by using -foffload=disable. */ + +/* { dg-do run } */ +/* { dg-additional-options "-foffload=disable" } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* See comment in target-50.c/target-50.c for why default-device-var can be '0'. */ + +/* { dg-output ".*OMP_DEFAULT_DEVICE = '-4'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" { target { ! offload_device } } } */ +/* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" { target offload_device } } */ + +int +main () +{ + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-50.c b/libgomp/testsuite/libgomp.c/target-50.c new file mode 100644 index 0000000..6f15569 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-50.c @@ -0,0 +1,27 @@ +/* Check OMP_TARGET_OFFLOAD on systems with no available non-host devices; + here with using -foffload=disable. + As default-device-var is set to 0 (= host in this case), it should not fail. */ + +/* Note that -foffload=disable will still find devices on the system and only + when trying to use them, it will fail as no binary data has been produced. + The "target offload_device" case is checked for in 'target-50a.c'. */ + +/* { dg-do run { target { ! offload_device } } } */ + +/* { dg-additional-options "-foffload=disable" } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ +/* { dg-set-target-env-var OMP_DEFAULT_DEVICE "0" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" } */ + +int +main () +{ + int x; + #pragma omp target map(tofrom:x) + x = 5; + if (x != 5) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-50a.c b/libgomp/testsuite/libgomp.c/target-50a.c new file mode 100644 index 0000000..0835cb5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-50a.c @@ -0,0 +1,43 @@ +/* Check OMP_TARGET_OFFLOAD on systems with non-host devices but no executable + code due to -foffload=disable. + + Note: While one might expect that -foffload=disable implies no non-host + devices, libgomp actually detects the devices and only fails when trying to + run as no executable code is availale for that device. + (Without MANDATORY it simply uses host fallback, which should usually be fine + but might have issues in corner cases.) + + We have default-device-var = 0 (default but also explicitly set), which will + fail at runtime. For -foffload=disable without non-host devices, see + target-50.c testcase. */ + +/* { dg-do run { target offload_device } } */ + +/* { dg-additional-options "-foffload=disable" } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ +/* { dg-set-target-env-var OMP_DEFAULT_DEVICE "0" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" } */ + +#include <omp.h> + +int +main () +{ + int x; + /* We know that there are non-host devices. With GCC, we still find them as + available devices, hence, check for it. */ + if (omp_get_num_devices() <= 0) + __builtin_abort (); + + /* But due to -foffload=disable, there are no binary code for (default) device '0' */ + + /* { dg-output ".*libgomp: OMP_TARGET_OFFLOAD is set to MANDATORY, but device cannot be used for offloading.*" } */ + /* { dg-shouldfail "OMP_TARGET_OFFLOAD=mandatory and no binary code for a non-host device" } */ + #pragma omp target map(tofrom:x) + x = 5; + if (x != 5) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-51.c b/libgomp/testsuite/libgomp.c/target-51.c new file mode 100644 index 0000000..bbe9ade --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-51.c @@ -0,0 +1,24 @@ +/* Check OMP_TARGET_OFFLOAD on systems with no available non-host devices, + which is enforced by using -foffload=disable. */ + +/* { dg-do run } */ +/* { dg-additional-options "-foffload=disable" } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ + +/* { dg-shouldfail "OMP_TARGET_OFFLOAD=mandatory and no available device" } */ + +/* See comment in target-50.c/target-50.c for why the output differs. */ + +/* { dg-output ".*libgomp: OMP_TARGET_OFFLOAD is set to MANDATORY, but only the host device is available.*" { target { ! offload_device } } } */ +/* { dg-output ".*libgomp: OMP_TARGET_OFFLOAD is set to MANDATORY, but device not found.*" { target offload_device } } */ + +int +main () +{ + int x; + #pragma omp target map(tofrom:x) + x = 5; + if (x != 5) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-52.c b/libgomp/testsuite/libgomp.c/target-52.c new file mode 100644 index 0000000..809380c --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-52.c @@ -0,0 +1,25 @@ +/* Only run this with available non-host devices; in that case, GCC sets + the default-device-var to 0. */ + +/* { dg-do run { target { offload_device } } } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" } */ + +#include <omp.h> + +int +main () +{ + int x; + #pragma omp target map(tofrom:x) + x = 5 + omp_is_initial_device (); + + if (x != 5) + __builtin_abort (); + + if (0 != omp_get_default_device()) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-53.c b/libgomp/testsuite/libgomp.c/target-53.c new file mode 100644 index 0000000..866e896 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-53.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "disabled" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* { dg-output ".*OMP_DEFAULT_DEVICE = '\[0-9\]+'.*OMP_TARGET_OFFLOAD = 'DISABLED'.*" } */ + +#include <omp.h> + +int +main () +{ + int x; + #pragma omp target map(tofrom:x) + x = 5 + omp_is_initial_device (); + + if (x != 5+1) + __builtin_abort (); + + if (omp_get_default_device() != omp_get_initial_device()) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-54.c b/libgomp/testsuite/libgomp.c/target-54.c new file mode 100644 index 0000000..bc4e69b --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-54.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "default" } */ +/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ + +/* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'DEFAULT'.*" } */ + +#include <omp.h> + +int +main () +{ + int x; + #pragma omp target map(tofrom:x) + x = 5 + omp_is_initial_device (); + + if (x != 5 + (omp_get_default_device() == omp_get_initial_device())) + __builtin_abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-55.c b/libgomp/testsuite/libgomp.c/target-55.c new file mode 100644 index 0000000..1314b3c --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-55.c @@ -0,0 +1,20 @@ +/* { dg-do run { target { offload_device } } } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ + +/* Should pass - see target-55a.c for !offload_device */ + +/* Check OMP_TARGET_OFFLOAD - it shall run on systems with offloading + devices available and fail otherwise. Note that this did always + fail - as the device handling wasn't initialized before doing the + mandatory checking. */ + +int +main () +{ + int x = 1; + #pragma omp target map(tofrom: x) + x = 5; + if (x != 5) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/target-55a.c b/libgomp/testsuite/libgomp.c/target-55a.c new file mode 100644 index 0000000..53978c3 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-55a.c @@ -0,0 +1,23 @@ +/* { dg-do run { target { ! offload_device } } } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ + +/* Should fail - see target-55a.c for offload_device */ + +/* { dg-shouldfail "omp_invalid_device" } */ +/* { dg-output ".*libgomp: OMP_TARGET_OFFLOAD is set to MANDATORY, but only the host device is available.*" } */ + +/* Check OMP_TARGET_OFFLOAD - it shall run on systems with offloading + devices available and fail otherwise. Note that this did always + fail - as the device handling wasn't initialized before doing the + mandatory checking. */ + +int +main () +{ + int x = 1; + #pragma omp target map(tofrom: x) + x = 5; + if (x != 5) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 new file mode 100644 index 0000000..2d0caa6 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 @@ -0,0 +1,3 @@ +! { dg-do run } + +include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90' diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp index e69656b..32e4bb2 100644 --- a/libgomp/testsuite/libgomp.fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.fortran/fortran.exp @@ -28,7 +28,6 @@ if { $blddir != "" } { set lang_source_re {^.*\.[fF](|90|95|03|08)$} set lang_include_flags "-fintrinsic-modules-path=${blddir}" } -set lang_link_flags "-foffload=-lgfortran" lappend ALWAYS_CFLAGS "compiler=$GFORTRAN_UNDER_TEST" # Initialize dg. @@ -63,7 +62,6 @@ if { $blddir != "" } { unset libquadmath_library_path unset lang_library_paths } -unset lang_link_flags # All done. dg-finish diff --git a/libgomp/testsuite/libgomp.fortran/requires-unified-addr-1.f90 b/libgomp/testsuite/libgomp.fortran/requires-unified-addr-1.f90 new file mode 100644 index 0000000..f5a5adf --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/requires-unified-addr-1.f90 @@ -0,0 +1,111 @@ +! PR libgomp/109837 + +program main + use iso_c_binding + use iso_fortran_env + use omp_lib + implicit none (external, type) + !$omp requires unified_address + + integer(c_intptr_t), parameter :: N = 15 + integer :: i, ntgts + + ntgts = omp_get_num_devices(); + if (ntgts > 0) then + write (ERROR_UNIT, '(a)') "Offloading devices exist" ! { dg-output "Offloading devices exist(\n|\r\n|\r)" { target offload_device } } + else + write (ERROR_UNIT, '(a)') "Only host fallback" ! { dg-output "Only host fallback(\n|\r\n|\r)" { target { ! offload_device } } } + endif + + do i = 0, ntgts + call test_device (i); + end do + +contains + + subroutine test_device (dev) + integer, value, intent(in) :: dev + + type t + integer(c_intptr_t) :: n, m + integer, pointer :: fptr(:) + type(c_ptr) :: cptr + end type t + type(t) :: s + type(c_ptr) :: cptr, qptr, cptr2, cptr2a + integer, target :: q(4) + integer, pointer :: fptr(:) + integer(c_intptr_t) :: i + + s%n = 10; + s%m = 23; + s%cptr = omp_target_alloc (s%n * NUMERIC_STORAGE_SIZE/CHARACTER_STORAGE_SIZE, dev); + cptr = omp_target_alloc (s%m * NUMERIC_STORAGE_SIZE/CHARACTER_STORAGE_SIZE, dev); + if (.not. c_associated(s%cptr)) stop 1 + if (.not. c_associated(cptr)) stop 2 + call c_f_pointer (cptr, s%fptr, [s%m]) + + cptr = omp_target_alloc (N * NUMERIC_STORAGE_SIZE/CHARACTER_STORAGE_SIZE, dev); + if (.not. c_associated(cptr)) stop 3 + + q = [1, 2, 3, 4] + !$omp target enter data map(q) device(device_num: dev) + !$omp target data use_device_addr(q) device(device_num: dev) + qptr = c_loc(q) + !$omp end target data + + !$omp target map(to:s) device(device_num: dev) + block + integer, pointer :: iptr(:) + call c_f_pointer(s%cptr, iptr, [s%n]) + do i = 1, s%n + iptr(i) = 23 * int(i) + end do + do i = 1, s%m + s%fptr(i) = 35 * int(i) + end do + end block + + cptr2 = c_loc(s%fptr(4)) + cptr2a = s%cptr + + !$omp target firstprivate(qptr) map(tofrom: cptr2) map(to :cptr2a) device(device_num: dev) + block + integer, pointer :: iptr(:), iptr2(:), qvar(:) + call c_f_pointer(cptr2, iptr, [4]) + call c_f_pointer(cptr2a, iptr2, [4]) + call c_f_pointer(qptr, qvar, [4]) + qvar = iptr + iptr2 + end block + + !$omp target exit data map(q) device(device_num: dev) + do i = 1, 4 + if (q(i) /= 23 * int(i) + 35 * (int(i) + 4 - 1)) stop 4 + end do + + !$omp target map(to: cptr) device(device_num: dev) + block + integer, pointer :: p(:) + call c_f_pointer(cptr, p, [N]) + do i = 1, N + p(i) = 11 * int(i) + end do + end block + + allocate(fptr(N)) + if (0 /= omp_target_memcpy (c_loc(fptr), cptr, & + N * NUMERIC_STORAGE_SIZE/CHARACTER_STORAGE_SIZE, & + 0_c_intptr_t, 0_c_intptr_t, & + omp_get_initial_device(), dev)) & + stop 5 + + do i = 1, N + if (fptr(i) /= 11 * int(i)) stop 6 + end do + + deallocate (fptr); + call omp_target_free (cptr, dev); + call omp_target_free (s%cptr, dev); + call omp_target_free (c_loc(s%fptr), dev); + end +end diff --git a/libgomp/testsuite/libgomp.fortran/target-present-1.f90 b/libgomp/testsuite/libgomp.fortran/target-present-1.f90 index 768166f..fc13609 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-1.f90 @@ -20,7 +20,7 @@ program main ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } ! b has not been allocated, so this should result in an error. - ! { dg-output "libgomp: present clause: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + ! { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } ! { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } !$omp target map (present, to: b) do i = 1, N diff --git a/libgomp/testsuite/libgomp.fortran/target-present-2.f90 b/libgomp/testsuite/libgomp.fortran/target-present-2.f90 index 8f2c24e..524d01d 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-2.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-2.f90 @@ -20,7 +20,7 @@ program main ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } ! b has not been allocated, so this should result in an error. - ! { dg-output "libgomp: present clause: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + ! { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } ! { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } !$omp target defaultmap (present) do i = 1, N diff --git a/libgomp/testsuite/libgomp.fortran/target-present-3.f90 b/libgomp/testsuite/libgomp.fortran/target-present-3.f90 index eb29c90..dd4af4c 100644 --- a/libgomp/testsuite/libgomp.fortran/target-present-3.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-present-3.f90 @@ -9,14 +9,27 @@ program main end do !$omp target enter data map (alloc: a, c) - ! This should work as a has already been allocated. - !$omp target update to (present: a) + + ! This should work as a has already been allocated. + !$omp target update to (present: a) + + !$omp target map(present, alloc: a, c) + do i = 1, N + if (a(i) /= i * 2) stop 1 + c(i) = 23 * i + end do + !$omp end target + + !$omp target update from (present: c) + do i = 1, N + if (c(i) /= 23 * i) stop 1 + end do print *, "CheCKpOInT" ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } ! This should fail as b has not been allocated. - ! { dg-output "libgomp: present clause: not present on the device \\\(0x\[0-9a-f\]+, \[0-9\]+\\\)" { target offload_device_nonshared_as } } + ! { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } } ! { dg-shouldfail "present error triggered" { offload_device_nonshared_as } } !$omp target update to (present: b) !$omp target exit data map (from: c) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c index 61c8109..02fbfda 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c @@ -48,5 +48,5 @@ main (int argc, char **argv) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "present clause: !acc_is_present" } */ +/* { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" } */ /* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 new file mode 100644 index 0000000..edc940c --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 @@ -0,0 +1,4 @@ +! { dg-do run } +!TODO { dg-prune-output {using 'vector_length \(32\)', ignoring 1} } + +include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90' diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index 2e8aa22..e5844ad 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -30,7 +30,6 @@ if { $blddir != "" } { set lang_source_re {^.*\.[fF](|90|95|03|08)$} set lang_include_flags "-fintrinsic-modules-path=${blddir}" } -set lang_link_flags "-foffload=-lgfortran" lappend ALWAYS_CFLAGS "compiler=$GFORTRAN_UNDER_TEST" # Initialize dg. @@ -113,7 +112,6 @@ if { $blddir != "" } { unset libquadmath_library_path unset lang_library_paths } -unset lang_link_flags # All done. dg-finish diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 3d66169..3424fef 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,14 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * configure.ac: Also set shared when enable_host_pie. + * configure: Regenerate. + +2023-06-13 Nathan Sidwell <nathan@acm.org> + + * cp-demangle.c (d_print_conversion): Remove incorrect + template instantiation handling. + * testsuite/demangle-expected: Add testcases. + 2023-06-07 Costas Argyris <costas.argyris@gmail.com> * argv.c (writeargv): Constant propagate "0" for "status", diff --git a/libiberty/configure b/libiberty/configure index 860f981fa..b8a19c4 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -5258,8 +5258,8 @@ case "${enable_shared}" in *) shared=yes ;; esac -# ...unless --enable-host-shared was passed from top-level config: -if [ "${enable_host_shared}" = "yes" ]; then +# ...unless --enable-host-{shared,pie} was passed from top-level config: +if [ "${enable_host_shared}" = "yes" ] || [ "${enable_host_pie}" = "yes" ]; then shared=yes fi diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 28d996f..6747a7b 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -233,8 +233,8 @@ case "${enable_shared}" in *) shared=yes ;; esac -# ...unless --enable-host-shared was passed from top-level config: -if [[ "${enable_host_shared}" = "yes" ]]; then +# ...unless --enable-host-{shared,pie} was passed from top-level config: +if [[ "${enable_host_shared}" = "yes" ]] || [[ "${enable_host_pie}" = "yes" ]]; then shared=yes fi diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 18ab28f..3bd303a 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -6660,32 +6660,10 @@ d_print_conversion (struct d_print_info *dpi, int options, dpt.template_decl = dpi->current_template; } - if (d_left (dc)->type != DEMANGLE_COMPONENT_TEMPLATE) - { - d_print_comp (dpi, options, d_left (dc)); - if (dpi->current_template != NULL) - dpi->templates = dpt.next; - } - else - { - d_print_comp (dpi, options, d_left (d_left (dc))); - - /* For a templated cast operator, we need to remove the template - parameters from scope after printing the operator name, - so we need to handle the template printing here. */ - if (dpi->current_template != NULL) - dpi->templates = dpt.next; + d_print_comp (dpi, options, d_left (dc)); - if (d_last_char (dpi) == '<') - d_append_char (dpi, ' '); - d_append_char (dpi, '<'); - d_print_comp (dpi, options, d_right (d_left (dc))); - /* Avoid generating two consecutive '>' characters, to avoid - the C++ syntactic ambiguity. */ - if (d_last_char (dpi) == '>') - d_append_char (dpi, ' '); - d_append_char (dpi, '>'); - } + if (dpi->current_template != NULL) + dpi->templates = dpt.next; } /* Initialize the information structure we use to pass around diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 52dff88..0acd2d6 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -1662,3 +1662,30 @@ X<int>::F()::{lambda(int)#1}::operator()(int) const _Z1fIiEv1AIXnxtlT_EEE void f<int>(A<noexcept(int{})>) + +_ZNO1Ycv1XEv +Y::operator X() && + +_ZNO1Ycv1XIT_EIvEEv +Y::operator X<void><void>() && + +_ZNO1Y3bobEv +Y::bob() && + +_ZNR1Y3bobEv +Y::bob() & + +_ZNKR1YcvRK1XIT_EIvEEv +Y::operator X<void> const&<void>() const & + +_ZZN1XIiEcviEvE1y +X<int>::operator int()::y + +_ZZN1XIiEcv1ZIiEEvE1y +X<int>::operator Z<int>()::y + +_ZZN1Xcv1ZIT_EIiEEvE1y +X::operator Z<int><int>()::y + +_ZZN1XIfEcv1ZIT_EIiEEvE1y +X<float>::operator Z<int><int>()::y diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 909f1df..dadbbcc 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2023-06-14 Jonny Grant <jg@jguk.org> + + * doc/xml/manual/extensions.xml: Remove demangle exception + description and include. + * doc/html/manual/ext_demangling.html: Regenerate. + 2023-06-10 Hans-Peter Nilsson <hp@axis.com> * testsuite/27_io/basic_istream/ignore/wchar_t/94749.cc (main) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 354c566..bda8053 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -29759,6 +29759,8 @@ else $as_echo "#define HAVE_FREXPF 1" >>confdefs.h + $as_echo "#define HAVE_HYPOTF 1" >>confdefs.h + $as_echo "#define HAVE_LDEXPF 1" >>confdefs.h $as_echo "#define HAVE_LOG10F 1" >>confdefs.h @@ -29780,6 +29782,1183 @@ else $as_echo "#define HAVE_TANHF 1" >>confdefs.h + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acosl declaration" >&5 +$as_echo_n "checking for acosl declaration... " >&6; } +if ${glibcxx_cv_func_acosl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef acosl + +int +main () +{ + + void (*f)(void) = (void (*)(void))acosl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_acosl_use=yes + +else + glibcxx_cv_func_acosl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_acosl_use" >&5 +$as_echo "$glibcxx_cv_func_acosl_use" >&6; } + if test "x$glibcxx_cv_func_acosl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_ACOSL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for asinl declaration" >&5 +$as_echo_n "checking for asinl declaration... " >&6; } +if ${glibcxx_cv_func_asinl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef asinl + +int +main () +{ + + void (*f)(void) = (void (*)(void))asinl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_asinl_use=yes + +else + glibcxx_cv_func_asinl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_asinl_use" >&5 +$as_echo "$glibcxx_cv_func_asinl_use" >&6; } + if test "x$glibcxx_cv_func_asinl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_ASINL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atan2l declaration" >&5 +$as_echo_n "checking for atan2l declaration... " >&6; } +if ${glibcxx_cv_func_atan2l_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef atan2l + +int +main () +{ + + void (*f)(void) = (void (*)(void))atan2l; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_atan2l_use=yes + +else + glibcxx_cv_func_atan2l_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_atan2l_use" >&5 +$as_echo "$glibcxx_cv_func_atan2l_use" >&6; } + if test "x$glibcxx_cv_func_atan2l_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_ATAN2L 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for atanl declaration" >&5 +$as_echo_n "checking for atanl declaration... " >&6; } +if ${glibcxx_cv_func_atanl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef atanl + +int +main () +{ + + void (*f)(void) = (void (*)(void))atanl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_atanl_use=yes + +else + glibcxx_cv_func_atanl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_atanl_use" >&5 +$as_echo "$glibcxx_cv_func_atanl_use" >&6; } + if test "x$glibcxx_cv_func_atanl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_ATANL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceill declaration" >&5 +$as_echo_n "checking for ceill declaration... " >&6; } +if ${glibcxx_cv_func_ceill_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef ceill + +int +main () +{ + + void (*f)(void) = (void (*)(void))ceill; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_ceill_use=yes + +else + glibcxx_cv_func_ceill_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_ceill_use" >&5 +$as_echo "$glibcxx_cv_func_ceill_use" >&6; } + if test "x$glibcxx_cv_func_ceill_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_CEILL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for coshl declaration" >&5 +$as_echo_n "checking for coshl declaration... " >&6; } +if ${glibcxx_cv_func_coshl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef coshl + +int +main () +{ + + void (*f)(void) = (void (*)(void))coshl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_coshl_use=yes + +else + glibcxx_cv_func_coshl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_coshl_use" >&5 +$as_echo "$glibcxx_cv_func_coshl_use" >&6; } + if test "x$glibcxx_cv_func_coshl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_COSHL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cosl declaration" >&5 +$as_echo_n "checking for cosl declaration... " >&6; } +if ${glibcxx_cv_func_cosl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef cosl + +int +main () +{ + + void (*f)(void) = (void (*)(void))cosl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_cosl_use=yes + +else + glibcxx_cv_func_cosl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_cosl_use" >&5 +$as_echo "$glibcxx_cv_func_cosl_use" >&6; } + if test "x$glibcxx_cv_func_cosl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_COSL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for expl declaration" >&5 +$as_echo_n "checking for expl declaration... " >&6; } +if ${glibcxx_cv_func_expl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef expl + +int +main () +{ + + void (*f)(void) = (void (*)(void))expl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_expl_use=yes + +else + glibcxx_cv_func_expl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_expl_use" >&5 +$as_echo "$glibcxx_cv_func_expl_use" >&6; } + if test "x$glibcxx_cv_func_expl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_EXPL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fabsl declaration" >&5 +$as_echo_n "checking for fabsl declaration... " >&6; } +if ${glibcxx_cv_func_fabsl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef fabsl + +int +main () +{ + + void (*f)(void) = (void (*)(void))fabsl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_fabsl_use=yes + +else + glibcxx_cv_func_fabsl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_fabsl_use" >&5 +$as_echo "$glibcxx_cv_func_fabsl_use" >&6; } + if test "x$glibcxx_cv_func_fabsl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_FABSL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for floorl declaration" >&5 +$as_echo_n "checking for floorl declaration... " >&6; } +if ${glibcxx_cv_func_floorl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef floorl + +int +main () +{ + + void (*f)(void) = (void (*)(void))floorl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_floorl_use=yes + +else + glibcxx_cv_func_floorl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_floorl_use" >&5 +$as_echo "$glibcxx_cv_func_floorl_use" >&6; } + if test "x$glibcxx_cv_func_floorl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_FLOORL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fmodl declaration" >&5 +$as_echo_n "checking for fmodl declaration... " >&6; } +if ${glibcxx_cv_func_fmodl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef fmodl + +int +main () +{ + + void (*f)(void) = (void (*)(void))fmodl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_fmodl_use=yes + +else + glibcxx_cv_func_fmodl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_fmodl_use" >&5 +$as_echo "$glibcxx_cv_func_fmodl_use" >&6; } + if test "x$glibcxx_cv_func_fmodl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_FMODL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for frexpl declaration" >&5 +$as_echo_n "checking for frexpl declaration... " >&6; } +if ${glibcxx_cv_func_frexpl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef frexpl + +int +main () +{ + + void (*f)(void) = (void (*)(void))frexpl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_frexpl_use=yes + +else + glibcxx_cv_func_frexpl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_frexpl_use" >&5 +$as_echo "$glibcxx_cv_func_frexpl_use" >&6; } + if test "x$glibcxx_cv_func_frexpl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_FREXPL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hypotl declaration" >&5 +$as_echo_n "checking for hypotl declaration... " >&6; } +if ${glibcxx_cv_func_hypotl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef hypotl + +int +main () +{ + + void (*f)(void) = (void (*)(void))hypotl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_hypotl_use=yes + +else + glibcxx_cv_func_hypotl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_hypotl_use" >&5 +$as_echo "$glibcxx_cv_func_hypotl_use" >&6; } + if test "x$glibcxx_cv_func_hypotl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_HYPOTL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldexpl declaration" >&5 +$as_echo_n "checking for ldexpl declaration... " >&6; } +if ${glibcxx_cv_func_ldexpl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef ldexpl + +int +main () +{ + + void (*f)(void) = (void (*)(void))ldexpl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_ldexpl_use=yes + +else + glibcxx_cv_func_ldexpl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_ldexpl_use" >&5 +$as_echo "$glibcxx_cv_func_ldexpl_use" >&6; } + if test "x$glibcxx_cv_func_ldexpl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LDEXPL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log10l declaration" >&5 +$as_echo_n "checking for log10l declaration... " >&6; } +if ${glibcxx_cv_func_log10l_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef log10l + +int +main () +{ + + void (*f)(void) = (void (*)(void))log10l; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_log10l_use=yes + +else + glibcxx_cv_func_log10l_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_log10l_use" >&5 +$as_echo "$glibcxx_cv_func_log10l_use" >&6; } + if test "x$glibcxx_cv_func_log10l_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LOG10L 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for logl declaration" >&5 +$as_echo_n "checking for logl declaration... " >&6; } +if ${glibcxx_cv_func_logl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef logl + +int +main () +{ + + void (*f)(void) = (void (*)(void))logl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_logl_use=yes + +else + glibcxx_cv_func_logl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_logl_use" >&5 +$as_echo "$glibcxx_cv_func_logl_use" >&6; } + if test "x$glibcxx_cv_func_logl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LOGL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for modfl declaration" >&5 +$as_echo_n "checking for modfl declaration... " >&6; } +if ${glibcxx_cv_func_modfl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef modfl + +int +main () +{ + + void (*f)(void) = (void (*)(void))modfl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_modfl_use=yes + +else + glibcxx_cv_func_modfl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_modfl_use" >&5 +$as_echo "$glibcxx_cv_func_modfl_use" >&6; } + if test "x$glibcxx_cv_func_modfl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_MODFL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for powl declaration" >&5 +$as_echo_n "checking for powl declaration... " >&6; } +if ${glibcxx_cv_func_powl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef powl + +int +main () +{ + + void (*f)(void) = (void (*)(void))powl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_powl_use=yes + +else + glibcxx_cv_func_powl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_powl_use" >&5 +$as_echo "$glibcxx_cv_func_powl_use" >&6; } + if test "x$glibcxx_cv_func_powl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_POWL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sinhl declaration" >&5 +$as_echo_n "checking for sinhl declaration... " >&6; } +if ${glibcxx_cv_func_sinhl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef sinhl + +int +main () +{ + + void (*f)(void) = (void (*)(void))sinhl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_sinhl_use=yes + +else + glibcxx_cv_func_sinhl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_sinhl_use" >&5 +$as_echo "$glibcxx_cv_func_sinhl_use" >&6; } + if test "x$glibcxx_cv_func_sinhl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SINHL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sinl declaration" >&5 +$as_echo_n "checking for sinl declaration... " >&6; } +if ${glibcxx_cv_func_sinl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef sinl + +int +main () +{ + + void (*f)(void) = (void (*)(void))sinl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_sinl_use=yes + +else + glibcxx_cv_func_sinl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_sinl_use" >&5 +$as_echo "$glibcxx_cv_func_sinl_use" >&6; } + if test "x$glibcxx_cv_func_sinl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SINL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrtl declaration" >&5 +$as_echo_n "checking for sqrtl declaration... " >&6; } +if ${glibcxx_cv_func_sqrtl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef sqrtl + +int +main () +{ + + void (*f)(void) = (void (*)(void))sqrtl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_sqrtl_use=yes + +else + glibcxx_cv_func_sqrtl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_sqrtl_use" >&5 +$as_echo "$glibcxx_cv_func_sqrtl_use" >&6; } + if test "x$glibcxx_cv_func_sqrtl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SQRTL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tanhl declaration" >&5 +$as_echo_n "checking for tanhl declaration... " >&6; } +if ${glibcxx_cv_func_tanhl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef tanhl + +int +main () +{ + + void (*f)(void) = (void (*)(void))tanhl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_tanhl_use=yes + +else + glibcxx_cv_func_tanhl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_tanhl_use" >&5 +$as_echo "$glibcxx_cv_func_tanhl_use" >&6; } + if test "x$glibcxx_cv_func_tanhl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_TANHL 1 +_ACEOF + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tanl declaration" >&5 +$as_echo_n "checking for tanl declaration... " >&6; } +if ${glibcxx_cv_func_tanl_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#undef tanl + +int +main () +{ + + void (*f)(void) = (void (*)(void))tanl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_func_tanl_use=yes + +else + glibcxx_cv_func_tanl_use=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_func_tanl_use" >&5 +$as_echo "$glibcxx_cv_func_tanl_use" >&6; } + if test "x$glibcxx_cv_func_tanl_use" = xyes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_TANL 1 +_ACEOF + + fi + + + + $as_echo "#define HAVE_ICONV 1" >>confdefs.h $as_echo "#define HAVE_MEMALIGN 1" >>confdefs.h diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 0abe54e..9770c17 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -349,6 +349,7 @@ else AC_DEFINE(HAVE_FLOORF) AC_DEFINE(HAVE_FMODF) AC_DEFINE(HAVE_FREXPF) + AC_DEFINE(HAVE_HYPOTF) AC_DEFINE(HAVE_LDEXPF) AC_DEFINE(HAVE_LOG10F) AC_DEFINE(HAVE_LOGF) @@ -360,6 +361,14 @@ else AC_DEFINE(HAVE_TANF) AC_DEFINE(HAVE_TANHF) +dnl # Support for the long version of some math libraries depends on +dnl # architecture and newlib version. So test for their availability +dnl # rather than hardcoding that information. + GLIBCXX_CHECK_MATH_DECLS([ + acosl asinl atan2l atanl ceill coshl cosl expl fabsl floorl fmodl + frexpl hypotl ldexpl log10l logl modfl powl sinhl sinl sqrtl + tanhl tanl]) + AC_DEFINE(HAVE_ICONV) AC_DEFINE(HAVE_MEMALIGN) diff --git a/libstdc++-v3/doc/html/manual/ext_demangling.html b/libstdc++-v3/doc/html/manual/ext_demangling.html index 1e7cdda8..b5fb87b 100644 --- a/libstdc++-v3/doc/html/manual/ext_demangling.html +++ b/libstdc++-v3/doc/html/manual/ext_demangling.html @@ -20,11 +20,9 @@ whole point of abstract interfaces. If we change the implementation, you won't notice.) </p><p> - Probably the only times you'll be interested in demangling at runtime - are when you're seeing <code class="code">typeid</code> strings in RTTI, or when - you're handling the runtime-support exception classes. For example: + Probably the only time you'll be interested in demangling at runtime + is when you're seeing <code class="code">typeid</code> strings in RTTI. For example: </p><pre class="programlisting"> -#include <exception> #include <iostream> #include <cstdlib> #include <cxxabi.h> diff --git a/libstdc++-v3/doc/xml/manual/extensions.xml b/libstdc++-v3/doc/xml/manual/extensions.xml index daa98f5..d4fe2f5 100644 --- a/libstdc++-v3/doc/xml/manual/extensions.xml +++ b/libstdc++-v3/doc/xml/manual/extensions.xml @@ -514,12 +514,10 @@ get_temporary_buffer(5, (int*)0); you won't notice.) </para> <para> - Probably the only times you'll be interested in demangling at runtime - are when you're seeing <code>typeid</code> strings in RTTI, or when - you're handling the runtime-support exception classes. For example: + Probably the only time you'll be interested in demangling at runtime + is when you're seeing <code>typeid</code> strings in RTTI. For example: </para> <programlisting> -#include <exception> #include <iostream> #include <cstdlib> #include <cxxabi.h> diff --git a/libstdc++-v3/testsuite/20_util/from_chars/4.cc b/libstdc++-v3/testsuite/20_util/from_chars/4.cc index 206e18d..76e07df 100644 --- a/libstdc++-v3/testsuite/20_util/from_chars/4.cc +++ b/libstdc++-v3/testsuite/20_util/from_chars/4.cc @@ -18,7 +18,7 @@ // <charconv> is supported in C++14 as a GNU extension // { dg-do run { target c++14 } } // { dg-add-options ieee } -// { dg-additional-options "-DSKIP_LONG_DOUBLE" { target aarch64-*-vxworks* x86_64-*-vxworks* } } +// { dg-additional-options "-DSKIP_LONG_DOUBLE" { target aarch64-*-rtems* aarch64-*-vxworks* x86_64-*-vxworks* } } #include <charconv> #include <string> diff --git a/zlib/ChangeLog b/zlib/ChangeLog index 9364455..db5825f 100644 --- a/zlib/ChangeLog +++ b/zlib/ChangeLog @@ -1,3 +1,9 @@ +2023-06-15 Marek Polacek <polacek@redhat.com> + + * configure.ac (--enable-host-shared): Don't set PICFLAG here. + (--enable-host-pie): New check. Set PICFLAG after this check. + * configure: Regenerate. + 2022-11-23 Marek Polacek <polacek@redhat.com> Revert: diff --git a/zlib/configure b/zlib/configure index e35ac6e..77be6c2 100755 --- a/zlib/configure +++ b/zlib/configure @@ -635,6 +635,8 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS PICFLAG +enable_host_pie +enable_host_shared TARGET_LIBRARY_FALSE TARGET_LIBRARY_TRUE toolexeclibdir @@ -778,6 +780,7 @@ with_gnu_ld enable_libtool_lock with_toolexeclibdir enable_host_shared +enable_host_pie ' ac_precious_vars='build_alias host_alias @@ -1420,6 +1423,7 @@ Optional Features: optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-host-shared build host code as shared libraries + --enable-host-pie build host code as PIE Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -10759,7 +10763,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10762 "configure" +#line 10778 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10865,7 +10869,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10868 "configure" +#line 10884 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11548,15 +11552,31 @@ else multilib_arg= fi +# Enable --enable-host-shared. # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PICFLAG=-fPIC + enableval=$enable_host_shared; +fi + + + +# Enable --enable-host-pie. +# Check whether --enable-host-pie was given. +if test "${enable_host_pie+set}" = set; then : + enableval=$enable_host_pie; +fi + + + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE else PICFLAG= fi - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF diff --git a/zlib/configure.ac b/zlib/configure.ac index be1cfe2..adf7aad 100644 --- a/zlib/configure.ac +++ b/zlib/configure.ac @@ -122,11 +122,26 @@ else multilib_arg= fi +# Enable --enable-host-shared. AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PICFLAG=-fPIC], [PICFLAG=]) -AC_SUBST(PICFLAG) + [build host code as shared libraries])]) +AC_SUBST(enable_host_shared) + +# Enable --enable-host-pie. +AC_ARG_ENABLE(host-pie, +[AS_HELP_STRING([--enable-host-pie], + [build host code as PIE])]) +AC_SUBST(enable_host_pie) + +if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +elif test x$enable_host_pie = xyes; then + PICFLAG=-fPIE +else + PICFLAG= +fi +AC_SUBST(PICFLAG) AC_CONFIG_FILES([Makefile]) AC_OUTPUT |