diff options
author | Martin Liska <mliska@suse.cz> | 2021-05-24 11:39:52 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-05-24 11:39:52 +0200 |
commit | a06bc9f78ddd15073bf7fa8386e1a97ac80655bb (patch) | |
tree | f0439435ed433ccd0eb1eebfaa4eaf250793d7f1 | |
parent | 905b28242c5afcf0a46d74580f800c3b0bd1f6ae (diff) | |
parent | 0f3cd532fa02d1787960bdd380d0a3f78343f024 (diff) | |
download | gcc-a06bc9f78ddd15073bf7fa8386e1a97ac80655bb.zip gcc-a06bc9f78ddd15073bf7fa8386e1a97ac80655bb.tar.gz gcc-a06bc9f78ddd15073bf7fa8386e1a97ac80655bb.tar.bz2 |
Merge branch 'master' into devel/sphinx
408 files changed, 10350 insertions, 2226 deletions
@@ -1,3 +1,8 @@ +2021-05-18 Mike Frysinger <vapier@gentoo.org> + + * Makefile.def: Add configure-sim dependency on all-gnulib. + * Makefile.in: Regenerated. + 2021-05-17 Serge Belyshev <belyshev@depni.sinp.msu.ru> * MAINTAINERS (Write After Approval): Add myself. diff --git a/Makefile.def b/Makefile.def index 3930d99..c83d9c4 100644 --- a/Makefile.def +++ b/Makefile.def @@ -540,6 +540,7 @@ dependencies = { module=install-strip-sid; on=install-strip-tcl; }; dependencies = { module=install-sid; on=install-tk; }; dependencies = { module=install-strip-sid; on=install-strip-tk; }; +dependencies = { module=configure-sim; on=all-gnulib; }; dependencies = { module=configure-sim; on=configure-intl; }; dependencies = { module=all-sim; on=all-intl; }; dependencies = { module=all-sim; on=all-libiberty; }; diff --git a/Makefile.in b/Makefile.in index b6cf330..ab883f6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -61035,6 +61035,7 @@ install-sid: maybe-install-tcl install-strip-sid: maybe-install-strip-tcl install-sid: maybe-install-tk install-strip-sid: maybe-install-strip-tk +configure-sim: maybe-all-gnulib all-sim: maybe-all-readline all-fastjar: maybe-all-build-texinfo all-libctf: all-libiberty diff --git a/config/ChangeLog b/config/ChangeLog index 25df3bd..311d80b 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2021-05-18 Mike Frysinger <vapier@gentoo.org> + + * acinclude.m4 (CYG_AC_PATH_SIM, CYG_AC_PATH_DEVO): Delete. + 2021-05-03 H.J. Lu <hjl.tools@gmail.com> PR bootstrap/99703 diff --git a/config/acinclude.m4 b/config/acinclude.m4 index 8242b2c..0abccafa 100644 --- a/config/acinclude.m4 +++ b/config/acinclude.m4 @@ -374,88 +374,6 @@ AC_SUBST(INTLLIB) ]) dnl ==================================================================== -dnl Find the simulator library. -AC_DEFUN([CYG_AC_PATH_SIM], [ -dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.." -case "$target_cpu" in - powerpc) target_dir=ppc ;; - sparc*) target_dir=erc32 ;; - mips*) target_dir=mips ;; - *) target_dir=$target_cpu ;; -esac -dnl First look for the header file -AC_MSG_CHECKING(for the simulator header file) -AC_CACHE_VAL(ac_cv_c_simh,[ -for i in $dirlist; do - if test -f "${srcdir}/$i/include/remote-sim.h" ; then - ac_cv_c_simh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})` - break - fi -done -]) -if test x"${ac_cv_c_simh}" != x; then - SIMHDIR="-I${ac_cv_c_simh}" - AC_MSG_RESULT(${ac_cv_c_simh}) -else - AC_MSG_RESULT(none) -fi -AC_SUBST(SIMHDIR) - -dnl See whether it's a devo or Foundry branch simulator -AC_MSG_CHECKING(Whether this is a devo simulator ) -AC_CACHE_VAL(ac_cv_c_simdevo,[ - CPPFLAGS="$CPPFLAGS $SIMHDIR" - AC_EGREP_HEADER([SIM_DESC sim_open.*struct _bfd], remote-sim.h, - ac_cv_c_simdevo=yes, - ac_cv_c_simdevo=no) -]) -if test x"$ac_cv_c_simdevo" = x"yes" ; then - AC_DEFINE(HAVE_DEVO_SIM) -fi -AC_MSG_RESULT(${ac_cv_c_simdevo}) -AC_SUBST(HAVE_DEVO_SIM) - -dnl Next look for the library -AC_MSG_CHECKING(for the simulator library) -AC_CACHE_VAL(ac_cv_c_simlib,[ -for i in $dirlist; do - if test -f "$i/sim/$target_dir/Makefile" ; then - ac_cv_c_simlib=`(cd $i/sim/$target_dir; ${PWDCMD-pwd})` - fi -done -]) -if test x"${ac_cv_c_simlib}" != x; then - SIMLIB="-L${ac_cv_c_simlib}" -else - AC_MSG_RESULT(none) - dnl FIXME: this is kinda bogus, cause umtimately the TM will build - dnl all the libraries for several architectures. But for now, this - dnl will work till then. -dnl AC_MSG_CHECKING(for the simulator installed with the compiler libraries) - dnl Transform the name of the compiler to it's cross variant, unless - dnl CXX is set. This is also what CXX gets set to in the generated - dnl Makefile. - CROSS_GCC=`echo gcc | sed -e "s/^/$target/"` - - dnl Get G++'s full path to libgcc.a -changequote(,) - gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib -changequote([,]) - if test -f $gccpath/libsim.a -o -f $gccpath/libsim.so ; then - ac_cv_c_simlib="$gccpath/" - SIMLIB="-L${ac_cv_c_simlib}" - AC_MSG_RESULT(${ac_cv_c_simlib}) - else - AM_CONDITIONAL(PSIM, test x$psim = xno) - SIMLIB="" - AC_MSG_RESULT(none) -dnl ac_cv_c_simlib=none - fi -fi -AC_SUBST(SIMLIB) -]) - -dnl ==================================================================== dnl Find the libiberty library. AC_DEFUN([CYG_AC_PATH_LIBIBERTY], [ AC_MSG_CHECKING(for the libiberty library in the build tree) @@ -477,26 +395,6 @@ AC_SUBST(LIBIBERTY) ]) dnl ==================================================================== -AC_DEFUN([CYG_AC_PATH_DEVO], [ -AC_MSG_CHECKING(for devo headers in the source tree) -dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." -AC_CACHE_VAL(ac_cv_c_devoh,[ -for i in $dirlist; do - if test -f "${srcdir}/$i/include/remote-sim.h" ; then - ac_cv_c_devoh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})` - fi -done -]) -if test x"${ac_cv_c_devoh}" != x; then - DEVOHDIR="-I${ac_cv_c_devoh}" - AC_MSG_RESULT(${ac_cv_c_devoh}) -else - AC_MSG_RESULT(none) -fi -AC_SUBST(DEVOHDIR) -]) - -dnl ==================================================================== dnl Find all the ILU headers and libraries AC_DEFUN([CYG_AC_PATH_ILU], [ AC_MSG_CHECKING(for ILU kernel headers in the source tree) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index b97710f..0b4cf14 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2021-05-18 Jonathan Wakely <jwakely@redhat.com> + + * gcc-changelog/git_email.py: Remove use of non-strict mode. + 2021-05-17 Richard Biener <rguenther@suse.de> * download_prerequisites: Update mpfr version to 3.1.6. diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 4958ab9..bd8c1ff 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -326,9 +326,11 @@ class GitCommit: # All modified files are only MISC files return elif project_files: - self.errors.append(Error('ChangeLog, DATESTAMP, BASE-VER and ' - 'DEV-PHASE updates should be done ' - 'separately from normal commits')) + err = 'ChangeLog, DATESTAMP, BASE-VER and DEV-PHASE updates ' \ + 'should be done separately from normal commits\n' \ + '(note: ChangeLog entries will be automatically ' \ + 'added by a cron job)' + self.errors.append(Error(err)) return all_are_ignored = (len(project_files) + len(ignored_files) diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 7472762..6d65963 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -258,7 +258,7 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0001-Add-patch_are') msg = 'ChangeLog, DATESTAMP, BASE-VER and DEV-PHASE updates should ' \ 'be done separately from normal commits' - assert email.errors[0].message == msg + assert email.errors[0].message.startswith(msg) def test_strict_mode_normal_patch(self): email = self.get_git_email('0001-Just-test-it.patch') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe5132d..5cf4824 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,770 @@ +2021-05-23 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100722 + * config/i386/mmx.md (*push<VI_32:mode>2_rex64): + New instruction pattern. + (*push<VI_32:mode>2): Ditto. + (push splitter for SSE registers): New splitter. + +2021-05-23 Andrew Pinski <apinski@marvell.com> + + * match.pd ((A & C) != 0 ? D : 0): Limit to non pointer types. + +2021-05-22 Aaron Sawdey <acsawdey@linux.ibm.com> + + * config/rs6000/genfusion.pl (gen_addadd): Fix incorrect attr types. + * config/rs6000/fusion.md: Regenerate file. + +2021-05-21 Aaron Sawdey <acsawdey@linux.ibm.com> + + * config/rs6000/genfusion.pl (gen_addadd): New function. + * config/rs6000/fusion.md: Regenerate file. + * config/rs6000/rs6000-cpus.def: Add + OPTION_MASK_P10_FUSION_2ADD to masks. + * config/rs6000/rs6000.c (rs6000_option_override_internal): + Handle default value of OPTION_MASK_P10_FUSION_2ADD. + * config/rs6000/rs6000.opt: Add -mpower10-fusion-2add. + +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * tree.h (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET): Define. + * gimplify.c (enum gimplify_omp_var_data): Fix up + GOVD_MAP_HAS_ATTACHMENTS value, add GOVD_FIRSTPRIVATE_IMPLICIT. + (omp_lastprivate_for_combined_outer_constructs): If combined target + has GOVD_FIRSTPRIVATE_IMPLICIT set for the decl, change it to + GOVD_MAP | GOVD_SEEN. + (gimplify_scan_omp_clauses): Set GOVD_FIRSTPRIVATE_IMPLICIT for + firstprivate clauses with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT. + (gimplify_adjust_omp_clauses): For firstprivate clauses with + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT either clear that bit and + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET too, or remove it and + let it be replaced by implicit map clause. + +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * gimplify.c (omp_lastprivate_for_combined_outer_constructs): New + function. + (gimplify_scan_omp_clauses) <case OMP_CLAUSE_LASTPRIVATE>: Use it. + (gimplify_omp_for): Likewise. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * omp-low.c (oacc_privatization_candidate_p): Reject 'static', + 'external' in blocks. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * flag-types.h (enum openacc_privatization): New. + * params.opt (-param=openacc-privatization): New. + * doc/invoke.texi (openacc-privatization): Document it. + * omp-general.h (get_openacc_privatization_dump_flags): New + function. + * omp-low.c (oacc_privatization_candidate_p): Add diagnostics. + * omp-offload.c (execute_oacc_device_lower) + <IFN_UNIQUE_OACC_PRIVATE>: Re-work diagnostics. + * target.def (goacc.adjust_private_decl): Add 'location_t' + parameter. + * doc/tm.texi: Regenerate. + * config/gcn/gcn-protos.h (gcn_goacc_adjust_private_decl): Adjust. + * config/gcn/gcn-tree.c (gcn_goacc_adjust_private_decl): Likewise. + * config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl): + Likewise. Preserve it for... + (nvptx_goacc_expand_var_decl): ... use here. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + * doc/sourcebuild.texi (Other attributes): Document '__OPTIMIZE__' + DejaGnu selector. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * omp-low.c (oacc_privatization_candidate_p): New function. + (oacc_privatization_scan_clause_chain) + (oacc_privatization_scan_decl_chain): Use it. Also + 'gcc_checking_assert' that we're not seeing duplicates. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * omp-offload.c (execute_oacc_device_lower): Skip processing if no + work to be done. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * omp-offload.c (execute_oacc_device_lower): Explain. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * omp-offload.c (execute_oacc_device_lower) + <IFN_UNIQUE_OACC_PRIVATE>: Diagnose and handle for 'level == -1' + case, too. + * internal-fn.c (expand_UNIQUE): Don't expect + 'IFN_UNIQUE_OACC_PRIVATE'. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * omp-low.c (lower_omp_for): Don't evaluate OpenMP 'for' clauses. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl) + (nvptx_goacc_expand_var_decl): Tighten. + +2021-05-21 Julian Brown <julian@codesourcery.com> + Chung-Lin Tang <cltang@codesourcery.com> + Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * doc/tm.texi.in (TARGET_GOACC_EXPAND_VAR_DECL) + (TARGET_GOACC_ADJUST_PRIVATE_DECL): Add documentation hooks. + * doc/tm.texi: Regenerate. + * expr.c (expand_expr_real_1): Expand decls using the + expand_var_decl OpenACC hook if defined. + * internal-fn.c (expand_UNIQUE): Handle IFN_UNIQUE_OACC_PRIVATE. + * internal-fn.h (IFN_UNIQUE_CODES): Add OACC_PRIVATE. + * omp-low.c (omp_context): Add oacc_privatization_candidates + field. + (lower_oacc_reductions): Add PRIVATE_MARKER parameter. Insert + before fork. + (lower_oacc_head_tail): Add PRIVATE_MARKER parameter. Modify + private marker's gimple call arguments, and pass it to + lower_oacc_reductions. + (oacc_privatization_scan_clause_chain) + (oacc_privatization_scan_decl_chain, lower_oacc_private_marker): + New functions. + (lower_omp_for, lower_omp_target, lower_omp_1): Use these. + * omp-offload.c (convert.h): Include. + (oacc_loop_xform_head_tail): Treat private-variable markers like + fork/join when transforming head/tail sequences. + (struct var_decl_rewrite_info): Add struct. + (oacc_rewrite_var_decl, is_sync_builtin_call): New functions. + (execute_oacc_device_lower): Support rewriting gang-private + variables using target hook, and fix up addr_expr and var_decl + nodes afterwards. + * target.def (adjust_private_decl, expand_var_decl): New hooks. + * config/gcn/gcn-protos.h (gcn_goacc_adjust_gangprivate_decl): + Rename to... + (gcn_goacc_adjust_private_decl): ...this. + * config/gcn/gcn-tree.c (gcn_goacc_adjust_gangprivate_decl): + Rename to... + (gcn_goacc_adjust_private_decl): ...this. Add LEVEL parameter. + * config/gcn/gcn.c (TARGET_GOACC_ADJUST_GANGPRIVATE_DECL): Rename + definition using gcn_goacc_adjust_gangprivate_decl... + (TARGET_GOACC_ADJUST_PRIVATE_DECL): ...to this, using + gcn_goacc_adjust_private_decl. + * config/nvptx/nvptx.c (tree-pretty-print.h): Include. + (gang_private_shared_size): New global variable. + (gang_private_shared_align): Likewise. + (gang_private_shared_sym): Likewise. + (gang_private_shared_hmap): Likewise. + (nvptx_option_override): Initialize these. + (nvptx_file_end): Output gang_private_shared_sym. + (nvptx_goacc_adjust_private_decl, nvptx_goacc_expand_var_decl): + New functions. + (nvptx_set_current_function): Clear gang_private_shared_hmap. + (TARGET_GOACC_ADJUST_PRIVATE_DECL): Define hook. + (TARGET_GOACC_EXPAND_VAR_DECL): Likewise. + +2021-05-21 H.J. Lu <hjl.tools@gmail.com> + + * config/i386/i386-modes.def (MAX_BITSIZE_MODE_ANY_INT): Removed. + +2021-05-21 Richard Biener <rguenther@suse.de> + H.J. Lu <hjl.tools@gmail.com> + + PR middle-end/90773 + * expr.c (expand_constructor): Elide expand_constructor if + move by pieces is preferred. + +2021-05-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/aarch64/aarch64-builtins.c (aarch64_call_properties): + Take a flag and mode value as arguments. + (aarch64_modifies_global_state_p): Likewise. + (aarch64_reads_global_state_p): Likewise. + (aarch64_could_trap_p): Likewise. + (aarch64_get_attributes): Likewise. + (aarch64_init_simd_builtins): Adjust callsite of above. + (aarch64_init_fcmla_laneq_builtins): Use aarch64_get_attributes to get + function attributes to apply to builtins. + (aarch64_init_crc32_builtins): Likewise. + (aarch64_init_builtin_rsqrt): Likewise. + +2021-05-21 Aaron Sawdey <acsawdey@linux.ibm.com> + + * config/rs6000/rs6000.md (define_attr "type"): Add types for fusion. + * config/rs6000/genfusion.pl (gen_ld_cmpi_p10): Use new fusion types. + (gen_2logical): Use new fusion types. + * config/rs6000/fusion.md: Regenerate. + +2021-05-21 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100637 + * config/i386/i386-expand.c (ix86_expand_sse_movcc): + Handle V4QI and V2HI modes. + (ix86_expand_sse_movcc): Ditto. + * config/i386/mmx.md (*<sat_plusminus:insn><VI_32:mode>3): + New instruction pattern. + (*eq<VI_32:mode>3): Ditto. + (*gt<VI_32:mode>3): Ditto. + (*xop_pcmov_<VI_32:mode>): Ditto. + (mmx_pblendvb32): Ditto. + (mmx_pblendvb64): Rename from mmx_pblendvb. + (vec_cmp<VI_32:mode><VI_32:mode>): New expander. + (vec_cmpu<VI_32:mode><VI_32:mode>): Ditto. + (vcond<VI_32:mode><VI_32:mode>): Ditto. + (vcondu<VI_32:mode><VI_32:mode>): Ditto. + (vcond_mask_<VI_32:mode><VI_32:mode>): Ditto. + +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/94589 + * tree-ssa-phiopt.c (spaceship_replacement): For integral rhs1 and + rhs2, treat x <= 4 equivalently to x < 5 etc. In cmp1 and cmp2 (if + not the same as cmp3) treat <= the same as < and >= the same as >. + Don't require that cond2_phi_edge is true edge, instead take + false/true edges into account based on cmp1/cmp2 comparison kinds. + +2021-05-21 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100637 + * config/i386/mmx.md (SMAXMIN_MMXMODEI): New mode iterator. + (<smaxmin:code><SMAXMIN_MMXMODEI:mode>3): Macroize expander + from <smaxmin:code>v4hi3> and <smaxmin:code><MMXMODE14:mode>3 + using SMAXMIN_MMXMODEI mode iterator. + (*<smaxmin:code>v4qi3): New insn pattern. + (*<smaxmin:code>v2hi3): Ditto. + (SMAXMIN_VI_32): New mode iterator. + (<smaxmin:code><SMAXMIN_VI_32>mode3): New expander. + (UMAXMIN_MMXMODEI): New mode iterator. + (<umaxmin:code><UMAXMIN_MMXMODEI:mode>3): Macroize expander + from <umaxmin:code>v8qi3> and <umaxmin:code><MMXMODE24:mode>3 + using UMAXMIN_MMXMODEI mode iterator. + (*<umaxmin:code>v4qi3): New insn pattern. + (*<umaxmin:code>v2hi3): Ditto. + (UMAXMIN_VI_32): New mode iterator. + (<umaxmin:code><UMAXMIN_VI_32>mode3): New expander. + (abs<VI_32:mode>2): New insn pattern. + (ssse3_abs<MMXMODEI:mode>2, abs<MMXMODEI:mode>2): Move from ... + * config/i386/sse.md: ... here. + +2021-05-20 Clement Chigot <clement.chigot@atos.net> + David Edelsohn <dje.gcc@gmail.com> + + * collect2.c (scan_prog_file): Issue non-fatal warning for + non-COFF files. + +2021-05-20 Jonathan Wakely <jwakely@redhat.com> + + * doc/invoke.texi (-Wno-c++11-extensions) + (-Wno-c++14-extensions, -Wno-c++17-extensions) + (-Wno-c++20-extensions, -Wno-c++23-extensions): Document + new options. + +2021-05-20 Indu Bhagat <indu.bhagat@oracle.com> + + * config/c6x/c6x.c (c6x_output_file_unwind): Use dwarf_debuginfo_p. + * config/darwin.c (darwin_override_options): Likewise. + * config/i386/cygming.h (DBX_REGISTER_NUMBER): Likewise. + * config/i386/darwin.h (DBX_REGISTER_NUMBER): Likewise. + (DWARF2_FRAME_REG_OUT): Likewise. + * config/mips/mips.c (mips_output_filename): Likewise. + * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): + Likewise. + (rs6000_dbx_register_number): Likewise. + * dbxout.c: Include flags.h. + * dwarf2cfi.c (cfi_label_required_p): Likewise. + (dwarf2out_do_frame): Likewise. + * except.c: Include flags.h. + * final.c (dwarf2_debug_info_emitted_p): Likewise. + (final_scan_insn_1): Likewise. + * flags.h (dwarf_debuginfo_p): New function declaration. + * opts.c (dwarf_debuginfo_p): New function definition. + * targhooks.c (default_debug_unwind_info): Use dwarf_debuginfo_p. + * toplev.c (process_options): Likewise. + +2021-05-20 Indu Bhagat <indu.bhagat@oracle.com> + + * common.opt: Change type to support bitmasks. + * flag-types.h (enum debug_info_type): Rename enumerator constants. + (NO_DEBUG): New bitmask. + (DBX_DEBUG): Likewise. + (DWARF2_DEBUG): Likewise. + (XCOFF_DEBUG): Likewise. + (VMS_DEBUG): Likewise. + (VMS_AND_DWARF2_DEBUG): Likewise. + * flags.h (debug_set_to_format): New function declaration. + (debug_set_count): Likewise. + (debug_set_names): Likewise. + * opts.c (debug_type_masks): Array of bitmasks for debug formats. + (debug_set_to_format): New function definition. + (debug_set_count): Likewise. + (debug_set_names): Likewise. + (set_debug_level): Update access to debug_type_names. + * toplev.c: Likewise. + +2021-05-20 Martin Sebor <msebor@redhat.com> + + PR middle-end/100684 + * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Handle C++ lambda. + +2021-05-20 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100701 + * config/i386/i386.md (isa): Remove x64_bmi. + (enabled): Remove x64_bmi. + * config/i386/mmx.md (mmx_andnot<MMXMODEI:mode>3): + Remove general register alternative. + (*andnot<VI_32:mode>3): Ditto. + (*mmx_<any_logic:code><MMXMODEI:mode>3): Ditto. + (*<any_logic:code><VI_32:mode>3): Ditto. + +2021-05-20 Kewen Lin <linkw@linux.ibm.com> + + * config/arm/arm.c: Include head files tree-vectorizer.h and + cfgloop.h. + +2021-05-20 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100637 + * config/i386/mmx.md (Yv_Yw): Revert adding V4QI and V2HI modes. + (*<plusminus:insn><VI_32:mode>3): Use Yw instad of <Yv_Yw> constrint. + (<s>mulv4hi3_highpart): New expander. + (*<s>mulv2hi3_highpart): New insn pattern. + (<s>mulv2hi3_higpart): New expander. + (*<any_shift:insn>v2hi3): New insn pattern. + (<any_shift:insn>v2hi3): New expander. + * config/i386/sse.md (smulhrsv2hi3): New expander. + (*smulhrsv2hi3): New insn pattern. + +2021-05-20 Kewen Lin <linkw@linux.ibm.com> + + * doc/invoke.texi (vect-inner-loop-cost-factor): Document new + parameter. + * params.opt (vect-inner-loop-cost-factor): New. + * targhooks.c (default_add_stmt_cost): Replace hardcoded factor + 50 with LOOP_VINFO_INNER_LOOP_COST_FACTOR, include head file + tree-vectorizer.h and its required ones. + * config/aarch64/aarch64.c (aarch64_add_stmt_cost): Replace + hardcoded factor 50 with LOOP_VINFO_INNER_LOOP_COST_FACTOR. + * config/arm/arm.c (arm_add_stmt_cost): Likewise. + * config/i386/i386.c (ix86_add_stmt_cost): Likewise. + * config/rs6000/rs6000.c (rs6000_add_stmt_cost): Likewise. + * tree-vect-loop.c (vect_compute_single_scalar_iteration_cost): + Likewise. + (_loop_vec_info::_loop_vec_info): Init inner_loop_cost_factor. + * tree-vectorizer.h (_loop_vec_info): Add inner_loop_cost_factor. + (LOOP_VINFO_INNER_LOOP_COST_FACTOR): New macro. + +2021-05-20 Christophe Lyon <christophe.lyon@linaro.org> + Torbjörn Svensson <torbjorn.svensson@st.com> + + PR c/42579 + * doc/cpp.texi (Common Predefined Macros): Document __FILE_NAME__. + +2021-05-20 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * gimplify.c (gimplify_scan_omp_clauses) <case OMP_CLAUSE_LINEAR>: For + explicit linear clause when combined with target, make it map(tofrom:) + instead of no clause or firstprivate. + +2021-05-20 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/94589 + * match.pd ((X & Y) == X -> (X & ~Y) == 0): Simplify even in presence + of integral conversions. + +2021-05-19 Andrew MacLeod <amacleod@redhat.com> + + * gimple-range.cc (fur_source::get_operand): New. + (gimple_range_fold): Delete. + (fold_using_range::fold_stmt): Move from gimple_ranger::calc_stmt. + (fold_using_range::range_of_range_op): Move from gimple_ranger. + (fold_using_range::range_of_address): Ditto. + (fold_using_range::range_of_phi): Ditto. + (fold_using_range::range_of_call): Ditto. + (fold_using_range::range_of_builtin_ubsan_call): Move from + range_of_builtin_ubsan_call. + (fold_using_range::range_of_builtin_call): Move from + range_of_builtin_call. + (gimple_ranger::range_of_builtin_call): Delete. + (fold_using_range::range_of_cond_expr): Move from gimple_ranger. + (gimple_ranger::fold_range_internal): New. + (gimple_ranger::range_of_stmt): Use new fold_using_range API. + (fold_using_range::range_of_ssa_name_with_loop_info): Move from + gimple_ranger. Improve ranges of SSA_NAMES when possible. + * gimple-range.h (gimple_ranger): Remove various range_of routines. + (class fur_source): New. + (class fold_using_range): New. + (fur_source::fur_source): New. + (fold_range): New. + * vr-values.c (vr_values::extract_range_basic): Use fold_using_range + instead of range_of_builtin_call. + +2021-05-19 Jonathan Wakely <jwakely@redhat.com> + + * doc/cpp.texi (Common Predefined Macros): Update documentation + for the __GXX_EXPERIMENTAL_CXX0X__ macro. + +2021-05-19 Alex Coplan <alex.coplan@arm.com> + + PR target/100333 + * config/arm/arm.md (nonsecure_call_internal): Always ensure + callee's address is in a register. + +2021-05-19 Geng Qi <gengqi@linux.alibaba.com> + + * common/config/riscv/riscv-common.c + (riscv_subset_list::parsing_subset_version): Properly parse the letter + 'p' in '-march'. + (riscv_subset_list::parse_std_ext, + riscv_subset_list::parse_multiletter_ext): To handle errors generated + in riscv_subset_list::parsing_subset_version. + +2021-05-19 Jonathan Wright <jonathan.wright@arm.com> + + * config/aarch64/aarch64-simd.md: Use "neon_move_narrow_q" + type attribute in patterns generating XTN(2). + +2021-05-19 Jonathan Wright <jonathan.wright@arm.com> + + * config/aarch64/aarch64-simd.md (aarch64_simd_vec_pack_trunc_<mode>): + Remove as duplicate of... + (aarch64_xtn<mode>): This. + (aarch64_xtn2<mode>_le): Move position in file. + (aarch64_xtn2<mode>_be): Move position in file. + (aarch64_xtn2<mode>): Move position in file. + (vec_pack_trunc_<mode>): Define as an expander. + +2021-05-19 Jonathan Wright <jonathan.wright@arm.com> + + * config/aarch64/aarch64-simd-builtins.def: Split builtin + generation for aarch64_<sur>q<r>shr<u>n_n<mode> pattern into + separate scalar and vector generators. + * config/aarch64/aarch64-simd.md + (aarch64_<sur>q<r>shr<u>n_n<mode>): Define as an expander and + split into... + (aarch64_<sur>q<r>shr<u>n_n<mode>_insn_le): This and... + (aarch64_<sur>q<r>shr<u>n_n<mode>_insn_be): This. + * config/aarch64/iterators.md: Define SD_HSDI iterator. + +2021-05-19 Jonathn Wright <jonathan.wright@arm.com> + + * config/aarch64/aarch64-simd.md: Use UNSPEC_SQXTUN instead + of UNSPEC_SQXTUN2. + * config/aarch64/iterators.md: Remove UNSPEC_SQXTUN2. + +2021-05-19 Jonathan Wright <jonathan.wright@arm.com> + + * config/aarch64/aarch64-simd.md (aarch64_<sur>q<r>shr<u>n2_n<mode>): + Implement as an expand emitting a big/little endian + instruction pattern. + (aarch64_<sur>q<r>shr<u>n2_n<mode>_insn_le): Define. + (aarch64_<sur>q<r>shr<u>n2_n<mode>_insn_be): Define. + +2021-05-19 Jonathan Wright <jonathan.wright@arm.com> + + * config/aarch64/aarch64-simd.md (aarch64_<sur><addsub>hn2<mode>): + Implement as an expand emitting a big/little endian + instruction pattern. + (aarch64_<sur><addsub>hn2<mode>_insn_le): Define. + (aarch64_<sur><addsub>hn2<mode>_insn_be): Define. + * config/aarch64/iterators.md: Remove UNSPEC_[R]ADDHN2 and + UNSPEC_[R]SUBHN2 unspecs and ADDSUBHN2 iterator. + +2021-05-19 Richard Biener <rguenther@suse.de> + + PR middle-end/100672 + * fold-const.c (fold_negate_expr_1): Use element_precision. + (negate_expr_p): Likewise. + +2021-05-19 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * config/aarch64/iterators.md (SVE_PRED_LOAD): New iterator. + (pred_load): New int attribute. + * config/aarch64/aarch64-sve.md + (aarch64_load_<ANY_EXTEND:optab><SVE_HSDI:mode><SVE_PARTIAL_I:mode>): Use + SVE_PRED_LOAD enum iterator and corresponding pred_load attribute. + * config/aarch64/aarch64-sve-builtins-base.cc (expand): Update call to + code_for_aarch64_load. + +2021-05-19 Richard Biener <rguenther@suse.de> + + * cfgexpand.c (discover_nonconstant_array_refs_r): Make + sure TARGET_MEM_REF bases are expanded as memory. + * tree-ssa-operands.c (operands_scanner::get_tmr_operands): + Do not mark TARGET_MEM_REF bases addressable. + * tree-ssa.c (non_rewritable_mem_ref_base): Handle + TARGET_MEM_REF bases as never rewritable. + * gimple-walk.c (walk_stmt_load_store_addr_ops): Do not + walk TARGET_MEM_REF bases as address-takens. + * tree-ssa-dce.c (ref_may_be_aliased): Handle TARGET_MEM_REF. + +2021-05-19 Richard Biener <rguenther@suse.de> + + * builtins.c (get_object_alignment_1): Strip outer + WITH_SIZE_EXPR. + * tree-dfa.c (get_ref_base_and_extent): Handle outer + WITH_SIZE_EXPR for size processing and process the + containing ref. + * tree-ssa-alias.c (ao_ref_base_alias_set): Strip + outer WITH_SIZE_EXPR. + (ao_ref_base_alias_ptr_type): Likewise. + (refs_may_alias_p_2): Allow WITH_SIZE_EXPR in ref->ref + and handle that accordingly, stripping it for the + core alias workers. + * tree.c (get_base_address): Handle WITH_SIZE_EXPR by + looking through it instead of returning NULL. + +2021-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/100576 + * builtins.c (check_read_access): Convert bound to size_type_node if + non-NULL. + +2021-05-19 Richard Biener <rguenther@suse.de> + + * tree-cfg.c (verify_types_in_gimple_min_lval): Inline... + (verify_types_in_gimple_reference): ... here. Sanitize. + (verify_gimple_call): Verify references in LHS and arguments. + (verify_gimple_assign_single): Reject WITH_SIZE_EXPR. + +2021-05-19 Uroš Bizjak <ubizjak@gmail.com> + + * config/i386/i386.h (VALID_INT_MODE_P): + Add V8QI, V4HI and V2SI modes for TARGET_64BIT. + * config/i386/i386.md (isa): Add x64_bmi. + (enabled): Handle x64_bmi. + * config/i386/mmx.md (mmx_andnot<MMXMODEI:mode>3): + Add alternative using 64bit general registers. + (*mmx_<any_logic:code><MMXMODEI:mode>3): Ditto. + +2021-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * tree.h (OMP_MASTER_COMBINED): Define. + * gimplify.c (gimplify_scan_omp_clauses): Rewrite lastprivate + handling for outer combined/composite constructs to a loop. + Handle lastprivate on combined target. + (gimplify_expr): Formatting fix. + +2021-05-19 Xionghu Luo <luoxhu@linux.ibm.com> + + * passes.def: Add sink_code pass before store_merging. + * tree-ssa-sink.c (pass_sink_code:clone): New. + +2021-05-18 Bill Schmidt <wschmidt@linux.ibm.com> + + * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Remove call to + rs6000_special_adjust_field_align_p. + * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. + * config/rs6000/rs6000-call.c (rs6000_function_arg_boundary): + Remove ABI warning. + (rs6000_function_arg): Likewise. + * config/rs6000/rs6000-protos.h + (rs6000_special_adjust_field_align_p): Remove prototype. + * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): + Remove. + * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Remove call to + rs6000_special_adjust_field_align_p. + +2021-05-18 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100637 + * config/i386/i386.h (VALID_SSE2_REG_MODE): + Add V4QI and V2HI modes. + (VALID_INT_MODE_P): Ditto. + * config/i386/mmx.md (VI_32): New mode iterator. + (mmxvecsize): Handle V4QI and V2HI. + (Yv_Yw): Ditto. + (mov<VI_32:mode>): New expander. + (*mov<mode>_internal): New insn pattern. + (movmisalign<VI_32:mode>): New expander. + (neg<VI_32:mode>): New expander. + (<plusminus:insn><VI_32:mode>3): New expander. + (*<plusminus:insn><VI_32:mode>3): New insn pattern. + (mulv2hi3): New expander. + (*mulv2hi3): New insn pattern. + (one_cmpl<VI_32:mode>2): New expander. + (*andnot<VI_32:mode>3): New insn pattern. + (<any_logic:code><VI_32:mode>3): New expander. + (*<any_logic:code><VI_32:mode>3): New insn pattern. + +2021-05-18 Uroš Bizjak <ubizjak@gmail.com> + + * config/i386/sse.md (<any_extend:insn>v4qiv4di2): + Fix a mode mismatch with operand 1. + +2021-05-18 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100626 + * config/i386/i386-expand.c (split_double_mode): Return + temporary register when simplify_gen_subreg fails with + the high half od the paradoxical subreg. + +2021-05-18 Richard Biener <rguenther@suse.de> + + * cfgexpand.c (expand_one_var): Pass in forced_stack_var + and honor it when expanding. + (expand_used_vars_for_block): Pass through forced_stack_var. + (expand_used_vars): Likewise. + (discover_nonconstant_array_refs_r): Set bits in + forced_stack_vars instead of marking vars TREE_ADDRESSABLE. + (avoid_type_punning_on_regs): Likewise. + (discover_nonconstant_array_refs): Likewise. + (pass_expand::execute): Create and pass down forced_stack_var + bitmap. For parameters and returns temporarily set + TREE_ADDRESSABLE when expand_function_start. + +2021-05-18 Thomas Schwinge <thomas@codesourcery.com> + + * doc/sourcebuild.texi: Document 'dg-note'. + +2021-05-18 Tobias Burnus <tobias@codesourcery.com> + + PR other/100598 + * configure: Regenerate. + * configure.ac (BUILD_CFLAG, BUILD_CXXFLAGS): Add $(CFLAGS-$@). + +2021-05-18 Thomas Schwinge <thomas@codesourcery.com> + + * gimple.h (is_gimple_omp_oacc): Tighten. + * omp-low.c (check_omp_nesting_restrictions): Adjust. + +2021-05-18 Richard Biener <rguenther@suse.de> + + * tree-ssa-operands.c (mark_address_taken): Simplify. + +2021-05-18 Martin Liska <mliska@suse.cz> + + * config/gcn/mkoffload.c (STR): Redefine. + * config/i386/intelmic-mkoffload.c (STR): Likewise. + * config/nvptx/mkoffload.c (STR): Likewise. + +2021-05-18 Martin Liska <mliska@suse.cz> + + * common/config/aarch64/aarch64-common.c (aarch64_parse_extension): + Use startswith function instead of strncmp. + * common/config/bfin/bfin-common.c (bfin_handle_option): Likewise. + * common/config/riscv/riscv-common.c (riscv_subset_list::parse): Likewise. + * config/aarch64/aarch64-sve-builtins-shapes.cc (parse_type): Likewise. + * config/aarch64/aarch64.c (aarch64_process_one_target_attr): Likewise. + * config/alpha/alpha.c (alpha_elf_section_type_flags): Likewise. + * config/arm/aarch-common.c (arm_md_asm_adjust): Likewise. + * config/arm/arm.c (arm_file_start): Likewise. + (arm_valid_target_attribute_rec): Likewise. + (thumb1_md_asm_adjust): Likewise. + * config/arm/driver-arm.c (host_detect_local_cpu): Likewise. + * config/avr/avr.c (STR_PREFIX_P): Likewise. + (avr_set_current_function): Likewise. + (avr_handle_addr_attribute): Likewise. + (avr_asm_output_aligned_decl_common): Likewise. + (avr_asm_named_section): Likewise. + (avr_section_type_flags): Likewise. + (avr_asm_select_section): Likewise. + * config/c6x/c6x.c (c6x_in_small_data_p): Likewise. + (c6x_section_type_flags): Likewise. + * config/darwin-c.c (darwin_cfstring_ref_p): Likewise. + (darwin_objc_declare_unresolved_class_reference): Likewise. + (darwin_objc_declare_class_definition): Likewise. + * config/darwin.c (indirect_data): Likewise. + (darwin_encode_section_info): Likewise. + (darwin_objc2_section): Likewise. + (darwin_objc1_section): Likewise. + (machopic_select_section): Likewise. + (darwin_globalize_label): Likewise. + (darwin_label_is_anonymous_local_objc_name): Likewise. + (darwin_asm_named_section): Likewise. + (darwin_asm_output_dwarf_offset): Likewise. + * config/frv/frv.c (frv_string_begins_with): Likewise. + (frv_in_small_data_p): Likewise. + * config/gcn/mkoffload.c (STR): Likewise. + (main): Likewise. + * config/i386/i386-builtins.c (get_builtin_code_for_version): Likewise. + * config/i386/i386-options.c (ix86_option_override_internal): Likewise. + * config/i386/i386.c (x86_64_elf_section_type_flags): Likewise. + (ix86_md_asm_adjust): Likewise. + * config/i386/intelmic-mkoffload.c (STR): Likewise. + * config/i386/winnt.c (i386_pe_asm_named_section): Likewise. + (i386_pe_file_end): Likewise. + * config/ia64/ia64.c (ia64_in_small_data_p): Likewise. + (ia64_section_type_flags): Likewise. + * config/mips/driver-native.c (host_detect_local_cpu): Likewise. + * config/mips/mips.c (mips_handle_interrupt_attr): Likewise. + (mips16_stub_function_p): Likewise. + (mips_function_rodata_section): Likewise. + * config/msp430/msp430.c (msp430_mcu_name): Likewise. + (msp430_function_section): Likewise. + (msp430_section_type_flags): Likewise. + (msp430_expand_helper): Likewise. + * config/nios2/nios2.c (nios2_small_section_name_p): Likewise. + (nios2_valid_target_attribute_rec): Likewise. + * config/nvptx/mkoffload.c (process): Likewise. + (STR): Likewise. + * config/pa/som.h: Likewise. + * config/pdp11/pdp11.c (pdp11_output_ident): Likewise. + * config/riscv/riscv.c (riscv_elf_select_rtx_section): Likewise. + * config/rs6000/rs6000.c (VTABLE_NAME_P): Likewise. + (rs6000_inner_target_options): Likewise. + * config/s390/driver-native.c (s390_host_detect_local_cpu): Likewise. + * config/sparc/driver-sparc.c (host_detect_local_cpu): Likewise. + * config/vax/vax.c (vax_output_int_move): Likewise. + * config/vms/vms-ld.c (startswith): Likewise. + (process_args): Likewise. + (main): Likewise. + * config/vms/vms.c: Likewise. + +2021-05-18 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/100590 + * regcprop.c (copyprop_hardreg_forward_1): Only DCE dead sets if + they are NONJUMP_INSN_P. + +2021-05-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/100580 + * function.c (push_dummy_function): Set DECL_ARTIFICIAL and + DECL_ASSEMBLER_NAME on the fn_decl. + +2021-05-18 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/94589 + * tree-ssa-phiopt.c (spaceship_replacement): Pattern match + phi result used in (res & ~1) == 0 comparison as res >= 0 as + res == 2 would be UB with -ffinite-math-only. + +2021-05-18 Martin Liska <mliska@suse.cz> + + * Makefile.in: genversion.o should depend on DATESTAMP. + +2021-05-18 Claudiu Zissulescu <claziss@synopsys.com> + + * config/arc/simdext.md (negv2si2): Remove round bracket. + +2021-05-18 Andreas Krebbel <krebbel@linux.ibm.com> + + * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define + _Bool as macro expanding to _Bool. + +2021-05-18 Andreas Krebbel <krebbel@linux.ibm.com> + + PR c++/100281 + * tree.c (build_reference_type_for_mode) + (build_pointer_type_for_mode): Pick pointer mode if MODE argument + is VOIDmode. + (build_reference_type, build_pointer_type): Invoke + build_*_type_for_mode with VOIDmode. + 2021-05-17 Andrew MacLeod <amacleod@redhat.com> PR tree-optimization/100512 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7fa5a77..e2a9538 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210518 +20210524 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5146820..b5ba177 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,82 @@ +2021-05-21 Piotr Trojanek <trojanek@adacore.com> + + * gcc-interface/trans.c (Raise_Error_to_gnu): Add an assertion. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/utils.c (gnat_pushdecl): Fix typo in comment. + * gcc-interface/utils2.c (build_simple_component_ref): Build NULL_EXPR + if the offset of the field has overflowed. + (build_component_ref): Add gigi checking assertion that the reference + has been built and replace the discriminant check by a Program_Error. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Named_Integer>: Do + not pass default value in call to create_var_decl. + <E_Variable>: Likewise. + <E_Record_Subtype>: Both pass true for const_flag and false for + const_decl_allowed_p in call to create_var_decl. + Small tweaks in the generic record type case. + (elaborate_expression): Rename need_debug into need_for_debug and + adjust throughout. + (elaborate_expression_1): Likewise. Pass Needs_Debug_Info instead + of need_for_debug in call to create_var_decl. + (elaborate_expression_2): Likewise. + * gcc-interface/utils.c (maybe_pad_type): Pass false for + const_decl_allowed_p in call to create_var_decl. + +2021-05-21 Ghjuvan Lacambre <lacambre@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity): Replace ? with ??. + (gnat_to_gnu_param): Likewise. + (gnat_to_gnu_subprog_type): Likewise. + (warn_on_field_placement): Likewise. + (intrin_arglists_compatible_p): Likewise. + * gcc-interface/trans.c (Pragma_to_gnu): Likewise. + (gnat_to_gnu): Likewise. + (validate_unchecked_conversion): Likewise. + * gcc-interface/utils.c (maybe_pad_type): Likewise. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Process + the implementation type of a packed type implemented specially. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_subprog_type): Always translate + the Is_Pure flag into the "pure" attribute of GNU C. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (Call_to_gnu): Restrict previous change + to bitfields whose size is not equal to the type size. + (gnat_to_gnu): Likewise. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (Call_to_gnu): Minor tweaks. + (gnat_to_gnu_external): Likewise. + (Raise_Error_to_gnu): Return an empty statement list if there is a + condition and it is always false. + (gnat_to_gnu): Do not check for elaboration code a priori during the + translation but a posteriori instead. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (gnat_to_gnu) <N_Simple_Return_Statement>: + Put a SLOC on the assignment from the return value to the return + object in the copy-in/copy-out case. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Replace + CEIL_DIV_EXPR with EXACT_DIV_EXPR. + * gcc-interface/misc.c (gnat_type_max_size): Likewise. + * gcc-interface/utils.c (maybe_pad_type): Likewise. + (finish_record_type): Likewise. And always compute the unit size. + 2021-05-14 Martin Liska <mliska@suse.cz> * doc/Makefile: Add gnat-style target. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 232b552..bc7046a 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -622,7 +622,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) = create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type, gnu_expr, true, Is_Public (gnat_entity), false, false, false, artificial_p, - debug_info_p, NULL, gnat_entity, true); + debug_info_p, NULL, gnat_entity); } break; @@ -1343,7 +1343,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) || (gnu_size && !allocatable_size_p (convert (sizetype, size_binop - (CEIL_DIV_EXPR, gnu_size, + (EXACT_DIV_EXPR, gnu_size, bitsize_unit_node)), global_bindings_p () || !definition @@ -1392,7 +1392,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST && !valid_constant_size_p (TYPE_SIZE_UNIT (gnu_alloc_type))) - post_error ("?`Storage_Error` will be raised at run time!", + post_error ("??`Storage_Error` will be raised at run time!", gnat_entity); gnu_expr @@ -1527,7 +1527,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) imported_p || !definition, static_flag, volatile_flag, artificial_p, debug_info_p && definition, attr_list, - gnat_entity, true); + gnat_entity); DECL_BY_REF_P (gnu_decl) = used_by_ref; DECL_POINTS_TO_READONLY_P (gnu_decl) = used_by_ref && inner_const_flag; DECL_CAN_NEVER_BE_NULL_P (gnu_decl) = Can_Never_Be_Null (gnat_entity); @@ -2345,11 +2345,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) set_nonaliased_component_on_array_type (tem); } - /* If an alignment is specified, use it if valid. But ignore it - for the original type of packed array types. If the alignment - was requested with an explicit alignment clause, state so. */ - if (No (Packed_Array_Impl_Type (gnat_entity)) - && Known_Alignment (gnat_entity)) + /* If this is a packed type implemented specially, then process the + implementation type so it is elaborated in the proper scope. */ + if (Present (Packed_Array_Impl_Type (gnat_entity))) + gnat_to_gnu_entity (Packed_Array_Impl_Type (gnat_entity), NULL_TREE, + false); + + /* Otherwise, if an alignment is specified, use it if valid and, if + the alignment was requested with an explicit clause, state so. */ + else if (Known_Alignment (gnat_entity)) { SET_TYPE_ALIGN (tem, validate_alignment (Alignment (gnat_entity), @@ -3522,9 +3526,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) = create_var_decl (create_concat_name (gnat_entity, "XVZ"), NULL_TREE, sizetype, gnu_size_unit, - false, false, false, false, false, - true, debug_info_p, - NULL, gnat_entity); + true, false, false, false, false, + true, true, NULL, gnat_entity, false); } /* Or else, if the subtype is artificial and encodings are not @@ -4324,7 +4327,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) ratio is greater or equal to the byte/bit ratio. */ if (tree_fits_uhwi_p (size) && align >= tree_to_uhwi (size) * BITS_PER_UNIT) - post_error_ne ("?suspiciously large alignment specified for&", + post_error_ne ("??suspiciously large alignment specified for&", Expression (Alignment_Clause (gnat_entity)), gnat_entity); } @@ -4451,21 +4454,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if (Unknown_RM_Size (gnat_entity) && TYPE_SIZE (gnu_type)) Set_RM_Size (gnat_entity, annotate_value (rm_size (gnu_type))); - /* If we are at global level, GCC will have applied variable_size to - the type, but that won't have done anything. So, if it's not - a constant or self-referential, call elaborate_expression_1 to - make a variable for the size rather than calculating it each time. - Handle both the RM size and the actual size. */ + /* If we are at global level, GCC applied variable_size to the size but + this has done nothing. So, if it's not constant or self-referential, + call elaborate_expression_1 to make a variable for it rather than + calculating it each time. */ if (TYPE_SIZE (gnu_type) && !TREE_CONSTANT (TYPE_SIZE (gnu_type)) && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)) && global_bindings_p ()) { - tree size = TYPE_SIZE (gnu_type); + tree orig_size = TYPE_SIZE (gnu_type); TYPE_SIZE (gnu_type) - = elaborate_expression_1 (size, gnat_entity, "SIZE", definition, - false); + = elaborate_expression_1 (TYPE_SIZE (gnu_type), gnat_entity, + "SIZE", definition, false); /* ??? For now, store the size as a multiple of the alignment in bytes so that we can see the alignment from the tree. */ @@ -4478,7 +4480,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) may not be marked by the call to create_type_decl below. */ MARK_VISITED (TYPE_SIZE_UNIT (gnu_type)); - if (TREE_CODE (gnu_type) == RECORD_TYPE) + /* For a record type, deal with the variant part, if any, and handle + the Ada size as well. */ + if (RECORD_OR_UNION_TYPE_P (gnu_type)) { tree variant_part = get_variant_part (gnu_type); tree ada_size = TYPE_ADA_SIZE (gnu_type); @@ -4531,7 +4535,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) DECL_SIZE_UNIT (variant_part) = TYPE_SIZE_UNIT (union_type); } - if (operand_equal_p (ada_size, size, 0)) + if (operand_equal_p (ada_size, orig_size, 0)) ada_size = TYPE_SIZE (gnu_type); else ada_size @@ -5439,7 +5443,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, tree gnu_param_type, bool first, input_location = saved_location; if (mech == By_Copy && (by_ref || by_component_ptr)) - post_error ("?cannot pass & by copy", gnat_param); + post_error ("??cannot pass & by copy", gnat_param); /* If this is an Out parameter that isn't passed by reference and whose type doesn't require the initialization of formals, we don't make a @@ -5737,16 +5741,16 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, tree gnu_cico_return_type = NULL_TREE; tree gnu_cico_field_list = NULL_TREE; bool gnu_cico_only_integral_type = true; - /* The semantics of "pure" in Ada essentially matches that of "const" - or "pure" in GCC. In particular, both properties are orthogonal - to the "nothrow" property if the EH circuitry is explicit in the - internal representation of the middle-end. If we are to completely - hide the EH circuitry from it, we need to declare that calls to pure - Ada subprograms that can throw have side effects since they can - trigger an "abnormal" transfer of control flow; therefore, they can - be neither "const" nor "pure" in the GCC sense. */ - bool const_flag = (Back_End_Exceptions () && Is_Pure (gnat_subprog)); - bool pure_flag = false; + /* Although the semantics of "pure" units in Ada essentially match those of + "const" in GNU C, the semantics of the Is_Pure flag in GNAT do not say + anything about access to global memory, that's why it needs to be mapped + to "pure" instead of "const" in GNU C. The property is orthogonal to the + "nothrow" property only if the EH circuitry is explicit in the internal + representation of the middle-end: if we are to completely hide the EH + circuitry from it, we need to declare that calls to pure Ada subprograms + that can throw have side effects, since they can trigger an "abnormal" + transfer of control; therefore they cannot be "pure" in the GCC sense. */ + bool pure_flag = Is_Pure (gnat_subprog) && Back_End_Exceptions (); bool return_by_direct_ref_p = false; bool return_by_invisi_ref_p = false; bool return_unconstrained_p = false; @@ -5899,14 +5903,14 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, } /* A procedure (something that doesn't return anything) shouldn't be - considered const since there would be no reason for calling such a + considered pure since there would be no reason for calling such a subprogram. Note that procedures with Out (or In Out) parameters have already been converted into a function with a return type. Similarly, if the function returns an unconstrained type, then the function will allocate the return value on the secondary stack and thus calls to it cannot be CSE'ed, lest the stack be reclaimed. */ if (VOID_TYPE_P (gnu_return_type) || return_unconstrained_p) - const_flag = false; + pure_flag = false; /* Loop over the parameters and get their associated GCC tree. While doing this, build a copy-in copy-out structure if we need one. */ @@ -6034,19 +6038,16 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, save_gnu_tree (gnat_param, gnu_param, false); /* A pure function in the Ada sense which takes an access parameter - may modify memory through it and thus need be considered neither - const nor pure in the GCC sense, unless it's access-to-function. - Likewise it if takes a by-ref In Out or Out parameter. But if it - takes a by-ref In parameter, then it may only read memory through - it and can be considered pure in the GCC sense. */ - if ((const_flag || pure_flag) + may modify memory through it and thus cannot be considered pure + in the GCC sense, unless it's access-to-function. Likewise it if + takes a by-ref In Out or Out parameter. But if it takes a by-ref + In parameter, then it may only read memory through it and can be + considered pure in the GCC sense. */ + if (pure_flag && ((POINTER_TYPE_P (gnu_param_type) && TREE_CODE (TREE_TYPE (gnu_param_type)) != FUNCTION_TYPE) || TYPE_IS_FAT_POINTER_P (gnu_param_type))) - { - const_flag = false; - pure_flag = DECL_POINTS_TO_READONLY_P (gnu_param); - } + pure_flag = DECL_POINTS_TO_READONLY_P (gnu_param); } /* If the parameter uses the copy-in copy-out mechanism, allocate a field @@ -6246,9 +6247,6 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, } } - if (const_flag) - gnu_type = change_qualified_type (gnu_type, TYPE_QUAL_CONST); - if (pure_flag) gnu_type = change_qualified_type (gnu_type, TYPE_QUAL_RESTRICT); @@ -6273,7 +6271,7 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, if (!intrin_profiles_compatible_p (&inb)) post_error - ("?profile of& doesn''t match the builtin it binds!", + ("??profile of& doesn''t match the builtin it binds!", gnat_subprog); return gnu_builtin_decl; @@ -6286,7 +6284,7 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, on demand without risking false positives with common default sets of options. */ if (warn_shadow) - post_error ("?gcc intrinsic not found for&!", gnat_subprog); + post_error ("??gcc intrinsic not found for&!", gnat_subprog); } } @@ -6726,12 +6724,12 @@ prepend_attributes (struct attrib **attr_list, Entity_Id gnat_entity) if a variable needs to be created and DEFINITION is true if this is done for a definition of GNAT_ENTITY. If NEED_VALUE is true, we need a result; otherwise, we are just elaborating the expression for side-effects. If - NEED_DEBUG is true, we need a variable for debugging purposes even if it - isn't needed for code generation. */ + NEED_FOR_DEBUG is true, we need a variable for debugging purposes even + if it isn't needed for code generation. */ static tree elaborate_expression (Node_Id gnat_expr, Entity_Id gnat_entity, const char *s, - bool definition, bool need_value, bool need_debug) + bool definition, bool need_value, bool need_for_debug) { tree gnu_expr; @@ -6749,12 +6747,12 @@ elaborate_expression (Node_Id gnat_expr, Entity_Id gnat_entity, const char *s, return NULL_TREE; /* If it's a static expression, we don't need a variable for debugging. */ - if (need_debug && Compile_Time_Known_Value (gnat_expr)) - need_debug = false; + if (need_for_debug && Compile_Time_Known_Value (gnat_expr)) + need_for_debug = false; /* Otherwise, convert this tree to its GCC equivalent and elaborate it. */ gnu_expr = elaborate_expression_1 (gnat_to_gnu (gnat_expr), gnat_entity, s, - definition, need_debug); + definition, need_for_debug); /* Save the expression in case we try to elaborate this entity again. Since it's not a DECL, don't check it. Don't save if it's a discriminant. */ @@ -6768,7 +6766,7 @@ elaborate_expression (Node_Id gnat_expr, Entity_Id gnat_entity, const char *s, static tree elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, const char *s, - bool definition, bool need_debug) + bool definition, bool need_for_debug) { const bool expr_public_p = Is_Public (gnat_entity); const bool expr_global_p = expr_public_p || global_bindings_p (); @@ -6816,38 +6814,42 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, const char *s, /* If the GNAT encodings are not used, we don't need a variable for debug info purposes if the expression is a constant or another variable, but - we need to be careful because we do not generate debug info for external + we must be careful because we do not generate debug info for external variables so DECL_IGNORED_P is not stable across units. */ - if (need_debug + if (need_for_debug && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL && (TREE_CONSTANT (gnu_expr) || (!expr_public_p && DECL_P (gnu_expr) && !DECL_IGNORED_P (gnu_expr)))) - need_debug = false; + need_for_debug = false; /* Now create it, possibly only for debugging purposes. */ - if (use_variable || need_debug) + if (use_variable || need_for_debug) { /* The following variable creation can happen when processing the body - of subprograms that are defined out of the extended main unit and + of subprograms that are defined outside of the extended main unit and inlined. In this case, we are not at the global scope, and thus the new variable must not be tagged "external", as we used to do here as - soon as DEFINITION was false. */ + soon as DEFINITION was false. And note that we test Needs_Debug_Info + here instead of NEED_FOR_DEBUG because, once the variable is created, + whether or not debug information is generated for it is orthogonal to + the reason why it was created in the first place. */ tree gnu_decl = create_var_decl (create_concat_name (gnat_entity, s), NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, true, expr_public_p, !definition && expr_global_p, - expr_global_p, false, true, need_debug, - NULL, gnat_entity); + expr_global_p, false, true, + Needs_Debug_Info (gnat_entity), + NULL, gnat_entity, false); - /* Using this variable at debug time (if need_debug is true) requires a - proper location. The back-end will compute a location for this + /* Using this variable for debug (if need_for_debug is true) requires + a proper location. The back-end will compute a location for this variable only if the variable is used by the generated code. Returning the variable ensures the caller will use it in generated code. Note that there is no need for a location if the debug info contains an integer constant. */ - if (use_variable || (need_debug && !TREE_CONSTANT (gnu_expr))) + if (use_variable || (need_for_debug && !TREE_CONSTANT (gnu_expr))) return gnu_decl; } @@ -6858,7 +6860,7 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, const char *s, static tree elaborate_expression_2 (tree gnu_expr, Entity_Id gnat_entity, const char *s, - bool definition, bool need_debug, unsigned int align) + bool definition, bool need_for_debug, unsigned int align) { tree unit_align = size_int (align / BITS_PER_UNIT); return @@ -6867,7 +6869,7 @@ elaborate_expression_2 (tree gnu_expr, Entity_Id gnat_entity, const char *s, gnu_expr, unit_align), gnat_entity, s, definition, - need_debug), + need_for_debug), unit_align); } @@ -7599,20 +7601,20 @@ warn_on_field_placement (tree gnu_field, Node_Id gnat_component_list, const char *msg1 = in_variant - ? "?variant layout may cause performance issues" - : "?record layout may cause performance issues"; + ? "??variant layout may cause performance issues" + : "??record layout may cause performance issues"; const char *msg2 = Ekind (gnat_field) == E_Discriminant - ? "?discriminant & whose length is not multiple of a byte" + ? "??discriminant & whose length is not multiple of a byte" : field_has_self_size (gnu_field) - ? "?component & whose length depends on a discriminant" + ? "??component & whose length depends on a discriminant" : field_has_variable_size (gnu_field) - ? "?component & whose length is not fixed" - : "?component & whose length is not multiple of a byte"; + ? "??component & whose length is not fixed" + : "??component & whose length is not multiple of a byte"; const char *msg3 = do_reorder - ? "?comes too early and was moved down" - : "?comes too early and ought to be moved down"; + ? "??comes too early and was moved down" + : "??comes too early and ought to be moved down"; post_error (msg1, gnat_field); post_error_ne (msg2, gnat_field, gnat_field); @@ -9483,14 +9485,14 @@ intrin_arglists_compatible_p (intrin_binding_t * inb) if (ada_type == void_type_node && btin_type != void_type_node) { - post_error ("?Ada arguments list too short!", inb->gnat_entity); + post_error ("??Ada arguments list too short!", inb->gnat_entity); return false; } if (btin_type == void_type_node && ada_type != void_type_node) { - post_error_ne_num ("?Ada arguments list too long ('> ^)!", + post_error_ne_num ("??Ada arguments list too long ('> ^)!", inb->gnat_entity, inb->gnat_entity, argpos); return false; } @@ -9499,7 +9501,7 @@ intrin_arglists_compatible_p (intrin_binding_t * inb) argpos ++; if (intrin_types_incompatible_p (ada_type, btin_type)) { - post_error_ne_num ("?intrinsic binding type mismatch on argument ^!", + post_error_ne_num ("??intrinsic binding type mismatch on argument ^!", inb->gnat_entity, inb->gnat_entity, argpos); return false; } @@ -9530,7 +9532,7 @@ intrin_return_compatible_p (intrin_binding_t * inb) handles void/void as well. */ if (intrin_types_incompatible_p (btin_return_type, ada_return_type)) { - post_error ("?intrinsic binding type mismatch on return value!", + post_error ("??intrinsic binding type mismatch on return value!", inb->gnat_entity); return false; } diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index f302cf0..72a2624 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -752,7 +752,7 @@ gnat_type_max_size (const_tree gnu_type) type's alignment and return the result in units. */ if (tree_fits_uhwi_p (max_ada_size)) max_size_unit - = size_binop (CEIL_DIV_EXPR, + = size_binop (EXACT_DIV_EXPR, round_up (max_ada_size, TYPE_ALIGN (gnu_type)), bitsize_unit_node); } diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 9aeaf03..ee014a3 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1453,17 +1453,17 @@ Pragma_to_gnu (Node_Id gnat_node) { case Name_Off: if (optimize) - post_error ("must specify -O0?", gnat_node); + post_error ("must specify -O0??", gnat_node); break; case Name_Space: if (!optimize_size) - post_error ("must specify -Os?", gnat_node); + post_error ("must specify -Os??", gnat_node); break; case Name_Time: if (!optimize) - post_error ("insufficient -O value?", gnat_node); + post_error ("insufficient -O value??", gnat_node); break; default: @@ -1473,7 +1473,7 @@ Pragma_to_gnu (Node_Id gnat_node) case Pragma_Reviewable: if (write_symbols == NO_DEBUG) - post_error ("must specify -g?", gnat_node); + post_error ("must specify -g??", gnat_node); break; case Pragma_Warning_As_Error: @@ -1574,17 +1574,17 @@ Pragma_to_gnu (Node_Id gnat_node) option_index = find_opt (option_string + 1, lang_mask); if (option_index == OPT_SPECIAL_unknown) { - post_error ("?unknown -W switch", gnat_node); + post_error ("unknown -W switch??", gnat_node); break; } else if (!(cl_options[option_index].flags & CL_WARNING)) { - post_error ("?-W switch does not control warning", gnat_node); + post_error ("-W switch does not control warning??", gnat_node); break; } else if (!(cl_options[option_index].flags & lang_mask)) { - post_error ("?-W switch not valid for Ada", gnat_node); + post_error ("-W switch not valid for Ada??", gnat_node); break; } if (cl_options[option_index].flags & CL_JOINED) @@ -4471,8 +4471,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, tree gnu_after_list = NULL_TREE; tree gnu_retval = NULL_TREE; tree gnu_call, gnu_result; - bool went_into_elab_proc = false; - bool pushed_binding_level = false; + bool went_into_elab_proc; + bool pushed_binding_level; bool variadic; bool by_descriptor; Entity_Id gnat_formal; @@ -4555,6 +4555,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, current_function_decl = get_elaboration_procedure (); went_into_elab_proc = true; } + else + went_into_elab_proc = false; /* First, create the temporary for the return value when: @@ -4609,6 +4611,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, || (gnu_target && TREE_CODE (gnu_target) == COMPONENT_REF && DECL_BIT_FIELD (TREE_OPERAND (gnu_target, 1)) + && DECL_SIZE (TREE_OPERAND (gnu_target, 1)) + != TYPE_SIZE (TREE_TYPE (gnu_target)) && type_is_padding_self_referential (gnu_result_type)))) { gnu_retval = create_temporary ("R", gnu_result_type); @@ -4624,6 +4628,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, gnat_pushlevel (); pushed_binding_level = true; } + else + pushed_binding_level = false; /* Create the list of the actual parameters as GCC expects it, namely a chain of TREE_LIST nodes in which the TREE_VALUE field of each node @@ -6146,12 +6152,19 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) { if (!gnu_cond) gnu_cond = gnat_to_gnu (gnat_cond); + if (integer_zerop (gnu_cond)) + return alloc_stmt_list (); gnu_result = build3 (COND_EXPR, void_type_node, gnu_cond, gnu_result, alloc_stmt_list ()); } } else - gnu_result = build1 (NULL_EXPR, *gnu_result_type_p, gnu_result); + { + /* The condition field must not be present when the node is used as an + expression form. */ + gigi_checking_assert (No (gnat_cond)); + gnu_result = build1 (NULL_EXPR, *gnu_result_type_p, gnu_result); + } return gnu_result; } @@ -6271,12 +6284,12 @@ tree gnat_to_gnu (Node_Id gnat_node) { const Node_Kind kind = Nkind (gnat_node); - bool went_into_elab_proc = false; tree gnu_result = error_mark_node; /* Default to no value. */ tree gnu_result_type = void_type_node; tree gnu_expr, gnu_lhs, gnu_rhs; Node_Id gnat_temp; atomic_acces_t aa_type; + bool went_into_elab_proc; bool aa_sync; /* Save node number for error message and set location information. */ @@ -6308,32 +6321,18 @@ gnat_to_gnu (Node_Id gnat_node) build_call_raise (CE_Range_Check_Failed, gnat_node, N_Raise_Constraint_Error)); - if ((statement_node_p (gnat_node) && kind != N_Null_Statement) - || kind == N_Handled_Sequence_Of_Statements - || kind == N_Implicit_Label_Declaration) + /* If this is a statement and we are at top level, it must be part of the + elaboration procedure, so mark us as being in that procedure. */ + if ((statement_node_p (gnat_node) + || kind == N_Handled_Sequence_Of_Statements + || kind == N_Implicit_Label_Declaration) + && !current_function_decl) { - tree current_elab_proc = get_elaboration_procedure (); - - /* If this is a statement and we are at top level, it must be part of - the elaboration procedure, so mark us as being in that procedure. */ - if (!current_function_decl) - { - current_function_decl = current_elab_proc; - went_into_elab_proc = true; - } - - /* If we are in the elaboration procedure, check if we are violating a - No_Elaboration_Code restriction by having a statement there. Don't - check for a possible No_Elaboration_Code restriction violation on - N_Handled_Sequence_Of_Statements, as we want to signal an error on - every nested real statement instead. This also avoids triggering - spurious errors on dummy (empty) sequences created by the front-end - for package bodies in some cases. */ - if (current_function_decl == current_elab_proc - && kind != N_Handled_Sequence_Of_Statements - && kind != N_Implicit_Label_Declaration) - Check_Elaboration_Code_Allowed (gnat_node); + current_function_decl = get_elaboration_procedure (); + went_into_elab_proc = true; } + else + went_into_elab_proc = false; switch (kind) { @@ -6976,7 +6975,7 @@ gnat_to_gnu (Node_Id gnat_node) if (align != 0 && align < oalign && !TYPE_ALIGN_OK (gnu_obj_type)) post_error_ne_tree_2 - ("?source alignment (^) '< alignment of & (^)", + ("??source alignment (^) '< alignment of & (^)", gnat_node, Designated_Type (Etype (gnat_node)), size_int (align / BITS_PER_UNIT), oalign / BITS_PER_UNIT); } @@ -7624,8 +7623,10 @@ gnat_to_gnu (Node_Id gnat_node) if (gnu_return_label_stack->last ()) { if (gnu_ret_val) - add_stmt (build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_ret_obj, - gnu_ret_val)); + add_stmt_with_node (build_binary_op (MODIFY_EXPR, + NULL_TREE, gnu_ret_obj, + gnu_ret_val), + gnat_node); gnu_result = build1 (GOTO_EXPR, void_type_node, gnu_return_label_stack->last ()); @@ -8233,6 +8234,14 @@ gnat_to_gnu (Node_Id gnat_node) gcc_unreachable (); } + /* If we are in the elaboration procedure, check if we are violating the + No_Elaboration_Code restriction by having a non-empty statement. */ + if (statement_node_p (gnat_node) + && !(TREE_CODE (gnu_result) == STATEMENT_LIST + && empty_stmt_list_p (gnu_result)) + && current_function_decl == get_elaboration_procedure ()) + Check_Elaboration_Code_Allowed (gnat_node); + /* If we pushed the processing of the elaboration routine, pop it back. */ if (went_into_elab_proc) current_function_decl = NULL_TREE; @@ -8281,7 +8290,7 @@ gnat_to_gnu (Node_Id gnat_node) /* If the result is a constant that overflowed, raise Constraint_Error. */ if (TREE_CODE (gnu_result) == INTEGER_CST && TREE_OVERFLOW (gnu_result)) { - post_error ("?`Constraint_Error` will be raised at run time", gnat_node); + post_error ("??`Constraint_Error` will be raised at run time", gnat_node); gnu_result = build1 (NULL_EXPR, gnu_result_type, build_call_raise (CE_Overflow_Check_Failed, gnat_node, @@ -8368,7 +8377,9 @@ gnat_to_gnu (Node_Id gnat_node) much data. But do not remove it if it is already too small. */ if (type_is_padding_self_referential (TREE_TYPE (gnu_result)) && !(TREE_CODE (gnu_result) == COMPONENT_REF - && DECL_BIT_FIELD (TREE_OPERAND (gnu_result, 1)))) + && DECL_BIT_FIELD (TREE_OPERAND (gnu_result, 1)) + && DECL_SIZE (TREE_OPERAND (gnu_result, 1)) + != TYPE_SIZE (TREE_TYPE (gnu_result)))) gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))), gnu_result); } @@ -8421,7 +8432,7 @@ tree gnat_to_gnu_external (Node_Id gnat_node) { const int save_force_global = force_global; - bool went_into_elab_proc = false; + bool went_into_elab_proc; /* Force the local context and create a fake scope that we zap at the end so declarations will not be stuck either in the @@ -8431,6 +8442,8 @@ gnat_to_gnu_external (Node_Id gnat_node) current_function_decl = get_elaboration_procedure (); went_into_elab_proc = true; } + else + went_into_elab_proc = false; force_global = 0; gnat_pushlevel (); @@ -10314,7 +10327,7 @@ validate_unchecked_conversion (Node_Id gnat_node) || !alias_sets_conflict_p (get_alias_set (gnu_source_desig_type), target_alias_set))) { - post_error_ne ("?possible aliasing problem for type&", + post_error_ne ("??possible aliasing problem for type&", gnat_node, Target_Type (gnat_node)); post_error ("\\?use -fno-strict-aliasing switch for references", gnat_node); @@ -10340,7 +10353,7 @@ validate_unchecked_conversion (Node_Id gnat_node) || !alias_sets_conflict_p (get_alias_set (gnu_source_desig_type), target_alias_set))) { - post_error_ne ("?possible aliasing problem for type&", + post_error_ne ("??possible aliasing problem for type&", gnat_node, Target_Type (gnat_node)); post_error ("\\?use -fno-strict-aliasing switch for references", gnat_node); diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 80a4160..1786fbf 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -784,7 +784,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) tree context = NULL_TREE; struct deferred_decl_context_node *deferred_decl_context = NULL; - /* If explicitely asked to make DECL global or if it's an imported nested + /* If explicitly asked to make DECL global or if it's an imported nested object, short-circuit the regular Scope-based context computation. */ if (!((TREE_PUBLIC (decl) && DECL_EXTERNAL (decl)) || force_global == 1)) { @@ -1547,7 +1547,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, TYPE_SIZE (record) = size ? size : orig_size; TYPE_SIZE_UNIT (record) = convert (sizetype, - size_binop (CEIL_DIV_EXPR, TYPE_SIZE (record), + size_binop (EXACT_DIV_EXPR, TYPE_SIZE (record), bitsize_unit_node)); /* If we are changing the alignment and the input type is a record with @@ -1637,7 +1637,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, = create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype, size_unit, true, global_bindings_p (), !definition && global_bindings_p (), false, - false, true, true, NULL, gnat_entity); + false, true, true, NULL, gnat_entity, false); TYPE_SIZE_UNIT (record) = size_unit; } @@ -1721,11 +1721,11 @@ built: if (Comes_From_Source (gnat_entity)) { if (is_component_type) - post_error_ne_tree ("component of& padded{ by ^ bits}?", + post_error_ne_tree ("component of& padded{ by ^ bits}??", gnat_entity, gnat_entity, size_diffop (size, orig_size)); else if (Present (gnat_error_node)) - post_error_ne_tree ("{^ }bits of & unused?", + post_error_ne_tree ("{^ }bits of & unused??", gnat_error_node, gnat_entity, size_diffop (size, orig_size)); } @@ -1970,7 +1970,6 @@ finish_record_type (tree record_type, tree field_list, int rep_level, { const enum tree_code orig_code = TREE_CODE (record_type); const bool had_size = TYPE_SIZE (record_type) != NULL_TREE; - const bool had_size_unit = TYPE_SIZE_UNIT (record_type) != NULL_TREE; const bool had_align = TYPE_ALIGN (record_type) > 0; /* For all-repped records with a size specified, lay the QUAL_UNION_TYPE out just like a UNION_TYPE, since the size will be fixed. */ @@ -1997,9 +1996,6 @@ finish_record_type (tree record_type, tree field_list, int rep_level, if (!had_size) TYPE_SIZE (record_type) = bitsize_zero_node; - - if (!had_size_unit) - TYPE_SIZE_UNIT (record_type) = size_zero_node; } else { @@ -2155,19 +2151,22 @@ finish_record_type (tree record_type, tree field_list, int rep_level, /* We need to set the regular sizes if REP_LEVEL is one. */ if (rep_level == 1) { + /* We round TYPE_SIZE and TYPE_SIZE_UNIT up to TYPE_ALIGN separately + to avoid having very large masking constants in TYPE_SIZE_UNIT. */ + const unsigned int align = TYPE_ALIGN (record_type); + /* If this is a padding record, we never want to make the size smaller than what was specified in it, if any. */ - if (TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type)) + if (TYPE_IS_PADDING_P (record_type) && had_size) size = TYPE_SIZE (record_type); - - tree size_unit = had_size_unit - ? TYPE_SIZE_UNIT (record_type) - : convert (sizetype, - size_binop (CEIL_DIV_EXPR, size, - bitsize_unit_node)); - const unsigned int align = TYPE_ALIGN (record_type); + else + size = round_up (size, BITS_PER_UNIT); TYPE_SIZE (record_type) = variable_size (round_up (size, align)); + + tree size_unit + = convert (sizetype, + size_binop (EXACT_DIV_EXPR, size, bitsize_unit_node)); TYPE_SIZE_UNIT (record_type) = variable_size (round_up (size_unit, align / BITS_PER_UNIT)); } diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index acb308c..e8ed4b2 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -2071,7 +2071,9 @@ build_simple_component_ref (tree record, tree field, bool no_fold) need to warn since this will be done on trying to declare the object. */ if (TREE_CODE (DECL_FIELD_OFFSET (field)) == INTEGER_CST && TREE_OVERFLOW (DECL_FIELD_OFFSET (field))) - return NULL_TREE; + return build1 (NULL_EXPR, TREE_TYPE (field), + build_call_raise (SE_Object_Too_Large, Empty, + N_Raise_Storage_Error)); ref = build3 (COMPONENT_REF, TREE_TYPE (field), record, field, NULL_TREE); @@ -2105,7 +2107,7 @@ build_simple_component_ref (tree record, tree field, bool no_fold) return fold (ref); } -/* Likewise, but return NULL_EXPR and generate a Constraint_Error if the +/* Likewise, but return NULL_EXPR and generate a Program_Error if the field is not found in the record. */ tree @@ -2115,10 +2117,13 @@ build_component_ref (tree record, tree field, bool no_fold) if (ref) return ref; - /* Assume this is an invalid user field so raise Constraint_Error. */ + /* The missing field should have been detected in the front-end. */ + gigi_checking_assert (false); + + /* Assume this is an invalid user field so raise Program_Error. */ return build1 (NULL_EXPR, TREE_TYPE (field), - build_call_raise (CE_Discriminant_Check_Failed, Empty, - N_Raise_Constraint_Error)); + build_call_raise (PE_Explicit_Raise, Empty, + N_Raise_Program_Error)); } /* Helper for build_call_alloc_dealloc, with arguments to be interpreted diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index e6c0631..7396971 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,11 @@ +2021-05-18 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/100615 + * sm-malloc.cc: Include "analyzer/function-set.h". + (malloc_state_machine::on_stmt): Call unaffected_by_call_p and + bail on the functions it recognizes. + (malloc_state_machine::unaffected_by_call_p): New. + 2021-05-10 Martin Liska <mliska@suse.cz> * sm-file.cc (is_file_using_fn_p): Use startswith diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc index f02b73a..a1582ca 100644 --- a/gcc/analyzer/sm-malloc.cc +++ b/gcc/analyzer/sm-malloc.cc @@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see #include "analyzer/region-model.h" #include "stringpool.h" #include "attribs.h" +#include "analyzer/function-set.h" #if ENABLE_ANALYZER @@ -384,6 +385,8 @@ public: bool reset_when_passed_to_unknown_fn_p (state_t s, bool is_mutable) const FINAL OVERRIDE; + static bool unaffected_by_call_p (tree fndecl); + standard_deallocator_set m_free; standard_deallocator_set m_scalar_delete; standard_deallocator_set m_vector_delete; @@ -1569,6 +1572,9 @@ malloc_state_machine::on_stmt (sm_context *sm_ctxt, return true; } + if (unaffected_by_call_p (callee_fndecl)) + return true; + /* Cast away const-ness for cache-like operations. */ malloc_state_machine *mutable_this = const_cast <malloc_state_machine *> (this); @@ -1925,6 +1931,28 @@ malloc_state_machine::reset_when_passed_to_unknown_fn_p (state_t s, return is_mutable; } +/* Return true if calls to FNDECL are known to not affect this sm-state. */ + +bool +malloc_state_machine::unaffected_by_call_p (tree fndecl) +{ + /* A set of functions that are known to not affect allocation + status, even if we haven't fully modelled the rest of their + behavior yet. */ + static const char * const funcnames[] = { + /* This array must be kept sorted. */ + "strsep", + }; + const size_t count + = sizeof(funcnames) / sizeof (funcnames[0]); + function_set fs (funcnames, count); + + if (fs.contains_decl_p (fndecl)) + return true; + + return false; +} + /* Shared logic for handling GIMPLE_ASSIGNs and GIMPLE_PHIs that assign zero to LHS. */ diff --git a/gcc/builtins.c b/gcc/builtins.c index e1b2848..b0c880d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -924,6 +924,10 @@ bool get_object_alignment_1 (tree exp, unsigned int *alignp, unsigned HOST_WIDE_INT *bitposp) { + /* Strip a WITH_SIZE_EXPR, get_inner_reference doesn't know how to deal + with it. */ + if (TREE_CODE (exp) == WITH_SIZE_EXPR) + exp = TREE_OPERAND (exp, 0); return get_object_alignment_2 (exp, alignp, bitposp, false); } @@ -4904,6 +4908,8 @@ check_read_access (tree exp, tree src, tree bound /* = NULL_TREE */, if (!warn_stringop_overread) return true; + if (bound && !useless_type_conversion_p (size_type_node, TREE_TYPE (bound))) + bound = fold_convert (size_type_node, bound); access_data data (exp, access_read_only, NULL_TREE, false, bound, true); compute_objsize (src, ost, &data.src); return check_access (exp, /*dstwrite=*/ NULL_TREE, /*maxread=*/ bound, diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index cc1019c..43d4c5e 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,39 @@ +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * c-omp.c (c_omp_split_clauses): Set OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT + on firstprivate clause copy going to target construct, and for + target simd set also OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET bit. + +2021-05-20 Jonathan Wakely <jwakely@redhat.com> + + * c.opt (Wc++11-extensions, Wc++14-extensions) + (Wc++17-extensions, Wc++20-extensions, Wc++23-extensions): New + options. + +2021-05-20 Indu Bhagat <indu.bhagat@oracle.com> + + * c-lex.c (init_c_lex): Use dwarf_debuginfo_p. + +2021-05-20 Indu Bhagat <indu.bhagat@oracle.com> + + * c-opts.c (c_common_post_options): Adjust access to debug_type_names. + * c-pch.c (struct c_pch_validity): Use type uint32_t. + (pch_init): Renamed member. + (c_common_valid_pch): Adjust access to debug_type_names. + +2021-05-19 Martin Sebor <msebor@redhat.com> + + PR c/100619 + * c-attribs.c (build_attr_access_from_parms): Handle arbitrarily many + bounds. + +2021-05-18 Richard Biener <rguenther@suse.de> + + PR c/100547 + * c-attribs.c (type_valid_for_vector_size): Reject too large nunits. + Reword existing nunit diagnostic. + 2021-05-17 Joern Rennecke <joern.rennecke@embecosm.com> * c-common.c (braced_list_to_string): Return CTOR unchanged diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index ecb32c7..ccf9e4c 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -5043,16 +5043,25 @@ build_attr_access_from_parms (tree parms, bool skip_voidptr) /* Create the attribute access string from the arg spec string, optionally followed by position of the VLA bound argument if it is one. */ - char specbuf[80]; - int len = snprintf (specbuf, sizeof specbuf, "%c%u%s", - attr_access::mode_chars[access_deferred], - argpos, s); - gcc_assert ((size_t) len < sizeof specbuf); - - if (!spec.length ()) - spec += '+'; + { + size_t specend = spec.length (); + if (!specend) + { + spec = '+'; + specend = 1; + } - spec += specbuf; + /* Format the access string in place. */ + int len = snprintf (NULL, 0, "%c%u%s", + attr_access::mode_chars[access_deferred], + argpos, s); + spec.resize (specend + len + 1); + sprintf (&spec[specend], "%c%u%s", + attr_access::mode_chars[access_deferred], + argpos, s); + /* Trim the trailing NUL. */ + spec.resize (specend + len); + } /* The (optional) list of expressions denoting the VLA bounds N in ARGTYPE <arg>[Ni]...[Nj]...[Nk]. */ @@ -5077,8 +5086,13 @@ build_attr_access_from_parms (tree parms, bool skip_voidptr) { /* BOUND previously seen in the parameter list. */ TREE_PURPOSE (vb) = size_int (*psizpos); - sprintf (specbuf, "$%u", *psizpos); - spec += specbuf; + /* Format the position string in place. */ + int len = snprintf (NULL, 0, "$%u", *psizpos); + size_t specend = spec.length (); + spec.resize (specend + len + 1); + sprintf (&spec[specend], "$%u", *psizpos); + /* Trim the trailing NUL. */ + spec.resize (specend + len); } else { diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 1c66ecd..c44e7a1 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "stor-layout.h" #include "c-pragma.h" #include "debug.h" +#include "flags.h" #include "file-prefix-map.h" /* remap_macro_filename() */ #include "langhooks.h" #include "attribs.h" @@ -87,8 +88,7 @@ init_c_lex (void) /* Set the debug callbacks if we can use them. */ if ((debug_info_level == DINFO_LEVEL_VERBOSE - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG)) + && dwarf_debuginfo_p ()) || flag_dump_go_spec != NULL) { cb->define = cb_define; diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index fb1a0d6..0945a1e 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -1733,10 +1733,21 @@ c_omp_split_clauses (location_t loc, enum tree_code code, { /* This must be #pragma omp target simd. */ s = C_OMP_CLAUSE_SPLIT_TARGET; + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (clauses) = 1; + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (clauses) = 1; break; } c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses), OMP_CLAUSE_FIRSTPRIVATE); + /* firstprivate should not be applied to target if it is + also lastprivate or on the combined/composite construct, + or if it is mentioned in map clause. OMP_CLAUSE_DECLs + may need to go through FE handling though (instantiation, + C++ non-static data members, array section lowering), so + add the clause with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT and + let *finish_omp_clauses and the gimplifier handle it + right. */ + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) = 1; OMP_CLAUSE_DECL (c) = OMP_CLAUSE_DECL (clauses); OMP_CLAUSE_CHAIN (c) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET]; cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c; diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 89e05a4..60b5802 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1112,9 +1112,10 @@ c_common_post_options (const char **pfilename) /* Only -g0 and -gdwarf* are supported with PCH, for other debug formats we warn here and refuse to load any PCH files. */ if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG) - warning (OPT_Wdeprecated, - "the %qs debug format cannot be used with " - "pre-compiled headers", debug_type_names[write_symbols]); + warning (OPT_Wdeprecated, + "the %qs debug info cannot be used with " + "pre-compiled headers", + debug_set_names (write_symbols & ~DWARF2_DEBUG)); } else if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG) c_common_no_more_pch (); diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c index fd94c37..8f0f760 100644 --- a/gcc/c-family/c-pch.c +++ b/gcc/c-family/c-pch.c @@ -52,7 +52,7 @@ enum { struct c_pch_validity { - unsigned char debug_info_type; + uint32_t pch_write_symbols; signed char match[MATCH_SIZE]; void (*pch_init) (void); size_t target_data_length; @@ -108,7 +108,7 @@ pch_init (void) pch_outfile = f; memset (&v, '\0', sizeof (v)); - v.debug_info_type = write_symbols; + v.pch_write_symbols = write_symbols; { size_t i; for (i = 0; i < MATCH_SIZE; i++) @@ -252,13 +252,13 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) /* The allowable debug info combinations are that either the PCH file was built with the same as is being used now, or the PCH file was built for some kind of debug info but now none is in use. */ - if (v.debug_info_type != write_symbols + if (v.pch_write_symbols != write_symbols && write_symbols != NO_DEBUG) { cpp_warning (pfile, CPP_W_INVALID_PCH, - "%s: created with -g%s, but used with -g%s", name, - debug_type_names[v.debug_info_type], - debug_type_names[write_symbols]); + "%s: created with '%s' debug info, but used with '%s'", name, + debug_set_names (v.pch_write_symbols), + debug_set_names (write_symbols)); return 2; } diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 5fcf961..9192970 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -431,6 +431,26 @@ Wc++20-compat C++ ObjC++ Var(warn_cxx20_compat) Warning LangEnabledBy(C++ ObjC++,Wall) Warn about C++ constructs whose meaning differs between ISO C++ 2017 and ISO C++ 2020. +Wc++11-extensions +C++ ObjC++ Var(warn_cxx11_extensions) Warning LangEnabledBy(C++ ObjC++) Init(1) +Warn about C++11 constructs in code compiled with an older standard. + +Wc++14-extensions +C++ ObjC++ Var(warn_cxx14_extensions) Warning LangEnabledBy(C++ ObjC++) Init(1) +Warn about C++14 constructs in code compiled with an older standard. + +Wc++17-extensions +C++ ObjC++ Var(warn_cxx17_extensions) Warning LangEnabledBy(C++ ObjC++) Init(1) +Warn about C++17 constructs in code compiled with an older standard. + +Wc++20-extensions +C++ ObjC++ Var(warn_cxx20_extensions) Warning LangEnabledBy(C++ ObjC++) Init(1) +Warn about C++20 constructs in code compiled with an older standard. + +Wc++23-extensions +C++ ObjC++ Var(warn_cxx23_extensions) Warning LangEnabledBy(C++ ObjC++) Init(1) +Warn about C++23 constructs in code compiled with an older standard. + Wcast-function-type C ObjC C++ ObjC++ Var(warn_cast_function_type) Warning EnabledBy(Wextra) Warn about casts between incompatible function types. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 7d34f7c..7780539 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,26 @@ +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * c-typeck.c (c_finish_omp_clauses): Move firstprivate clauses with + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain. Don't error + if a decl is mentioned both in map clause and in such firstprivate + clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set. + +2021-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * c-parser.c (c_parser_omp_master): Set OMP_MASTER_COMBINED on + master when combined with taskloop. + (c_parser_omp_parallel): Don't set OMP_PARALLEL_COMBINED on + parallel master when not combined with taskloop. + +2021-05-18 Richard Biener <rguenther@suse.de> + + PR c/100522 + * gimple-parser.c (c_parser_gimple_postfix_expression_after_primary): + Diagnose calls to non-functions. + (c_parser_gimple_statement): Diagnose unexpected assignment RHS. + 2021-05-17 Richard Biener <rguenther@suse.de> PR c/100625 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index f79b839..b9930d4 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -18826,6 +18826,7 @@ c_parser_omp_master (location_t loc, c_parser *parser, if (ret == NULL_TREE) return ret; ret = c_finish_omp_master (loc, block); + OMP_MASTER_COMBINED (ret) = 1; return ret; } } @@ -19126,7 +19127,16 @@ c_parser_omp_parallel (location_t loc, c_parser *parser, block); if (ret == NULL) return ret; - OMP_PARALLEL_COMBINED (stmt) = 1; + /* master doesn't have any clauses and during gimplification + isn't represented by a gimplification omp context, so for + #pragma omp parallel master don't set OMP_PARALLEL_COMBINED, + so that + #pragma omp parallel master + #pragma omp taskloop simd lastprivate (x) + isn't confused with + #pragma omp parallel master taskloop simd lastprivate (x) */ + if (OMP_MASTER_COMBINED (ret)) + OMP_PARALLEL_COMBINED (stmt) = 1; return stmt; } else if (strcmp (p, "loop") == 0) diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index c3b85da..fc64ef9 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -13936,6 +13936,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) has been seen, -2 if mixed inscan/normal reduction diagnosed. */ int reduction_seen = 0; bool allocate_seen = false; + bool firstprivate_implicit_moved = false; bitmap_obstack_initialize (NULL); bitmap_initialize (&generic_head, &bitmap_default_obstack); @@ -14377,6 +14378,29 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) break; case OMP_CLAUSE_FIRSTPRIVATE: + if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) + && !firstprivate_implicit_moved) + { + firstprivate_implicit_moved = true; + /* Move firstprivate clauses with + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT set to the end of + clauses chain. */ + tree cl = NULL, *pc1 = pc, *pc2 = &cl; + while (*pc1) + if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_FIRSTPRIVATE + && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (*pc1)) + { + *pc2 = *pc1; + pc2 = &OMP_CLAUSE_CHAIN (*pc2); + *pc1 = OMP_CLAUSE_CHAIN (*pc1); + } + else + pc1 = &OMP_CLAUSE_CHAIN (*pc1); + *pc2 = NULL; + *pc1 = cl; + if (pc1 != pc) + continue; + } t = OMP_CLAUSE_DECL (c); need_complete = true; need_implicitly_determined = true; @@ -14398,6 +14422,9 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (ort == C_ORT_ACC) error_at (OMP_CLAUSE_LOCATION (c), "%qD appears more than once in data clauses", t); + else if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) + && !OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c)) + /* Silently drop the clause. */; else error_at (OMP_CLAUSE_LOCATION (c), "%qD appears both in data and map clauses", t); diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index e3814ee..39e5b04 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1719,7 +1719,8 @@ defer_stack_allocation (tree var, bool toplevel) */ static poly_uint64 -expand_one_var (tree var, bool toplevel, bool really_expand) +expand_one_var (tree var, bool toplevel, bool really_expand, + bitmap forced_stack_var = NULL) { unsigned int align = BITS_PER_UNIT; tree origvar = var; @@ -1797,7 +1798,9 @@ expand_one_var (tree var, bool toplevel, bool really_expand) expand_one_error_var (var); } } - else if (use_register_for_decl (var)) + else if (use_register_for_decl (var) + && (!forced_stack_var + || !bitmap_bit_p (forced_stack_var, DECL_UID (var)))) { if (really_expand) expand_one_register_var (origvar); @@ -1842,7 +1845,7 @@ expand_one_var (tree var, bool toplevel, bool really_expand) TOPLEVEL is true if this is the outermost BLOCK. */ static void -expand_used_vars_for_block (tree block, bool toplevel) +expand_used_vars_for_block (tree block, bool toplevel, bitmap forced_stack_vars) { tree t; @@ -1851,11 +1854,11 @@ expand_used_vars_for_block (tree block, bool toplevel) if (TREE_USED (t) && ((!VAR_P (t) && TREE_CODE (t) != RESULT_DECL) || !DECL_NONSHAREABLE (t))) - expand_one_var (t, toplevel, true); + expand_one_var (t, toplevel, true, forced_stack_vars); /* Expand all variables at containing levels. */ for (t = BLOCK_SUBBLOCKS (block); t ; t = BLOCK_CHAIN (t)) - expand_used_vars_for_block (t, false); + expand_used_vars_for_block (t, false, forced_stack_vars); } /* A subroutine of expand_used_vars. Walk down through the BLOCK tree @@ -2139,7 +2142,7 @@ stack_protect_return_slot_p () /* Expand all variables used in the function. */ static rtx_insn * -expand_used_vars (void) +expand_used_vars (bitmap forced_stack_vars) { tree var, outer_block = DECL_INITIAL (current_function_decl); auto_vec<tree> maybe_local_decls; @@ -2216,7 +2219,7 @@ expand_used_vars (void) TREE_USED (var) = 1; if (expand_now) - expand_one_var (var, true, true); + expand_one_var (var, true, true, forced_stack_vars); next: if (DECL_ARTIFICIAL (var) && !DECL_IGNORED_P (var)) @@ -2251,7 +2254,7 @@ expand_used_vars (void) /* At this point, all variables within the block tree with TREE_USED set are actually used by the optimized function. Lay them out. */ - expand_used_vars_for_block (outer_block, true); + expand_used_vars_for_block (outer_block, true, forced_stack_vars); tree attribs = DECL_ATTRIBUTES (current_function_decl); if (stack_vars_num > 0) @@ -6241,9 +6244,10 @@ construct_exit_block (void) static tree discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, - void *data ATTRIBUTE_UNUSED) + void *data) { tree t = *tp; + bitmap forced_stack_vars = (bitmap)((walk_stmt_info *)data)->info; if (IS_TYPE_OR_DECL_P (t)) *walk_subtrees = 0; @@ -6267,25 +6271,29 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, { t = get_base_address (t); if (t && DECL_P (t) - && DECL_MODE (t) != BLKmode) - TREE_ADDRESSABLE (t) = 1; + && DECL_MODE (t) != BLKmode + && !TREE_ADDRESSABLE (t)) + bitmap_set_bit (forced_stack_vars, DECL_UID (t)); } *walk_subtrees = 0; } /* References of size POLY_INT_CST to a fixed-size object must go through memory. It's more efficient to force that here than - to create temporary slots on the fly. */ - else if ((TREE_CODE (t) == MEM_REF || TREE_CODE (t) == TARGET_MEM_REF) - && TYPE_SIZE (TREE_TYPE (t)) - && POLY_INT_CST_P (TYPE_SIZE (TREE_TYPE (t)))) + to create temporary slots on the fly. + RTL expansion expectes TARGET_MEM_REF to always address actual memory. */ + else if (TREE_CODE (t) == TARGET_MEM_REF + || (TREE_CODE (t) == MEM_REF + && TYPE_SIZE (TREE_TYPE (t)) + && POLY_INT_CST_P (TYPE_SIZE (TREE_TYPE (t))))) { tree base = get_base_address (t); if (base && DECL_P (base) + && !TREE_ADDRESSABLE (base) && DECL_MODE (base) != BLKmode && GET_MODE_SIZE (DECL_MODE (base)).is_constant ()) - TREE_ADDRESSABLE (base) = 1; + bitmap_set_bit (forced_stack_vars, DECL_UID (base)); *walk_subtrees = 0; } @@ -6298,7 +6306,7 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, suitable for raw bits processing (like XFmode on i?86). */ static void -avoid_type_punning_on_regs (tree t) +avoid_type_punning_on_regs (tree t, bitmap forced_stack_vars) { machine_mode access_mode = TYPE_MODE (TREE_TYPE (t)); if (access_mode != BLKmode @@ -6312,7 +6320,7 @@ avoid_type_punning_on_regs (tree t) GET_MODE_BITSIZE (GET_MODE_INNER (DECL_MODE (base)))) /* Double check in the expensive way we really would get a pseudo. */ && use_register_for_decl (base)) - TREE_ADDRESSABLE (base) = 1; + bitmap_set_bit (forced_stack_vars, DECL_UID (base)); } /* RTL expansion is not able to compile array references with variable @@ -6321,38 +6329,49 @@ avoid_type_punning_on_regs (tree t) scenario. */ static void -discover_nonconstant_array_refs (void) +discover_nonconstant_array_refs (bitmap forced_stack_vars) { basic_block bb; gimple_stmt_iterator gsi; + walk_stmt_info wi = {}; + wi.info = forced_stack_vars; FOR_EACH_BB_FN (bb, cfun) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); if (!is_gimple_debug (stmt)) { - walk_gimple_op (stmt, discover_nonconstant_array_refs_r, NULL); + walk_gimple_op (stmt, discover_nonconstant_array_refs_r, &wi); gcall *call = dyn_cast <gcall *> (stmt); if (call && gimple_call_internal_p (call)) - switch (gimple_call_internal_fn (call)) - { - case IFN_LOAD_LANES: - /* The source must be a MEM. */ - mark_addressable (gimple_call_arg (call, 0)); - break; - case IFN_STORE_LANES: - /* The destination must be a MEM. */ - mark_addressable (gimple_call_lhs (call)); - break; - default: - break; - } + { + tree cand = NULL_TREE; + switch (gimple_call_internal_fn (call)) + { + case IFN_LOAD_LANES: + /* The source must be a MEM. */ + cand = gimple_call_arg (call, 0); + break; + case IFN_STORE_LANES: + /* The destination must be a MEM. */ + cand = gimple_call_lhs (call); + break; + default: + break; + } + if (cand) + cand = get_base_address (cand); + if (cand + && DECL_P (cand) + && use_register_for_decl (cand)) + bitmap_set_bit (forced_stack_vars, DECL_UID (cand)); + } if (gimple_vdef (stmt)) { tree t = gimple_get_lhs (stmt); if (t && REFERENCE_CLASS_P (t)) - avoid_type_punning_on_regs (t); + avoid_type_punning_on_regs (t, forced_stack_vars); } } } @@ -6553,7 +6572,8 @@ pass_expand::execute (function *fun) } /* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */ - discover_nonconstant_array_refs (); + auto_bitmap forced_stack_vars; + discover_nonconstant_array_refs (forced_stack_vars); /* Make sure all values used by the optimization passes have sane defaults. */ @@ -6601,7 +6621,7 @@ pass_expand::execute (function *fun) timevar_push (TV_VAR_EXPAND); start_sequence (); - var_ret_seq = expand_used_vars (); + var_ret_seq = expand_used_vars (forced_stack_vars); var_seq = get_insns (); end_sequence (); @@ -6621,9 +6641,34 @@ pass_expand::execute (function *fun) (int) param_ssp_buffer_size); } + /* Temporarily mark PARM_DECLs and RESULT_DECLs we need to expand to + memory addressable so expand_function_start can emit the required + copies. */ + auto_vec<tree, 16> marked_parms; + for (tree parm = DECL_ARGUMENTS (current_function_decl); parm; + parm = DECL_CHAIN (parm)) + if (!TREE_ADDRESSABLE (parm) + && bitmap_bit_p (forced_stack_vars, DECL_UID (parm))) + { + TREE_ADDRESSABLE (parm) = 1; + marked_parms.safe_push (parm); + } + if (DECL_RESULT (current_function_decl) + && !TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) + && bitmap_bit_p (forced_stack_vars, + DECL_UID (DECL_RESULT (current_function_decl)))) + { + TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) = 1; + marked_parms.safe_push (DECL_RESULT (current_function_decl)); + } + /* Set up parameters and prepare for return, for the function. */ expand_function_start (current_function_decl); + /* Clear TREE_ADDRESSABLE again. */ + while (!marked_parms.is_empty ()) + TREE_ADDRESSABLE (marked_parms.pop ()) = 0; + /* If we emitted any instructions for setting up the variables, emit them before the FUNCTION_START note. */ if (var_seq) diff --git a/gcc/collect2.c b/gcc/collect2.c index 0ddb169..b08c6e7 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -2779,7 +2779,10 @@ scan_prog_file (const char *prog_name, scanpass which_pass, if ((ldptr = ldopen (CONST_CAST (char *, prog_name), ldptr)) != NULL) { if (! MY_ISCOFF (HEADER (ldptr).f_magic)) - fatal_error (input_location, "%s: not a COFF file", prog_name); + { + warning (0, "%s: not a COFF file", prog_name); + continue; + } if (GCC_CHECK_HDR (ldptr)) { diff --git a/gcc/common.opt b/gcc/common.opt index a75b44e..ffb968d 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -109,7 +109,7 @@ bool exit_after_options ; flag-types.h for the definitions of the different possible types of ; debugging information. Variable -enum debug_info_type write_symbols = NO_DEBUG +uint32_t write_symbols = NO_DEBUG ; Level of debugging information we are producing. See flag-types.h ; for the definitions of the different possible levels. diff --git a/gcc/common/config/riscv/riscv-common.c b/gcc/common/config/riscv/riscv-common.c index d17bea6..10868fd4 100644 --- a/gcc/common/config/riscv/riscv-common.c +++ b/gcc/common/config/riscv/riscv-common.c @@ -518,40 +518,39 @@ riscv_subset_list::parsing_subset_version (const char *ext, unsigned version = 0; unsigned major = 0; unsigned minor = 0; - char np; *explicit_version_p = false; - for (; *p; ++p) - { - if (*p == 'p') - { - np = *(p + 1); - - if (!ISDIGIT (np)) - { - /* Might be beginning of `p` extension. */ - if (std_ext_p) - { - get_default_version (ext, major_version, minor_version); - return p; - } - else - { - error_at (m_loc, "%<-march=%s%>: Expect number " - "after %<%dp%>.", m_arch, version); - return NULL; - } - } - - major = version; - major_p = false; - version = 0; - } - else if (ISDIGIT (*p)) - version = (version * 10) + (*p - '0'); - else - break; - } + /* If we got `p`, that means we are still parsing standard extension. */ + gcc_assert (std_ext_p || *p != 'p'); + + if (*p != 'p') { + for (; *p; ++p) + { + if (*p == 'p') + { + if (!ISDIGIT (*(p+1))) + { + error_at (m_loc, "%<-march=%s%>: Expect number " + "after %<%dp%>.", m_arch, version); + return NULL; + } + if (!major_p) + { + error_at (m_loc, "%<-march=%s%>: For %<%s%dp%dp?%>, version " + "number with more than 2 level is not supported.", + m_arch, ext, major, version); + return NULL; + } + major = version; + major_p = false; + version = 0; + } + else if (ISDIGIT (*p)) + version = (version * 10) + (*p - '0'); + else + break; + } + } if (major_p) major = version; @@ -643,7 +642,7 @@ riscv_subset_list::parse_std_ext (const char *p) return NULL; } - while (*p) + while (p != NULL && *p) { char subset[2] = {0, 0}; @@ -771,6 +770,9 @@ riscv_subset_list::parse_multiletter_ext (const char *p, /* std_ext_p= */ false, &explicit_version_p); free (ext); + if (end_of_version == NULL) + return NULL; + *q = '\0'; if (strlen (subset) == 1) diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index acdea2a..3cab3ec 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -906,14 +906,13 @@ aarch64_init_simd_builtin_scalar_types (void) "__builtin_aarch64_simd_udi"); } -/* Return a set of FLAG_* flags that describe what the function could do, +/* Return a set of FLAG_* flags derived from FLAGS + that describe what a function with result MODE could do, taking the command-line flags into account. */ static unsigned int -aarch64_call_properties (aarch64_simd_builtin_datum *d) +aarch64_call_properties (unsigned int flags, machine_mode mode) { - unsigned int flags = d->flags; - - if (!(flags & FLAG_AUTO_FP) && FLOAT_MODE_P (d->mode)) + if (!(flags & FLAG_AUTO_FP) && FLOAT_MODE_P (mode)) flags |= FLAG_FP; /* -fno-trapping-math means that we can assume any FP exceptions @@ -924,12 +923,12 @@ aarch64_call_properties (aarch64_simd_builtin_datum *d) return flags; } -/* Return true if calls to the function could modify some form of - global state. */ +/* Return true if calls to a function with flags F and mode MODE + could modify some form of global state. */ static bool -aarch64_modifies_global_state_p (aarch64_simd_builtin_datum *d) +aarch64_modifies_global_state_p (unsigned int f, machine_mode mode) { - unsigned int flags = aarch64_call_properties (d); + unsigned int flags = aarch64_call_properties (f, mode); if (flags & FLAG_RAISE_FP_EXCEPTIONS) return true; @@ -940,12 +939,12 @@ aarch64_modifies_global_state_p (aarch64_simd_builtin_datum *d) return flags & FLAG_WRITE_MEMORY; } -/* Return true if calls to the function could read some form of - global state. */ +/* Return true if calls to a function with flags F and mode MODE + could read some form of global state. */ static bool -aarch64_reads_global_state_p (aarch64_simd_builtin_datum *d) +aarch64_reads_global_state_p (unsigned int f, machine_mode mode) { - unsigned int flags = aarch64_call_properties (d); + unsigned int flags = aarch64_call_properties (f, mode); if (flags & FLAG_READ_FPCR) return true; @@ -953,11 +952,12 @@ aarch64_reads_global_state_p (aarch64_simd_builtin_datum *d) return flags & FLAG_READ_MEMORY; } -/* Return true if calls to the function could raise a signal. */ +/* Return true if calls to a function with flags F and mode MODE + could raise a signal. */ static bool -aarch64_could_trap_p (aarch64_simd_builtin_datum *d) +aarch64_could_trap_p (unsigned int f, machine_mode mode) { - unsigned int flags = aarch64_call_properties (d); + unsigned int flags = aarch64_call_properties (f, mode); if (flags & FLAG_RAISE_FP_EXCEPTIONS) return true; @@ -975,21 +975,22 @@ aarch64_add_attribute (const char *name, tree attrs) return tree_cons (get_identifier (name), NULL_TREE, attrs); } -/* Return the appropriate function attributes. */ +/* Return the appropriate attributes for a function that has + flags F and mode MODE. */ static tree -aarch64_get_attributes (aarch64_simd_builtin_datum *d) +aarch64_get_attributes (unsigned int f, machine_mode mode) { tree attrs = NULL_TREE; - if (!aarch64_modifies_global_state_p (d)) + if (!aarch64_modifies_global_state_p (f, mode)) { - if (aarch64_reads_global_state_p (d)) + if (aarch64_reads_global_state_p (f, mode)) attrs = aarch64_add_attribute ("pure", attrs); else attrs = aarch64_add_attribute ("const", attrs); } - if (!flag_non_call_exceptions || !aarch64_could_trap_p (d)) + if (!flag_non_call_exceptions || !aarch64_could_trap_p (f, mode)) attrs = aarch64_add_attribute ("nothrow", attrs); return aarch64_add_attribute ("leaf", attrs); @@ -1018,7 +1019,9 @@ aarch64_init_fcmla_laneq_builtins (void) = aarch64_simd_builtin_std_type (SImode, qualifier_lane_pair_index); tree ftype = build_function_type_list (argtype, argtype, argtype, quadtype, lanetype, NULL_TREE); - tree fndecl = aarch64_general_add_builtin (d->name, ftype, d->fcode); + tree attrs = aarch64_get_attributes (FLAG_FP, d->mode); + tree fndecl + = aarch64_general_add_builtin (d->name, ftype, d->fcode, attrs); aarch64_builtin_decls[d->fcode] = fndecl; } @@ -1148,7 +1151,7 @@ aarch64_init_simd_builtins (void) snprintf (namebuf, sizeof (namebuf), "__builtin_aarch64_%s", d->name); - tree attrs = aarch64_get_attributes (d); + tree attrs = aarch64_get_attributes (d->flags, d->mode); fndecl = aarch64_general_add_builtin (namebuf, ftype, fcode, attrs); aarch64_builtin_decls[fcode] = fndecl; @@ -1170,7 +1173,9 @@ aarch64_init_crc32_builtins () tree argtype = aarch64_simd_builtin_std_type (d->mode, qualifier_unsigned); tree ftype = build_function_type_list (usi_type, usi_type, argtype, NULL_TREE); - tree fndecl = aarch64_general_add_builtin (d->name, ftype, d->fcode); + tree attrs = aarch64_get_attributes (FLAG_NONE, d->mode); + tree fndecl + = aarch64_general_add_builtin (d->name, ftype, d->fcode, attrs); aarch64_builtin_decls[d->fcode] = fndecl; } @@ -1210,8 +1215,9 @@ aarch64_init_builtin_rsqrt (void) for (; bdd < bdd_end; bdd++) { ftype = build_function_type_list (bdd->type_node, bdd->type_node, NULL_TREE); + tree attrs = aarch64_get_attributes (FLAG_FP, TYPE_MODE (bdd->type_node)); fndecl = aarch64_general_add_builtin (bdd->builtin_name, - ftype, bdd->function_code); + ftype, bdd->function_code, attrs); aarch64_builtin_decls[bdd->function_code] = fndecl; } } diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index 1e81bb5..18baa67 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -421,12 +421,18 @@ 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_VSQN_HSDI (SHIFTIMM, sqshrun_n, 0, NONE) - BUILTIN_VSQN_HSDI (SHIFTIMM, sqrshrun_n, 0, NONE) - BUILTIN_VSQN_HSDI (SHIFTIMM, sqshrn_n, 0, NONE) - BUILTIN_VSQN_HSDI (USHIFTIMM, uqshrn_n, 0, NONE) - BUILTIN_VSQN_HSDI (SHIFTIMM, sqrshrn_n, 0, NONE) - BUILTIN_VSQN_HSDI (USHIFTIMM, uqrshrn_n, 0, NONE) + BUILTIN_VQN (SHIFTIMM, sqshrun_n, 0, NONE) + BUILTIN_VQN (SHIFTIMM, sqrshrun_n, 0, NONE) + BUILTIN_VQN (SHIFTIMM, sqshrn_n, 0, NONE) + BUILTIN_VQN (USHIFTIMM, uqshrn_n, 0, NONE) + BUILTIN_VQN (SHIFTIMM, sqrshrn_n, 0, NONE) + BUILTIN_VQN (USHIFTIMM, uqrshrn_n, 0, NONE) + BUILTIN_SD_HSDI (SHIFTIMM, sqshrun_n, 0, NONE) + BUILTIN_SD_HSDI (SHIFTIMM, sqrshrun_n, 0, NONE) + BUILTIN_SD_HSDI (SHIFTIMM, sqshrn_n, 0, NONE) + 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) diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index e59bc7b..e750fae 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -1691,12 +1691,49 @@ ;; Narrowing operations. ;; For doubles. -(define_insn "aarch64_simd_vec_pack_trunc_<mode>" - [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (truncate:<VNARROWQ> (match_operand:VQN 1 "register_operand" "w")))] - "TARGET_SIMD" - "xtn\\t%0.<Vntype>, %1.<Vtype>" - [(set_attr "type" "neon_shift_imm_narrow_q")] + +(define_insn "aarch64_xtn<mode>" + [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") + (truncate:<VNARROWQ> (match_operand:VQN 1 "register_operand" "w")))] + "TARGET_SIMD" + "xtn\\t%0.<Vntype>, %1.<Vtype>" + [(set_attr "type" "neon_move_narrow_q")] +) + +(define_insn "aarch64_xtn2<mode>_le" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (match_operand:<VNARROWQ> 1 "register_operand" "0") + (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand" "w"))))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN" + "xtn2\t%0.<V2ntype>, %2.<Vtype>" + [(set_attr "type" "neon_move_narrow_q")] +) + +(define_insn "aarch64_xtn2<mode>_be" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand" "w")) + (match_operand:<VNARROWQ> 1 "register_operand" "0")))] + "TARGET_SIMD && BYTES_BIG_ENDIAN" + "xtn2\t%0.<V2ntype>, %2.<Vtype>" + [(set_attr "type" "neon_move_narrow_q")] +) + +(define_expand "aarch64_xtn2<mode>" + [(match_operand:<VNARROWQ2> 0 "register_operand") + (match_operand:<VNARROWQ> 1 "register_operand") + (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand"))] + "TARGET_SIMD" + { + if (BYTES_BIG_ENDIAN) + emit_insn (gen_aarch64_xtn2<mode>_be (operands[0], operands[1], + operands[2])); + else + emit_insn (gen_aarch64_xtn2<mode>_le (operands[0], operands[1], + operands[2])); + DONE; + } ) (define_expand "vec_pack_trunc_<mode>" @@ -1711,7 +1748,7 @@ emit_insn (gen_move_lo_quad_<Vdbl> (tempreg, operands[lo])); emit_insn (gen_move_hi_quad_<Vdbl> (tempreg, operands[hi])); - emit_insn (gen_aarch64_simd_vec_pack_trunc_<Vdbl> (operands[0], tempreg)); + emit_insn (gen_aarch64_xtn<Vdbl> (operands[0], tempreg)); DONE; }) @@ -1901,20 +1938,25 @@ ;; For quads. -(define_insn "vec_pack_trunc_<mode>" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=&w") +(define_expand "vec_pack_trunc_<mode>" + [(set (match_operand:<VNARROWQ2> 0 "register_operand") (vec_concat:<VNARROWQ2> - (truncate:<VNARROWQ> (match_operand:VQN 1 "register_operand" "w")) - (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand" "w"))))] + (truncate:<VNARROWQ> (match_operand:VQN 1 "register_operand")) + (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand"))))] "TARGET_SIMD" { + rtx tmpreg = gen_reg_rtx (<VNARROWQ>mode); + int lo = BYTES_BIG_ENDIAN ? 2 : 1; + int hi = BYTES_BIG_ENDIAN ? 1 : 2; + + emit_insn (gen_aarch64_xtn<mode> (tmpreg, operands[lo])); + if (BYTES_BIG_ENDIAN) - return "xtn\\t%0.<Vntype>, %2.<Vtype>\;xtn2\\t%0.<V2ntype>, %1.<Vtype>"; + emit_insn (gen_aarch64_xtn2<mode>_be (operands[0], tmpreg, operands[hi])); else - return "xtn\\t%0.<Vntype>, %1.<Vtype>\;xtn2\\t%0.<V2ntype>, %2.<Vtype>"; + emit_insn (gen_aarch64_xtn2<mode>_le (operands[0], tmpreg, operands[hi])); + DONE; } - [(set_attr "type" "multiple") - (set_attr "length" "8")] ) ;; Widening operations. @@ -4594,17 +4636,48 @@ [(set_attr "type" "neon_<addsub>_halve_narrow_q")] ) -(define_insn "aarch64_<sur><addsub>hn2<mode>" +(define_insn "aarch64_<sur><addsub>hn2<mode>_insn_le" [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (unspec:<VNARROWQ2> [(match_operand:<VNARROWQ> 1 "register_operand" "0") - (match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "register_operand" "w")] - ADDSUBHN2))] - "TARGET_SIMD" + (vec_concat:<VNARROWQ2> + (match_operand:<VNARROWQ> 1 "register_operand" "0") + (unspec:<VNARROWQ> [(match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 "register_operand" "w")] + ADDSUBHN)))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN" + "<sur><addsub>hn2\\t%0.<V2ntype>, %2.<Vtype>, %3.<Vtype>" + [(set_attr "type" "neon_<addsub>_halve_narrow_q")] +) + +(define_insn "aarch64_<sur><addsub>hn2<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 "register_operand" "w")] + ADDSUBHN) + (match_operand:<VNARROWQ> 1 "register_operand" "0")))] + "TARGET_SIMD && BYTES_BIG_ENDIAN" "<sur><addsub>hn2\\t%0.<V2ntype>, %2.<Vtype>, %3.<Vtype>" [(set_attr "type" "neon_<addsub>_halve_narrow_q")] ) +(define_expand "aarch64_<sur><addsub>hn2<mode>" + [(match_operand:<VNARROWQ2> 0 "register_operand") + (match_operand:<VNARROWQ> 1 "register_operand") + (unspec [(match_operand:VQN 2 "register_operand") + (match_operand:VQN 3 "register_operand")] + ADDSUBHN)] + "TARGET_SIMD" + { + if (BYTES_BIG_ENDIAN) + emit_insn (gen_aarch64_<sur><addsub>hn2<mode>_insn_be (operands[0], + operands[1], operands[2], operands[3])); + else + emit_insn (gen_aarch64_<sur><addsub>hn2<mode>_insn_le (operands[0], + operands[1], operands[2], operands[3])); + DONE; + } +) + ;; pmul. (define_insn "aarch64_pmul<mode>" @@ -4828,7 +4901,7 @@ (vec_concat:<VNARROWQ2> (match_operand:<VNARROWQ> 1 "register_operand" "0") (unspec:<VNARROWQ> - [(match_operand:VQN 2 "register_operand" "w")] UNSPEC_SQXTUN2)))] + [(match_operand:VQN 2 "register_operand" "w")] UNSPEC_SQXTUN)))] "TARGET_SIMD && !BYTES_BIG_ENDIAN" "sqxtun2\\t%0.<V2ntype>, %2.<Vtype>" [(set_attr "type" "neon_sat_shift_imm_narrow_q")] @@ -4838,7 +4911,7 @@ [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") (vec_concat:<VNARROWQ2> (unspec:<VNARROWQ> - [(match_operand:VQN 2 "register_operand" "w")] UNSPEC_SQXTUN2) + [(match_operand:VQN 2 "register_operand" "w")] UNSPEC_SQXTUN) (match_operand:<VNARROWQ> 1 "register_operand" "0")))] "TARGET_SIMD && BYTES_BIG_ENDIAN" "sqxtun2\\t%0.<V2ntype>, %2.<Vtype>" @@ -4849,7 +4922,7 @@ [(match_operand:<VNARROWQ2> 0 "register_operand") (match_operand:<VNARROWQ> 1 "register_operand") (unspec:<VNARROWQ> - [(match_operand:VQN 2 "register_operand")] UNSPEC_SQXTUN2)] + [(match_operand:VQN 2 "register_operand")] UNSPEC_SQXTUN)] "TARGET_SIMD" { if (BYTES_BIG_ENDIAN) @@ -6014,7 +6087,7 @@ (define_insn "aarch64_<sur>q<r>shr<u>n_n<mode>" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (unspec:<VNARROWQ> [(match_operand:VSQN_HSDI 1 "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))] @@ -6023,17 +6096,106 @@ [(set_attr "type" "neon_sat_shift_imm_narrow_q")] ) -(define_insn "aarch64_<sur>q<r>shr<u>n2_n<mode>" +(define_insn "aarch64_<sur>q<r>shr<u>n_n<mode>_insn_le" + [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") + (vec_concat:<VNARROWQ2> + (unspec:<VNARROWQ> + [(match_operand:VQN 1 "register_operand" "w") + (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>")] + VQSHRN_N) + (match_operand:<VNARROWQ> 3 "aarch64_simd_or_scalar_imm_zero")))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN" + "<sur>q<r>shr<u>n\\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_be" [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (unspec:<VNARROWQ2> [(match_operand:<VNARROWQ> 1 "register_operand" "0") - (match_operand:VQN 2 "register_operand" "w") - (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<ve_mode>" "i")] - VQSHRN_N))] + (vec_concat:<VNARROWQ2> + (match_operand:<VNARROWQ> 3 "aarch64_simd_or_scalar_imm_zero") + (unspec:<VNARROWQ> + [(match_operand:VQN 1 "register_operand" "w") + (match_operand:VQN 2 "aarch64_simd_shift_imm_vec_<vn_mode>")] + VQSHRN_N)))] + "TARGET_SIMD && BYTES_BIG_ENDIAN" + "<sur>q<r>shr<u>n\\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>" + [(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))] "TARGET_SIMD" + { + operands[2] = aarch64_simd_gen_const_vector_dup (<MODE>mode, + INTVAL (operands[2])); + rtx tmp = gen_reg_rtx (<VNARROWQ2>mode); + if (BYTES_BIG_ENDIAN) + emit_insn (gen_aarch64_<sur>q<r>shr<u>n_n<mode>_insn_be (tmp, + operands[1], operands[2], CONST0_RTX (<VNARROWQ>mode))); + else + emit_insn (gen_aarch64_<sur>q<r>shr<u>n_n<mode>_insn_le (tmp, + operands[1], operands[2], CONST0_RTX (<VNARROWQ>mode))); + + /* The intrinsic expects a narrow result, so emit a subreg that will get + optimized away as appropriate. */ + emit_move_insn (operands[0], lowpart_subreg (<VNARROWQ>mode, tmp, + <VNARROWQ2>mode)); + DONE; + } +) + +(define_insn "aarch64_<sur>q<r>shr<u>n2_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)))] + "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")] ) +(define_insn "aarch64_<sur>q<r>shr<u>n2_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) + (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")] +) + +(define_expand "aarch64_<sur>q<r>shr<u>n2_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)] + "TARGET_SIMD" + { + operands[3] = aarch64_simd_gen_const_vector_dup (<MODE>mode, + INTVAL (operands[3])); + + 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])); + else + emit_insn (gen_aarch64_<sur>q<r>shr<u>n2_n<mode>_insn_le (operands[0], + operands[1], operands[2], operands[3])); + DONE; + } +) + ;; cm(eq|ge|gt|lt|le) ;; Note, we have constraints for Dz and Z as different expanders @@ -8450,56 +8612,13 @@ "" ) -(define_expand "aarch64_xtn<mode>" - [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") - (truncate:<VNARROWQ> (match_operand:VQN 1 "register_operand" "w")))] - "TARGET_SIMD" - "" -) - ;; Truncate a 128-bit integer vector to a 64-bit vector. (define_insn "trunc<mode><Vnarrowq>2" [(set (match_operand:<VNARROWQ> 0 "register_operand" "=w") (truncate:<VNARROWQ> (match_operand:VQN 1 "register_operand" "w")))] "TARGET_SIMD" "xtn\t%0.<Vntype>, %1.<Vtype>" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_insn "aarch64_xtn2<mode>_le" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (match_operand:<VNARROWQ> 1 "register_operand" "0") - (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand" "w"))))] - "TARGET_SIMD && !BYTES_BIG_ENDIAN" - "xtn2\t%0.<V2ntype>, %2.<Vtype>" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_insn "aarch64_xtn2<mode>_be" - [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w") - (vec_concat:<VNARROWQ2> - (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand" "w")) - (match_operand:<VNARROWQ> 1 "register_operand" "0")))] - "TARGET_SIMD && BYTES_BIG_ENDIAN" - "xtn2\t%0.<V2ntype>, %2.<Vtype>" - [(set_attr "type" "neon_shift_imm_narrow_q")] -) - -(define_expand "aarch64_xtn2<mode>" - [(match_operand:<VNARROWQ2> 0 "register_operand") - (match_operand:<VNARROWQ> 1 "register_operand") - (truncate:<VNARROWQ> (match_operand:VQN 2 "register_operand"))] - "TARGET_SIMD" - { - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_xtn2<mode>_be (operands[0], operands[1], - operands[2])); - else - emit_insn (gen_aarch64_xtn2<mode>_le (operands[0], operands[1], - operands[2])); - DONE; - } + [(set_attr "type" "neon_move_narrow_q")] ) (define_insn "aarch64_bfdot<mode>" diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc index dfdf0e2..8fd6d3f 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc @@ -1123,7 +1123,7 @@ public: rtx expand (function_expander &e) const OVERRIDE { - insn_code icode = code_for_aarch64_load (extend_rtx_code (), + insn_code icode = code_for_aarch64_load (UNSPEC_LD1_SVE, extend_rtx_code (), e.vector_mode (0), e.memory_vector_mode ()); return e.use_contiguous_load_insn (icode); diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index b8b6f55..9e48c0e 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -1287,7 +1287,7 @@ ;; ------------------------------------------------------------------------- ;; Predicated load and extend, with 8 elements per 128-bit block. -(define_insn_and_rewrite "@aarch64_load_<ANY_EXTEND:optab><SVE_HSDI:mode><SVE_PARTIAL_I:mode>" +(define_insn_and_rewrite "@aarch64_load<SVE_PRED_LOAD:pred_load>_<ANY_EXTEND:optab><SVE_HSDI:mode><SVE_PARTIAL_I:mode>" [(set (match_operand:SVE_HSDI 0 "register_operand" "=w") (unspec:SVE_HSDI [(match_operand:<SVE_HSDI:VPRED> 3 "general_operand" "UplDnm") @@ -1295,7 +1295,7 @@ (unspec:SVE_PARTIAL_I [(match_operand:<SVE_PARTIAL_I:VPRED> 2 "register_operand" "Upl") (match_operand:SVE_PARTIAL_I 1 "memory_operand" "m")] - UNSPEC_LD1_SVE))] + SVE_PRED_LOAD))] UNSPEC_PRED_X))] "TARGET_SVE && (~<SVE_HSDI:narrower_mask> & <SVE_PARTIAL_I:self_mask>) == 0" "ld1<ANY_EXTEND:s><SVE_PARTIAL_I:Vesize>\t%0.<SVE_HSDI:Vctype>, %2/z, %1" diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 0835646..c1e451e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -15435,7 +15435,10 @@ aarch64_add_stmt_cost (class vec_info *vinfo, void *data, int count, arbitrary and could potentially be improved with analysis. */ if (where == vect_body && stmt_info && stmt_in_inner_loop_p (vinfo, stmt_info)) - count *= 50; /* FIXME */ + { + gcc_assert (loop_vinfo); + count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME */ + } retval = (unsigned) (count * stmt_cost); costs->region[where] += retval; diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 69d9dbe..e9047d0 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -282,6 +282,9 @@ ;; Scalar 64-bit container: 16, 32-bit integer modes (define_mode_iterator SD_HSI [HI SI]) +;; Scalar 64-bit container: 16-bit, 32-bit and 64-bit integer modes. +(define_mode_iterator SD_HSDI [HI SI DI]) + ;; Advanced SIMD 64-bit container: 16, 32-bit integer modes. (define_mode_iterator VQ_HSI [V8HI V4SI]) @@ -514,10 +517,6 @@ UNSPEC_RADDHN ; Used in aarch64-simd.md. UNSPEC_SUBHN ; Used in aarch64-simd.md. UNSPEC_RSUBHN ; Used in aarch64-simd.md. - UNSPEC_ADDHN2 ; Used in aarch64-simd.md. - UNSPEC_RADDHN2 ; Used in aarch64-simd.md. - UNSPEC_SUBHN2 ; Used in aarch64-simd.md. - UNSPEC_RSUBHN2 ; Used in aarch64-simd.md. UNSPEC_SQDMULH ; Used in aarch64-simd.md. UNSPEC_SQRDMULH ; Used in aarch64-simd.md. UNSPEC_PMUL ; Used in aarch64-simd.md. @@ -525,7 +524,6 @@ UNSPEC_USQADD ; Used in aarch64-simd.md. UNSPEC_SUQADD ; Used in aarch64-simd.md. UNSPEC_SQXTUN ; Used in aarch64-simd.md. - UNSPEC_SQXTUN2 ; Used in aarch64-simd.md. UNSPEC_SSRA ; Used in aarch64-simd.md. UNSPEC_USRA ; Used in aarch64-simd.md. UNSPEC_SRSRA ; Used in aarch64-simd.md. @@ -2241,9 +2239,6 @@ (define_int_iterator ADDSUBHN [UNSPEC_ADDHN UNSPEC_RADDHN UNSPEC_SUBHN UNSPEC_RSUBHN]) -(define_int_iterator ADDSUBHN2 [UNSPEC_ADDHN2 UNSPEC_RADDHN2 - UNSPEC_SUBHN2 UNSPEC_RSUBHN2]) - (define_int_iterator FMAXMIN_UNS [UNSPEC_FMAX UNSPEC_FMIN UNSPEC_FMAXNM UNSPEC_FMINNM]) @@ -2516,6 +2511,10 @@ (define_int_iterator SVE_LDFF1_LDNF1 [UNSPEC_LDFF1 UNSPEC_LDNF1]) +(define_int_iterator SVE_PRED_LOAD [UNSPEC_PRED_X UNSPEC_LD1_SVE]) + +(define_int_attr pred_load [(UNSPEC_PRED_X "_x") (UNSPEC_LD1_SVE "")]) + (define_int_iterator SVE2_U32_UNARY [UNSPEC_URECPE UNSPEC_RSQRTE]) (define_int_iterator SVE2_INT_UNARY_NARROWB [UNSPEC_SQXTNB @@ -2996,8 +2995,6 @@ (UNSPEC_SABDL2 "s") (UNSPEC_UABDL2 "u") (UNSPEC_SADALP "s") (UNSPEC_UADALP "u") (UNSPEC_SUBHN "") (UNSPEC_RSUBHN "r") - (UNSPEC_ADDHN2 "") (UNSPEC_RADDHN2 "r") - (UNSPEC_SUBHN2 "") (UNSPEC_RSUBHN2 "r") (UNSPEC_USQADD "us") (UNSPEC_SUQADD "su") (UNSPEC_SSLI "s") (UNSPEC_USLI "u") (UNSPEC_SSRI "s") (UNSPEC_USRI "u") @@ -3060,11 +3057,7 @@ (UNSPEC_ADDHN "add") (UNSPEC_SUBHN "sub") (UNSPEC_RADDHN "add") - (UNSPEC_RSUBHN "sub") - (UNSPEC_ADDHN2 "add") - (UNSPEC_SUBHN2 "sub") - (UNSPEC_RADDHN2 "add") - (UNSPEC_RSUBHN2 "sub")]) + (UNSPEC_RSUBHN "sub")]) ;; BSL variants: first commutative operand. (define_int_attr bsl_1st [(1 "w") (2 "0")]) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 28cfd81..9377aae 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -32,6 +32,7 @@ #include "tree.h" #include "memmodel.h" #include "cfghooks.h" +#include "cfgloop.h" #include "df.h" #include "tm_p.h" #include "stringpool.h" @@ -69,6 +70,7 @@ #include "gimplify.h" #include "gimple.h" #include "selftest.h" +#include "tree-vectorizer.h" /* This file should be included last. */ #include "target-def.h" @@ -12226,7 +12228,11 @@ arm_add_stmt_cost (vec_info *vinfo, void *data, int count, arbitrary and could potentially be improved with analysis. */ if (where == vect_body && stmt_info && stmt_in_inner_loop_p (vinfo, stmt_info)) - count *= 50; /* FIXME. */ + { + loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo); + gcc_assert (loop_vinfo); + count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME. */ + } retval = (unsigned) (count * stmt_cost); cost[where] += retval; diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 45a471a..0646048 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -8580,18 +8580,21 @@ (use (match_operand 2 "" "")) (clobber (reg:SI LR_REGNUM))])] "use_cmse" - " { + rtx addr = XEXP (operands[0], 0); + rtx tmp = REG_P (addr) ? addr : force_reg (SImode, addr); + if (!TARGET_HAVE_FPCXT_CMSE) { - rtx tmp = - copy_to_suggested_reg (XEXP (operands[0], 0), - gen_rtx_REG (SImode, R4_REGNUM), - SImode); - - operands[0] = replace_equiv_address (operands[0], tmp); + rtx r4 = gen_rtx_REG (SImode, R4_REGNUM); + emit_move_insn (r4, tmp); + tmp = r4; } - }") + + if (tmp != addr) + operands[0] = replace_equiv_address (operands[0], tmp); + } +) (define_insn "*call_reg_armv5" [(call (mem:SI (match_operand:SI 0 "s_register_operand" "r")) diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index e7e1d6c..ce49495 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -59,6 +59,7 @@ #include "regrename.h" #include "dumpfile.h" #include "builtins.h" +#include "flags.h" /* This file should be included last. */ #include "target-def.h" @@ -439,8 +440,7 @@ c6x_output_file_unwind (FILE * f) { if (flag_unwind_tables || flag_exceptions) { - if (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) asm_fprintf (f, "\t.cfi_sections .debug_frame, .c6xabi.exidx\n"); else asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n"); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index c4016fe..b160c23 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "lto-section-names.h" #include "intl.h" #include "optabs.h" +#include "flags.h" /* Fix and Continue. @@ -3347,7 +3348,7 @@ darwin_override_options (void) && generating_for_darwin_version >= 9 && (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE) : (debug_info_level >= DINFO_LEVEL_NORMAL)) - && write_symbols == DWARF2_DEBUG) + && dwarf_debuginfo_p ()) flag_var_tracking_uninit = flag_var_tracking; /* Final check on PCI options; for Darwin these are not dependent on the PIE diff --git a/gcc/config/gcn/gcn-protos.h b/gcc/config/gcn/gcn-protos.h index dc9331c..8bd0b43 100644 --- a/gcc/config/gcn/gcn-protos.h +++ b/gcc/config/gcn/gcn-protos.h @@ -40,7 +40,7 @@ extern rtx gcn_gen_undef (machine_mode); extern bool gcn_global_address_p (rtx); extern tree gcn_goacc_adjust_propagation_record (tree record_type, bool sender, const char *name); -extern void gcn_goacc_adjust_gangprivate_decl (tree var); +extern tree gcn_goacc_adjust_private_decl (location_t, tree var, int level); extern void gcn_goacc_reduction (gcall *call); extern bool gcn_hard_regno_rename_ok (unsigned int from_reg, unsigned int to_reg); diff --git a/gcc/config/gcn/gcn-tree.c b/gcc/config/gcn/gcn-tree.c index 8f27099..1eb8882 100644 --- a/gcc/config/gcn/gcn-tree.c +++ b/gcc/config/gcn/gcn-tree.c @@ -577,9 +577,12 @@ gcn_goacc_adjust_propagation_record (tree record_type, bool sender, return decl; } -void -gcn_goacc_adjust_gangprivate_decl (tree var) +tree +gcn_goacc_adjust_private_decl (location_t, tree var, int level) { + if (level != GOMP_DIM_GANG) + return var; + tree type = TREE_TYPE (var); tree lds_type = build_qualified_type (type, TYPE_QUALS_NO_ADDR_SPACE (type) @@ -597,6 +600,8 @@ gcn_goacc_adjust_gangprivate_decl (tree var) if (machfun) machfun->use_flat_addressing = true; + + return var; } /* }}} */ diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 9660ca6..283a91f 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -6320,8 +6320,8 @@ gcn_dwarf_register_span (rtx rtl) #undef TARGET_GOACC_ADJUST_PROPAGATION_RECORD #define TARGET_GOACC_ADJUST_PROPAGATION_RECORD \ gcn_goacc_adjust_propagation_record -#undef TARGET_GOACC_ADJUST_GANGPRIVATE_DECL -#define TARGET_GOACC_ADJUST_GANGPRIVATE_DECL gcn_goacc_adjust_gangprivate_decl +#undef TARGET_GOACC_ADJUST_PRIVATE_DECL +#define TARGET_GOACC_ADJUST_PRIVATE_DECL gcn_goacc_adjust_private_decl #undef TARGET_GOACC_FORK_JOIN #define TARGET_GOACC_FORK_JOIN gcn_fork_join #undef TARGET_GOACC_REDUCTION diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index cfbca34..ac458cd 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see #undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) \ (TARGET_64BIT ? dbx64_register_map[n] \ - : (write_symbols == DWARF2_DEBUG \ + : (dwarf_debuginfo_p () \ ? svr4_dbx_register_map[n] : dbx_register_map[n])) /* Map gcc register number to DWARF 2 CFA column number. For 32 bit diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index afa9f1b..5312003 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -275,13 +275,13 @@ along with GCC; see the file COPYING3. If not see #undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) \ (TARGET_64BIT ? dbx64_register_map[n] \ - : write_symbols == DWARF2_DEBUG ? svr4_dbx_register_map[n] \ + : dwarf_debuginfo_p () ? svr4_dbx_register_map[n] \ : dbx_register_map[n]) /* Unfortunately, the 32-bit EH information also doesn't use the standard DWARF register numbers. */ #define DWARF2_FRAME_REG_OUT(n, for_eh) \ - (! (for_eh) || write_symbols != DWARF2_DEBUG || TARGET_64BIT ? (n) \ + (! (for_eh) || !dwarf_debuginfo_p () || TARGET_64BIT ? (n) \ : (n) == 5 ? 4 \ : (n) == 4 ? 5 \ : (n) >= 11 && (n) <= 18 ? (n) + 1 \ diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 0fa8d45..931b336 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -154,9 +154,13 @@ split_double_mode (machine_mode mode, rtx operands[], lo_half[num] = simplify_gen_subreg (half_mode, op, GET_MODE (op) == VOIDmode ? mode : GET_MODE (op), 0); - hi_half[num] = simplify_gen_subreg (half_mode, op, - GET_MODE (op) == VOIDmode - ? mode : GET_MODE (op), byte); + + rtx tmp = simplify_gen_subreg (half_mode, op, + GET_MODE (op) == VOIDmode + ? mode : GET_MODE (op), byte); + /* simplify_gen_subreg will return NULL RTX for the + high half of the paradoxical subreg. */ + hi_half[num] = tmp ? tmp : gen_reg_rtx (half_mode); } } } @@ -3717,7 +3721,7 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false) { op_true = force_reg (mode, op_true); - gen = gen_mmx_pblendvb; + gen = gen_mmx_pblendvb64; if (mode != V8QImode) d = gen_reg_rtx (V8QImode); op_false = gen_lowpart (V8QImode, op_false); @@ -3725,6 +3729,20 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false) cmp = gen_lowpart (V8QImode, cmp); } break; + case E_V4QImode: + case E_V2HImode: + if (TARGET_SSE4_1) + { + op_true = force_reg (mode, op_true); + + gen = gen_mmx_pblendvb32; + if (mode != V4QImode) + d = gen_reg_rtx (V4QImode); + op_false = gen_lowpart (V4QImode, op_false); + op_true = gen_lowpart (V4QImode, op_true); + cmp = gen_lowpart (V4QImode, cmp); + } + break; case E_V16QImode: case E_V8HImode: case E_V4SImode: @@ -4237,6 +4255,12 @@ ix86_expand_int_sse_cmp (rtx dest, enum rtx_code code, rtx cop0, rtx cop1, else if (code == GT && TARGET_SSE4_1) gen = gen_sminv8qi3; break; + case E_V4QImode: + if (code == GTU && TARGET_SSE2) + gen = gen_uminv4qi3; + else if (code == GT && TARGET_SSE4_1) + gen = gen_sminv4qi3; + break; case E_V8HImode: if (code == GTU && TARGET_SSE4_1) gen = gen_uminv8hi3; @@ -4249,6 +4273,12 @@ ix86_expand_int_sse_cmp (rtx dest, enum rtx_code code, rtx cop0, rtx cop1, else if (code == GT && TARGET_SSE2) gen = gen_sminv4hi3; break; + case E_V2HImode: + if (code == GTU && TARGET_SSE4_1) + gen = gen_uminv2hi3; + else if (code == GT && TARGET_SSE2) + gen = gen_sminv2hi3; + break; case E_V4SImode: if (TARGET_SSE4_1) gen = (code == GTU) ? gen_uminv4si3 : gen_sminv4si3; @@ -4323,8 +4353,10 @@ ix86_expand_int_sse_cmp (rtx dest, enum rtx_code code, rtx cop0, rtx cop1, case E_V16HImode: case E_V16QImode: case E_V8QImode: + case E_V4QImode: case E_V8HImode: case E_V4HImode: + case E_V2HImode: /* Perform a parallel unsigned saturating subtraction. */ x = gen_reg_rtx (mode); emit_insn (gen_rtx_SET diff --git a/gcc/config/i386/i386-modes.def b/gcc/config/i386/i386-modes.def index dbddfd8..4e7014b 100644 --- a/gcc/config/i386/i386-modes.def +++ b/gcc/config/i386/i386-modes.def @@ -107,19 +107,10 @@ INT_MODE (XI, 64); PARTIAL_INT_MODE (HI, 16, P2QI); PARTIAL_INT_MODE (SI, 32, P2HI); -/* Mode used for signed overflow checking of TImode. As - MAX_BITSIZE_MODE_ANY_INT is only 160, wide-int.h reserves only that - rounded up to multiple of HOST_BITS_PER_WIDE_INT bits in wide_int etc., - so OImode is too large. For the overflow checking we actually need - just 1 or 2 bits beyond TImode precision. Use 160 bits to have - a multiple of 32. */ +/* Mode used for signed overflow checking of TImode. For the overflow + checking we actually need just 1 or 2 bits beyond TImode precision. + Use 160 bits to have a multiple of 32. */ PARTIAL_INT_MODE (OI, 160, POI); -/* Keep the OI and XI modes from confusing the compiler into thinking - that these modes could actually be used for computation. They are - only holders for vectors during data movement. Include POImode precision - though. */ -#define MAX_BITSIZE_MODE_ANY_INT (160) - /* The symbol Pmode stands for one of the above machine modes (usually SImode). The tm.h file specifies which one. It is not a distinct mode. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 743d8a2..28e6113 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -17991,21 +17991,24 @@ ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi) gcc_assert (n_args == 2); arg0 = gimple_call_arg (stmt, 0); arg1 = gimple_call_arg (stmt, 1); - { - location_t loc = gimple_location (stmt); - tree type = TREE_TYPE (arg0); - tree zero_vec = build_zero_cst (type); - tree minus_one_vec = build_minus_one_cst (type); - tree cmp_type = truth_type_for (type); - gimple_seq stmts = NULL; - tree cmp = gimple_build (&stmts, tcode, cmp_type, arg0, arg1); - gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); - gimple* g = gimple_build_assign (gimple_call_lhs (stmt), - VEC_COND_EXPR, cmp, - minus_one_vec, zero_vec); - gimple_set_location (g, loc); - gsi_replace (gsi, g, false); - } + if (gimple_call_lhs (stmt)) + { + location_t loc = gimple_location (stmt); + tree type = TREE_TYPE (arg0); + tree zero_vec = build_zero_cst (type); + tree minus_one_vec = build_minus_one_cst (type); + tree cmp_type = truth_type_for (type); + gimple_seq stmts = NULL; + tree cmp = gimple_build (&stmts, tcode, cmp_type, arg0, arg1); + gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); + gimple* g = gimple_build_assign (gimple_call_lhs (stmt), + VEC_COND_EXPR, cmp, + minus_one_vec, zero_vec); + gimple_set_location (g, loc); + gsi_replace (gsi, g, false); + } + else + gsi_replace (gsi, gimple_build_nop (), false); return true; case IX86_BUILTIN_PSLLD: @@ -22482,7 +22485,11 @@ ix86_add_stmt_cost (class vec_info *vinfo, void *data, int count, arbitrary and could potentially be improved with analysis. */ if (where == vect_body && stmt_info && stmt_in_inner_loop_p (vinfo, stmt_info)) - count *= 50; /* FIXME. */ + { + loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo); + gcc_assert (loop_vinfo); + count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME. */ + } retval = (unsigned) (count * stmt_cost); diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 97d6f38..53d503f 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1007,6 +1007,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define VALID_SSE2_REG_MODE(MODE) \ ((MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DFmode \ + || (MODE) == V4QImode || (MODE) == V2HImode \ || (MODE) == V2DImode || (MODE) == DFmode) #define VALID_SSE_REG_MODE(MODE) \ @@ -1034,12 +1035,16 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); || (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \ #define VALID_INT_MODE_P(MODE) \ - ((MODE) == QImode || (MODE) == HImode || (MODE) == SImode \ - || (MODE) == DImode \ - || (MODE) == CQImode || (MODE) == CHImode || (MODE) == CSImode \ - || (MODE) == CDImode \ - || (TARGET_64BIT && ((MODE) == TImode || (MODE) == CTImode \ - || (MODE) == TFmode || (MODE) == TCmode))) + ((MODE) == QImode || (MODE) == HImode \ + || (MODE) == SImode || (MODE) == DImode \ + || (MODE) == CQImode || (MODE) == CHImode \ + || (MODE) == CSImode || (MODE) == CDImode \ + || (MODE) == V4QImode || (MODE) == V2HImode \ + || (TARGET_64BIT \ + && ((MODE) == TImode || (MODE) == CTImode \ + || (MODE) == TFmode || (MODE) == TCmode \ + || (MODE) == V8QImode || (MODE) == V4HImode \ + || (MODE) == V2SImode))) /* Return true for modes passed in SSE registers. */ #define SSE_REG_MODE_P(MODE) \ diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 74e924f..960ecbd 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -815,11 +815,12 @@ (define_attr "movu" "0,1" (const_string "0")) ;; Used to control the "enabled" attribute on a per-instruction basis. -(define_attr "isa" "base,x64,x64_sse2,x64_sse4,x64_sse4_noavx,x64_avx,nox64, +(define_attr "isa" "base,x64,nox64,x64_sse2,x64_sse4,x64_sse4_noavx, + x64_avx,x64_avx512bw,x64_avx512dq, sse_noavx,sse2,sse2_noavx,sse3,sse3_noavx,sse4,sse4_noavx, avx,noavx,avx2,noavx2,bmi,bmi2,fma4,fma,avx512f,noavx512f, avx512bw,noavx512bw,avx512dq,noavx512dq, - avx512vl,noavx512vl,x64_avx512dq,x64_avx512bw, + avx512vl,noavx512vl, avxvnni,avx512vnnivl" (const_string "base")) @@ -829,6 +830,7 @@ (define_attr "enabled" "" (cond [(eq_attr "isa" "x64") (symbol_ref "TARGET_64BIT") + (eq_attr "isa" "nox64") (symbol_ref "!TARGET_64BIT") (eq_attr "isa" "x64_sse2") (symbol_ref "TARGET_64BIT && TARGET_SSE2") (eq_attr "isa" "x64_sse4") @@ -837,14 +839,13 @@ (symbol_ref "TARGET_64BIT && TARGET_SSE4_1 && !TARGET_AVX") (eq_attr "isa" "x64_avx") (symbol_ref "TARGET_64BIT && TARGET_AVX") - (eq_attr "isa" "x64_avx512dq") - (symbol_ref "TARGET_64BIT && TARGET_AVX512DQ") (eq_attr "isa" "x64_avx512bw") (symbol_ref "TARGET_64BIT && TARGET_AVX512BW") - (eq_attr "isa" "nox64") (symbol_ref "!TARGET_64BIT") - (eq_attr "isa" "sse2") (symbol_ref "TARGET_SSE2") + (eq_attr "isa" "x64_avx512dq") + (symbol_ref "TARGET_64BIT && TARGET_AVX512DQ") (eq_attr "isa" "sse_noavx") (symbol_ref "TARGET_SSE && !TARGET_AVX") + (eq_attr "isa" "sse2") (symbol_ref "TARGET_SSE2") (eq_attr "isa" "sse2_noavx") (symbol_ref "TARGET_SSE2 && !TARGET_AVX") (eq_attr "isa" "sse3") (symbol_ref "TARGET_SSE3") diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 7fc2e5d..453e8ea 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -57,11 +57,15 @@ (define_mode_iterator MMXMODE24 [V4HI V2SI]) (define_mode_iterator MMXMODE248 [V4HI V2SI V1DI]) +;; All 32bit integer vector modes +(define_mode_iterator VI_32 [V4QI V2HI]) + ;; All V2S* modes (define_mode_iterator V2FI [V2SF V2SI]) ;; Mapping from integer vector mode to mnemonic suffix -(define_mode_attr mmxvecsize [(V8QI "b") (V4HI "w") (V2SI "d") (V1DI "q")]) +(define_mode_attr mmxvecsize + [(V8QI "b") (V4QI "b") (V4HI "w") (V2HI "w") (V2SI "d") (V1DI "q")]) (define_mode_attr mmxdoublemode [(V8QI "V8HI") (V4HI "V4SI")]) @@ -233,6 +237,113 @@ DONE; }) +(define_expand "mov<mode>" + [(set (match_operand:VI_32 0 "nonimmediate_operand") + (match_operand:VI_32 1 "nonimmediate_operand"))] + "TARGET_SSE2" +{ + ix86_expand_vector_move (<MODE>mode, operands); + DONE; +}) + +(define_insn "*mov<mode>_internal" + [(set (match_operand:VI_32 0 "nonimmediate_operand" + "=r ,m ,v,v,v,m,r,v") + (match_operand:VI_32 1 "general_operand" + "rmC,rC,C,v,m,v,v,r"))] + "TARGET_SSE2 && + !(MEM_P (operands[0]) && MEM_P (operands[1]))" +{ + switch (get_attr_type (insn)) + { + case TYPE_IMOV: + return "mov{l}\t{%1, %0|%0, %1}"; + + case TYPE_SSELOG1: + return standard_sse_constant_opcode (insn, operands); + + case TYPE_SSEMOV: + return ix86_output_ssemov (insn, operands); + + default: + gcc_unreachable (); + } +} + [(set (attr "type") + (cond [(eq_attr "alternative" "2") + (const_string "sselog1") + (eq_attr "alternative" "3,4,5,6,7") + (const_string "ssemov") + ] + (const_string "imov"))) + (set (attr "prefix") + (if_then_else (eq_attr "type" "sselog1,ssemov") + (const_string "maybe_vex") + (const_string "orig"))) + (set (attr "prefix_data16") + (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI")) + (const_string "1") + (const_string "*"))) + (set (attr "mode") + (cond [(eq_attr "alternative" "2,3") + (cond [(match_test "TARGET_AVX") + (const_string "TI") + (match_test "optimize_function_for_size_p (cfun)") + (const_string "V4SF") + ] + (const_string "TI")) + ] + (const_string "SI"))) + (set (attr "preferred_for_speed") + (cond [(eq_attr "alternative" "6") + (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") + (eq_attr "alternative" "7") + (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") + ] + (symbol_ref "true")))]) + +;; For TARGET_64BIT we always round up to 8 bytes. +(define_insn "*push<mode>2_rex64" + [(set (match_operand:VI_32 0 "push_operand" "=X,X") + (match_operand:VI_32 1 "nonmemory_no_elim_operand" "rC,*v"))] + "TARGET_SSE2 && TARGET_64BIT" + "@ + push{q}\t%q1 + #" + [(set_attr "type" "push,multi") + (set_attr "mode" "DI")]) + +(define_insn "*push<mode>2" + [(set (match_operand:VI_32 0 "push_operand" "=<,<") + (match_operand:VI_32 1 "general_no_elim_operand" "rC*m,*v"))] + "TARGET_SSE2 && !TARGET_64BIT" + "@ + push{l}\t%1 + #" + [(set_attr "type" "push,multi") + (set_attr "mode" "SI")]) + +(define_split + [(set (match_operand:VI_32 0 "push_operand") + (match_operand:VI_32 1 "sse_reg_operand"))] + "TARGET_SSE2 && reload_completed" + [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) + (set (match_dup 0) (match_dup 1))] +{ + operands[2] = GEN_INT (-PUSH_ROUNDING (GET_MODE_SIZE (<VI_32:MODE>mode))); + /* Preserve memory attributes. */ + operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); +}) + +(define_expand "movmisalign<mode>" + [(set (match_operand:VI_32 0 "nonimmediate_operand") + (match_operand:VI_32 1 "nonimmediate_operand"))] + "TARGET_SSE2" +{ + ix86_expand_vector_move (<MODE>mode, operands); + DONE; +}) + (define_insn "sse_movntq" [(set (match_operand:DI 0 "memory_operand" "=m,m") (unspec:DI [(match_operand:DI 1 "register_operand" "y,r")] @@ -1229,6 +1340,14 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(define_expand "neg<mode>2" + [(set (match_operand:MMXMODEI 0 "register_operand") + (minus:MMXMODEI + (match_dup 2) + (match_operand:MMXMODEI 1 "register_operand")))] + "TARGET_MMX_WITH_SSE" + "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));") + (define_expand "mmx_<insn><mode>3" [(set (match_operand:MMXMODEI8 0 "register_operand") (plusminus:MMXMODEI8 @@ -1248,8 +1367,10 @@ (define_insn "*mmx_<insn><mode>3" [(set (match_operand:MMXMODEI8 0 "register_operand" "=y,x,<Yv_Yw>") (plusminus:MMXMODEI8 - (match_operand:MMXMODEI8 1 "register_mmxmem_operand" "<comm>0,0,<Yv_Yw>") - (match_operand:MMXMODEI8 2 "register_mmxmem_operand" "ym,x,<Yv_Yw>")))] + (match_operand:MMXMODEI8 1 "register_mmxmem_operand" + "<comm>0,0,<Yv_Yw>") + (match_operand:MMXMODEI8 2 "register_mmxmem_operand" + "ym,x,<Yv_Yw>")))] "(TARGET_MMX || TARGET_MMX_WITH_SSE) && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)" "@ @@ -1261,6 +1382,36 @@ (set_attr "type" "mmxadd,sseadd,sseadd") (set_attr "mode" "DI,TI,TI")]) +(define_expand "neg<mode>2" + [(set (match_operand:VI_32 0 "register_operand") + (minus:VI_32 + (match_dup 2) + (match_operand:VI_32 1 "register_operand")))] + "TARGET_SSE2" + "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));") + +(define_expand "<insn><mode>3" + [(set (match_operand:VI_32 0 "register_operand") + (plusminus:VI_32 + (match_operand:VI_32 1 "register_operand") + (match_operand:VI_32 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);") + +(define_insn "*<insn><mode>3" + [(set (match_operand:VI_32 0 "register_operand" "=x,Yw") + (plusminus:VI_32 + (match_operand:VI_32 1 "register_operand" "<comm>0,Yw") + (match_operand:VI_32 2 "register_operand" "x,Yw")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)" + "@ + p<plusminus_mnemonic><mmxvecsize>\t{%2, %0|%0, %2} + vp<plusminus_mnemonic><mmxvecsize>\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sseadd") + (set_attr "mode" "TI")]) + (define_expand "mmx_<insn><mode>3" [(set (match_operand:MMXMODE12 0 "register_operand") (sat_plusminus:MMXMODE12 @@ -1285,6 +1436,20 @@ (set_attr "type" "mmxadd,sseadd,sseadd") (set_attr "mode" "DI,TI,TI")]) +(define_insn "*<insn><mode>3" + [(set (match_operand:VI_32 0 "register_operand" "=x,Yw") + (sat_plusminus:VI_32 + (match_operand:VI_32 1 "register_operand" "<comm>0,Yw") + (match_operand:VI_32 2 "register_operand" "x,Yw")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)" + "@ + p<plusminus_mnemonic><mmxvecsize>\t{%2, %0|%0, %2} + vp<plusminus_mnemonic><mmxvecsize>\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sseadd") + (set_attr "mode" "TI")]) + (define_expand "mmx_mulv4hi3" [(set (match_operand:V4HI 0 "register_operand") (mult:V4HI (match_operand:V4HI 1 "register_mmxmem_operand") @@ -1314,6 +1479,26 @@ (set_attr "type" "mmxmul,ssemul,ssemul") (set_attr "mode" "DI,TI,TI")]) +(define_expand "mulv2hi3" + [(set (match_operand:V2HI 0 "register_operand") + (mult:V2HI (match_operand:V2HI 1 "register_operand") + (match_operand:V2HI 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (MULT, V2HImode, operands);") + +(define_insn "*mulv2hi3" + [(set (match_operand:V2HI 0 "register_operand" "=x,Yw") + (mult:V2HI (match_operand:V2HI 1 "register_operand" "%0,Yw") + (match_operand:V2HI 2 "register_operand" "x,Yw")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (MULT, V2HImode, operands)" + "@ + pmullw\t{%2, %0|%0, %2} + vpmullw\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "ssemul") + (set_attr "mode" "TI")]) + (define_expand "mmx_smulv4hi3_highpart" [(set (match_operand:V4HI 0 "register_operand") (truncate:V4HI @@ -1384,6 +1569,51 @@ (set_attr "type" "mmxmul,ssemul,ssemul") (set_attr "mode" "DI,TI,TI")]) +(define_expand "<s>mulv4hi3_highpart" + [(set (match_operand:V4HI 0 "register_operand") + (truncate:V4HI + (lshiftrt:V4SI + (mult:V4SI + (any_extend:V4SI + (match_operand:V4HI 1 "register_operand")) + (any_extend:V4SI + (match_operand:V4HI 2 "register_operand"))) + (const_int 16))))] + "TARGET_MMX_WITH_SSE" + "ix86_fixup_binary_operands_no_copy (MULT, V4HImode, operands);") + +(define_insn "*<s>mulv2hi3_highpart" + [(set (match_operand:V2HI 0 "register_operand" "=x,Yw") + (truncate:V2HI + (lshiftrt:V2SI + (mult:V2SI + (any_extend:V2SI + (match_operand:V2HI 1 "register_operand" "%0,Yw")) + (any_extend:V2SI + (match_operand:V2HI 2 "register_operand" "x,Yw"))) + (const_int 16))))] + "TARGET_SSE2 + && ix86_binary_operator_ok (MULT, V2HImode, operands)" + "@ + pmulh<u>w\t{%2, %0|%0, %2} + vpmulh<u>w\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "ssemul") + (set_attr "mode" "TI")]) + +(define_expand "<s>mulv2hi3_highpart" + [(set (match_operand:V2HI 0 "register_operand") + (truncate:V2HI + (lshiftrt:V2SI + (mult:V2SI + (any_extend:V2SI + (match_operand:V2HI 1 "register_operand")) + (any_extend:V2SI + (match_operand:V2HI 2 "register_operand"))) + (const_int 16))))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (MULT, V2HImode, operands);") + (define_expand "mmx_pmaddwd" [(set (match_operand:V2SI 0 "register_operand") (plus:V2SI @@ -1508,13 +1738,11 @@ (set_attr "type" "mmxmul,ssemul,ssemul") (set_attr "mode" "DI,TI,TI")]) -(define_expand "<code><mode>3" - [(set (match_operand:MMXMODE14 0 "register_operand") - (smaxmin:MMXMODE14 - (match_operand:MMXMODE14 1 "register_operand") - (match_operand:MMXMODE14 2 "register_operand")))] - "TARGET_MMX_WITH_SSE && TARGET_SSE4_1" - "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);") +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Parallel integral shifts +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define_insn "*mmx_<code><mode>3" [(set (match_operand:MMXMODE14 0 "register_operand" "=Yr,*x,Yv") @@ -1542,14 +1770,6 @@ && (TARGET_SSE || TARGET_3DNOW_A)" "ix86_fixup_binary_operands_no_copy (<CODE>, V4HImode, operands);") -(define_expand "<code>v4hi3" - [(set (match_operand:V4HI 0 "register_operand") - (smaxmin:V4HI - (match_operand:V4HI 1 "register_operand") - (match_operand:V4HI 2 "register_operand")))] - "TARGET_MMX_WITH_SSE" - "ix86_fixup_binary_operands_no_copy (<CODE>, V4HImode, operands);") - (define_insn "*mmx_<code>v4hi3" [(set (match_operand:V4HI 0 "register_operand" "=y,x,Yw") (smaxmin:V4HI @@ -1567,14 +1787,58 @@ (set_attr "type" "mmxadd,sseiadd,sseiadd") (set_attr "mode" "DI,TI,TI")]) +(define_mode_iterator SMAXMIN_MMXMODEI + [(V8QI "TARGET_SSE4_1") V4HI (V2SI "TARGET_SSE4_1")]) + (define_expand "<code><mode>3" - [(set (match_operand:MMXMODE24 0 "register_operand") - (umaxmin:MMXMODE24 - (match_operand:MMXMODE24 1 "register_operand") - (match_operand:MMXMODE24 2 "register_operand")))] - "TARGET_MMX_WITH_SSE && TARGET_SSE4_1" + [(set (match_operand:SMAXMIN_MMXMODEI 0 "register_operand") + (smaxmin:SMAXMIN_MMXMODEI + (match_operand:SMAXMIN_MMXMODEI 1 "register_operand") + (match_operand:SMAXMIN_MMXMODEI 2 "register_operand")))] + "TARGET_MMX_WITH_SSE" "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);") +(define_insn "*<code>v4qi3" + [(set (match_operand:V4QI 0 "register_operand" "=Yr,*x,Yv") + (smaxmin:V4QI + (match_operand:V4QI 1 "register_operand" "%0,0,Yv") + (match_operand:V4QI 2 "register_operand" "Yr,*x,Yv")))] + "TARGET_SSE4_1 + && ix86_binary_operator_ok (<CODE>, V4QImode, operands)" + "@ + p<maxmin_int>b\t{%2, %0|%0, %2} + p<maxmin_int>b\t{%2, %0|%0, %2} + vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,noavx,avx") + (set_attr "type" "sseiadd") + (set_attr "prefix_extra" "1,1,*") + (set_attr "prefix" "orig,orig,vex") + (set_attr "mode" "TI")]) + +(define_insn "*<code>v2hi3" + [(set (match_operand:V2HI 0 "register_operand" "=x,Yw") + (smaxmin:V2HI + (match_operand:V2HI 1 "register_operand" "%0,Yw") + (match_operand:V2HI 2 "register_operand" "x,Yw")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (<CODE>, V2HImode, operands)" + "@ + p<maxmin_int>w\t{%2, %0|%0, %2} + vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sseiadd") + (set_attr "mode" "TI")]) + +(define_mode_iterator SMAXMIN_VI_32 [(V4QI "TARGET_SSE4_1") V2HI]) + +(define_expand "<code><mode>3" + [(set (match_operand:SMAXMIN_VI_32 0 "register_operand") + (smaxmin:SMAXMIN_VI_32 + (match_operand:SMAXMIN_VI_32 1 "register_operand") + (match_operand:SMAXMIN_VI_32 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (<CODE>, V4HImode, operands);") + (define_insn "*mmx_<code><mode>3" [(set (match_operand:MMXMODE24 0 "register_operand" "=Yr,*x,Yv") (umaxmin:MMXMODE24 @@ -1601,14 +1865,6 @@ && (TARGET_SSE || TARGET_3DNOW_A)" "ix86_fixup_binary_operands_no_copy (<CODE>, V8QImode, operands);") -(define_expand "<code>v8qi3" - [(set (match_operand:V8QI 0 "register_operand") - (umaxmin:V8QI - (match_operand:V8QI 1 "register_operand") - (match_operand:V8QI 2 "register_operand")))] - "TARGET_MMX_WITH_SSE" - "ix86_fixup_binary_operands_no_copy (<CODE>, V8QImode, operands);") - (define_insn "*mmx_<code>v8qi3" [(set (match_operand:V8QI 0 "register_operand" "=y,x,Yw") (umaxmin:V8QI @@ -1626,6 +1882,97 @@ (set_attr "type" "mmxadd,sseiadd,sseiadd") (set_attr "mode" "DI,TI,TI")]) +(define_mode_iterator UMAXMIN_MMXMODEI + [V8QI (V4HI "TARGET_SSE4_1") (V2SI "TARGET_SSE4_1")]) + +(define_expand "<code><mode>3" + [(set (match_operand:UMAXMIN_MMXMODEI 0 "register_operand") + (umaxmin:UMAXMIN_MMXMODEI + (match_operand:UMAXMIN_MMXMODEI 1 "register_operand") + (match_operand:UMAXMIN_MMXMODEI 2 "register_operand")))] + "TARGET_MMX_WITH_SSE" + "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);") + +(define_insn "*<code>v4qi3" + [(set (match_operand:V4QI 0 "register_operand" "=x,Yw") + (umaxmin:V4QI + (match_operand:V4QI 1 "register_operand" "%0,Yw") + (match_operand:V4QI 2 "register_operand" "x,Yw")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (<CODE>, V4QImode, operands)" + "@ + p<maxmin_int>b\t{%2, %0|%0, %2} + vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sseiadd") + (set_attr "mode" "TI")]) + +(define_insn "*<code>v2hi3" + [(set (match_operand:V2HI 0 "register_operand" "=Yr,*x,Yv") + (umaxmin:V2HI + (match_operand:V2HI 1 "register_operand" "%0,0,Yv") + (match_operand:V2HI 2 "register_operand" "Yr,*x,Yv")))] + "TARGET_SSE4_1 + && ix86_binary_operator_ok (<CODE>, V2HImode, operands)" + "@ + p<maxmin_int>w\t{%2, %0|%0, %2} + p<maxmin_int>w\t{%2, %0|%0, %2} + vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,noavx,avx") + (set_attr "type" "sseiadd") + (set_attr "prefix_extra" "1,1,*") + (set_attr "prefix" "orig,orig,vex") + (set_attr "mode" "TI")]) + +(define_mode_iterator UMAXMIN_VI_32 [V4QI (V2HI "TARGET_SSE4_1")]) + +(define_expand "<code><mode>3" + [(set (match_operand:UMAXMIN_VI_32 0 "register_operand") + (umaxmin:UMAXMIN_VI_32 + (match_operand:UMAXMIN_VI_32 1 "register_operand") + (match_operand:UMAXMIN_VI_32 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (<CODE>, V4HImode, operands);") + +(define_insn "ssse3_abs<mode>2" + [(set (match_operand:MMXMODEI 0 "register_operand" "=y,Yv") + (abs:MMXMODEI + (match_operand:MMXMODEI 1 "register_mmxmem_operand" "ym,Yv")))] + "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3" + "@ + pabs<mmxvecsize>\t{%1, %0|%0, %1} + %vpabs<mmxvecsize>\t{%1, %0|%0, %1}" + [(set_attr "mmx_isa" "native,*") + (set_attr "type" "sselog1") + (set_attr "prefix_rep" "0") + (set_attr "prefix_extra" "1") + (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)")) + (set_attr "mode" "DI,TI")]) + +(define_expand "abs<mode>2" + [(set (match_operand:MMXMODEI 0 "register_operand") + (abs:MMXMODEI + (match_operand:MMXMODEI 1 "register_operand")))] + "TARGET_MMX_WITH_SSE && TARGET_SSSE3") + +(define_insn "abs<mode>2" + [(set (match_operand:VI_32 0 "register_operand" "=Yv") + (abs:VI_32 + (match_operand:VI_32 1 "register_operand" "Yv")))] + "TARGET_SSSE3" + "%vpabs<mmxvecsize>\t{%1, %0|%0, %1}" + [(set_attr "type" "sselog1") + (set_attr "prefix_rep" "0") + (set_attr "prefix_extra" "1") + (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)")) + (set_attr "mode" "TI")]) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Parallel integral shifts +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (define_insn "mmx_ashr<mode>3" [(set (match_operand:MMXMODE24 0 "register_operand" "=y,x,<Yv_Yw>") (ashiftrt:MMXMODE24 @@ -1678,6 +2025,30 @@ (match_operand:DI 2 "nonmemory_operand")))] "TARGET_MMX_WITH_SSE") +(define_insn "*<insn>v2hi3" + [(set (match_operand:V2HI 0 "register_operand" "=x,Yw") + (any_shift:V2HI + (match_operand:V2HI 1 "register_operand" "0,Yw") + (match_operand:DI 2 "nonmemory_operand" "xN,YwN")))] + "TARGET_SSE2" + "@ + p<vshift>w\t{%2, %0|%0, %2} + vp<vshift>w\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sseishft") + (set (attr "length_immediate") + (if_then_else (match_operand 2 "const_int_operand") + (const_string "1") + (const_string "0"))) + (set_attr "mode" "TI")]) + +(define_expand "<insn>v2hi3" + [(set (match_operand:V2HI 0 "register_operand") + (any_shift:V2HI + (match_operand:V2HI 1 "register_operand") + (match_operand:DI 2 "nonmemory_operand")))] + "TARGET_SSE2") + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Parallel integral comparisons @@ -1708,6 +2079,20 @@ (set_attr "type" "mmxcmp,ssecmp,ssecmp") (set_attr "mode" "DI,TI,TI")]) +(define_insn "*eq<mode>3" + [(set (match_operand:VI_32 0 "register_operand" "=x,x") + (eq:VI_32 + (match_operand:VI_32 1 "register_operand" "%0,x") + (match_operand:VI_32 2 "register_operand" "x,x")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (EQ, <MODE>mode, operands)" + "@ + pcmpeq<mmxvecsize>\t{%2, %0|%0, %2} + vpcmpeq<mmxvecsize>\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "ssecmp") + (set_attr "mode" "TI")]) + (define_insn "mmx_gt<mode>3" [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,x") (gt:MMXMODEI @@ -1723,6 +2108,19 @@ (set_attr "type" "mmxcmp,ssecmp,ssecmp") (set_attr "mode" "DI,TI,TI")]) +(define_insn "*gt<mode>3" + [(set (match_operand:VI_32 0 "register_operand" "=x,x") + (gt:VI_32 + (match_operand:VI_32 1 "register_operand" "0,x") + (match_operand:VI_32 2 "register_operand" "x,x")))] + "TARGET_SSE2" + "@ + pcmpgt<mmxvecsize>\t{%2, %0|%0, %2} + vpcmpgt<mmxvecsize>\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "ssecmp") + (set_attr "mode" "TI")]) + (define_expand "vec_cmp<mode><mode>" [(set (match_operand:MMXMODEI 0 "register_operand") (match_operator:MMXMODEI 1 "" @@ -1735,6 +2133,18 @@ DONE; }) +(define_expand "vec_cmp<mode><mode>" + [(set (match_operand:VI_32 0 "register_operand") + (match_operator:VI_32 1 "" + [(match_operand:VI_32 2 "register_operand") + (match_operand:VI_32 3 "register_operand")]))] + "TARGET_SSE2" +{ + bool ok = ix86_expand_int_vec_cmp (operands); + gcc_assert (ok); + DONE; +}) + (define_expand "vec_cmpu<mode><mode>" [(set (match_operand:MMXMODEI 0 "register_operand") (match_operator:MMXMODEI 1 "" @@ -1747,6 +2157,18 @@ DONE; }) +(define_expand "vec_cmpu<mode><mode>" + [(set (match_operand:VI_32 0 "register_operand") + (match_operator:VI_32 1 "" + [(match_operand:VI_32 2 "register_operand") + (match_operand:VI_32 3 "register_operand")]))] + "TARGET_SSE2" +{ + bool ok = ix86_expand_int_vec_cmp (operands); + gcc_assert (ok); + DONE; +}) + (define_expand "vcond<MMXMODE124:mode><MMXMODEI:mode>" [(set (match_operand:MMXMODE124 0 "register_operand") (if_then_else:MMXMODE124 @@ -1764,6 +2186,21 @@ DONE; }) +(define_expand "vcond<mode><mode>" + [(set (match_operand:VI_32 0 "register_operand") + (if_then_else:VI_32 + (match_operator 3 "" + [(match_operand:VI_32 4 "register_operand") + (match_operand:VI_32 5 "register_operand")]) + (match_operand:VI_32 1) + (match_operand:VI_32 2)))] + "TARGET_SSE2" +{ + bool ok = ix86_expand_int_vcond (operands); + gcc_assert (ok); + DONE; +}) + (define_expand "vcondu<MMXMODE124:mode><MMXMODEI:mode>" [(set (match_operand:MMXMODE124 0 "register_operand") (if_then_else:MMXMODE124 @@ -1781,6 +2218,21 @@ DONE; }) +(define_expand "vcondu<mode><mode>" + [(set (match_operand:VI_32 0 "register_operand") + (if_then_else:VI_32 + (match_operator 3 "" + [(match_operand:VI_32 4 "register_operand") + (match_operand:VI_32 5 "register_operand")]) + (match_operand:VI_32 1) + (match_operand:VI_32 2)))] + "TARGET_SSE2" +{ + bool ok = ix86_expand_int_vcond (operands); + gcc_assert (ok); + DONE; +}) + (define_expand "vcond_mask_<mode><mmxintvecmodelower>" [(set (match_operand:MMXMODE124 0 "register_operand") (vec_merge:MMXMODE124 @@ -1794,7 +2246,20 @@ DONE; }) -(define_insn "mmx_pblendvb" +(define_expand "vcond_mask_<mode><mode>" + [(set (match_operand:VI_32 0 "register_operand") + (vec_merge:VI_32 + (match_operand:VI_32 1 "register_operand") + (match_operand:VI_32 2 "register_operand") + (match_operand:VI_32 3 "register_operand")))] + "TARGET_SSE2" +{ + ix86_expand_sse_movcc (operands[0], operands[3], + operands[1], operands[2]); + DONE; +}) + +(define_insn "mmx_pblendvb64" [(set (match_operand:V8QI 0 "register_operand" "=Yr,*x,x") (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0,0,x") @@ -1814,6 +2279,26 @@ (set_attr "btver2_decode" "vector") (set_attr "mode" "TI")]) +(define_insn "mmx_pblendvb32" + [(set (match_operand:V4QI 0 "register_operand" "=Yr,*x,x") + (unspec:V4QI + [(match_operand:V4QI 1 "register_operand" "0,0,x") + (match_operand:V4QI 2 "register_operand" "Yr,*x,x") + (match_operand:V4QI 3 "register_operand" "Yz,Yz,x")] + UNSPEC_BLENDV))] + "TARGET_SSE4_1" + "@ + pblendvb\t{%3, %2, %0|%0, %2, %3} + pblendvb\t{%3, %2, %0|%0, %2, %3} + vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}" + [(set_attr "isa" "noavx,noavx,avx") + (set_attr "type" "ssemov") + (set_attr "prefix_extra" "1") + (set_attr "length_immediate" "*,*,1") + (set_attr "prefix" "orig,orig,vex") + (set_attr "btver2_decode" "vector") + (set_attr "mode" "TI")]) + ;; XOP parallel XMM conditional moves (define_insn "*xop_pcmov_<mode>" [(set (match_operand:MMXMODE124 0 "register_operand" "=x") @@ -1825,6 +2310,16 @@ "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}" [(set_attr "type" "sse4arg")]) +(define_insn "*xop_pcmov_<mode>" + [(set (match_operand:VI_32 0 "register_operand" "=x") + (if_then_else:VI_32 + (match_operand:VI_32 3 "register_operand" "x") + (match_operand:VI_32 1 "register_operand" "x") + (match_operand:VI_32 2 "register_operand" "x")))] + "TARGET_XOP" + "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}" + [(set_attr "type" "sse4arg")]) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Parallel integral logical operations @@ -1839,6 +2334,14 @@ "TARGET_MMX_WITH_SSE" "operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));") +(define_expand "one_cmpl<mode>2" + [(set (match_operand:VI_32 0 "register_operand") + (xor:VI_32 + (match_operand:VI_32 1 "register_operand") + (match_dup 2)))] + "TARGET_SSE2" + "operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));") + (define_insn "mmx_andnot<mode>3" [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,x,v") (and:MMXMODEI @@ -1855,6 +2358,20 @@ (set_attr "type" "mmxadd,sselog,sselog,sselog") (set_attr "mode" "DI,TI,TI,TI")]) +(define_insn "*andnot<mode>3" + [(set (match_operand:VI_32 0 "register_operand" "=x,x,v") + (and:VI_32 + (not:VI_32 (match_operand:VI_32 1 "register_operand" "0,x,v")) + (match_operand:VI_32 2 "register_operand" "x,x,v")))] + "TARGET_SSE2" + "@ + pandn\t{%2, %0|%0, %2} + vpandn\t{%2, %1, %0|%0, %1, %2} + vpandnd\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx,avx512vl") + (set_attr "type" "sselog") + (set_attr "mode" "TI")]) + (define_expand "mmx_<code><mode>3" [(set (match_operand:MMXMODEI 0 "register_operand") (any_logic:MMXMODEI @@ -1888,6 +2405,29 @@ (set_attr "type" "mmxadd,sselog,sselog,sselog") (set_attr "mode" "DI,TI,TI,TI")]) +(define_expand "<code><mode>3" + [(set (match_operand:VI_32 0 "register_operand") + (any_logic:VI_32 + (match_operand:VI_32 1 "register_operand") + (match_operand:VI_32 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);") + +(define_insn "*<code><mode>3" + [(set (match_operand:VI_32 0 "register_operand" "=x,x,v") + (any_logic:VI_32 + (match_operand:VI_32 1 "register_operand" "%0,x,v") + (match_operand:VI_32 2 "register_operand" "x,x,v")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)" + "@ + p<logic>\t{%2, %0|%0, %2} + vp<logic>\t{%2, %1, %0|%0, %1, %2} + vp<logic>d\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx,avx512vl") + (set_attr "type" "sselog") + (set_attr "mode" "TI")]) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Parallel integral element swizzling diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 62f4e15f..7269147 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -17239,6 +17239,51 @@ (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)")) (set_attr "mode" "DI,TI,TI")]) +(define_expand "smulhrsv2hi3" + [(set (match_operand:V2HI 0 "register_operand") + (truncate:V2HI + (lshiftrt:V2SI + (plus:V2SI + (lshiftrt:V2SI + (mult:V2SI + (sign_extend:V2SI + (match_operand:V2HI 1 "register_operand")) + (sign_extend:V2SI + (match_operand:V2HI 2 "register_operand"))) + (const_int 14)) + (match_dup 3)) + (const_int 1))))] + "TARGET_SSSE3" +{ + operands[3] = CONST1_RTX(V2HImode); + ix86_fixup_binary_operands_no_copy (MULT, V2HImode, operands); +}) + +(define_insn "*smulhrsv2hi3" + [(set (match_operand:V2HI 0 "register_operand" "=x,Yv") + (truncate:V2HI + (lshiftrt:V2SI + (plus:V2SI + (lshiftrt:V2SI + (mult:V2SI + (sign_extend:V2SI + (match_operand:V2HI 1 "register_operand" "%0,Yv")) + (sign_extend:V2SI + (match_operand:V2HI 2 "register_operand" "x,Yv"))) + (const_int 14)) + (match_operand:V2HI 3 "const1_operand")) + (const_int 1))))] + "TARGET_SSSE3 + && !(MEM_P (operands[1]) && MEM_P (operands[2]))" + "@ + pmulhrsw\t{%2, %0|%0, %2} + vpmulhrsw\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sseimul") + (set_attr "prefix_extra" "1") + (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)")) + (set_attr "mode" "TI")]) + (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>" [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,<v_Yw>") (unspec:VI1_AVX512 @@ -17508,27 +17553,6 @@ } }) -(define_insn "ssse3_abs<mode>2" - [(set (match_operand:MMXMODEI 0 "register_operand" "=y,Yv") - (abs:MMXMODEI - (match_operand:MMXMODEI 1 "register_mmxmem_operand" "ym,Yv")))] - "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3" - "@ - pabs<mmxvecsize>\t{%1, %0|%0, %1} - %vpabs<mmxvecsize>\t{%1, %0|%0, %1}" - [(set_attr "mmx_isa" "native,*") - (set_attr "type" "sselog1") - (set_attr "prefix_rep" "0") - (set_attr "prefix_extra" "1") - (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)")) - (set_attr "mode" "DI,TI")]) - -(define_insn "abs<mode>2" - [(set (match_operand:MMXMODEI 0 "register_operand") - (abs:MMXMODEI - (match_operand:MMXMODEI 1 "register_operand")))] - "TARGET_MMX_WITH_SSE && TARGET_SSSE3") - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; AMD SSE4A instructions @@ -18558,8 +18582,8 @@ { if (!MEM_P (operands[1])) { - operands[1] = force_reg (V8QImode, operands[1]); - operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0); + operands[1] = force_reg (V4QImode, operands[1]); + operands[1] = simplify_gen_subreg (V16QImode, operands[1], V4QImode, 0); emit_insn (gen_avx2_<code>v4qiv4di2 (operands[0], operands[1])); DONE; } diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index e5ba273..1f1475c 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "context.h" #include "builtins.h" #include "rtl-iter.h" +#include "flags.h" /* This file should be included last. */ #include "target-def.h" @@ -9489,7 +9490,7 @@ mips_output_filename (FILE *stream, const char *name) { /* If we are emitting DWARF-2, let dwarf2out handle the ".file" directives. */ - if (write_symbols == DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) return; else if (mips_output_filename_first_time) { diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 722b0fa..6642bdf 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -75,6 +75,7 @@ #include "fold-const.h" #include "intl.h" #include "opts.h" +#include "tree-pretty-print.h" /* This file should be included last. */ #include "target-def.h" @@ -167,6 +168,12 @@ static unsigned vector_red_align; static unsigned vector_red_partition; static GTY(()) rtx vector_red_sym; +/* Shared memory block for gang-private variables. */ +static unsigned gang_private_shared_size; +static unsigned gang_private_shared_align; +static GTY(()) rtx gang_private_shared_sym; +static hash_map<tree_decl_hash, unsigned int> gang_private_shared_hmap; + /* Global lock variable, needed for 128bit worker & gang reductions. */ static GTY(()) tree global_lock_var; @@ -251,6 +258,10 @@ nvptx_option_override (void) vector_red_align = GET_MODE_ALIGNMENT (SImode) / BITS_PER_UNIT; vector_red_partition = 0; + gang_private_shared_sym = gen_rtx_SYMBOL_REF (Pmode, "__gang_private_shared"); + SET_SYMBOL_DATA_AREA (gang_private_shared_sym, DATA_AREA_SHARED); + gang_private_shared_align = GET_MODE_ALIGNMENT (SImode) / BITS_PER_UNIT; + diagnose_openacc_conflict (TARGET_GOMP, "-mgomp"); diagnose_openacc_conflict (TARGET_SOFT_STACK, "-msoft-stack"); diagnose_openacc_conflict (TARGET_UNIFORM_SIMT, "-muniform-simt"); @@ -5435,6 +5446,10 @@ nvptx_file_end (void) write_shared_buffer (asm_out_file, vector_red_sym, vector_red_align, vector_red_size); + if (gang_private_shared_size) + write_shared_buffer (asm_out_file, gang_private_shared_sym, + gang_private_shared_align, gang_private_shared_size); + if (need_softstack_decl) { write_var_marker (asm_out_file, false, true, "__nvptx_stacks"); @@ -6662,6 +6677,108 @@ nvptx_truly_noop_truncation (poly_uint64, poly_uint64) return false; } +/* Implement TARGET_GOACC_ADJUST_PRIVATE_DECL. */ + +static tree +nvptx_goacc_adjust_private_decl (location_t loc, tree decl, int level) +{ + gcc_checking_assert (!lookup_attribute ("oacc gang-private", + DECL_ATTRIBUTES (decl))); + + /* Set "oacc gang-private" attribute for gang-private variable + declarations. */ + if (level == GOMP_DIM_GANG) + { + tree id = get_identifier ("oacc gang-private"); + /* For later diagnostic purposes, pass LOC as VALUE (wrapped as a + TREE). */ + tree loc_tree = build_empty_stmt (loc); + DECL_ATTRIBUTES (decl) + = tree_cons (id, loc_tree, DECL_ATTRIBUTES (decl)); + } + + return decl; +} + +/* Implement TARGET_GOACC_EXPAND_VAR_DECL. */ + +static rtx +nvptx_goacc_expand_var_decl (tree var) +{ + /* Place "oacc gang-private" variables in shared memory. */ + if (tree attr = lookup_attribute ("oacc gang-private", + DECL_ATTRIBUTES (var))) + { + gcc_checking_assert (VAR_P (var)); + + unsigned int offset, *poffset; + poffset = gang_private_shared_hmap.get (var); + if (poffset) + offset = *poffset; + else + { + unsigned HOST_WIDE_INT align = DECL_ALIGN (var); + gang_private_shared_size + = (gang_private_shared_size + align - 1) & ~(align - 1); + if (gang_private_shared_align < align) + gang_private_shared_align = align; + + offset = gang_private_shared_size; + bool existed = gang_private_shared_hmap.put (var, offset); + gcc_checking_assert (!existed); + gang_private_shared_size += tree_to_uhwi (DECL_SIZE_UNIT (var)); + + location_t loc = EXPR_LOCATION (TREE_VALUE (attr)); +#if 0 /* For some reason, this doesn't work. */ + if (dump_enabled_p ()) + { + dump_flags_t l_dump_flags + = get_openacc_privatization_dump_flags (); + + const dump_user_location_t d_u_loc + = dump_user_location_t::from_location_t (loc); +/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat" +#endif + dump_printf_loc (l_dump_flags, d_u_loc, + "variable %<%T%> adjusted for OpenACC" + " privatization level: %qs\n", + var, "gang"); +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + } +#else /* ..., thus emulate that, good enough for testsuite usage. */ + if (param_openacc_privatization != OPENACC_PRIVATIZATION_QUIET) + inform (loc, + "variable %qD adjusted for OpenACC privatization level:" + " %qs", + var, "gang"); + if (dump_file && (dump_flags & TDF_DETAILS)) + { + /* 'dumpfile.c:dump_loc' */ + fprintf (dump_file, "%s:%d:%d: ", LOCATION_FILE (loc), + LOCATION_LINE (loc), LOCATION_COLUMN (loc)); + fprintf (dump_file, "%s: ", "note"); + + fprintf (dump_file, + "variable '"); + print_generic_expr (dump_file, var, TDF_SLIM); + fprintf (dump_file, + "' adjusted for OpenACC privatization level: '%s'\n", + "gang"); + } +#endif + } + rtx addr = plus_constant (Pmode, gang_private_shared_sym, offset); + return gen_rtx_MEM (TYPE_MODE (TREE_TYPE (var)), addr); + } + + return NULL_RTX; +} + static GTY(()) tree nvptx_previous_fndecl; static void @@ -6670,6 +6787,7 @@ nvptx_set_current_function (tree fndecl) if (!fndecl || fndecl == nvptx_previous_fndecl) return; + gang_private_shared_hmap.empty (); nvptx_previous_fndecl = fndecl; vector_red_partition = 0; oacc_bcast_partition = 0; @@ -6834,6 +6952,12 @@ nvptx_libc_has_function (enum function_class fn_class, tree type) #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed +#undef TARGET_GOACC_ADJUST_PRIVATE_DECL +#define TARGET_GOACC_ADJUST_PRIVATE_DECL nvptx_goacc_adjust_private_decl + +#undef TARGET_GOACC_EXPAND_VAR_DECL +#define TARGET_GOACC_EXPAND_VAR_DECL nvptx_goacc_expand_var_decl + #undef TARGET_SET_CURRENT_FUNCTION #define TARGET_SET_CURRENT_FUNCTION nvptx_set_current_function diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h index 11ea22e..7987983 100644 --- a/gcc/config/rs6000/freebsd64.h +++ b/gcc/config/rs6000/freebsd64.h @@ -306,12 +306,10 @@ extern int dot_symbols; /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ - (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ - ? 128 \ - : (TARGET_64BIT \ - && TARGET_ALIGN_NATURAL == 0 \ - && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ - ? MIN ((COMPUTED), 32) \ + ((TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ + && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ + ? MIN ((COMPUTED), 32) \ : (COMPUTED)) #undef TOC_SECTION_ASM_OP diff --git a/gcc/config/rs6000/fusion.md b/gcc/config/rs6000/fusion.md index 56478fc..4d810e6 100644 --- a/gcc/config/rs6000/fusion.md +++ b/gcc/config/rs6000/fusion.md @@ -35,7 +35,7 @@ (set (match_dup 2) (compare:CC (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -56,7 +56,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -77,7 +77,7 @@ (set (match_dup 2) (compare:CC (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -98,7 +98,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -119,7 +119,7 @@ (set (match_dup 2) (compare:CC (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -140,7 +140,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -161,7 +161,7 @@ (set (match_dup 2) (compare:CC (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -182,7 +182,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -203,7 +203,7 @@ (set (match_dup 2) (compare:CC (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -224,7 +224,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -245,7 +245,7 @@ (set (match_dup 2) (compare:CC (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -266,7 +266,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -287,7 +287,7 @@ (set (match_dup 2) (compare:CC (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -308,7 +308,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -329,7 +329,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -350,7 +350,7 @@ (set (match_dup 2) (compare:CCUNS (match_dup 0) (match_dup 3)))] "" - [(set_attr "type" "load") + [(set_attr "type" "fused_load_cmpi") (set_attr "cost" "8") (set_attr "length" "8")]) @@ -369,7 +369,7 @@ and %3,%1,%0\;and %3,%3,%2 and %3,%1,%0\;and %3,%3,%2 and %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -387,7 +387,7 @@ andc %3,%1,%0\;and %3,%3,%2 andc %3,%1,%0\;and %3,%3,%2 andc %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -405,7 +405,7 @@ eqv %3,%1,%0\;and %3,%3,%2 eqv %3,%1,%0\;and %3,%3,%2 eqv %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -423,7 +423,7 @@ nand %3,%1,%0\;and %3,%3,%2 nand %3,%1,%0\;and %3,%3,%2 nand %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -441,7 +441,7 @@ nor %3,%1,%0\;and %3,%3,%2 nor %3,%1,%0\;and %3,%3,%2 nor %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -459,7 +459,7 @@ or %3,%1,%0\;and %3,%3,%2 or %3,%1,%0\;and %3,%3,%2 or %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -477,7 +477,7 @@ orc %3,%1,%0\;and %3,%3,%2 orc %3,%1,%0\;and %3,%3,%2 orc %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -495,7 +495,7 @@ xor %3,%1,%0\;and %3,%3,%2 xor %3,%1,%0\;and %3,%3,%2 xor %4,%1,%0\;and %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -513,7 +513,7 @@ and %3,%1,%0\;andc %3,%3,%2 and %3,%1,%0\;andc %3,%3,%2 and %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -531,7 +531,7 @@ andc %3,%1,%0\;andc %3,%3,%2 andc %3,%1,%0\;andc %3,%3,%2 andc %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -549,7 +549,7 @@ eqv %3,%1,%0\;andc %3,%3,%2 eqv %3,%1,%0\;andc %3,%3,%2 eqv %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -567,7 +567,7 @@ nand %3,%1,%0\;andc %3,%3,%2 nand %3,%1,%0\;andc %3,%3,%2 nand %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -585,7 +585,7 @@ nor %3,%1,%0\;andc %3,%3,%2 nor %3,%1,%0\;andc %3,%3,%2 nor %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -603,7 +603,7 @@ or %3,%1,%0\;andc %3,%3,%2 or %3,%1,%0\;andc %3,%3,%2 or %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -621,7 +621,7 @@ orc %3,%1,%0\;andc %3,%3,%2 orc %3,%1,%0\;andc %3,%3,%2 orc %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -639,7 +639,7 @@ xor %3,%1,%0\;andc %3,%3,%2 xor %3,%1,%0\;andc %3,%3,%2 xor %4,%1,%0\;andc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -657,7 +657,7 @@ and %3,%1,%0\;eqv %3,%3,%2 and %3,%1,%0\;eqv %3,%3,%2 and %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -675,7 +675,7 @@ andc %3,%1,%0\;eqv %3,%3,%2 andc %3,%1,%0\;eqv %3,%3,%2 andc %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -693,7 +693,7 @@ eqv %3,%1,%0\;eqv %3,%3,%2 eqv %3,%1,%0\;eqv %3,%3,%2 eqv %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -711,7 +711,7 @@ nand %3,%1,%0\;eqv %3,%3,%2 nand %3,%1,%0\;eqv %3,%3,%2 nand %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -729,7 +729,7 @@ nor %3,%1,%0\;eqv %3,%3,%2 nor %3,%1,%0\;eqv %3,%3,%2 nor %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -747,7 +747,7 @@ or %3,%1,%0\;eqv %3,%3,%2 or %3,%1,%0\;eqv %3,%3,%2 or %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -765,7 +765,7 @@ orc %3,%1,%0\;eqv %3,%3,%2 orc %3,%1,%0\;eqv %3,%3,%2 orc %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -783,7 +783,7 @@ xor %3,%1,%0\;eqv %3,%3,%2 xor %3,%1,%0\;eqv %3,%3,%2 xor %4,%1,%0\;eqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -801,7 +801,7 @@ and %3,%1,%0\;nand %3,%3,%2 and %3,%1,%0\;nand %3,%3,%2 and %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -819,7 +819,7 @@ andc %3,%1,%0\;nand %3,%3,%2 andc %3,%1,%0\;nand %3,%3,%2 andc %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -837,7 +837,7 @@ eqv %3,%1,%0\;nand %3,%3,%2 eqv %3,%1,%0\;nand %3,%3,%2 eqv %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -855,7 +855,7 @@ nand %3,%1,%0\;nand %3,%3,%2 nand %3,%1,%0\;nand %3,%3,%2 nand %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -873,7 +873,7 @@ nor %3,%1,%0\;nand %3,%3,%2 nor %3,%1,%0\;nand %3,%3,%2 nor %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -891,7 +891,7 @@ or %3,%1,%0\;nand %3,%3,%2 or %3,%1,%0\;nand %3,%3,%2 or %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -909,7 +909,7 @@ orc %3,%1,%0\;nand %3,%3,%2 orc %3,%1,%0\;nand %3,%3,%2 orc %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -927,7 +927,7 @@ xor %3,%1,%0\;nand %3,%3,%2 xor %3,%1,%0\;nand %3,%3,%2 xor %4,%1,%0\;nand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -945,7 +945,7 @@ and %3,%1,%0\;nor %3,%3,%2 and %3,%1,%0\;nor %3,%3,%2 and %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -963,7 +963,7 @@ andc %3,%1,%0\;nor %3,%3,%2 andc %3,%1,%0\;nor %3,%3,%2 andc %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -981,7 +981,7 @@ eqv %3,%1,%0\;nor %3,%3,%2 eqv %3,%1,%0\;nor %3,%3,%2 eqv %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -999,7 +999,7 @@ nand %3,%1,%0\;nor %3,%3,%2 nand %3,%1,%0\;nor %3,%3,%2 nand %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1017,7 +1017,7 @@ nor %3,%1,%0\;nor %3,%3,%2 nor %3,%1,%0\;nor %3,%3,%2 nor %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1035,7 +1035,7 @@ or %3,%1,%0\;nor %3,%3,%2 or %3,%1,%0\;nor %3,%3,%2 or %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1053,7 +1053,7 @@ orc %3,%1,%0\;nor %3,%3,%2 orc %3,%1,%0\;nor %3,%3,%2 orc %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1071,7 +1071,7 @@ xor %3,%1,%0\;nor %3,%3,%2 xor %3,%1,%0\;nor %3,%3,%2 xor %4,%1,%0\;nor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1089,7 +1089,7 @@ and %3,%1,%0\;or %3,%3,%2 and %3,%1,%0\;or %3,%3,%2 and %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1107,7 +1107,7 @@ andc %3,%1,%0\;or %3,%3,%2 andc %3,%1,%0\;or %3,%3,%2 andc %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1125,7 +1125,7 @@ eqv %3,%1,%0\;or %3,%3,%2 eqv %3,%1,%0\;or %3,%3,%2 eqv %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1143,7 +1143,7 @@ nand %3,%1,%0\;or %3,%3,%2 nand %3,%1,%0\;or %3,%3,%2 nand %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1161,7 +1161,7 @@ nor %3,%1,%0\;or %3,%3,%2 nor %3,%1,%0\;or %3,%3,%2 nor %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1179,7 +1179,7 @@ or %3,%1,%0\;or %3,%3,%2 or %3,%1,%0\;or %3,%3,%2 or %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1197,7 +1197,7 @@ orc %3,%1,%0\;or %3,%3,%2 orc %3,%1,%0\;or %3,%3,%2 orc %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1215,7 +1215,7 @@ xor %3,%1,%0\;or %3,%3,%2 xor %3,%1,%0\;or %3,%3,%2 xor %4,%1,%0\;or %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1233,7 +1233,7 @@ and %3,%1,%0\;orc %3,%3,%2 and %3,%1,%0\;orc %3,%3,%2 and %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1251,7 +1251,7 @@ andc %3,%1,%0\;orc %3,%3,%2 andc %3,%1,%0\;orc %3,%3,%2 andc %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1269,7 +1269,7 @@ eqv %3,%1,%0\;orc %3,%3,%2 eqv %3,%1,%0\;orc %3,%3,%2 eqv %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1287,7 +1287,7 @@ nand %3,%1,%0\;orc %3,%3,%2 nand %3,%1,%0\;orc %3,%3,%2 nand %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1305,7 +1305,7 @@ nor %3,%1,%0\;orc %3,%3,%2 nor %3,%1,%0\;orc %3,%3,%2 nor %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1323,7 +1323,7 @@ or %3,%1,%0\;orc %3,%3,%2 or %3,%1,%0\;orc %3,%3,%2 or %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1341,7 +1341,7 @@ orc %3,%1,%0\;orc %3,%3,%2 orc %3,%1,%0\;orc %3,%3,%2 orc %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1359,7 +1359,7 @@ xor %3,%1,%0\;orc %3,%3,%2 xor %3,%1,%0\;orc %3,%3,%2 xor %4,%1,%0\;orc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1377,7 +1377,7 @@ and %3,%1,%0\;xor %3,%3,%2 and %3,%1,%0\;xor %3,%3,%2 and %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1395,7 +1395,7 @@ andc %3,%1,%0\;xor %3,%3,%2 andc %3,%1,%0\;xor %3,%3,%2 andc %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1413,7 +1413,7 @@ eqv %3,%1,%0\;xor %3,%3,%2 eqv %3,%1,%0\;xor %3,%3,%2 eqv %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1431,7 +1431,7 @@ nand %3,%1,%0\;xor %3,%3,%2 nand %3,%1,%0\;xor %3,%3,%2 nand %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1449,7 +1449,7 @@ nor %3,%1,%0\;xor %3,%3,%2 nor %3,%1,%0\;xor %3,%3,%2 nor %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1467,7 +1467,7 @@ or %3,%1,%0\;xor %3,%3,%2 or %3,%1,%0\;xor %3,%3,%2 or %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1485,7 +1485,7 @@ orc %3,%1,%0\;xor %3,%3,%2 orc %3,%1,%0\;xor %3,%3,%2 orc %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1503,7 +1503,7 @@ xor %3,%1,%0\;xor %3,%3,%2 xor %3,%1,%0\;xor %3,%3,%2 xor %4,%1,%0\;xor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_arith_logical") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1521,7 +1521,7 @@ vand %3,%1,%0\;vand %3,%3,%2 vand %3,%1,%0\;vand %3,%3,%2 vand %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1539,7 +1539,7 @@ vandc %3,%1,%0\;vand %3,%3,%2 vandc %3,%1,%0\;vand %3,%3,%2 vandc %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1557,7 +1557,7 @@ veqv %3,%1,%0\;vand %3,%3,%2 veqv %3,%1,%0\;vand %3,%3,%2 veqv %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1575,7 +1575,7 @@ vnand %3,%1,%0\;vand %3,%3,%2 vnand %3,%1,%0\;vand %3,%3,%2 vnand %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1593,7 +1593,7 @@ vnor %3,%1,%0\;vand %3,%3,%2 vnor %3,%1,%0\;vand %3,%3,%2 vnor %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1611,7 +1611,7 @@ vor %3,%1,%0\;vand %3,%3,%2 vor %3,%1,%0\;vand %3,%3,%2 vor %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1629,7 +1629,7 @@ vorc %3,%1,%0\;vand %3,%3,%2 vorc %3,%1,%0\;vand %3,%3,%2 vorc %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1647,7 +1647,7 @@ vxor %3,%1,%0\;vand %3,%3,%2 vxor %3,%1,%0\;vand %3,%3,%2 vxor %4,%1,%0\;vand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1665,7 +1665,7 @@ vand %3,%1,%0\;vandc %3,%3,%2 vand %3,%1,%0\;vandc %3,%3,%2 vand %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1683,7 +1683,7 @@ vandc %3,%1,%0\;vandc %3,%3,%2 vandc %3,%1,%0\;vandc %3,%3,%2 vandc %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1701,7 +1701,7 @@ veqv %3,%1,%0\;vandc %3,%3,%2 veqv %3,%1,%0\;vandc %3,%3,%2 veqv %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1719,7 +1719,7 @@ vnand %3,%1,%0\;vandc %3,%3,%2 vnand %3,%1,%0\;vandc %3,%3,%2 vnand %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1737,7 +1737,7 @@ vnor %3,%1,%0\;vandc %3,%3,%2 vnor %3,%1,%0\;vandc %3,%3,%2 vnor %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1755,7 +1755,7 @@ vor %3,%1,%0\;vandc %3,%3,%2 vor %3,%1,%0\;vandc %3,%3,%2 vor %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1773,7 +1773,7 @@ vorc %3,%1,%0\;vandc %3,%3,%2 vorc %3,%1,%0\;vandc %3,%3,%2 vorc %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1791,7 +1791,7 @@ vxor %3,%1,%0\;vandc %3,%3,%2 vxor %3,%1,%0\;vandc %3,%3,%2 vxor %4,%1,%0\;vandc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1809,7 +1809,7 @@ vand %3,%1,%0\;veqv %3,%3,%2 vand %3,%1,%0\;veqv %3,%3,%2 vand %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1827,7 +1827,7 @@ vandc %3,%1,%0\;veqv %3,%3,%2 vandc %3,%1,%0\;veqv %3,%3,%2 vandc %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1845,7 +1845,7 @@ veqv %3,%1,%0\;veqv %3,%3,%2 veqv %3,%1,%0\;veqv %3,%3,%2 veqv %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1863,7 +1863,7 @@ vnand %3,%1,%0\;veqv %3,%3,%2 vnand %3,%1,%0\;veqv %3,%3,%2 vnand %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1881,7 +1881,7 @@ vnor %3,%1,%0\;veqv %3,%3,%2 vnor %3,%1,%0\;veqv %3,%3,%2 vnor %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1899,7 +1899,7 @@ vor %3,%1,%0\;veqv %3,%3,%2 vor %3,%1,%0\;veqv %3,%3,%2 vor %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1917,7 +1917,7 @@ vorc %3,%1,%0\;veqv %3,%3,%2 vorc %3,%1,%0\;veqv %3,%3,%2 vorc %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1935,7 +1935,7 @@ vxor %3,%1,%0\;veqv %3,%3,%2 vxor %3,%1,%0\;veqv %3,%3,%2 vxor %4,%1,%0\;veqv %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1953,7 +1953,7 @@ vand %3,%1,%0\;vnand %3,%3,%2 vand %3,%1,%0\;vnand %3,%3,%2 vand %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1971,7 +1971,7 @@ vandc %3,%1,%0\;vnand %3,%3,%2 vandc %3,%1,%0\;vnand %3,%3,%2 vandc %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -1989,7 +1989,7 @@ veqv %3,%1,%0\;vnand %3,%3,%2 veqv %3,%1,%0\;vnand %3,%3,%2 veqv %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2007,7 +2007,7 @@ vnand %3,%1,%0\;vnand %3,%3,%2 vnand %3,%1,%0\;vnand %3,%3,%2 vnand %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2025,7 +2025,7 @@ vnor %3,%1,%0\;vnand %3,%3,%2 vnor %3,%1,%0\;vnand %3,%3,%2 vnor %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2043,7 +2043,7 @@ vor %3,%1,%0\;vnand %3,%3,%2 vor %3,%1,%0\;vnand %3,%3,%2 vor %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2061,7 +2061,7 @@ vorc %3,%1,%0\;vnand %3,%3,%2 vorc %3,%1,%0\;vnand %3,%3,%2 vorc %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2079,7 +2079,7 @@ vxor %3,%1,%0\;vnand %3,%3,%2 vxor %3,%1,%0\;vnand %3,%3,%2 vxor %4,%1,%0\;vnand %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2097,7 +2097,7 @@ vand %3,%1,%0\;vnor %3,%3,%2 vand %3,%1,%0\;vnor %3,%3,%2 vand %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2115,7 +2115,7 @@ vandc %3,%1,%0\;vnor %3,%3,%2 vandc %3,%1,%0\;vnor %3,%3,%2 vandc %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2133,7 +2133,7 @@ veqv %3,%1,%0\;vnor %3,%3,%2 veqv %3,%1,%0\;vnor %3,%3,%2 veqv %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2151,7 +2151,7 @@ vnand %3,%1,%0\;vnor %3,%3,%2 vnand %3,%1,%0\;vnor %3,%3,%2 vnand %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2169,7 +2169,7 @@ vnor %3,%1,%0\;vnor %3,%3,%2 vnor %3,%1,%0\;vnor %3,%3,%2 vnor %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2187,7 +2187,7 @@ vor %3,%1,%0\;vnor %3,%3,%2 vor %3,%1,%0\;vnor %3,%3,%2 vor %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2205,7 +2205,7 @@ vorc %3,%1,%0\;vnor %3,%3,%2 vorc %3,%1,%0\;vnor %3,%3,%2 vorc %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2223,7 +2223,7 @@ vxor %3,%1,%0\;vnor %3,%3,%2 vxor %3,%1,%0\;vnor %3,%3,%2 vxor %4,%1,%0\;vnor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2241,7 +2241,7 @@ vand %3,%1,%0\;vor %3,%3,%2 vand %3,%1,%0\;vor %3,%3,%2 vand %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2259,7 +2259,7 @@ vandc %3,%1,%0\;vor %3,%3,%2 vandc %3,%1,%0\;vor %3,%3,%2 vandc %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2277,7 +2277,7 @@ veqv %3,%1,%0\;vor %3,%3,%2 veqv %3,%1,%0\;vor %3,%3,%2 veqv %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2295,7 +2295,7 @@ vnand %3,%1,%0\;vor %3,%3,%2 vnand %3,%1,%0\;vor %3,%3,%2 vnand %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2313,7 +2313,7 @@ vnor %3,%1,%0\;vor %3,%3,%2 vnor %3,%1,%0\;vor %3,%3,%2 vnor %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2331,7 +2331,7 @@ vor %3,%1,%0\;vor %3,%3,%2 vor %3,%1,%0\;vor %3,%3,%2 vor %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2349,7 +2349,7 @@ vorc %3,%1,%0\;vor %3,%3,%2 vorc %3,%1,%0\;vor %3,%3,%2 vorc %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2367,7 +2367,7 @@ vxor %3,%1,%0\;vor %3,%3,%2 vxor %3,%1,%0\;vor %3,%3,%2 vxor %4,%1,%0\;vor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2385,7 +2385,7 @@ vand %3,%1,%0\;vorc %3,%3,%2 vand %3,%1,%0\;vorc %3,%3,%2 vand %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2403,7 +2403,7 @@ vandc %3,%1,%0\;vorc %3,%3,%2 vandc %3,%1,%0\;vorc %3,%3,%2 vandc %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2421,7 +2421,7 @@ veqv %3,%1,%0\;vorc %3,%3,%2 veqv %3,%1,%0\;vorc %3,%3,%2 veqv %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2439,7 +2439,7 @@ vnand %3,%1,%0\;vorc %3,%3,%2 vnand %3,%1,%0\;vorc %3,%3,%2 vnand %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2457,7 +2457,7 @@ vnor %3,%1,%0\;vorc %3,%3,%2 vnor %3,%1,%0\;vorc %3,%3,%2 vnor %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2475,7 +2475,7 @@ vor %3,%1,%0\;vorc %3,%3,%2 vor %3,%1,%0\;vorc %3,%3,%2 vor %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2493,7 +2493,7 @@ vorc %3,%1,%0\;vorc %3,%3,%2 vorc %3,%1,%0\;vorc %3,%3,%2 vorc %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2511,7 +2511,7 @@ vxor %3,%1,%0\;vorc %3,%3,%2 vxor %3,%1,%0\;vorc %3,%3,%2 vxor %4,%1,%0\;vorc %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2529,7 +2529,7 @@ vand %3,%1,%0\;vxor %3,%3,%2 vand %3,%1,%0\;vxor %3,%3,%2 vand %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2547,7 +2547,7 @@ vandc %3,%1,%0\;vxor %3,%3,%2 vandc %3,%1,%0\;vxor %3,%3,%2 vandc %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2565,7 +2565,7 @@ veqv %3,%1,%0\;vxor %3,%3,%2 veqv %3,%1,%0\;vxor %3,%3,%2 veqv %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2583,7 +2583,7 @@ vnand %3,%1,%0\;vxor %3,%3,%2 vnand %3,%1,%0\;vxor %3,%3,%2 vnand %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2601,7 +2601,7 @@ vnor %3,%1,%0\;vxor %3,%3,%2 vnor %3,%1,%0\;vxor %3,%3,%2 vnor %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2619,7 +2619,7 @@ vor %3,%1,%0\;vxor %3,%3,%2 vor %3,%1,%0\;vxor %3,%3,%2 vor %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2637,7 +2637,7 @@ vorc %3,%1,%0\;vxor %3,%3,%2 vorc %3,%1,%0\;vxor %3,%3,%2 vorc %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) @@ -2655,6 +2655,42 @@ vxor %3,%1,%0\;vxor %3,%3,%2 vxor %3,%1,%0\;vxor %3,%3,%2 vxor %4,%1,%0\;vxor %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "fused_vector") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; add-add fusion pattern generated by gen_addadd +(define_insn "*fuse_add_add" + [(set (match_operand:GPR 3 "gpc_reg_operand" "=0,1,&r,r") + (plus:GPR + (plus:GPR (match_operand:GPR 0 "gpc_reg_operand" "r,r,r,r") + (match_operand:GPR 1 "gpc_reg_operand" "%r,r,r,r")) + (match_operand:GPR 2 "gpc_reg_operand" "r,r,r,r"))) + (clobber (match_scratch:GPR 4 "=X,X,X,&r"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_2ADD)" + "@ + add %3,%1,%0\;add %3,%3,%2 + add %3,%1,%0\;add %3,%3,%2 + add %3,%1,%0\;add %3,%3,%2 + add %4,%1,%0\;add %3,%4,%2" + [(set_attr "type" "fused_arith_logical") + (set_attr "cost" "6") + (set_attr "length" "8")]) + +;; vaddudm-vaddudm fusion pattern generated by gen_addadd +(define_insn "*fuse_vaddudm_vaddudm" + [(set (match_operand:V2DI 3 "altivec_register_operand" "=0,1,&v,v") + (plus:V2DI + (plus:V2DI (match_operand:V2DI 0 "altivec_register_operand" "v,v,v,v") + (match_operand:V2DI 1 "altivec_register_operand" "%v,v,v,v")) + (match_operand:V2DI 2 "altivec_register_operand" "v,v,v,v"))) + (clobber (match_scratch:V2DI 4 "=X,X,X,&v"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_2ADD)" + "@ + vaddudm %3,%1,%0\;vaddudm %3,%3,%2 + vaddudm %3,%1,%0\;vaddudm %3,%3,%2 + vaddudm %3,%1,%0\;vaddudm %3,%3,%2 + vaddudm %4,%1,%0\;vaddudm %3,%4,%2" + [(set_attr "type" "fused_vector") (set_attr "cost" "6") (set_attr "length" "8")]) diff --git a/gcc/config/rs6000/genfusion.pl b/gcc/config/rs6000/genfusion.pl index c86c743..1fd46cc 100755 --- a/gcc/config/rs6000/genfusion.pl +++ b/gcc/config/rs6000/genfusion.pl @@ -135,7 +135,7 @@ sub gen_ld_cmpi_p10 print " (set (match_dup 2)\n"; print " (compare:${ccmode} (match_dup 0) (match_dup 3)))]\n"; print " \"\"\n"; - print " [(set_attr \"type\" \"load\")\n"; + print " [(set_attr \"type\" \"fused_load_cmpi\")\n"; print " (set_attr \"cost\" \"8\")\n"; print " (set_attr \"length\" \"8\")])\n"; print "\n"; @@ -159,18 +159,20 @@ sub gen_2logical my ($kind, $vchr, $mode, $pred, $constraint, $cr, $outer, $outer_op, $outer_comp, $outer_inv, $outer_rtl, $inner, $inner_comp, $inner_inv, $inner_rtl, $inner_op, $both_commute, $c4, $bc, $inner_arg0, - $inner_arg1, $inner_exp, $outer_arg2, $outer_exp, $insn); + $inner_arg1, $inner_exp, $outer_arg2, $outer_exp, $insn, $fuse_type); KIND: foreach $kind ('scalar','vector') { if ( $kind eq 'vector' ) { $vchr = "v"; $mode = "VM"; $pred = "altivec_register_operand"; $constraint = "v"; + $fuse_type = "fused_vector"; } else { $vchr = ""; $mode = "GPR"; $pred = "gpc_reg_operand"; $constraint = "r"; + $fuse_type = "fused_arith_logical"; } $c4 = "${constraint},${constraint},${constraint},${constraint}"; OUTER: foreach $outer ( @logicals ) { @@ -227,7 +229,7 @@ sub gen_2logical ${inner_op} %3,%1,%0\\;${outer_op} %3,%3,%2 ${inner_op} %3,%1,%0\\;${outer_op} %3,%3,%2 ${inner_op} %4,%1,%0\\;${outer_op} %3,%4,%2" - [(set_attr "type" "logical") + [(set_attr "type" "$fuse_type") (set_attr "cost" "6") (set_attr "length" "8")]) EOF @@ -238,8 +240,52 @@ EOF } } +sub gen_addadd +{ + my ($kind, $vchr, $op, $type, $mode, $pred, $constraint); + foreach $kind ('scalar','vector') { + if ( $kind eq 'vector' ) { + $vchr = "v"; + $op = "vaddudm"; + $type = "fused_vector"; + $mode = "V2DI"; + $pred = "altivec_register_operand"; + $constraint = "v"; + } else { + $vchr = ""; + $op = "add"; + $type = "fused_arith_logical"; + $mode = "GPR"; + $pred = "gpc_reg_operand"; + $constraint = "r"; + } + my $c4 = "${constraint},${constraint},${constraint},${constraint}"; + print <<"EOF"; + +;; ${op}-${op} fusion pattern generated by gen_addadd +(define_insn "*fuse_${op}_${op}" + [(set (match_operand:${mode} 3 "${pred}" "=0,1,&${constraint},${constraint}") + (plus:${mode} + (plus:${mode} (match_operand:${mode} 0 "${pred}" "${c4}") + (match_operand:${mode} 1 "${pred}" "%${c4}")) + (match_operand:${mode} 2 "${pred}" "${c4}"))) + (clobber (match_scratch:${mode} 4 "=X,X,X,&${constraint}"))] + "(TARGET_P10_FUSION && TARGET_P10_FUSION_2ADD)" + "@ + ${op} %3,%1,%0\\;${op} %3,%3,%2 + ${op} %3,%1,%0\\;${op} %3,%3,%2 + ${op} %3,%1,%0\\;${op} %3,%3,%2 + ${op} %4,%1,%0\\;${op} %3,%4,%2" + [(set_attr "type" "${type}") + (set_attr "cost" "6") + (set_attr "length" "8")]) +EOF + } +} + gen_ld_cmpi_p10(); gen_2logical(); +gen_addadd; exit(0); diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index e3f2cd2..74be9a9 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -213,11 +213,9 @@ extern int dot_symbols; /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ - (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ - ? 128 \ - : (TARGET_64BIT \ - && TARGET_ALIGN_NATURAL == 0 \ - && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ + ((TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ + && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ ? MIN ((COMPUTED), 32) \ : (COMPUTED)) diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index c4332a6..f271b0a 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -6793,25 +6793,8 @@ rs6000_function_arg_boundary (machine_mode mode, const_tree type) /* "Aggregate" means any AGGREGATE_TYPE except for single-element or homogeneous float/vector aggregates here. We already handled vector aggregates above, but still need to check for float here. */ - bool aggregate_p = (AGGREGATE_TYPE_P (type) - && !SCALAR_FLOAT_MODE_P (elt_mode)); - - /* We used to check for BLKmode instead of the above aggregate type - check. Warn when this results in any difference to the ABI. */ - if (aggregate_p != (mode == BLKmode)) - { - static bool warned; - if (!warned && warn_psabi) - { - warned = true; - inform (input_location, - "the ABI of passing aggregates with %d-byte alignment" - " has changed in GCC 5", - (int) TYPE_ALIGN (type) / BITS_PER_UNIT); - } - } - - if (aggregate_p) + if (AGGREGATE_TYPE_P (type) + && !SCALAR_FLOAT_MODE_P (elt_mode)) return 128; } @@ -7805,8 +7788,6 @@ rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG && cum->nargs_prototype > 0) { - static bool warned; - machine_mode rmode = TARGET_32BIT ? SImode : DImode; int n_words = rs6000_arg_size (mode, type); @@ -7820,14 +7801,6 @@ rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); } while (++align_words < GP_ARG_NUM_REG && --n_words != 0); - - if (!warned && warn_psabi) - { - warned = true; - inform (input_location, - "the ABI of passing homogeneous %<float%> aggregates" - " has changed in GCC 5"); - } } return rs6000_finish_function_arg (mode, rvec, k); diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index cbbb42c..d46a91d 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -85,7 +85,8 @@ | OTHER_POWER10_MASKS \ | OPTION_MASK_P10_FUSION \ | OPTION_MASK_P10_FUSION_LD_CMPI \ - | OPTION_MASK_P10_FUSION_2LOGICAL) + | OPTION_MASK_P10_FUSION_2LOGICAL \ + | OPTION_MASK_P10_FUSION_2ADD) /* Flags that need to be turned off if -mno-power9-vector. */ #define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW \ @@ -135,6 +136,7 @@ | OPTION_MASK_P10_FUSION \ | OPTION_MASK_P10_FUSION_LD_CMPI \ | OPTION_MASK_P10_FUSION_2LOGICAL \ + | OPTION_MASK_P10_FUSION_2ADD \ | OPTION_MASK_HTM \ | OPTION_MASK_ISEL \ | OPTION_MASK_MFCRF \ diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index bef727e..9de294d 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -226,7 +226,6 @@ address_is_prefixed (rtx addr, #ifdef TREE_CODE extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); -extern bool rs6000_special_adjust_field_align_p (tree, unsigned int); extern unsigned int rs6000_special_adjust_field_align (tree, unsigned int); extern unsigned int rs6000_special_round_type_align (tree, unsigned int, unsigned int); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c304596..9f03256 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4465,16 +4465,22 @@ rs6000_option_override_internal (bool global_init_p) if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_MMA) == 0) rs6000_isa_flags |= OPTION_MASK_MMA; - if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION) == 0) + if (TARGET_POWER10 + && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION) == 0) rs6000_isa_flags |= OPTION_MASK_P10_FUSION; if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_LD_CMPI) == 0) rs6000_isa_flags |= OPTION_MASK_P10_FUSION_LD_CMPI; - if (TARGET_POWER10 && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_2LOGICAL) == 0) + if (TARGET_POWER10 + && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_2LOGICAL) == 0) rs6000_isa_flags |= OPTION_MASK_P10_FUSION_2LOGICAL; + if (TARGET_POWER10 + && (rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION_2ADD) == 0) + rs6000_isa_flags |= OPTION_MASK_P10_FUSION_2ADD; + /* Turn off vector pair/mma options on non-power10 systems. */ else if (!TARGET_POWER10 && TARGET_MMA) { @@ -5364,7 +5370,11 @@ rs6000_add_stmt_cost (class vec_info *vinfo, void *data, int count, arbitrary and could potentially be improved with analysis. */ if (where == vect_body && stmt_info && stmt_in_inner_loop_p (vinfo, stmt_info)) - count *= 50; /* FIXME. */ + { + loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo); + gcc_assert (loop_vinfo); + count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); /* FIXME. */ + } retval = (unsigned) (count * stmt_cost); cost_data->cost[where] += retval; @@ -7900,32 +7910,6 @@ rs6000_slow_unaligned_access (machine_mode mode, unsigned int align) && (int) align < VECTOR_ALIGN (mode))))); } -/* Previous GCC releases forced all vector types to have 16-byte alignment. */ - -bool -rs6000_special_adjust_field_align_p (tree type, unsigned int computed) -{ - if (TARGET_ALTIVEC && TREE_CODE (type) == VECTOR_TYPE) - { - if (computed != 128) - { - static bool warned; - if (!warned && warn_psabi) - { - warned = true; - inform (input_location, - "the layout of aggregates containing vectors with" - " %d-byte alignment has changed in GCC 5", - computed / BITS_PER_UNIT); - } - } - /* In current GCC there is no special case. */ - return false; - } - - return false; -} - /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */ unsigned int @@ -21610,7 +21594,7 @@ rs6000_xcoff_declare_function_name (FILE *file, const char *name, tree decl) { if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG) xcoffout_declare_function (file, decl, buffer); - else if (write_symbols == DWARF2_DEBUG) + else if (dwarf_debuginfo_p ()) { name = (*targetm.strip_name_encoding) (name); fprintf (file, "\t.function .%s,.%s,2,0\n", name, name); @@ -23769,7 +23753,7 @@ rs6000_dbx_register_number (unsigned int regno, unsigned int format) { /* On some platforms, we use the standard DWARF register numbering for .debug_info and .debug_frame. */ - if ((format == 0 && write_symbols == DWARF2_DEBUG) || format == 1) + if ((format == 0 && dwarf_debuginfo_p ()) || format == 1) { #ifdef RS6000_USE_DWARF_NUMBERING if (regno <= 31) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 0bfeb24..3f59b54 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -206,8 +206,26 @@ vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm, vecfloat,vecfdiv,vecdouble,mtvsr,mfvsr,crypto, veclogical,veccmpfx,vecexts,vecmove, - htm,htmsimple,dfp,mma" + htm,htmsimple,dfp,mma, + fused_arith_logical, + fused_cmp_isel, + fused_carry, + fused_load_cmpi, + fused_load_load,fused_store_store, + fused_addis_load, + fused_mtbc, + fused_vector" (const_string "integer")) +;; Attr type definitions for fused pairs: +;; fused_arith_logical is used for scalar logical+add/subf and +;; add/subf+logical pairs of instructions. +;; fused_load_cmpi is used for a D-form load fused with +;; a compare immediate. +;; fused_load_load is for a fused pair of loads to adjacent addresses. +;; fused_store_store is for a fused pair of stores to adjacent addresses. +;; fused_addis_load is for addis fused to D-form load for a larger immediate. +;; fused_mtbc is for fused mtlr and bclr[l] pairs. +;; fused_vector is for a fused pair of vector logical instructions. ;; What data size does this instruction work on? ;; This is used for insert, mul and others as necessary. diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 2685fa7..e30dc04 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -502,6 +502,10 @@ mpower10-fusion-2logical Target Undocumented Mask(P10_FUSION_2LOGICAL) Var(rs6000_isa_flags) Fuse certain integer operations together for better performance on power10. +mpower10-fusion-2add +Target Undocumented Mask(P10_FUSION_2ADD) Var(rs6000_isa_flags) +Fuse certain add operations together for better performance on power10. + mcrypto Target Mask(CRYPTO) Var(rs6000_isa_flags) Use ISA 2.07 Category:Vector.AES and Category:Vector.SHA2 instructions. diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 510abe1..23ff594 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -325,8 +325,7 @@ do { \ /* An expression for the alignment of a structure field FIELD if the alignment computed in the usual way is COMPUTED. */ #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ - (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ - ? 128 : COMPUTED) + (COMPUTED) #undef BIGGEST_FIELD_ALIGNMENT diff --git a/gcc/configure b/gcc/configure index 039a86d..4a9e4fa 100755 --- a/gcc/configure +++ b/gcc/configure @@ -911,7 +911,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -1086,7 +1085,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1339,15 +1337,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1485,7 +1474,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1638,7 +1627,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -13309,8 +13297,8 @@ BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' # And these apply if build != host, or we are generating coverage data if test x$build != x$host || test "x$coverage_flags" != x then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' + BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)' + BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)' BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}} @@ -19447,7 +19435,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19450 "configure" +#line 19438 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19553,7 +19541,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19556 "configure" +#line 19544 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 4e78801..d9fc3c2 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2448,8 +2448,8 @@ BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' AC_SUBST(BUILD_NO_PIE_FLAG) # And these apply if build != host, or we are generating coverage data if test x$build != x$host || test "x$coverage_flags" != x then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' + BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)' + BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)' BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}} diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 45af840..2eb793e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,148 @@ +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * semantics.c (finish_omp_clauses): Move firstprivate clauses with + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT to the end of the chain. Don't error + if a decl is mentioned both in map clause and in such firstprivate + clause unless OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET is also set. + +2021-05-20 Jason Merrill <jason@redhat.com> + + * call.c (reference_binding): Check for designator. + (implicit_conversion_1, build_special_member_call): Likewise. + * decl.c (reshape_init_r): Likewise. + * pt.c (do_class_deduction): Likewise. + * typeck2.c (digest_init_r): Likewise. + +2021-05-20 Jason Merrill <jason@redhat.com> + + PR c++/100489 + * decl.c (reshape_init_class): Handle designator for + member of anonymous aggregate here. + * typeck2.c (process_init_constructor_record): Not here. + +2021-05-20 Jonathan Wakely <jwakely@redhat.com> + + * call.c (maybe_warn_array_conv): Use new warning option. + * decl.c (mark_inline_variable, grokdeclarator): Likewise. + * error.c (maybe_warn_cpp0x): Likewise. + * parser.c (cp_parser_primary_expression) + (cp_parser_unqualified_id) + (cp_parser_pseudo_destructor_name) + (cp_parser_lambda_introducer) + (cp_parser_lambda_declarator_opt) + (cp_parser_selection_statement) + (cp_parser_init_statement) + (cp_parser_decomposition_declaration) + (cp_parser_function_specifier_opt) + (cp_parser_static_assert) + (cp_parser_namespace_definition) + (cp_parser_using_declaration) + (cp_parser_asm_definition) + (cp_parser_ctor_initializer_opt_and_function_body) + (cp_parser_initializer_list) + (cp_parser_type_parameter_key) + (cp_parser_member_declaration) + (cp_parser_try_block) + (cp_parser_std_attribute_spec): Likewise. + * pt.c (check_template_variable): Likewise. + +2021-05-20 Jason Merrill <jason@redhat.com> + + PR c++/100634 + * pt.c (invalid_nontype_parm_type_p): Return true for COMPLEX_TYPE. + +2021-05-20 Jason Merrill <jason@redhat.com> + + PR c++/100659 + * cp-tree.h (CONST_DECL_USING_P): Check for null TREE_TYPE. + +2021-05-19 Jason Merrill <jason@redhat.com> + + PR c++/100367 + PR c++/96299 + * method.c (genericize_spaceship): Use fold_build2 for scalar + operands. + +2021-05-19 Jason Merrill <jason@redhat.com> + + * pt.c (build_deduction_guide): Treat the implicit deduction guide + as a member of the class. + +2021-05-19 Marek Polacek <polacek@redhat.com> + + PR c++/100596 + * cp-tree.h (any_non_type_attribute_p): Remove. + * decl.c (grokdeclarator): Turn an error into a warning and only + warn for standard attributes. + * decl2.c (any_non_type_attribute_p): Remove. + * parser.c (cp_parser_elaborated_type_specifier): Turn an error + into a warning and only warn for standard attributes. + (cp_parser_member_declaration): Likewise. + +2021-05-19 Martin Liska <mliska@suse.cz> + + PR testsuite/100658 + * mangle.c (write_encoding): Fix typos. + +2021-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * parser.c (cp_parser_omp_master): Set OMP_MASTER_COMBINED on + master when combined with taskloop. + (cp_parser_omp_parallel): Don't set OMP_PARALLEL_COMBINED on + parallel master when not combined with taskloop. + +2021-05-19 Jason Merrill <jason@redhat.com> + + PR c++/100261 + * rtti.c (get_tinfo_decl_direct): Check TYPE_TRANSPARENT_AGGR. + +2021-05-19 Jason Merrill <jason@redhat.com> + + PR c++/100372 + * tree.c (strip_typedefs): Only look at the pattern of a + TYPE_PACK_EXPANSION if it's a type. + +2021-05-18 Marek Polacek <polacek@redhat.com> + + * class.c (classtype_has_non_deleted_copy_ctor): Remove. + * constraint.cc (contains_wildcard_p): Likewise. + (get_template_head_requirements): Likewise. + (check_constrained_friend): Likewise. + (subsumes_constraints): Likewise. + * cp-tree.h (classtype_has_non_deleted_copy_ctor): Likewise. + (push_void_library_fn): Likewise. + (get_pattern_parm): Likewise. + (get_template_parms_at_level): Likewise. + (lambda_return_type): Likewise. + (get_template_head_requirements): Likewise. + (check_constrained_friend): Likewise. + (subsumes_constraints): Likewise. + * decl.c (push_void_library_fn): Likewise. + * lambda.c (lambda_return_type): Likewise. + * pt.c (get_template_parms_at_level): Likewise. + (get_pattern_parm): Likewise. + +2021-05-18 Jason Merrill <jason@redhat.com> + + PR c++/100644 + * call.c (perfect_candidate_p): An implicitly deleted move + is not perfect. + +2021-05-18 Andreas Krebbel <krebbel@linux.ibm.com> + + PR c++/100281 + * cvt.c (cp_convert_to_pointer): Use the size of the target + pointer type. + * tree.c (cp_build_reference_type): Call + cp_build_reference_type_for_mode with VOIDmode. + (cp_build_reference_type_for_mode): Rename from + cp_build_reference_type. Add MODE argument and invoke + build_reference_type_for_mode. + (strip_typedefs): Use build_pointer_type_for_mode and + cp_build_reference_type_for_mode for pointers and references. + 2021-05-17 Jonathan Wakely <jwakely@redhat.com> PR c++/100635 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 1e2d1d4..cfccf27 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1731,7 +1731,8 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags, because A[] and A[2] are reference-related. But we don't do it because grok_reference_init has deduced the array size (to 1), and A[1] and A[2] aren't reference-related. */ - if (CONSTRUCTOR_NELTS (expr) == 1) + if (CONSTRUCTOR_NELTS (expr) == 1 + && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)) { tree elt = CONSTRUCTOR_ELT (expr, 0)->value; if (error_operand_p (elt)) @@ -2095,6 +2096,7 @@ implicit_conversion_1 (tree to, tree from, tree expr, bool c_cast_p, { if (BRACE_ENCLOSED_INITIALIZER_P (expr) && CONSTRUCTOR_NELTS (expr) == 1 + && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr) && !is_list_ctor (cand->fn)) { /* "If C is not an initializer-list constructor and the @@ -5890,6 +5892,11 @@ perfect_candidate_p (z_candidate *cand) { if (cand->viable < 1) return false; + /* CWG1402 makes an implicitly deleted move op worse than other + candidates. */ + if (DECL_DELETED_FN (cand->fn) && DECL_DEFAULTED_FN (cand->fn) + && move_fn_p (cand->fn)) + return false; int len = cand->num_convs; for (int i = 0; i < len; ++i) if (!perfect_conversion_p (cand->convs[i])) @@ -7464,8 +7471,9 @@ maybe_warn_array_conv (location_t loc, conversion *c, tree expr) || TYPE_DOMAIN (type) == NULL_TREE) return; - if (conv_binds_to_array_of_unknown_bound (c)) - pedwarn (loc, OPT_Wpedantic, "conversions to arrays of unknown bound " + if (pedantic && conv_binds_to_array_of_unknown_bound (c)) + pedwarn (loc, OPT_Wc__20_extensions, + "conversions to arrays of unknown bound " "are only available with %<-std=c++20%> or %<-std=gnu++20%>"); } @@ -10193,6 +10201,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args, if (BRACE_ENCLOSED_INITIALIZER_P (arg) && !TYPE_HAS_LIST_CTOR (class_type) + && !CONSTRUCTOR_IS_DESIGNATED_INIT (arg) && CONSTRUCTOR_NELTS (arg) == 1) arg = CONSTRUCTOR_ELT (arg, 0)->value; diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 66bc1ee..354addd 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5604,19 +5604,6 @@ classtype_has_non_deleted_move_ctor (tree t) return false; } -/* True iff T has a copy constructor that is not deleted. */ - -bool -classtype_has_non_deleted_copy_ctor (tree t) -{ - if (CLASSTYPE_LAZY_COPY_CTOR (t)) - lazily_declare_fn (sfk_copy_constructor, t); - for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter) - if (copy_fn_p (*iter) && !DECL_DELETED_FN (*iter)) - return true; - return false; -} - /* If T, a class, has a user-provided copy constructor, copy assignment operator, or destructor, returns that function. Otherwise, null. */ diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 30fccc4..03ce8eb 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -278,21 +278,6 @@ get_concept_check_template (tree t) return tmpl; } -/* Returns true if any of the arguments in the template argument list is - a wildcard or wildcard pack. */ - -bool -contains_wildcard_p (tree args) -{ - for (int i = 0; i < TREE_VEC_LENGTH (args); ++i) - { - tree arg = TREE_VEC_ELT (args, i); - if (TREE_CODE (arg) == WILDCARD_DECL) - return true; - } - return false; -} - /*--------------------------------------------------------------------------- Resolution of qualified concept names ---------------------------------------------------------------------------*/ @@ -1310,18 +1295,6 @@ maybe_substitute_reqs_for (tree reqs, const_tree decl_) return reqs; } -/* Returns the template-head requires clause for the template - declaration T or NULL_TREE if none. */ - -tree -get_template_head_requirements (tree t) -{ - tree ci = get_constraints (t); - if (!ci) - return NULL_TREE; - return CI_TEMPLATE_REQS (ci); -} - /* Returns the trailing requires clause of the declarator of a template declaration T or NULL_TREE if none. */ @@ -3469,31 +3442,6 @@ check_function_concept (tree fn) return NULL_TREE; } - -// Check that a constrained friend declaration function declaration, -// FN, is admissible. This is the case only when the declaration depends -// on template parameters and does not declare a specialization. -void -check_constrained_friend (tree fn, tree reqs) -{ - if (fn == error_mark_node) - return; - gcc_assert (TREE_CODE (fn) == FUNCTION_DECL); - - // If there are not constraints, this cannot be an error. - if (!reqs) - return; - - // Constrained friend functions that don't depend on template - // arguments are effectively meaningless. - if (!uses_template_parms (TREE_TYPE (fn))) - { - error_at (location_of (fn), - "constrained friend does not depend on template parameters"); - return; - } -} - /*--------------------------------------------------------------------------- Equivalence of constraints ---------------------------------------------------------------------------*/ @@ -3521,16 +3469,6 @@ equivalently_constrained (tree d1, tree d2) Partial ordering of constraints ---------------------------------------------------------------------------*/ -/* Returns true when the constraints in A subsume those in B. */ - -bool -subsumes_constraints (tree a, tree b) -{ - gcc_assert (!a || TREE_CODE (a) == CONSTRAINT_INFO); - gcc_assert (!b || TREE_CODE (b) == CONSTRAINT_INFO); - return subsumes (a, b); -} - /* Returns true when the constraints in CI strictly subsume the associated constraints of TMPL. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 580db91..aa20271 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3553,6 +3553,7 @@ struct GTY(()) lang_decl { created by handle_using_decl. */ #define CONST_DECL_USING_P(NODE) \ (TREE_CODE (NODE) == CONST_DECL \ + && TREE_TYPE (NODE) \ && TREE_CODE (TREE_TYPE (NODE)) == ENUMERAL_TYPE \ && DECL_CONTEXT (NODE) != TREE_TYPE (NODE)) @@ -6568,7 +6569,6 @@ extern bool type_has_constexpr_destructor (tree); extern bool type_has_virtual_destructor (tree); extern bool classtype_has_move_assign_or_move_ctor_p (tree, bool user_declared); extern bool classtype_has_non_deleted_move_ctor (tree); -extern bool classtype_has_non_deleted_copy_ctor (tree); extern tree classtype_has_depr_implicit_copy (tree); extern bool classtype_has_op (tree, tree_code); extern tree classtype_has_defaulted_op (tree, tree_code); @@ -6654,7 +6654,6 @@ extern void pop_abi_namespace (unsigned flags, extern tree build_library_fn_ptr (const char *, tree, int); extern tree build_cp_library_fn_ptr (const char *, tree, int); extern tree push_library_fn (tree, tree, tree, int); -extern tree push_void_library_fn (tree, tree, int); extern tree push_throw_library_fn (tree, tree); extern void warn_misplaced_attr_for_class_type (location_t location, tree class_type); @@ -6763,7 +6762,6 @@ extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *, tree, tree, tree); extern tree splice_template_attributes (tree *, tree); extern bool any_dependent_type_attributes_p (tree); -extern bool any_non_type_attribute_p (tree); extern tree cp_reconstruct_complex_type (tree, tree); extern bool attributes_naming_typedef_ok (tree); extern void cplus_decl_attributes (tree *, tree, int); @@ -7179,7 +7177,6 @@ extern tree get_template_info (const_tree); extern int template_class_depth (tree); extern int is_specialization_of (tree, tree); extern bool is_specialization_of_friend (tree, tree); -extern tree get_pattern_parm (tree, tree); extern int comp_template_args (tree, tree, tree * = NULL, tree * = NULL, bool = false); extern int template_args_equal (tree, tree, bool = false); @@ -7253,7 +7250,6 @@ bool template_template_parameter_p (const_tree); bool template_type_parameter_p (const_tree); extern bool primary_template_specialization_p (const_tree); extern tree get_primary_template_innermost_parameters (const_tree); -extern tree get_template_parms_at_level (tree, int); extern tree get_template_innermost_arguments (const_tree); extern tree get_template_argument_pack_elems (const_tree); extern tree get_function_template_decl (const_tree); @@ -7556,7 +7552,6 @@ extern tree build_lambda_expr (void); extern tree build_lambda_object (tree); extern tree begin_lambda_type (tree); extern tree lambda_capture_field_type (tree, bool, bool); -extern tree lambda_return_type (tree); extern tree lambda_proxy_type (tree); extern tree lambda_function (tree); extern void apply_deduced_return_type (tree, tree); @@ -8109,7 +8104,6 @@ extern tree current_template_constraints (void); extern tree associate_classtype_constraints (tree); extern tree build_constraints (tree, tree); extern tree maybe_substitute_reqs_for (tree, const_tree); -extern tree get_template_head_requirements (tree); extern tree get_trailing_function_requirements (tree); extern tree get_shorthand_constraints (tree); @@ -8135,7 +8129,6 @@ extern tree finish_simple_requirement (location_t, tree); extern tree finish_type_requirement (location_t, tree); extern tree finish_compound_requirement (location_t, tree, tree, bool); extern tree finish_nested_requirement (location_t, tree); -extern void check_constrained_friend (tree, tree); extern tree tsubst_requires_expr (tree, tree, tsubst_flags_t, tree); extern tree evaluate_requires_expr (tree); extern tree tsubst_constraint (tree, tree, tsubst_flags_t, tree); @@ -8159,7 +8152,6 @@ extern bool save_subsumption_result (tree, tree, bool); extern tree find_template_parameters (tree, tree); extern bool equivalent_constraints (tree, tree); extern bool equivalently_constrained (tree, tree); -extern bool subsumes_constraints (tree, tree); extern bool strictly_subsumes (tree, tree); extern bool weakly_subsumes (tree, tree); extern int more_constrained (tree, tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 17511f0..e7268d5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4963,16 +4963,6 @@ push_cp_library_fn (enum tree_code operator_code, tree type, return fn; } -/* Like push_library_fn, but takes a TREE_LIST of parm types rather than - a FUNCTION_TYPE. */ - -tree -push_void_library_fn (tree name, tree parmtypes, int ecf_flags) -{ - tree type = build_function_type (void_type_node, parmtypes); - return push_library_fn (name, type, NULL_TREE, ecf_flags); -} - /* Like push_library_fn, but also note that this function throws and does not return. Used for __throw_foo and the like. */ @@ -6428,10 +6418,9 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p, /* We already reshaped this. */ if (field != d->cur->index) { - tree id = DECL_NAME (d->cur->index); - gcc_assert (id); - gcc_checking_assert (d->cur->index - == get_class_binding (type, id)); + if (tree id = DECL_NAME (d->cur->index)) + gcc_checking_assert (d->cur->index + == get_class_binding (type, id)); field = d->cur->index; } } @@ -6452,6 +6441,32 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p, d->cur->index); return error_mark_node; } + + /* If the element is an anonymous union object and the initializer + list is a designated-initializer-list, the anonymous union object + is initialized by the designated-initializer-list { D }, where D + is the designated-initializer-clause naming a member of the + anonymous union object. */ + tree ictx = DECL_CONTEXT (field); + if (!same_type_ignoring_top_level_qualifiers_p (ictx, type)) + { + gcc_assert (ANON_AGGR_TYPE_P (ictx)); + /* Find the anon aggr that is a direct member of TYPE. */ + while (true) + { + tree cctx = TYPE_CONTEXT (ictx); + if (same_type_ignoring_top_level_qualifiers_p (cctx, type)) + break; + ictx = cctx; + } + /* And then the TYPE member with that anon aggr type. */ + tree aafield = TYPE_FIELDS (type); + for (; aafield; aafield = TREE_CHAIN (aafield)) + if (TREE_TYPE (aafield) == ictx) + break; + gcc_assert (aafield); + field = aafield; + } } /* If we processed all the member of the class, we are done. */ @@ -6635,6 +6650,8 @@ reshape_init_r (tree type, reshape_iter *d, tree first_initializer_p, initialized from that element." Even if T is an aggregate. */ if (cxx_dialect >= cxx11 && (CLASS_TYPE_P (type) || VECTOR_TYPE_P (type)) && first_initializer_p + /* But not if it's a designated init. */ + && !d->cur->index && d->end - d->cur == 1 && reference_related_p (type, TREE_TYPE (init))) { @@ -11176,7 +11193,7 @@ mark_inline_variable (tree decl, location_t loc) inlinep = false; } else if (cxx_dialect < cxx17) - pedwarn (loc, 0, "inline variables are only available " + pedwarn (loc, OPT_Wc__17_extensions, "inline variables are only available " "with %<-std=c++17%> or %<-std=gnu++17%>"); if (inlinep) { @@ -12012,13 +12029,13 @@ grokdeclarator (const cp_declarator *declarator, storage_class = sc_none; staticp = 0; } - if (constexpr_p && cxx_dialect < cxx20) + if (constexpr_p && pedantic && cxx_dialect < cxx20) { gcc_rich_location richloc (declspecs->locations[ds_virtual]); richloc.add_range (declspecs->locations[ds_constexpr]); - pedwarn (&richloc, OPT_Wpedantic, "member %qD can be declared both " - "%<virtual%> and %<constexpr%> only in %<-std=c++20%> or " - "%<-std=gnu++20%>", dname); + pedwarn (&richloc, OPT_Wc__20_extensions, "member %qD can be " + "declared both %<virtual%> and %<constexpr%> only in " + "%<-std=c++20%> or %<-std=gnu++20%>", dname); } } friendp = decl_spec_seq_has_spec_p (declspecs, ds_friend); @@ -12106,7 +12123,7 @@ grokdeclarator (const cp_declarator *declarator, error_at (declspecs->locations[ds_consteval], "structured " "binding declaration cannot be %qs", "consteval"); if (thread_p && cxx_dialect < cxx20) - pedwarn (declspecs->locations[ds_thread], 0, + pedwarn (declspecs->locations[ds_thread], OPT_Wc__20_extensions, "structured binding declaration can be %qs only in " "%<-std=c++20%> or %<-std=gnu++20%>", declspecs->gnu_thread_keyword_p @@ -12128,7 +12145,7 @@ grokdeclarator (const cp_declarator *declarator, break; case sc_static: if (cxx_dialect < cxx20) - pedwarn (loc, 0, + pedwarn (loc, OPT_Wc__20_extensions, "structured binding declaration can be %qs only in " "%<-std=c++20%> or %<-std=gnu++20%>", "static"); break; @@ -13741,11 +13758,15 @@ grokdeclarator (const cp_declarator *declarator, if (friendp) { - if (attrlist && !funcdef_flag - /* Hack to allow attributes like vector_size on a friend. */ - && any_non_type_attribute_p (*attrlist)) - error_at (id_loc, "attribute appertains to a friend " - "declaration that is not a definition"); + /* Packages tend to use GNU attributes on friends, so we only + warn for standard attributes. */ + if (attrlist && !funcdef_flag && cxx11_attribute_p (*attrlist)) + { + *attrlist = NULL_TREE; + if (warning_at (id_loc, OPT_Wattributes, "attribute ignored")) + inform (id_loc, "an attribute that appertains to a friend " + "declaration that is not a definition is ignored"); + } /* Friends are treated specially. */ if (ctype == current_class_type) ; /* We already issued a permerror. */ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 8e4dd6b..89f874a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1331,20 +1331,6 @@ any_dependent_type_attributes_p (tree attrs) return false; } -/* True if ATTRS contains any attribute that does not require a type. */ - -bool -any_non_type_attribute_p (tree attrs) -{ - for (tree a = attrs; a; a = TREE_CHAIN (a)) - { - const attribute_spec *as = lookup_attribute_spec (get_attribute_name (a)); - if (as && !as->type_required) - return true; - } - return false; -} - /* Return true iff ATTRS are acceptable attributes to be applied in-place to a typedef which gives a previously unnamed class or enum a name for linkage purposes. */ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 3c2276b..3d5eebd 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -4407,77 +4407,78 @@ maybe_warn_cpp0x (cpp0x_warn_str str) switch (str) { case CPP0X_INITIALIZER_LISTS: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "extended initializer lists " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_EXPLICIT_CONVERSION: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "explicit conversion operators " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_VARIADIC_TEMPLATES: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "variadic templates " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_LAMBDA_EXPR: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "lambda expressions " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_AUTO: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "C++11 auto only available with %<-std=c++11%> or " "%<-std=gnu++11%>"); break; case CPP0X_SCOPED_ENUMS: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "scoped enums only available with %<-std=c++11%> or " "%<-std=gnu++11%>"); break; case CPP0X_DEFAULTED_DELETED: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "defaulted and deleted functions " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_INLINE_NAMESPACES: - pedwarn (input_location, OPT_Wpedantic, - "inline namespaces " - "only available with %<-std=c++11%> or %<-std=gnu++11%>"); + if (pedantic) + pedwarn (input_location, OPT_Wc__11_extensions, + "inline namespaces " + "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_OVERRIDE_CONTROLS: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "override controls (override/final) " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_NSDMI: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "non-static data member initializers " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_USER_DEFINED_LITERALS: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "user-defined literals " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_DELEGATING_CTORS: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "delegating constructors " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_INHERITING_CTORS: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "inheriting constructors " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_ATTRIBUTES: - pedwarn (input_location, 0, - "c++11 attributes " + pedwarn (input_location, OPT_Wc__11_extensions, + "C++11 attributes " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; case CPP0X_REF_QUALIFIER: - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__11_extensions, "ref-qualifiers " "only available with %<-std=c++11%> or %<-std=gnu++11%>"); break; diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 16e2b4c..4a1e090 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -160,24 +160,6 @@ begin_lambda_type (tree lambda) return type; } -/* Returns the type to use for the return type of the operator() of a - closure class. */ - -tree -lambda_return_type (tree expr) -{ - if (expr == NULL_TREE) - return void_type_node; - if (type_unknown_p (expr) - || BRACE_ENCLOSED_INITIALIZER_P (expr)) - { - cxx_incomplete_type_error (expr, TREE_TYPE (expr)); - return error_mark_node; - } - gcc_checking_assert (!type_dependent_expression_p (expr)); - return cv_unqualified (type_decays_to (unlowered_expr_type (expr))); -} - /* Given a LAMBDA_EXPR or closure type LAMBDA, return the op() of the closure type. */ diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index f0e1f41..ee14c2d 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -835,7 +835,7 @@ write_encoding (const tree decl) } } -/* Interface to substitution and identifer mangling, used by the +/* Interface to substitution and identifier mangling, used by the module name mangler. */ void diff --git a/gcc/cp/method.c b/gcc/cp/method.c index f8c9456..dd74523 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1087,7 +1087,8 @@ genericize_spaceship (location_t loc, tree type, tree op0, tree op1) gcc_checking_assert (tag < cc_last); tree r; - if (SCALAR_TYPE_P (TREE_TYPE (op0))) + bool scalar = SCALAR_TYPE_P (TREE_TYPE (op0)); + if (scalar) { op0 = save_expr (op0); op1 = save_expr (op1); @@ -1097,26 +1098,53 @@ genericize_spaceship (location_t loc, tree type, tree op0, tree op1) int flags = LOOKUP_NORMAL; tsubst_flags_t complain = tf_none; + tree comp; if (tag == cc_partial_ordering) { /* op0 == op1 ? equivalent : op0 < op1 ? less : op1 < op0 ? greater : unordered */ tree uo = lookup_comparison_result (tag, type, 3); - tree comp = build_new_op (loc, LT_EXPR, flags, op1, op0, complain); - r = build_conditional_expr (loc, comp, gt, uo, complain); + if (scalar) + { + /* For scalars use the low level operations; using build_new_op causes + trouble with constexpr eval in the middle of genericize (100367). */ + comp = fold_build2 (LT_EXPR, boolean_type_node, op1, op0); + r = fold_build3 (COND_EXPR, type, comp, gt, uo); + } + else + { + comp = build_new_op (loc, LT_EXPR, flags, op1, op0, complain); + r = build_conditional_expr (loc, comp, gt, uo, complain); + } } else /* op0 == op1 ? equal : op0 < op1 ? less : greater */ r = gt; tree lt = lookup_comparison_result (tag, type, 2); - tree comp = build_new_op (loc, LT_EXPR, flags, op0, op1, complain); - r = build_conditional_expr (loc, comp, lt, r, complain); + if (scalar) + { + comp = fold_build2 (LT_EXPR, boolean_type_node, op0, op1); + r = fold_build3 (COND_EXPR, type, comp, lt, r); + } + else + { + comp = build_new_op (loc, LT_EXPR, flags, op0, op1, complain); + r = build_conditional_expr (loc, comp, lt, r, complain); + } tree eq = lookup_comparison_result (tag, type, 0); - comp = build_new_op (loc, EQ_EXPR, flags, op0, op1, complain); - r = build_conditional_expr (loc, comp, eq, r, complain); + if (scalar) + { + comp = fold_build2 (EQ_EXPR, boolean_type_node, op0, op1); + r = fold_build3 (COND_EXPR, type, comp, eq, r); + } + else + { + comp = build_new_op (loc, EQ_EXPR, flags, op0, op1, complain); + r = build_conditional_expr (loc, comp, eq, r, complain); + } return r; } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c0b5795..48b83d6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -5577,8 +5577,9 @@ cp_parser_primary_expression (cp_parser *parser, expr = cp_parser_fold_expression (parser, expr); if (expr != error_mark_node && cxx_dialect < cxx17) - pedwarn (input_location, 0, "fold-expressions only available " - "with %<-std=c++17%> or %<-std=gnu++17%>"); + pedwarn (input_location, OPT_Wc__17_extensions, + "fold-expressions only available with %<-std=c++17%> " + "or %<-std=gnu++17%>"); } else /* Let the front end know that this expression was @@ -6325,7 +6326,7 @@ cp_parser_unqualified_id (cp_parser* parser, if (cp_parser_is_keyword (token, RID_AUTO)) { if (cxx_dialect < cxx14) - pedwarn (loc, 0, + pedwarn (loc, OPT_Wc__14_extensions, "%<~auto%> only available with " "%<-std=c++14%> or %<-std=gnu++14%>"); cp_lexer_consume_token (parser->lexer); @@ -8353,7 +8354,7 @@ cp_parser_pseudo_destructor_name (cp_parser* parser, && !type_dependent_expression_p (object)) { if (cxx_dialect < cxx14) - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__14_extensions, "%<~auto%> only available with " "%<-std=c++14%> or %<-std=gnu++14%>"); cp_lexer_consume_token (parser->lexer); @@ -11042,8 +11043,9 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) { location_t loc = cp_lexer_peek_token (parser->lexer)->location; if (cxx_dialect < cxx17) - pedwarn (loc, 0, "%<*this%> capture only available with " - "%<-std=c++17%> or %<-std=gnu++17%>"); + pedwarn (loc, OPT_Wc__17_extensions, + "%<*this%> capture only available with " + "%<-std=c++17%> or %<-std=gnu++17%>"); cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer); if (LAMBDA_EXPR_THIS_CAPTURE (lambda_expr)) @@ -11081,7 +11083,8 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) { ellipsis_loc = cp_lexer_peek_token (parser->lexer)->location; if (cxx_dialect < cxx20) - pedwarn (ellipsis_loc, 0, "pack init-capture only available with " + pedwarn (ellipsis_loc, OPT_Wc__20_extensions, + "pack init-capture only available with " "%<-std=c++20%> or %<-std=gnu++20%>"); cp_lexer_consume_token (parser->lexer); init_pack_expansion = true; @@ -11122,7 +11125,7 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) bool direct, non_constant; /* An explicit initializer exists. */ if (cxx_dialect < cxx14) - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__14_extensions, "lambda capture initializers " "only available with %<-std=c++14%> or %<-std=gnu++14%>"); capture_init_expr = cp_parser_initializer (parser, &direct, @@ -11296,11 +11299,11 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) if (cp_lexer_next_token_is (parser->lexer, CPP_LESS)) { if (cxx_dialect < cxx14) - pedwarn (parser->lexer->next_token->location, 0, + pedwarn (parser->lexer->next_token->location, OPT_Wc__14_extensions, "lambda templates are only available with " "%<-std=c++14%> or %<-std=gnu++14%>"); - else if (cxx_dialect < cxx20) - pedwarn (parser->lexer->next_token->location, OPT_Wpedantic, + else if (pedantic && cxx_dialect < cxx20) + pedwarn (parser->lexer->next_token->location, OPT_Wc__20_extensions, "lambda templates are only available with " "%<-std=c++20%> or %<-std=gnu++20%>"); @@ -11365,10 +11368,11 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) /* Default arguments shall not be specified in the parameter-declaration-clause of a lambda-declarator. */ - if (cxx_dialect < cxx14) + if (pedantic && cxx_dialect < cxx14) for (tree t = param_list; t; t = TREE_CHAIN (t)) if (TREE_PURPOSE (t) && DECL_P (TREE_VALUE (t))) - pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic, + pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), + OPT_Wc__14_extensions, "default argument specified for lambda parameter"); parens.require_close (parser); @@ -11388,7 +11392,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) if (omitted_parms_loc && lambda_specs.any_specifiers_p) { - pedwarn (omitted_parms_loc, 0, + pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda declaration " "specifiers only optional with %<-std=c++2b%> or " "%<-std=gnu++2b%>"); @@ -11407,7 +11411,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) tx_qual = cp_parser_tx_qualifier_opt (parser); if (omitted_parms_loc && tx_qual) { - pedwarn (omitted_parms_loc, 0, + pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda transaction " "qualifier only optional with %<-std=c++2b%> or " "%<-std=gnu++2b%>"); @@ -11420,7 +11424,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) if (omitted_parms_loc && exception_spec) { - pedwarn (omitted_parms_loc, 0, + pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda exception " "specification only optional with %<-std=c++2b%> or " "%<-std=gnu++2b%>"); @@ -11438,7 +11442,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) if (cp_lexer_next_token_is (parser->lexer, CPP_DEREF)) { if (omitted_parms_loc) - pedwarn (omitted_parms_loc, 0, + pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda trailing " "return type only optional with %<-std=c++2b%> or " "%<-std=gnu++2b%>"); @@ -12301,8 +12305,9 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p, cx = true; cp_token *tok = cp_lexer_consume_token (parser->lexer); if (cxx_dialect < cxx17) - pedwarn (tok->location, 0, "%<if constexpr%> only available " - "with %<-std=c++17%> or %<-std=gnu++17%>"); + pedwarn (tok->location, OPT_Wc__17_extensions, + "%<if constexpr%> only available with " + "%<-std=c++17%> or %<-std=gnu++17%>"); } /* Look for the `('. */ @@ -12327,7 +12332,8 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p, { tree decl; if (cxx_dialect < cxx17) - pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0, + pedwarn (cp_lexer_peek_token (parser->lexer)->location, + OPT_Wc__17_extensions, "init-statement in selection statements only available " "with %<-std=c++17%> or %<-std=gnu++17%>"); if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) @@ -13398,7 +13404,8 @@ cp_parser_init_statement (cp_parser *parser, tree *decl) if (cxx_dialect < cxx20) { - pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0, + pedwarn (cp_lexer_peek_token (parser->lexer)->location, + OPT_Wc__20_extensions, "range-based %<for%> loops with initializer only " "available with %<-std=c++20%> or %<-std=gnu++20%>"); *decl = error_mark_node; @@ -13422,7 +13429,8 @@ cp_parser_init_statement (cp_parser *parser, tree *decl) cp_lexer_consume_token (parser->lexer); is_range_for = true; if (cxx_dialect < cxx11) - pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0, + pedwarn (cp_lexer_peek_token (parser->lexer)->location, + OPT_Wc__11_extensions, "range-based %<for%> loops only available with " "%<-std=c++11%> or %<-std=gnu++11%>"); } @@ -14665,8 +14673,9 @@ cp_parser_decomposition_declaration (cp_parser *parser, } if (cxx_dialect < cxx17) - pedwarn (loc, 0, "structured bindings only available with " - "%<-std=c++17%> or %<-std=gnu++17%>"); + pedwarn (loc, OPT_Wc__17_extensions, + "structured bindings only available with " + "%<-std=c++17%> or %<-std=gnu++17%>"); tree pushed_scope; cp_declarator *declarator = make_declarator (cdk_decomp); @@ -15261,7 +15270,7 @@ cp_parser_function_specifier_opt (cp_parser* parser, = G_("types may not be defined in explicit-specifier"); if (cxx_dialect < cxx20) - pedwarn (token->location, 0, + pedwarn (token->location, OPT_Wc__20_extensions, "%<explicit(bool)%> only available with %<-std=c++20%> " "or %<-std=gnu++20%>"); @@ -15428,8 +15437,8 @@ cp_parser_static_assert(cp_parser *parser, bool member_p) if (cp_lexer_peek_token (parser->lexer)->type == CPP_CLOSE_PAREN) { - if (cxx_dialect < cxx17) - pedwarn (input_location, OPT_Wpedantic, + if (pedantic && cxx_dialect < cxx17) + pedwarn (input_location, OPT_Wc__17_extensions, "%<static_assert%> without a message " "only available with %<-std=c++17%> or %<-std=gnu++17%>"); /* Eat the ')' */ @@ -19774,9 +19783,12 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, && ! processing_explicit_instantiation) warning (OPT_Wattributes, "attributes ignored on template instantiation"); - else if (is_friend && attributes) - error ("attribute appertains to a friend declaration that is not " - "a definition"); + else if (is_friend && cxx11_attribute_p (attributes)) + { + if (warning (OPT_Wattributes, "attribute ignored")) + inform (input_location, "an attribute that appertains to a friend " + "declaration that is not a definition is ignored"); + } else if (is_declaration && cp_parser_declares_only_class_p (parser)) cplus_decl_attributes (&type, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE); else @@ -20415,10 +20427,11 @@ cp_parser_namespace_definition (cp_parser* parser) RID_INLINE); if (nested_inline_p && nested_definition_count != 0) { - if (cxx_dialect < cxx20) + if (pedantic && cxx_dialect < cxx20) pedwarn (cp_lexer_peek_token (parser->lexer)->location, - OPT_Wpedantic, "nested inline namespace definitions only " - "available with %<-std=c++20%> or %<-std=gnu++20%>"); + OPT_Wc__20_extensions, "nested inline namespace " + "definitions only available with %<-std=c++20%> or " + "%<-std=gnu++20%>"); cp_lexer_consume_token (parser->lexer); } @@ -20445,8 +20458,8 @@ cp_parser_namespace_definition (cp_parser* parser) break; } - if (!nested_definition_count && cxx_dialect < cxx17) - pedwarn (input_location, OPT_Wpedantic, + if (!nested_definition_count && pedantic && cxx_dialect < cxx17) + pedwarn (input_location, OPT_Wc__17_extensions, "nested namespace definitions only available with " "%<-std=c++17%> or %<-std=gnu++17%>"); @@ -20705,7 +20718,7 @@ cp_parser_using_declaration (cp_parser* parser, { cp_token *ell = cp_lexer_consume_token (parser->lexer); if (cxx_dialect < cxx17) - pedwarn (ell->location, 0, + pedwarn (ell->location, OPT_Wc__17_extensions, "pack expansion in using-declaration only available " "with %<-std=c++17%> or %<-std=gnu++17%>"); qscope = make_pack_expansion (qscope); @@ -20738,7 +20751,7 @@ cp_parser_using_declaration (cp_parser* parser, { cp_token *comma = cp_lexer_consume_token (parser->lexer); if (cxx_dialect < cxx17) - pedwarn (comma->location, 0, + pedwarn (comma->location, OPT_Wc__17_extensions, "comma-separated list in using-declaration only available " "with %<-std=c++17%> or %<-std=gnu++17%>"); goto again; @@ -21054,9 +21067,10 @@ cp_parser_asm_definition (cp_parser* parser) functions. */ if (parser->in_function_body && DECL_DECLARED_CONSTEXPR_P (current_function_decl) - && (cxx_dialect < cxx20)) - pedwarn (asm_loc, 0, "%<asm%> in %<constexpr%> function only available " - "with %<-std=c++20%> or %<-std=gnu++20%>"); + && cxx_dialect < cxx20) + pedwarn (asm_loc, OPT_Wc__20_extensions, "%<asm%> in %<constexpr%> " + "function only available with %<-std=c++20%> or " + "%<-std=gnu++20%>"); /* Handle the asm-qualifier-list. */ location_t volatile_loc = UNKNOWN_LOCATION; @@ -24128,11 +24142,11 @@ cp_parser_ctor_initializer_opt_and_function_body (cp_parser *parser, && cxx_dialect < cxx20) { if (DECL_CONSTRUCTOR_P (current_function_decl)) - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__20_extensions, "function-try-block body of %<constexpr%> constructor only " "available with %<-std=c++20%> or %<-std=gnu++20%>"); else - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__20_extensions, "function-try-block body of %<constexpr%> function only " "available with %<-std=c++20%> or %<-std=gnu++20%>"); } @@ -24455,8 +24469,8 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p, || (cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_OPEN_BRACE))) { - if (cxx_dialect < cxx20) - pedwarn (loc, OPT_Wpedantic, + if (pedantic && cxx_dialect < cxx20) + pedwarn (loc, OPT_Wc__20_extensions, "C++ designated initializers only available with " "%<-std=c++20%> or %<-std=gnu++20%>"); /* Consume the `.'. */ @@ -25797,10 +25811,11 @@ cp_parser_type_parameter_key (cp_parser* parser) if ((tag_type = cp_parser_token_is_type_parameter_key (token)) != none_type) { cp_lexer_consume_token (parser->lexer); - if (pedantic && tag_type == typename_type && cxx_dialect < cxx17) + if (pedantic && tag_type == typename_type + && cxx_dialect < cxx17) /* typename is not allowed in a template template parameter by the standard until C++17. */ - pedwarn (token->location, OPT_Wpedantic, + pedwarn (token->location, OPT_Wc__17_extensions, "ISO C++ forbids typename key in template template parameter;" " use %<-std=c++17%> or %<-std=gnu++17%>"); } @@ -26064,17 +26079,23 @@ cp_parser_member_declaration (cp_parser* parser) if (type && TREE_CODE (type) == TYPE_DECL) type = TREE_TYPE (type); } + /* Warn if an attribute cannot appear here, as per + [dcl.attr.grammar]/5. But not when declares_class_or_enum: + we ignore attributes in elaborated-type-specifiers. */ + if (!declares_class_or_enum + && cxx11_attribute_p (decl_specifiers.attributes)) + { + decl_specifiers.attributes = NULL_TREE; + if (warning_at (decl_spec_token_start->location, + OPT_Wattributes, "attribute ignored")) + inform (decl_spec_token_start->location, "an attribute " + "that appertains to a friend declaration that " + "is not a definition is ignored"); + } if (!type || !TYPE_P (type)) error_at (decl_spec_token_start->location, "friend declaration does not name a class or " "function"); - /* Give an error if an attribute cannot appear here, as per - [dcl.attr.grammar]/5. But not when declares_class_or_enum: - we ignore attributes in elaborated-type-specifiers. */ - else if (!declares_class_or_enum && decl_specifiers.attributes) - error_at (decl_spec_token_start->location, - "attribute appertains to a friend declaration " - "that is not a definition"); else make_friend_class (current_class_type, type, /*complain=*/true); @@ -26188,7 +26209,7 @@ cp_parser_member_declaration (cp_parser* parser) = cp_lexer_peek_token (parser->lexer)->location; if (cxx_dialect < cxx20 && identifier != NULL_TREE) - pedwarn (loc, 0, + pedwarn (loc, OPT_Wc__20_extensions, "default member initializers for bit-fields " "only available with %<-std=c++20%> or " "%<-std=gnu++20%>"); @@ -27149,7 +27170,7 @@ cp_parser_try_block (cp_parser* parser) if (parser->in_function_body && DECL_DECLARED_CONSTEXPR_P (current_function_decl) && cxx_dialect < cxx20) - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__20_extensions, "%<try%> in %<constexpr%> function only " "available with %<-std=c++20%> or %<-std=gnu++20%>"); @@ -28108,7 +28129,7 @@ cp_parser_std_attribute_spec (cp_parser *parser) && cp_lexer_nth_token_is (parser->lexer, 3, CPP_COLON)) { if (cxx_dialect < cxx17) - pedwarn (input_location, 0, + pedwarn (input_location, OPT_Wc__17_extensions, "attribute using prefix only available " "with %<-std=c++17%> or %<-std=gnu++17%>"); @@ -40922,7 +40943,9 @@ cp_parser_omp_master (cp_parser *parser, cp_token *pragma_tok, tree body = finish_omp_structured_block (sb); if (ret == NULL) return ret; - return c_finish_omp_master (loc, body); + ret = c_finish_omp_master (loc, body); + OMP_MASTER_COMBINED (ret) = 1; + return ret; } } if (!flag_openmp) /* flag_openmp_simd */ @@ -41206,7 +41229,16 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok, block); if (ret == NULL_TREE) return ret; - OMP_PARALLEL_COMBINED (stmt) = 1; + /* master doesn't have any clauses and during gimplification + isn't represented by a gimplification omp context, so for + #pragma omp parallel master don't set OMP_PARALLEL_COMBINED, + so that + #pragma omp parallel master + #pragma omp taskloop simd lastprivate (x) + isn't confused with + #pragma omp parallel master taskloop simd lastprivate (x) */ + if (OMP_MASTER_COMBINED (ret)) + OMP_PARALLEL_COMBINED (stmt) = 1; return stmt; } else if (strcmp (p, "loop") == 0) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bf99635..99a9ee5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2703,7 +2703,7 @@ check_template_variable (tree decl) && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl))) { if (cxx_dialect < cxx14) - pedwarn (DECL_SOURCE_LOCATION (decl), 0, + pedwarn (DECL_SOURCE_LOCATION (decl), OPT_Wc__14_extensions, "variable templates only available with " "%<-std=c++14%> or %<-std=gnu++14%>"); @@ -3693,25 +3693,6 @@ get_primary_template_innermost_parameters (const_tree t) return parms; } -/* Return the template parameters of the LEVELth level from the full list - of template parameters PARMS. */ - -tree -get_template_parms_at_level (tree parms, int level) -{ - tree p; - if (!parms - || TREE_CODE (parms) != TREE_LIST - || level > TMPL_PARMS_DEPTH (parms)) - return NULL_TREE; - - for (p = parms; p; p = TREE_CHAIN (p)) - if (TMPL_PARMS_DEPTH (p) == level) - return p; - - return NULL_TREE; -} - /* Returns the template arguments of T if T is a template instantiation, NULL otherwise. */ @@ -13276,36 +13257,6 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, return result; } -/* Given PARM_DECL PARM, find the corresponding PARM_DECL in the template - TMPL. We do this using DECL_PARM_INDEX, which should work even with - parameter packs; all parms generated from a function parameter pack will - have the same DECL_PARM_INDEX. */ - -tree -get_pattern_parm (tree parm, tree tmpl) -{ - tree pattern = DECL_TEMPLATE_RESULT (tmpl); - tree patparm; - - if (DECL_ARTIFICIAL (parm)) - { - for (patparm = DECL_ARGUMENTS (pattern); - patparm; patparm = DECL_CHAIN (patparm)) - if (DECL_ARTIFICIAL (patparm) - && DECL_NAME (parm) == DECL_NAME (patparm)) - break; - } - else - { - patparm = FUNCTION_FIRST_USER_PARM (DECL_TEMPLATE_RESULT (tmpl)); - patparm = chain_index (DECL_PARM_INDEX (parm)-1, patparm); - gcc_assert (DECL_PARM_INDEX (patparm) - == DECL_PARM_INDEX (parm)); - } - - return patparm; -} - /* Make an argument pack out of the TREE_VEC VEC. */ static tree @@ -26612,6 +26563,8 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) else if (cxx_dialect >= cxx11 && TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM) return false; + else if (TREE_CODE (type) == COMPLEX_TYPE) + /* Fall through. */; else if (VOID_TYPE_P (type)) /* Fall through. */; else if (cxx_dialect >= cxx20) @@ -28852,6 +28805,9 @@ build_deduction_guide (tree type, tree ctor, tree outer_args, tsubst_flags_t com DECL_ABSTRACT_ORIGIN (ded_tmpl) = fn_tmpl; if (ci) set_constraints (ded_tmpl, ci); + /* The artificial deduction guide should have same access as the + constructor. */ + DECL_CONTEXT (ded_fn) = type; return ded_tmpl; } @@ -29370,7 +29326,8 @@ do_class_deduction (tree ptype, tree tmpl, tree init, { list_init_p = true; try_list_ctor = TYPE_HAS_LIST_CTOR (type); - if (try_list_ctor && CONSTRUCTOR_NELTS (init) == 1) + if (try_list_ctor && CONSTRUCTOR_NELTS (init) == 1 + && !CONSTRUCTOR_IS_DESIGNATED_INIT (init)) { /* As an exception, the first phase in 16.3.1.7 (considering the initializer list as a single argument) is omitted if the diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 5a33b83..82eaa28 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -433,7 +433,7 @@ get_tinfo_decl_direct (tree type, tree name, int pseudo_ix) if (!name) name = mangle_typeinfo_for_type (type); - if (!CLASS_TYPE_P (type)) + if (!CLASS_TYPE_P (type) || TYPE_TRANSPARENT_AGGR (type)) d = get_global_binding (name); if (!d) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0d590c3..fffbe40 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -6519,6 +6519,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) bool allocate_seen = false; tree detach_seen = NULL_TREE; bool mergeable_seen = false; + bool firstprivate_implicit_moved = false; bitmap_obstack_initialize (NULL); bitmap_initialize (&generic_head, &bitmap_default_obstack); @@ -6843,6 +6844,29 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) break; case OMP_CLAUSE_FIRSTPRIVATE: + if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) + && !firstprivate_implicit_moved) + { + firstprivate_implicit_moved = true; + /* Move firstprivate clauses with + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT set to the end of + clauses chain. */ + tree cl = NULL, *pc1 = pc, *pc2 = &cl; + while (*pc1) + if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_FIRSTPRIVATE + && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (*pc1)) + { + *pc2 = *pc1; + pc2 = &OMP_CLAUSE_CHAIN (*pc2); + *pc1 = OMP_CLAUSE_CHAIN (*pc1); + } + else + pc1 = &OMP_CLAUSE_CHAIN (*pc1); + *pc2 = NULL; + *pc1 = cl; + if (pc1 != pc) + continue; + } t = omp_clause_decl_field (OMP_CLAUSE_DECL (c)); if (t) omp_note_field_privatization (t, OMP_CLAUSE_DECL (c)); @@ -6884,6 +6908,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (ort == C_ORT_ACC) error_at (OMP_CLAUSE_LOCATION (c), "%qD appears more than once in data clauses", t); + else if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) + && !OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c)) + /* Silently drop the clause. */; else error_at (OMP_CLAUSE_LOCATION (c), "%qD appears both in data and map clauses", t); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 35faeff..72f498f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1741,13 +1741,18 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags) result = finish_underlying_type (type); break; case TYPE_PACK_EXPANSION: - type = strip_typedefs (PACK_EXPANSION_PATTERN (t), - remove_attributes, flags); - if (type != PACK_EXPANSION_PATTERN (t)) - { - result = copy_node (t); - PACK_EXPANSION_PATTERN (result) = type; - } + { + tree pat = PACK_EXPANSION_PATTERN (t); + if (TYPE_P (pat)) + { + type = strip_typedefs (pat, remove_attributes, flags); + if (type != pat) + { + result = copy_node (t); + PACK_EXPANSION_PATTERN (result) = type; + } + } + } break; default: break; diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index ce3016c..6679e24 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1183,6 +1183,7 @@ digest_init_r (tree type, tree init, int nested, int flags, the object is initialized from that element." */ if (cxx_dialect >= cxx11 && BRACE_ENCLOSED_INITIALIZER_P (stripped_init) + && !CONSTRUCTOR_IS_DESIGNATED_INIT (stripped_init) && CONSTRUCTOR_NELTS (stripped_init) == 1 && ((CLASS_TYPE_P (type) && !CLASSTYPE_NON_AGGREGATE (type)) || VECTOR_TYPE_P (type))) @@ -1517,19 +1518,6 @@ process_init_constructor_record (tree type, tree init, int nested, int flags, || identifier_p (ce->index)); if (ce->index == field || ce->index == DECL_NAME (field)) next = ce->value; - else if (ANON_AGGR_TYPE_P (fldtype) - && search_anon_aggr (fldtype, - TREE_CODE (ce->index) == FIELD_DECL - ? DECL_NAME (ce->index) - : ce->index)) - /* If the element is an anonymous union object and the - initializer list is a designated-initializer-list, the - anonymous union object is initialized by the - designated-initializer-list { D }, where D is the - designated-initializer-clause naming a member of the - anonymous union object. */ - next = build_constructor_single (init_list_type_node, - ce->index, ce->value); else { ce = NULL; @@ -1675,19 +1663,6 @@ process_init_constructor_record (tree type, tree init, int nested, int flags, if (ce->index == field || ce->index == DECL_NAME (field)) break; - if (ANON_AGGR_TYPE_P (TREE_TYPE (field))) - { - tree t - = search_anon_aggr (TREE_TYPE (field), - TREE_CODE (ce->index) == FIELD_DECL - ? DECL_NAME (ce->index) - : ce->index); - if (t) - { - field = t; - break; - } - } } } if (field) diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 2e66ed5..85176b7 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,19 @@ +2021-05-18 Iain Buclaw <ibuclaw@gdcproject.org> + + * d-incpath.cc (prefixed_path): Use filename_ncmp instead of strncmp. + +2021-05-18 Iain Buclaw <ibuclaw@gdcproject.org> + + * types.cc (TypeVisitor::visit (TypeEnum *)): Use startswith function + instead of strncmp. + +2021-05-18 Iain Buclaw <ibuclaw@gdcproject.org> + + * dmd/dinterpret.c (evaluateIfBuiltin): Revert last change. + * dmd/dmangle.c: Likewise. + * dmd/hdrgen.c: Likewise. + * dmd/identifier.c (Identifier::toHChars2): Likewise. + 2021-05-10 Iain Buclaw <ibuclaw@gdcproject.org> * dmd/MERGE: Merge upstream dmd b7d146c4c. diff --git a/gcc/d/d-incpath.cc b/gcc/d/d-incpath.cc index 8b7c435..d863929 100644 --- a/gcc/d/d-incpath.cc +++ b/gcc/d/d-incpath.cc @@ -30,11 +30,9 @@ along with GCC; see the file COPYING3. If not see static char * prefixed_path (const char *path, const char *iprefix) { - size_t len; - - if (cpp_relocated () && (len = cpp_PREFIX_len) != 0) + if (cpp_relocated () && cpp_PREFIX_len != 0) { - if (!strncmp (path, cpp_PREFIX, len)) + if (!filename_ncmp (path, cpp_PREFIX, cpp_PREFIX_len)) { static const char *relocated_prefix; /* If this path starts with the configure-time prefix, @@ -52,14 +50,14 @@ prefixed_path (const char *path, const char *iprefix) free (dummy); } - return concat (relocated_prefix, path + len, NULL); + return concat (relocated_prefix, path + cpp_PREFIX_len, NULL); } } - if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) + if (iprefix && cpp_GCC_INCLUDE_DIR_len != 0) { - if (!strncmp (path, cpp_GCC_INCLUDE_DIR, len)) - return concat (iprefix, path + len, NULL); + if (!filename_ncmp (path, cpp_GCC_INCLUDE_DIR, cpp_GCC_INCLUDE_DIR_len)) + return concat (iprefix, path + cpp_GCC_INCLUDE_DIR_len, NULL); } return xstrdup (path); diff --git a/gcc/d/dmd/dinterpret.c b/gcc/d/dmd/dinterpret.c index 9e74a0d..5e71f3b 100644 --- a/gcc/d/dmd/dinterpret.c +++ b/gcc/d/dmd/dinterpret.c @@ -6881,7 +6881,7 @@ Expression *evaluateIfBuiltin(UnionExp *pue, InterState *istate, Loc loc, const char *id = fd->ident->toChars(); size_t idlen = strlen(id); if (nargs == 2 && (idlen == 10 || idlen == 11) && - startswith (id, "_aApply")) + !strncmp(id, "_aApply", 7)) { // Functions from aApply.d and aApplyR.d in the runtime bool rvs = (idlen == 11); // true if foreach_reverse diff --git a/gcc/d/dmd/dmangle.c b/gcc/d/dmd/dmangle.c index f112243..83f4c18 100644 --- a/gcc/d/dmd/dmangle.c +++ b/gcc/d/dmd/dmangle.c @@ -673,7 +673,7 @@ public: cd == ClassDeclaration::object || cd == Type::typeinfoclass || cd == Module::moduleinfo || - startswith (cd->ident->toChars(), "TypeInfo_")) + strncmp(cd->ident->toChars(), "TypeInfo_", 9) == 0) { // Don't mangle parent ad->parent = NULL; diff --git a/gcc/d/dmd/hdrgen.c b/gcc/d/dmd/hdrgen.c index e72273b..9397b1e 100644 --- a/gcc/d/dmd/hdrgen.c +++ b/gcc/d/dmd/hdrgen.c @@ -3212,7 +3212,7 @@ public: } else if (p->type->ty == Tident && strlen(((TypeIdentifier *)p->type)->ident->toChars()) > 3 && - startswith (((TypeIdentifier *)p->type)->ident->toChars(), "__T")) + strncmp(((TypeIdentifier *)p->type)->ident->toChars(), "__T", 3) == 0) { // print parameter name, instead of undetermined type parameter buf->writestring(p->ident->toChars()); diff --git a/gcc/d/dmd/identifier.c b/gcc/d/dmd/identifier.c index dd2c58f..197d288 100644 --- a/gcc/d/dmd/identifier.c +++ b/gcc/d/dmd/identifier.c @@ -73,11 +73,11 @@ const char *Identifier::toHChars2() { p = toChars(); if (*p == '_') { - if (startswith(p, "_staticCtor")) + if (strncmp(p, "_staticCtor", 11) == 0) p = "static this"; - else if (startswith(p, "_staticDtor")) + else if (strncmp(p, "_staticDtor", 11) == 0) p = "static ~this"; - else if (startswith(p, "__invariant")) + else if (strncmp(p, "__invariant", 11) == 0) p = "invariant"; } } diff --git a/gcc/d/types.cc b/gcc/d/types.cc index 3b121f5..ba2d6d4 100644 --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -874,7 +874,7 @@ public: Type *underlying = NULL; /* Skip over the prefixing `__c_'. */ - gcc_assert (strncmp (ident, "__c_", strlen ("__c_")) == 0); + gcc_assert (startswith (ident, "__c_")); ident = ident + strlen ("__c_"); /* To keep things compatible within the code generation we stick to diff --git a/gcc/dbxout.c b/gcc/dbxout.c index d20527b..6be2827 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -92,6 +92,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "expr.h" #include "file-prefix-map.h" /* remap_debug_filename() */ +#include "flags.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index fd12af9..7272eb0 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -1929,6 +1929,13 @@ This macro expands to the name of the main input file, in the form of a C string constant. This is the source file that was specified on the command line of the preprocessor or C compiler. +@item __FILE_NAME__ +This macro expands to the basename of the current input file, in the +form of a C string constant. This is the last path component by which +the preprocessor opened the file. For example, processing +@code{"/usr/local/include/myheader.h"} would set this +macro to @code{"myheader.h"}. + @item __INCLUDE_LEVEL__ This macro expands to a decimal integer constant that represents the depth of nesting in include files. The value of this macro is @@ -2236,11 +2243,13 @@ mechanism based on @code{setjmp} and @code{longjmp} for exception handling. @item __GXX_EXPERIMENTAL_CXX0X__ -This macro is defined when compiling a C++ source file with the option -@option{-std=c++0x} or @option{-std=gnu++0x}. It indicates that some -features likely to be included in C++0x are available. Note that these -features are experimental, and may change or be removed in future -versions of GCC. +This macro is defined when compiling a C++ source file with C++11 features +enabled, i.e., for all C++ language dialects except @option{-std=c++98} +and @option{-std=gnu++98}. This macro is obsolete, but can be used to +detect experimental C++0x features in very old versions of GCC. Since +GCC 4.7.0 the @code{__cplusplus} macro is defined correctly, so most +code should test @code{__cplusplus >= 201103L} instead of using this +macro. @item __GXX_WEAK__ This macro is defined when compiling a C++ source file. It has the diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a0c9bb2..4b4699f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -330,7 +330,9 @@ Objective-C and Objective-C++ Dialects}. -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol -Wc11-c2x-compat @gol -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol --Wc++20-compat @gol +-Wc++20-compat @gol +-Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions @gol +-Wno-c++20-extensions -Wno-c++23-extensions @gol -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol -Wchar-subscripts @gol -Wclobbered -Wcomment @gol @@ -8154,6 +8156,41 @@ and ISO C++ 2017. This warning is enabled by @option{-Wall}. Warn about C++ constructs whose meaning differs between ISO C++ 2017 and ISO C++ 2020. This warning is enabled by @option{-Wall}. +@item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)} +@opindex Wc++11-extensions +@opindex Wno-c++11-extensions +Do not warn about C++11 constructs in code being compiled using +an older C++ standard. Even without this option, some C++11 constructs +will only be diagnosed if @option{-Wpedantic} is used. + +@item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)} +@opindex Wc++14-extensions +@opindex Wno-c++14-extensions +Do not warn about C++14 constructs in code being compiled using +an older C++ standard. Even without this option, some C++14 constructs +will only be diagnosed if @option{-Wpedantic} is used. + +@item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)} +@opindex Wc++17-extensions +@opindex Wno-c++17-extensions +Do not warn about C++17 constructs in code being compiled using +an older C++ standard. Even without this option, some C++17 constructs +will only be diagnosed if @option{-Wpedantic} is used. + +@item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)} +@opindex Wc++20-extensions +@opindex Wno-c++20-extensions +Do not warn about C++20 constructs in code being compiled using +an older C++ standard. Even without this option, some C++20 constructs +will only be diagnosed if @option{-Wpedantic} is used. + +@item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)} +@opindex Wc++23-extensions +@opindex Wno-c++23-extensions +Do not warn about C++23 constructs in code being compiled using +an older C++ standard. Even without this option, some C++23 constructs +will only be diagnosed if @option{-Wpedantic} is used. + @item -Wcast-qual @opindex Wcast-qual @opindex Wno-cast-qual @@ -14226,6 +14263,11 @@ code to iterate. 2 allows partial vector loads and stores in all loops. The parameter only has an effect on targets that support partial vector loads and stores. +@item vect-inner-loop-cost-factor +The factor which the loop vectorizer applies to the cost of statements +in an inner loop relative to the loop being vectorized. The default +value is 50. + @item avoid-fma-max-bits Maximum number of bits for which we avoid creating FMAs. @@ -14383,6 +14425,14 @@ With @option{--param=openacc-kernels=parloops}, OpenACC `kernels' constructs are handled by the @samp{parloops} pass, en bloc. This is the current default. +@item openacc-privatization +Specify mode of OpenACC privatization diagnostics for +@option{-fopt-info-omp-note} and applicable +@option{-fdump-tree-*-details}. +With @option{--param=openacc-privatization=quiet}, don't diagnose. +This is the current default. +With @option{--param=openacc-privatization=noisy}, do diagnose. + @end table The following choices of @var{name} are available on AArch64 targets: diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index ceb6b99..cf309874 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1217,6 +1217,21 @@ If there is no message for that line or if the text of that message is not matched by @var{regexp} then the check fails and @var{comment} is included in the @code{FAIL} message. +@item @{ dg-note @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @} +The line is expected to get a @samp{note} message. +If there is no message for that line or if the text of that message is +not matched by @var{regexp} then the check fails and @var{comment} is +included in the @code{FAIL} message. + +By default, any @emph{excess} @samp{note} messages are pruned, meaning +their appearance doesn't trigger @emph{excess errors}. +However, if @samp{dg-note} is used at least once in a testcase, +they're not pruned and instead must @emph{all} be handled explicitly. +Thus, if looking for just single instances of messages with +@samp{note: } prefixes without caring for all of them, use +@samp{dg-message "note: [@dots{}]"} instead of @samp{dg-note}, or use +@samp{dg-note} together with @samp{dg-prune-output "note: "}. + @item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @} This DejaGnu directive appears on a source line that should not get a message matching @var{regexp}, or else specifies the source line @@ -1227,7 +1242,8 @@ targets. @item @{ dg-line @var{linenumvar} @} This DejaGnu directive sets the variable @var{linenumvar} to the line number of the source line. The variable @var{linenumvar} can then be used in subsequent -@code{dg-error}, @code{dg-warning}, @code{dg-message} and @code{dg-bogus} +@code{dg-error}, @code{dg-warning}, @code{dg-message}, @code{dg-note} +and @code{dg-bogus} directives. For example: @smallexample @@ -1239,7 +1255,9 @@ float a; /* @{ dg-error "conflicting types of" @} */ @item @{ dg-excess-errors @var{comment} [@{ target/xfail @var{selector} @}] @} This DejaGnu directive indicates that the test is expected to fail due to compiler messages that are not handled by @samp{dg-error}, -@samp{dg-warning} or @samp{dg-bogus}. For this directive @samp{xfail} +@samp{dg-warning}, @code{dg-message}, @samp{dg-note} or +@samp{dg-bogus}. +For this directive @samp{xfail} has the same effect as @samp{target}. @item @{ dg-prune-output @var{regexp} @} @@ -2737,6 +2755,10 @@ constant. @item lgccjit Target supports -lgccjit, i.e. libgccjit.so can be linked into jit tests. + +@item __OPTIMIZE__ +Optimizations are enabled (@code{__OPTIMIZE__}) per the current +compiler flags. @end table @subsubsection Local to tests in @code{gcc.target/i386} diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 85ea939..e3a080e 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6236,6 +6236,32 @@ like @code{cond_add@var{m}}. The default implementation returns a zero constant of type @var{type}. @end deftypefn +@deftypefn {Target Hook} tree TARGET_GOACC_ADJUST_PRIVATE_DECL (location_t @var{loc}, tree @var{var}, int @var{level}) +This hook, if defined, is used by accelerator target back-ends to adjust +OpenACC variable declarations that should be made private to the given +parallelism level (i.e. @code{GOMP_DIM_GANG}, @code{GOMP_DIM_WORKER} or +@code{GOMP_DIM_VECTOR}). A typical use for this hook is to force variable +declarations at the @code{gang} level to reside in GPU shared memory. +@var{loc} may be used for diagnostic purposes. + +You may also use the @code{TARGET_GOACC_EXPAND_VAR_DECL} hook if the +adjusted variable declaration needs to be expanded to RTL in a non-standard +way. +@end deftypefn + +@deftypefn {Target Hook} rtx TARGET_GOACC_EXPAND_VAR_DECL (tree @var{var}) +This hook, if defined, is used by accelerator target back-ends to expand +specially handled kinds of @code{VAR_DECL} expressions. A particular use is +to place variables with specific attributes inside special accelarator +memories. A return value of @code{NULL} indicates that the target does not +handle this @code{VAR_DECL}, and normal RTL expanding is resumed. + +Only define this hook if your accelerator target needs to expand certain +@code{VAR_DECL} nodes in a way that differs from the default. You can also adjust +private variables at OpenACC device-lowering time using the +@code{TARGET_GOACC_ADJUST_PRIVATE_DECL} target hook. +@end deftypefn + @node Anchored Addresses @section Anchored Addresses @cindex anchored addresses diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index d8e3de1..d9fbbe2 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4221,6 +4221,10 @@ address; but often a machine-dependent strategy can generate better code. @hook TARGET_PREFERRED_ELSE_VALUE +@hook TARGET_GOACC_ADJUST_PRIVATE_DECL + +@hook TARGET_GOACC_EXPAND_VAR_DECL + @node Anchored Addresses @section Anchored Addresses @cindex anchored addresses diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index 362ff3f..c27ac19 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -39,7 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "expr.h" /* init_return_column_size */ #include "output.h" /* asm_out_file */ #include "debug.h" /* dwarf2out_do_frame, dwarf2out_do_cfi_asm */ - +#include "flags.h" /* dwarf_debuginfo_p */ /* ??? Poison these here until it can be done generically. They've been totally replaced in this file; make sure it stays that way. */ @@ -2289,8 +2289,7 @@ cfi_label_required_p (dw_cfi_ref cfi) if (dwarf_version == 2 && debug_info_level > DINFO_LEVEL_TERSE - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG)) + && dwarf_debuginfo_p ()) { switch (cfi->dw_cfi_opc) { @@ -3557,9 +3556,9 @@ bool dwarf2out_do_frame (void) { /* We want to emit correct CFA location expressions or lists, so we - have to return true if we're going to output debug info, even if + have to return true if we're going to generate debug info, even if we're not going to output frame or unwind info. */ - if (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) return true; if (saved_do_cfi_asm > 0) diff --git a/gcc/except.c b/gcc/except.c index a7902bbd..d481a5e 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -144,6 +144,7 @@ along with GCC; see the file COPYING3. If not see #include "cfgloop.h" #include "builtins.h" #include "tree-hash-traits.h" +#include "flags.h" static GTY(()) int call_site_base; @@ -8523,6 +8523,19 @@ expand_constructor (tree exp, rtx target, enum expand_modifier modifier, return constructor; } + /* If the CTOR is available in static storage and not mostly + zeros and we can move it by pieces prefer to do so since + that's usually more efficient than performing a series of + stores from immediates. */ + if (avoid_temp_mem + && TREE_STATIC (exp) + && TREE_CONSTANT (exp) + && tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)) + && can_move_by_pieces (tree_to_uhwi (TYPE_SIZE_UNIT (type)), + TYPE_ALIGN (type)) + && ! mostly_zeros_p (exp)) + return NULL_RTX; + /* Handle calls that pass values in multiple non-contiguous locations. The Irix 6 ABI has examples of this. */ if (target == 0 || ! safe_from_p (target, exp, 1) @@ -10406,8 +10419,19 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, exp = SSA_NAME_VAR (ssa_name); goto expand_decl_rtl; - case PARM_DECL: case VAR_DECL: + /* Allow accel compiler to handle variables that require special + treatment, e.g. if they have been modified in some way earlier in + compilation by the adjust_private_decl OpenACC hook. */ + if (flag_openacc && targetm.goacc.expand_var_decl) + { + temp = targetm.goacc.expand_var_decl (exp); + if (temp) + return temp; + } + /* ... fall through ... */ + + case PARM_DECL: /* If a static var's type was incomplete when the decl was written, but the type is complete now, lay out the decl now. */ if (DECL_SIZE (exp) == 0 diff --git a/gcc/final.c b/gcc/final.c index e0a70fc..38c3d70 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1428,7 +1428,8 @@ asm_str_count (const char *templ) static bool dwarf2_debug_info_emitted_p (tree decl) { - if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG) + /* When DWARF2 debug info is not generated internally. */ + if (!dwarf_debuginfo_p ()) return false; if (DECL_IGNORED_P (decl)) @@ -2306,10 +2307,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, break; case NOTE_INSN_BLOCK_BEG: - if (debug_info_level == DINFO_LEVEL_NORMAL - || debug_info_level == DINFO_LEVEL_VERBOSE - || write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG + if (debug_info_level >= DINFO_LEVEL_NORMAL + || dwarf_debuginfo_p () || write_symbols == VMS_DEBUG) { int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); @@ -2344,10 +2343,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, case NOTE_INSN_BLOCK_END: maybe_output_next_view (seen); - if (debug_info_level == DINFO_LEVEL_NORMAL - || debug_info_level == DINFO_LEVEL_VERBOSE - || write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG + if (debug_info_level >= DINFO_LEVEL_NORMAL + || dwarf_debuginfo_p () || write_symbols == VMS_DEBUG) { int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); diff --git a/gcc/flag-types.h b/gcc/flag-types.h index a038c8f..375448e 100644 --- a/gcc/flag-types.h +++ b/gcc/flag-types.h @@ -24,15 +24,30 @@ along with GCC; see the file COPYING3. If not see enum debug_info_type { - NO_DEBUG, /* Write no debug info. */ - DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */ - DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */ - XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */ - VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */ - VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c). - and DWARF v2 debug info (using dwarf2out.c). */ + DINFO_TYPE_NONE = 0, /* No debug info. */ + DINFO_TYPE_DBX = 1, /* BSD .stabs for DBX. */ + DINFO_TYPE_DWARF2 = 2, /* Dwarf v2 debug info. */ + DINFO_TYPE_XCOFF = 3, /* IBM/Xcoff debug info. */ + DINFO_TYPE_VMS = 4, /* VMS debug info. */ + DINFO_TYPE_MAX = DINFO_TYPE_VMS /* Marker only. */ }; +#define NO_DEBUG (0U) +/* Write DBX debug info (using dbxout.c). */ +#define DBX_DEBUG (1U << DINFO_TYPE_DBX) +/* Write DWARF2 debug info (using dwarf2out.c). */ +#define DWARF2_DEBUG (1U << DINFO_TYPE_DWARF2) +/* Write IBM/XCOFF debug info (using dbxout.c). */ +#define XCOFF_DEBUG (1U << DINFO_TYPE_XCOFF) +/* Write VMS debug info (using vmsdbgout.c). */ +#define VMS_DEBUG (1U << DINFO_TYPE_VMS) +/* Note: Adding new definitions to handle -combination- of debug formats, + like VMS_AND_DWARF2_DEBUG is not recommended. This definition remains + here for historical reasons. */ +/* Write VMS debug info (using vmsdbgout.c) and DWARF v2 debug info (using + dwarf2out.c). */ +#define VMS_AND_DWARF2_DEBUG ((VMS_DEBUG | DWARF2_DEBUG)) + enum debug_info_levels { DINFO_LEVEL_NONE, /* Write no debugging info. */ @@ -427,6 +442,13 @@ enum openacc_kernels OPENACC_KERNELS_PARLOOPS }; +/* Modes of OpenACC privatization diagnostics. */ +enum openacc_privatization +{ + OPENACC_PRIVATIZATION_QUIET, + OPENACC_PRIVATIZATION_NOISY +}; + #endif #endif /* ! GCC_FLAG_TYPES_H */ diff --git a/gcc/flags.h b/gcc/flags.h index 0c4409e..cc7b79b 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -22,9 +22,28 @@ along with GCC; see the file COPYING3. If not see #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) -/* Names of debug_info_type, for error messages. */ +/* Names of fundamental debug info formats indexed by enum + debug_info_type. */ + extern const char *const debug_type_names[]; +/* Get enum debug_info_type of the specified debug format, for error messages. + Can be used only for individual debug format types. */ + +extern enum debug_info_type debug_set_to_format (uint32_t debug_info_set); + +/* Get the number of debug formats enabled for output. */ + +unsigned int debug_set_count (uint32_t w_symbols); + +/* Get the names of the debug formats enabled for output. */ + +const char * debug_set_names (uint32_t w_symbols); + +/* Return true iff DWARF2 debug info is enabled. */ + +extern bool dwarf_debuginfo_p (); + extern void strip_off_ending (char *, int); extern int base_of_path (const char *path, const char **base_out); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5a41524..3be9c15 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -512,7 +512,7 @@ negate_expr_p (tree t) if (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST) { tree op1 = TREE_OPERAND (t, 1); - if (wi::to_wide (op1) == TYPE_PRECISION (type) - 1) + if (wi::to_wide (op1) == element_precision (type) - 1) return true; } break; @@ -705,7 +705,7 @@ fold_negate_expr_1 (location_t loc, tree t) if (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST) { tree op1 = TREE_OPERAND (t, 1); - if (wi::to_wide (op1) == TYPE_PRECISION (type) - 1) + if (wi::to_wide (op1) == element_precision (type) - 1) { tree ntype = TYPE_UNSIGNED (type) ? signed_type_for (type) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 54fa0ee..5e526916 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,33 @@ +2021-05-23 Harald Anlauf <anlauf@gmx.de> + + PR fortran/100551 + * trans-expr.c (gfc_conv_procedure_call): Adjust check for + implicit conversion of actual argument to an unlimited polymorphic + procedure argument. + +2021-05-23 Tobias Burnus <tobias@codesourcery.com> + + * intrinsic.texi (ATOMIC_ADD, ATOMIC_FETCH_ADD): Use the + proper variable name in the description. + +2021-05-22 Andre Vehreschild <vehre@gcc.gnu.org> + Steve Kargl <kargl@gcc.gnu.org> + + PR fortran/98301 + * trans-decl.c (gfc_build_builtin_function_decls): Move decl. + * trans-intrinsic.c (conv_intrinsic_random_init): Use bool for + lib-call of caf_random_init instead of logical (4-byte). + * trans.h: Add tree var for random_init. + +2021-05-20 Marcel Vollweiler <marcel@codesourcery.com> + + * openmp.c (gfc_match_omp_clauses): Support map-type-modifier 'close'. + +2021-05-18 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/100642 + * openmp.c (omp_code_to_statement): Add missing EXEC_OMP_DEPOBJ. + 2021-05-17 Harald Anlauf <anlauf@gmx.de> PR fortran/98411 diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index a625087..ad16413 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -1870,7 +1870,7 @@ Inverse function: @gol @table @asis @item @emph{Description}: -@code{ATOMIC_ADD(ATOM, VALUE)} atomically adds the value of @var{VAR} to the +@code{ATOMIC_ADD(ATOM, VALUE)} atomically adds the value of @var{VALUE} to the variable @var{ATOM}. When @var{STAT} is present and the invocation was successful, it is assigned the value 0. If it is present and the invocation has failed, it is assigned a positive value; in particular, for a coindexed @@ -2090,7 +2090,7 @@ end program atomic @table @asis @item @emph{Description}: @code{ATOMIC_FETCH_ADD(ATOM, VALUE, OLD)} atomically stores the value of -@var{ATOM} in @var{OLD} and adds the value of @var{VAR} to the +@var{ATOM} in @var{OLD} and adds the value of @var{VALUE} to the variable @var{ATOM}. When @var{STAT} is present and the invocation was successful, it is assigned the value 0. If it is present and the invocation has failed, it is assigned a positive value; in particular, for a coindexed diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 294b6d0..cf4d7ba 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1710,27 +1710,62 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, && gfc_match ("map ( ") == MATCH_YES) { locus old_loc2 = gfc_current_locus; - bool always = false; + int always_modifier = 0; + int close_modifier = 0; + locus second_always_locus = old_loc2; + locus second_close_locus = old_loc2; + + for (;;) + { + locus current_locus = gfc_current_locus; + if (gfc_match ("always ") == MATCH_YES) + { + if (always_modifier++ == 1) + second_always_locus = current_locus; + } + else if (gfc_match ("close ") == MATCH_YES) + { + if (close_modifier++ == 1) + second_close_locus = current_locus; + } + else + break; + gfc_match (", "); + } + gfc_omp_map_op map_op = OMP_MAP_TOFROM; - if (gfc_match ("always , ") == MATCH_YES) - always = true; if (gfc_match ("alloc : ") == MATCH_YES) map_op = OMP_MAP_ALLOC; else if (gfc_match ("tofrom : ") == MATCH_YES) - map_op = always ? OMP_MAP_ALWAYS_TOFROM : OMP_MAP_TOFROM; + map_op = always_modifier ? OMP_MAP_ALWAYS_TOFROM : OMP_MAP_TOFROM; else if (gfc_match ("to : ") == MATCH_YES) - map_op = always ? OMP_MAP_ALWAYS_TO : OMP_MAP_TO; + map_op = always_modifier ? OMP_MAP_ALWAYS_TO : OMP_MAP_TO; else if (gfc_match ("from : ") == MATCH_YES) - map_op = always ? OMP_MAP_ALWAYS_FROM : OMP_MAP_FROM; + map_op = always_modifier ? OMP_MAP_ALWAYS_FROM : OMP_MAP_FROM; else if (gfc_match ("release : ") == MATCH_YES) map_op = OMP_MAP_RELEASE; else if (gfc_match ("delete : ") == MATCH_YES) map_op = OMP_MAP_DELETE; - else if (always) + else { gfc_current_locus = old_loc2; - always = false; + always_modifier = 0; + close_modifier = 0; } + + if (always_modifier > 1) + { + gfc_error ("too many %<always%> modifiers at %L", + &second_always_locus); + break; + } + if (close_modifier > 1) + { + gfc_error ("too many %<close%> modifiers at %L", + &second_close_locus); + break; + } + head = NULL; if (gfc_match_omp_variable_list ("", &c->lists[OMP_LIST_MAP], false, NULL, &head, @@ -1741,8 +1776,8 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, n->u.map_op = map_op; continue; } - else - gfc_current_locus = old_loc; + gfc_current_locus = old_loc; + break; } if ((mask & OMP_CLAUSE_MERGEABLE) && !c->mergeable && gfc_match ("mergeable") == MATCH_YES) @@ -6902,7 +6937,8 @@ omp_code_to_statement (gfc_code *code) return ST_OMP_PARALLEL_DO; case EXEC_OMP_PARALLEL_DO_SIMD: return ST_OMP_PARALLEL_DO_SIMD; - + case EXEC_OMP_DEPOBJ: + return ST_OMP_DEPOBJ; default: gcc_unreachable (); } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 406b4ae..c32bd05 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -170,6 +170,7 @@ tree gfor_fndecl_co_min; tree gfor_fndecl_co_reduce; tree gfor_fndecl_co_sum; tree gfor_fndecl_caf_is_present; +tree gfor_fndecl_caf_random_init; /* Math functions. Many other math functions are handled in @@ -233,7 +234,7 @@ tree gfor_fndecl_cgemm; tree gfor_fndecl_zgemm; /* RANDOM_INIT function. */ -tree gfor_fndecl_random_init; +tree gfor_fndecl_random_init; /* libgfortran, 1 image only. */ static void gfc_add_decl_to_parent_function (tree decl) @@ -3516,6 +3517,8 @@ gfc_build_intrinsic_function_decls (void) void_type_node, 3, gfc_logical4_type_node, gfc_logical4_type_node, gfc_int4_type_node); + // gfor_fndecl_caf_rand_init is defined in the lib-coarray section below. + gfor_fndecl_sc_kind = gfc_build_library_function_decl_with_spec ( get_identifier (PREFIX("selected_char_kind")), ". . R ", gfc_int4_type_node, 2, gfc_charlen_type_node, pchar_type_node); @@ -4081,6 +4084,10 @@ gfc_build_builtin_function_decls (void) get_identifier (PREFIX("caf_is_present")), ". r . r ", integer_type_node, 3, pvoid_type_node, integer_type_node, pvoid_type_node); + + gfor_fndecl_caf_random_init = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_random_init")), + void_type_node, 2, logical_type_node, logical_type_node); } gfc_build_intrinsic_function_decls (); diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index cce18d0..3432cd4 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -5826,7 +5826,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, &derived_array); } else if (UNLIMITED_POLY (fsym) && e->ts.type != BT_CLASS - && gfc_expr_attr (e).flavor != FL_PROCEDURE) + && e->ts.type != BT_PROCEDURE + && (gfc_expr_attr (e).flavor != FL_PROCEDURE + || gfc_expr_attr (e).proc != PROC_UNKNOWN)) { /* The intrinsic type needs to be converted to a temporary CLASS object for the unlimited polymorphic formal. */ diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 4d74514..db9248c 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -3827,38 +3827,43 @@ conv_intrinsic_random_init (gfc_code *code) { stmtblock_t block; gfc_se se; - tree arg1, arg2, arg3, tmp; - tree logical4_type_node = gfc_get_logical_type (4); + tree arg1, arg2, tmp; + /* On none coarray == lib compiles use LOGICAL(4) else regular LOGICAL. */ + tree used_bool_type_node = flag_coarray == GFC_FCOARRAY_LIB + ? logical_type_node + : gfc_get_logical_type (4); /* Make the function call. */ gfc_init_block (&block); gfc_init_se (&se, NULL); - /* Convert REPEATABLE to a LOGICAL(4) entity. */ + /* Convert REPEATABLE to the desired LOGICAL entity. */ gfc_conv_expr (&se, code->ext.actual->expr); gfc_add_block_to_block (&block, &se.pre); - arg1 = fold_convert (logical4_type_node, gfc_evaluate_now (se.expr, &block)); + arg1 = fold_convert (used_bool_type_node, gfc_evaluate_now (se.expr, &block)); gfc_add_block_to_block (&block, &se.post); - /* Convert IMAGE_DISTINCT to a LOGICAL(4) entity. */ + /* Convert IMAGE_DISTINCT to the desired LOGICAL entity. */ gfc_conv_expr (&se, code->ext.actual->next->expr); gfc_add_block_to_block (&block, &se.pre); - arg2 = fold_convert (logical4_type_node, gfc_evaluate_now (se.expr, &block)); + arg2 = fold_convert (used_bool_type_node, gfc_evaluate_now (se.expr, &block)); gfc_add_block_to_block (&block, &se.post); - /* Create the hidden argument. For non-coarray codes and -fcoarray=single, - simply set this to 0. For -fcoarray=lib, generate a call to - THIS_IMAGE() without arguments. */ - arg3 = build_int_cst (gfc_get_int_type (4), 0); if (flag_coarray == GFC_FCOARRAY_LIB) { - arg3 = build_call_expr_loc (input_location, gfor_fndecl_caf_this_image, - 1, arg3); - se.expr = fold_convert (gfc_get_int_type (4), arg3); + tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_random_init, + 2, arg1, arg2); + } + else + { + /* The ABI for libgfortran needs to be maintained, so a hidden + argument must be include if code is compiled with -fcoarray=single + or without the option. Set to 0. */ + tree arg3 = build_int_cst (gfc_get_int_type (4), 0); + tmp = build_call_expr_loc (input_location, gfor_fndecl_random_init, + 3, arg1, arg2, arg3); } - tmp = build_call_expr_loc (input_location, gfor_fndecl_random_init, 3, - arg1, arg2, arg3); gfc_add_expr_to_block (&block, tmp); return gfc_finish_block (&block); diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 8c6f82f..69d3fdc 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -969,6 +969,7 @@ extern GTY(()) tree gfor_fndecl_ieee_procedure_exit; /* RANDOM_INIT. */ extern GTY(()) tree gfor_fndecl_random_init; +extern GTY(()) tree gfor_fndecl_caf_random_init; /* True if node is an integer constant. */ #define INTEGER_CST_P(node) (TREE_CODE(node) == INTEGER_CST) diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 710bc7f..06e9804 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -47,6 +47,31 @@ along with GCC; see the file COPYING3. If not see #include "vr-values.h" #include "gimple-range.h" +// Evaluate expression EXPR using the source information the class was +// instantiated with. Place the result in R, and return TRUE. If a range +// cannot be calcluated, return FALSE. + +bool +fur_source::get_operand (irange &r, tree expr) +{ + if (!gimple_range_ssa_p (expr)) + return get_tree_range (r, expr); + + // If no query engine is present, simply get the global value. + if (!m_query) + { + r = gimple_range_global (expr); + return true; + } + + // First look for a stmt. + if (m_stmt) + return m_query->range_of_expr (r, expr, m_stmt); + + // Finally must be on an edge. + return m_query->range_on_edge (r, m_edge, expr); +} + // Adjust the range for a pointer difference where the operands came // from a memchr. @@ -193,41 +218,9 @@ get_tree_range (irange &r, tree expr) return true; } -// Fold this unary statement using R1 as operand1's range, returning -// the result in RES. Return false if the operation fails. - -bool -gimple_range_fold (irange &res, const gimple *stmt, const irange &r1) -{ - gcc_checking_assert (gimple_range_handler (stmt)); - - tree type = gimple_expr_type (stmt); - // Unary SSA operations require the LHS type as the second range. - int_range<2> r2 (type); - - return gimple_range_fold (res, stmt, r1, r2); -} - -// Fold this binary statement using R1 and R2 as the operands ranges, -// returning the result in RES. Return false if the operation fails. - -bool -gimple_range_fold (irange &res, const gimple *stmt, - const irange &r1, const irange &r2) -{ - gcc_checking_assert (gimple_range_handler (stmt)); - - gimple_range_handler (stmt)->fold_range (res, gimple_expr_type (stmt), - r1, r2); - - // If there are any gimple lookups, do those now. - gimple_range_adjustment (res, stmt); - return true; -} - // Return the base of the RHS of an assignment. -tree +static tree gimple_range_base_of_assignment (const gimple *stmt) { gcc_checking_assert (gimple_code (stmt) == GIMPLE_ASSIGN); @@ -364,20 +357,29 @@ gimple_range_calc_op2 (irange &r, const gimple *stmt, // be calculated, return false. bool -gimple_ranger::calc_stmt (irange &r, gimple *s, tree name) +fold_using_range::fold_stmt (irange &r, gimple *s, fur_source &src, tree name) { bool res = false; - // If name is specified, make sure it is an LHS of S. - gcc_checking_assert (name ? SSA_NAME_DEF_STMT (name) == s : true); + // If name and S are specified, make sure it is an LHS of S. + gcc_checking_assert (!name || !gimple_get_lhs (s) || + name == gimple_get_lhs (s)); + + if (!name) + name = gimple_get_lhs (s); + + // Process addresses. + if (gimple_code (s) == GIMPLE_ASSIGN + && gimple_assign_rhs_code (s) == ADDR_EXPR) + return range_of_address (r, s, src); if (gimple_range_handler (s)) - res = range_of_range_op (r, s); + res = range_of_range_op (r, s, src); else if (is_a<gphi *>(s)) - res = range_of_phi (r, as_a<gphi *> (s)); + res = range_of_phi (r, as_a<gphi *> (s), src); else if (is_a<gcall *>(s)) - res = range_of_call (r, as_a<gcall *> (s)); + res = range_of_call (r, as_a<gcall *> (s), src); else if (is_a<gassign *> (s) && gimple_assign_rhs_code (s) == COND_EXPR) - res = range_of_cond_expr (r, as_a<gassign *> (s)); + res = range_of_cond_expr (r, as_a<gassign *> (s), src); if (!res) { @@ -414,36 +416,45 @@ gimple_ranger::calc_stmt (irange &r, gimple *s, tree name) // If a range cannot be calculated, return false. bool -gimple_ranger::range_of_range_op (irange &r, gimple *s) +fold_using_range::range_of_range_op (irange &r, gimple *s, fur_source &src) { int_range_max range1, range2; - tree lhs = gimple_get_lhs (s); tree type = gimple_expr_type (s); + range_operator *handler = gimple_range_handler (s); + gcc_checking_assert (handler); gcc_checking_assert (irange::supports_type_p (type)); + tree lhs = gimple_get_lhs (s); tree op1 = gimple_range_operand1 (s); tree op2 = gimple_range_operand2 (s); - if (lhs) - { - // Register potential dependencies for stale value tracking. - m_cache.register_dependency (lhs, op1); - m_cache.register_dependency (lhs, op2); - } - - if (gimple_code (s) == GIMPLE_ASSIGN - && gimple_assign_rhs_code (s) == ADDR_EXPR) - return range_of_address (r, s); - - if (range_of_expr (range1, op1, s)) + if (src.get_operand (range1, op1)) { if (!op2) - return gimple_range_fold (r, s, range1); - - if (range_of_expr (range2, op2, s)) - return gimple_range_fold (r, s, range1, range2); + { + // Fold range, and register any dependency if available. + int_range<2> r2 (type); + handler->fold_range (r, type, range1, r2); + if (lhs && src.m_cache) + src.m_cache->register_dependency (lhs, op1); + } + else if (src.get_operand (range2, op2)) + { + // Fold range, and register any dependency if available. + handler->fold_range (r, type, range1, range2); + if (lhs && src.m_cache) + { + src.m_cache->register_dependency (lhs, op1); + src.m_cache->register_dependency (lhs, op2); + } + } + else + r.set_varying (type); } - r.set_varying (type); + else + r.set_varying (type); + // Make certain range-op adjustments that aren't handled any other way. + gimple_range_adjustment (r, s); return true; } @@ -452,7 +463,7 @@ gimple_ranger::range_of_range_op (irange &r, gimple *s) // If a range cannot be calculated, set it to VARYING and return true. bool -gimple_ranger::range_of_address (irange &r, gimple *stmt) +fold_using_range::range_of_address (irange &r, gimple *stmt, fur_source &src) { gcc_checking_assert (gimple_code (stmt) == GIMPLE_ASSIGN); gcc_checking_assert (gimple_assign_rhs_code (stmt) == ADDR_EXPR); @@ -473,8 +484,11 @@ gimple_ranger::range_of_address (irange &r, gimple *stmt) && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) { tree ssa = TREE_OPERAND (base, 0); + tree lhs = gimple_get_lhs (stmt); + if (src.m_cache && lhs && gimple_range_ssa_p (ssa)) + src.m_cache->register_dependency (lhs, ssa); gcc_checking_assert (irange::supports_type_p (TREE_TYPE (ssa))); - range_of_expr (r, ssa, stmt); + src.get_operand (r, ssa); range_cast (r, TREE_TYPE (gimple_assign_rhs1 (stmt))); poly_offset_int off = 0; @@ -531,7 +545,7 @@ gimple_ranger::range_of_address (irange &r, gimple *stmt) // If a range cannot be calculated, return false. bool -gimple_ranger::range_of_phi (irange &r, gphi *phi) +fold_using_range::range_of_phi (irange &r, gphi *phi, fur_source &src) { tree phi_def = gimple_phi_result (phi); tree type = TREE_TYPE (phi_def); @@ -549,9 +563,19 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi) edge e = gimple_phi_arg_edge (phi, x); // Register potential dependencies for stale value tracking. - m_cache.register_dependency (phi_def, arg); - - range_on_edge (arg_range, e, arg); + if (src.m_cache && gimple_range_ssa_p (arg)) + src.m_cache->register_dependency (phi_def, arg); + + // Get the range of the argument on its edge. + fur_source e_src (src.m_query, e); + e_src.get_operand (arg_range, arg); + // If we're recomputing the argument elsewhere, try to refine it. + if (src.m_stmt != phi) + { + int_range_max tmp; + e_src.get_operand (tmp, arg); + arg_range.intersect (tmp); + } r.union_ (arg_range); // Once the value reaches varying, stop looking. if (r.varying_p ()) @@ -565,7 +589,7 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi) class loop *l = loop_containing_stmt (phi); if (l && loop_outer (l)) { - range_of_ssa_name_with_loop_info (loop_range, phi_def, l, phi); + range_of_ssa_name_with_loop_info (loop_range, phi_def, l, phi, src); if (!loop_range.varying_p ()) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -590,7 +614,7 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi) // If a range cannot be calculated, return false. bool -gimple_ranger::range_of_call (irange &r, gcall *call) +fold_using_range::range_of_call (irange &r, gcall *call, fur_source &src) { tree type = gimple_call_return_type (call); tree lhs = gimple_call_lhs (call); @@ -599,7 +623,7 @@ gimple_ranger::range_of_call (irange &r, gcall *call) if (!irange::supports_type_p (type)) return false; - if (range_of_builtin_call (r, call)) + if (range_of_builtin_call (r, call, src)) ; else if (gimple_stmt_nonnegative_warnv_p (call, &strict_overflow_p)) r.set (build_int_cst (type, 0), TYPE_MAX_VALUE (type)); @@ -623,9 +647,9 @@ gimple_ranger::range_of_call (irange &r, gcall *call) // CODE is the type of ubsan call (PLUS_EXPR, MINUS_EXPR or // MULT_EXPR). -static void -range_of_builtin_ubsan_call (range_query &query, irange &r, gcall *call, - tree_code code) +void +fold_using_range::range_of_builtin_ubsan_call (irange &r, gcall *call, + tree_code code, fur_source &src) { gcc_checking_assert (code == PLUS_EXPR || code == MINUS_EXPR || code == MULT_EXPR); @@ -635,8 +659,8 @@ range_of_builtin_ubsan_call (range_query &query, irange &r, gcall *call, int_range_max ir0, ir1; tree arg0 = gimple_call_arg (call, 0); tree arg1 = gimple_call_arg (call, 1); - query.range_of_expr (ir0, arg0, call); - query.range_of_expr (ir1, arg1, call); + src.get_operand (ir0, arg0); + src.get_operand (ir1, arg1); bool saved_flag_wrapv = flag_wrapv; // Pretend the arithmetic is wrapping. If there is any overflow, @@ -656,7 +680,8 @@ range_of_builtin_ubsan_call (range_query &query, irange &r, gcall *call, // TRUE. Otherwise return FALSE. bool -range_of_builtin_call (range_query &query, irange &r, gcall *call) +fold_using_range::range_of_builtin_call (irange &r, gcall *call, + fur_source &src) { combined_fn func = gimple_call_combined_fn (call); if (func == CFN_LAST) @@ -677,7 +702,7 @@ range_of_builtin_call (range_query &query, irange &r, gcall *call) return true; } arg = gimple_call_arg (call, 0); - if (query.range_of_expr (r, arg, call) && r.singleton_p ()) + if (src.get_operand (r, arg) && r.singleton_p ()) { r.set (build_one_cst (type), build_one_cst (type)); return true; @@ -691,7 +716,7 @@ range_of_builtin_call (range_query &query, irange &r, gcall *call) prec = TYPE_PRECISION (TREE_TYPE (arg)); mini = 0; maxi = prec; - query.range_of_expr (r, arg, call); + src.get_operand (r, arg); // If arg is non-zero, then ffs or popcount are non-zero. if (!range_includes_zero_p (&r)) mini = 1; @@ -735,7 +760,7 @@ range_of_builtin_call (range_query &query, irange &r, gcall *call) } } - query.range_of_expr (r, arg, call); + src.get_operand (r, arg); // From clz of minimum we can compute result maximum. if (r.constant_p () && !r.varying_p ()) { @@ -800,7 +825,7 @@ range_of_builtin_call (range_query &query, irange &r, gcall *call) mini = -2; } } - query.range_of_expr (r, arg, call); + src.get_operand (r, arg); if (!r.undefined_p ()) { if (r.lower_bound () != 0) @@ -838,13 +863,13 @@ range_of_builtin_call (range_query &query, irange &r, gcall *call) r.set (build_int_cst (type, 0), build_int_cst (type, prec - 1)); return true; case CFN_UBSAN_CHECK_ADD: - range_of_builtin_ubsan_call (query, r, call, PLUS_EXPR); + range_of_builtin_ubsan_call (r, call, PLUS_EXPR, src); return true; case CFN_UBSAN_CHECK_SUB: - range_of_builtin_ubsan_call (query, r, call, MINUS_EXPR); + range_of_builtin_ubsan_call (r, call, MINUS_EXPR, src); return true; case CFN_UBSAN_CHECK_MUL: - range_of_builtin_ubsan_call (query, r, call, MULT_EXPR); + range_of_builtin_ubsan_call (r, call, MULT_EXPR, src); return true; case CFN_GOACC_DIM_SIZE: @@ -894,17 +919,11 @@ range_of_builtin_call (range_query &query, irange &r, gcall *call) } -bool -gimple_ranger::range_of_builtin_call (irange &r, gcall *call) -{ - return ::range_of_builtin_call (*this, r, call); -} - // Calculate a range for COND_EXPR statement S and return it in R. // If a range cannot be calculated, return false. bool -gimple_ranger::range_of_cond_expr (irange &r, gassign *s) +fold_using_range::range_of_cond_expr (irange &r, gassign *s, fur_source &src) { int_range_max cond_range, range1, range2; tree cond = gimple_assign_rhs1 (s); @@ -917,9 +936,9 @@ gimple_ranger::range_of_cond_expr (irange &r, gassign *s) if (!irange::supports_type_p (TREE_TYPE (op1))) return false; - range_of_expr (cond_range, cond, s); - range_of_expr (range1, op1, s); - range_of_expr (range2, op2, s); + src.get_operand (cond_range, cond); + src.get_operand (range1, op1); + src.get_operand (range2, op2); // If the condition is known, choose the appropriate expression. if (cond_range.singleton_p ()) @@ -1047,6 +1066,16 @@ gimple_ranger::range_on_edge (irange &r, edge e, tree name) return true; } +// fold_range wrapper for range_of_stmt to use as an internal client. + +bool +gimple_ranger::fold_range_internal (irange &r, gimple *s, tree name) +{ + fold_using_range f; + fur_source src (this, &m_cache, NULL, s); + return f.fold_stmt (r, s, src, name); +} + // Calculate a range for statement S and return it in R. If NAME is // provided it represents the SSA_NAME on the LHS of the statement. // It is only required if there is more than one lhs/output. Check @@ -1063,7 +1092,7 @@ gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name) // If no name, simply call the base routine. if (!name) - return calc_stmt (r, s, NULL_TREE); + return fold_range_internal (r, s, NULL_TREE); if (!gimple_range_ssa_p (name)) return false; @@ -1074,7 +1103,7 @@ gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name) // Otherwise calculate a new value. int_range_max tmp; - calc_stmt (tmp, s, name); + fold_range_internal (tmp, s, name); // Combine the new value with the old value. This is required because // the way value propagation works, when the IL changes on the fly we @@ -1216,20 +1245,32 @@ gimple_ranger::dump (FILE *f) // If SCEV has any information about phi node NAME, return it as a range in R. void -gimple_ranger::range_of_ssa_name_with_loop_info (irange &r, tree name, - class loop *l, gphi *phi) +fold_using_range::range_of_ssa_name_with_loop_info (irange &r, tree name, + class loop *l, gphi *phi, + fur_source &src) { gcc_checking_assert (TREE_CODE (name) == SSA_NAME); tree min, max, type = TREE_TYPE (name); - if (bounds_of_var_in_loop (&min, &max, this, l, phi, name)) + if (bounds_of_var_in_loop (&min, &max, src.m_query, l, phi, name)) { - // ?? We could do better here. Since MIN/MAX can only be an - // SSA, SSA +- INTEGER_CST, or INTEGER_CST, we could easily call - // the ranger and solve anything not an integer. if (TREE_CODE (min) != INTEGER_CST) - min = vrp_val_min (type); + { + if (src.m_query + && src.m_query->range_of_expr (r, min, phi) + && !r.undefined_p ()) + min = wide_int_to_tree (type, r.lower_bound ()); + else + min = vrp_val_min (type); + } if (TREE_CODE (max) != INTEGER_CST) - max = vrp_val_max (type); + { + if (src.m_query + && src.m_query->range_of_expr (r, max, phi) + && !r.undefined_p ()) + max = wide_int_to_tree (type, r.upper_bound ()); + else + max = vrp_val_max (type); + } r.set (min, max); } else diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h index f331561..5320506 100644 --- a/gcc/gimple-range.h +++ b/gcc/gimple-range.h @@ -30,6 +30,18 @@ along with GCC; see the file COPYING3. If not see #include "gimple-range-cache.h" #include "value-query.h" +// This file is the main include point for gimple ranges. +// There are two fold_range routines of interest: +// bool fold_range (irange &r, gimple *s, range_query *q) +// bool fold_range (irange &r, gimple *s, edge on_edge, range_query *q) +// These routines will fold stmt S into the result irange R. +// Any ssa_names on the stmt will be calculated using the range_query +// parameter via a call to range_of_expr. +// If no range_query is provided, current global range info will be used. +// The second variation specifies an edge, and stmt S is recalculated as if +// it appeared on that edge. + + // This is the basic range generator interface. // // This base class provides all the API entry points, but only provides @@ -55,32 +67,116 @@ public: void export_global_ranges (); void dump (FILE *f); protected: - bool calc_stmt (irange &r, gimple *s, tree name = NULL_TREE); - bool range_of_range_op (irange &r, gimple *s); - bool range_of_call (irange &r, gcall *call); - bool range_of_cond_expr (irange &r, gassign* cond); + bool fold_range_internal (irange &r, gimple *s, tree name); ranger_cache m_cache; -private: - bool range_of_phi (irange &r, gphi *phi); - bool range_of_address (irange &r, gimple *s); - bool range_of_builtin_call (irange &r, gcall *call); - bool range_with_loop_info (irange &r, tree name); - void range_of_ssa_name_with_loop_info (irange &, tree, class loop *, - gphi *); }; -// Calculate a basic range for a tree expression. +// Source of an operand for fold_using_range. +// It can specify a stmt or and edge, or thru an internal API which uses +// the ranger cache. +// Its primary function is to retreive an operand from the source via a +// call thru the range_query object. + +class fur_source +{ + friend class fold_using_range; +public: + inline fur_source (range_query *q, edge e); + inline fur_source (range_query *q, gimple *s); + inline fur_source (range_query *q, class ranger_cache *g, edge e, gimple *s); + bool get_operand (irange &r, tree expr); +protected: + ranger_cache *m_cache; + range_query *m_query; + edge m_edge; + gimple *m_stmt; +}; + + +// This class uses ranges to fold a gimple statement producinf a range for +// the LHS. The source of all operands is supplied via the fur_source class +// which provides a range_query as well as a source location and any other +// required information. + +class fold_using_range +{ +public: + bool fold_stmt (irange &r, gimple *s, class fur_source &src, + tree name = NULL_TREE); +protected: + bool range_of_range_op (irange &r, gimple *s, fur_source &src); + bool range_of_call (irange &r, gcall *call, fur_source &src); + bool range_of_cond_expr (irange &r, gassign* cond, fur_source &src); + bool range_of_address (irange &r, gimple *s, fur_source &src); + bool range_of_builtin_call (irange &r, gcall *call, fur_source &src); + void range_of_builtin_ubsan_call (irange &r, gcall *call, tree_code code, + fur_source &src); + bool range_of_phi (irange &r, gphi *phi, fur_source &src); + void range_of_ssa_name_with_loop_info (irange &, tree, class loop *, gphi *, + fur_source &src); +}; + + +// Create a source for a query on an edge. + +inline +fur_source::fur_source (range_query *q, edge e) +{ + m_query = q; + m_cache = NULL; + m_edge = e; + m_stmt = NULL; +} + +// Create a source for a query at a statement. + +inline +fur_source::fur_source (range_query *q, gimple *s) +{ + m_query = q; + m_cache = NULL; + m_edge = NULL; + m_stmt = s; +} + +// Create a source for Ranger. THis can recalculate from a different location +// and can also set the dependency information as appropriate when invoked. + +inline +fur_source::fur_source (range_query *q, ranger_cache *g, edge e, gimple *s) +{ + m_query = q; + m_cache = g; + m_edge = e; + m_stmt = s; +} + +// Fold stmt S into range R using range query Q. + +inline bool +fold_range (irange &r, gimple *s, range_query *q = NULL) +{ + fold_using_range f; + fur_source src (q, s); + return f.fold_stmt (r, s, src); +} + +// Recalculate stmt S into R using range query Q as if it were on edge ON_EDGE. + +inline bool +fold_range (irange &r, gimple *s, edge on_edge, range_query *q = NULL) +{ + fold_using_range f; + fur_source src (q, on_edge); + return f.fold_stmt (r, s, src); +} + +// Calculate a basic range for a tree node expression. extern bool get_tree_range (irange &r, tree expr); // These routines provide a GIMPLE interface to the range-ops code. extern tree gimple_range_operand1 (const gimple *s); extern tree gimple_range_operand2 (const gimple *s); -extern tree gimple_range_base_of_assignment (const gimple *s); -extern bool gimple_range_fold (irange &res, const gimple *s, - const irange &r1); -extern bool gimple_range_fold (irange &res, const gimple *s, - const irange &r1, - const irange &r2); extern bool gimple_range_calc_op1 (irange &r, const gimple *s, const irange &lhs_range); extern bool gimple_range_calc_op1 (irange &r, const gimple *s, @@ -199,7 +295,4 @@ private: // Flag to enable debugging the various internal Caches. #define DEBUG_RANGE_CACHE (dump_file && (param_evrp_mode & EVRP_MODE_DEBUG)) -// Temporary external interface to share with vr_values. -bool range_of_builtin_call (range_query &query, irange &r, gcall *call); - #endif // GCC_GIMPLE_RANGE_STMT_H diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index f8b0482..e4a55f1 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -748,10 +748,6 @@ walk_stmt_load_store_addr_ops (gimple *stmt, void *data, { if (TREE_CODE (rhs) == ADDR_EXPR) ret |= visit_addr (stmt, TREE_OPERAND (rhs, 0), arg, data); - else if (TREE_CODE (rhs) == TARGET_MEM_REF - && TREE_CODE (TMR_BASE (rhs)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (rhs), 0), arg, - data); else if (TREE_CODE (rhs) == OBJ_TYPE_REF && TREE_CODE (OBJ_TYPE_REF_OBJECT (rhs)) == ADDR_EXPR) ret |= visit_addr (stmt, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (rhs), @@ -770,10 +766,6 @@ walk_stmt_load_store_addr_ops (gimple *stmt, void *data, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (val), 0), arg, data); } - lhs = gimple_assign_lhs (stmt); - if (TREE_CODE (lhs) == TARGET_MEM_REF - && TREE_CODE (TMR_BASE (lhs)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (lhs), 0), lhs, data); } if (visit_load) { diff --git a/gcc/gimple.h b/gcc/gimple.h index 3ec86f5..91b92b4 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -6501,6 +6501,14 @@ is_gimple_omp_oacc (const gimple *stmt) gcc_assert (is_gimple_omp (stmt)); switch (gimple_code (stmt)) { + case GIMPLE_OMP_ATOMIC_LOAD: + case GIMPLE_OMP_ATOMIC_STORE: + case GIMPLE_OMP_CONTINUE: + case GIMPLE_OMP_RETURN: + /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate + the two. */ + gcc_unreachable (); + case GIMPLE_OMP_FOR: switch (gimple_omp_for_kind (stmt)) { diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e790f08..b62ea0e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -126,7 +126,10 @@ enum gimplify_omp_var_data /* Flag for GOVD_MAP: (struct) vars that have pointer attachments for fields. */ - GOVD_MAP_HAS_ATTACHMENTS = 8388608, + GOVD_MAP_HAS_ATTACHMENTS = 0x4000000, + + /* Flag for GOVD_FIRSTPRIVATE: OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT. */ + GOVD_FIRSTPRIVATE_IMPLICIT = 0x8000000, GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LINEAR @@ -8533,6 +8536,84 @@ omp_target_reorder_clauses (tree *list_p) } } +/* DECL is supposed to have lastprivate semantics in the outer contexts + of combined/composite constructs, starting with OCTX. + Add needed lastprivate, shared or map clause if no data sharing or + mapping clause are present. IMPLICIT_P is true if it is an implicit + clause (IV on simd), in which case the lastprivate will not be + copied to some constructs. */ + +static void +omp_lastprivate_for_combined_outer_constructs (struct gimplify_omp_ctx *octx, + tree decl, bool implicit_p) +{ + struct gimplify_omp_ctx *orig_octx = octx; + for (; octx; octx = octx->outer_context) + { + if ((octx->region_type == ORT_COMBINED_PARALLEL + || (octx->region_type & ORT_COMBINED_TEAMS) == ORT_COMBINED_TEAMS) + && splay_tree_lookup (octx->variables, + (splay_tree_key) decl) == NULL) + { + omp_add_variable (octx, decl, GOVD_SHARED | GOVD_SEEN); + continue; + } + if ((octx->region_type & ORT_TASK) != 0 + && octx->combined_loop + && splay_tree_lookup (octx->variables, + (splay_tree_key) decl) == NULL) + { + omp_add_variable (octx, decl, GOVD_LASTPRIVATE | GOVD_SEEN); + continue; + } + if (implicit_p + && octx->region_type == ORT_WORKSHARE + && octx->combined_loop + && splay_tree_lookup (octx->variables, + (splay_tree_key) decl) == NULL + && octx->outer_context + && octx->outer_context->region_type == ORT_COMBINED_PARALLEL + && splay_tree_lookup (octx->outer_context->variables, + (splay_tree_key) decl) == NULL) + { + octx = octx->outer_context; + omp_add_variable (octx, decl, GOVD_LASTPRIVATE | GOVD_SEEN); + continue; + } + if ((octx->region_type == ORT_WORKSHARE || octx->region_type == ORT_ACC) + && octx->combined_loop + && splay_tree_lookup (octx->variables, + (splay_tree_key) decl) == NULL + && !omp_check_private (octx, decl, false)) + { + omp_add_variable (octx, decl, GOVD_LASTPRIVATE | GOVD_SEEN); + continue; + } + if (octx->region_type == ORT_COMBINED_TARGET) + { + splay_tree_node n = splay_tree_lookup (octx->variables, + (splay_tree_key) decl); + if (n == NULL) + { + omp_add_variable (octx, decl, GOVD_MAP | GOVD_SEEN); + octx = octx->outer_context; + } + else if (!implicit_p + && (n->value & GOVD_FIRSTPRIVATE_IMPLICIT)) + { + n->value &= ~(GOVD_FIRSTPRIVATE + | GOVD_FIRSTPRIVATE_IMPLICIT + | GOVD_EXPLICIT); + omp_add_variable (octx, decl, GOVD_MAP | GOVD_SEEN); + octx = octx->outer_context; + } + } + break; + } + if (octx && (implicit_p || octx != orig_octx)) + omp_notice_variable (octx, decl, true); +} + /* Scan the OMP clauses in *LIST_P, installing mappings into a new and previous omp contexts. */ @@ -8606,6 +8687,11 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, case OMP_CLAUSE_FIRSTPRIVATE: flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT; check_non_private = "firstprivate"; + if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)) + { + gcc_assert (code == OMP_TARGET); + flags |= GOVD_FIRSTPRIVATE_IMPLICIT; + } goto do_add; case OMP_CLAUSE_LASTPRIVATE: if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c)) @@ -8642,75 +8728,8 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, } if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c)) flags |= GOVD_LASTPRIVATE_CONDITIONAL; - if (outer_ctx - && (outer_ctx->region_type == ORT_COMBINED_PARALLEL - || ((outer_ctx->region_type & ORT_COMBINED_TEAMS) - == ORT_COMBINED_TEAMS)) - && splay_tree_lookup (outer_ctx->variables, - (splay_tree_key) decl) == NULL) - { - omp_add_variable (outer_ctx, decl, GOVD_SHARED | GOVD_SEEN); - if (outer_ctx->outer_context) - omp_notice_variable (outer_ctx->outer_context, decl, true); - } - else if (outer_ctx - && (outer_ctx->region_type & ORT_TASK) != 0 - && outer_ctx->combined_loop - && splay_tree_lookup (outer_ctx->variables, - (splay_tree_key) decl) == NULL) - { - omp_add_variable (outer_ctx, decl, GOVD_LASTPRIVATE | GOVD_SEEN); - if (outer_ctx->outer_context) - omp_notice_variable (outer_ctx->outer_context, decl, true); - } - else if (outer_ctx - && (outer_ctx->region_type == ORT_WORKSHARE - || outer_ctx->region_type == ORT_ACC) - && outer_ctx->combined_loop - && splay_tree_lookup (outer_ctx->variables, - (splay_tree_key) decl) == NULL - && !omp_check_private (outer_ctx, decl, false)) - { - omp_add_variable (outer_ctx, decl, GOVD_LASTPRIVATE | GOVD_SEEN); - if (outer_ctx->outer_context - && (outer_ctx->outer_context->region_type - == ORT_COMBINED_PARALLEL) - && splay_tree_lookup (outer_ctx->outer_context->variables, - (splay_tree_key) decl) == NULL) - { - struct gimplify_omp_ctx *octx = outer_ctx->outer_context; - omp_add_variable (octx, decl, GOVD_SHARED | GOVD_SEEN); - if (octx->outer_context) - { - octx = octx->outer_context; - if (octx->region_type == ORT_WORKSHARE - && octx->combined_loop - && splay_tree_lookup (octx->variables, - (splay_tree_key) decl) == NULL - && !omp_check_private (octx, decl, false)) - { - omp_add_variable (octx, decl, - GOVD_LASTPRIVATE | GOVD_SEEN); - octx = octx->outer_context; - if (octx - && ((octx->region_type & ORT_COMBINED_TEAMS) - == ORT_COMBINED_TEAMS) - && (splay_tree_lookup (octx->variables, - (splay_tree_key) decl) - == NULL)) - { - omp_add_variable (octx, decl, - GOVD_SHARED | GOVD_SEEN); - octx = octx->outer_context; - } - } - if (octx) - omp_notice_variable (octx, decl, true); - } - } - else if (outer_ctx->outer_context) - omp_notice_variable (outer_ctx->outer_context, decl, true); - } + omp_lastprivate_for_combined_outer_constructs (outer_ctx, decl, + false); goto do_add; case OMP_CLAUSE_REDUCTION: if (OMP_CLAUSE_REDUCTION_TASK (c)) @@ -8911,9 +8930,8 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, else if (octx && octx->region_type == ORT_COMBINED_TARGET) { - flags &= ~GOVD_LASTPRIVATE; - if (flags == GOVD_SEEN) - break; + if (flags & GOVD_LASTPRIVATE) + flags = GOVD_SEEN | GOVD_MAP; } else break; @@ -10533,6 +10551,18 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, remove = true; break; } + if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)) + { + decl = OMP_CLAUSE_DECL (c); + n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); + if ((n->value & GOVD_MAP) != 0) + { + remove = true; + break; + } + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c) = 0; + OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) = 0; + } /* FALLTHRU */ case OMP_CLAUSE_PRIVATE: case OMP_CLAUSE_SHARED: @@ -11881,80 +11911,8 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) OMP_FOR_CLAUSES (for_stmt) = c; omp_add_variable (gimplify_omp_ctxp, decl, flags); if (outer && !OMP_CLAUSE_LINEAR_NO_COPYOUT (c)) - { - if (outer->region_type == ORT_WORKSHARE - && outer->combined_loop) - { - if (outer->outer_context - && (outer->outer_context->region_type - == ORT_COMBINED_PARALLEL)) - outer = outer->outer_context; - else if (omp_check_private (outer, decl, false)) - outer = NULL; - } - else if (((outer->region_type & ORT_TASKLOOP) - == ORT_TASKLOOP) - && outer->combined_loop - && !omp_check_private (gimplify_omp_ctxp, - decl, false)) - ; - else if (outer->region_type != ORT_COMBINED_PARALLEL) - { - omp_notice_variable (outer, decl, true); - outer = NULL; - } - if (outer) - { - n = splay_tree_lookup (outer->variables, - (splay_tree_key)decl); - if (n == NULL || (n->value & GOVD_DATA_SHARE_CLASS) == 0) - { - omp_add_variable (outer, decl, - GOVD_LASTPRIVATE | GOVD_SEEN); - if (outer->region_type == ORT_COMBINED_PARALLEL - && outer->outer_context - && (outer->outer_context->region_type - == ORT_WORKSHARE) - && outer->outer_context->combined_loop) - { - outer = outer->outer_context; - n = splay_tree_lookup (outer->variables, - (splay_tree_key)decl); - if (omp_check_private (outer, decl, false)) - outer = NULL; - else if (n == NULL - || ((n->value & GOVD_DATA_SHARE_CLASS) - == 0)) - omp_add_variable (outer, decl, - GOVD_LASTPRIVATE - | GOVD_SEEN); - else - outer = NULL; - } - if (outer && outer->outer_context - && ((outer->outer_context->region_type - & ORT_COMBINED_TEAMS) == ORT_COMBINED_TEAMS - || (((outer->region_type & ORT_TASKLOOP) - == ORT_TASKLOOP) - && (outer->outer_context->region_type - == ORT_COMBINED_PARALLEL)))) - { - outer = outer->outer_context; - n = splay_tree_lookup (outer->variables, - (splay_tree_key)decl); - if (n == NULL - || (n->value & GOVD_DATA_SHARE_CLASS) == 0) - omp_add_variable (outer, decl, - GOVD_SHARED | GOVD_SEEN); - else - outer = NULL; - } - if (outer && outer->outer_context) - omp_notice_variable (outer->outer_context, decl, - true); - } - } - } + omp_lastprivate_for_combined_outer_constructs (outer, decl, + true); } else { @@ -11973,87 +11931,8 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) struct gimplify_omp_ctx *outer = gimplify_omp_ctxp->outer_context; if (outer && lastprivate) - { - if (outer->region_type == ORT_WORKSHARE - && outer->combined_loop) - { - n = splay_tree_lookup (outer->variables, - (splay_tree_key)decl); - if (n != NULL && (n->value & GOVD_LOCAL) != 0) - { - lastprivate = false; - outer = NULL; - } - else if (outer->outer_context - && (outer->outer_context->region_type - == ORT_COMBINED_PARALLEL)) - outer = outer->outer_context; - else if (omp_check_private (outer, decl, false)) - outer = NULL; - } - else if (((outer->region_type & ORT_TASKLOOP) - == ORT_TASKLOOP) - && outer->combined_loop - && !omp_check_private (gimplify_omp_ctxp, - decl, false)) - ; - else if (outer->region_type != ORT_COMBINED_PARALLEL) - { - omp_notice_variable (outer, decl, true); - outer = NULL; - } - if (outer) - { - n = splay_tree_lookup (outer->variables, - (splay_tree_key)decl); - if (n == NULL || (n->value & GOVD_DATA_SHARE_CLASS) == 0) - { - omp_add_variable (outer, decl, - GOVD_LASTPRIVATE | GOVD_SEEN); - if (outer->region_type == ORT_COMBINED_PARALLEL - && outer->outer_context - && (outer->outer_context->region_type - == ORT_WORKSHARE) - && outer->outer_context->combined_loop) - { - outer = outer->outer_context; - n = splay_tree_lookup (outer->variables, - (splay_tree_key)decl); - if (omp_check_private (outer, decl, false)) - outer = NULL; - else if (n == NULL - || ((n->value & GOVD_DATA_SHARE_CLASS) - == 0)) - omp_add_variable (outer, decl, - GOVD_LASTPRIVATE - | GOVD_SEEN); - else - outer = NULL; - } - if (outer && outer->outer_context - && ((outer->outer_context->region_type - & ORT_COMBINED_TEAMS) == ORT_COMBINED_TEAMS - || (((outer->region_type & ORT_TASKLOOP) - == ORT_TASKLOOP) - && (outer->outer_context->region_type - == ORT_COMBINED_PARALLEL)))) - { - outer = outer->outer_context; - n = splay_tree_lookup (outer->variables, - (splay_tree_key)decl); - if (n == NULL - || (n->value & GOVD_DATA_SHARE_CLASS) == 0) - omp_add_variable (outer, decl, - GOVD_SHARED | GOVD_SEEN); - else - outer = NULL; - } - if (outer && outer->outer_context) - omp_notice_variable (outer->outer_context, decl, - true); - } - } - } + omp_lastprivate_for_combined_outer_constructs (outer, decl, + true); c = build_omp_clause (input_location, lastprivate ? OMP_CLAUSE_LASTPRIVATE @@ -14643,7 +14522,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, g = gimple_build_omp_section (body); break; case OMP_MASTER: - g = gimple_build_omp_master (body); + g = gimple_build_omp_master (body); break; case OMP_ORDERED: g = gimplify_omp_ordered (*expr_p, body); diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 5c5d332..85bd343 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,8 +1,3 @@ -2021-05-10 Martin Liska <mliska@suse.cz> - - * gofrontend/runtime.cc (Runtime::name_to_code): Use startswith - function instead of strncmp. - 2021-01-28 Ian Lance Taylor <iant@golang.org> * gospec.c (lang_specific_driver): Add -g if no debugging options diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index efb7a77..373b58c 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -9782e85bef1c16c72a4980856d921cea104b129c +38228e7a91d37588463307ec60420c8f17f1aee4 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/runtime.cc b/gcc/go/gofrontend/runtime.cc index 514c045..3cc5ded 100644 --- a/gcc/go/gofrontend/runtime.cc +++ b/gcc/go/gofrontend/runtime.cc @@ -463,7 +463,7 @@ Runtime::name_to_code(const std::string& name) // The names in the table have "runtime." prefix. We may be // called with a name without the prefix. Try matching // without the prefix as well. - if (startswith(runtime_function_name, "runtime.") + if (strncmp(runtime_function_name, "runtime.", 8) == 0 && strcmp(runtime_function_name + 8, name.c_str()) == 0) code = static_cast<Runtime::Function>(i); } diff --git a/gcc/internal-fn.h b/gcc/internal-fn.h index c6599ce..5bc5660 100644 --- a/gcc/internal-fn.h +++ b/gcc/internal-fn.h @@ -32,11 +32,15 @@ along with GCC; see the file COPYING3. If not see or leaving partitioned execution. DEP_VAR = UNIQUE ({HEAD,TAIL}_MARK, REMAINING_MARKS, ...PRIMARY_FLAGS) - The PRIMARY_FLAGS only occur on the first HEAD_MARK of a sequence. */ + The PRIMARY_FLAGS only occur on the first HEAD_MARK of a sequence. + + PRIVATE captures variables to be made private at the surrounding parallelism + level. */ #define IFN_UNIQUE_CODES \ DEF(UNSPEC), \ DEF(OACC_FORK), DEF(OACC_JOIN), \ - DEF(OACC_HEAD_MARK), DEF(OACC_TAIL_MARK) + DEF(OACC_HEAD_MARK), DEF(OACC_TAIL_MARK), \ + DEF(OACC_PRIVATE) enum ifn_unique_kind { #define DEF(X) IFN_UNIQUE_##X diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 106a537..819aa97 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,8 @@ +2021-05-19 Martin Liska <mliska@suse.cz> + + PR testsuite/100658 + * libgccjit.c (gcc_jit_context_new_function): Fix typos. + 2021-03-24 Matthias Klose <doko@ubuntu.com> * Make-lang.in (jit.sphinx.html, jit.sphinx.pdf): Use $(mkinstalldirs), diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c index 0cc650f..7fa9480 100644 --- a/gcc/jit/libgccjit.c +++ b/gcc/jit/libgccjit.c @@ -909,7 +909,7 @@ gcc_jit_context_new_function (gcc_jit_context *ctxt, RETURN_NULL_IF_FAIL (return_type, ctxt, loc, "NULL return_type"); RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); /* The assembler can only handle certain names, so for now, enforce - C's rules for identiers upon the name, using ISALPHA and ISALNUM + C's rules for identifiers upon the name, using ISALPHA and ISALNUM from safe-ctype.h to ignore the current locale. Eventually we'll need some way to interact with e.g. C++ name mangling. */ diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c index 8344d3e..3586e20 100644 --- a/gcc/lto/lto-dump.c +++ b/gcc/lto/lto-dump.c @@ -122,7 +122,7 @@ public: cgraph_node *cnode = dyn_cast<cgraph_node *> (node); gcc_assert (cnode); - return (cnode->definition && !cnode->alias) + return (cnode->definition && !cnode->thunk && !cnode->alias) ? n_basic_blocks_for_fn (DECL_STRUCT_FUNCTION (cnode->decl)) : 0; } diff --git a/gcc/match.pd b/gcc/match.pd index cdb8763..1fc6b7b 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4769,6 +4769,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (simplify (cmp:c (bit_and:c @0 @1) @0) (cmp (bit_and @0 (bit_not! @1)) { build_zero_cst (TREE_TYPE (@0)); })) + (simplify + (cmp:c (convert@3 (bit_and (convert@2 @0) INTEGER_CST@1)) (convert @0)) + (if (INTEGRAL_TYPE_P (TREE_TYPE (@0)) + && INTEGRAL_TYPE_P (TREE_TYPE (@2)) + && INTEGRAL_TYPE_P (TREE_TYPE (@3)) + && TYPE_PRECISION (TREE_TYPE (@2)) == TYPE_PRECISION (TREE_TYPE (@0)) + && TYPE_PRECISION (TREE_TYPE (@3)) > TYPE_PRECISION (TREE_TYPE (@2)) + && !wi::neg_p (wi::to_wide (@1))) + (cmp (bit_and @0 (convert (bit_not @1))) + { build_zero_cst (TREE_TYPE (@0)); }))) /* (X | Y) == Y becomes (X & ~Y) == 0. */ (simplify @@ -4830,7 +4840,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (cond (ne (bit_and @0 integer_pow2p@1) integer_zerop) INTEGER_CST@2 integer_zerop) - (if (integer_pow2p (@2)) + (if (!POINTER_TYPE_P (type) && integer_pow2p (@2)) (with { int shift = (wi::exact_log2 (wi::to_wide (@2)) - wi::exact_log2 (wi::to_wide (@1))); diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 9474135..7ae02af 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2021-05-20 Indu Bhagat <indu.bhagat@oracle.com> + + * objc-act.c (synth_module_prologue): Use uint32_t instead of enum + debug_info_type. + 2021-05-10 Martin Liska <mliska@suse.cz> * objc-act.c (objc_string_ref_type_p): Use startswith diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 796256d..8d106a4 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3078,7 +3078,7 @@ static void synth_module_prologue (void) { tree type; - enum debug_info_type save_write_symbols = write_symbols; + uint32_t save_write_symbols = write_symbols; const struct gcc_debug_hooks *const save_hooks = debug_hooks; /* Suppress outputting debug symbols, because diff --git a/gcc/omp-general.h b/gcc/omp-general.h index aa04895..5c3e0f0 100644 --- a/gcc/omp-general.h +++ b/gcc/omp-general.h @@ -132,4 +132,17 @@ enum omp_requires { extern GTY(()) enum omp_requires omp_requires_mask; +static inline dump_flags_t +get_openacc_privatization_dump_flags () +{ + dump_flags_t l_dump_flags = MSG_NOTE; + + /* For '--param=openacc-privatization=quiet', diagnostics only go to dump + files. */ + if (param_openacc_privatization == OPENACC_PRIVATIZATION_QUIET) + l_dump_flags |= MSG_PRIORITY_INTERNALS; + + return l_dump_flags; +} + #endif /* GCC_OMP_GENERAL_H */ diff --git a/gcc/omp-low.c b/gcc/omp-low.c index cadca7e..e00051b 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -179,6 +179,9 @@ struct omp_context /* Only used for omp target contexts. True if an OpenMP construct other than teams is strictly nested in it. */ bool nonteams_nested_p; + + /* Candidates for adjusting OpenACC privatization level. */ + vec<tree> oacc_privatization_candidates; }; static splay_tree all_contexts; @@ -3016,11 +3019,12 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx) /* No nesting of non-OpenACC STMT (that is, an OpenMP one, or a GOMP builtin) inside an OpenACC CTX. */ - if (!(is_gimple_omp (stmt) - && is_gimple_omp_oacc (stmt)) - /* Except for atomic codes that we share with OpenMP. */ - && !(gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD - || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE)) + if (gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD + || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE) + /* ..., except for the atomic codes that OpenACC shares with OpenMP. */ + ; + else if (!(is_gimple_omp (stmt) + && is_gimple_omp_oacc (stmt))) { if (oacc_get_fn_attrib (cfun->decl) != NULL) { @@ -7131,8 +7135,9 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *body_p, static void lower_oacc_reductions (location_t loc, tree clauses, tree level, bool inner, - gcall *fork, gcall *join, gimple_seq *fork_seq, - gimple_seq *join_seq, omp_context *ctx) + gcall *fork, gcall *private_marker, gcall *join, + gimple_seq *fork_seq, gimple_seq *join_seq, + omp_context *ctx) { gimple_seq before_fork = NULL; gimple_seq after_fork = NULL; @@ -7336,6 +7341,8 @@ lower_oacc_reductions (location_t loc, tree clauses, tree level, bool inner, /* Now stitch things together. */ gimple_seq_add_seq (fork_seq, before_fork); + if (private_marker) + gimple_seq_add_stmt (fork_seq, private_marker); if (fork) gimple_seq_add_stmt (fork_seq, fork); gimple_seq_add_seq (fork_seq, after_fork); @@ -8115,7 +8122,7 @@ lower_oacc_loop_marker (location_t loc, tree ddvar, bool head, HEAD and TAIL. */ static void -lower_oacc_head_tail (location_t loc, tree clauses, +lower_oacc_head_tail (location_t loc, tree clauses, gcall *private_marker, gimple_seq *head, gimple_seq *tail, omp_context *ctx) { bool inner = false; @@ -8123,6 +8130,14 @@ lower_oacc_head_tail (location_t loc, tree clauses, gimple_seq_add_stmt (head, gimple_build_assign (ddvar, integer_zero_node)); unsigned count = lower_oacc_head_mark (loc, ddvar, clauses, head, ctx); + + if (private_marker) + { + gimple_set_location (private_marker, loc); + gimple_call_set_lhs (private_marker, ddvar); + gimple_call_set_arg (private_marker, 1, ddvar); + } + tree fork_kind = build_int_cst (unsigned_type_node, IFN_UNIQUE_OACC_FORK); tree join_kind = build_int_cst (unsigned_type_node, IFN_UNIQUE_OACC_JOIN); @@ -8153,7 +8168,8 @@ lower_oacc_head_tail (location_t loc, tree clauses, &join_seq); lower_oacc_reductions (loc, clauses, place, inner, - fork, join, &fork_seq, &join_seq, ctx); + fork, (count == 1) ? private_marker : NULL, + join, &fork_seq, &join_seq, ctx); /* Append this level to head. */ gimple_seq_add_seq (head, fork_seq); @@ -10128,6 +10144,165 @@ lower_omp_for_lastprivate (struct omp_for_data *fd, gimple_seq *body_p, } } +/* OpenACC privatization. + + Or, in other words, *sharing* at the respective OpenACC level of + parallelism. + + From a correctness perspective, a non-addressable variable can't be accessed + outside the current thread, so it can go in a (faster than shared memory) + register -- though that register may need to be broadcast in some + circumstances. A variable can only meaningfully be "shared" across workers + or vector lanes if its address is taken, e.g. by a call to an atomic + builtin. + + From an optimisation perspective, the answer might be fuzzier: maybe + sometimes, using shared memory directly would be faster than + broadcasting. */ + +static void +oacc_privatization_begin_diagnose_var (const dump_flags_t l_dump_flags, + const location_t loc, const tree c, + const tree decl) +{ + const dump_user_location_t d_u_loc + = dump_user_location_t::from_location_t (loc); +/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat" +#endif + dump_printf_loc (l_dump_flags, d_u_loc, + "variable %<%T%> ", decl); +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + if (c) + dump_printf (l_dump_flags, + "in %qs clause ", + omp_clause_code_name[OMP_CLAUSE_CODE (c)]); + else + dump_printf (l_dump_flags, + "declared in block "); +} + +static bool +oacc_privatization_candidate_p (const location_t loc, const tree c, + const tree decl) +{ + dump_flags_t l_dump_flags = get_openacc_privatization_dump_flags (); + + /* There is some differentiation depending on block vs. clause. */ + bool block = !c; + + bool res = true; + + if (res && !VAR_P (decl)) + { + res = false; + + if (dump_enabled_p ()) + { + oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl); + dump_printf (l_dump_flags, + "potentially has improper OpenACC privatization level: %qs\n", + get_tree_code_name (TREE_CODE (decl))); + } + } + + if (res && block && TREE_STATIC (decl)) + { + res = false; + + if (dump_enabled_p ()) + { + oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl); + dump_printf (l_dump_flags, + "isn%'t candidate for adjusting OpenACC privatization level: %s\n", + "static"); + } + } + + if (res && block && DECL_EXTERNAL (decl)) + { + res = false; + + if (dump_enabled_p ()) + { + oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl); + dump_printf (l_dump_flags, + "isn%'t candidate for adjusting OpenACC privatization level: %s\n", + "external"); + } + } + + if (res && !TREE_ADDRESSABLE (decl)) + { + res = false; + + if (dump_enabled_p ()) + { + oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl); + dump_printf (l_dump_flags, + "isn%'t candidate for adjusting OpenACC privatization level: %s\n", + "not addressable"); + } + } + + if (res) + { + if (dump_enabled_p ()) + { + oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl); + dump_printf (l_dump_flags, + "is candidate for adjusting OpenACC privatization level\n"); + } + } + + if (dump_file && (dump_flags & TDF_DETAILS)) + { + print_generic_decl (dump_file, decl, dump_flags); + fprintf (dump_file, "\n"); + } + + return res; +} + +/* Scan CLAUSES for candidates for adjusting OpenACC privatization level in + CTX. */ + +static void +oacc_privatization_scan_clause_chain (omp_context *ctx, tree clauses) +{ + for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_PRIVATE) + { + tree decl = OMP_CLAUSE_DECL (c); + + if (!oacc_privatization_candidate_p (OMP_CLAUSE_LOCATION (c), c, decl)) + continue; + + gcc_checking_assert (!ctx->oacc_privatization_candidates.contains (decl)); + ctx->oacc_privatization_candidates.safe_push (decl); + } +} + +/* Scan DECLS for candidates for adjusting OpenACC privatization level in + CTX. */ + +static void +oacc_privatization_scan_decl_chain (omp_context *ctx, tree decls) +{ + for (tree decl = decls; decl; decl = DECL_CHAIN (decl)) + { + if (!oacc_privatization_candidate_p (gimple_location (ctx->stmt), NULL, decl)) + continue; + + gcc_checking_assert (!ctx->oacc_privatization_candidates.contains (decl)); + ctx->oacc_privatization_candidates.safe_push (decl); + } +} + /* Callback for walk_gimple_seq. Find #pragma omp scan statement. */ static tree @@ -10957,6 +11132,58 @@ lower_omp_for_scan (gimple_seq *body_p, gimple_seq *dlist, gomp_for *stmt, *dlist = new_dlist; } +/* Build an internal UNIQUE function with type IFN_UNIQUE_OACC_PRIVATE listing + the addresses of variables to be made private at the surrounding + parallelism level. Such functions appear in the gimple code stream in two + forms, e.g. for a partitioned loop: + + .data_dep.6 = .UNIQUE (OACC_HEAD_MARK, .data_dep.6, 1, 68); + .data_dep.6 = .UNIQUE (OACC_PRIVATE, .data_dep.6, -1, &w); + .data_dep.6 = .UNIQUE (OACC_FORK, .data_dep.6, -1); + .data_dep.6 = .UNIQUE (OACC_HEAD_MARK, .data_dep.6); + + or alternatively, OACC_PRIVATE can appear at the top level of a parallel, + not as part of a HEAD_MARK sequence: + + .UNIQUE (OACC_PRIVATE, 0, 0, &w); + + For such stand-alone appearances, the 3rd argument is always 0, denoting + gang partitioning. */ + +static gcall * +lower_oacc_private_marker (omp_context *ctx) +{ + if (ctx->oacc_privatization_candidates.length () == 0) + return NULL; + + auto_vec<tree, 5> args; + + args.quick_push (build_int_cst (integer_type_node, IFN_UNIQUE_OACC_PRIVATE)); + args.quick_push (integer_zero_node); + args.quick_push (integer_minus_one_node); + + int i; + tree decl; + FOR_EACH_VEC_ELT (ctx->oacc_privatization_candidates, i, decl) + { + for (omp_context *thisctx = ctx; thisctx; thisctx = thisctx->outer) + { + tree inner_decl = maybe_lookup_decl (decl, thisctx); + if (inner_decl) + { + decl = inner_decl; + break; + } + } + gcc_checking_assert (decl); + + tree addr = build_fold_addr_expr (decl); + args.safe_push (addr); + } + + return gimple_build_call_internal_vec (IFN_UNIQUE, args); +} + /* Lower code for an OMP loop directive. */ static void @@ -10973,6 +11200,9 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx) push_gimplify_context (); + if (is_gimple_omp_oacc (ctx->stmt)) + oacc_privatization_scan_clause_chain (ctx, gimple_omp_for_clauses (stmt)); + lower_omp (gimple_omp_for_pre_body_ptr (stmt), ctx); block = make_node (BLOCK); @@ -10991,6 +11221,8 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx) gbind *inner_bind = as_a <gbind *> (gimple_seq_first_stmt (omp_for_body)); tree vars = gimple_bind_vars (inner_bind); + if (is_gimple_omp_oacc (ctx->stmt)) + oacc_privatization_scan_decl_chain (ctx, vars); gimple_bind_append_vars (new_stmt, vars); /* bind_vars/BLOCK_VARS are being moved to new_stmt/block, don't keep them on the inner_bind and it's block. */ @@ -11104,6 +11336,11 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx) lower_omp (gimple_omp_body_ptr (stmt), ctx); + gcall *private_marker = NULL; + if (is_gimple_omp_oacc (ctx->stmt) + && !gimple_seq_empty_p (omp_for_body)) + private_marker = lower_oacc_private_marker (ctx); + /* Lower the header expressions. At this point, we can assume that the header is of the form: @@ -11158,7 +11395,7 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx) if (is_gimple_omp_oacc (ctx->stmt) && !ctx_in_oacc_kernels_region (ctx)) lower_oacc_head_tail (gimple_location (stmt), - gimple_omp_for_clauses (stmt), + gimple_omp_for_clauses (stmt), private_marker, &oacc_head, &oacc_tail, ctx); /* Add OpenACC partitioning and reduction markers just before the loop. */ @@ -13155,8 +13392,14 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) them as a dummy GANG loop. */ tree level = build_int_cst (integer_type_node, GOMP_DIM_GANG); + gcall *private_marker = lower_oacc_private_marker (ctx); + + if (private_marker) + gimple_call_set_arg (private_marker, 2, level); + lower_oacc_reductions (gimple_location (ctx->stmt), clauses, level, - false, NULL, NULL, &fork_seq, &join_seq, ctx); + false, NULL, private_marker, NULL, &fork_seq, + &join_seq, ctx); } gimple_seq_add_seq (&new_body, fork_seq); @@ -13398,6 +13641,11 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx) ctx); break; case GIMPLE_BIND: + if (ctx && is_gimple_omp_oacc (ctx->stmt)) + { + tree vars = gimple_bind_vars (as_a <gbind *> (stmt)); + oacc_privatization_scan_decl_chain (ctx, vars); + } lower_omp (gimple_bind_body_ptr (as_a <gbind *> (stmt)), ctx); maybe_remove_omp_member_access_dummy_vars (as_a <gbind *> (stmt)); break; diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c index 1612461..e907827 100644 --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "attribs.h" #include "cfgloop.h" #include "context.h" +#include "convert.h" /* Describe the OpenACC looping structure of a function. The entire function is held in a 'NULL' loop. */ @@ -1357,7 +1358,9 @@ oacc_loop_xform_head_tail (gcall *from, int level) = ((enum ifn_unique_kind) TREE_INT_CST_LOW (gimple_call_arg (stmt, 0))); - if (k == IFN_UNIQUE_OACC_FORK || k == IFN_UNIQUE_OACC_JOIN) + if (k == IFN_UNIQUE_OACC_FORK + || k == IFN_UNIQUE_OACC_JOIN + || k == IFN_UNIQUE_OACC_PRIVATE) *gimple_call_arg_ptr (stmt, 2) = replacement; else if (k == kind && stmt != from) break; @@ -1774,6 +1777,136 @@ default_goacc_reduction (gcall *call) gsi_replace_with_seq (&gsi, seq, true); } +struct var_decl_rewrite_info +{ + gimple *stmt; + hash_map<tree, tree> *adjusted_vars; + bool avoid_pointer_conversion; + bool modified; +}; + +/* Helper function for execute_oacc_device_lower. Rewrite VAR_DECLs (by + themselves or wrapped in various other nodes) according to ADJUSTED_VARS in + the var_decl_rewrite_info pointed to via DATA. Used as part of coercing + gang-private variables in OpenACC offload regions to reside in GPU shared + memory. */ + +static tree +oacc_rewrite_var_decl (tree *tp, int *walk_subtrees, void *data) +{ + walk_stmt_info *wi = (walk_stmt_info *) data; + var_decl_rewrite_info *info = (var_decl_rewrite_info *) wi->info; + + if (TREE_CODE (*tp) == ADDR_EXPR) + { + tree arg = TREE_OPERAND (*tp, 0); + tree *new_arg = info->adjusted_vars->get (arg); + + if (new_arg) + { + if (info->avoid_pointer_conversion) + { + *tp = build_fold_addr_expr (*new_arg); + info->modified = true; + *walk_subtrees = 0; + } + else + { + gimple_stmt_iterator gsi = gsi_for_stmt (info->stmt); + tree repl = build_fold_addr_expr (*new_arg); + gimple *stmt1 + = gimple_build_assign (make_ssa_name (TREE_TYPE (repl)), repl); + tree conv = convert_to_pointer (TREE_TYPE (*tp), + gimple_assign_lhs (stmt1)); + gimple *stmt2 + = gimple_build_assign (make_ssa_name (TREE_TYPE (*tp)), conv); + gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT); + gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT); + *tp = gimple_assign_lhs (stmt2); + info->modified = true; + *walk_subtrees = 0; + } + } + } + else if (TREE_CODE (*tp) == COMPONENT_REF || TREE_CODE (*tp) == ARRAY_REF) + { + tree *base = &TREE_OPERAND (*tp, 0); + + while (TREE_CODE (*base) == COMPONENT_REF + || TREE_CODE (*base) == ARRAY_REF) + base = &TREE_OPERAND (*base, 0); + + if (TREE_CODE (*base) != VAR_DECL) + return NULL; + + tree *new_decl = info->adjusted_vars->get (*base); + if (!new_decl) + return NULL; + + int base_quals = TYPE_QUALS (TREE_TYPE (*new_decl)); + tree field = TREE_OPERAND (*tp, 1); + + /* Adjust the type of the field. */ + int field_quals = TYPE_QUALS (TREE_TYPE (field)); + if (TREE_CODE (field) == FIELD_DECL && field_quals != base_quals) + { + tree *field_type = &TREE_TYPE (field); + while (TREE_CODE (*field_type) == ARRAY_TYPE) + field_type = &TREE_TYPE (*field_type); + field_quals |= base_quals; + *field_type = build_qualified_type (*field_type, field_quals); + } + + /* Adjust the type of the component ref itself. */ + tree comp_type = TREE_TYPE (*tp); + int comp_quals = TYPE_QUALS (comp_type); + if (TREE_CODE (*tp) == COMPONENT_REF && comp_quals != base_quals) + { + comp_quals |= base_quals; + TREE_TYPE (*tp) + = build_qualified_type (comp_type, comp_quals); + } + + *base = *new_decl; + info->modified = true; + } + else if (TREE_CODE (*tp) == VAR_DECL) + { + tree *new_decl = info->adjusted_vars->get (*tp); + if (new_decl) + { + *tp = *new_decl; + info->modified = true; + } + } + + return NULL_TREE; +} + +/* Return TRUE if CALL is a call to a builtin atomic/sync operation. */ + +static bool +is_sync_builtin_call (gcall *call) +{ + tree callee = gimple_call_fndecl (call); + + if (callee != NULL_TREE + && gimple_call_builtin_p (call, BUILT_IN_NORMAL)) + switch (DECL_FUNCTION_CODE (callee)) + { +#undef DEF_SYNC_BUILTIN +#define DEF_SYNC_BUILTIN(ENUM, NAME, TYPE, ATTRS) case ENUM: +#include "sync-builtins.def" +#undef DEF_SYNC_BUILTIN + return true; + + default: + ; + } + + return false; +} + /* Main entry point for oacc transformations which run on the device compiler after LTO, so we know what the target device is at this point (including the host fallback). */ @@ -1923,6 +2056,8 @@ execute_oacc_device_lower () dominance information to update SSA. */ calculate_dominance_info (CDI_DOMINATORS); + hash_map<tree, tree> adjusted_vars; + /* Now lower internal loop functions to target-specific code sequences. */ basic_block bb; @@ -1999,6 +2134,90 @@ execute_oacc_device_lower () case IFN_UNIQUE_OACC_TAIL_MARK: remove = true; break; + + case IFN_UNIQUE_OACC_PRIVATE: + { + dump_flags_t l_dump_flags + = get_openacc_privatization_dump_flags (); + + location_t loc = gimple_location (stmt); + if (LOCATION_LOCUS (loc) == UNKNOWN_LOCATION) + loc = DECL_SOURCE_LOCATION (current_function_decl); + const dump_user_location_t d_u_loc + = dump_user_location_t::from_location_t (loc); + + HOST_WIDE_INT level + = TREE_INT_CST_LOW (gimple_call_arg (call, 2)); + gcc_checking_assert (level == -1 + || (level >= 0 + && level < GOMP_DIM_MAX)); + for (unsigned i = 3; + i < gimple_call_num_args (call); + i++) + { + static char const *const axes[] = + /* Must be kept in sync with GOMP_DIM enumeration. */ + { "gang", "worker", "vector" }; + + tree arg = gimple_call_arg (call, i); + gcc_checking_assert (TREE_CODE (arg) == ADDR_EXPR); + tree decl = TREE_OPERAND (arg, 0); + if (dump_enabled_p ()) +/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat" +#endif + dump_printf_loc (l_dump_flags, d_u_loc, + "variable %<%T%> ought to be" + " adjusted for OpenACC" + " privatization level: %qs\n", + decl, + (level == -1 + ? "UNKNOWN" : axes[level])); +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + bool adjusted; + if (level == -1) + adjusted = false; + else if (!targetm.goacc.adjust_private_decl) + adjusted = false; + else if (level == GOMP_DIM_VECTOR) + { + /* That's the default behavior. */ + adjusted = true; + } + else + { + tree oldtype = TREE_TYPE (decl); + tree newdecl + = targetm.goacc.adjust_private_decl (loc, decl, + level); + adjusted = (TREE_TYPE (newdecl) != oldtype + || newdecl != decl); + if (adjusted) + adjusted_vars.put (decl, newdecl); + } + if (adjusted + && dump_enabled_p ()) +/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */ +#if __GNUC__ >= 10 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat" +#endif + dump_printf_loc (l_dump_flags, d_u_loc, + "variable %<%T%> adjusted for" + " OpenACC privatization level:" + " %qs\n", + decl, axes[level]); +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + } + remove = true; + } + break; } break; } @@ -2030,6 +2249,76 @@ execute_oacc_device_lower () gsi_next (&gsi); } + /* Regarding the OpenACC privatization level, we're currently only looking at + making the gang-private level work. Regarding that, we have the following + configurations: + + - GCN offloading: 'targetm.goacc.adjust_private_decl' does the work (in + particular, change 'TREE_TYPE', etc.) and there is no + 'targetm.goacc.expand_var_decl'. + + - nvptx offloading: 'targetm.goacc.adjust_private_decl' only sets a + marker and then 'targetm.goacc.expand_var_decl' does the work. + + Eventually (in particular, for worker-private level?), both + 'targetm.goacc.adjust_private_decl' and 'targetm.goacc.expand_var_decl' + may need to do things, but that's currently not meant to be addressed, and + thus not fully worked out and implemented, and thus untested. Hence, + 'assert' what currently is implemented/tested, only. */ + + if (targetm.goacc.expand_var_decl) + gcc_assert (adjusted_vars.is_empty ()); + + /* Make adjustments to gang-private local variables if required by the + target, e.g. forcing them into a particular address space. Afterwards, + ADDR_EXPR nodes which have adjusted variables as their argument need to + be modified in one of two ways: + + 1. They can be recreated, making a pointer to the variable in the new + address space, or + + 2. The address of the variable in the new address space can be taken, + converted to the default (original) address space, and the result of + that conversion subsituted in place of the original ADDR_EXPR node. + + Which of these is done depends on the gimple statement being processed. + At present atomic operations and inline asms use (1), and everything else + uses (2). At least on AMD GCN, there are atomic operations that work + directly in the LDS address space. + + COMPONENT_REFS, ARRAY_REFS and plain VAR_DECLs are also rewritten to use + the new decl, adjusting types of appropriate tree nodes as necessary. */ + + if (targetm.goacc.adjust_private_decl + && !adjusted_vars.is_empty ()) + { + FOR_ALL_BB_FN (bb, cfun) + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); + !gsi_end_p (gsi); + gsi_next (&gsi)) + { + gimple *stmt = gsi_stmt (gsi); + walk_stmt_info wi; + var_decl_rewrite_info info; + + info.avoid_pointer_conversion + = (is_gimple_call (stmt) + && is_sync_builtin_call (as_a <gcall *> (stmt))) + || gimple_code (stmt) == GIMPLE_ASM; + info.stmt = stmt; + info.modified = false; + info.adjusted_vars = &adjusted_vars; + + memset (&wi, 0, sizeof (wi)); + wi.info = &info; + + walk_gimple_op (stmt, oacc_rewrite_var_decl, &wi); + + if (info.modified) + update_stmt (stmt); + } + } + free_oacc_loop (loops); return 0; @@ -37,12 +37,103 @@ along with GCC; see the file COPYING3. If not see static void set_Wstrict_aliasing (struct gcc_options *opts, int onoff); -/* Indexed by enum debug_info_type. */ +/* Names of fundamental debug info formats indexed by enum + debug_info_type. */ + const char *const debug_type_names[] = { "none", "stabs", "dwarf-2", "xcoff", "vms" }; +/* Bitmasks of fundamental debug info formats indexed by enum + debug_info_type. */ + +static uint32_t debug_type_masks[] = +{ + NO_DEBUG, DBX_DEBUG, DWARF2_DEBUG, XCOFF_DEBUG, VMS_DEBUG +}; + +/* Names of the set of debug formats requested by user. Updated and accessed + via debug_set_names. */ + +static char df_set_names[sizeof "none stabs dwarf-2 xcoff vms"]; + +/* Get enum debug_info_type of the specified debug format, for error messages. + Can be used only for individual debug format types. */ + +enum debug_info_type +debug_set_to_format (uint32_t debug_info_set) +{ + int idx = 0; + enum debug_info_type dinfo_type = DINFO_TYPE_NONE; + /* Find first set bit. */ + if (debug_info_set) + idx = exact_log2 (debug_info_set & - debug_info_set); + /* Check that only one bit is set, if at all. This function is meant to be + used only for vanilla debug_info_set bitmask values, i.e. for individual + debug format types upto DINFO_TYPE_MAX. */ + gcc_assert ((debug_info_set & (debug_info_set - 1)) == 0); + dinfo_type = (enum debug_info_type)idx; + gcc_assert (dinfo_type <= DINFO_TYPE_MAX); + return dinfo_type; +} + +/* Get the number of debug formats enabled for output. */ + +unsigned int +debug_set_count (uint32_t w_symbols) +{ + unsigned int count = 0; + while (w_symbols) + { + ++ count; + w_symbols &= ~ (w_symbols & - w_symbols); + } + return count; +} + +/* Get the names of the debug formats enabled for output. */ + +const char * +debug_set_names (uint32_t w_symbols) +{ + uint32_t df_mask = 0; + /* Reset the string to be returned. */ + memset (df_set_names, 0, sizeof (df_set_names)); + /* Get the popcount. */ + int num_set_df = debug_set_count (w_symbols); + /* Iterate over the debug formats. Add name string for those enabled. */ + for (int i = DINFO_TYPE_NONE; i <= DINFO_TYPE_MAX; i++) + { + df_mask = debug_type_masks[i]; + if (w_symbols & df_mask) + { + strcat (df_set_names, debug_type_names[i]); + num_set_df--; + if (num_set_df) + strcat (df_set_names, " "); + else + break; + } + else if (!w_symbols) + { + /* No debug formats enabled. */ + gcc_assert (i == DINFO_TYPE_NONE); + strcat (df_set_names, debug_type_names[i]); + break; + } + } + return df_set_names; +} + +/* Return TRUE iff dwarf2 debug info is enabled. */ + +bool +dwarf_debuginfo_p () +{ + return (write_symbols & DWARF2_DEBUG); +} + /* Parse the -femit-struct-debug-detailed option value and set the flag variables. */ @@ -190,7 +281,7 @@ static const char use_diagnosed_msg[] = N_("Uses of this option are diagnosed.") typedef char *char_p; /* For DEF_VEC_P. */ -static void set_debug_level (enum debug_info_type type, int extended, +static void set_debug_level (uint32_t dinfo, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc); @@ -3027,17 +3118,17 @@ fast_math_flags_struct_set_p (struct cl_optimization *opt) } /* Handle a debug output -g switch for options OPTS - (OPTS_SET->x_write_symbols storing whether a debug type was passed + (OPTS_SET->x_write_symbols storing whether a debug format was passed explicitly), location LOC. EXTENDED is true or false to support extended output (2 is special and means "-ggdb" was given). */ static void -set_debug_level (enum debug_info_type type, int extended, const char *arg, +set_debug_level (uint32_t dinfo, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) { opts->x_use_gnu_debug_info_extensions = extended; - if (type == NO_DEBUG) + if (dinfo == NO_DEBUG) { if (opts->x_write_symbols == NO_DEBUG) { @@ -3058,14 +3149,18 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg, } else { - /* Does it conflict with an already selected type? */ + /* Does it conflict with an already selected debug format? */ if (opts_set->x_write_symbols != NO_DEBUG && opts->x_write_symbols != NO_DEBUG - && type != opts->x_write_symbols) - error_at (loc, "debug format %qs conflicts with prior selection", - debug_type_names[type]); - opts->x_write_symbols = type; - opts_set->x_write_symbols = type; + && dinfo != opts->x_write_symbols) + { + gcc_assert (debug_set_count (dinfo) <= 1); + error_at (loc, "debug format %qs conflicts with prior selection", + debug_type_names[debug_set_to_format (dinfo)]); + } + + opts->x_write_symbols = dinfo; + opts_set->x_write_symbols = dinfo; } /* A debug flag without a level defaults to level 2. diff --git a/gcc/params.opt b/gcc/params.opt index 2e4cbdd..0d0dcd2 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -795,6 +795,19 @@ Enum(openacc_kernels) String(decompose) Value(OPENACC_KERNELS_DECOMPOSE) EnumValue Enum(openacc_kernels) String(parloops) Value(OPENACC_KERNELS_PARLOOPS) +-param=openacc-privatization= +Common Joined Enum(openacc_privatization) Var(param_openacc_privatization) Init(OPENACC_PRIVATIZATION_QUIET) Param +--param=openacc-privatization=[quiet|noisy] Specify mode of OpenACC privatization diagnostics. + +Enum +Name(openacc_privatization) Type(enum openacc_privatization) + +EnumValue +Enum(openacc_privatization) String(quiet) Value(OPENACC_PRIVATIZATION_QUIET) + +EnumValue +Enum(openacc_privatization) String(noisy) Value(OPENACC_PRIVATIZATION_NOISY) + -param=parloops-chunk-size= Common Joined UInteger Var(param_parloops_chunk_size) Param Optimization Chunk size of omp schedule for loops parallelized by parloops. @@ -1089,4 +1102,8 @@ Bound on number of runtime checks inserted by the vectorizer's loop versioning f Common Joined UInteger Var(param_vect_partial_vector_usage) Init(2) IntegerRange(0, 2) Param Optimization Controls how loop vectorizer uses partial vectors. 0 means never, 1 means only for loops whose need to iterate can be removed, 2 means for all loops. The default value is 2. +-param=vect-inner-loop-cost-factor= +Common Joined UInteger Var(param_vect_inner_loop_cost_factor) Init(50) IntegerRange(1, 999999) Param Optimization +The factor which the loop vectorizer applies to the cost of statements in an inner loop relative to the loop being vectorized. + ; This comment is to ensure we retain the blank line above. diff --git a/gcc/passes.def b/gcc/passes.def index de39fa4..945d2bc 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -348,6 +348,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_phiopt, false /* early_p */); NEXT_PASS (pass_fold_builtins); NEXT_PASS (pass_optimize_widening_mul); + NEXT_PASS (pass_sink_code); NEXT_PASS (pass_store_merging); NEXT_PASS (pass_tail_calls); /* If DCE is not run before checking for uninitialized uses, diff --git a/gcc/target.def b/gcc/target.def index bbaf6b4..1dffedc 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1726,6 +1726,36 @@ for allocating any storage for reductions when necessary.", void, (gcall *call), default_goacc_reduction) +DEFHOOK +(adjust_private_decl, +"This hook, if defined, is used by accelerator target back-ends to adjust\n\ +OpenACC variable declarations that should be made private to the given\n\ +parallelism level (i.e. @code{GOMP_DIM_GANG}, @code{GOMP_DIM_WORKER} or\n\ +@code{GOMP_DIM_VECTOR}). A typical use for this hook is to force variable\n\ +declarations at the @code{gang} level to reside in GPU shared memory.\n\ +@var{loc} may be used for diagnostic purposes.\n\ +\n\ +You may also use the @code{TARGET_GOACC_EXPAND_VAR_DECL} hook if the\n\ +adjusted variable declaration needs to be expanded to RTL in a non-standard\n\ +way.", +tree, (location_t loc, tree var, int level), +NULL) + +DEFHOOK +(expand_var_decl, +"This hook, if defined, is used by accelerator target back-ends to expand\n\ +specially handled kinds of @code{VAR_DECL} expressions. A particular use is\n\ +to place variables with specific attributes inside special accelarator\n\ +memories. A return value of @code{NULL} indicates that the target does not\n\ +handle this @code{VAR_DECL}, and normal RTL expanding is resumed.\n\ +\n\ +Only define this hook if your accelerator target needs to expand certain\n\ +@code{VAR_DECL} nodes in a way that differs from the default. You can also adjust\n\ +private variables at OpenACC device-lowering time using the\n\ +@code{TARGET_GOACC_ADJUST_PRIVATE_DECL} target hook.", +rtx, (tree var), +NULL) + HOOK_VECTOR_END (goacc) /* Functions relating to vectorization. */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 1947ef2..08f676b 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -90,6 +90,9 @@ along with GCC; see the file COPYING3. If not see #include "attribs.h" #include "asan.h" #include "emit-rtl.h" +#include "gimple.h" +#include "cfgloop.h" +#include "tree-vectorizer.h" bool default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, @@ -1480,7 +1483,11 @@ default_add_stmt_cost (class vec_info *vinfo, void *data, int count, arbitrary and could potentially be improved with analysis. */ if (where == vect_body && stmt_info && stmt_in_inner_loop_p (vinfo, stmt_info)) - count *= 50; /* FIXME. */ + { + loop_vec_info loop_vinfo = dyn_cast<loop_vec_info> (vinfo); + gcc_assert (loop_vinfo); + count *= LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); + } retval = (unsigned) (count * stmt_cost); cost[where] += retval; @@ -2055,7 +2062,7 @@ default_debug_unwind_info (void) /* Otherwise, only turn it on if dwarf2 debugging is enabled. */ #ifdef DWARF2_DEBUGGING_INFO - if (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) return UI_DWARF2; #endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9141534..0b3dc03 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,391 @@ +2021-05-23 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100722 + * gcc.target/i386/pr100722.c: New test. + +2021-05-23 Harald Anlauf <anlauf@gmx.de> + + PR fortran/100551 + * gfortran.dg/pr100551.f90: New test. + +2021-05-23 Andrew Pinski <apinski@marvell.com> + + * gcc.dg/gimplefe-45.c: New test. + +2021-05-21 Aaron Sawdey <acsawdey@linux.ibm.com> + + * gcc.target/powerpc/fusion-p10-addadd.c: New file. + +2021-05-21 Aaron Sawdey <acsawdey@linux.ibm.com> + + * gcc.target/powerpc/fusion-p10-ldcmpi.c: New file. + * gcc.target/powerpc/fusion-p10-2logical.c: New file. + +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * c-c++-common/gomp/pr99928-3.c: Remove all xfails. + * c-c++-common/gomp/pr99928-15.c: New test. + +2021-05-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * c-c++-common/gomp/pr99928-6.c: Remove all xfails. + * c-c++-common/gomp/pr99928-13.c: New test. + * c-c++-common/gomp/pr99928-14.c: New test. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * c-c++-common/goacc/privatization-1-compute-loop.c: Update. + * c-c++-common/goacc/privatization-1-compute.c: Likewise. + * c-c++-common/goacc/privatization-1-routine_gang-loop.c: + Likewise. + * c-c++-common/goacc/privatization-1-routine_gang.c: Likewise. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * c-c++-common/goacc/privatization-1-compute-loop.c: New file. + * c-c++-common/goacc/privatization-1-compute.c: Likewise. + * c-c++-common/goacc/privatization-1-routine_gang-loop.c: + Likewise. + * c-c++-common/goacc/privatization-1-routine_gang.c: Likewise. + * gfortran.dg/goacc/privatization-1-compute-loop.f90: Likewise. + * gfortran.dg/goacc/privatization-1-compute.f90: Likewise. + * gfortran.dg/goacc/privatization-1-routine_gang-loop.f90: + Likewise. + * gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise. + * c-c++-common/goacc-gomp/nesting-1.c: Update. + * c-c++-common/goacc/private-reduction-1.c: Likewise. + * gfortran.dg/goacc/private-3.f95: Likewise. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + * lib/target-supports.exp (check_effective_target___OPTIMIZE__): + New proc. + * gcc.c-torture/compile/ssa-unused-1.c: New file. + +2021-05-21 Richard Biener <rguenther@suse.de> + H.J. Lu <hjl.tools@gmail.com> + + * gcc.target/i386/pr90773-24.c: New test. + * gcc.target/i386/pr90773-25.c: Likewise. + +2021-05-21 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100637 + * g++.target/i386/pr100637-1b.C: New test. + * g++.target/i386/pr100637-1w.C: Ditto. + * gcc.target/i386/pr100637-2b.c: Ditto. + * gcc.target/i386/pr100637-2w.c: Ditto. + +2021-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/derived_type7.adb, gnat.dg/derived_type7.ads: New test. + +2021-05-20 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp2a/desig19.C: New test. + +2021-05-20 Jason Merrill <jason@redhat.com> + + PR c++/100489 + * g++.dg/cpp2a/desig18.C: New test. + +2021-05-20 Indu Bhagat <indu.bhagat@oracle.com> + + * gcc.dg/pch/valid-1.c: Adjust diagnostic message in testcase. + * lib/dg-pch.exp: Adjust diagnostic message. + +2021-05-20 Martin Sebor <msebor@redhat.com> + + PR middle-end/100684 + * g++.dg/warn/Wnonnull13.C: New test. + * g++.dg/warn/Wnonnull14.C: New test. + * g++.dg/warn/Wnonnull15.C: New test. + +2021-05-20 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * g++.dg/modules/omp-1_c.C: Fix testcase. + +2021-05-20 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100701 + * gcc.target/i386/pr100701.c: New test. + +2021-05-20 Marcel Vollweiler <marcel@codesourcery.com> + + * gfortran.dg/gomp/map-6.f90: New test. + * gfortran.dg/gomp/map-7.f90: New test. + * gfortran.dg/gomp/map-8.f90: New test. + +2021-05-20 Eric Botcazou <ebotcazou@adacore.com> + + PR testsuite/96488 + * gnat.dg/unchecked_convert5.adb: Do not run on PowerPC64 LE. + * gnat.dg/unchecked_convert6.adb: Likewise. + +2021-05-20 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100637 + * gcc.target/i386/pr100637-1w.c (shl, ashr, lshr): New tests. + +2021-05-20 Christophe Lyon <christophe.lyon@linaro.org> + Torbjörn Svensson <torbjorn.svensson@st.com> + + PR c/42579 + * c-c++-common/spellcheck-reserved.c: Add tests for __FILE_NAME__. + * c-c++-common/cpp/file-name-1.c: New test. + +2021-05-20 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/96983 + * gfortran.dg/pr96711.f90: Use 2**digit(x) instead of a hard-coded value; + add comments regarding what the code does. + +2021-05-20 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * c-c++-common/gomp/pr99928-4.c: Remove all xfails. + * c-c++-common/gomp/pr99928-5.c: Likewise. + +2021-05-20 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/100646 + * gcc.dg/cpp/pr100646-1.c: New test. + * gcc.dg/cpp/pr100646-2.c: New test. + +2021-05-20 Jason Merrill <jason@redhat.com> + + PR c++/100634 + * g++.dg/cpp2a/nontype-complex1.C: New test. + +2021-05-20 Jason Merrill <jason@redhat.com> + + PR c++/100659 + * g++.dg/parse/access13.C: New test. + +2021-05-19 Martin Sebor <msebor@redhat.com> + + PR c/100619 + * gcc.dg/pr100619.c: New test. + +2021-05-19 Jason Merrill <jason@redhat.com> + + PR c++/100367 + PR c++/96299 + * g++.dg/cpp2a/spaceship-fallback1.C: New test. + +2021-05-19 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp1z/class-deduction-access1.C: New test. + * g++.dg/cpp1z/class-deduction-access2.C: New test. + +2021-05-19 Marek Polacek <polacek@redhat.com> + + PR c++/100596 + * g++.dg/cpp0x/friend7.C: Turn a few dg-warnings into dg-errors. + Remove dg-errors for GNU attributes. + * g++.dg/ext/attrib63.C: Remove dg-error. + * g++.dg/cpp0x/friend8.C: New test. + +2021-05-19 Kito Cheng <kito.cheng@sifive.com> + + * g++.dg/modules/omp-1_a.C: Check pthread is available. + * g++.dg/modules/omp-1_b.C: Ditto. + * g++.dg/modules/omp-1_c.C: Ditto. + * g++.dg/modules/omp-2_a.C: Ditto. + * g++.dg/modules/omp-2_b.C: Ditto. + +2021-05-19 Alex Coplan <alex.coplan@arm.com> + + PR target/100333 + * gcc.target/arm/cmse/pr100333.c: New test. + +2021-05-19 Christophe Lyon <christophe.lyon@linaro.org> + + PR target/99977 + * gcc.target/arm/pr99977.c: Require arm_arch_v8m_base. + +2021-05-19 Geng Qi <gengqi@linux.alibaba.com> + + * gcc.target/riscv/arch-12.c: New. + * gcc.target/riscv/attribute-19.c: New. + +2021-05-19 Jonathan Wright <jonathan.wright@arm.com> + + * gcc.target/aarch64/narrow_high_combine.c: New test. + +2021-05-19 Richard Biener <rguenther@suse.de> + + PR middle-end/100672 + * gcc.dg/torture/pr100672.c: New testcase. + +2021-05-19 Martin Liska <mliska@suse.cz> + + PR testsuite/100658 + * gcc.dg/local1.c: Fix typos. + * gcc.dg/ucnid-5-utf8.c: Likewise. + * gcc.dg/ucnid-5.c: Likewise. + +2021-05-19 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * gcc.target/aarch64/sve/logical_unpacked_and_2.c: Change + scan-assembly-times to scan-assembly not for superfluous uxtb. + * gcc.target/aarch64/sve/logical_unpacked_and_3.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_and_4.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_and_6.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_and_7.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_eor_2.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_eor_3.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_eor_4.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_eor_6.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_eor_7.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_orr_2.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_orr_3.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_orr_4.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_orr_6.c: Likewise. + * gcc.target/aarch64/sve/logical_unpacked_orr_7.c: Likewise. + * gcc.target/aarch64/sve/ld1_extend.c: New test. + +2021-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/100576 + * gcc.c-torture/compile/pr100576.c: New test. + +2021-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * gcc.dg/tree-ssa/ssa-sink-3.c: Fix test case. + +2021-05-19 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99928 + * c-c++-common/gomp/pr99928-2.c: Remove all xfails. + * c-c++-common/gomp/pr99928-12.c: New test. + +2021-05-19 Xionghu Luo <luoxhu@linux.ibm.com> + + * gcc.dg/tree-ssa/ssa-sink-1.c: Adjust. + * gcc.dg/tree-ssa/ssa-sink-2.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-3.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-4.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-5.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-6.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-7.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-8.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-9.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-10.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-13.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-14.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-16.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-17.c: Ditto. + * gcc.dg/tree-ssa/ssa-sink-18.c: New. + +2021-05-19 Jason Merrill <jason@redhat.com> + + PR c++/100261 + * g++.dg/dfp/mangle-6.C: New test. + +2021-05-19 Jason Merrill <jason@redhat.com> + + PR c++/100372 + * g++.dg/cpp0x/alias-decl-ttp1.C: New test. + +2021-05-18 Bill Schmidt <wschmidt@linux.ibm.com> + + * gcc.target/powerpc/ppc64-abi-warn-1.c: Remove. + * gcc.target/powerpc/ppc64-abi-warn-2.c: Remove. + * gcc.target/powerpc/ppc64-abi-warn-3.c: Remove. + +2021-05-18 Jason Merrill <jason@redhat.com> + + PR c++/100205 + PR c++/99314 + * g++.dg/cpp0x/decltype-nonstatic1.C: New test. + +2021-05-18 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/implicit-delete1.C: New test. + +2021-05-18 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/100615 + * gcc.dg/analyzer/pr100615.c: New test. + +2021-05-18 Uroš Bizjak <ubizjak@gmail.com> + + PR target/100637 + * gcc.target/i386/pr100637-1b.c: New test. + * gcc.target/i386/pr100637-1w.c: Ditto. + * gcc.target/i386/pr92658-avx2-2.c: Do not XFAIL scan for pmovsxbq. + * gcc.target/i386/pr92658-avx2.c: Do not XFAIL scan for pmovzxbq. + * gcc.target/i386/pr92658-avx512vl.c: Do not XFAIL scan for vpmovdb. + * gcc.target/i386/pr92658-sse4-2.c: Do not XFAIL scan for + pmovsxbd and pmovsxwq. + * gcc.target/i386/pr92658-sse4.c: Do not XFAIL scan for + pmovzxbd and pmovzxwq. + +2021-05-18 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/100642 + * gfortran.dg/goacc-gomp/depobj.f90: New test. + +2021-05-18 Thomas Schwinge <thomas@codesourcery.com> + + * lib/gcc-dg.exp: Implement 'dg-note'. + * lib/prune.exp: Likewise. + * gcc.dg/vect/nodump-vect-opt-info-2.c: Use 'dg-note', and + 'dg-prune-output "note: ". + * gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Use + 'dg-note', match up additional notes, one class of them with + XFAILed 'dg-bogus'. + * lib/lto.exp: Implement 'dg-lto-note'. + * g++.dg/lto/odr-1_0.C: Use 'dg-lto-note', match up additional + notes. + * g++.dg/lto/odr-1_1.C: Likewise. + * g++.dg/lto/odr-2_1.C: Likewise. + +2021-05-18 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/100590 + * gcc.dg/pr100590.c: New test. + +2021-05-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/100580 + * g++.dg/other/pr100580.C: New test. + +2021-05-18 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/94589 + * g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to 12. + +2021-05-18 Richard Biener <rguenther@suse.de> + + * gcc.target/i386/pr100582.c: Adjust for AVX512. + +2021-05-18 Richard Biener <rguenther@suse.de> + + PR c/100522 + * gcc.dg/gimplefe-error-10.c: New testcase. + +2021-05-18 Richard Biener <rguenther@suse.de> + + PR c/100547 + * gcc.dg/pr100547.c: New testcase. + * gcc.dg/attr-vector_size.c: Adjust. + +2021-05-18 Andreas Krebbel <krebbel@linux.ibm.com> + + * gcc.target/s390/zvector/vec-_Bool.c: New test. + +2021-05-18 Andreas Krebbel <krebbel@linux.ibm.com> + + PR c++/100281 + * g++.target/s390/pr100281-1.C: New test. + * g++.target/s390/pr100281-2.C: New test. + 2021-05-17 Andrew MacLeod <amacleod@redhat.com> PR tree-optimization/100512 diff --git a/gcc/testsuite/c-c++-common/cpp/file-name-1.c b/gcc/testsuite/c-c++-common/cpp/file-name-1.c new file mode 100644 index 0000000..2b476e3 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/file-name-1.c @@ -0,0 +1,22 @@ +/* { dg-do preprocess } */ +/* { dg-additional-options -Wno-pedantic } */ + +main-1 __FILE_NAME__ + +# 7 "inner.h" 1 +inner-1 __FILE_NAME__ +# 9 "subdir/inside.h" 1 +inside-1 __FILE_NAME__ +inside-2 __FILE__ +# 11 "" 2 +inner-2 __FILE_NAME__ +#13 "" 2 +main-2 __FILE_NAME__ + + +/* { dg-final { scan-file file-name-1.i "main-1 \"\[^\n]*file-name-1.c\"\n" } } */ +/* { dg-final { scan-file file-name-1.i "main-2 \"\[^\n]*file-name-1.c\"\n" } } */ +/* { dg-final { scan-file file-name-1.i "inner-1 \"inner.h\"\n" } } */ +/* { dg-final { scan-file file-name-1.i "inner-2 \"inner.h\"\n" } } */ +/* { dg-final { scan-file file-name-1.i "inside-1 \"inside.h\"\n" } } */ +/* { dg-final { scan-file file-name-1.i "inside-2 \"subdir/inside.h\"\n" } } */ diff --git a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c index aaf0e7a..b0b7837 100644 --- a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c +++ b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c @@ -1,7 +1,14 @@ +/* { dg-additional-options "-fopt-info-omp-note" } */ +/* { dg-additional-options "--param=openacc-privatization=noisy" } for + testing/documenting aspects of that functionality. */ + + void f_acc_data (void) { #pragma acc data + /* { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } */ { int i; #pragma omp atomic write @@ -13,6 +20,8 @@ void f_acc_kernels (void) { #pragma acc kernels + /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } + { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-2 } */ { int i; #pragma omp atomic write @@ -27,6 +36,9 @@ f_acc_loop (void) int i; #pragma acc loop + /* { dg-note {variable 'i\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } + { dg-bogus {note: variable 'i' ought to be adjusted for OpenACC privatization level: 'UNKNOWN'} "TODO" { xfail *-*-* } .-3 } */ for (i = 0; i < 2; ++i) { #pragma omp atomic write @@ -38,6 +50,8 @@ void f_acc_parallel (void) { #pragma acc parallel + /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } + { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-2 } */ { int i; #pragma omp atomic write diff --git a/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c b/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c index d4e3995..38f6b7a 100644 --- a/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c +++ b/gcc/testsuite/c-c++-common/goacc/private-reduction-1.c @@ -1,3 +1,7 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } for + testing/documenting aspects of that functionality. */ + int reduction () { @@ -5,6 +9,8 @@ reduction () #pragma acc parallel #pragma acc loop private (r) reduction (+:r) + /* { dg-note {variable 'r' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} r { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} i { target *-*-* } .-2 } */ for (i = 0; i < 100; i++) r += 10; diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c new file mode 100644 index 0000000..43b39c2 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c @@ -0,0 +1,93 @@ +/* OpenACC privatization: 'loop' construct inside compute construct */ + +/* { dg-additional-options "-fopt-info-omp-note" } */ +/* { dg-additional-options "--param=openacc-privatization=noisy" } for + testing/documenting aspects of that functionality. */ + +/* See also '../../gfortran.dg/goacc/privatization-1-compute-loop.f90'. */ + +/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' + passed to 'incr' may be unset, and in that case, it will be set to [...]", + so to maintain compatibility with earlier Tcl releases, we manually + initialize counter variables: + { dg-line l_dummy[variable c_loop 0] } + { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid + "WARNING: dg-line var l_dummy defined, but not used". */ + +extern int e; +static int s; +int g; + +void +f (int i, int j, int a) +{ + extern int ex; + static int st; + int x, y; +#pragma acc parallel +#pragma acc loop collapse(2) private(a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_loop[incr c_loop] } */ + for (i = 0; i < 20; ++i) + for (j = 0; j < 25; ++j) + { + __label__ ll; + /* Nested scopes fun. */ + { + struct s_ss { int i; } ss; + { + extern int func (int *, int *, int *); + /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */ + /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */ + + a = func (&i, &j, &a); + } + ss.i = a; + { + extern int func2 (int *, int *, int *, int *, int *, int *, int *); + extern int ext; + static int sta; + a = func2 (&e, &s, &g, &ex, &st, &ext, &sta); + } + } + x = a; +#pragma acc atomic write + y = a; + { + int xx, yy; + xx = a; +#pragma acc atomic write + yy = a; + } + + ll: + ; + } + /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j\.1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'i\.0' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_loop$c_loop } + { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_loop$c_loop } */ + /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ +} diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c new file mode 100644 index 0000000..b7c7bff --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c @@ -0,0 +1,88 @@ +/* OpenACC privatization: compute construct */ + +/* { dg-additional-options "-fopt-info-omp-note" } */ +/* { dg-additional-options "--param=openacc-privatization=noisy" } for + testing/documenting aspects of that functionality. */ + +/* See also '../../gfortran.dg/goacc/privatization-1-compute.f90'. */ + +/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' + passed to 'incr' may be unset, and in that case, it will be set to [...]", + so to maintain compatibility with earlier Tcl releases, we manually + initialize counter variables: + { dg-line l_dummy[variable c_compute 0] } + { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid + "WARNING: dg-line var l_dummy defined, but not used". */ + +extern int e; +static int s; +int g; + +void +f (int i, int j, int a) +{ + extern int ex; + static int st; + int x, y; +#pragma acc parallel private(i, j, a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_compute[incr c_compute] } */ + { + __label__ ll; + /* Nested scopes fun. */ + { + struct s_ss { int i; } ss; + { + extern int func (int *, int *, int *); + /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */ + /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */ + + a = func (&i, &j, &a); + } + ss.i = a; + { + extern int func2 (int *, int *, int *, int *, int *, int *, int *); + extern int ext; + static int sta; + a = func2 (&e, &s, &g, &ex, &st, &ext, &sta); + } + } + x = a; +#pragma acc atomic write + y = a; + { + int xx, yy; + xx = a; +#pragma acc atomic write + yy = a; + } + + ll: + ; + } + /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute } + { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute } + { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute } + { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute } + { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute } + { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute } + { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_compute$c_compute } + { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_compute$c_compute } */ + /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "" { target *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ + /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } */ +} diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c new file mode 100644 index 0000000..816e430 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c @@ -0,0 +1,93 @@ +/* OpenACC privatization: 'loop' construct inside 'routine' */ + +/* { dg-additional-options "-fopt-info-omp-note" } */ +/* { dg-additional-options "--param=openacc-privatization=noisy" } for + testing/documenting aspects of that functionality. */ + +/* See also '../../gfortran.dg/goacc/privatization-1-routine_gang-loop.f90'. */ + +/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' + passed to 'incr' may be unset, and in that case, it will be set to [...]", + so to maintain compatibility with earlier Tcl releases, we manually + initialize counter variables: + { dg-line l_dummy[variable c_loop 0] } + { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid + "WARNING: dg-line var l_dummy defined, but not used". */ + +extern int e; +static int s; +int g; + +#pragma acc routine gang +void +f (int i, int j, int a) +{ + extern int ex; + static int st; + int x, y; +#pragma acc loop collapse(2) private(a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_loop[incr c_loop] } */ + for (i = 0; i < 20; ++i) + for (j = 0; j < 25; ++j) + { + __label__ ll; + /* Nested scopes fun. */ + { + struct s_ss { int i; } ss; + { + extern int func (int *, int *, int *); + /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */ + /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */ + + a = func (&i, &j, &a); + } + ss.i = a; + { + extern int func2 (int *, int *, int *, int *, int *, int *, int *); + extern int ext; + static int sta; + a = func2 (&e, &s, &g, &ex, &st, &ext, &sta); + } + } + x = a; +#pragma acc atomic write + y = a; + { + int xx, yy; + xx = a; +#pragma acc atomic write + yy = a; + } + + ll: + ; + } + /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j\.1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'i\.0' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_loop$c_loop } + { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_loop$c_loop } */ + /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */ +} diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c new file mode 100644 index 0000000..f9f316e --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c @@ -0,0 +1,91 @@ +/* OpenACC privatization: 'routine' */ + +/* { dg-additional-options "-fopt-info-omp-note" } */ +/* { dg-additional-options "--param=openacc-privatization=noisy" } for + testing/documenting aspects of that functionality. */ + +/* See also '../../gfortran.dg/goacc/privatization-1-routine_gang.f90'. */ + +/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' + passed to 'incr' may be unset, and in that case, it will be set to [...]", + so to maintain compatibility with earlier Tcl releases, we manually + initialize counter variables: + { dg-line l_dummy[variable c_routine 0] } + { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid + "WARNING: dg-line var l_dummy defined, but not used". */ + +extern int e; +static int s; +int g; +#pragma acc declare device_resident(e, s, g) + +#pragma acc routine gang /* { dg-line l_routine[incr c_routine] } */ +void +f (int i, int j, int a) +{ + extern int ex; + static int st; +#pragma acc declare device_resident(ex /* , st */) + int x, y; + { + __label__ ll; + /* Nested scopes fun. */ + { + struct s_ss { int i; } ss; + { + extern int func (int *, int *, int *); + /* Don't know how to effect a 'CONST_DECL' here. (See Fortran example.) */ + /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'. */ + + a = func (&i, &j, &a); + } + ss.i = a; + { + extern int func2 (int *, int *, int *, int *, int *, int *, int *); + extern int ext; + static int sta; +#pragma acc declare device_resident(ext /* , sta */) + a = func2 (&e, &s, &g, &ex, &st, &ext, &sta); + } + } + x = a; +#pragma acc atomic write + y = a; + { + int xx, yy; + xx = a; +#pragma acc atomic write + yy = a; + } + + ll: + ; + } +} + /* { dg-note {variable 'y' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine } + { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'st' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine } + { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'ex' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine } + { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'g' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine } + { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 's' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine } + { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'e' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine } + { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'a' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'j' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'i' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c xfail *-*-* } l_routine$c_routine } + { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */ + /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine } + { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */ diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-12.c b/gcc/testsuite/c-c++-common/gomp/pr99928-12.c new file mode 100644 index 0000000..be0c5c0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-12.c @@ -0,0 +1,23 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ + +int +foo (void) +{ + int l = 0; + #pragma omp parallel master taskloop simd lastprivate (l) default(none) /* { dg-bogus "'l' not specified in enclosing 'parallel'" } */ + for (int i = 0; i < 16; i++) + l = i; + return l; +} + +int +bar (void) +{ + int l = 0; + #pragma omp parallel master default(none) /* { dg-message "enclosing 'parallel'" } */ + #pragma omp taskloop simd lastprivate (l) /* { dg-error "'l' not specified in enclosing 'parallel'" } */ + for (int i = 0; i < 16; i++) + l = i; + return l; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-13.c b/gcc/testsuite/c-c++-common/gomp/pr99928-13.c new file mode 100644 index 0000000..d5d8d78 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-13.c @@ -0,0 +1,171 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int j00a, j00b, j01a, j01b, j02a, j02b, j03a, j03b; +int j06a, j06b, j07a, j07b, j08a, j08b, j09a, j09b, j10a, j10b; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j00a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j00b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */ + #pragma omp distribute parallel for simd collapse(2) lastprivate (j00a, j00b) + for (j00a = 0; j00a < 64; j00a++) + for (j00b = 0; j00b < 4; j00b++) + ; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */ + #pragma omp distribute simd collapse(2) lastprivate (j01a, j01b) + for (j01a = 0; j01a < 64; j01a++) + for (j01b = 0; j01b < 4; j01b++) + ; +} + +void +bar (void) +{ + int j04a, j04b, j05a, j05b, j11a, j11b, j12a, j12b; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */ + #pragma omp for simd collapse(2) lastprivate (j02a, j02b) + for (j02a = 0; j02a < 64; j02a++) + for (j02b = 0; j02b < 4; j02b++) + ; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03a\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03b\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */ + #pragma omp master taskloop simd collapse(2) lastprivate (j03a, j03b) + for (j03a = 0; j03a < 64; j03a++) + for (j03b = 0; j03b < 4; j03b++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j04a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j04b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } */ + #pragma omp parallel for simd collapse(2) lastprivate (j04a, j04b) + for (j04a = 0; j04a < 64; j04a++) + for (j04b = 0; j04b < 4; j04b++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05a\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05b\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd collapse(2) lastprivate (j05a, j05b) + for (j05a = 0; j05a < 64; j05a++) + for (j05b = 0; j05b < 4; j05b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j06a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j06b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } */ + #pragma omp target parallel for simd collapse(2) lastprivate (j06a, j06b) + for (j06a = 0; j06a < 64; j06a++) + for (j06b = 0; j06b < 4; j06b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07b\\)" "gimple" } } */ + #pragma omp target simd collapse(2) lastprivate (j07a, j07b) + for (j07a = 0; j07a < 64; j07a++) + for (j07b = 0; j07b < 4; j07b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd collapse(2) lastprivate (j08a, j08b) + for (j08a = 0; j08a < 64; j08a++) + for (j08b = 0; j08b < 4; j08b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */ + #pragma omp target teams distribute simd collapse(2) lastprivate (j09a, j09b) + for (j09a = 0; j09a < 64; j09a++) + for (j09b = 0; j09b < 4; j09b++) + ; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10a\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10b\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */ + #pragma omp taskloop simd collapse(2) lastprivate (j10a, j10b) + for (j10a = 0; j10a < 64; j10a++) + for (j10b = 0; j10b < 4; j10b++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j11b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd collapse(2) lastprivate (j11a, j11b) + for (j11a = 0; j11a < 64; j11a++) + for (j11b = 0; j11b < 4; j11b++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */ + #pragma omp teams distribute simd collapse(2) lastprivate (j12a, j12b) + for (j12a = 0; j12a < 64; j12a++) + for (j12b = 0; j12b < 4; j12b++) + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-14.c b/gcc/testsuite/c-c++-common/gomp/pr99928-14.c new file mode 100644 index 0000000..2d9e0be --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-14.c @@ -0,0 +1,171 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int j00a, j00b, j01a, j01b, j02a, j02b, j03a, j03b, j04a, j04b; +int j06a, j06b, j07a, j07b, j08a, j08b, j09a, j09b, j10a, j10b; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00b\\)" "gimple" } } */ + #pragma omp distribute parallel for simd collapse(2) + for (j00a = 0; j00a < 64; j00a++) + for (j00b = 0; j00b < 4; j00b++) + ; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01b\\)" "gimple" } } */ + #pragma omp distribute simd collapse(2) + for (j01a = 0; j01a < 64; j01a++) + for (j01b = 0; j01b < 4; j01b++) + ; +} + +void +bar (void) +{ + int j05a, j05b, j11a, j11b, j12a, j12b; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02b\\)" "gimple" } } */ + #pragma omp for simd collapse(2) + for (j02a = 0; j02a < 64; j02a++) + for (j02b = 0; j02b < 4; j02b++) + ; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03a\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03b\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03b\\)" "gimple" } } */ + #pragma omp master taskloop simd collapse(2) + for (j03a = 0; j03a < 64; j03a++) + for (j03b = 0; j03b < 4; j03b++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j04b\\)" "gimple" } } */ + #pragma omp parallel for simd collapse(2) + for (j04a = 0; j04a < 64; j04a++) + for (j04b = 0; j04b < 4; j04b++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05a\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05b\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j05b\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd collapse(2) + for (j05a = 0; j05a < 64; j05a++) + for (j05b = 0; j05b < 4; j05b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j06b\\)" "gimple" } } */ + #pragma omp target parallel for simd collapse(2) + for (j06a = 0; j06a < 64; j06a++) + for (j06b = 0; j06b < 4; j06b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j07b\\)" "gimple" } } */ + #pragma omp target simd collapse(2) + for (j07a = 0; j07a < 64; j07a++) + for (j07b = 0; j07b < 4; j07b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j08b\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd collapse(2) + for (j08a = 0; j08a < 64; j08a++) + for (j08b = 0; j08b < 4; j08b++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09a" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09b" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j09b\\)" "gimple" } } */ + #pragma omp target teams distribute simd collapse(2) + for (j09a = 0; j09a < 64; j09a++) + for (j09b = 0; j09b < 4; j09b++) + ; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10a\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10b\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j10b\\)" "gimple" } } */ + #pragma omp taskloop simd collapse(2) + for (j10a = 0; j10a < 64; j10a++) + for (j10b = 0; j10b < 4; j10b++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j11b\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd collapse(2) + for (j11a = 0; j11a < 64; j11a++) + for (j11b = 0; j11b < 4; j11b++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12a\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j12b\\)" "gimple" } } */ + #pragma omp teams distribute simd collapse(2) + for (j12a = 0; j12a < 64; j12a++) + for (j12b = 0; j12b < 4; j12b++) + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-15.c b/gcc/testsuite/c-c++-common/gomp/pr99928-15.c new file mode 100644 index 0000000..f0c6232 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-15.c @@ -0,0 +1,26 @@ +/* PR middle-end/99928 */ + +int v; + +void +foo (void) +{ + #pragma omp target parallel firstprivate (v) map(tofrom: v) /* { dg-bogus "'v' appears both in data and map clauses" } */ + v++; +} + +void +bar (void) +{ + #pragma omp target firstprivate (v) map (tofrom: v) /* { dg-error "'v' appears both in data and map clauses" } */ + v++; +} + +void +baz (void) +{ + int j; + #pragma omp target simd firstprivate (v) map (tofrom: v) private (j) /* { dg-error "'v' appears both in data and map clauses" } */ + for (int i = 0; i < 1; i++) + j = v; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-2.c b/gcc/testsuite/c-c++-common/gomp/pr99928-2.c index 313374c..6ba3d46 100644 --- a/gcc/testsuite/c-c++-common/gomp/pr99928-2.c +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-2.c @@ -92,38 +92,38 @@ bar (void) #pragma omp section l10 = 2; } - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l11" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l11\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l11" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l11\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } *//* FIXME. */ #pragma omp target parallel for lastprivate (l11) for (int i = 0; i < 64; i++) l11 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l12" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l12\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l12" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l12\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } *//* FIXME. */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } */ #pragma omp target parallel for simd lastprivate (l12) for (int i = 0; i < 64; i++) l12 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j01" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j01\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j01" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j01\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j01\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } *//* NOTE: This is implementation detail. */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } *//* NOTE: This is implementation detail. */ #pragma omp target parallel loop lastprivate (j01) for (j01 = 0; j01 < 64; j01++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l13" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l13\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l13" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l13\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l13\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l13\\)" "gimple" } } */ #pragma omp target teams distribute lastprivate (l13) for (int i = 0; i < 64; i++) l13 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l14" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l14\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l14" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l14\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l14\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } *//* FIXME: This should be on for instead. */ @@ -131,8 +131,8 @@ bar (void) #pragma omp target teams distribute parallel for lastprivate (l14) for (int i = 0; i < 64; i++) l14 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l15" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l15\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l15" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l15\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l15\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } *//* FIXME: This should be on for instead. */ @@ -141,16 +141,16 @@ bar (void) #pragma omp target teams distribute parallel for simd lastprivate (l15) for (int i = 0; i < 64; i++) l15 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l16" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l16\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l16" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l16\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l16\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l16\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l16\\)" "gimple" } } */ #pragma omp target teams distribute simd lastprivate (l16) for (int i = 0; i < 64; i++) l16 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j02" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j02\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j02" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j02\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j02\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */ @@ -159,8 +159,8 @@ bar (void) #pragma omp target teams loop lastprivate (j02) for (j02 = 0; j02 < 64; j02++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l17" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l17\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l17" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l17\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l17\\)" "gimple" } } */ #pragma omp target simd lastprivate (l17) for (int i = 0; i < 64; i++) diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-3.c b/gcc/testsuite/c-c++-common/gomp/pr99928-3.c index 67f590b..cf9c72d 100644 --- a/gcc/testsuite/c-c++-common/gomp/pr99928-3.c +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-3.c @@ -82,8 +82,8 @@ bar (void) #pragma omp section l07 = 2; } - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l08" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l08\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l08" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME. */ @@ -91,8 +91,8 @@ bar (void) #pragma omp target parallel for firstprivate (l08) lastprivate (l08) for (int i = 0; i < 64; i++) l08 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l09" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l09\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l09" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME. */ @@ -102,8 +102,8 @@ bar (void) #pragma omp target parallel for simd firstprivate (l09) lastprivate (l09) for (int i = 0; i < 64; i++) l09 = i; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l10" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l10\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l10" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l10\\)" "gimple" } } */ /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l10\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } */ #pragma omp target simd firstprivate (l10) lastprivate (l10) diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-4.c b/gcc/testsuite/c-c++-common/gomp/pr99928-4.c index c03afc4..f35e734 100644 --- a/gcc/testsuite/c-c++-common/gomp/pr99928-4.c +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-4.c @@ -44,15 +44,15 @@ bar (void) #pragma omp parallel master taskloop simd linear (l04) for (int i = 0; i < 64; i++) l04++; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l05" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l05\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l05" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l05\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l05\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp for\[^\n\r]*linear\\(l05:1\\)" "gimple" } } */ #pragma omp target parallel for linear (l05) for (int i = 0; i < 64; i++) l05++; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l06" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l06\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l06" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } *//* FIXME. */ @@ -61,8 +61,8 @@ bar (void) #pragma omp target parallel for simd linear (l06) for (int i = 0; i < 64; i++) l06++; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l07" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l07\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l07" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l07:1\\)" "gimple" } } */ #pragma omp target simd linear (l07) for (int i = 0; i < 64; i++) diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-5.c b/gcc/testsuite/c-c++-common/gomp/pr99928-5.c index 6eca9c8..7405188 100644 --- a/gcc/testsuite/c-c++-common/gomp/pr99928-5.c +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-5.c @@ -52,22 +52,22 @@ bar (void) #pragma omp parallel master taskloop simd linear (j05) for (j05 = 0; j05 < 64; j05++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */ #pragma omp target parallel for simd linear (j06) for (j06 = 0; j06 < 64; j06++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */ #pragma omp target simd linear (j07) for (j07 = 0; j07 < 64; j07++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ @@ -76,8 +76,8 @@ bar (void) #pragma omp target teams distribute parallel for simd linear (j08) for (j08 = 0; j08 < 64; j08++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-6.c b/gcc/testsuite/c-c++-common/gomp/pr99928-6.c index 9934047..918a97e 100644 --- a/gcc/testsuite/c-c++-common/gomp/pr99928-6.c +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-6.c @@ -52,22 +52,22 @@ bar (void) #pragma omp parallel master taskloop simd for (j05 = 0; j05 < 64; j05++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */ #pragma omp target parallel for simd for (j06 = 0; j06 < 64; j06++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */ #pragma omp target simd for (j07 = 0; j07 < 64; j07++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ @@ -76,8 +76,8 @@ bar (void) #pragma omp target teams distribute parallel for simd for (j08 = 0; j08 < 64; j08++) ; - /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" { xfail *-*-* } } } */ - /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/spellcheck-reserved.c b/gcc/testsuite/c-c++-common/spellcheck-reserved.c index ed292f2..56e59dc 100644 --- a/gcc/testsuite/c-c++-common/spellcheck-reserved.c +++ b/gcc/testsuite/c-c++-common/spellcheck-reserved.c @@ -50,3 +50,21 @@ const char * test_3 (void) /* { dg-error "did you mean '__FILE__'" "" { target c } misspelled__FILE_ } */ /* { dg-error "'__FILE_' was not declared in this scope; did you mean '__FILE__'\\?" "" { target c++ } misspelled__FILE_ } */ } + +/* Verify that we can correct "__FILE_NAME_" to "__FILE_NAME__". */ + +const char * test_4 (void) +{ + return __FILE_NAME_; /* { dg-line misspelled__FILE_NAME_ } */ + /* { dg-error "did you mean '__FILE_NAME__'" "" { target c } misspelled__FILE_NAME_ } */ + /* { dg-error "'__FILE_NAME_' was not declared in this scope; did you mean '__FILE_NAME__'\\?" "" { target c++ } misspelled__FILE_NAME_ } */ +} + +/* Verify that we can correct "__FILENAME__" to "__FILE_NAME__". */ + +const char * test_5 (void) +{ + return __FILENAME__; /* { dg-line misspelled__FILENAME__ } */ + /* { dg-error "did you mean '__FILE_NAME__'" "" { target c } misspelled__FILENAME__ } */ + /* { dg-error "'__FILENAME__' was not declared in this scope; did you mean '__FILE_NAME__'\\?" "" { target c++ } misspelled__FILENAME__ } */ +} diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C new file mode 100644 index 0000000..d1af8d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C @@ -0,0 +1,6 @@ +// PR c++/100372 +// { dg-do compile { target c++14 } } + +template <bool> using enable_if_t = int; +template <class> bool has_P_match_v; +template <template <class> class... List> enable_if_t<has_P_match_v<List...>> a; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C new file mode 100644 index 0000000..bc488ff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C @@ -0,0 +1,16 @@ +// PR c++/100205 +// { dg-do compile { target c++11 } } + +struct coordinate_matrix { + using index_t = unsigned; + struct convert_to_matrix_coordinate { + index_t column_id; + }; + index_t column_id; + + // does not work + using value_type2 = decltype(convert_to_matrix_coordinate{column_id}); + + // does work + using value_type5 = decltype(column_id); +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/friend7.C b/gcc/testsuite/g++.dg/cpp0x/friend7.C index 734b367..e1d5f44 100644 --- a/gcc/testsuite/g++.dg/cpp0x/friend7.C +++ b/gcc/testsuite/g++.dg/cpp0x/friend7.C @@ -6,21 +6,21 @@ template<typename T1, typename T2> void foo (T1, T2); struct S { - [[deprecated]] friend void f(); // { dg-error "attribute appertains" } + [[deprecated]] friend void f(); // { dg-warning "attribute ignored" } [[deprecated]] friend void f2() { } - __attribute__((deprecated)) friend void f3(); // { dg-error "attribute appertains" } - friend void f3 [[deprecated]] (); // { dg-error "attribute appertains" } + __attribute__((deprecated)) friend void f3(); + friend void f3 [[deprecated]] (); // { dg-warning "attribute ignored" } friend void f4 [[deprecated]] () { } - [[deprecated]] friend void; // { dg-error "attribute appertains" } - __attribute__((deprecated)) friend int; // { dg-error "attribute appertains" } - friend __attribute__((deprecated)) int; // { dg-error "attribute appertains" } - friend int __attribute__((deprecated)); // { dg-error "attribute appertains" } - [[deprecated]] friend X; // { dg-error "attribute appertains" } + [[deprecated]] friend void; // { dg-warning "attribute ignored" } + __attribute__((deprecated)) friend int; + friend __attribute__((deprecated)) int; + friend int __attribute__((deprecated)); + [[deprecated]] friend X; // { dg-warning "attribute ignored" } [[deprecated]] friend class N; // { dg-warning "attribute ignored" } - friend class [[deprecated]] N2; // { dg-error "attribute appertains" } - friend class __attribute__((deprecated)) N3; // { dg-error "attribute appertains" } - [[deprecated]] friend void foo<>(int, int); // { dg-error "attribute appertains" } - [[deprecated]] friend void ::foo(int, int); // { dg-error "attribute appertains" } + friend class [[deprecated]] N2; // { dg-warning "attribute ignored" } + friend class __attribute__((deprecated)) N3; + [[deprecated]] friend void foo<>(int, int); // { dg-warning "attribute ignored" } + [[deprecated]] friend void ::foo(int, int); // { dg-warning "attribute ignored" } // { dg-bogus "should have" "PR100339" { xfail *-*-* } .-1 } }; @@ -29,12 +29,12 @@ class node { }; template<typename T> struct A { - [[deprecated]] friend T; // { dg-error "attribute appertains" } + [[deprecated]] friend T; // { dg-warning "attribute ignored" } [[deprecated]] friend class node<T>; // { dg-warning "attribute ignored" } template<typename> [[deprecated]] friend class A; // { dg-warning "attribute ignored" } template<typename> [[deprecated]] friend void bar () { } template<typename> - [[deprecated]] friend void baz (); // { dg-error "attribute appertains" } + [[deprecated]] friend void baz (); // { dg-warning "attribute ignored" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/friend8.C b/gcc/testsuite/g++.dg/cpp0x/friend8.C new file mode 100644 index 0000000..8d2a2d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/friend8.C @@ -0,0 +1,15 @@ +// PR c++/100596 +// { dg-do compile { target c++11 } } + +struct A +{ + __attribute((deprecated)) friend void f(A); // part of A API, definition in .C + [[deprecated]] friend void f2(A); // { dg-warning "ignored" } +}; + +int main() +{ + A a; + f(a); // { dg-warning "is deprecated" } + f2(a); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C new file mode 100644 index 0000000..6dcced4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C @@ -0,0 +1,20 @@ +// PR c++/100644 +// { dg-do compile { target c++11 } } + +struct NonMovable { + NonMovable(NonMovable&&) = delete; +}; + +template <class T> +struct Maybe { + NonMovable mMember; + + template <typename U> + Maybe(Maybe<U>&&); +}; + +void foo(Maybe<int>); + +void unlucky(Maybe<int>&& x) { + Maybe<int> var{(Maybe<int>&&)x}; +} diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction-access1.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access1.C new file mode 100644 index 0000000..2424abb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access1.C @@ -0,0 +1,18 @@ +// { dg-do compile { target c++17 } } + +template<typename T> +struct Base +{ +protected: + using type = T; +}; + +template<typename T> +struct Cont : Base<T> +{ + using argument_type = typename Base<T>::type; + + Cont(T, argument_type) { } +}; + +Cont c(1, 1); diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction-access2.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access2.C new file mode 100644 index 0000000..87f2031 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction-access2.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++17 } } + +struct B { +protected: + struct type {}; +}; +template<typename T> struct D : B { + D(T, typename T::type); +}; +D c = {B(), {}}; diff --git a/gcc/testsuite/g++.dg/cpp2a/desig18.C b/gcc/testsuite/g++.dg/cpp2a/desig18.C new file mode 100644 index 0000000..4851579 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/desig18.C @@ -0,0 +1,17 @@ +// PR c++/100489 +// { dg-options "" } + +union U +{ + union + { + unsigned char a; + }; + + unsigned char b[1]; +}; + +void f(unsigned char a) +{ + union U u = { .a = a }; +} diff --git a/gcc/testsuite/g++.dg/cpp2a/desig19.C b/gcc/testsuite/g++.dg/cpp2a/desig19.C new file mode 100644 index 0000000..3321da8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/desig19.C @@ -0,0 +1,33 @@ +// { dg-do compile { target c++11 } } +// { dg-options "" } + +struct A +{ + int i; + constexpr operator int() { return 42; } +}; + +#define SA(X) static_assert ((X),#X) +constexpr A a1 { A() }; +SA(a1.i == 0); +constexpr A a2 { i: A() }; +SA(a2.i == 42); +#if __cpp_constexpr >= 201304L +constexpr int f3 () { A const &r { A() }; return r.i; } +SA(f3() == 0); +constexpr int f4 () { A const &r { i: A() }; return r.i; } +SA(f4() == 42); +constexpr int f5 () { A ar[1]{{ A() }}; return ar[0].i; } +SA(f5() == 0); +constexpr int f5a () { A ar[1]{{ i: A() }}; return ar[0].i; } +SA(f5a() == 42); +#if __cpp_constexpr >= 201907L +constexpr int f6 () { A* p = new A{A()}; int i = p->i; delete p; return i; } +SA(f6() == 0); +constexpr int f6a () { A* p = new A{i:A()}; int i = p->i; delete p; return i; } +SA(f6a() == 42); +#endif +#endif +constexpr int f7 (A a) { return a.i; } +SA(f7({A()}) == 0); +SA(f7({i:A()}) == 42); diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-complex1.C b/gcc/testsuite/g++.dg/cpp2a/nontype-complex1.C new file mode 100644 index 0000000..4de2168 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-complex1.C @@ -0,0 +1,8 @@ +// PR c++/100634 +// { dg-do compile { target c++20 } } +// { dg-options "" } + +// We could support _Complex template arguments, but better I think to make +// people use a standard type instead. +template<_Complex int> struct ComplexInt {}; // { dg-error "not a valid type" } +using CI = ComplexInt<1 + 3i>; diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-fallback1.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-fallback1.C new file mode 100644 index 0000000..5ce4949 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-fallback1.C @@ -0,0 +1,17 @@ +// PR c++/100367 +// { dg-do compile { target c++20 } } + +#include <compare> + +struct iter { + bool current; + iter(iter &); +}; + +constexpr bool operator==(const iter &, const iter &y) { + return y.current; +} + +void lexicographical_compare_three_way(iter a) { + (a == a) <=> true; +} diff --git a/gcc/testsuite/g++.dg/dfp/mangle-6.C b/gcc/testsuite/g++.dg/dfp/mangle-6.C new file mode 100644 index 0000000..9cfb2a9 --- /dev/null +++ b/gcc/testsuite/g++.dg/dfp/mangle-6.C @@ -0,0 +1,19 @@ +// PR c++/100261 +// { dg-do compile } + +#include <typeinfo> + +namespace std { + namespace decimal { + class decimal32 { + float private__decfloat32; + }; + } +} + +void +foo () +{ + typeid (float); + typeid (std::decimal::decimal32); +} diff --git a/gcc/testsuite/g++.dg/ext/attrib63.C b/gcc/testsuite/g++.dg/ext/attrib63.C index 93bde1e..583779a9 100644 --- a/gcc/testsuite/g++.dg/ext/attrib63.C +++ b/gcc/testsuite/g++.dg/ext/attrib63.C @@ -4,9 +4,9 @@ #define vector __attribute__((vector_size(16))) class A { friend vector float f(); - __attribute__((deprecated)) friend void f2(); // { dg-error "attribute appertains" } - friend __attribute__((deprecated, vector_size(16))) float f3(); // { dg-error "attribute appertains" } - friend __attribute__((vector_size(16), deprecated)) float f4(); // { dg-error "attribute appertains" } + __attribute__((deprecated)) friend void f2(); + friend __attribute__((deprecated, vector_size(16))) float f3(); + friend __attribute__((vector_size(16), deprecated)) float f4(); }; vector float vf; @@ -15,3 +15,20 @@ f () { return vf; } + +void +f2 () +{ +} + +vector float +f3 () +{ + return vf; +} + +vector float +f4 () +{ + return vf; +} diff --git a/gcc/testsuite/g++.dg/lto/odr-1_0.C b/gcc/testsuite/g++.dg/lto/odr-1_0.C index 6fff888..318a047 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_0.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_0.C @@ -1,8 +1,10 @@ // PR c++/82414 // { dg-lto-do link } enum vals {aa,cc}; // { dg-lto-warning "6: type 'vals' violates the C\\+\\+ One Definition Rule" } +// { dg-lto-note "name 'cc' differs from name 'bb' defined in another translation unit" "" { target *-*-* } .-1 } struct a { // { dg-lto-warning "8: type 'struct a' violates the C\\+\\+ One Definition Rule" } - struct b *ptr; // { dg-lto-message "13: the first difference of corresponding definitions is field 'ptr'" } + struct b *ptr; // { dg-lto-note "13: the first difference of corresponding definitions is field 'ptr'" } + // { dg-lto-note "the incompatible type defined in another translation unit" "" { target *-*-* } .-1 } enum vals vals; }; void test(struct a *a) diff --git a/gcc/testsuite/g++.dg/lto/odr-1_1.C b/gcc/testsuite/g++.dg/lto/odr-1_1.C index 494436a..a57bb38 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_1.C @@ -1,9 +1,10 @@ namespace { - struct b; // { dg-lto-message "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" } + struct b; // { dg-lto-note "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" } } -enum vals {aa,bb,cc}; // { dg-lto-message "an enum with different value name is defined in another translation unit" } -struct a { // { dg-lto-message "a different type is defined in another translation unit" } - struct b *ptr; // { dg-lto-message "a field of same name but different type is defined in another translation unit" } +enum vals {aa,bb,cc}; // { dg-lto-note "an enum with different value name is defined in another translation unit" } +// { dg-lto-note "mismatching definition" "" { target *-*-* } .-1 } +struct a { // { dg-lto-note "a different type is defined in another translation unit" } + struct b *ptr; // { dg-lto-note "a field of same name but different type is defined in another translation unit" } enum vals vals; } a; void test(struct a *); diff --git a/gcc/testsuite/g++.dg/lto/odr-2_1.C b/gcc/testsuite/g++.dg/lto/odr-2_1.C index f384ae8..23cfccc 100644 --- a/gcc/testsuite/g++.dg/lto/odr-2_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-2_1.C @@ -1,4 +1,4 @@ -class a { // { dg-lto-message "a different type is defined in another translation unit" } +class a { // { dg-lto-note "a different type is defined in another translation unit" } int *b() const; }; int *a::b() const { return 0; } diff --git a/gcc/testsuite/g++.dg/modules/omp-1_a.C b/gcc/testsuite/g++.dg/modules/omp-1_a.C index 722720a..94e1171 100644 --- a/gcc/testsuite/g++.dg/modules/omp-1_a.C +++ b/gcc/testsuite/g++.dg/modules/omp-1_a.C @@ -1,4 +1,5 @@ // { dg-additional-options "-fmodules-ts -fopenmp" } +// { dg-require-effective-target pthread } export module foo; // { dg-module-cmi foo } diff --git a/gcc/testsuite/g++.dg/modules/omp-1_b.C b/gcc/testsuite/g++.dg/modules/omp-1_b.C index f3f5d92..09d97e4a 100644 --- a/gcc/testsuite/g++.dg/modules/omp-1_b.C +++ b/gcc/testsuite/g++.dg/modules/omp-1_b.C @@ -1,4 +1,5 @@ // { dg-additional-options "-fmodules-ts -fopenmp" } +// { dg-require-effective-target pthread } import foo; diff --git a/gcc/testsuite/g++.dg/modules/omp-1_c.C b/gcc/testsuite/g++.dg/modules/omp-1_c.C index f30f611..71a24f6 100644 --- a/gcc/testsuite/g++.dg/modules/omp-1_c.C +++ b/gcc/testsuite/g++.dg/modules/omp-1_c.C @@ -1,8 +1,9 @@ // { dg-additional-options "-fmodules-ts" } +// { dg-require-effective-target pthread } import foo; -// { dg-regexp "In module imported at \[^\n]*omp-1_c.C:3:1:\nfoo: error: module contains OpenMP, use '-fopenmp' to enable\n" } +// { dg-regexp "In module imported at \[^\n]*omp-1_c.C:4:1:\nfoo: error: module contains OpenMP, use '-fopenmp' to enable\n" } // { dg-prune-output "failed to read" } // { dg-prune-output "fatal error:" } // { dg-prune-output "compilation terminated" } diff --git a/gcc/testsuite/g++.dg/modules/omp-2_a.C b/gcc/testsuite/g++.dg/modules/omp-2_a.C index d2291b6..b0d4bbc 100644 --- a/gcc/testsuite/g++.dg/modules/omp-2_a.C +++ b/gcc/testsuite/g++.dg/modules/omp-2_a.C @@ -1,4 +1,5 @@ // { dg-additional-options "-fmodules-ts -fopenmp" } +// { dg-require-effective-target pthread } export module foo; // { dg-module-cmi foo } diff --git a/gcc/testsuite/g++.dg/modules/omp-2_b.C b/gcc/testsuite/g++.dg/modules/omp-2_b.C index 39f34c7..aeee4d1 100644 --- a/gcc/testsuite/g++.dg/modules/omp-2_b.C +++ b/gcc/testsuite/g++.dg/modules/omp-2_b.C @@ -1,4 +1,5 @@ // { dg-additional-options "-fmodules-ts" } +// { dg-require-effective-target pthread } import foo; diff --git a/gcc/testsuite/g++.dg/parse/access13.C b/gcc/testsuite/g++.dg/parse/access13.C new file mode 100644 index 0000000..41463c5 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/access13.C @@ -0,0 +1,7 @@ +// PR c++/100659 + +template <typename> struct A +{ + A::E::V; // { dg-warning "access decl" } + enum { V }; // { dg-error "conflicts with a previous decl" } +}; diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull13.C b/gcc/testsuite/g++.dg/warn/Wnonnull13.C new file mode 100644 index 0000000..e327976 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wnonnull13.C @@ -0,0 +1,28 @@ +/* PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda + { dg-do compile { target c++11 } } + { dg-options "-O0 -Wall -fsanitize=undefined" } */ + +#define NONNULL __attribute__ ((nonnull)) + +typedef int F (const char *); + +NONNULL int f (const char *); + +int nowarn_O0 () +{ + return static_cast<F*>([](const char *s){ return f (s); })("O0"); + // { dg-bogus "\\\[-Wnonnull" "" { target *-*-* } .-1 } +} + +int warn_O0 () +{ + return static_cast<F*>([] NONNULL (const char *){ return 0; })(0); + // { dg-warning "\\\[-Wnonnull" "" { target *-*-* } .-1 } +} + +int warn_O0_inline () +{ + return static_cast<F*>([](const char *s){ return f (s); })(0); + // { dg-warning "\\\[-Wnonnull" "lambda not inlined" { xfail *-*-* } .-1 } +} + diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull14.C b/gcc/testsuite/g++.dg/warn/Wnonnull14.C new file mode 100644 index 0000000..16d7ec3 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wnonnull14.C @@ -0,0 +1,28 @@ +/* PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda + { dg-do compile { target c++11 } } + { dg-options "-Og -Wall -fsanitize=undefined" } */ + +#define NONNULL __attribute__ ((nonnull)) + +typedef int F (const char *); + +__attribute__ ((nonnull)) int f (const char *); + +int nowarn_Og () +{ + return static_cast<F*>([](const char *s){ return f (s); })("Og"); + // { dg-bogus "'this' pointer is null" "" { target *-*-* } .-1 } +} + +int warn_Og () +{ + return static_cast<F*>([] NONNULL (const char *){ return 0; })(0); + // { dg-warning "\\\[-Wnonnull" "" { target *-*-* } .-1 } +} + +int warn_Og_inline () +{ + const char *p = 0; + return static_cast<F*>([](const char *s){ return f (s); })(p); + // { dg-warning "\\\[-Wnonnull" "lambda not inlined" { xfail *-*-* } .-1 } +} diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull15.C b/gcc/testsuite/g++.dg/warn/Wnonnull15.C new file mode 100644 index 0000000..36a2ab4 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wnonnull15.C @@ -0,0 +1,28 @@ +/* PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda + { dg-do compile { target c++11 } } + { dg-options "-O1 -Wall -fsanitize=undefined" } */ + +#define NONNULL __attribute__ ((nonnull)) + +typedef int F (const char *); + +NONNULL int f (const char *); + +int nowarn_O1 () +{ + return static_cast<F*>([](const char *s){ return f (s); })("O1"); + // { dg-bogus "\\\[-Wnonnull" "" { target *-*-* } .-1 } +} + +int warn_O1 () +{ + return static_cast<F*>([] NONNULL (const char *){ return 0; })(0); + // { dg-warning "\\\[-Wnonnull" "" { target *-*-* } .-1 } +} + +int warn_O1_inline () +{ + const char *p = 0; + return static_cast<F*>([](const char *s){ return f (s); })(p); + // { dg-warning "\\\[-Wnonnull" "lambda not inlined" { xfail *-*-* } .-1 } +} diff --git a/gcc/testsuite/g++.target/i386/pr100637-1b.C b/gcc/testsuite/g++.target/i386/pr100637-1b.C new file mode 100644 index 0000000..35b5df7 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr100637-1b.C @@ -0,0 +1,17 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef unsigned char __attribute__((__vector_size__ (4))) __v4qu; +typedef char __attribute__((__vector_size__ (4))) __v4qi; + +__v4qu au, bu; +__v4qi as, bs; + +__v4qu uu (__v4qu a, __v4qu b) { return (a > b) ? au : bu; } +__v4qu us (__v4qi a, __v4qi b) { return (a > b) ? au : bu; } +__v4qi su (__v4qu a, __v4qu b) { return (a > b) ? as : bs; } +__v4qi ss (__v4qi a, __v4qi b) { return (a > b) ? as : bs; } + +/* { dg-final { scan-assembler-times "pcmpeqb" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpgtb" 2 } } */ diff --git a/gcc/testsuite/g++.target/i386/pr100637-1w.C b/gcc/testsuite/g++.target/i386/pr100637-1w.C new file mode 100644 index 0000000..a3ed06f --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr100637-1w.C @@ -0,0 +1,17 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef unsigned short __attribute__((__vector_size__ (4))) __v2hu; +typedef short __attribute__((__vector_size__ (4))) __v2hi; + +__v2hu au, bu; +__v2hi as, bs; + +__v2hu uu (__v2hu a, __v2hu b) { return (a > b) ? au : bu; } +__v2hu us (__v2hi a, __v2hi b) { return (a > b) ? au : bu; } +__v2hi su (__v2hu a, __v2hu b) { return (a > b) ? as : bs; } +__v2hi ss (__v2hi a, __v2hi b) { return (a > b) ? as : bs; } + +/* { dg-final { scan-assembler-times "pcmpeqw" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpgtw" 2 } } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100576.c b/gcc/testsuite/gcc.c-torture/compile/pr100576.c new file mode 100644 index 0000000..f2f40ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr100576.c @@ -0,0 +1,12 @@ +/* PR middle-end/100576 */ + +const char v[] = {0x12}; + +void +foo (const char *p) +{ + int b = sizeof v; + int n = memcmp (p, v, b); + if (n) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/ssa-unused-1.c b/gcc/testsuite/gcc.c-torture/compile/ssa-unused-1.c new file mode 100644 index 0000000..e8fb93c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/ssa-unused-1.c @@ -0,0 +1,15 @@ +/* This is just to exercise the '__OPTIMIZE__' DejaGnu selector. */ + +/* { dg-do "assemble" } */ +/* { dg-additional-options "-fdump-tree-ssa" } */ + +void f() +{ + int unused = 3; + (void) &unused; +} + +/* { dg-final { scan-tree-dump-not {No longer having address taken: unused} ssa { target { ! __OPTIMIZE__ } } } } + { dg-final { scan-tree-dump-times {No longer having address taken: unused} 1 ssa { target __OPTIMIZE__ } } } */ +/* { dg-final { scan-tree-dump-not {Now a gimple register: unused} ssa { target { ! __OPTIMIZE__ } } } } + { dg-final { scan-tree-dump-times {Now a gimple register: unused} 1 ssa { target __OPTIMIZE__ } } } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/pr100615.c b/gcc/testsuite/gcc.dg/analyzer/pr100615.c new file mode 100644 index 0000000..7a06f98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr100615.c @@ -0,0 +1,53 @@ +/* Adapted from + https://github.com/stackpath/rxtxcpu/blob/816d86c5d49c4db2ea5649f6b87e96da5af660f1/cpu.c + which is MIT-licensed. */ + +typedef __SIZE_TYPE__ size_t; +#define NULL ((void *)0) + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__pure__)) + __attribute__ ((__nonnull__ (1))); +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__malloc__)) + __attribute__ ((__nonnull__ (1))); +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__nonnull__ (1, 2))); +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__nonnull__ (1))); +extern void free (void *__ptr) + __attribute__ ((__nothrow__ , __leaf__)); + +#define CPU_LIST_BASE 10 + +int parse_cpu_list(char *cpu_list) { + if (strlen(cpu_list) == 0) { + return 0; + } + + char *endptr; + char *tofree, *string, *range; + + tofree = string = strdup(cpu_list); /* { dg-message "allocated here" } */ + + while ((range = strsep(&string, ",")) != NULL) { + int first = strtol(range, &endptr, CPU_LIST_BASE); + if (!*endptr) { + continue; + } + char *save = endptr; + endptr++; + int last = strtol(endptr, &endptr, CPU_LIST_BASE); + if (save[0] != '-' || *endptr || last < first) { + return -1; /* { dg-warning "leak of 'tofree'" } */ + } + } + free(tofree); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/cpp/pr100646-1.c b/gcc/testsuite/gcc.dg/cpp/pr100646-1.c new file mode 100644 index 0000000..8f2caf4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr100646-1.c @@ -0,0 +1,5 @@ +/* PR preprocessor/100646 */ +/* { dg-do compile } */ +/* { dg-options "-fdirectives-only -save-temps -std=c17" } */ +int main () { return 0; } +// Not newline terminated
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/cpp/pr100646-2.c b/gcc/testsuite/gcc.dg/cpp/pr100646-2.c new file mode 100644 index 0000000..a1deba1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr100646-2.c @@ -0,0 +1,6 @@ +/* PR preprocessor/100646 */ +/* { dg-do compile } */ +/* { dg-options "-fdirectives-only -save-temps -std=c17" } */ +int main () { return 0; } +/* { dg-warning "backslash-newline at end of file" "" { target *-*-* } .+1 } */ +// Not newline terminated\
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/gimplefe-45.c b/gcc/testsuite/gcc.dg/gimplefe-45.c new file mode 100644 index 0000000..b1d3cbb --- /dev/null +++ b/gcc/testsuite/gcc.dg/gimplefe-45.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fgimple" } */ + +/* This used to ICE when simplifying (A & C) != 0 ? D : 0 + for pointer types. */ + +int *__GIMPLE () +p (int n) +{ + int *_2; + int *_t; + int *_t1; + _t = (int*)8; + _t1 = 0; + n = n & 2; + _2 = n != 0 ? _t : _t1; + return _2; +} + diff --git a/gcc/testsuite/gcc.dg/local1.c b/gcc/testsuite/gcc.dg/local1.c index e9f653b..448c71b 100644 --- a/gcc/testsuite/gcc.dg/local1.c +++ b/gcc/testsuite/gcc.dg/local1.c @@ -10,7 +10,7 @@ the later daclaration is the same as the linkage specified at the prior declaration. If no prior declaration is visible, or if the prior declaration specifies no linkage, then the - identifer has external linkage. + identifier has external linkage. This is PR 14366. */ diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.c b/gcc/testsuite/gcc.dg/pch/valid-1.c index d445c47..6e9abda 100644 --- a/gcc/testsuite/gcc.dg/pch/valid-1.c +++ b/gcc/testsuite/gcc.dg/pch/valid-1.c @@ -1,7 +1,7 @@ /* { dg-require-effective-target pch_supported_debug } */ /* { dg-options "-I. -Winvalid-pch -g" } */ -#include "valid-1.h"/* { dg-warning "created with -gnone, but used with -g" } */ +#include "valid-1.h"/* { dg-warning "created with .none. debug info, but used with" } */ /* { dg-error "No such file" "no such file" { target *-*-* } 0 } */ /* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/pr100619.c b/gcc/testsuite/gcc.dg/pr100619.c new file mode 100644 index 0000000..5df02bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100619.c @@ -0,0 +1,24 @@ +/* PR c/100619 - ICE on a VLA parameter with too many dimensions + { dg-do compile } + { dg-options "-Wall" } */ + +extern int n; + +#define A10 [n][n][n][n][n][n][n][n][n][n] +#define A100 A10 A10 A10 A10 A10 A10 A10 A10 A10 A10 A10 +#define A1000 A100 A100 A100 A100 A100 A100 A100 A100 A100 A100 A100 + +void f10 (int A10); +void f10 (int A10); + +void f100 (int A100); +void f100 (int A100); + +void f1000 (int A1000); +void f1000 (int A1000); + +void fx_1000 (int [ ]A1000); +void fx_1000 (int [1]A1000); // { dg-warning "-Warray-parameter" } + +void fn_1000 (int [n ]A1000); +void fn_1000 (int [n + 1]A1000); // { dg-warning "-Wvla-parameter" } diff --git a/gcc/testsuite/gcc.dg/torture/pr100672.c b/gcc/testsuite/gcc.dg/torture/pr100672.c new file mode 100644 index 0000000..cc62e71 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100672.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-additional-options "-w -Wno-psabi" } */ + +typedef long long __attribute__((__vector_size__ (4 * sizeof (long long)))) V; + +V +foo (V v) +{ + return -(v >> 1); +} + +int +main (void) +{ + V v = foo ((V) { -2, -4, -6, -8 }); + if (v[0] != 1 || v[1] != 2 || v[2] != 3 || v[3] != 4) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c index 4c190e6..3681fa7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c @@ -7,4 +7,4 @@ int eqm1_phi (unsigned long a) { return a ? 0 : -1; } int spaceship1 (long a) { return a > 0 ? 1 : a < 0 ? -1 : 0; } int spaceship2 (long a) { return a > 0 ? 1 : a == 0 ? 0 : -1; } -/* { dg-final { scan-tree-dump-times " = -\[^\r\n\]*_.;" 4 "optimized"} } */ +/* { dg-final { scan-tree-dump-times " = -\[^\r\n\]*_\[0-9\]*;" 4 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c index 18ecbd5..51e1f6d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c @@ -18,5 +18,5 @@ int f(int t, int c) /* There should be one ifs as one of them should be changed into a conditional and the other should be there still. */ /* { dg-final { scan-tree-dump-times "if" 1 "optimized" } }*/ -/* { dg-final { scan-tree-dump-times "\[^\r\n\]*_. = c_\[0-9\]*.D. != 0" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\[^\r\n\]*_\[0-9\]* = c_\[0-9\]*.D. != 0" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c index 411585a..57b5016 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c @@ -7,4 +7,4 @@ foo (int a, int b, int c) return c ? x : a; } /* We should sink the x = a * b calculation into the branch that returns x. */ -/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c index 37e4d2f..535cb32 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c @@ -16,4 +16,4 @@ void foo (void) } } -/* { dg-final { scan-tree-dump-times "Sinking # VUSE" 4 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sinking # VUSE" 4 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c index a65ba35..584fd91 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-13.c @@ -21,5 +21,5 @@ void test () /* We should sink/merge all stores and end up with a single BB. */ -/* { dg-final { scan-tree-dump-times "MEM\[^\n\r\]* = 0;" 3 "sink" } } */ -/* { dg-final { scan-tree-dump-times "<bb " 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "MEM\[^\n\r\]* = 0;" 3 "sink1" } } */ +/* { dg-final { scan-tree-dump-times "<bb " 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c index 771cd44..f5418b0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-14.c @@ -13,5 +13,5 @@ void foo (int b) /* We should have sunk the store and inserted a PHI to merge the stored values. */ -/* { dg-final { scan-tree-dump-times " = PHI" 1 "sink" } } */ -/* { dg-final { scan-tree-dump-times "x = " 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times " = PHI" 1 "sink1" } } */ +/* { dg-final { scan-tree-dump-times "x = " 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c index 610c8d6..012b165 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c @@ -10,5 +10,5 @@ int f(int n) return j; } -/* { dg-final { scan-tree-dump "Sinking j_. = __builtin_ffs" "sink" } } */ +/* { dg-final { scan-tree-dump "Sinking j_. = __builtin_ffs" "sink1" } } */ /* { dg-final { scan-tree-dump "return 2;" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c index cf2e2a0..d0aeeb3 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c @@ -12,4 +12,4 @@ int my_f(int a, int b) } /* We should sink the call to pure_f to the if block. */ -/* { dg-final { scan-tree-dump "Sinking # VUSE" "sink" } } */ +/* { dg-final { scan-tree-dump "Sinking # VUSE" "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c new file mode 100644 index 0000000..421c78e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-18.c @@ -0,0 +1,212 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-sink-stats" } */ + +#include <stdint.h> + +#define HLOG 16 +#define MAX_LIT (1 << 5) +typedef const uint8_t *LZF_HSLOT; +typedef LZF_HSLOT LZF_STATE[1 << (HLOG)]; + +int +compute_on_bytes (uint8_t *in_data, int in_len, uint8_t *out_data, int out_len) +{ + LZF_STATE htab; + + uint8_t *ip = in_data; + uint8_t *op = out_data; + uint8_t *in_end = ip + in_len; + uint8_t *out_end = op + out_len; + uint8_t *ref; + + unsigned long off; + unsigned int hval; + int lit; + + if (!in_len || !out_len) + return 0; + + lit = 0; + op++; + hval = (((ip[0]) << 8) | ip[1]); + + while (ip < in_end - 2) + { + uint8_t *hslot; + + hval = (((hval) << 8) | ip[2]); + hslot = (uint8_t*)(htab + (((hval >> (3 * 8 - 16)) - hval * 5) & ((1 << (16)) - 1))); + + ref = *hslot + in_data; + *hslot = ip - in_data; + + if (1 && (off = ip - ref - 1) < (1 << 13) && ref > in_data + && ref[2] == ip[2] + && ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0])) + { + unsigned int len = 2; + unsigned int maxlen = in_end - ip - len; + maxlen + = maxlen > ((1 << 8) + (1 << 3)) ? ((1 << 8) + (1 << 3)) : maxlen; + + if ((op + 3 + 1 >= out_end) != 0) + if (op - !lit + 3 + 1 >= out_end) + return 0; + + op[-lit - 1] = lit - 1; + op -= !lit; + + for (;;) + { + if (maxlen > 16) + { + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + len++; + if (ref[len] != ip[len]) + break; + } + + do + { + len++; + } + while (len < maxlen && ip[len] == ref[len]); + + break; + } + + len -= 2; + ip++; + + if (len < 7) + { + *op++ = (off >> 8) + (len << 5); + } + else + { + *op++ = (off >> 8) + (7 << 5); + *op++ = len - 7; + } + *op++ = off; + lit = 0; + op++; + ip += len + 1; + + if (ip >= in_end - 2) + break; + + --ip; + --ip; + + hval = (((ip[0]) << 8) | ip[1]); + hval = (((hval) << 8) | ip[2]); + htab[(((hval >> (3 * 8 - 16)) - hval * 5) & ((1 << (16)) - 1))] + = (LZF_HSLOT)(ip - in_data); + ip++; + + hval = (((hval) << 8) | ip[2]); + htab[(((hval >> (3 * 8 - 16)) - hval * 5) & ((1 << (16)) - 1))] + = (LZF_HSLOT)(ip - in_data); + ip++; + } + else + { + if (op >= out_end) + return 0; + + lit++; + *op++ = *ip++; + + if (lit == (1 << 5)) + { + op[-lit - 1] = lit - 1; + lit = 0; + op++; + } + } + } + if (op + 3 > out_end) /* at most 3 bytes can be missing here */ + return 0; + + while (ip < in_end) + { + lit++; + *op++ = *ip++; + if (lit == MAX_LIT) + { + op[-lit - 1] = lit - 1; /* stop run */ + lit = 0; + op++; /* start run */ + } + } + + op[-lit - 1] = lit - 1; /* end run */ + op -= !lit; /* undo run if length is zero */ + + return op - out_data; + } + + /* For this case, pass sink2 sinks statements from hot loop header to loop + exits after gimple loop optimizations, which generates instructions executed + each iteration in loop, but the results are used outside of loop: + With -m64, + "Sinking _367 = (uint8_t *) _320; + from bb 31 to bb 90 + Sinking _320 = _321 + ivtmp.25_326; + from bb 31 to bb 90 + Sinking _321 = (unsigned long) ip_229; + from bb 31 to bb 90 + Sinking len_158 = _322 + 4294967295; + from bb 31 to bb 33" + When -m32, Power and X86 will sink 3 instructions, but arm ilp32 couldn't + sink due to ivopts chooses two IV candidates instead of one, which is + expected, so this case is restricted to lp64 only so far. */ + + /* { dg-final { scan-tree-dump-times "Sunk statements: 4" 1 "sink2" { target lp64 } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c index 6aa5a18..a0b4734 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c @@ -9,4 +9,4 @@ bar (int a, int b, int c) return y; } /* We should sink the x = a * b calculation into the else branch */ -/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c index 599997e..ad88ccc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c @@ -12,4 +12,4 @@ main (int argc) } } /* We should sink the a = argc + 1 calculation into the if branch */ -/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c index 784edd2..1e3cfa9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c @@ -17,4 +17,4 @@ main (int argc) foo2 (a); } /* We should sink the first a = b + c calculation into the else branch */ -/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c index dbdde39..f04da5d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-5.c @@ -44,4 +44,4 @@ void foo(int16_t runs[], uint8_t alpha[], int x, int count) } /* We should not sink the next_runs = runs + x calculation after the loop. */ -/* { dg-final { scan-tree-dump-times "Sunk statements:" 0 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sunk statements:" 0 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c index 1abae9f..31f5af3 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-6.c @@ -14,4 +14,4 @@ int foo(int *a, int r) /* *a = 1 should be sunk to the else block. */ -/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c index ec3288f..bd74844 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-7.c @@ -15,4 +15,4 @@ int foo(int *a, int r, short *b) /* *a = 1 should be sunk to the else block. */ -/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c index 48af421..4b23b56 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-8.c @@ -24,4 +24,4 @@ int foo(int *a, int r, short *b) /* *a = 1 should be sunk into the default case. */ -/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c index 509a763..32bfc81 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-9.c @@ -15,4 +15,4 @@ int foo(int *a, int r, int *b) /* *a = 1 should be sunk to the else block. */ -/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink" } } */ +/* { dg-final { scan-tree-dump-times "Sinking" 1 "sink1" } } */ diff --git a/gcc/testsuite/gcc.dg/ucnid-5-utf8.c b/gcc/testsuite/gcc.dg/ucnid-5-utf8.c index 8e10467..43310b6 100644 --- a/gcc/testsuite/gcc.dg/ucnid-5-utf8.c +++ b/gcc/testsuite/gcc.dg/ucnid-5-utf8.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "No dollar in identfiers" { avr-*-* powerpc-ibm-aix* } } */ +/* { dg-skip-if "No dollar in identifiers" { avr-*-* powerpc-ibm-aix* } } */ /* { dg-skip-if "" { ! ucn } } */ /* { dg-options "-std=c99 -fdollars-in-identifiers -g" } */ void abort (void); diff --git a/gcc/testsuite/gcc.dg/ucnid-5.c b/gcc/testsuite/gcc.dg/ucnid-5.c index dc282a7..6f0f475 100644 --- a/gcc/testsuite/gcc.dg/ucnid-5.c +++ b/gcc/testsuite/gcc.dg/ucnid-5.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "No dollar in identfiers" { avr-*-* powerpc-ibm-aix* } } */ +/* { dg-skip-if "No dollar in identifiers" { avr-*-* powerpc-ibm-aix* } } */ /* { dg-options "-std=c99 -fdollars-in-identifiers -g" } */ void abort (void); diff --git a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c index 23a3b39..bcdf7f0 100644 --- a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c +++ b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c @@ -3,7 +3,9 @@ extern void accumulate (int x, int *a); -int test_missing_function_defn (int *arr, int n) /* { dg-message "vectorized 0 loops in function" } */ +int test_missing_function_defn (int *arr, int n) /* { dg-note "5: vectorized 0 loops in function" } */ +/* { dg-prune-output "note: " } as we're not interested in matching any further + notes. */ { int sum = 0; for (int i = 0; i < n; ++i) /* { dg-missed "21: couldn't vectorize loop" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/narrow_high_combine.c b/gcc/testsuite/gcc.target/aarch64/narrow_high_combine.c new file mode 100644 index 0000000..cf649bd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/narrow_high_combine.c @@ -0,0 +1,125 @@ +/* { dg-skip-if "" { arm*-*-* } } */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#include <arm_neon.h> + +#define TEST_ARITH(name, rettype, rmwtype, intype, fs, rs) \ + rettype test_ ## name ## _ ## fs ## _high_combine \ + (rmwtype a, intype b, intype c) \ + { \ + return vcombine_ ## rs (a, name ## _ ## fs (b, c)); \ + } + +TEST_ARITH (vaddhn, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_ARITH (vaddhn, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_ARITH (vaddhn, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_ARITH (vaddhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_ARITH (vaddhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_ARITH (vaddhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_ARITH (vraddhn, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_ARITH (vraddhn, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_ARITH (vraddhn, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_ARITH (vraddhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_ARITH (vraddhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_ARITH (vraddhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_ARITH (vsubhn, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_ARITH (vsubhn, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_ARITH (vsubhn, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_ARITH (vsubhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_ARITH (vsubhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_ARITH (vsubhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_ARITH (vrsubhn, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_ARITH (vrsubhn, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_ARITH (vrsubhn, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_ARITH (vrsubhn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_ARITH (vrsubhn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_ARITH (vrsubhn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +#define TEST_SHIFT(name, rettype, rmwtype, intype, fs, rs) \ + rettype test_ ## name ## _ ## fs ## _high_combine \ + (rmwtype a, intype b) \ + { \ + return vcombine_ ## rs (a, name ## _ ## fs (b, 4)); \ + } + +TEST_SHIFT (vshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_SHIFT (vshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_SHIFT (vshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_SHIFT (vshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_SHIFT (vshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_SHIFT (vshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_SHIFT (vrshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_SHIFT (vrshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_SHIFT (vrshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_SHIFT (vrshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_SHIFT (vrshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_SHIFT (vrshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_SHIFT (vqshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_SHIFT (vqshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_SHIFT (vqshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_SHIFT (vqshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_SHIFT (vqshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_SHIFT (vqshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_SHIFT (vqrshrn_n, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_SHIFT (vqrshrn_n, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_SHIFT (vqrshrn_n, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_SHIFT (vqrshrn_n, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_SHIFT (vqrshrn_n, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_SHIFT (vqrshrn_n, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_SHIFT (vqshrun_n, uint8x16_t, uint8x8_t, int16x8_t, s16, u8) +TEST_SHIFT (vqshrun_n, uint16x8_t, uint16x4_t, int32x4_t, s32, u16) +TEST_SHIFT (vqshrun_n, uint32x4_t, uint32x2_t, int64x2_t, s64, u32) + +TEST_SHIFT (vqrshrun_n, uint8x16_t, uint8x8_t, int16x8_t, s16, u8) +TEST_SHIFT (vqrshrun_n, uint16x8_t, uint16x4_t, int32x4_t, s32, u16) +TEST_SHIFT (vqrshrun_n, uint32x4_t, uint32x2_t, int64x2_t, s64, u32) + +#define TEST_UNARY(name, rettype, rmwtype, intype, fs, rs) \ + rettype test_ ## name ## _ ## fs ## _high_combine \ + (rmwtype a, intype b) \ + { \ + return vcombine_ ## rs (a, name ## _ ## fs (b)); \ + } + +TEST_UNARY (vmovn, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_UNARY (vmovn, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_UNARY (vmovn, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_UNARY (vmovn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_UNARY (vmovn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_UNARY (vmovn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_UNARY (vqmovn, int8x16_t, int8x8_t, int16x8_t, s16, s8) +TEST_UNARY (vqmovn, int16x8_t, int16x4_t, int32x4_t, s32, s16) +TEST_UNARY (vqmovn, int32x4_t, int32x2_t, int64x2_t, s64, s32) +TEST_UNARY (vqmovn, uint8x16_t, uint8x8_t, uint16x8_t, u16, u8) +TEST_UNARY (vqmovn, uint16x8_t, uint16x4_t, uint32x4_t, u32, u16) +TEST_UNARY (vqmovn, uint32x4_t, uint32x2_t, uint64x2_t, u64, u32) + +TEST_UNARY (vqmovun, uint8x16_t, uint8x8_t, int16x8_t, s16, u8) +TEST_UNARY (vqmovun, uint16x8_t, uint16x4_t, int32x4_t, s32, u16) +TEST_UNARY (vqmovun, uint32x4_t, uint32x2_t, int64x2_t, s64, u32) + +/* { dg-final { scan-assembler-times "\\taddhn2\\tv" 6} } */ +/* { dg-final { scan-assembler-times "\\tsubhn2\\tv" 6} } */ +/* { dg-final { scan-assembler-times "\\trsubhn2\\tv" 6} } */ +/* { dg-final { scan-assembler-times "\\traddhn2\\tv" 6} } */ +/* { dg-final { scan-assembler-times "\\trshrn2\\tv" 6} } */ +/* { dg-final { scan-assembler-times "\\tshrn2\\tv" 6} } */ +/* { dg-final { scan-assembler-times "\\tsqshrun2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\tsqrshrun2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\tsqshrn2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\tuqshrn2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\tsqrshrn2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\tuqrshrn2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\txtn2\\tv" 6} } */ +/* { dg-final { scan-assembler-times "\\tuqxtn2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\tsqxtn2\\tv" 3} } */ +/* { dg-final { scan-assembler-times "\\tsqxtun2\\tv" 3} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/ld1_extend.c b/gcc/testsuite/gcc.target/aarch64/sve/ld1_extend.c new file mode 100644 index 0000000..7f78cb4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/ld1_extend.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 --param vect-partial-vector-usage=1" } */ + +void foo (signed char * __restrict__ a, signed char * __restrict__ b, short * __restrict__ c, int n) +{ + for (int i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +/* { dg-final { scan-assembler-times {\tld1sb\t} 4 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c index 08b2745..505767a 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_2.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */ /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c index c823470..f7d4360 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_3.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c index 52c9291..1aef903 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_4.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint16_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxth\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c index 1552ed8..fb58b52 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_6.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */ /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */ /* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c index 484d9da..34b2cc0 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_and_7.c @@ -10,7 +10,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2){ /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c index 23ddeb9..529c073 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_2.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */ /* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c index 4dd1e08..b6b0119 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_3.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c index a31a2d4..a61eed4 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_4.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint16_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxth\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c index 416567b..a3fde4b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_6.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */ /* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */ /* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c index 3f7c3dd..8e01f3f 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_eor_7.c @@ -10,7 +10,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2){ /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c index 593de65..763c81b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_2.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */ /* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c index ec34e75..17fddcd 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_3.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c index 561a104..4e8c4d0 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_4.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint16_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxth\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c index 3ce1c3f..26103cf 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_6.c @@ -11,7 +11,7 @@ f (uint64_t *restrict dst, uint16_t *restrict src1, uint8_t *restrict src2) /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.h,} } } */ /* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */ /* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c index e6a4291..06e1b58 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/logical_unpacked_orr_7.c @@ -10,7 +10,7 @@ f (uint64_t *restrict dst, uint32_t *restrict src1, uint8_t *restrict src2){ /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tld1b\tz[0-9]+\.d,} 2 } } */ -/* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s,} 1 } } */ +/* { dg-final { scan-assembler-not {\tuxtb\tz[0-9]+\.s,} } } */ /* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */ /* { dg-final { scan-assembler-times {\tuxtw\tz[0-9]+\.d,} 2 } } */ /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/pr100333.c b/gcc/testsuite/gcc.target/arm/cmse/pr100333.c new file mode 100644 index 0000000..d8e3d80 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/pr100333.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mcmse" } */ +typedef void __attribute__((cmse_nonsecure_call)) t(void); +t g; +void f() { + g(); +} diff --git a/gcc/testsuite/gcc.target/arm/pr99977.c b/gcc/testsuite/gcc.target/arm/pr99977.c index 7911899..db330e4 100644 --- a/gcc/testsuite/gcc.target/arm/pr99977.c +++ b/gcc/testsuite/gcc.target/arm/pr99977.c @@ -1,5 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-march=armv8-m.base -mfloat-abi=soft -O2" } */ +/* { dg-require-effective-target arm_arch_v8m_base_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8m_base } */ _Bool f1(int *p) { return __sync_bool_compare_and_swap (p, -1, 2); } _Bool f2(int *p) { return __sync_bool_compare_and_swap (p, -8, 2); } int g1(int *p) { return __sync_val_compare_and_swap (p, -1, 2); } diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1b.c b/gcc/testsuite/gcc.target/i386/pr100637-1b.c new file mode 100644 index 0000000..3e7445a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-1b.c @@ -0,0 +1,25 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -dp" } */ + +typedef char __v4qi __attribute__ ((__vector_size__ (4))); + +__v4qi and (__v4qi a, __v4qi b) { return a & b; }; +/* { dg-final { scan-assembler "andv4qi3" } } */ + +__v4qi andn (__v4qi a, __v4qi b) { return a & ~b; }; +/* { dg-final { scan-assembler "andnotv4qi3" } } */ + +__v4qi or (__v4qi a, __v4qi b) { return a | b; }; +/* { dg-final { scan-assembler "iorv4qi3" } } */ + +__v4qi xor (__v4qi a, __v4qi b) { return a ^ b; }; +__v4qi not (__v4qi a) { return ~a; }; +/* { dg-final { scan-assembler-times "xorv4qi3" 2 } } */ + +__v4qi plus (__v4qi a, __v4qi b) { return a + b; }; +/* { dg-final { scan-assembler "addv4qi3" } } */ + +__v4qi minus (__v4qi a, __v4qi b) { return a - b; }; +__v4qi neg (__v4qi a) { return -a; }; +/* { dg-final { scan-assembler-times "subv4qi3" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1w.c b/gcc/testsuite/gcc.target/i386/pr100637-1w.c new file mode 100644 index 0000000..fe69640 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-1w.c @@ -0,0 +1,38 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -dp" } */ + +typedef short __v2hi __attribute__ ((__vector_size__ (4))); +typedef unsigned short __v2hu __attribute__ ((__vector_size__ (4))); + +__v2hi and (__v2hi a, __v2hi b) { return a & b; }; +/* { dg-final { scan-assembler "andv2hi3" } } */ + +__v2hi andn (__v2hi a, __v2hi b) { return a & ~b; }; +/* { dg-final { scan-assembler "andnotv2hi3" } } */ + +__v2hi or (__v2hi a, __v2hi b) { return a | b; }; +/* { dg-final { scan-assembler "iorv2hi3" } } */ + +__v2hi xor (__v2hi a, __v2hi b) { return a ^ b; }; +__v2hi not (__v2hi a) { return ~a; }; +/* { dg-final { scan-assembler-times "xorv2hi3" 2 } } */ + +__v2hi plus (__v2hi a, __v2hi b) { return a + b; }; +/* { dg-final { scan-assembler "addv2hi3" } } */ + +__v2hi minus (__v2hi a, __v2hi b) { return a - b; }; +__v2hi neg (__v2hi a) { return -a; }; +/* { dg-final { scan-assembler-times "subv2hi3" 2 } } */ + +__v2hi mul (__v2hi a, __v2hi b) { return a * b; }; +/* { dg-final { scan-assembler "mulv2hi3" } } */ + +__v2hi shl (__v2hi a, int b) { return a << b; }; +/* { dg-final { scan-assembler "ashlv2hi3" } } */ + +__v2hi ashr (__v2hi a, int b) { return a >> b; }; +/* { dg-final { scan-assembler "ashrv2hi3" } } */ + +__v2hu lshr (__v2hu a, int b) { return a >> b; }; +/* { dg-final { scan-assembler "lshrv2hi3" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr100637-2b.c b/gcc/testsuite/gcc.target/i386/pr100637-2b.c new file mode 100644 index 0000000..04480bb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-2b.c @@ -0,0 +1,21 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef char vec __attribute__((vector_size(4))); + +vec lt (vec a, vec b) { return a < b; } +vec le (vec a, vec b) { return a <= b; } +vec eq (vec a, vec b) { return a == b; } +vec ne (vec a, vec b) { return a != b; } +vec ge (vec a, vec b) { return a >= b; } +vec gt (vec a, vec b) { return a > b; } + +typedef unsigned char uvec __attribute__((vector_size(4))); + +vec ltu (uvec a, uvec b) { return a < b; } +vec leu (uvec a, uvec b) { return a <= b; } +vec geu (uvec a, uvec b) { return a >= b; } +vec gtu (uvec a, uvec b) { return a > b; } + +/* { dg-final { scan-assembler-not "cmpb" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr100637-2w.c b/gcc/testsuite/gcc.target/i386/pr100637-2w.c new file mode 100644 index 0000000..fbbaac9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-2w.c @@ -0,0 +1,21 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +typedef short vec __attribute__((vector_size(4))); + +vec lt (vec a, vec b) { return a < b; } +vec le (vec a, vec b) { return a <= b; } +vec eq (vec a, vec b) { return a == b; } +vec ne (vec a, vec b) { return a != b; } +vec ge (vec a, vec b) { return a >= b; } +vec gt (vec a, vec b) { return a > b; } + +typedef unsigned short uvec __attribute__((vector_size(4))); + +vec ltu (uvec a, uvec b) { return a < b; } +vec leu (uvec a, uvec b) { return a <= b; } +vec geu (uvec a, uvec b) { return a >= b; } +vec gtu (uvec a, uvec b) { return a > b; } + +/* { dg-final { scan-assembler-not "cmpw" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr100660.c b/gcc/testsuite/gcc.target/i386/pr100660.c new file mode 100644 index 0000000..1112b74 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100660.c @@ -0,0 +1,10 @@ +/* PR target/pr100660. */ +/* { dg-do compile } */ +/* { dg-options "-mavx2 -O" } */ + +typedef char v16qi __attribute__ ((vector_size (16))); +v16qi +f5 (v16qi a, v16qi b) +{ + __builtin_ia32_pcmpgtb128 (a, b); +} diff --git a/gcc/testsuite/gcc.target/i386/pr100701.c b/gcc/testsuite/gcc.target/i386/pr100701.c new file mode 100644 index 0000000..3132d66 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100701.c @@ -0,0 +1,28 @@ +/* PR target/100701 */ +/* { dg-do run { target { ! ia32 } } } */ +/* { dg-options "-O0 -fschedule-insns2 -msse2" } */ + +typedef unsigned char __attribute__((__vector_size__ (8))) V; +typedef unsigned int __attribute__((__vector_size__ (8))) U; + +U u; +unsigned x; +unsigned char y; + +V +foo (V a, __int128 i) +{ + V b = a; + a &= y; + if (i == 0) + __builtin_abort (); + U c = (x != y / i) <= u; + return (V) c + a + b; +} + +int +main (void) +{ + (void)foo ((V) { }, 4); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr100722.c b/gcc/testsuite/gcc.target/i386/pr100722.c new file mode 100644 index 0000000..f784039 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100722.c @@ -0,0 +1,17 @@ +/* PR target/100722 */ +/* { dg-do compile } */ +/* { dg-options "-O -msse2" } */ + +typedef char int8x4_t __attribute__((vector_size(4))); + +void stack_callee (int8x4_t, int8x4_t, int8x4_t, int8x4_t, + int8x4_t, int8x4_t, int8x4_t); + +int8x4_t stack_caller_x1; + +void stack_caller (void) +{ + stack_callee (stack_caller_x1, stack_caller_x1, stack_caller_x1, + stack_caller_x1, stack_caller_x1, stack_caller_x1, + stack_caller_x1); +} diff --git a/gcc/testsuite/gcc.target/i386/pr90773-24.c b/gcc/testsuite/gcc.target/i386/pr90773-24.c new file mode 100644 index 0000000..7b2ea66 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-24.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -march=x86-64" } */ + +struct S +{ + long long s1 __attribute__ ((aligned (8))); + unsigned s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14; +}; + +const struct S array[] = { + { 0, 60, 640, 2112543726, 39682, 48, 16, 33, 10, 96, 2, 0, 0, 4 } +}; + +void +foo (struct S *x) +{ + x[0] = array[0]; +} + +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 32\\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 48\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-25.c b/gcc/testsuite/gcc.target/i386/pr90773-25.c new file mode 100644 index 0000000..57642ea --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-25.c @@ -0,0 +1,25 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -march=x86-64" } */ + +struct S +{ + long long s1 __attribute__ ((aligned (8))); + unsigned s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14; +}; + +const struct S array[] = { + { 0, } +}; + +void +foo (struct S *x) +{ + x[0] = array[0]; +} + +/* { dg-final { scan-assembler-not "movdqa" } } */ +/* { dg-final { scan-assembler-times "pxor\[\\t \]%xmm\[0-9\]+, %xmm\[0-9\]+" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 16\\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 32\\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]%xmm\[0-9\]+, 48\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c index 7aad858..6c30702 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c @@ -109,7 +109,7 @@ bar_s8_s64 (v4di * dst, v32qi src) dst[0] = *(v4di *) tem; } -/* { dg-final { scan-assembler-times "pmovsxbq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxbq" 2 } } */ void foo_s16_s32 (v8si * dst, v16hi * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c index 21fa3e5..70b5bdb 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c @@ -109,7 +109,7 @@ bar_u8_u64 (v4di * dst, v32qi src) dst[0] = *(v4di *) tem; } -/* { dg-final { scan-assembler-times "pmovzxbq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxbq" 2 } } */ void foo_u16_u32 (v8si * dst, v16hi * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c index dc50084..a9f7d7e 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c @@ -126,4 +126,4 @@ truncdb_128 (v16qi * dst, v4si * __restrict src) /* { dg-final { scan-assembler-times "vpmovqb" 2 { xfail *-*-* } } } */ /* { dg-final { scan-assembler-times "vpmovdw" 1 } } */ /* { dg-final { scan-assembler-times "vpmovdw" 2 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times "vpmovdb" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "vpmovdb" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c index ca174ce..53e89ad 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c @@ -61,7 +61,7 @@ bar_s8_s32 (v4si * dst, v16qi src) dst[0] = *(v4si *) tem; } -/* { dg-final { scan-assembler-times "pmovsxbd" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxbd" 2 } } */ void foo_s8_s64 (v2di * dst, v16qi * __restrict src) @@ -125,7 +125,7 @@ bar_s16_s64 (v2di * dst, v8hi src) dst[0] = *(v2di *) tem; } -/* { dg-final { scan-assembler-times "pmovsxwq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxwq" 2 } } */ void foo_s32_s64 (v2di * dst, v4si * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c index e462629..e12e163 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c @@ -61,7 +61,7 @@ bar_u8_u32 (v4si * dst, v16qi src) dst[0] = *(v4si *) tem; } -/* { dg-final { scan-assembler-times "pmovzxbd" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxbd" 2 } } */ void foo_u8_u64 (v2di * dst, v16qi * __restrict src) @@ -125,7 +125,7 @@ bar_u16_u64 (v2di * dst, v8hi src) dst[0] = *(v2di *) tem; } -/* { dg-final { scan-assembler-times "pmovzxwq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxwq" 2 } } */ void foo_u32_u64 (v2di * dst, v4si * __restrict src) diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c new file mode 100644 index 0000000..9a20537 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c @@ -0,0 +1,205 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */ + +#include <altivec.h> +#include <stdint.h> + +/* and/andc/eqv/nand/nor/or/orc/xor */ +#define AND(a,b) ((a)&(b)) +#define ANDC1(a,b) ((a)&((~b))) +#define ANDC2(a,b) ((~(a))&(b)) +#define EQV(a,b) (~((a)^(b))) +#define NAND(a,b) (~((a)&(b))) +#define NOR(a,b) (~((a)|(b))) +#define OR(a,b) ((a)|(b)) +#define ORC1(a,b) ((a)|((~b))) +#define ORC2(a,b) ((~(a))|(b)) +#define XOR(a,b) ((a)^(b)) +#define TEST1(type, func) \ + type func ## _and_T_ ## type (type a, type b, type c) { return AND(func(a,b),c); } \ + type func ## _andc1_T_ ## type (type a, type b, type c) { return ANDC1(func(a,b),c); } \ + type func ## _andc2_T_ ## type (type a, type b, type c) { return ANDC2(func(a,b),c); } \ + type func ## _eqv_T_ ## type (type a, type b, type c) { return EQV(func(a,b),c); } \ + type func ## _nand_T_ ## type (type a, type b, type c) { return NAND(func(a,b),c); } \ + type func ## _nor_T_ ## type (type a, type b, type c) { return NOR(func(a,b),c); } \ + type func ## _or_T_ ## type (type a, type b, type c) { return OR(func(a,b),c); } \ + type func ## _orc1_T_ ## type (type a, type b, type c) { return ORC1(func(a,b),c); } \ + type func ## _orc2_T_ ## type (type a, type b, type c) { return ORC2(func(a,b),c); } \ + type func ## _xor_T_ ## type (type a, type b, type c) { return XOR(func(a,b),c); } \ + type func ## _rev_and_T_ ## type (type a, type b, type c) { return AND(c,func(a,b)); } \ + type func ## _rev_andc1_T_ ## type (type a, type b, type c) { return ANDC1(c,func(a,b)); } \ + type func ## _rev_andc2_T_ ## type (type a, type b, type c) { return ANDC2(c,func(a,b)); } \ + type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return EQV(c,func(a,b)); } \ + type func ## _rev_nand_T_ ## type (type a, type b, type c) { return NAND(c,func(a,b)); } \ + type func ## _rev_nor_T_ ## type (type a, type b, type c) { return NOR(c,func(a,b)); } \ + type func ## _rev_or_T_ ## type (type a, type b, type c) { return OR(c,func(a,b)); } \ + type func ## _rev_orc1_T_ ## type (type a, type b, type c) { return ORC1(c,func(a,b)); } \ + type func ## _rev_orc2_T_ ## type (type a, type b, type c) { return ORC2(c,func(a,b)); } \ + type func ## _rev_xor_T_ ## type (type a, type b, type c) { return XOR(c,func(a,b)); } +#define TEST(type) \ + TEST1(type,AND) \ + TEST1(type,ANDC1) \ + TEST1(type,ANDC2) \ + TEST1(type,EQV) \ + TEST1(type,NAND) \ + TEST1(type,NOR) \ + TEST1(type,OR) \ + TEST1(type,ORC1) \ + TEST1(type,ORC2) \ + TEST1(type,XOR) + +typedef vector bool char vboolchar_t; +typedef vector unsigned int vuint_t; + +TEST(uint8_t); +TEST(int8_t); +TEST(uint16_t); +TEST(int16_t); +TEST(uint32_t); +TEST(int32_t); +TEST(uint64_t); +TEST(int64_t); +TEST(vboolchar_t); +TEST(vuint_t); + +/* Recreate with: + grep ' \*fuse_' fusion-p10-2logical.s|sed -e 's,^.*\*,,' |sort -k 7,7 |uniq -c|awk '{l=30-length($2); printf("/%s* { %s { scan-assembler-times \"%s\"%-*s %4d } } *%s/\n","","dg-final",$2,l,"",$1,"");}' + */ + +/* { dg-final { scan-assembler-times "fuse_and_and/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/1" 26 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_or/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_or/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_or/2" 32 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_orc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_orc/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_xor/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_xor/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_xor/2" 32 } } */ +/* { dg-final { scan-assembler-times "fuse_and_eqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_and_eqv/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_and_or/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_or/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_and_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_and_xor/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_xor/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_andc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_andc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_or/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_or/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_andc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_andc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/0" 14 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/1" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/2" 72 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_orc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/0" 28 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/1" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/3" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_andc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_andc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_or/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_or/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_or_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_andc/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_andc/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_and/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_and/2" 32 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_andc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_andc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_andc/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/1" 10 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/2" 72 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_xor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_xor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_xor/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_or_eqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_or_eqv/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_or_or/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_or/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_xor/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_xor/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vand/1" 10 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vand/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vorc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vxor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vand/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_veqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_veqv_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_veqv_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_veqv_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vor/0" 14 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vor/1" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vor/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vorc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vand/0" 14 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vand/1" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vand/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vandc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vand/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vandc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vor/1" 10 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vor/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vxor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_veqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_veqv/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vnand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vxor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_andc/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_andc/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_eqv/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_eqv/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_nand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_nand/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_or/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_or/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_xor/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_xor/2" 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c new file mode 100644 index 0000000..494ccdb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-addadd.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */ + +long addadd0(long a, long b, long c) +{ + return a+b+c; +} +long addadd1(long a, long b, long c, long *t) +{ + long r=a+b+c; + *t = b; + return r; +} +long addadd2(long s, long a, long b, long c) +{ + return b+c+a; +} + +typedef vector long vlong; +vlong vaddadd(vlong a, vlong b, vlong c) +{ + return a+b+c; +} +vlong vaddadd1(vlong a, vlong b, vlong c, vlong *t) +{ + vlong r=a+b+c; + *t = b; + return r; +} +vlong vaddadd2(vlong s, vlong a, vlong b, vlong c) +{ + return a+b+c; +} + +/* { dg-final { scan-assembler-times "fuse_add_add/0" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_add_add/1" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_add_add/2" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_vaddudm_vaddudm/0" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_vaddudm_vaddudm/1" 1 } } */ +/* { dg-final { scan-assembler-times "fuse_vaddudm_vaddudm/2" 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c new file mode 100644 index 0000000..99f9e92 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c @@ -0,0 +1,66 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */ + +#include <stdint.h> + +#define TEST(type) \ + struct t ## type { type x[128],a,b,c; }; \ + struct s ## type { struct t ## type *p; int d,e,f; uint64_t g,h,i; }; \ +int \ +t ## type (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->a > ((type)0)) { return p->d; } \ + if(!tp || tp->b > ((type)1)) { return p->e; } \ + if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return p->f; } \ + return 0; \ +} \ +type \ +t ## type ## _ret (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->a > ((type)0)) { return tp->a; } \ + if(!tp || tp->b > ((type)1)) { return tp->b; } \ + if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return tp->c; } \ + return 0; \ +}\ +int \ +t ## type ## _x (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->x[p->g] > ((type)0)) { return p->d; } \ + if(!tp || tp->x[p->h] > ((type)1)) { return p->e; } \ + if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return p->f; } \ + return 0; \ +} \ +type \ +t ## type ## _x_ret (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->x[p->g] > ((type)0)) { return tp->x[p->g]; } \ + if(!tp || tp->x[p->h] > ((type)1)) { return tp->x[p->h]; } \ + if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return tp->x[p->i]; } \ + return 0; \ +} + +TEST(uint64_t) +TEST(int64_t) +TEST(uint32_t) +TEST(int32_t) +TEST(uint16_t) +TEST(int16_t) +TEST(uint8_t) +TEST(int8_t) + +/* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero" 2 } } */ +/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none" 4 } } */ +/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none" 4 } } */ +/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none" 1 } } */ +/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none" 1 } } */ +/* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign" 8 } } */ +/* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero" 2 } } */ +/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign" 3 } } */ +/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_clobber_CC_none" 4 } } */ +/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero" 2 } } */ +/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none" 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c deleted file mode 100644 index ae7d574..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -/* { dg-options "-mabi=elfv2" } */ - -struct f8 - { - float x[8]; - }; - -void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous 'float' aggregates has changed" } */ -{ -} - diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c deleted file mode 100644 index fdbeddf..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c +++ /dev/null @@ -1,11 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ - -struct test - { - long a __attribute__((aligned (16))); - }; - -void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment has changed" } */ -{ -} - diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c deleted file mode 100644 index 22cad0c..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -/* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec" } */ - -struct test - { - int a __attribute__((vector_size (8))); - }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment has changed" } */ - diff --git a/gcc/testsuite/gcc.target/riscv/arch-12.c b/gcc/testsuite/gcc.target/riscv/arch-12.c new file mode 100644 index 0000000..29e16c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-12.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=rv64im1p2p3 -mabi=lp64" } */ +int foo() {} +/* { dg-error "'-march=rv64im1p2p3': For 'm1p2p\\?', version number with more than 2 level is not supported." "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/riscv/attribute-19.c b/gcc/testsuite/gcc.target/riscv/attribute-19.c new file mode 100644 index 0000000..18f68d9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/attribute-19.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-mriscv-attribute -march=rv64imp0p9 -mabi=lp64" } */ +int foo() {} +/* { dg-final { scan-assembler ".attribute arch, \"rv64i2p0_m2p0_p0p9\"" } } */ diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 new file mode 100644 index 0000000..e1c6830 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 @@ -0,0 +1,11 @@ +! PR fortran/100642 +! Contributed by G. Steinmetz +program p + !use omp_lib, only: omp_depend_kind + use iso_c_binding, only: c_intptr_t + integer, parameter :: omp_depend_kind = 2*c_intptr_t + integer(omp_depend_kind) :: a, b + !$acc data + !$omp depobj(b) depend(out:a) ! { dg-error "The !\\\$OMP DEPOBJ directive cannot be specified within a !\\\$ACC DATA region" } + !$acc end data +end diff --git a/gcc/testsuite/gfortran.dg/goacc/private-3.f95 b/gcc/testsuite/gfortran.dg/goacc/private-3.f95 index a7c6d81..1bfb4f1 100644 --- a/gcc/testsuite/gfortran.dg/goacc/private-3.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/private-3.f95 @@ -1,7 +1,9 @@ -! { dg-do compile } - ! test for private variables in a reduction clause +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } for +! testing/documenting aspects of that functionality. + program test implicit none integer, parameter :: n = 100 @@ -16,6 +18,7 @@ program test !$acc parallel private (k) k = 0 !$acc loop reduction (+:k) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, n k = k + 1 end do diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 new file mode 100644 index 0000000..bcd7159 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 @@ -0,0 +1,57 @@ +! OpenACC privatization: 'loop' construct + +! { dg-additional-options "-fopt-info-omp-note" } +! { dg-additional-options "--param=openacc-privatization=noisy" } for +! testing/documenting aspects of that functionality. + +! See also '../../c-c++-common/goacc/privatization-1-compute-loop.c'. +!TODO More cases should be added here. + +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_loop 0] } +! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". + +module m +contains + subroutine f (i, j, a) + implicit none + integer :: i, j, a + integer :: x, y + integer, parameter :: c = 3 + integer, external :: g + + !$acc parallel + !$acc loop collapse(2) private(a) private(x, y) ! { dg-line l_loop[incr c_loop] } + do i = 1, 20 + do j = 1, 25 + ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.) + + ! Don't know how to effect a 'LABEL_DECL' here. + ! Don't know how to effect a 'TYPE_DECL' here. + ! Don't know how to effect a 'FUNCTION_DECL' here. + ! Don't know how to effect a 'RESULT_DECL' here. + ! Don't know how to effect a 'VAR_DECL' here. + ! (See C/C++ example.) + + a = g (i, j, a, c) + x = a + !$acc atomic write + y = a + end do + end do + ! { dg-note {variable 'count\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } + !$acc end parallel + end subroutine f +end module m diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 new file mode 100644 index 0000000..ed7e9ec --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 @@ -0,0 +1,48 @@ +! OpenACC privatization: compute construct + +! { dg-additional-options "-fopt-info-omp-note" } +! { dg-additional-options "--param=openacc-privatization=noisy" } for +! testing/documenting aspects of that functionality. + +! See also '../../c-c++-common/goacc/privatization-1-compute.c'. +!TODO More cases should be added here. + +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_compute 0] } +! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". + +module m +contains + subroutine f (i, j, a) + implicit none + integer :: i, j, a + integer :: x, y + integer, parameter :: c = 3 + integer, external :: g + + !$acc parallel private(i, j, a) private(x, y) ! { dg-line l_compute[incr c_compute] } + ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.) + + ! Don't know how to effect a 'LABEL_DECL' here. + ! Don't know how to effect a 'TYPE_DECL' here. + ! Don't know how to effect a 'FUNCTION_DECL' here. + ! Don't know how to effect a 'RESULT_DECL' here. + ! Don't know how to effect a 'VAR_DECL' here. + ! (See C/C++ example.) + + a = g (i, j, a, c) + x = a + !$acc atomic write ! ... to force 'TREE_ADDRESSABLE'. + y = a + !$acc end parallel + ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } + ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } + ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + end subroutine f +end module m diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 new file mode 100644 index 0000000..db6d822 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 @@ -0,0 +1,56 @@ +! OpenACC privatization: 'loop' construct inside 'routine' + +! { dg-additional-options "-fopt-info-omp-note" } +! { dg-additional-options "--param=openacc-privatization=noisy" } for +! testing/documenting aspects of that functionality. + +! See also '../../c-c++-common/goacc/privatization-1-routine_gang-loop.c'. +!TODO More cases should be added here. + +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_loop 0] } +! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". + +module m +contains + subroutine f (i, j, a) + implicit none + integer :: i, j, a + !$acc routine (f) gang + integer :: x, y + integer, parameter :: c = 3 + integer, external :: g + + !$acc loop collapse(2) private(a) private(x, y) ! { dg-line l_loop[incr c_loop] } + do i = 1, 20 + do j = 1, 25 + ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.) + + ! Don't know how to effect a 'LABEL_DECL' here. + ! Don't know how to effect a 'TYPE_DECL' here. + ! Don't know how to effect a 'FUNCTION_DECL' here. + ! Don't know how to effect a 'RESULT_DECL' here. + ! Don't know how to effect a 'VAR_DECL' here. + ! (See C/C++ example.) + + a = g (i, j, a, c) + x = a + !$acc atomic write + y = a + end do + end do + ! { dg-note {variable 'count\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } + end subroutine f +end module m diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 new file mode 100644 index 0000000..725bd5e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 @@ -0,0 +1,47 @@ +! OpenACC privatization: 'routine' + +! { dg-additional-options "-fopt-info-omp-note" } +! { dg-additional-options "--param=openacc-privatization=noisy" } for +! testing/documenting aspects of that functionality. + +! See also '../../c-c++-common/goacc/privatization-1-routine_gang.c'. +!TODO More cases should be added here. + +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_routine 0] } +! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". + +module m +contains + subroutine f (i, j, a) + implicit none + integer :: i, j, a + !$acc routine (f) gang ! { dg-line l_routine[incr c_routine] } + integer :: x, y + integer, parameter :: c = 3 + integer, external :: g + + ! Can't have nested scopes fun. (Fortran 'block' construct supported only starting with OpenACC 3.1.) + + ! Don't know how to effect a 'LABEL_DECL' here. + ! Don't know how to effect a 'TYPE_DECL' here. + ! Don't know how to effect a 'FUNCTION_DECL' here. + ! Don't know how to effect a 'RESULT_DECL' here. + ! Don't know how to effect a 'VAR_DECL' here. + ! (See C/C++ example.) + + a = g (i, j, a, c) + x = a + !$acc atomic write ! ... to force 'TREE_ADDRESSABLE'. + y = a + end subroutine f + ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } + ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } + ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } +end module m diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f index 0e8dfb1..04d507f 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f +++ b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f @@ -22,6 +22,8 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do j = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } +! { dg-bogus "note: routine 'workerr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'workerr_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do end do !$acc end parallel loop @@ -30,9 +32,12 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do i = 1, n !$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do j = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } +! { dg-bogus "note: routine 'gangr' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 } +! { dg-bogus "note: routine 'gangr_' declared here" "TODO" { xfail offloading_enabled } .-3 } end do end do !$acc end parallel loop @@ -83,6 +88,7 @@ !$acc end parallel loop !$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -90,6 +96,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -97,6 +104,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -126,6 +134,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -133,6 +142,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -152,6 +162,8 @@ !$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } do i = 1, n call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-bogus "note: routine 'vectorr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'vectorr_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do !$acc end parallel loop @@ -168,6 +180,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -201,6 +214,8 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do j = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } +! { dg-bogus "note: routine 'workerf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'workerf_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do end do !$acc end parallel loop @@ -209,9 +224,12 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do i = 1, n !$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do j = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } +! { dg-bogus "note: routine 'gangf' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 } +! { dg-bogus "note: routine 'gangf_' declared here" "TODO" { xfail offloading_enabled } .-3 } end do end do !$acc end parallel loop @@ -262,6 +280,7 @@ !$acc end parallel loop !$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -269,6 +288,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -276,6 +296,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -305,6 +326,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -312,6 +334,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -331,6 +354,8 @@ !$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } do i = 1, n a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-bogus "note: routine 'vectorf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'vectorf_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do !$acc end parallel loop @@ -347,6 +372,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/gfortran.dg/gomp/map-6.f90 b/gcc/testsuite/gfortran.dg/gomp/map-6.f90 new file mode 100644 index 0000000..309f845 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/map-6.f90 @@ -0,0 +1,50 @@ +! { dg-additional-options "-fdump-tree-original" } + +implicit none + +integer :: a, b, b1, b2, b3, b4, b5, b6 + +!$omp target map(a) +!$omp end target + +!$omp target map(to : a) +!$omp end target + +!$omp target map(always to: a) +!$omp end target +!$omp target map(always, to: a) +!$omp end target +!$omp target map(close to: a) +!$omp end target +!$omp target map(close, to: a) +!$omp end target + +!$omp target map(close always to:b1) +!$omp end target +!$omp target map(close, always to:b2) +!$omp end target +!$omp target map(close, always, to:b3) +!$omp end target +!$omp target map(always close to:b4) +!$omp end target +!$omp target map(always, close to:b5) +!$omp end target +!$omp target map(always, close, to:b6) +!$omp end target + + +!$omp target map (always to : a) map (close to : b) +!$omp end target + +end + +! { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } } + +! { dg-final { scan-tree-dump-times "#pragma omp target map\\(always,to:" 9 "original" } } + +! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b1\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b2\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b3\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b4\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b5\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:b6\\)" "original" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/map-7.f90 b/gcc/testsuite/gfortran.dg/gomp/map-7.f90 new file mode 100644 index 0000000..009c6d4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/map-7.f90 @@ -0,0 +1,26 @@ +! { dg-additional-options "-fdump-tree-original" } + +implicit none + +integer :: a, b, close, always, to + +!$omp target map(close) +!$omp end target + +!$omp target map(always) +!$omp end target + +!$omp target map(always, close) +!$omp end target + +!$omp target map(always, close, to : always, close, a) +!$omp end target + +!$omp target map(to, always, close) +!$omp end target + +end + +! { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } } +! { dg-final { scan-tree-dump "#pragma omp target map\\(always,to:always\\) map\\(always,to:close\\) map\\(always,to:a\\)" "original" } } +! { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/map-8.f90 b/gcc/testsuite/gfortran.dg/gomp/map-8.f90 new file mode 100644 index 0000000..92b802c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/map-8.f90 @@ -0,0 +1,34 @@ +implicit none + +integer :: a + +!$omp target map(close, delete: a) ! { dg-error "TARGET with map-type other than TO, FROM, TOFROM, or ALLOC on MAP clause at \\(1\\)" } +!$omp end target + +!$omp target map(close) ! { dg-error "Symbol 'close' at \\(1\\) has no IMPLICIT type" } +!$omp end target + +!$omp target map(always) ! { dg-error "Symbol 'always' at \\(1\\) has no IMPLICIT type" } +!$omp end target + +!$omp target map(always, always, to : a) ! { dg-error "too many 'always' modifiers" } +! !$omp end target +!$omp target map(always always, to : a) ! { dg-error "too many 'always' modifiers" } +! !$omp end target +!$omp target map(always, always to : a) ! { dg-error "too many 'always' modifiers" } +! !$omp end target +!$omp target map(always always to : a) ! { dg-error "too many 'always' modifiers" } +! !$omp end target +!$omp target map(close, close, to : a) ! { dg-error "too many 'close' modifiers" } +! !$omp end target +!$omp target map(close close, to : a) ! { dg-error "too many 'close' modifiers" } +! !$omp end target +!$omp target map(close, close to : a) ! { dg-error "too many 'close' modifiers" } +! !$omp end target +!$omp target map(close close to : a) ! { dg-error "too many 'close' modifiers" } +! !$omp end target + +!$omp target map(close close always always to : a) ! { dg-error "too many 'always' modifiers" } +! !$omp end target + +end diff --git a/gcc/testsuite/gfortran.dg/pr100551.f90 b/gcc/testsuite/gfortran.dg/pr100551.f90 new file mode 100644 index 0000000..f82f505 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr100551.f90 @@ -0,0 +1,30 @@ +! { dg-do run } +! PR fortran/100551 - Passing return value to class(*) dummy argument + +program p + implicit none + integer :: result + result = 1 + result = test ( (result)) ! works + if (result /= 1) stop 1 + result = test (int (result)) ! issue 1 +! write(*,*) result + if (result /= 1) stop 2 + result = test (f (result)) ! issue 2 +! write(*,*) result + if (result /= 2) stop 3 +contains + integer function test(x) + class(*), intent(in) :: x + select type (x) + type is (integer) + test = x + class default + test = -1 + end select + end function test + integer function f(x) + integer, intent(in) :: x + f = 2*x + end function f +end program diff --git a/gcc/testsuite/gfortran.dg/pr96711.f90 b/gcc/testsuite/gfortran.dg/pr96711.f90 index 3761a8e..3fa5d99 100644 --- a/gcc/testsuite/gfortran.dg/pr96711.f90 +++ b/gcc/testsuite/gfortran.dg/pr96711.f90 @@ -10,10 +10,12 @@ program p implicit none real(8) :: x real(16) :: y + ! Assume radix(x) == 2 + ! 2/epsilon(x) = 2/(radix(x)**(1-digits(x)) = 2**digits(x) with that assumption integer(16), parameter :: k1 = nint (2 / epsilon (x), kind(k1)) integer(16), parameter :: k2 = nint (2 / epsilon (y), kind(k2)) - integer(16), parameter :: m1 = 9007199254740992_16 !2**53 - integer(16), parameter :: m2 = 10384593717069655257060992658440192_16 !2**113 + integer(16), parameter :: m1 = 2_16**digits(x) ! IEEE: 2**53 + integer(16), parameter :: m2 = 2_16**digits(y) ! IEEE: 2**113 integer(16), volatile :: m x = 2 / epsilon (x) y = 2 / epsilon (y) diff --git a/gcc/testsuite/gnat.dg/derived_type7.adb b/gcc/testsuite/gnat.dg/derived_type7.adb new file mode 100644 index 0000000..61e7aba --- /dev/null +++ b/gcc/testsuite/gnat.dg/derived_type7.adb @@ -0,0 +1,9 @@ +package body Derived_Type7 is + + procedure Proc (Size : Natural) is + type Sar_Six_Bit_Arr is new Six_Bit_Data_Array_Type (1 .. Size); + begin + null; + end; + +end Derived_Type7; diff --git a/gcc/testsuite/gnat.dg/derived_type7.ads b/gcc/testsuite/gnat.dg/derived_type7.ads new file mode 100644 index 0000000..2b1427a --- /dev/null +++ b/gcc/testsuite/gnat.dg/derived_type7.ads @@ -0,0 +1,13 @@ +-- { dg-do compile } + +package Derived_Type7 is + + type Six_Bit_Data_Type is range 0 .. 63; + for Six_Bit_Data_Type'Size use 6; + + type Six_Bit_Data_Array_Type is array (Integer range <>) of Six_Bit_Data_Type; + for Six_Bit_Data_Array_Type'Component_Size use 6; + + procedure Proc (Size : Natural); + +end Derived_Type7; diff --git a/gcc/testsuite/gnat.dg/unchecked_convert5.adb b/gcc/testsuite/gnat.dg/unchecked_convert5.adb index e3e4312..9c24d66 100644 --- a/gcc/testsuite/gnat.dg/unchecked_convert5.adb +++ b/gcc/testsuite/gnat.dg/unchecked_convert5.adb @@ -1,4 +1,4 @@ --- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } } +-- { dg-do run { target hppa*-*-* sparc*-*-* powerpc-*-* powerpc64-*-* } } with Unchecked_Conversion; diff --git a/gcc/testsuite/gnat.dg/unchecked_convert6.adb b/gcc/testsuite/gnat.dg/unchecked_convert6.adb index a26a6a9..ce8cc10 100644 --- a/gcc/testsuite/gnat.dg/unchecked_convert6.adb +++ b/gcc/testsuite/gnat.dg/unchecked_convert6.adb @@ -1,4 +1,4 @@ --- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } } +-- { dg-do run { target hppa*-*-* sparc*-*-* powerpc-*-* powerpc64-*-* } } with Unchecked_Conversion; diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp index 1f60fde..bb0ce46 100644 --- a/gcc/testsuite/lib/dg-pch.exp +++ b/gcc/testsuite/lib/dg-pch.exp @@ -28,7 +28,7 @@ proc pch-init { args } { set result [check_compile pchtest object "int i;" "-g -x c-header"] set pch_unsupported_debug \ - [regexp "debug format cannot be used with pre-compiled headers" \ + [regexp "debug info cannot be used with pre-compiled headers" \ [lindex $result 0]] remote_file build delete [lindex $result 1] @@ -38,7 +38,7 @@ proc pch-init { args } { set result [check_compile pchtest object "int i;" "-x c-header"] set pch_unsupported \ - [regexp "debug format cannot be used with pre-compiled headers" \ + [regexp "debug info cannot be used with pre-compiled headers" \ [lindex $result 0]] remote_file build delete [lindex $result 1] } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index e48a184..fce0989 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1012,6 +1012,8 @@ if { [info procs saved-dg-test] == [list] } { } unset save_linenr_varnames } + + initialize_prune_notes } proc dg-test { args } { @@ -1245,6 +1247,36 @@ proc dg-missed { args } { process-message saved-dg-warning "missed:" "$args" } +# Look for messages with 'note: ' prefixes. +# In addition to standard compiler diagnostics ('DK_NOTE', 'inform' functions, +# "for additional details on an error message"), +# this also includes output from '-fopt-info' for 'MSG_NOTE': +# a general optimization info. +# By default, any *excess* notes are pruned, meaning their appearance doesn't +# trigger *excess errors*. However, if 'dg-note' is used at least once in a +# testcase, they're not pruned and instead must *all* be handled explicitly. +# Thus, if looking for just single instances of messages with 'note: ' prefixes +# without caring for all of them, use 'dg-message "note: [...]"' instead of +# 'dg-note', or use 'dg-note' together with 'dg-prune-output "note: "'. + +variable prune_notes + +proc initialize_prune_notes { } { + global prune_notes + set prune_notes 1 +} + +initialize_prune_notes + +proc dg-note { args } { + upvar dg-messages dg-messages + + global prune_notes + set prune_notes 0 + + process-message saved-dg-warning "note:" "$args" +} + # Check the existence of a gdb in the path, and return true if there # is one. # diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp index 77919e8..d0e0dc6 100644 --- a/gcc/testsuite/lib/lto.exp +++ b/gcc/testsuite/lib/lto.exp @@ -161,9 +161,13 @@ proc lto_prune_warns { text } { # Ignore missing jobserver for tests that do more than 1 LTRANS unit regsub -all "(^|\n)\[^\n\]*: warning: using serial compilation of \[^\n\]*" $text "" text + regsub -all "(^|\n)\[^\n\]*: note: see the \[^\n\]*'-flto' option documentation\[^\n\]* for more information" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } verbose "lto_prune_warns: exit: $text" 2 @@ -390,8 +394,8 @@ proc lto-can-handle-directive { op } { # A list of directives to recognize, and a list of directives # to remap them to. # For example, "dg-lto-warning" is implemented by calling "dg-warning". - set directives { dg-lto-warning dg-lto-message } - set remapped_directives { dg-warning dg-message } + set directives { dg-lto-warning dg-lto-message dg-lto-note } + set remapped_directives { dg-warning dg-message dg-note } set idx [lsearch -exact $directives $cmd] if { $idx != -1 } { @@ -597,7 +601,7 @@ proc lto-get-options { src } { # # SRC1 is the full pathname of the main file of the testcase. # SID identifies a test suite in the names of temporary files. -proc lto-execute { src1 sid } { +proc lto-execute-1 { src1 sid } { global srcdir tmpdir global lto_option_list global tool @@ -811,6 +815,14 @@ proc lto-execute { src1 sid } { } } +proc lto-execute { src1 sid } { + lto-execute-1 $src1 $sid + + # LTO testing doesn't use 'dg-runtest'/'dg-test', and thus doesn't call + # 'cleanup-after-saved-dg-test', so we have to clean up manually. + initialize_prune_notes +} + # Call pass if object readelf is ok, otherwise fail. # example: /* { dg-final { object-readelf Tag_ABI_enum_size int} } */ proc object-readelf { args } { diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp index 2809f88..91f165b 100644 --- a/gcc/testsuite/lib/prune.exp +++ b/gcc/testsuite/lib/prune.exp @@ -54,8 +54,11 @@ proc prune_gcc_output { text } { regsub -all "(^|\n)\[ \]+from \[^\n\]*" $text "" text regsub -all "(^|\n)(In|of) module( \[^\n \]*,)? imported at \[^\n\]*" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } # Ignore harmless -fpic warnings. regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 8192da5..849f1bb 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11103,3 +11103,13 @@ proc check_effective_target_lra { } { return 1 } +# Test whether optimizations are enabled ('__OPTIMIZE__') per the +# 'current_compiler_flags' (thus don't cache). + +proc check_effective_target___OPTIMIZE__ {} { + return [check_no_compiler_messages_nocache __OPTIMIZE__ assembly { + #ifndef __OPTIMIZE__ + # error nein + #endif + } [current_compiler_flags]] +} diff --git a/gcc/toplev.c b/gcc/toplev.c index 7e23253..6a6ebe9 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1461,9 +1461,12 @@ process_options (void) debug_hooks = &dwarf2_lineno_debug_hooks; #endif else - error_at (UNKNOWN_LOCATION, - "target system does not support the %qs debug format", - debug_type_names[write_symbols]); + { + gcc_assert (debug_set_count (write_symbols) <= 1); + error_at (UNKNOWN_LOCATION, + "target system does not support the %qs debug format", + debug_type_names[debug_set_to_format (write_symbols)]); + } /* We know which debug output will be used so we can set flag_var_tracking and flag_var_tracking_uninit if the user has not specified them. */ @@ -1524,8 +1527,7 @@ process_options (void) debug_nonbind_markers_p = (optimize && debug_info_level >= DINFO_LEVEL_NORMAL - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + && dwarf_debuginfo_p () && !(flag_selective_scheduling || flag_selective_scheduling2)); if (dwarf2out_as_loc_support == AUTODETECT_VALUE) @@ -1540,8 +1542,7 @@ process_options (void) debug_variable_location_views = (flag_var_tracking && debug_info_level >= DINFO_LEVEL_NORMAL - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + && dwarf_debuginfo_p () && !dwarf_strict && dwarf2out_as_loc_support && dwarf2out_as_locview_support); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index f8d15ff..0225658 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3036,40 +3036,6 @@ verify_address (tree t, bool verify_addressable) } -/* Verify if EXPR is either a GIMPLE ID or a GIMPLE indirect reference. - Returns true if there is an error, otherwise false. */ - -static bool -verify_types_in_gimple_min_lval (tree expr) -{ - tree op; - - if (is_gimple_id (expr)) - return false; - - if (TREE_CODE (expr) != TARGET_MEM_REF - && TREE_CODE (expr) != MEM_REF) - { - error ("invalid expression for min lvalue"); - return true; - } - - /* TARGET_MEM_REFs are strange beasts. */ - if (TREE_CODE (expr) == TARGET_MEM_REF) - return false; - - op = TREE_OPERAND (expr, 0); - if (!is_gimple_val (op)) - { - error ("invalid operand in indirect reference"); - debug_generic_stmt (op); - return true; - } - /* Memory references now generally can involve a value conversion. */ - - return false; -} - /* Verify if EXPR is a valid GIMPLE reference expression. If REQUIRE_LVALUE is true verifies it is an lvalue. Returns true if there is an error, otherwise false. */ @@ -3307,8 +3273,21 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) return true; } - return ((require_lvalue || !is_gimple_min_invariant (expr)) - && verify_types_in_gimple_min_lval (expr)); + if (!require_lvalue + && (TREE_CODE (expr) == SSA_NAME || is_gimple_min_invariant (expr))) + return false; + + if (TREE_CODE (expr) != SSA_NAME && is_gimple_id (expr)) + return false; + + if (TREE_CODE (expr) != TARGET_MEM_REF + && TREE_CODE (expr) != MEM_REF) + { + error ("invalid expression for min lvalue"); + return true; + } + + return false; } /* Returns true if there is one pointer type in TYPE_POINTER_TO (SRC_OBJ) @@ -3398,8 +3377,11 @@ verify_gimple_call (gcall *stmt) tree lhs = gimple_call_lhs (stmt); if (lhs - && (!is_gimple_lvalue (lhs) - || verify_types_in_gimple_reference (lhs, true))) + && (!is_gimple_reg (lhs) + && (!is_gimple_lvalue (lhs) + || verify_types_in_gimple_reference + (TREE_CODE (lhs) == WITH_SIZE_EXPR + ? TREE_OPERAND (lhs, 0) : lhs, true)))) { error ("invalid LHS in gimple call"); return true; @@ -3488,6 +3470,13 @@ verify_gimple_call (gcall *stmt) debug_generic_expr (arg); return true; } + if (!is_gimple_reg (arg)) + { + if (TREE_CODE (arg) == WITH_SIZE_EXPR) + arg = TREE_OPERAND (arg, 0); + if (verify_types_in_gimple_reference (arg, false)) + return true; + } } return false; @@ -4479,6 +4468,14 @@ verify_gimple_assign_single (gassign *stmt) return true; } + if (TREE_CODE (lhs) == WITH_SIZE_EXPR) + { + error ("%qs LHS in assignment statement", + get_tree_code_name (TREE_CODE (lhs))); + debug_generic_expr (lhs); + return true; + } + if (handled_component_p (lhs) || TREE_CODE (lhs) == MEM_REF || TREE_CODE (lhs) == TARGET_MEM_REF) @@ -4669,8 +4666,13 @@ verify_gimple_assign_single (gassign *stmt) } break; - case OBJ_TYPE_REF: case WITH_SIZE_EXPR: + error ("%qs RHS in assignment statement", + get_tree_code_name (rhs_code)); + debug_generic_expr (rhs1); + return true; + + case OBJ_TYPE_REF: /* FIXME. */ return res; diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 0482b05..c6c3bd6 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -394,6 +394,11 @@ get_ref_base_and_extent (tree exp, poly_int64_pod *poffset, size_tree = DECL_SIZE (TREE_OPERAND (exp, 1)); else if (TREE_CODE (exp) == BIT_FIELD_REF) size_tree = TREE_OPERAND (exp, 1); + else if (TREE_CODE (exp) == WITH_SIZE_EXPR) + { + size_tree = TREE_OPERAND (exp, 1); + exp = TREE_OPERAND (exp, 0); + } else if (!VOID_TYPE_P (TREE_TYPE (exp))) { machine_mode mode = TYPE_MODE (TREE_TYPE (exp)); diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 6c7d2f1b..0421bfa 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -722,6 +722,8 @@ ao_ref_base_alias_set (ao_ref *ref) if (!ref->ref) return 0; base_ref = ref->ref; + if (TREE_CODE (base_ref) == WITH_SIZE_EXPR) + base_ref = TREE_OPERAND (base_ref, 0); while (handled_component_p (base_ref)) base_ref = TREE_OPERAND (base_ref, 0); ref->base_alias_set = get_alias_set (base_ref); @@ -752,6 +754,8 @@ ao_ref_base_alias_ptr_type (ao_ref *ref) if (!ref->ref) return NULL_TREE; base_ref = ref->ref; + if (TREE_CODE (base_ref) == WITH_SIZE_EXPR) + base_ref = TREE_OPERAND (base_ref, 0); while (handled_component_p (base_ref)) base_ref = TREE_OPERAND (base_ref, 0); tree ret = reference_alias_ptr_type (base_ref); @@ -2314,14 +2318,16 @@ refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) || TREE_CODE (ref1->ref) == STRING_CST || handled_component_p (ref1->ref) || TREE_CODE (ref1->ref) == MEM_REF - || TREE_CODE (ref1->ref) == TARGET_MEM_REF) + || TREE_CODE (ref1->ref) == TARGET_MEM_REF + || TREE_CODE (ref1->ref) == WITH_SIZE_EXPR) && (!ref2->ref || TREE_CODE (ref2->ref) == SSA_NAME || DECL_P (ref2->ref) || TREE_CODE (ref2->ref) == STRING_CST || handled_component_p (ref2->ref) || TREE_CODE (ref2->ref) == MEM_REF - || TREE_CODE (ref2->ref) == TARGET_MEM_REF)); + || TREE_CODE (ref2->ref) == TARGET_MEM_REF + || TREE_CODE (ref2->ref) == WITH_SIZE_EXPR)); /* Decompose the references into their base objects and the access. */ base1 = ao_ref_base (ref1); @@ -2360,6 +2366,15 @@ refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) && ref2->volatile_p) return true; + /* refN->ref may convey size information, do not confuse our workers + with that but strip it - ao_ref_base took it into account already. */ + tree ref1ref = ref1->ref; + if (ref1ref && TREE_CODE (ref1ref) == WITH_SIZE_EXPR) + ref1ref = TREE_OPERAND (ref1ref, 0); + tree ref2ref = ref2->ref; + if (ref2ref && TREE_CODE (ref2ref) == WITH_SIZE_EXPR) + ref2ref = TREE_OPERAND (ref2ref, 0); + /* Defer to simple offset based disambiguation if we have references based on two decls. Do this before defering to TBAA to handle must-alias cases in conformance with the @@ -2367,9 +2382,9 @@ refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) var1_p = DECL_P (base1); var2_p = DECL_P (base2); if (var1_p && var2_p) - return decl_refs_may_alias_p (ref1->ref, base1, offset1, max_size1, + return decl_refs_may_alias_p (ref1ref, base1, offset1, max_size1, ref1->size, - ref2->ref, base2, offset2, max_size2, + ref2ref, base2, offset2, max_size2, ref2->size); /* Handle restrict based accesses. @@ -2379,14 +2394,14 @@ refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) tree rbase2 = base2; if (var1_p) { - rbase1 = ref1->ref; + rbase1 = ref1ref; if (rbase1) while (handled_component_p (rbase1)) rbase1 = TREE_OPERAND (rbase1, 0); } if (var2_p) { - rbase2 = ref2->ref; + rbase2 = ref2ref; if (rbase2) while (handled_component_p (rbase2)) rbase2 = TREE_OPERAND (rbase2, 0); @@ -2412,6 +2427,7 @@ refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) std::swap (max_size1, max_size2); std::swap (base1, base2); std::swap (ref1, ref2); + std::swap (ref1ref, ref2ref); var1_p = true; ind1_p = false; var2_p = false; @@ -2437,21 +2453,21 @@ refs_may_alias_p_2 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) /* Dispatch to the pointer-vs-decl or pointer-vs-pointer disambiguators. */ if (var1_p && ind2_p) - return indirect_ref_may_alias_decl_p (ref2->ref, base2, + return indirect_ref_may_alias_decl_p (ref2ref, base2, offset2, max_size2, ref2->size, ao_ref_alias_set (ref2), ao_ref_base_alias_set (ref2), - ref1->ref, base1, + ref1ref, base1, offset1, max_size1, ref1->size, ao_ref_alias_set (ref1), ao_ref_base_alias_set (ref1), tbaa_p); else if (ind1_p && ind2_p) - return indirect_refs_may_alias_p (ref1->ref, base1, + return indirect_refs_may_alias_p (ref1ref, base1, offset1, max_size1, ref1->size, ao_ref_alias_set (ref1), ao_ref_base_alias_set (ref1), - ref2->ref, base2, + ref2ref, base2, offset2, max_size2, ref2->size, ao_ref_alias_set (ref2), ao_ref_base_alias_set (ref2), diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index bf31f03..3834212 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -3536,6 +3536,7 @@ pass_post_ipa_warn::execute (function *fun) continue; tree fndecl = gimple_call_fndecl (stmt); + const bool closure = fndecl && DECL_LAMBDA_FUNCTION_P (fndecl); for (unsigned i = 0; i < gimple_call_num_args (stmt); i++) { @@ -3544,6 +3545,9 @@ pass_post_ipa_warn::execute (function *fun) continue; if (!integer_zerop (arg)) continue; + if (i == 0 && closure) + /* Avoid warning for the first argument to lambda functions. */ + continue; if (!bitmap_empty_p (nonnullargs) && !bitmap_bit_p (nonnullargs, i)) continue; diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index c091868..def6ae6 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -452,7 +452,7 @@ ref_may_be_aliased (tree ref) gcc_assert (TREE_CODE (ref) != WITH_SIZE_EXPR); while (handled_component_p (ref)) ref = TREE_OPERAND (ref, 0); - if (TREE_CODE (ref) == MEM_REF + if ((TREE_CODE (ref) == MEM_REF || TREE_CODE (ref) == TARGET_MEM_REF) && TREE_CODE (TREE_OPERAND (ref, 0)) == ADDR_EXPR) ref = TREE_OPERAND (TREE_OPERAND (ref, 0), 0); return !(DECL_P (ref) diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 9e62088..c155754 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -626,15 +626,10 @@ mark_address_taken (tree ref) be referenced using pointer arithmetic. See PR 21407 and the ensuing mailing list discussion. */ var = get_base_address (ref); - if (var) - { - if (DECL_P (var)) - TREE_ADDRESSABLE (var) = 1; - else if (TREE_CODE (var) == MEM_REF - && TREE_CODE (TREE_OPERAND (var, 0)) == ADDR_EXPR - && DECL_P (TREE_OPERAND (TREE_OPERAND (var, 0), 0))) - TREE_ADDRESSABLE (TREE_OPERAND (TREE_OPERAND (var, 0), 0)) = 1; - } + if (VAR_P (var) + || TREE_CODE (var) == RESULT_DECL + || TREE_CODE (var) == PARM_DECL) + TREE_ADDRESSABLE (var) = 1; } @@ -674,7 +669,9 @@ operands_scanner::get_tmr_operands(tree expr, int flags) gimple_set_has_volatile_ops (stmt, true); /* First record the real operands. */ - get_expr_operands (&TMR_BASE (expr), opf_use | (flags & opf_no_vops)); + get_expr_operands (&TMR_BASE (expr), + opf_non_addressable | opf_use + | (flags & (opf_no_vops|opf_not_non_addressable))); get_expr_operands (&TMR_INDEX (expr), opf_use | (flags & opf_no_vops)); get_expr_operands (&TMR_INDEX2 (expr), opf_use | (flags & opf_no_vops)); diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 8e8a08b..f133659 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1988,8 +1988,16 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb, gcond *cond1 = as_a <gcond *> (last_stmt (cond_bb)); enum tree_code cmp1 = gimple_cond_code (cond1); - if (cmp1 != LT_EXPR && cmp1 != GT_EXPR) - return false; + switch (cmp1) + { + case LT_EXPR: + case LE_EXPR: + case GT_EXPR: + case GE_EXPR: + break; + default: + return false; + } tree lhs1 = gimple_cond_lhs (cond1); tree rhs1 = gimple_cond_rhs (cond1); /* The optimization may be unsafe due to NaNs. */ @@ -2029,7 +2037,42 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb, if (lhs2 == lhs1) { if (!operand_equal_p (rhs2, rhs1, 0)) - return false; + { + if ((cmp2 == EQ_EXPR || cmp2 == NE_EXPR) + && TREE_CODE (rhs1) == INTEGER_CST + && TREE_CODE (rhs2) == INTEGER_CST) + { + /* For integers, we can have cond2 x == 5 + and cond1 x < 5, x <= 4, x <= 5, x < 6, + x > 5, x >= 6, x >= 5 or x > 4. */ + if (tree_int_cst_lt (rhs1, rhs2)) + { + if (wi::ne_p (wi::to_wide (rhs1) + 1, wi::to_wide (rhs2))) + return false; + if (cmp1 == LE_EXPR) + cmp1 = LT_EXPR; + else if (cmp1 == GT_EXPR) + cmp1 = GE_EXPR; + else + return false; + } + else + { + gcc_checking_assert (tree_int_cst_lt (rhs2, rhs1)); + if (wi::ne_p (wi::to_wide (rhs2) + 1, wi::to_wide (rhs1))) + return false; + if (cmp1 == LT_EXPR) + cmp1 = LE_EXPR; + else if (cmp1 == GE_EXPR) + cmp1 = GT_EXPR; + else + return false; + } + rhs1 = rhs2; + } + else + return false; + } } else if (lhs2 == rhs1) { @@ -2061,20 +2104,30 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb, || absu_hwi (tree_to_shwi (arg0)) != 1 || wi::to_widest (arg0) == wi::to_widest (arg1)) return false; - if (cmp2 != LT_EXPR && cmp2 != GT_EXPR) - return false; + switch (cmp2) + { + case LT_EXPR: + case LE_EXPR: + case GT_EXPR: + case GE_EXPR: + break; + default: + return false; + } /* if (x < y) goto phi_bb; else fallthru; if (x > y) goto phi_bb; else fallthru; bbx:; phi_bb:; is ok, but if x and y are swapped in one of the comparisons, or the comparisons are the same and operands not swapped, - or second goto phi_bb is not the true edge, it is not. */ + or the true and false edges are swapped, it is not. */ if ((lhs2 == lhs1) - ^ (cmp2 == cmp1) - ^ ((e1->flags & EDGE_TRUE_VALUE) != 0)) - return false; - if ((cond2_phi_edge->flags & EDGE_TRUE_VALUE) == 0) + ^ (((cond2_phi_edge->flags + & ((cmp2 == LT_EXPR || cmp2 == LE_EXPR) + ? EDGE_TRUE_VALUE : EDGE_FALSE_VALUE)) != 0) + != ((e1->flags + & ((cmp1 == LT_EXPR || cmp1 == LE_EXPR) + ? EDGE_TRUE_VALUE : EDGE_FALSE_VALUE)) != 0))) return false; if (!single_pred_p (cond2_bb) || !cond_only_block_p (cond2_bb)) return false; @@ -2124,7 +2177,7 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb, /* lhs1 one_cmp rhs1 results in phires of 1. */ enum tree_code one_cmp; - if ((cmp1 == LT_EXPR) + if ((cmp1 == LT_EXPR || cmp1 == LE_EXPR) ^ (!integer_onep ((e1->flags & EDGE_TRUE_VALUE) ? arg1 : arg0))) one_cmp = LT_EXPR; else diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index d33e56e..d252cbb 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -819,6 +819,7 @@ public: /* opt_pass methods: */ virtual bool gate (function *) { return flag_tree_sink != 0; } virtual unsigned int execute (function *); + opt_pass *clone (void) { return new pass_sink_code (m_ctxt); } }; // class pass_sink_code diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index cf54c89..4cc400d 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1494,6 +1494,16 @@ non_rewritable_mem_ref_base (tree ref) return decl; } + /* We cannot rewrite TARGET_MEM_REFs. */ + if (TREE_CODE (base) == TARGET_MEM_REF + && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) + { + tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0); + if (! DECL_P (decl)) + return NULL_TREE; + return decl; + } + return NULL_TREE; } diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index f10e66a..ff7673d 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -836,6 +836,7 @@ _loop_vec_info::_loop_vec_info (class loop *loop_in, vec_info_shared *shared) single_scalar_iteration_cost (0), vec_outside_cost (0), vec_inside_cost (0), + inner_loop_cost_factor (param_vect_inner_loop_cost_factor), vectorizable (false), can_use_partial_vectors_p (param_vect_partial_vector_usage != 0), using_partial_vectors_p (false), @@ -1237,7 +1238,7 @@ vect_compute_single_scalar_iteration_cost (loop_vec_info loop_vinfo) /* FORNOW. */ innerloop_iters = 1; if (loop->inner) - innerloop_iters = 50; /* FIXME */ + innerloop_iters = LOOP_VINFO_INNER_LOOP_COST_FACTOR (loop_vinfo); for (i = 0; i < nbbs; i++) { diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 8d1ffaf..7dcb4cd 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -689,6 +689,10 @@ public: /* The cost of the vector loop body. */ int vec_inside_cost; + /* The factor used to over weight those statements in an inner loop + relative to the loop being vectorized. */ + unsigned int inner_loop_cost_factor; + /* Is the loop vectorizable? */ bool vectorizable; @@ -807,6 +811,7 @@ public: #define LOOP_VINFO_SINGLE_SCALAR_ITERATION_COST(L) (L)->single_scalar_iteration_cost #define LOOP_VINFO_ORIG_LOOP_INFO(L) (L)->orig_loop_info #define LOOP_VINFO_SIMD_IF_COND(L) (L)->simd_if_cond +#define LOOP_VINFO_INNER_LOOP_COST_FACTOR(L) (L)->inner_loop_cost_factor #define LOOP_VINFO_FULLY_MASKED_P(L) \ (LOOP_VINFO_USING_PARTIAL_VECTORS_P (L) \ @@ -12382,6 +12382,8 @@ drop_tree_overflow (tree t) tree get_base_address (tree t) { + if (TREE_CODE (t) == WITH_SIZE_EXPR) + t = TREE_OPERAND (t, 0); while (handled_component_p (t)) t = TREE_OPERAND (t, 0); @@ -12390,11 +12392,6 @@ get_base_address (tree t) && TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR) t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); - /* ??? Either the alias oracle or all callers need to properly deal - with WITH_SIZE_EXPRs before we can look through those. */ - if (TREE_CODE (t) == WITH_SIZE_EXPR) - return NULL_TREE; - return t; } @@ -1502,6 +1502,11 @@ class auto_suppress_location_wrappers #define OMP_TARGET_COMBINED(NODE) \ (OMP_TARGET_CHECK (NODE)->base.private_flag) +/* True on an OMP_MASTER statement if it represents an explicit + combined master constructs. */ +#define OMP_MASTER_COMBINED(NODE) \ + (OMP_MASTER_CHECK (NODE)->base.private_flag) + /* Memory order for OMP_ATOMIC*. */ #define OMP_ATOMIC_MEMORY_ORDER(NODE) \ (TREE_RANGE_CHECK (NODE, OMP_ATOMIC, \ @@ -1533,6 +1538,11 @@ class auto_suppress_location_wrappers #define OMP_CLAUSE_FIRSTPRIVATE_NO_REFERENCE(NODE) \ TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FIRSTPRIVATE)) +/* True on a FIRSTPRIVATE clause with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT also + set if target construct is the only one that accepts the clause. */ +#define OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET(NODE) \ + TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FIRSTPRIVATE)) + /* True on a LASTPRIVATE clause if a FIRSTPRIVATE clause for the same decl is present in the chain. */ #define OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE(NODE) \ diff --git a/gcc/vr-values.c b/gcc/vr-values.c index b1bf53a..02bc0db 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -1229,7 +1229,7 @@ vr_values::extract_range_basic (value_range_equiv *vr, gimple *stmt) return; break; default: - if (range_of_builtin_call (*this, *vr, as_a<gcall *> (stmt))) + if (fold_range (*vr, stmt, this)) { /* The original code nuked equivalences every time a range was found, so do the same here. */ diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 0d2c86f..ea3bec8 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,17 @@ +2021-05-20 Christophe Lyon <christophe.lyon@linaro.org> + Torbjörn Svensson <torbjorn.svensson@st.com> + + PR c/42579 + * include/cpplib.h (cpp_builtin_type): Add BT_FILE_NAME entry. + * init.c (builtin_array): Likewise. + * macro.c (_cpp_builtin_macro_text): Add support for BT_FILE_NAME. + +2021-05-20 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/100646 + * lex.c (cpp_directive_only_process): Treat end of file as termination + for !is_block comments. + 2021-05-12 Jakub Jelinek <jakub@redhat.com> PR preprocessor/100392 diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 2cdaf19..7e84063 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -886,6 +886,7 @@ enum cpp_builtin_type BT_SPECLINE = 0, /* `__LINE__' */ BT_DATE, /* `__DATE__' */ BT_FILE, /* `__FILE__' */ + BT_FILE_NAME, /* `__FILE_NAME__' */ BT_BASE_FILE, /* `__BASE_FILE__' */ BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ BT_TIME, /* `__TIME__' */ diff --git a/libcpp/init.c b/libcpp/init.c index d5d4e99..a450470 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -405,6 +405,7 @@ static const struct builtin_macro builtin_array[] = B("__TIME__", BT_TIME, false), B("__DATE__", BT_DATE, false), B("__FILE__", BT_FILE, false), + B("__FILE_NAME__", BT_FILE_NAME, false), B("__BASE_FILE__", BT_BASE_FILE, false), B("__LINE__", BT_SPECLINE, true), B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL, true), diff --git a/libcpp/lex.c b/libcpp/lex.c index 6fd722a..3618fa5 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -4480,8 +4480,9 @@ cpp_directive_only_process (cpp_reader *pfile, break; } } - cpp_error_with_line (pfile, CPP_DL_ERROR, sloc, 0, - "unterminated comment"); + if (pos < limit || is_block) + cpp_error_with_line (pfile, CPP_DL_ERROR, sloc, 0, + "unterminated comment"); done_comment: lwm = pos; break; diff --git a/libcpp/macro.c b/libcpp/macro.c index dff7c98..4fc5f83 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -531,15 +531,21 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node, } break; case BT_FILE: + case BT_FILE_NAME: case BT_BASE_FILE: { unsigned int len; const char *name; uchar *buf; - - if (node->value.builtin == BT_FILE) - name = linemap_get_expansion_filename (pfile->line_table, - pfile->line_table->highest_line); + + if (node->value.builtin == BT_FILE + || node->value.builtin == BT_FILE_NAME) + { + name = linemap_get_expansion_filename (pfile->line_table, + pfile->line_table->highest_line); + if ((node->value.builtin == BT_FILE_NAME) && name) + name = lbasename (name); + } else { name = _cpp_get_file_name (pfile->main_file); diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 27d79ae..5776572 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,11 @@ +2021-05-22 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/98301 + * caf/libcaf.h (_gfortran_caf_random_init): New function. + * caf/single.c (_gfortran_caf_random_init): New function. + * gfortran.map: Added fndecl. + * intrinsics/random_init.f90: Implement random_init. + 2021-05-05 Tobias Burnus <tobias@codesourcery.com> * intrinsics/chmod.c (chmod_internal): Only declare mode_mask var diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h index 5abb753..c66d037 100644 --- a/libgfortran/caf/libcaf.h +++ b/libgfortran/caf/libcaf.h @@ -261,4 +261,6 @@ void _gfortran_caf_stopped_images (gfc_descriptor_t *, int _gfortran_caf_is_present (caf_token_t, int, caf_reference_t *); +void _gfortran_caf_random_init (bool, bool); + #endif /* LIBCAF_H */ diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c index a291c44..fc8e3b3 100644 --- a/libgfortran/caf/single.c +++ b/libgfortran/caf/single.c @@ -3135,3 +3135,13 @@ _gfortran_caf_is_present (caf_token_t token, } return memptr != NULL; } + +/* Reference the libraries implementation. */ +extern void _gfortran_random_init (int32_t, int32_t, int32_t); + +void _gfortran_caf_random_init (bool repeatable, bool image_distinct) +{ + /* In a single image implementation always forward to the gfortran + routine. */ + _gfortran_random_init (repeatable, image_distinct, 1); +} diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map index f74436f..3257983 100644 --- a/libgfortran/gfortran.map +++ b/libgfortran/gfortran.map @@ -1629,3 +1629,8 @@ GFORTRAN_10.2 { _gfortran_mfindloc1_c10; _gfortran_sfindloc1_c10; } GFORTRAN_10; + +GFORTRAN_12 { + global: + _gfortran_caf_random_init; +} GFORTRAN_10.2; diff --git a/libgfortran/intrinsics/random_init.f90 b/libgfortran/intrinsics/random_init.f90 index e5b4087..1200225 100644 --- a/libgfortran/intrinsics/random_init.f90 +++ b/libgfortran/intrinsics/random_init.f90 @@ -1,94 +1,100 @@ ! Copyright (C) 2018-2021 Free Software Foundation, Inc. ! Contributed by Steven G. Kargl <kargl@gcc.gnu.org> -! +! ! This file is part of the GNU Fortran runtime library (libgfortran). -! +! ! Libgfortran 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 of the License, or (at your option) any later version. -! +! ! Libgfortran 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/>. ! -! ! WARNING: This file should never be compiled with an option that changes ! default logical kind from 4 to some other value or changes default integer -! kind from from 4 to some other value. -! -! -! There are four combinations of repeatable and image_distinct. If a program -! is compiled without the -fcoarray= option or with -fcoarray=single, then -! execution of the compiled executable does not use image_distinct as it is -! irrelevant (although required). The behavior is as follows: -! -! call random_init(.true., .true.) +! kind from 4 to some other value. ! -! The sequence of random numbers is repeatable within an instance of program -! execution. That is, calls to random_init(.true., .true.) during the -! execution will reset the sequence of RN to the same sequence. If the -! program is compiled with -fcoarray=lib and multiple images are instantiated, -! then each image accesses a repeatable distinct sequence of random numbers. -! There are no guarantees that multiple execution of the program will access -! the same sequence. +! There are four combinations of repeatable and image_distinct. The +! language below is from the F2018 standard (actually, J3/18-007r1). ! -! call random_init(.false., .false.) -! call random_init(.false., .true.) +! This routine is only used for non-coarray programs or with programs +! compiled with -fcoarray=single. Use of -fcoarray=lib or -fcoarray=shared +! requires different routines due to the need for communication between +! images under case(iv). ! -! The sequence of random numbers is determined from process-dependent seeds. -! On each execution of the executable, different seeds will be used. For -! -fcoarray=lib and multiple instantiated images, each image will use -! process-dependent seeds. In other words, the two calls have identical -! behavior. +! Technically, neither image_distinct nor image_num are now needed. The +! interface to _gfortran_random_init() is maintained for libgfortran ABI. +! Note, the Fortran standard requires the image_distinct argument, so +! it will always have a valid value, and the frontend generates an value +! of 0 for image_num. ! -! call random_init(.true., .false.) -! -! For a program compiled without the -fcoarray= option or with -! -fcoarray=single, a single image is instantiated when the executable is -! run. If the executable causes multiple images to be instantiated, then -! image_distinct=.false. in one image cannot affect the sequence of random -! numbers in another image. As gfortran gives each image its own independent -! PRNG, this condition is automatically satisfied. -! -impure subroutine _gfortran_random_init(repeatable, image_distinct, hidden) +impure subroutine _gfortran_random_init(repeatable, image_distinct, image_num) implicit none logical, value, intent(in) :: repeatable logical, value, intent(in) :: image_distinct - integer, value, intent(in) :: hidden + integer, value, intent(in) :: image_num logical, save :: once = .true. - integer :: nseed + integer :: nseed, lcg_seed integer, save, allocatable :: seed(:) - if (once) then - once = .false. - call random_seed(size=nseed) - allocate(seed(nseed)) - call random_seed(get=seed) + if (repeatable) then + if (once) then + once = .false. + call random_seed(size=nseed) + allocate(seed(nseed)) + lcg_seed = 57911963 + call _gfortran_lcg(seed) + end if + call random_seed(put=seed) + else + call random_seed() ! - ! To guarantee that seed is distinct on multiple images, add the hidden - ! argument (which is the image index). + ! This cannot happen; but, prevent gfortran complaining about + ! unused variables. ! - if (image_distinct) seed = seed + hidden + if (image_num > 2) then + block + use iso_fortran_env, only : error_unit + write(error_unit, '(A)') 'whoops: random_init(.false., .false.)' + if (image_distinct) error stop image_num + 1 + error stop image_num + end block + end if end if - if (repeatable) then - call random_seed(put=seed); - else - call random_seed(); - end if + contains + ! + ! SK Park and KW Miller, ``Random number generators: good ones are hard + ! to find,'' Comm. ACM, 31(10), 1192--1201, (1988). + ! + ! Implementation of a prime modulus multiplicative linear congruential + ! generator, which avoids overflow and provides the full period. + ! + impure elemental subroutine _gfortran_lcg(i) + implicit none + integer, intent(out) :: i + integer, parameter :: a = 16807 ! Multiplier + integer, parameter :: m = huge(a) ! Modulus + integer, parameter :: q = 127773 ! Quotient to avoid overflow + integer, parameter :: r = 2836 ! Remainder to avoid overflow + lcg_seed = a * mod(lcg_seed, q) - r * (lcg_seed / q) + if (lcg_seed <= 0) lcg_seed = lcg_seed + m + i = lcg_seed + end subroutine _gfortran_lcg end subroutine _gfortran_random_init diff --git a/libgo/configure b/libgo/configure index 70f64c9..915eeaf 100755 --- a/libgo/configure +++ b/libgo/configure @@ -11544,7 +11544,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11557 "configure" +#line 11547 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11650,7 +11650,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11663 "configure" +#line 11653 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libgo/go/compress/bzip2/testdata/Isaac.Newton-Opticks.txt.bz2 b/libgo/go/compress/bzip2/testdata/Isaac.Newton-Opticks.txt.bz2 Binary files differindex e69de29..6c56de3 100644 --- a/libgo/go/compress/bzip2/testdata/Isaac.Newton-Opticks.txt.bz2 +++ b/libgo/go/compress/bzip2/testdata/Isaac.Newton-Opticks.txt.bz2 diff --git a/libgo/go/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2 b/libgo/go/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2 Binary files differdeleted file mode 100644 index eac2b05..0000000 --- a/libgo/go/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2 +++ /dev/null diff --git a/libgo/go/runtime/testdata/testwinsignal/main.go b/libgo/go/runtime/testdata/testwinsignal/main.go index 1e7c947..d8cd884 100644 --- a/libgo/go/runtime/testdata/testwinsignal/main.go +++ b/libgo/go/runtime/testdata/testwinsignal/main.go @@ -1,19 +1,19 @@ -package main - -import ( - "fmt" - "os" - "os/signal" - "time" -) - -func main() { - c := make(chan os.Signal, 1) - signal.Notify(c) - - fmt.Println("ready") - sig := <-c - - time.Sleep(time.Second) - fmt.Println(sig) -} +package main
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "time"
+)
+
+func main() {
+ c := make(chan os.Signal, 1)
+ signal.Notify(c)
+
+ fmt.Println("ready")
+ sig := <-c
+
+ time.Sleep(time.Second)
+ fmt.Println(sig)
+}
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 8caeda0..8dec62e 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,178 @@ +2021-05-22 Thomas Schwinge <thomas@codesourcery.com> + + PR testsuite/90115 + * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Prune + uninteresting/varying diagnostics. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: Update. + * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90: New + file. + * testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Update. + * testsuite/libgomp.oacc-c-c++-common/host_data-7.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/private-variables.c: + Likewise. + * testsuite/libgomp.oacc-c-c++-common/routine-4.c: Likewise. + * testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: + Likewise. + * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. + * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. + * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. + * testsuite/libgomp.oacc-fortran/declare-1.f90: Likewise. + * testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise. + * testsuite/libgomp.oacc-fortran/if-1.f90: Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/optional-private.f90: Likewise. + * testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise. + * testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/private-variables.f90: Likewise. + * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise. + * testsuite/libgomp.oacc-fortran/routine-7.f90: Likewise. + +2021-05-21 Julian Brown <julian@codesourcery.com> + Chung-Lin Tang <cltang@codesourcery.com> + Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90115 + * testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c: New + test. + * testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90: + Likewise. + * testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90: + Likewise. + +2021-05-21 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Don't skip + for nvptx offloading. + +2021-05-21 Tobias Burnus <tobias@codesourcery.com> + + * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: New. + +2021-05-19 Thomas Schwinge <thomas@codesourcery.com> + + PR target/83812 + * testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c: New. + +2021-05-19 Julian Brown <julian@codesourcery.com> + + * testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: New. + +2021-05-18 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/lib/libgomp.exp + (check_effective_target_offload_target_nvptx): Don't shadow global + 'offload_targets' variable. + +2021-05-18 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/libgomp.c-c++-common/reduction-5.c: Restrict + '-latomic' to nvptx offloading compilation. + * testsuite/libgomp.c-c++-common/reduction-6.c: Likewise. + +2021-05-18 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/libgomp.c/target-44.c: Restrict '-latomic' to nvptx + offloading compilation. + 2021-05-17 Kwok Cheung Yeung <kcy@codesourcery.com> * task.c (omp_fulfill_event): Call gomp_team_barrier_set_task_pending diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 46cce9b..089c2bb 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -354,9 +354,9 @@ proc libgomp_check_effective_target_offload_target { target_name } { # decides. This is somewhat modelled after # 'gcc/testsuite/lib/target-supports.exp:check_configured_with'. set gcc_output [libgomp_target_compile "" "" "none" $options] - if [regexp "(?n)^OFFLOAD_TARGET_NAMES=(.*)" $gcc_output dummy offload_targets] { - verbose "compiling for offload targets: $offload_targets" - return [string match "*:$target_name*:*" ":$offload_targets:"] + if [regexp "(?n)^OFFLOAD_TARGET_NAMES=(.*)" $gcc_output dummy gcc_offload_targets] { + verbose "compiling for offload targets: $gcc_offload_targets" + return [string match "*:$target_name*:*" ":$gcc_offload_targets:"] } verbose "not compiling for $target_name offload target" diff --git a/libgomp/testsuite/libgomp.c-c++-common/reduction-5.c b/libgomp/testsuite/libgomp.c-c++-common/reduction-5.c index 2154051..31fa267 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/reduction-5.c +++ b/libgomp/testsuite/libgomp.c-c++-common/reduction-5.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-foffload=-latomic" { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=nvptx-none=-latomic" { target { offload_target_nvptx } } } */ /* C / C++'s logical AND and OR operators take any scalar argument which compares (un)equal to 0 - the result 1 or 0 and of type int. diff --git a/libgomp/testsuite/libgomp.c-c++-common/reduction-6.c b/libgomp/testsuite/libgomp.c-c++-common/reduction-6.c index 27d9ef6..727e11e 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/reduction-6.c +++ b/libgomp/testsuite/libgomp.c-c++-common/reduction-6.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-foffload=-latomic" { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=nvptx-none=-latomic" { target { offload_target_nvptx } } } */ /* C / C++'s logical AND and OR operators take any scalar argument which compares (un)equal to 0 - the result 1 or 0 and of type int. diff --git a/libgomp/testsuite/libgomp.c/target-44.c b/libgomp/testsuite/libgomp.c/target-44.c index 13e0c75..b95e807 100644 --- a/libgomp/testsuite/libgomp.c/target-44.c +++ b/libgomp/testsuite/libgomp.c/target-44.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-foffload=-latomic" { target { offload_target_nvptx } } } */ +/* { dg-additional-options "-foffload=nvptx-none=-latomic" { target { offload_target_nvptx } } } */ #include <stdlib.h> diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c index 0990e3d..fff0c28 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting aspects of that functionality. */ @@ -15,9 +21,11 @@ void t1 () ary[i] = ~0; #pragma acc parallel num_gangs (32) copy (ok) firstprivate (val) copy(ary, ondev) + /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { ondev = acc_on_device (acc_device_not_host); #pragma acc loop gang(static:1) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (unsigned i = 0; i < 32; i++) { if (val != 2) @@ -79,6 +87,7 @@ void t3 () #pragma acc parallel num_gangs (n) firstprivate (a) #pragma acc loop gang + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < n; i++) { a = a + i; @@ -124,6 +133,7 @@ void t4 () /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */ { #pragma acc loop gang + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) arr[i] += x; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-7.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-7.c index 6830ef1..66501e6 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-7.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-7.c @@ -1,6 +1,11 @@ -/* { dg-do run } */ - /* Test if, if_present clauses on host_data construct. */ + +/* { dg-additional-options "-fopt-info-all-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-all-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* C/C++ variant of 'libgomp.oacc-fortran/host_data-5.F90' */ #include <assert.h> @@ -14,15 +19,19 @@ foo (float *p, intptr_t host_p, int cond) #pragma acc data copyin(host_p) { #pragma acc host_data use_device(p) if_present + /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ /* p not mapped yet, so it will be equal to the host pointer. */ assert (p == (float *) host_p); #pragma acc data copy(p[0:100]) + /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { /* Not inside a host_data construct, so p is still the host pointer. */ assert (p == (float *) host_p); #pragma acc host_data use_device(p) + /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { #if ACC_MEM_SHARED assert (p == (float *) host_p); @@ -33,6 +42,7 @@ foo (float *p, intptr_t host_p, int cond) } #pragma acc host_data use_device(p) if_present + /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { #if ACC_MEM_SHARED assert (p == (float *) host_p); @@ -43,6 +53,8 @@ foo (float *p, intptr_t host_p, int cond) } #pragma acc host_data use_device(p) if(cond) + /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-2 } */ { #if ACC_MEM_SHARED assert (p == (float *) host_p); diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c index dd83557..e08cfa5 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c @@ -3,11 +3,17 @@ /* { dg-additional-options "-fopt-info-omp-all" } */ /* { dg-additional-options "--param=openacc-kernels=decompose" } */ +/* { dg-additional-options "-fopt-info-all-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-all-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' passed to 'incr' may be unset, and in that case, it will be set to [...]", so to maintain compatibility with earlier Tcl releases, we manually initialize counter variables: - { dg-line l_dummy[variable c_loop_i 0] } + { dg-line l_dummy[variable c_compute 0 c_loop_i 0] } { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid "WARNING: dg-line var l_dummy defined, but not used". */ @@ -22,15 +28,19 @@ int main() #define N 123 int b[N] = { 0 }; -#pragma acc kernels +#pragma acc kernels /* { dg-line l_compute[incr c_compute] } */ { int c = 234; /* { dg-message "note: beginning 'gang-single' part in OpenACC 'kernels' region" } */ + /* { dg-note {variable 'c' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'c\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ /*TODO Hopefully, this is the same issue as '../../../gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c'. */ (volatile int *) &c; #pragma acc loop independent gang /* { dg-line l_loop_i[incr c_loop_i] } */ /* { dg-message "note: parallelized loop nest in OpenACC 'kernels' region" "" { target *-*-* } l_loop_i$c_loop_i } */ + /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop_i$c_loop_i } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop_i$c_loop_i } */ /* { dg-optimized "assigned OpenACC gang loop parallelism" "" { target *-*-* } l_loop_i$c_loop_i } */ for (int i = 0; i < N; ++i) b[i] = c; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c index bcbe28a..f28513d 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared in a local scope, broadcasting @@ -12,30 +18,40 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; int x = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; int x = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c index a944486..21f2511 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared in a local scope, broadcasting @@ -12,25 +18,32 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; int x = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; x = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c index ba0b44d..8b4cde8 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared in a local scope, broadcasting @@ -17,13 +23,18 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; @@ -33,10 +44,12 @@ main (int argc, char* argv[]) pt.y = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.x * k; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.y * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c index 7189d2a..a658d16 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared in a local scope, broadcasting @@ -17,13 +23,19 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'pt' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'ptp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (j = 0; j < 32; j++) { int k; @@ -34,12 +46,14 @@ main (int argc, char* argv[]) pt.x = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += ptp->x * k; ptp->y = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.y * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c index 854ad7e..b82b9bf 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared in a local scope, broadcasting @@ -12,13 +18,18 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; @@ -27,12 +38,14 @@ main (int argc, char* argv[]) pt[0] = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[0] * k; pt[1] = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[1] * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c index 5bc90c2..38d89c7 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of gang-private variables declared on loop directive. */ @@ -13,6 +19,8 @@ main (int argc, char* argv[]) #pragma acc kernels copy(arr) { #pragma acc loop gang(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ for (i = 0; i < 32; i++) { x = i * 2; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c index 3eb1167..62dd12f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of gang-private variables declared on loop directive, with broadcasting @@ -14,11 +20,15 @@ main (int argc, char* argv[]) #pragma acc kernels copy(arr) { #pragma acc loop gang(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (i = 0; i < 32; i++) { x = i * 2; #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c index 86b9a71..c22c3b4 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of gang-private variables declared on loop directive, with broadcasting @@ -14,11 +20,15 @@ main (int argc, char* argv[]) #pragma acc kernels copy(arr) { #pragma acc loop gang(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (i = 0; i < 32; i++) { x = i * 2; #pragma acc loop vector(length:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c index 4174248..27a8e80 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of gang-private addressable variable declared on loop directive, with @@ -14,6 +20,10 @@ main (int argc, char* argv[]) #pragma acc kernels copy(arr) { #pragma acc loop gang(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (i = 0; i < 32; i++) { int *p = &x; @@ -21,6 +31,7 @@ main (int argc, char* argv[]) x = i * 2; #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c index b160eaa..f570c22 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of gang-private array variable declared on loop directive, with @@ -14,12 +20,16 @@ main (int argc, char* argv[]) #pragma acc kernels copy(arr) { #pragma acc loop gang(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (i = 0; i < 32; i++) { for (int j = 0; j < 8; j++) x[j] = j * 2; #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x[j % 8]; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c index 88ab245..5b776f1 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of gang-private aggregate variable declared on loop directive, with @@ -20,6 +26,9 @@ main (int argc, char* argv[]) #pragma acc kernels copy(arr) { #pragma acc loop gang private(pt) + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (i = 0; i < 32; i++) { pt.x = i; @@ -28,6 +37,7 @@ main (int argc, char* argv[]) pt.attr[5] = i * 6; #pragma acc loop worker + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += pt.x + pt.y + pt.z + pt.attr[5]; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c index df4add1..696da0f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of vector-private variables declared on loop directive. */ @@ -11,18 +17,24 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ for (j = 0; j < 32; j++) { int k; #pragma acc loop vector(length:32) private(x) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ for (k = 0; k < 32; k++) { x = i ^ j * 3; @@ -30,6 +42,8 @@ main (int argc, char* argv[]) } #pragma acc loop vector(length:32) private(x) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ for (k = 0; k < 32; k++) { x = i | j * 5; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c index 53c56b2..2e3b635 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of vector-private variables declared on loop directive. Array type. */ @@ -11,18 +17,24 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ for (j = 0; j < 32; j++) { int k; #pragma acc loop vector(length:32) private(pt) + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ for (k = 0; k < 32; k++) { pt[0] = i ^ j * 3; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c index 95db2f8..1aedc79 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared on a loop directive. */ @@ -11,13 +17,17 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ for (j = 0; j < 32; j++) { x = i ^ j * 3; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c index ceaa3ee..3bf62aa 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared on a loop directive, broadcasting @@ -12,19 +18,25 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; x = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c index 193a1d1..8de5516 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared on a loop directive, broadcasting @@ -12,30 +18,40 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; x = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } #pragma acc loop worker(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; x = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c index 4320cd8..425fe63 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared on a loop directive, broadcasting @@ -12,25 +18,32 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; x = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; x = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c index 80992ee..c027c02 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared on a loop directive, broadcasting @@ -12,13 +18,19 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) private(x) + /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (j = 0; j < 32; j++) { int k; @@ -27,12 +39,14 @@ main (int argc, char* argv[]) x = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; *p = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c index 005ba60..4f17566 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared on a loop directive, broadcasting @@ -18,13 +24,18 @@ main (int argc, char* argv[]) arr[i] = i; #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { #pragma acc loop worker(num:32) private(pt) + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; @@ -33,10 +44,12 @@ main (int argc, char* argv[]) pt.y = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.x * k; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.y * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c index 8d367fb..12b4c54 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <assert.h> /* Test of worker-private variables declared on loop directive, broadcasting @@ -15,14 +21,19 @@ main (int argc, char* argv[]) /* "pt" is treated as "present_or_copy" on the kernels directive because it is an array variable. */ #pragma acc kernels copy(arr) + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { int j; #pragma acc loop gang(num:32) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 32; i++) { /* But here, it is made private per-worker. */ #pragma acc loop worker(num:32) private(pt) + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ for (j = 0; j < 32; j++) { int k; @@ -30,12 +41,14 @@ main (int argc, char* argv[]) pt[0] = i ^ j * 3; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[0] * k; pt[1] = i | j * 5; #pragma acc loop vector(length:32) + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[1] * k; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c index 98f02e9..12272ad 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -14,8 +20,13 @@ int main () ary[ix] = -1; #pragma acc parallel num_gangs(32) copy(ary) copy(ondev) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { #pragma acc loop gang + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (unsigned ix = 0; ix < N; ix++) { if (acc_on_device (acc_device_not_host)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c index 4152a4e..683bd12 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -14,8 +20,13 @@ int main () ary[ix] = -1; #pragma acc parallel num_gangs(32) copy(ary) copy(ondev) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { #pragma acc loop gang (static:1) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (unsigned ix = 0; ix < N; ix++) { if (acc_on_device (acc_device_not_host)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c index 5c84301..e5ed2ab 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -16,8 +22,13 @@ int main () #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \ copy(ary) copy(ondev) copyout(gangsize, workersize, vectorsize) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { #pragma acc loop gang worker vector + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (unsigned ix = 0; ix < N; ix++) { if (acc_on_device (acc_device_not_host)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c new file mode 100644 index 0000000..cb3878b --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c @@ -0,0 +1,106 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + +#include <stdio.h> +#include <openacc.h> +#include <alloca.h> +#include <string.h> +#include <gomp-constants.h> +#include <stdlib.h> + +#if 0 +#define DEBUG(DIM, IDX, VAL) \ + fprintf (stderr, "%sdist[%d] = %d\n", (DIM), (IDX), (VAL)) +#else +#define DEBUG(DIM, IDX, VAL) +#endif + +#define N (32*32*32) + +int +check (const char *dim, int *dist, int dimsize) +{ + int ix; + int exit = 0; + + for (ix = 0; ix < dimsize; ix++) + { + DEBUG(dim, ix, dist[ix]); + if (dist[ix] < (N) / (dimsize + 0.5) + || dist[ix] > (N) / (dimsize - 0.5)) + { + fprintf (stderr, "did not distribute to %ss (%d not between %d " + "and %d)\n", dim, dist[ix], (int) ((N) / (dimsize + 0.5)), + (int) ((N) / (dimsize - 0.5))); + exit |= 1; + } + } + + return exit; +} + +int main () +{ + int ary[N]; + int ix; + int exit = 0; + int gangsize = 0, workersize = 0, vectorsize = 0; + int *gangdist, *workerdist, *vectordist; + + for (ix = 0; ix < N;ix++) + ary[ix] = -1; + +#pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \ + copy(ary) copyout(gangsize, workersize, vectorsize) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + { +#pragma acc loop gang worker vector + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + for (unsigned ix = 0; ix < N; ix++) + { + int g, w, v; + + g = __builtin_goacc_parlevel_id (GOMP_DIM_GANG); + w = __builtin_goacc_parlevel_id (GOMP_DIM_WORKER); + v = __builtin_goacc_parlevel_id (GOMP_DIM_VECTOR); + + ary[ix] = (g << 16) | (w << 8) | v; + } + + gangsize = __builtin_goacc_parlevel_size (GOMP_DIM_GANG); + workersize = __builtin_goacc_parlevel_size (GOMP_DIM_WORKER); + vectorsize = __builtin_goacc_parlevel_size (GOMP_DIM_VECTOR); + } + + gangdist = (int *) alloca (gangsize * sizeof (int)); + workerdist = (int *) alloca (workersize * sizeof (int)); + vectordist = (int *) alloca (vectorsize * sizeof (int)); + memset (gangdist, 0, gangsize * sizeof (int)); + memset (workerdist, 0, workersize * sizeof (int)); + memset (vectordist, 0, vectorsize * sizeof (int)); + + /* Test that work is shared approximately equally amongst each active + gang/worker/vector. */ + for (ix = 0; ix < N; ix++) + { + int g = (ary[ix] >> 16) & 255; + int w = (ary[ix] >> 8) & 255; + int v = ary[ix] & 255; + + gangdist[g]++; + workerdist[w]++; + vectordist[v]++; + } + + exit = check ("gang", gangdist, gangsize); + exit |= check ("worker", workerdist, workersize); + exit |= check ("vector", vectordist, vectorsize); + + return exit; +} diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c index 7107502..0c84027 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -10,8 +16,14 @@ int main () int t = 0, h = 0; #pragma acc parallel num_gangs(32) copy(ondev) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { #pragma acc loop gang reduction (+:t) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ for (unsigned ix = 0; ix < N; ix++) { int val = ix; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c index 9c4a85f..c1a2d0c 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -12,8 +18,14 @@ int main () #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \ copy(ondev) copyout(gangsize, workersize, vectorsize) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { #pragma acc loop gang worker vector reduction(+:t) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ for (unsigned ix = 0; ix < N; ix++) { int val = ix; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c index 1173c1f..58c7b6a 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -12,8 +18,14 @@ int main () int vectorsize; #pragma acc parallel vector_length(32) copy(ondev) copyout(vectorsize) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ { #pragma acc loop vector reduction (+:t) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ for (unsigned ix = 0; ix < N; ix++) { int val = ix; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c index 84c2296..85931f5 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -12,10 +18,17 @@ int main () int vectorsize; #pragma acc parallel vector_length(32) copy(q) copy(ondev) copyout(vectorsize) + /* { dg-note {variable 't' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { int t = q; #pragma acc loop vector reduction (+:t) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ for (unsigned ix = 0; ix < N; ix++) { int val = ix; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c index 2f749e0..b9ceec9 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting aspects of that functionality. */ @@ -15,9 +21,15 @@ int main () #pragma acc parallel num_workers(32) vector_length(32) copy(ondev) \ copyout(workersize) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 } */ { #pragma acc loop worker reduction(+:t) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ for (unsigned ix = 0; ix < N; ix++) { int val = ix; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c index 9727e22..ff5e4a1 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting aspects of that functionality. */ @@ -15,11 +21,18 @@ int main () #pragma acc parallel num_workers(32) vector_length(32) copy(q) copy(ondev) \ copyout(workersize) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */ + /* { dg-note {variable 't' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } */ { int t = q; #pragma acc loop worker reduction(+:t) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ for (unsigned ix = 0; ix < N; ix++) { int val = ix; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c index c360ad1..5d60899 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -12,8 +18,14 @@ int main () #pragma acc parallel num_workers(32) vector_length(32) copy(ondev) \ copyout(workersize, vectorsize) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { #pragma acc loop worker vector reduction (+:t) + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ for (unsigned ix = 0; ix < N; ix++) { int val = ix; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c index 8c858f3..9ccc1a8 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -16,8 +22,13 @@ int main () #pragma acc parallel vector_length(32) copy(ary) copy(ondev) \ copyout(vectorsize) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { #pragma acc loop vector + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (unsigned ix = 0; ix < N; ix++) { if (acc_on_device (acc_device_not_host)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c index d639e14..0e99ec6 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting aspects of that functionality. */ @@ -19,9 +25,14 @@ int main () #pragma acc parallel num_workers(32) vector_length(32) copy(ary) copy(ondev) \ copyout(workersize) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "vector" { target *-*-* } .-2 } */ + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "vector" { target *-*-* } .-3 } */ { #pragma acc loop worker + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (unsigned ix = 0; ix < N; ix++) { if (acc_on_device (acc_device_not_host)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c index fd4e4cf..f4707d1 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdio.h> #include <openacc.h> #include <gomp-constants.h> @@ -16,8 +22,13 @@ int main () #pragma acc parallel num_workers(32) vector_length(32) copy(ary) copy(ondev) \ copyout(workersize, vectorsize) + /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { #pragma acc loop worker vector + /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ + /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */ + /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */ for (unsigned ix = 0; ix < N; ix++) { if (acc_on_device (acc_device_not_host)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c index b15ee8b..f88babc 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting aspects of that functionality. */ @@ -63,6 +69,7 @@ main () #pragma acc parallel num_gangs (10) reduction (+:s1) copy(s1) { #pragma acc loop gang reduction (+:s1) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < 10; i++) s1++; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c new file mode 100644 index 0000000..2c1ffb1 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c @@ -0,0 +1,99 @@ +/* Tests for gang-private variables, 'atomic' access */ + +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + +/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' + passed to 'incr' may be unset, and in that case, it will be set to [...]", + so to maintain compatibility with earlier Tcl releases, we manually + initialize counter variables: + { dg-line l_dummy[variable c_compute 0 c_loop 0] } + { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid + "WARNING: dg-line var l_dummy defined, but not used". */ + +#include <assert.h> +#include <openacc.h> + +int main (void) +{ + int ret; + + + ret = 0; + #pragma acc parallel num_gangs(1444) num_workers(32) reduction(+: ret) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'w' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'w' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_compute$c_compute } */ + /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ + { + int w = -22; + + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + for (int i = 0; i < 2232; i++) + { + #pragma acc atomic update + w++; + } + + ret = (w == -22 + 2232); + } + if (acc_get_device_type () == acc_device_host) + assert (ret == 1); + else + assert (ret == 1444); + + + ret = 0; + #pragma acc parallel num_gangs(1414) vector_length(32) reduction(+: ret) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'v' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'v' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'v' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_compute$c_compute } */ + /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ + { + int v = 10; + + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + for (int i = 0; i < 3201; i++) + { + #pragma acc atomic update + v++; + } + + ret = (v == 10 + 3201); + } + if (acc_get_device_type () == acc_device_host) + assert (ret == 1); + else + assert (ret == 1414); + + + ret = 0; +#pragma acc parallel num_gangs(314) reduction(+: ret) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'v' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'v' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } + { dg-note {variable 'v' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_compute$c_compute } */ + { + int v = -222; + +#pragma acc atomic update + ++v; +#pragma acc atomic update + ++v; +#pragma acc atomic update + ++v; + + ret += (v == -222 + 3); + } + if (acc_get_device_type () == acc_device_host) + assert (ret == 1); + else + assert (ret == 314); + + + return 0; +} diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c new file mode 100644 index 0000000..e651012 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c @@ -0,0 +1,50 @@ +// 'atomic' access of thread-private variable + +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + +#include <assert.h> + +int main (void) +{ + int res; + + res = 0; +#pragma acc parallel reduction(+: res) + /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + { +#pragma acc loop vector reduction(+: res) + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + /* { dg-note {variable 'v' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } + { dg-note {variable 'v' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } .-3 } + { dg-note {variable 'v' adjusted for OpenACC privatization level: 'vector'} "" { target { ! openacc_host_selected } } .-4 } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ + for (int i = 0; i < 2322; i++) + { + int v = -222; + +#pragma acc loop seq + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ + for (int j = 0; j < 121; ++j) + { +#pragma acc atomic update + ++v; + /* nvptx offloading: PR83812 "operation not supported on global/shared address space". + { dg-output "(\n|\r\n|\r)libgomp: cuStreamSynchronize error: operation not supported on global/shared address space(\n|\r\n|\r)$" { target openacc_nvidia_accel_selected } } + Scan for what we expect in the "XFAILed" case (without actually XFAILing). + { dg-shouldfail "XFAILed" { openacc_nvidia_accel_selected } } + ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + { dg-final { if { [dg-process-target { xfail openacc_nvidia_accel_selected }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } + ... so that we still get an XFAIL visible in the log. */ + } + + res += (v == -222 + 121); + } + } + assert (res == 2322); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/private-variables.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/private-variables.c index 3cc6f15..366f818 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/private-variables.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/private-variables.c @@ -1,6 +1,20 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting aspects of that functionality. */ +/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' + passed to 'incr' may be unset, and in that case, it will be set to [...]", + so to maintain compatibility with earlier Tcl releases, we manually + initialize counter variables: + { dg-line l_dummy[variable c_compute 0 c_loop 0] } + { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid + "WARNING: dg-line var l_dummy defined, but not used". */ + #include <assert.h> #include <openacc.h> @@ -24,17 +38,20 @@ void local_g_1() for (i = 0; i < 32; i++) arr[i] = 3; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { int x; - #pragma acc loop gang(static:1) + #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) x = i * 2; - #pragma acc loop gang(static:1) + #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { if (acc_on_device (acc_device_host)) @@ -58,31 +75,41 @@ void local_w_1() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; int x = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; int x = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } @@ -109,26 +136,33 @@ void local_w_2() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; int x = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; x = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } @@ -155,14 +189,19 @@ void local_w_3() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; @@ -171,11 +210,13 @@ void local_w_3() pt.x = i ^ j * 3; pt.y = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.x * k; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.y * k; } @@ -202,14 +243,22 @@ void local_w_4() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'pt' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'ptp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; @@ -219,13 +268,15 @@ void local_w_4() pt.x = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += ptp->x * k; ptp->y = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.y * k; } @@ -252,14 +303,19 @@ void local_w_5() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; @@ -267,13 +323,15 @@ void local_w_5() pt[0] = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[0] * k; pt[1] = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[1] * k; } @@ -299,11 +357,13 @@ void loop_g_1() for (i = 0; i < 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang private(x) + #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { x = i * 2; @@ -326,15 +386,19 @@ void loop_g_2() for (i = 0; i < 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang private(x) + #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { x = i * 2; - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x; } @@ -355,15 +419,19 @@ void loop_g_3() for (i = 0; i < 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang private(x) + #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { x = i * 2; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x; } @@ -384,17 +452,33 @@ void loop_g_4() for (i = 0; i < 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang private(x) + #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + But, with optimizations enabled, per the '*.ssa' dump ('gcc/tree-ssa.c:execute_update_addresses_taken'): + No longer having address taken: x + Now a gimple register: x + However, 'x' remains in the candidate set: + { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop } + Now, for GCN offloading, 'adjust_private_decl' does the privatization change right away: + { dg-note {variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target openacc_radeon_accel_selected } l_loop$c_loop } + For nvptx offloading however, we first mark up 'x', and then later apply the privatization change -- or, with optimizations enabled, don't, because we then don't actually call 'expand_var_decl'. + { dg-note {variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && { ! __OPTIMIZE__ } } } l_loop$c_loop } + { dg-bogus {note: variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && __OPTIMIZE__ } } l_loop$c_loop } + */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { int *p = &x; x = i * 2; - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x; @@ -417,16 +501,22 @@ void loop_g_5() for (i = 0; i < 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang private(x) + #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_loop$c_loop } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { for (int j = 0; j < 8; j++) x[j] = j * 2; - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += x[j % 8]; } @@ -448,10 +538,13 @@ void loop_g_6() for (i = 0; i < 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang private(pt) + #pragma acc loop gang private(pt) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { pt.x = i; @@ -459,7 +552,8 @@ void loop_g_6() pt.z = i * 4; pt.attr[5] = i * 6; - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (int j = 0; j < 32; j++) arr[i * 32 + j] += pt.x + pt.y + pt.z + pt.attr[5]; } @@ -479,26 +573,34 @@ void loop_v_1() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; - #pragma acc loop vector private(x) + #pragma acc loop vector private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) { x = i ^ j * 3; arr[i * 1024 + j * 32 + k] += x * k; } - #pragma acc loop vector private(x) + #pragma acc loop vector private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) { x = i | j * 5; @@ -527,19 +629,25 @@ void loop_v_2() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; - #pragma acc loop vector private(pt) + #pragma acc loop vector private(pt) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) { pt[0] = i ^ j * 3; @@ -570,15 +678,19 @@ void loop_w_1() for (i = 0; i < 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker private(x) + #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { x = i ^ j * 3; @@ -605,20 +717,26 @@ void loop_w_2() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker private(x) + #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; x = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } @@ -645,31 +763,41 @@ void loop_w_3() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker private(x) + #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; x = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } - #pragma acc loop worker private(x) + #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; x = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } @@ -696,26 +824,33 @@ void loop_w_4() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker private(x) + #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; x = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; x = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } @@ -742,14 +877,22 @@ void loop_w_5() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker private(x) + #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop } + { dg-note {variable 'x' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; @@ -757,13 +900,15 @@ void loop_w_5() x = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; *p = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += x * k; } @@ -791,14 +936,19 @@ void loop_w_6() for (i = 0; i < 32 * 32 * 32; i++) arr[i] = i; - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { - #pragma acc loop worker private(pt) + #pragma acc loop worker private(pt) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; @@ -806,11 +956,13 @@ void loop_w_6() pt.x = i ^ j * 3; pt.y = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.x * k; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt.y * k; } @@ -840,28 +992,35 @@ void loop_w_7() /* "pt" is treated as "present_or_copy" on the parallel directive because it is an array variable. */ - #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) + #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */ { int j; - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { /* But here, it is made private per-worker. */ - #pragma acc loop worker private(pt) + #pragma acc loop worker private(pt) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) { int k; pt[0] = i ^ j * 3; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[0] * k; pt[1] = i | j * 5; - #pragma acc loop vector + #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (k = 0; k < 32; k++) arr[i * 1024 + j * 32 + k] += pt[1] * k; } @@ -887,15 +1046,17 @@ void parallel_g_1() for (i = 0; i < 32; i++) arr[i] = 3; - #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(8) vector_length(32) - /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */ + #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang(static:1) + #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) x = i * 2; - #pragma acc loop gang(static:1) + #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { if (acc_on_device (acc_device_host)) @@ -918,17 +1079,20 @@ void parallel_g_2() for (i = 0; i < 32 * 32; i++) arr[i] = i; - #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(2) vector_length(32) - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(2) vector_length(32) /* { dg-line l_compute[incr c_compute] } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */ { - #pragma acc loop gang + #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ + /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (i = 0; i < 32; i++) { int j; for (j = 0; j < 32; j++) x[j] = j * 2; - #pragma acc loop worker + #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */ + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */ for (j = 0; j < 32; j++) arr[i * 32 + j] += x[31 - j]; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-4.c index d6ff44d..0402e44 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/routine-4.c @@ -1,3 +1,9 @@ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + #include <stdlib.h> #include <stdio.h> @@ -11,6 +17,7 @@ vector (int *a) int i; #pragma acc loop vector + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < N; i++) a[i] -= a[i]; } @@ -22,9 +29,11 @@ worker (int *b) int i, j; #pragma acc loop worker + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < N; i++) { #pragma acc loop vector + /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (j = 0; j < M; j++) b[i * M + j] += b[i * M + j]; } @@ -37,6 +46,7 @@ gang (int *a) int i; #pragma acc loop gang worker vector + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < N; i++) a[i] -= i; } @@ -66,6 +76,7 @@ main(int argc, char **argv) #pragma acc parallel copy (a[0:N]) { #pragma acc loop seq + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < N; i++) seq (&a[0]); } @@ -79,6 +90,7 @@ main(int argc, char **argv) #pragma acc parallel copy (a[0:N]) { #pragma acc loop seq + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < N; i++) gang (&a[0]); } @@ -109,6 +121,7 @@ main(int argc, char **argv) #pragma acc parallel copy (a[0:N]) { #pragma acc loop + /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */ for (i = 0; i < N; i++) vector (&a[0]); } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c index 0c071c3..ceb2c88 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c @@ -9,6 +9,12 @@ variables" (only visible to members of the GitHub OpenACC organization). */ +/* { dg-additional-options "-fopt-info-note-omp" } + { dg-additional-options "--param=openacc-privatization=noisy" } + { dg-additional-options "-foffload=-fopt-info-note-omp" } + { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } + for testing/documenting aspects of that functionality. */ + /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting aspects of that functionality. */ @@ -40,6 +46,7 @@ static void t0_c(void) #pragma acc parallel \ reduction(max:num_gangs_actual) \ reduction(max:result) + /* { dg-note {variable 'var' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } .-3 } */ { num_gangs_actual = 1 + __builtin_goacc_parlevel_id(GOMP_DIM_GANG); @@ -134,6 +141,7 @@ static void t1_c(void) num_gangs(num_gangs_request) \ reduction(max:num_gangs_actual) \ reduction(max:result) + /* { dg-note {variable 'var' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } .-4 } */ { num_gangs_actual = 1 + __builtin_goacc_parlevel_id(GOMP_DIM_GANG); @@ -290,6 +298,7 @@ static void t2(void) #pragma acc data \ copy(results_1, results_2, results_3) + /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */ { for (int i = 0; i < i_limit; ++i) { @@ -304,6 +313,8 @@ static void t2(void) present(results_1) \ num_gangs(num_gangs_request_1) \ async(1) + /* { dg-note {variable 'var' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'tmp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ { static int var = var_init_1; @@ -327,6 +338,8 @@ static void t2(void) present(results_3) \ num_gangs(num_gangs_request_3) \ async(3) + /* { dg-note {variable 'var' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } .-4 } */ + /* { dg-note {variable 'tmp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */ { static int var = var_init_3; @@ -447,6 +460,7 @@ static void pr84992_1(void) int n[1]; n[0] = 3; #pragma acc parallel copy(n) + /* { dg-note {variable 'test' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } .-1 } */ { static const int test[] = {1,2,3,4}; n[0] = test[n[0]]; diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 index 1a8432c..ace9358 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90 @@ -1,6 +1,12 @@ ! { dg-do run } ! { dg-additional-options "-cpp" } -! + +! { dg-additional-options "-fopt-info-all-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-all-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! TODO: Have to disable the acc_on_device builtin for we want to test the ! libgomp library function? The command line option ! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not for @@ -20,6 +26,8 @@ if (acc_on_device (acc_device_nvidia)) STOP 4 ! Host via offloading fallback mode. !$acc parallel if(.false.) +! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 } +!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls. if (.not. acc_on_device (acc_device_none)) STOP 5 if (.not. acc_on_device (acc_device_host)) STOP 6 if (acc_on_device (acc_device_not_host)) STOP 7 @@ -32,6 +40,7 @@ if (acc_on_device (acc_device_nvidia)) STOP 8 ! Offloaded. !$acc parallel +! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 } if (acc_on_device (acc_device_none)) STOP 9 if (acc_on_device (acc_device_host)) STOP 10 if (.not. acc_on_device (acc_device_not_host)) STOP 11 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f index 56f99d4..56270b1 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f @@ -1,6 +1,12 @@ ! { dg-do run } ! { dg-additional-options "-cpp" } -! + +! { dg-additional-options "-fopt-info-all-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-all-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! TODO: Have to disable the acc_on_device builtin for we want to test ! the libgomp library function? The command line option ! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not @@ -20,6 +26,8 @@ !Host via offloading fallback mode. !$ACC PARALLEL IF(.FALSE.) +! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 } +!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 5 IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 6 IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 7 @@ -32,6 +40,7 @@ ! Offloaded. !$ACC PARALLEL +! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 } IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 9 IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 10 IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 11 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f index 5657238..a8b9cdd 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f @@ -1,6 +1,12 @@ ! { dg-do run } ! { dg-additional-options "-cpp" } -! + +! { dg-additional-options "-fopt-info-all-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-all-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! TODO: Have to disable the acc_on_device builtin for we want to test ! the libgomp library function? The command line option ! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not @@ -20,6 +26,8 @@ !Host via offloading fallback mode. !$ACC PARALLEL IF(.FALSE.) +! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 } +!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 5 IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 6 IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 7 @@ -32,6 +40,7 @@ ! Offloaded. !$ACC PARALLEL +! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 } IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 9 IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 10 IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 11 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90 index 084f336..51776a1 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90 @@ -1,6 +1,12 @@ ! { dg-do run } ! { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } } +! { dg-additional-options "-fopt-info-all-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-all-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! Tests to exercise the declare directive along with ! the clauses: copy ! copyin @@ -34,6 +40,7 @@ subroutine subr5 (a, b, c, d) i = 0 !$acc parallel + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N b(i) = a(i) c(i) = b(i) @@ -55,6 +62,7 @@ subroutine subr4 (a, b) i = 0 !$acc parallel + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N b(i) = a(i) end do @@ -74,6 +82,7 @@ subroutine subr3 (a, c) i = 0 !$acc parallel + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N a(i) = c(i) c(i) = 0 @@ -96,6 +105,7 @@ subroutine subr2 (a, b, c) i = 0 !$acc parallel + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N b(i) = a(i) c(i) = b(i) + c(i) + 1 @@ -114,6 +124,7 @@ subroutine subr1 (a) i = 0 !$acc parallel + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N a(i) = a(i) + 1 end do @@ -133,6 +144,9 @@ subroutine test (a, e) end subroutine subroutine subr0 (a, b, c, d) + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } + ! { dg-note {variable 'a\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } implicit none integer, parameter :: N = 8 integer :: a(N) @@ -198,6 +212,10 @@ subroutine subr0 (a, b, c, d) end subroutine program main + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } + ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } + ! { dg-note {variable 'desc\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-4 } use vars use openacc implicit none diff --git a/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90 b/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90 index 483ac3f..93e9ee0 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90 @@ -1,7 +1,13 @@ ! { dg-do run } ! ! Test if, if_present clauses on host_data construct. -! + +! { dg-additional-options "-fopt-info-all-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-all-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! Fortran variant of 'libgomp.oacc-c-c++-common/host_data-7.c'. ! program main @@ -33,11 +39,24 @@ subroutine foo (p2, parr, host_p, host_parr, cond) #endif !$acc data copyin(host_p, host_parr) + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-2 } + ! { dg-note {variable 'p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } + ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target { ! openacc_host_selected } } .-5 } #if !ACC_MEM_SHARED if (acc_is_present(p, c_sizeof(p))) stop 5 if (acc_is_present(parr, 1)) stop 6 #endif !$acc host_data use_device(p, parr) if_present + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } + ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } + ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } + ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } + ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-6 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-8 } ! not mapped yet, so it will be equal to the host pointer. if (transfer(c_loc(p), host_p) /= host_p) stop 7 if (transfer(c_loc(parr), host_parr) /= host_parr) stop 8 @@ -48,6 +67,17 @@ subroutine foo (p2, parr, host_p, host_parr, cond) #endif !$acc data copy(p, parr) + ! { dg-note {variable 'p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } + ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } + ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } + ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 } + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-7 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 } + ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-9 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-10 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-11 } if (.not. acc_is_present(p, c_sizeof(p))) stop 11 if (.not. acc_is_present(parr, 1)) stop 12 ! Not inside a host_data construct, so still the host pointer. @@ -55,6 +85,14 @@ subroutine foo (p2, parr, host_p, host_parr, cond) if (transfer(c_loc(parr), host_parr) /= host_parr) stop 14 !$acc host_data use_device(p, parr) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } + ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } + ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } + ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } + ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-6 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-8 } #if ACC_MEM_SHARED if (transfer(c_loc(p), host_p) /= host_p) stop 15 if (transfer(c_loc(parr), host_parr) /= host_parr) stop 16 @@ -66,6 +104,14 @@ subroutine foo (p2, parr, host_p, host_parr, cond) !$acc end host_data !$acc host_data use_device(p, parr) if_present + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } + ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } + ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } + ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 } + ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 } #if ACC_MEM_SHARED if (transfer(c_loc(p), host_p) /= host_p) stop 19 if (transfer(c_loc(parr), host_parr) /= host_parr) stop 20 @@ -77,6 +123,14 @@ subroutine foo (p2, parr, host_p, host_parr, cond) !$acc end host_data !$acc host_data use_device(p, parr) if(cond) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } + ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } + ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } + ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 } + ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 } + ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 } #if ACC_MEM_SHARED if (transfer(c_loc(p), host_p) /= host_p) stop 23 if (transfer(c_loc(parr), host_parr) /= host_parr) stop 24 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90 index f3bf1ee..3089d6a 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/if-1.f90 @@ -1,6 +1,20 @@ ! { dg-do run } ! { dg-additional-options "-cpp" } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_compute 0] } +! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". */ + program main use openacc implicit none @@ -19,8 +33,11 @@ program main a(:) = 4.0 - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } + !TODO Unhandled 'CONST_DECL' instances for constant argument in 'acc_on_device' call. if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -41,8 +58,10 @@ program main a(:) = 16.0 - !$acc parallel if (0 == 1) + !$acc parallel if (0 == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -57,8 +76,10 @@ program main a(:) = 8.0 - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -79,8 +100,10 @@ program main a(:) = 22.0 - !$acc parallel if (zero == 1) + !$acc parallel if (zero == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -95,8 +118,10 @@ program main a(:) = 16.0 - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -117,8 +142,10 @@ program main a(:) = 76.0 - !$acc parallel if (.FALSE.) + !$acc parallel if (.FALSE.) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -135,8 +162,10 @@ program main nn = 1 - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -159,8 +188,10 @@ program main nn = 0 - !$acc parallel if (nn == 1) + !$acc parallel if (nn == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -177,8 +208,10 @@ program main nn = 1 - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -201,8 +234,10 @@ program main nn = 0; - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -217,8 +252,10 @@ program main a(:) = 91.0 - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -233,8 +270,10 @@ program main a(:) = 43.0 - !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) + !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -255,8 +294,10 @@ program main a(:) = 87.0 - !$acc parallel if (one == 0) + !$acc parallel if (one == 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -333,8 +374,11 @@ program main b(:) = 0.0 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } - !$acc parallel present (a(1:N)) + !$acc parallel present (a(1:N)) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N b(i) = a(i) end do @@ -349,6 +393,7 @@ program main b(:) = 1.0 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-1 } #if !ACC_MEM_SHARED if (acc_is_present (a) .eqv. .TRUE.) STOP 21 @@ -361,18 +406,25 @@ program main b(:) = 21.0 !$acc data copyin (a(1:N)) if (1 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } #if !ACC_MEM_SHARED if (acc_is_present (a) .eqv. .FALSE.) STOP 23 #endif !$acc data copyout (b(1:N)) if (0 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } #if !ACC_MEM_SHARED if (acc_is_present (b) .eqv. .TRUE.) STOP 24 #endif !$acc data copyout (b(1:N)) if (1 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } - !$acc parallel present (a(1:N)) present (b(1:N)) + !$acc parallel present (a(1:N)) present (b(1:N)) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N b(i) = a(i) end do @@ -452,8 +504,10 @@ program main a(:) = 4.0 - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -474,8 +528,10 @@ program main a(:) = 16.0 - !$acc kernels if (0 == 1) + !$acc kernels if (0 == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -490,8 +546,10 @@ program main a(:) = 8.0 - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -512,8 +570,10 @@ program main a(:) = 22.0 - !$acc kernels if (zero == 1) + !$acc kernels if (zero == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -528,8 +588,10 @@ program main a(:) = 16.0 - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -550,8 +612,10 @@ program main a(:) = 76.0 - !$acc kernels if (.FALSE.) + !$acc kernels if (.FALSE.) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -568,8 +632,10 @@ program main nn = 1 - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -592,8 +658,10 @@ program main nn = 0 - !$acc kernels if (nn == 1) + !$acc kernels if (nn == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -610,8 +678,10 @@ program main nn = 1 - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -634,8 +704,10 @@ program main nn = 0; - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -650,8 +722,10 @@ program main a(:) = 91.0 - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -666,8 +740,10 @@ program main a(:) = 43.0 - !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) + !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -688,8 +764,10 @@ program main a(:) = 87.0 - !$acc kernels if (one == 0) + !$acc kernels if (one == 0) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute } if (acc_on_device (acc_device_host) .eqv. .TRUE.) then b(i) = a(i) + 1 else @@ -766,8 +844,11 @@ program main b(:) = 0.0 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } - !$acc kernels present (a(1:N)) + !$acc kernels present (a(1:N)) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N b(i) = a(i) end do @@ -782,6 +863,7 @@ program main b(:) = 1.0 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-1 } #if !ACC_MEM_SHARED if (acc_is_present (a) .eqv. .TRUE.) STOP 56 @@ -794,18 +876,25 @@ program main b(:) = 21.0 !$acc data copyin (a(1:N)) if (1 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } #if !ACC_MEM_SHARED if (acc_is_present (a) .eqv. .FALSE.) STOP 58 #endif !$acc data copyout (b(1:N)) if (0 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } #if !ACC_MEM_SHARED if (acc_is_present (b) .eqv. .TRUE.) STOP 59 #endif !$acc data copyout (b(1:N)) if (1 == 1) + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } - !$acc kernels present (a(1:N)) present (b(1:N)) + !$acc kernels present (a(1:N)) present (b(1:N)) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } do i = 1, N b(i) = a(i) end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90 index bcc0476..0ae7c4b 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90 @@ -2,6 +2,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, arr(32) @@ -11,6 +17,8 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) private(x) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do i = 1, 32 x = i * 2; arr(i) = arr(i) + x; diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90 index 5571059..e3ff248 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, j, arr(0:32*32) @@ -12,10 +18,13 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) private(x) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do i = 0, 31 x = i * 2; !$acc loop worker(num:32) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 0, 31 arr(i * 32 + j) = arr(i * 32 + j) + x; end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90 index 6abbed7..370a25a 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, j, arr(0:32*32) @@ -12,10 +18,13 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) private(x) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do i = 0, 31 x = i * 2; !$acc loop vector(length:32) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 0, 31 arr(i * 32 + j) = arr(i * 32 + j) + x; end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90 index d92be2d..abb86d0 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main type vec3 integer x, y, z, attr(13) @@ -17,6 +23,8 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) private(pt) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } do i = 0, 31 pt%x = i pt%y = i * 2 @@ -24,6 +32,7 @@ program main pt%attr(5) = i * 6 !$acc loop vector(length:32) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 0, 31 arr(i * 32 + j) = arr(i * 32 + j) + pt%x + pt%y + pt%z + pt%attr(5); end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90 index e9c0fb3..fe796f3 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90 @@ -2,6 +2,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, j, k, idx, arr(0:32*32*32) @@ -11,15 +17,21 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 0, 31 !$acc loop vector(length:32) private(x) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do k = 0, 31 x = ieor(i, j * 3) arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do !$acc loop vector(length:32) private(x) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do k = 0, 31 x = ior(i, j * 5) arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90 index 13badb5..b5cefec 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90 @@ -2,6 +2,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: i, j, k, idx, arr(0:32*32*32), pt(2) @@ -11,10 +17,14 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 0, 31 !$acc loop vector(length:32) private(x, pt) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } do k = 0, 31 pt(1) = ieor(i, j * 3) pt(2) = ior(i, j * 5) diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90 index 04d732e..3fd1239 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90 @@ -2,6 +2,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, j, arr(0:32*32) common x @@ -12,8 +18,11 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) private(x) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) private(x) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do j = 0, 31 x = ieor(i, j * 3) arr(i * 32 + j) = arr(i * 32 + j) + x diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90 index 6c9a6b8..1dc5d9e 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, j, k, idx, arr(0:32*32*32) @@ -12,12 +18,16 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) private(x) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do j = 0, 31 x = ieor(i, j * 3) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90 index fab14c3..25bc67a 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, j, k, idx, arr(0:32*32*32) @@ -12,22 +18,29 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) private(x) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do j = 0, 31 x = ieor(i, j * 3) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do end do !$acc loop worker(num:8) private(x) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do j = 0, 31 x = ior(i, j * 5) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90 index 71f4a11..b3f66ea 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: x, i, j, k, idx, arr(0:32*32*32) @@ -12,12 +18,16 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) private(x) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do j = 0, 31 x = ieor(i, j * 3) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do @@ -25,6 +35,7 @@ program main x = ior(i, j * 5) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90 index bb45755..d9dbb07 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: i, j, k, idx, arr(0:32*32*32) integer, target :: x @@ -14,13 +20,18 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) private(x, p) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } + ! { dg-note {variable 'p' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } do j = 0, 31 p => x x = ieor(i, j * 3) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do @@ -28,6 +39,7 @@ program main p = ior(i, j * 5) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90 index e169714..b4225c2 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main type vec2 integer x, y @@ -17,18 +23,23 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) private(pt) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do j = 0, 31 pt%x = ieor(i, j * 3) pt%y = ior(i, j * 5) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%x * k end do !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%y * k end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90 b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90 index e262c02..76bbda7 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90 @@ -3,6 +3,12 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + program main integer :: i, j, k, idx, arr(0:32*32*32), pt(2) @@ -12,18 +18,23 @@ program main !$acc kernels copy(arr) !$acc loop gang(num:32) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker(num:8) private(pt) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } do j = 0, 31 pt(1) = ieor(i, j * 3) pt(2) = ior(i, j * 5) !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(1) * k end do !$acc loop vector(length:32) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(2) * k end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/optional-private.f90 b/libgomp/testsuite/libgomp.oacc-fortran/optional-private.f90 index 4d36d86..4e67809 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/optional-private.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/optional-private.f90 @@ -4,9 +4,16 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting ! aspects of that functionality. + program main implicit none @@ -36,6 +43,8 @@ contains ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } !$acc loop gang private(x) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'x' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } .-2 } do i = 1, 32 x = i * 2; arr(i) = arr(i) + x @@ -62,6 +71,8 @@ contains !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } !$acc loop gang private(pt) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'pt' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } .-2 } do i = 0, 31 pt%x = i pt%y = i * 2 @@ -69,6 +80,7 @@ contains pt%attr(5) = i * 6 !$acc loop vector + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 0, 31 arr(i * 32 + j) = arr(i * 32 + j) + pt%x + pt%y + pt%z + pt%attr(5); end do @@ -92,10 +104,14 @@ contains !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) !$acc loop gang + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 0, 31 !$acc loop worker + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 0, 31 !$acc loop vector private(pt) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'pt' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } .-2 } do k = 0, 31 pt(1) = ieor(i, j * 3) pt(2) = ior(i, j * 5) diff --git a/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90 b/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90 index f69ab5a..fad3d9d 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90 @@ -5,6 +5,12 @@ ! { dg-do run } ! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting ! aspects of that functionality. @@ -62,6 +68,7 @@ program main vectors_max = -huge(gangs_max) - 1 ! INT_MIN !$acc serial & !$acc reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max) ! { dg-warning "using vector_length \\(32\\), ignoring 1" "" { target openacc_nvidia_accel_selected } } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 100, -99, -1 gangs_min = acc_gang (); gangs_max = acc_gang (); @@ -90,6 +97,8 @@ program main ! { dg-bogus "\[Ww\]arning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 } ! { dg-bogus "\[Ww\]arning: region contains worker partitioned code but is not worker partitioned" "TODO 'serial'" { xfail *-*-* } .-2 } ! { dg-bogus "\[Ww\]arning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 } + ! { dg-note {variable 'C.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-4 } + !TODO Unhandled 'CONST_DECL' instance for constant argument in 'acc_on_device' call. if (acc_on_device (acc_device_nvidia)) then ! The GCC nvptx back end enforces vector_length (32). ! It's unclear if that's actually permissible here; @@ -98,10 +107,14 @@ program main vectors_actual = 32 end if !$acc loop gang reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max) + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 100, -99, -1 !$acc loop worker reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } do j = 100, -99, -1 !$acc loop vector reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max) + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do k = 100 * vectors_actual, -99 * vectors_actual, -1 gangs_min = acc_gang (); gangs_max = acc_gang (); diff --git a/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90 b/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90 new file mode 100644 index 0000000..4be7507 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90 @@ -0,0 +1,35 @@ +! 'atomic' access of gang-private variable + +! { dg-do run } + +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + + +program main + integer :: w, arr(0:31) + + !$acc parallel num_gangs(32) num_workers(32) copyout(arr) + !$acc loop gang private(w) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'w' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } + ! { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-3 } + ! { dg-note {variable 'w' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } .-4 } + do j = 0, 31 + w = 0 + !$acc loop seq + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + do i = 0, 31 + !$acc atomic update + w = w + 1 + !$acc end atomic + end do + arr(j) = w + end do + !$acc end parallel + + if (any (arr .ne. 32)) stop 1 +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90 b/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90 new file mode 100644 index 0000000..e916837 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90 @@ -0,0 +1,42 @@ +! 'atomic' access of vector-private variable + +! { dg-do run } + +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + + +program main + integer :: w, arr(0:31) + + !$acc parallel num_gangs(32) num_workers(32) copyout(arr) + !$acc loop gang worker vector private(w) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'w' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } + ! { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } .-3 } + ! { dg-note {variable 'w' adjusted for OpenACC privatization level: 'vector'} "" { target { ! openacc_host_selected } } .-4 } + do j = 0, 31 + w = 0 + !$acc loop seq + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + do i = 0, 31 + !$acc atomic update + w = w + 1 + ! nvptx offloading: PR83812 "operation not supported on global/shared address space". + ! { dg-output "(\n|\r\n|\r)libgomp: cuStreamSynchronize error: operation not supported on global/shared address space(\n|\r\n|\r)$" { target openacc_nvidia_accel_selected } } + ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + ! { dg-shouldfail "XFAILed" { openacc_nvidia_accel_selected } } + ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + ! { dg-final { if { [dg-process-target { xfail openacc_nvidia_accel_selected }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } + ! ... so that we still get an XFAIL visible in the log. + !$acc end atomic + end do + arr(j) = w + end do + !$acc end parallel + + if (any (arr .ne. 32)) stop 1 +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90 b/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90 new file mode 100644 index 0000000..5fa157b --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90 @@ -0,0 +1,42 @@ +! 'atomic' access of worker-private variable + +! { dg-do run } + +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + + +program main + integer :: w, arr(0:31) + + !$acc parallel num_gangs(32) num_workers(32) copyout(arr) + !$acc loop gang worker private(w) + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + ! { dg-note {variable 'w' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } + ! { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } .-3 } + ! { dg-note {variable 'w' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } .-4 } + do j = 0, 31 + w = 0 + !$acc loop seq + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } + do i = 0, 31 + !$acc atomic update + w = w + 1 + ! nvptx offloading: PR83812 "operation not supported on global/shared address space". + ! { dg-output "(\n|\r\n|\r)libgomp: cuStreamSynchronize error: operation not supported on global/shared address space(\n|\r\n|\r)$" { target openacc_nvidia_accel_selected } } + ! Scan for what we expect in the "XFAILed" case (without actually XFAILing). + ! { dg-shouldfail "XFAILed" { openacc_nvidia_accel_selected } } + ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all. + ! { dg-final { if { [dg-process-target { xfail openacc_nvidia_accel_selected }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } + ! ... so that we still get an XFAIL visible in the log. + !$acc end atomic + end do + arr(j) = w + end do + !$acc end parallel + + if (any (arr .ne. 32)) stop 1 +end program main diff --git a/libgomp/testsuite/libgomp.oacc-fortran/private-variables.f90 b/libgomp/testsuite/libgomp.oacc-fortran/private-variables.f90 index 81043a2..e40a82f 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/private-variables.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/private-variables.f90 @@ -2,9 +2,23 @@ ! { dg-do run } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting ! aspects of that functionality. +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_loop 0] } +! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". + ! Test of gang-private variables declared on loop directive. @@ -18,7 +32,9 @@ subroutine t1() !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } - !$acc loop gang private(x) + !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 1, 32 x = i * 2; arr(i) = arr(i) + x @@ -43,11 +59,14 @@ subroutine t2() !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } - !$acc loop gang private(x) + !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 x = i * 2; - !$acc loop worker + !$acc loop worker ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 arr(i * 32 + j) = arr(i * 32 + j) + x end do @@ -72,11 +91,14 @@ subroutine t3() !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } - !$acc loop gang private(x) + !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 x = i * 2; - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 arr(i * 32 + j) = arr(i * 32 + j) + x end do @@ -106,14 +128,26 @@ subroutine t4() !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } - !$acc loop gang private(pt) + !$acc loop gang private(pt) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! But, with optimizations enabled, per the '*.ssa' dump ('gcc/tree-ssa.c:execute_update_addresses_taken'): + ! No longer having address taken: pt + ! However, 'pt' remains in the candidate set: + ! { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop } + ! Now, for GCN offloading, 'adjust_private_decl' does the privatization change right away: + ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'gang'} "" { target openacc_radeon_accel_selected } l_loop$c_loop } + ! For nvptx offloading however, we first mark up 'pt', and then later apply the privatization change -- or, with optimizations enabled, don't, because we then don't actually call 'expand_var_decl'. + ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && { ! __OPTIMIZE__ } } } l_loop$c_loop } + ! { dg-bogus {note: variable 'pt' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && __OPTIMIZE__ } } l_loop$c_loop } do i = 0, 31 pt%x = i pt%y = i * 2 pt%z = i * 4 pt%attr(5) = i * 6 - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 arr(i * 32 + j) = arr(i * 32 + j) + pt%x + pt%y + pt%z + pt%attr(5); end do @@ -136,16 +170,22 @@ subroutine t5() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker + !$acc loop worker ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 - !$acc loop vector private(x) + !$acc loop vector private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 x = ieor(i, j * 3) arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do - !$acc loop vector private(x) + !$acc loop vector private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 x = ior(i, j * 5) arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k @@ -177,11 +217,18 @@ subroutine t6() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker + !$acc loop worker ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 - !$acc loop vector private(x, pt) + !$acc loop vector private(x, pt) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-bogus {note: variable 'x' in 'private' clause} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'vector'} "" { target { ! openacc_host_selected } } l_loop$c_loop } do k = 0, 31 pt(1) = ieor(i, j * 3) pt(2) = ior(i, j * 5) @@ -217,9 +264,13 @@ subroutine t7() !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } - !$acc loop gang private(x) + !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-bogus {note: variable 'x' in 'private' clause} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker private(x) + !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 x = ieor(i, j * 3) arr(i * 32 + j) = arr(i * 32 + j) + x @@ -244,13 +295,17 @@ subroutine t8() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker private(x) + !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 x = ieor(i, j * 3) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do @@ -280,23 +335,30 @@ subroutine t9() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker private(x) + !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 x = ieor(i, j * 3) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do end do - !$acc loop worker private(x) + !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 x = ior(i, j * 5) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do @@ -328,20 +390,25 @@ subroutine t10() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker private(x) + !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 x = ieor(i, j * 3) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do x = ior(i, j * 5) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do @@ -375,21 +442,29 @@ subroutine t11() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker private(x, p) + !$acc loop worker private(x, p) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'x' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } + ! { dg-note {variable 'p' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 p => x x = ieor(i, j * 3) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do p = ior(i, j * 5) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k end do @@ -426,19 +501,24 @@ subroutine t12() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker private(pt) + !$acc loop worker private(pt) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do j = 0, 31 pt%x = ieor(i, j * 3) pt%y = ior(i, j * 5) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%x * k end do - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%y * k end do @@ -470,19 +550,26 @@ subroutine t13() end do !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) - !$acc loop gang + !$acc loop gang ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 0, 31 - !$acc loop worker private(pt) + !$acc loop worker private(pt) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } */ do j = 0, 31 pt(1) = ieor(i, j * 3) pt(2) = ior(i, j * 5) - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(1) * k end do - !$acc loop vector + !$acc loop vector ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do k = 0, 31 arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(2) * k end do @@ -518,13 +605,17 @@ subroutine t14() !$acc parallel private(x) copy(arr) num_gangs(n) num_workers(8) vector_length(32) ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } - !$acc loop gang(static:1) + !$acc loop gang(static:1) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 1, n x = i * 2; end do - !$acc loop gang(static:1) + !$acc loop gang(static:1) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } do i = 1, n + ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop } + !TODO Unhandled 'CONST_DECL' instance for constant argument in 'acc_on_device' call. if (acc_on_device (acc_device_host) .eqv. .TRUE.) x = i * 2 arr(i) = arr(i) + x end do diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 new file mode 100644 index 0000000..baaee02 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 @@ -0,0 +1,157 @@ +! { dg-do run } + +! PR65181 "Support for alloca in nvptx" +! { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target openacc_nvidia_accel_selected } } +! Aside from restricting this testcase to non-nvptx offloading, and duplicating +! it with 'dg-do link' for nvptx offloading, there doesn't seem to be a way to +! XFAIL the "UNRESOLVED: [...] compilation failed to produce executable", or +! get rid of it, unfortunately. + +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. +! Prune a few: uninteresting, and varying depending on GCC configuration (data types): +! { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } + +! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' +! passed to 'incr' may be unset, and in that case, it will be set to [...]", +! so to maintain compatibility with earlier Tcl releases, we manually +! initialize counter variables: +! { dg-line l_dummy[variable c_compute 0 c_loop 0] } +! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid +! "WARNING: dg-line var l_dummy defined, but not used". */ + +program main + implicit none (type, external) + integer :: j + integer, allocatable :: A(:) + character(len=:), allocatable :: my_str + character(len=15), allocatable :: my_str15 + + A = [(3*j, j=1, 10)] + call foo (A, size(A)) + call bar (A) + my_str = "1234567890" + call foo_str(my_str) + call bar_str(my_str) + my_str15 = "123456789012345" + call foobar (my_str15) + deallocate (A, my_str, my_str15) +contains + subroutine foo (array, nn) + integer :: i, nn + integer :: array(nn) + + !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + array = [(-i, i = 1, nn)] + !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'array' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop } + ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } l_loop$c_loop } + do i = 1, 10 + array(i) = i + end do + if (any (array /= [(-i, i = 1, nn)])) error stop 1 + !$acc end parallel + end subroutine foo + subroutine bar (array) + integer :: i + integer :: array(:) + + !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] } + ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'parm\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } + ! { dg-note {variable 'parm\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_compute$c_compute } + ! { dg-note {variable 'A\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_compute$c_compute } + array = [(-2*i, i = 1, size(array))] + !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'array\.[0-9]+' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'array\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'array\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_loop$c_loop } + ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } l_loop$c_loop } + do i = 1, 10 + array(i) = 9*i + end do + if (any (array /= [(-2*i, i = 1, 10)])) error stop 2 + !$acc end parallel + end subroutine bar + subroutine foo_str(str) + integer :: i + character(len=*) :: str + + !$acc parallel copyout(str) + str = "abcdefghij" + !$acc loop gang private(str) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'str' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'char\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'char\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'char\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_loop$c_loop } + ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } l_loop$c_loop } + do i = 1, 10 + str(i:i) = achar(ichar('A') + i) + end do + if (str /= "abcdefghij") error stop 3 + !$acc end parallel + end + subroutine bar_str(str) + integer :: i + character(len=:), allocatable :: str + +! *************************************** +! FIXME: Fails due to PR middle-end/95499 +! *************************************** + !!$acc parallel copyout(str) + str = "abcdefghij" + !!$acc loop gang private(str) + !do i = 1, 10 + ! str(i:i) = achar(ichar('A') + i) + !end do + if (str /= "abcdefghij") error stop 5 + !!$acc end parallel + end + subroutine foobar (scalar) + integer :: i + character(len=15), optional :: scalar + + !$acc parallel copyout(scalar) + scalar = "abcdefghi-12345" + !$acc loop gang private(scalar) ! { dg-line l_loop[incr c_loop] } + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'scalar' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'char\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'char\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop } + ! { dg-note {variable 'char\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_loop$c_loop } + do i = 1, 15 + scalar(i:i) = achar(ichar('A') + i) + end do + !$acc end parallel + if (scalar /= "abcdefghi-12345") error stop 6 + end subroutine foobar + subroutine foobar15 (scalar) + integer :: i + character(len=15), optional, allocatable :: scalar + + !$acc parallel copyout(scalar) + scalar = "abcdefghi-12345" + !$acc loop gang private(scalar) + do i = 1, 15 + scalar(i:i) = achar(ichar('A') + i) + end do + !$acc end parallel + if (scalar /= "abcdefghi-12345") error stop 1 + end subroutine foobar15 +end diff --git a/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90 b/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90 index c34de3a..75660bb 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90 @@ -2,6 +2,12 @@ ! { dg-do run } ! { dg-additional-options "-cpp" } +! { dg-additional-options "-fopt-info-note-omp" } +! { dg-additional-options "--param=openacc-privatization=noisy" } +! { dg-additional-options "-foffload=-fopt-info-note-omp" } +! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } +! for testing/documenting aspects of that functionality. + ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting ! aspects of that functionality. !TODO { dg-additional-options "-fno-inline" } for stable results regarding OpenACC 'routine'. @@ -20,6 +26,7 @@ program main !$acc parallel copy (a) !$acc loop seq + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N call seq (a) end do @@ -31,6 +38,7 @@ program main !$acc parallel copy (a) !$acc loop seq + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N call gang (a) end do @@ -46,6 +54,7 @@ program main !$acc parallel copy (b) !$acc loop seq + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N call worker (b) end do @@ -61,6 +70,7 @@ program main !$acc parallel copy (a) !$acc loop seq + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N call vector (a) end do @@ -78,6 +88,7 @@ subroutine vector (a) integer :: i !$acc loop vector + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N a(i) = a(i) - a(i) end do @@ -90,8 +101,10 @@ subroutine worker (b) integer :: i, j !$acc loop worker + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N !$acc loop vector + ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do j = 1, M b(j + ((i - 1) * M)) = b(j + ((i - 1) * M)) + 1 end do @@ -107,6 +120,7 @@ subroutine gang (a) integer :: i !$acc loop gang + ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } do i = 1, N a(i) = a(i) - i end do diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 5833998..87be850 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,11 @@ +2021-05-21 Tamar Christina <tamar.christina@arm.com> + + PR sanitizer/100379 + * sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick + llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135. + * sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise. + * sanitizer_common/sanitizer_platform_limits_posix.h: Likewise. + 2021-05-13 Iain Sandoe <iain@sandoe.co.uk> * LOCAL_PATCHES: Add Darwin patch for __builtin_os_log_format. diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc index 7f18125..b7da659 100644 --- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc @@ -370,15 +370,6 @@ static void ioctl_table_fill() { #if SANITIZER_GLIBC // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE - _(CYGETDEFTHRESH, WRITE, sizeof(int)); - _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); - _(CYGETMON, WRITE, struct_cyclades_monitor_sz); - _(CYGETTHRESH, WRITE, sizeof(int)); - _(CYGETTIMEOUT, WRITE, sizeof(int)); - _(CYSETDEFTHRESH, NONE, 0); - _(CYSETDEFTIMEOUT, NONE, 0); - _(CYSETTHRESH, NONE, 0); - _(CYSETTIMEOUT, NONE, 0); _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp index 35a690c..6e5c330 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp @@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t; # include <sys/procfs.h> #endif #include <sys/user.h> -#include <linux/cyclades.h> #include <linux/if_eql.h> #include <linux/if_plip.h> #include <linux/lp.h> @@ -460,7 +459,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); #if SANITIZER_GLIBC unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); - unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); #if EV_VERSION > (0x010000) unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); #else @@ -824,15 +822,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); #endif // SANITIZER_LINUX #if SANITIZER_LINUX && !SANITIZER_ANDROID - unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; - unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; - unsigned IOCTL_CYGETMON = CYGETMON; - unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; - unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; - unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; - unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; - unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; - unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index ad358ee..cba41ba 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz; #if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned struct_ax25_parms_struct_sz; -extern unsigned struct_cyclades_monitor_sz; extern unsigned struct_input_keymap_entry_sz; extern unsigned struct_ipx_config_data_sz; extern unsigned struct_kbdiacrs_sz; @@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE; #endif // SANITIZER_LINUX #if SANITIZER_LINUX && !SANITIZER_ANDROID -extern unsigned IOCTL_CYGETDEFTHRESH; -extern unsigned IOCTL_CYGETDEFTIMEOUT; -extern unsigned IOCTL_CYGETMON; -extern unsigned IOCTL_CYGETTHRESH; -extern unsigned IOCTL_CYGETTIMEOUT; -extern unsigned IOCTL_CYSETDEFTHRESH; -extern unsigned IOCTL_CYSETDEFTIMEOUT; -extern unsigned IOCTL_CYSETTHRESH; -extern unsigned IOCTL_CYSETTIMEOUT; extern unsigned IOCTL_EQL_EMANCIPATE; extern unsigned IOCTL_EQL_ENSLAVE; extern unsigned IOCTL_EQL_GETMASTRCFG; diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 91ba017..947b35d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,113 @@ +2021-05-21 Patrick Palka <ppalka@redhat.com> + + PR libstdc++/100606 + * include/std/ranges (drop_while_view::begin): Assert the + precondition added by LWG 3490. + +2021-05-21 Patrick Palka <ppalka@redhat.com> + + PR libstdc++/100690 + * include/std/ranges (iota_view::_Sentinel::_M_distance_from): + Split out this member function from ... + (iota_view::_Sentinel::operator-): ... here, for sake of access + control. + * testsuite/std/ranges/iota/iota_view.cc (test05): New test. + +2021-05-20 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/random.tcc (__representable_as_double) + (__p1_representable_as_double): Add "" to static asserts. + +2021-05-20 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/100676 + * include/bits/c++config (__glibcxx_assert_1): Rename to ... + (__glibcxx_constexpr_assert): ... this. + (__glibcxx_assert_impl): Use __glibcxx_constexpr_assert. + (__glibcxx_assert): Define as either __glibcxx_constexpr_assert + or __glibcxx_assert_impl. + (__glibcxx_assert_2): Remove + * include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_AT_F): Use + __glibcxx_constexpr_assert instead of __glibcxx_assert_1. + * testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc: + Adjust expected error. + * testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: + Likewise. + * testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc: + Likewise. + Likewise. + * testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc: + Likewise. + * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: + Likewise. + * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc: + Likewise. + * testsuite/23_containers/span/back_neg.cc: Likewise. + * testsuite/23_containers/span/front_neg.cc: Likewise. + * testsuite/23_containers/span/index_op_neg.cc: Likewise. + +2021-05-20 Patrick Palka <ppalka@redhat.com> + + PR libstdc++/100639 + * include/bits/stl_iterator.h (reverse_iterator::difference_type): + In C++20 mode, define in terms of iter_difference_t as per P0896R4. + (reverse_iterator::reference): Likewise, but with iter_reference_t. + (reverse_iterator::value_type): Likewise, but with iter_value_t. + * testsuite/std/ranges/adaptors/reverse.cc (test08): New test. + * testsuite/24_iterators/reverse_iterator/100639.cc: New test. + +2021-05-20 Joern Rennecke <joern.rennecke@riscy-ip.com> + + PR libstdc++/100361 + * include/std/charconv (to_chars): Hide the overloads for + floating-point types for 16 bit targets. + * src/c++17/floating_to_chars.cc: Don't compile for 16 bit targets. + * testsuite/20_util/to_chars/double.cc: Run this test only on + size32plus targets. + * testsuite/20_util/to_chars/float.cc: Likewise. + * testsuite/20_util/to_chars/long_double.cc: Likewise. + +2021-05-18 Patrick Palka <ppalka@redhat.com> + + PR libstdc++/100631 + * include/std/ranges (elements_view::_Sentinel::operator-): Use + _M_distance_from in the other operator- overload too. + * testsuite/std/ranges/adaptors/elements.cc (test06): Augment test. + +2021-05-18 Thomas Schwinge <thomas@codesourcery.com> + + * testsuite/lib/prune.exp: Add note about 'dg-note'. + +2021-05-18 Patrick Palka <ppalka@redhat.com> + + PR libstdc++/100475 + * include/std/ranges (__box::__box): Use non-list-initialization + in member initializer list of in-place constructor of the + partial specialization for semiregular types. + (__box::operator->): Use std::__addressof. + * testsuite/std/ranges/adaptors/detail/semiregular_box.cc + (test02): New test. + * testsuite/std/ranges/single_view.cc (test04): New test. + +2021-05-18 Patrick Palka <ppalka@redhat.com> + + PR libstdc++/100621 + * include/std/ranges (reverse_view::_S_needs_cached_begin): + Set to true if the underlying non-common random-access range + doesn't have a sized sentinel. + +2021-05-18 Patrick Palka <ppalka@redhat.com> + + PR libstdc++/100631 + * include/std/ranges (elements_view::_Iterator): Also befriend + _Sentinel<!_Const>. + (elements_view::_Sentinel::_M_equal): Templatize. + (elements_view::_Sentinel::_M_distance_from): Split out from ... + (elements_view::_Sentinel::operator-): ... here. Depend on + _Base2 instead of _Base in the return type. + * testsuite/std/ranges/adaptors/elements.cc (test06, test07): + New tests. + 2021-05-17 Thomas Rodgers <rodgert@twrodgers.com> * include/bits/atomic_wait.h (__waiter::_M_do_wait_v): loop diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 72ec919..9314117 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -487,6 +487,16 @@ namespace std # define _GLIBCXX_EXTERN_TEMPLATE -1 #endif + +#if __has_builtin(__builtin_is_constant_evaluated) +# define __glibcxx_constexpr_assert(cond) \ + if (__builtin_is_constant_evaluated() && !bool(cond)) \ + __builtin_unreachable() /* precondition violation detected! */ +#else +# define __glibcxx_constexpr_assert(unevaluated) +#endif + + // Assert. #if defined(_GLIBCXX_ASSERTIONS) \ || defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PARALLEL_ASSERTIONS) @@ -506,14 +516,19 @@ namespace std } #define __glibcxx_assert_impl(_Condition) \ if (__builtin_expect(!bool(_Condition), false)) \ + { \ + __glibcxx_constexpr_assert(_Condition); \ std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ - #_Condition) + #_Condition); \ + } #endif #if defined(_GLIBCXX_ASSERTIONS) -# define __glibcxx_assert_2(_Condition) __glibcxx_assert_impl(_Condition) +# define __glibcxx_assert(cond) \ + do { __glibcxx_assert_impl(cond); } while (false) #else -# define __glibcxx_assert_2(_Condition) +# define __glibcxx_assert(cond) \ + do { __glibcxx_constexpr_assert(cond); } while (false) #endif // Macros for race detectors. @@ -736,25 +751,6 @@ namespace std #undef _GLIBCXX_HAS_BUILTIN -#if _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED && __cplusplus >= 201402L -# define __glibcxx_assert_1(_Condition) \ - if (__builtin_is_constant_evaluated()) \ - { \ - void __failed_assertion(); \ - if (!bool(_Condition)) \ - __failed_assertion(); \ - } \ - else -#else -# define __glibcxx_assert_1(_Condition) -#endif - -# define __glibcxx_assert(_Condition) \ - do { \ - __glibcxx_assert_1(_Condition) \ - { __glibcxx_assert_2(_Condition); } \ - } while (false) - // PSTL configuration diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index bf43970..1357e18 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -811,8 +811,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr bool __representable_as_double(_Tp __x) noexcept { - static_assert(numeric_limits<_Tp>::is_integer); - static_assert(!numeric_limits<_Tp>::is_signed); + static_assert(numeric_limits<_Tp>::is_integer, ""); + static_assert(!numeric_limits<_Tp>::is_signed, ""); // All integers <= 2^53 are representable. return (__x <= (1ull << __DBL_MANT_DIG__)) // Between 2^53 and 2^54 only even numbers are representable. @@ -824,8 +824,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr bool __p1_representable_as_double(_Tp __x) noexcept { - static_assert(numeric_limits<_Tp>::is_integer); - static_assert(!numeric_limits<_Tp>::is_signed); + static_assert(numeric_limits<_Tp>::is_integer, ""); + static_assert(!numeric_limits<_Tp>::is_signed, ""); return numeric_limits<_Tp>::digits < __DBL_MANT_DIG__ || (bool(__x + 1u) // return false if x+1 wraps around to zero && __detail::__representable_as_double(__x + 1u)); diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 2409cd7..8768624 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -149,11 +149,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: typedef _Iterator iterator_type; - typedef typename __traits_type::difference_type difference_type; typedef typename __traits_type::pointer pointer; +#if __cplusplus <= 201703L + typedef typename __traits_type::difference_type difference_type; typedef typename __traits_type::reference reference; - -#if __cplusplus > 201703L && __cpp_lib_concepts +#else using iterator_concept = conditional_t<random_access_iterator<_Iterator>, random_access_iterator_tag, @@ -161,6 +161,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using iterator_category = __detail::__clamp_iter_cat<typename __traits_type::iterator_category, random_access_iterator_tag>; + using value_type = iter_value_t<_Iterator>; + using difference_type = iter_difference_t<_Iterator>; + using reference = iter_reference_t<_Iterator>; #endif /** diff --git a/libstdc++-v3/include/debug/macros.h b/libstdc++-v3/include/debug/macros.h index 9ac52eb..9e1288c 100644 --- a/libstdc++-v3/include/debug/macros.h +++ b/libstdc++-v3/include/debug/macros.h @@ -45,8 +45,8 @@ #define _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,_Func) \ do { \ - __glibcxx_assert_1(_Cond) \ - { _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func); } \ + __glibcxx_constexpr_assert(_Cond); \ + _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func); \ } while (false) #define _GLIBCXX_DEBUG_VERIFY_AT(_Cond,_ErrMsg,_File,_Line) \ diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv index 193702e..ac9c34d 100644 --- a/libstdc++-v3/include/std/charconv +++ b/libstdc++-v3/include/std/charconv @@ -703,7 +703,8 @@ namespace __detail chars_format __fmt = chars_format::general) noexcept; #endif -#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 +#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \ + && __SIZE_WIDTH__ >= 32 // Floating-point std::to_chars // Overloads for float. diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index ca62f73..76add25 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -499,6 +499,10 @@ namespace ranges _M_equal(const _Iterator& __x) const { return __x._M_value == _M_bound; } + constexpr auto + _M_distance_from(const _Iterator& __x) const + { return _M_bound - __x._M_value; } + _Bound _M_bound = _Bound(); public: @@ -515,12 +519,12 @@ namespace ranges friend constexpr iter_difference_t<_Winc> operator-(const _Iterator& __x, const _Sentinel& __y) requires sized_sentinel_for<_Bound, _Winc> - { return __x._M_value - __y._M_bound; } + { return -__y._M_distance_from(__x); } friend constexpr iter_difference_t<_Winc> operator-(const _Sentinel& __x, const _Iterator& __y) requires sized_sentinel_for<_Bound, _Winc> - { return -(__y - __x); } + { return __x._M_distance_from(__y); } }; _Winc _M_value = _Winc(); @@ -2186,6 +2190,7 @@ namespace views::__adaptor if (_M_cached_begin._M_has_value()) return _M_cached_begin._M_get(_M_base); + __glibcxx_assert(_M_pred.has_value()); auto __it = __detail::find_if_not(ranges::begin(_M_base), ranges::end(_M_base), std::cref(*_M_pred)); @@ -3687,7 +3692,7 @@ namespace views::__adaptor requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>> friend constexpr range_difference_t<_Base2> operator-(const _Iterator<_Const2>& __x, const _Sentinel& __y) - { return __x._M_current - __y._M_end; } + { return -__y._M_distance_from(__x); } template<bool _Const2, typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>> diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc b/libstdc++-v3/src/c++17/floating_to_chars.cc index 1a0abb9..44f547a 100644 --- a/libstdc++-v3/src/c++17/floating_to_chars.cc +++ b/libstdc++-v3/src/c++17/floating_to_chars.cc @@ -50,7 +50,9 @@ extern "C" int __sprintfieee128(char*, const char*, ...); // This implementation crucially assumes float/double have the // IEEE binary32/binary64 formats. -#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 +#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \ + /* And it also assumes that uint64_t POW10_SPLIT_2[3133][3] is valid. */\ + && __SIZE_WIDTH__ >= 32 // Determine the binary format of 'long double'. diff --git a/libstdc++-v3/testsuite/20_util/to_chars/double.cc b/libstdc++-v3/testsuite/20_util/to_chars/double.cc index bb6f744..64e6221 100644 --- a/libstdc++-v3/testsuite/20_util/to_chars/double.cc +++ b/libstdc++-v3/testsuite/20_util/to_chars/double.cc @@ -33,6 +33,7 @@ // { dg-do run { target c++17 } } // { dg-require-effective-target ieee-floats } +// { dg-require-effective-target size32plus } #include <charconv> diff --git a/libstdc++-v3/testsuite/20_util/to_chars/float.cc b/libstdc++-v3/testsuite/20_util/to_chars/float.cc index 0c8dd4f..73b9081 100644 --- a/libstdc++-v3/testsuite/20_util/to_chars/float.cc +++ b/libstdc++-v3/testsuite/20_util/to_chars/float.cc @@ -33,6 +33,7 @@ // { dg-do run { target c++17 } } // { dg-require-effective-target ieee-floats } +// { dg-require-effective-target size32plus } #include <charconv> diff --git a/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc b/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc index 8cf45ad..447e536 100644 --- a/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc +++ b/libstdc++-v3/testsuite/20_util/to_chars/long_double.cc @@ -35,6 +35,7 @@ // { dg-xfail-run-if "Non-conforming printf (see PR98384)" { *-*-solaris* *-*-darwin* } } // { dg-require-effective-target ieee-floats } +// { dg-require-effective-target size32plus } #include <charconv> diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc index 0f731c9..2da90bd 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc @@ -32,4 +32,4 @@ back() static_assert(back() != 'a'); // { dg-error "non-constant condition" } // { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "failed_assertion" } +// { dg-prune-output "unreachable" } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc index 5dd206f..844b622 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc @@ -31,4 +31,4 @@ test() static_assert(test() == 0); // { dg-error "non-constant condition" } // { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "failed_assertion" } +// { dg-prune-output "unreachable" } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc index 9c84611..d6dceb6 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc @@ -32,4 +32,4 @@ front() static_assert(front() != 'a'); // { dg-error "non-constant condition" } // { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "failed_assertion" } +// { dg-prune-output "unreachable" } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc index 26d2d4d..798e1a4 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc @@ -32,4 +32,4 @@ back() static_assert(back() != L'a'); // { dg-error "non-constant condition" } // { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "failed_assertion" } +// { dg-prune-output "unreachable" } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc index c853dad..0e22b76 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc @@ -31,4 +31,4 @@ test() static_assert(test() == 0); // { dg-error "non-constant condition" } // { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "failed_assertion" } +// { dg-prune-output "unreachable" } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc index fdcabd7..f49774a 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc @@ -32,4 +32,4 @@ front() static_assert(front() != L'a'); // { dg-error "non-constant condition" } // { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "failed_assertion" } +// { dg-prune-output "unreachable" } diff --git a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc index 0289ece..ce00aa8 100644 --- a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc @@ -31,5 +31,5 @@ test01(bool b) static_assert(test01(false)); static_assert(test01(true)); // { dg-error "non-constant" } -// { dg-error "assert" "" { target *-*-* } 0 } +// { dg-error "unreachable" "" { target *-*-* } 0 } // { dg-prune-output "in 'constexpr' expansion" } diff --git a/libstdc++-v3/testsuite/23_containers/span/front_neg.cc b/libstdc++-v3/testsuite/23_containers/span/front_neg.cc index dfad9f8..a6efc7d 100644 --- a/libstdc++-v3/testsuite/23_containers/span/front_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/front_neg.cc @@ -31,5 +31,5 @@ test01(bool b) static_assert(test01(false)); static_assert(test01(true)); // { dg-error "non-constant" } -// { dg-error "assert" "" { target *-*-* } 0 } +// { dg-error "unreachable" "" { target *-*-* } 0 } // { dg-prune-output "in 'constexpr' expansion" } diff --git a/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc b/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc index 378ae05..2dce639 100644 --- a/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc @@ -31,5 +31,5 @@ test01(bool b) static_assert(test01(false)); static_assert(test01(true)); // { dg-error "non-constant" } -// { dg-error "assert" "" { target *-*-* } 0 } +// { dg-error "unreachable" "" { target *-*-* } 0 } // { dg-prune-output "in 'constexpr' expansion" } diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/100639.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/100639.cc new file mode 100644 index 0000000..358d91d --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/100639.cc @@ -0,0 +1,37 @@ +// Copyright (C) 2021 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 library 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 this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=c++2a" } +// { dg-do compile { target c++2a } } + +// PR libstdc++/100639 + +#include <iterator> +#include <ranges> + +void +test01() +{ + using iter = std::ranges::iterator_t<std::ranges::iota_view<long long>>; + using riter = std::reverse_iterator<iter>; + static_assert(std::same_as<std::iter_reference_t<iter>, + std::iter_reference_t<riter>>); + static_assert(std::same_as<std::iter_value_t<iter>, + std::iter_value_t<riter>>); + static_assert(std::same_as<std::iter_difference_t<iter>, + std::iter_difference_t<riter>>); +} diff --git a/libstdc++-v3/testsuite/lib/prune.exp b/libstdc++-v3/testsuite/lib/prune.exp index 45c77d2..fd4a0ac 100644 --- a/libstdc++-v3/testsuite/lib/prune.exp +++ b/libstdc++-v3/testsuite/lib/prune.exp @@ -52,6 +52,8 @@ proc libstdc++-dg-prune { system text } { regsub -all "(^|\n)\[ \t\]*from \[^\n\]*" $text "" text # Ignore informational notes. + #TODO As this isn't even using 'gcc-dg.exp', cannot consider its + # 'variable prune_notes' (for 'dg-note') here. regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text # Ignore errata warning from IA64 assembler. diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc index c6839e3..1322f44 100644 --- a/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc @@ -128,7 +128,8 @@ test06() | views::keys; auto b = r.begin(); auto e = r.end(); - e - b; + VERIFY( e - b == 42 ); + VERIFY( b - e == -42 ); } void diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc index 47e34eb..d9094a9 100644 --- a/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc @@ -161,6 +161,15 @@ test07() static_assert(!requires { 0 | reverse; }); } +void +test08() +{ + // PR libstdc++/100639 + auto v = views::iota(1701ll, 3000ll) | views::reverse | views::take(5); + for (auto x : v) + ; +} + int main() { @@ -171,4 +180,5 @@ main() test05(); test06(); test07(); + test08(); } diff --git a/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc b/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc index be86951..362ef1f 100644 --- a/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc +++ b/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc @@ -80,6 +80,16 @@ test04() // Verify we optimize away the 'bound' data member of an unbounded iota_view. static_assert(sizeof(std::ranges::iota_view<char>) == 1); +void +test05() +{ + // PR libstdc++/100690 + int x[] = {42, 42, 42}; + auto r = std::views::iota(std::ranges::begin(x), std::ranges::cbegin(x) + 3); + VERIFY( r.end() - r.begin() == 3 ); + VERIFY( r.begin() - r.end() == -3 ); +} + int main() { @@ -87,4 +97,5 @@ main() test02(); test03(); test04(); + test05(); } |