]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 years agoUse more appropriate var in localize_reductions call
Julian Brown [Fri, 6 Sep 2019 15:46:20 +0000 (08:46 -0700)] 
Use more appropriate var in localize_reductions call

gcc/
* gimplify.c (gimplify_omp_for): Use for_stmt in call to
localize_reductions.

4 years agoRemove duplicate SESE code in NVPTX backend
Julian Brown [Fri, 6 Sep 2019 11:53:17 +0000 (04:53 -0700)] 
Remove duplicate SESE code in NVPTX backend

gcc/
* config/nvptx/nvptx.c (omp-sese.h): Include.
(bb_pair_t, bb_pair_vec_t, pseudo_node_t, bracket, bracket_vec_t,
bb_sese, bb_sese::~bb_sese, bb_sese::append, bb_sese::remove,
BB_SET_SESE, BB_GET_SESE, nvptx_sese_number, nvptx_sese_pseudo,
nvptx_sese_color, nvptx_find_sese): Remove.
(nvptx_neuter_pars): Call omp_find_sese instead of nvptx_find_sese.
* omp-sese.c (omp-sese.h): Include.
(struct parallel): Rename to...
(struct parallel_g): This.
(parallel::parallel, parallel::~parallel): Rename to...
(parallel_g::parallel_g, parallel_g::~parallel_g): These.
(omp_sese_dump_pars, omp_sese_find_par, omp_sese_discover_pars,
populate_single_mode_bitmaps, find_ssa_names_to_propagate,
find_partitioned_var_uses, find_local_vars_to_propagate,
neuter_worker_single): Update for parallel_g name change.
(bb_pair_t, bb_pair_vec_t): Remove.
(omp_find_sese): Make global.
* omp-sese.h (bb_pair_t, bb_pair_vec_t): New.
(omp_find_sese): Add prototype.

4 years agoFix tree check failure with reduction localization
Julian Brown [Fri, 6 Sep 2019 11:42:16 +0000 (04:42 -0700)] 
Fix tree check failure with reduction localization

gcc/
* gimplify.c (gimplify_omp_workshare): Use OMP_CLAUSES, OMP_BODY
instead of OMP_TARGET_CLAUSES, OMP_TARGET_BODY.

4 years agoEnable worker partitioning for AMD GCN
Julian Brown [Tue, 3 Sep 2019 15:57:39 +0000 (08:57 -0700)] 
Enable worker partitioning for AMD GCN

gcc/
* config/gcn/gcn.c (gcn_goacc_validate_dims): Remove
no-flag_worker-partitioning assertion.
(TARGET_GOACC_WORKER_PARTITIONING): Define target hook to true.
* config/gcn/gcn.opt (flag_worker_partitioning): Change default to 1.

libgomp/
* plugin/plugin-gcn.c (gcn_exec): Change default number of workers to
16.

4 years agoReference reduction localization
Julian Brown [Tue, 3 Sep 2019 15:54:28 +0000 (08:54 -0700)] 
Reference reduction localization

gcc/
* gimplify.c (privatize_reduction): New struct.
(localize_reductions_r, localize_reductions): New functions.
(gimplify_omp_for): Call localize_reductions.
(gimplify_omp_workshare): Likewise.
* omp-low.c (lower_oacc_reductions): Handle localized reductions.
Create fewer temp vars.
* tree-core.h (omp_clause_code): Add OMP_CLAUSE_REDUCTION_PRIVATE_DECL
documentation.
* tree.c (omp_clause_num_ops): Bump number of ops for
OMP_CLAUSE_REDUCTION to 6.
(walk_tree_1): Adjust accordingly.
* tree.h (OMP_CLAUSE_REDUCTION_PRIVATE_DECL): Add macro.

4 years agoFix up tests for oaccdevlow pass splitting
Julian Brown [Tue, 3 Sep 2019 20:37:50 +0000 (13:37 -0700)] 
Fix up tests for oaccdevlow pass splitting

gcc/testsuite/
* c-c++-common/goacc/classify-kernels-unparallelized.c,
c-c++-common/goacc/classify-kernels.c,
c-c++-common/goacc/classify-parallel.c,
c-c++-common/goacc/classify-routine.c,
gfortran.dg/goacc/classify-kernels-unparallelized.f95,
gfortran.dg/goacc/classify-kernels.f95,
gfortran.dg/goacc/classify-parallel.f95,
gfortran.dg/goacc/classify-routine.f95: Scan oaccloops dump instead of
oaccdevlow pass.

4 years agoAMD GCN adjustments for middle-end worker partitioning
Julian Brown [Wed, 4 Sep 2019 23:33:02 +0000 (16:33 -0700)] 
AMD GCN adjustments for middle-end worker partitioning

gcc/
* config/gcn/gcn-protos.h (gcn_goacc_adjust_propagation_record): Rename
prototype to...
(gcn_goacc_create_propagation_record): This.
* config/gcn/gcn-tree.c (gcn_goacc_adjust_propagation_record): Rename
function to...
(gcn_goacc_create_propagation_record): This.  Adjust comment.
* config/gcn/gcn.c (gcn_init_builtins): Override decls for
        BUILT_IN_GOACC_SINGLE_START, BUILT_IN_GOACC_SINGLE_COPY_START,
        BUILT_IN_GOACC_SINGLE_COPY_END and BUILT_IN_GOACC_BARRIER.
(gcn_fork_join): Remove inaccurate comment.
(TARGET_GOACC_ADJUST_PROPAGATION_RECORD): Rename to...
(TARGET_GOACC_CREATE_PROPAGATION_RECORD): This.

4 years agoOpenACC middle-end worker-partitioning support
Julian Brown [Wed, 11 Oct 2017 15:07:18 +0000 (08:07 -0700)] 
OpenACC middle-end worker-partitioning support

gcc/
* Makefile.in (OBJS): Add omp-sese.o.
* omp-builtins.def (BUILT_IN_GOACC_BARRIER, BUILT_IN_GOACC_SINGLE_START,
        BUILT_IN_GOACC_SINGLE_COPY_START, BUILT_IN_GOACC_SINGLE_COPY_END): New
builtins.
* omp-offload.c (omp-sese.h): Include header.
(oacc_loop_xform_head_tail): Call update_stmt for modified builtin
calls.
(oacc_loop_process): Likewise.
(default_goacc_create_propagation_record): New default implementation
for TARGET_GOACC_CREATE_PROPAGATION_RECORD hook.
(execute_oacc_loop_designation): New.  Split out of oacc_device_lower.
(execute_oacc_gimple_workers): New.  Likewise.
(execute_oacc_device_lower): Recreate dims array.
(pass_data_oacc_loop_designation, pass_data_oacc_gimple_workers): New.
(pass_oacc_loop_designation, pass_oacc_gimple_workers): New.
(make_pass_oacc_loop_designation, make_pass_oacc_gimple_workers): New.
* omp-offload.h (oacc_fn_attrib_level): Add prototype.
* omp-sese.c: New file.
* omp-sese.h: New file.
* passes.def (pass_oacc_loop_designation, pass_oacc_gimple_workers):
Add passes.
* target.def (worker_partitioning, create_propagation_record): Add
target hooks.
* targhooks.h (default_goacc_create_propagation_record): Add prototype.
* tree-pass.h (make_pass_oacc_loop_designation,
make_pass_oacc_gimple_workers): Add prototypes.
* doc/tm.texi.in (TARGET_GOACC_WORKER_PARTITIONING,
TARGET_GOACC_CREATE_PROPAGATION_RECORD): Add documentation hooks.
* doc/tm.texi: Regenerate.

4 years agoTarget-dependent gang-private variable decl rewriting
Julian Brown [Tue, 3 Sep 2019 23:35:10 +0000 (16:35 -0700)] 
Target-dependent gang-private variable decl rewriting

gcc/
* omp-offload.c (convert.h): Include.
(struct addr_expr_rewrite_info): Add struct.
(rewrite_addr_expr): New function.
(is_sync_builtin_call): New function.
(execute_oacc_device_lower): Support rewriting gang-private variables
using target hook, and fix up addr_expr nodes afterwards.
* target.def (adjust_gangprivate_decl): New target hook.
* doc/tm.texi.in (TARGET_GOACC_ADJUST_GANGPRIVATE_DECL): Document new
target hook.
* doc/tm.texi: Regenerate.

4 years agoFix libgomp.oacc-fortran/lib-13.f90 async bug
Julian Brown [Tue, 3 Sep 2019 14:57:05 +0000 (07:57 -0700)] 
Fix libgomp.oacc-fortran/lib-13.f90 async bug

libgomp/
* testsuite/libgomp.oacc-fortran/lib-13.f90: End data region after
wait API calls.

4 years agoWait at end of OpenACC asynchronous kernels regions
Julian Brown [Fri, 9 Aug 2019 20:01:33 +0000 (13:01 -0700)] 
Wait at end of OpenACC asynchronous kernels regions

gcc/
* omp-oacc-kernels-decompose.cc (add_wait): New function, split out
of...
(add_async_clauses_and_wait): ...here. Call new outlined function.
(decompose_kernels_region_body): Add wait at the end of
explicitly-asynchronous kernels regions.

4 years agoAdd missing exec_params libgomp plugin entry points
Julian Brown [Mon, 5 Aug 2019 22:05:35 +0000 (15:05 -0700)] 
Add missing exec_params libgomp plugin entry points

libgomp/
* plugin/plugin-gcn.c (GOMP_OFFLOAD_openacc_exec_params,
GOMP_OFFLOAD_openacc_async_exec_params): New functions.

4 years agoNVPTX GOMP_OFFLOAD_openacc_async_construct arg fix and gomp_print_* support
Julian Brown [Mon, 29 Jul 2019 22:05:35 +0000 (15:05 -0700)] 
NVPTX GOMP_OFFLOAD_openacc_async_construct arg fix and gomp_print_* support

libgomp/
* config/nvptx/gomp_print.c (gomp_print_string, gomp_print_integer,
gomp_print_double): New.

4 years agoAdd changes to profiling interface from OG8 branch
Kwok Cheung Yeung [Fri, 21 Jun 2019 17:40:38 +0000 (10:40 -0700)] 
Add changes to profiling interface from OG8 branch

This bundles up the parts of the profiling code from the OG8 branch that were
not included in the upstream patch.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c: Update.

libgomp/
* oacc-init.c (get_property_any): Add profiling code.

libgomp/
* Makefile.am (libgomp_la_SOURCES): Add
oacc-profiling-acc_register_library.c.
* Makefile.in: Regenerate.
* libgomp.texi: Remove paragraph about acc_register_library.
* oacc-parallel.c (GOACC_parallel_keyed_internal): Set device_api for
profiling.
* oacc-profiling-acc_register_library.c: New file.
* oacc-profiling.c (goacc_profiling_initialize): Call
acc_register_library.  Avoid duplicate registration.
(acc_register_library): Remove.
* config/nvptx/oacc-profiling-acc_register_library.c:
New empty file.
* config/nvptx/oacc-profiling.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-dispatch-1.c: Remove
call to acc_register_library.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-parallel-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-valid_bytes-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-version-1.c: Likewise.

4 years agoAllow the accelerator to have more offloaded functions than the host
Cesar Philippidis [Sun, 7 Jul 2019 18:25:51 +0000 (11:25 -0700)] 
Allow the accelerator to have more offloaded functions than the host

libgomp/
* target.c (gomp_load_image_to_device): Allow the accelerator to
possess more offloaded functions than the host.

4 years agoAssumed-size arrays with non-lexical data mappings
Julian Brown [Fri, 5 Jul 2019 01:14:41 +0000 (18:14 -0700)] 
Assumed-size arrays with non-lexical data mappings

gcc/
* gimplify.c (gimplify_adjust_omp_clauses_1): Raise error for
assumed-size arrays in map clauses for Fortran/OpenMP.
* omp-low.c (lower_omp_target): Set the size of assumed-size Fortran
arrays to one to allow use of data already mapped on the offload device.

gcc/fortran/
* trans-openmp.c (gfc_omp_finish_clause): Change clauses mapping
assumed-size arrays to use the GOMP_MAP_FORCE_PRESENT map type.

4 years agoApply gangprivate attribute to innermost decl
Julian Brown [Tue, 28 May 2019 15:42:10 +0000 (08:42 -0700)] 
Apply gangprivate attribute to innermost decl

...and fix parallelism-level calculation when applying the attribute.

gcc/
* omp-low.c (mark_oacc_gangprivate): Add CTX parameter.  Use to look up
correct decl to add attribute to.
(lower_omp_for): Move "oacc gangprivate" processing from here...
(process_oacc_gangprivate_1): ...to here. New function.
(lower_omp_target): Update call to mark_oacc_gangprivate.
(execute_lower_omp): Call process_oacc_gangprivate_1 for each OMP
context.

libgomp/
* testsuite/libgomp.oacc-fortran/gangprivate-attrib-2.f90: New test.

4 years agoFix expected messages in goacc tests
Kwok Cheung Yeung [Fri, 31 May 2019 19:25:03 +0000 (12:25 -0700)] 
Fix expected messages in goacc tests

The expected messages in the OpenACC kernel-related tests should be prefixed
with 'optimized:' rather than 'note:'.

2019-05-31  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-1.c: Change 'note:' to
'optimized:'.  Fix typo.
* c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c:
Change 'note:' to 'optimized:'.
* c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c: Likewise.
* c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-1-kernels-loops.c: Likewise.
* c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c:
Likewise.
* c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c:
Likewise.
* c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-kernels-loop-auto.c: Likewise.
* c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-kernels-loops.c: Likewise.

4 years agoFix lexically-nested data mappings for no_alloc or optional arguments
Julian Brown [Tue, 21 May 2019 00:27:38 +0000 (17:27 -0700)] 
Fix lexically-nested data mappings for no_alloc or optional arguments

gcc/
* gimplify.c (gimplify_adjust_omp_clauses_1): Support implied no_alloc
and optional arguments based on mappings in enclosing data regions.

4 years agoFix references declared in lexically-enclosing OpenACC data region
Julian Brown [Sun, 19 May 2019 17:42:20 +0000 (10:42 -0700)] 
Fix references declared in lexically-enclosing OpenACC data region

gcc/fortran/
* trans-openmp.c (gfc_omp_finish_clause): Guard addition of clauses for
pointers with DECL_P.

gcc/
* gimplify.c (oacc_array_mapping_info): Add REF field.
(gimplify_scan_omp_clauses): Initialise above field for data blocks
passed by reference.
(gomp_oacc_needs_data_present): Handle references.
(gimplify_adjust_omp_clauses_1): Handle references and optional
arguments for variables declared in lexically-enclosing OpenACC data
region.

4 years agoAdd kernels for-index reuse testcase.
Julian Brown [Thu, 16 May 2019 12:47:16 +0000 (05:47 -0700)] 
Add kernels for-index reuse testcase.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-for-index-reuse-1.c: New
test.

4 years agoAvoid introducing 'create' mapping clauses for loop index variables in kernels regions
Julian Brown [Thu, 16 May 2019 12:45:35 +0000 (05:45 -0700)] 
Avoid introducing 'create' mapping clauses for loop index variables in kernels regions

gcc/
* omp-oacc-kernels-decompose.cc (find_omp_for_index_vars_1,
find_omp_for_index_vars): New functions.
(maybe_build_inner_data_region): Add IDX_VARS argument. Don't add
CREATE mapping clauses for loop index variables.  Set TREE_ADDRESSABLE
flag on newly-mapped declarations as a side effect.
(decompose_kernels_region_body): Call find_omp_for_index_vars.  Don't
create PRESENT clause for loop index variables.  Pass index variable
set to maybe_build_inner_data_region.

4 years agoUpdate OpenACC version to 2.6
Julian Brown [Wed, 9 Jan 2019 11:41:04 +0000 (03:41 -0800)] 
Update OpenACC version to 2.6

gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins): Update _OPENACC define to 201711.

gcc/doc/
* invoke.texi: Update mention of OpenACC version to 2.6.

gcc/fortran/
* cpp.c (cpp_define_builtins): Update _OPENACC define to 201711.
* gfortran.texi: Update mentions of OpenACC version to 2.6.
* intrinsic.texi: Likewise.

gcc/testsuite/
* c-c++-common/cpp/openacc-define-3.c: Update expected value for
_OPENACC define.
* gfortran.dg/openacc-define-3.f90: Likewise.

libgomp/
* libgomp.texi: Update mentions of OpenACC version to 2.6.  Update
section numbers to match version 2.6 of the spec.
* openacc.f90 (openacc_version): Update to 201711.
* openacc_lib.h (openacc_version): Update to 201711.
* testsuite/libgomp.oacc-fortran/openacc_version-1.f: Update expected
openacc_version to 201711.
* testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise.

4 years agoMake new OpenACC kernels conversion the default; adjust and add tests
Thomas Schwinge [Wed, 23 Jan 2019 10:40:08 +0000 (02:40 -0800)] 
Make new OpenACC kernels conversion the default; adjust and add tests

gcc/
* doc/invoke.texi (-fopenacc-kernels): Update.
gcc/testsuite/
* c-c++-common/goacc/classify-kernels-unparallelized.c: Update.
* c-c++-common/goacc/classify-kernels.c: Likewise.
* c-c++-common/goacc/classify-parallel.c: Likewise.
* c-c++-common/goacc/classify-routine.c: Likewise.
* c-c++-common/goacc/loop-2-kernels.c: Likewise.
* c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c:
New file.
* c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c:
Likewise.
* c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-1-kernels-loops.c: Likewise.
* c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c:
Likewise.
* c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c:
Likewise.
* c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-kernels-loop-auto.c:
Likewise.
* c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c:
Likewise.
* c-c++-common/goacc/note-parallelism-kernels-loops.c: Likewise.
* c-c++-common/goacc/note-parallelism.c: Likewise.
* c-c++-common/goacc/routine-1.c: Likewise.
* c-c++-common/goacc/uninit-dim-clause.c: Likewise.

4 years agoUse "--param=openacc-kernels=parloops" to document "parloops" test cases
Thomas Schwinge [Wed, 30 Jan 2019 09:32:10 +0000 (10:32 +0100)] 
Use "--param=openacc-kernels=parloops" to document "parloops" test cases

gcc/testsuite/
* c-c++-common/goacc/kernels-1.c: Add
"--param=openacc-kernels=parloops".
* c-c++-common/goacc/kernels-acc-loop-reduction.c: Likewise.
* c-c++-common/goacc/kernels-acc-loop-smaller-equal.c: Likewise.
* c-c++-common/goacc/kernels-alias-2.c: Likewise.
* c-c++-common/goacc/kernels-alias-3.c: Likewise.
* c-c++-common/goacc/kernels-alias-4.c: Likewise.
* c-c++-common/goacc/kernels-alias-5.c: Likewise.
* c-c++-common/goacc/kernels-alias-6.c: Likewise.
* c-c++-common/goacc/kernels-alias-7.c: Likewise.
* c-c++-common/goacc/kernels-alias-8.c: Likewise.
* c-c++-common/goacc/kernels-alias-ipa-pta-2.c: Likewise.
* c-c++-common/goacc/kernels-alias-ipa-pta-3.c: Likewise.
* c-c++-common/goacc/kernels-alias-ipa-pta-4.c: Likewise.
* c-c++-common/goacc/kernels-alias-ipa-pta.c: Likewise.
* c-c++-common/goacc/kernels-alias.c: Likewise.
* c-c++-common/goacc/kernels-counter-var-redundant-load.c:
Likewise.
* c-c++-common/goacc/kernels-counter-vars-function-scope.c:
Likewise.
* c-c++-common/goacc/kernels-double-reduction-n.c: Likewise.
* c-c++-common/goacc/kernels-double-reduction.c: Likewise.
* c-c++-common/goacc/kernels-loop-2-acc-loop.c: Likewise.
* c-c++-common/goacc/kernels-loop-2.c: Likewise.
* c-c++-common/goacc/kernels-loop-3-acc-loop.c: Likewise.
* c-c++-common/goacc/kernels-loop-3.c: Likewise.
* c-c++-common/goacc/kernels-loop-acc-loop.c: Likewise.
* c-c++-common/goacc/kernels-loop-data-2.c: Likewise.
* c-c++-common/goacc/kernels-loop-data-enter-exit-2.c: Likewise.
* c-c++-common/goacc/kernels-loop-data-enter-exit.c: Likewise.
* c-c++-common/goacc/kernels-loop-data-update.c: Likewise.
* c-c++-common/goacc/kernels-loop-data.c: Likewise.
* c-c++-common/goacc/kernels-loop-g.c: Likewise.
* c-c++-common/goacc/kernels-loop-mod-not-zero.c: Likewise.
* c-c++-common/goacc/kernels-loop-n-acc-loop.c: Likewise.
* c-c++-common/goacc/kernels-loop-n.c: Likewise.
* c-c++-common/goacc/kernels-loop-nest.c: Likewise.
* c-c++-common/goacc/kernels-loop.c: Likewise.
* c-c++-common/goacc/kernels-one-counter-var.c: Likewise.
* c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c:
Likewise.
* c-c++-common/goacc/kernels-reduction.c: Likewise.
* gfortran.dg/goacc/kernels-alias-2.f95: Likewise.
* gfortran.dg/goacc/kernels-alias-3.f95: Likewise.
* gfortran.dg/goacc/kernels-alias-4.f95: Likewise.
* gfortran.dg/goacc/kernels-alias.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-2.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-data-2.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-data-enter-exit.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-data-update.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-data.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-inner.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-n.f95: Likewise.
* gfortran.dg/goacc/kernels-loop.f95: Likewise.
* gfortran.dg/goacc/kernels-loops-adjacent.f95: Likewise.
* gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95:
Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c:
Add "--param=openacc-kernels=parloops".
* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-6.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-collapse.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-enter-exit-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-enter-exit.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-update.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-data.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-g.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-mod-not-zero.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-n.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop-nest.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-loop.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-parallel-loop-data-enter-exit.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-reduction-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-reduction.c:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop-2.f95: Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop-data-2.f95:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit-2.f95:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop-data-enter-exit.f95:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop-data-update.f95:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop-data.f95: Likewise.
* testsuite/libgomp.oacc-fortran/kernels-loop.f95: Likewise.
* testsuite/libgomp.oacc-fortran/kernels-parallel-loop-data-enter-exit.f95:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-reduction-1.f90:
Likewise.

4 years ago[nvptx] Expand OpenACC child function arguments to use CUDA params space
Kwok Cheung Yeung [Mon, 19 Apr 2021 22:01:03 +0000 (15:01 -0700)] 
[nvptx] Expand OpenACC child function arguments to use CUDA params space

This patch replaces the patches "Use functional parameters for data mappings
in OpenACC child functions" and "Make OpenACC function-parameter explosion
optional".

2019-09-10  Chung-Lin Tang  (cltang@codesourcery.com)

* config/nvptx/nvptx.c (nvptx_expand_to_rtl_hook): New function
implementing CUDA .params space transformation.
(TARGET_EXPAND_TO_RTL_HOOK): implement hook with
nvptx_expand_to_rtl_hook.

libgomp/
* plugin/plugin-nvptx.c (nvptx_exec): Adjust arguments, add
kernel argument setup code, adjust cuLaunchKernel calling code.
(GOMP_OFFLOAD_openacc_exec): Adjust nvptx_exec call, delete
profiling code.
(GOMP_OFFLOAD_openacc_async_exec): Likewise.
(cuda_free_argmem): Delete function.

4 years agoDisable libstdc++ dependency for libffi
Maciej W. Rozycki [Thu, 20 Dec 2018 14:10:16 +0000 (14:10 +0000)] 
Disable libstdc++ dependency for libffi

Disable AC_PROG_CXX and consequently a libstdc++ dependency for libffi,
introduced with upstream libffi commit 7d698125b1f0 ("Use the proper C++
compiler to run C++ tests").  This is only needed for the libffi test
suite, which we don't have to support in the GCC tree, as libffi is
maintained as a separate project.  The dependency causes a build failure
with the `powerpc64le-linux-gnu' target due to a circular dependency:

make[1]: Circular configure-target-libffi <- maybe-all-target-libstdc++-v3 dependency dropped.
make[1]: *** [configure-target-libffi] Error 1
make: *** [all] Error 2

due to a libgomp dependency for libstdc++ and then a libffi dependency
for libgomp, introduced with commit 998eb38b265d ("Use functional
parameters for data mappings in OpenACC child functions").

/
* Makefile.def (lang_env_dependencies): Disable `cxx' dependency
for `libffi'.
* Makefile.in: Regenerate.

libffi/
* configure.ac: Disable AC_PROG_CXX.
* configure: Regenerate.
* Makefile.in: Regenerate.
* include/Makefile.in: Regenerate.
* man/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.

4 years agoAdd support for gang local storage allocation in shared memory
Julian Brown [Thu, 21 Mar 2019 22:09:24 +0000 (15:09 -0700)] 
Add support for gang local storage allocation in shared memory

2018-12-11  Julian Brown  <julian@codesourcery.com>
         Chung-Lin Tang  <cltang@codesourcery.com>

     gcc/
     * config/nvptx/nvptx.c (tree-hash-traits.h): Include.
     (gangprivate_shared_size): New global variable.
     (gangprivate_shared_align): Likewise.
     (gangprivate_shared_sym): Likewise.
     (gangprivate_shared_hmap): Likewise.
     (nvptx_option_override): Initialize gangprivate_shared_sym,
     gangprivate_shared_align.
     (nvptx_file_end): Output gangprivate_shared_sym.
     (nvptx_goacc_expand_accel_var): New function.
     (nvptx_set_current_function): New function.
     (TARGET_SET_CURRENT_FUNCTION): Define hook.
     (TARGET_GOACC_EXPAND_ACCEL): Likewise.
     * doc/tm.texi (TARGET_GOACC_EXPAND_ACCEL_VAR): Document new hook.
     * doc/tm.texi.in (TARGET_GOACC_EXPAND_ACCEL_VAR): Likewise.
     * expr.c (expand_expr_real_1): Remap decls marked with the
     "oacc gangprivate" attribute.
     * omp-low.c (omp_context): Add oacc_partitioning_level and
     oacc_addressable_var_decls fields.
     (new_omp_context): Initialize oacc_addressable_var_decls in new
     omp_context.
     (delete_omp_context): Delete oacc_addressable_var_decls in old
     omp_context.
     (lower_oacc_head_tail): Record partitioning-level count in omp context.
     (oacc_record_private_var_clauses, oacc_record_vars_in_bind)
     (mark_oacc_gangprivate): New functions.
     (lower_omp_for): Call oacc_record_private_var_clauses with "for"
     clauses.  Call mark_oacc_gangprivate for gang-partitioned loops.
     (lower_omp_target): Call oacc_record_private_var_clauses with "target"
     clauses.
     Call mark_oacc_gangprivate for offloaded target regions.
     (lower_omp_1): Call vars_in_bind for GIMPLE_BIND within OMP regions.
     * target.def (expand_accel_var): New hook.

     libgomp/
     * testsuite/libgomp.oacc-c-c++-common/gang-private-1.c: New test.
     * testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: New test.
     * testsuite/libgomp.oacc-c/pr85465.c: New test.
     * testsuite/libgomp.oacc-fortran/gangprivate-attrib-1.f90: New test.kk

4 years agoTweak target selector for libgomp.oacc-c-c++-common/lib-93.c.
Julian Brown [Tue, 19 Mar 2019 13:53:56 +0000 (06:53 -0700)] 
Tweak target selector for libgomp.oacc-c-c++-common/lib-93.c.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/lib-93.c: Adjust target selector.

4 years agoEnable firstprivate OpenACC reductions
Julian Brown [Tue, 26 Feb 2019 23:59:03 +0000 (15:59 -0800)] 
Enable firstprivate OpenACC reductions

2018-09-05  Cesar Philippidis  <cesar@codesourcery.com>
    Chung-Lin Tang  <cltang@codesourcery.com>

gcc/
* gimplify.c (omp_add_variable): Enable firstprivate reduction
variables.

gcc/testsuite/
* c-c++-common/goacc/reduction-8.c: New test.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/privatize-reduction-1.c: New
test.
* testsuite/libgomp.oacc-c-c++-common/privatize-reduction-2.c: New
test.

4 years agoDon't mark OpenACC auto loops as independent inside acc parallel regions
Julian Brown [Tue, 26 Feb 2019 23:55:23 +0000 (15:55 -0800)] 
Don't mark OpenACC auto loops as independent inside acc parallel regions

2018-09-20  Cesar Philippidis  <cesar@codesourcery.com>

gcc/
* omp-low.c (lower_oacc_head_mark): Don't mark OpenACC auto
loops as independent inside acc parallel regions.

gcc/testsuite/
* c-c++-common/goacc/loop-auto-1.c: Adjust test case to conform to
the new behavior of the auto clause in OpenACC 2.5.
* c-c++-common/goacc/loop-auto-2.c: Likewise.
* gcc.dg/goacc/loop-processing-1.c: Likewise.
* c-c++-common/goacc/loop-auto-3.c: New test.
* gfortran.dg/goacc/loop-auto-1.f90: New test.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Adjust test case
to conform to the new behavior of the auto clause in OpenACC 2.5.

4 years agoEnable GOMP_MAP_FIRSTPRIVATE_INT for OpenACC
Julian Brown [Tue, 26 Feb 2019 23:10:21 +0000 (15:10 -0800)] 
Enable GOMP_MAP_FIRSTPRIVATE_INT for OpenACC

2018-12-22  Cesar Philippidis  <cesar@codesourcery.com>
            Julian Brown  <julian@codesourcery.com>
            Tobias Burnus  <tobias@codesourcery.com>

gcc/
* omp-low.c (maybe_lookup_field_in_outer_ctx): New function.
(convert_to_firstprivate_int): New function.
(convert_from_firstprivate_int): New function.
(lower_omp_target): Enable GOMP_MAP_FIRSTPRIVATE_INT in OpenACC.
Remove unused variable.

libgomp/
* oacc-parallel.c (GOACC_parallel_keyed): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* plugin/plugin-nvptx.c (nvptx_exec): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* testsuite/libgomp.oacc-c++/firstprivate-int.C: New test.
* testsuite/libgomp.oacc-c-c++-common/firstprivate-int.c: New
test.
* testsuite/libgomp.oacc-fortran/firstprivate-int.f90: New test.

4 years agoFix implicit mapping for array slices on lexically-enclosing data constructs (PR70828)
Julian Brown [Tue, 26 Feb 2019 22:22:41 +0000 (14:22 -0800)] 
Fix implicit mapping for array slices on lexically-enclosing data constructs (PR70828)

2018-08-28  Julian Brown  <julian@codesourcery.com>
            Cesar Philippidis  <cesar@codesourcery.com>

gcc/
* gimplify.c (oacc_array_mapping_info): New struct.
(gimplify_omp_ctx): Add decl_data_clause hash map.
(new_omp_context): Zero-initialise above.
(delete_omp_context): Delete above if allocated.
(gimplify_scan_omp_clauses): Scan for array mappings on data constructs,
and record in above map.
(gomp_oacc_needs_data_present): New function.
(gimplify_adjust_omp_clauses_1): Handle data mappings (e.g. array
slices) declared in lexically-enclosing data constructs.
* omp-low.c (lower_omp_target): Allow decl for bias not to be present
in OpenACC context.

gcc/testsuite/
* c-c++-common/goacc/acc-data-chain.c: New test.
* gfortran.dg/goacc/pr70828.f90: New test.
* gfortran.dg/goacc/pr70828-2.f90: New test.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/pr70828.c: New test.
* testsuite/libgomp.oacc-fortran/implicit_copy.f90: New test.
* testsuite/libgomp.oacc-fortran/pr70828.f90: New test.
* testsuite/libgomp.oacc-fortran/pr70828-2.f90: New test.
* testsuite/libgomp.oacc-fortran/pr70828-3.f90: New test.
* testsuite/libgomp.oacc-fortran/pr70828-4.f90: New test.
* testsuite/libgomp.oacc-fortran/pr70828-5.f90: New test.
* testsuite/libgomp.oacc-fortran/pr70828-6.f90: New test.

4 years agoDefault compute dimensions (compile time)
Julian Brown [Tue, 26 Feb 2019 22:12:06 +0000 (14:12 -0800)] 
Default compute dimensions (compile time)

Typo fix relative to last posted version.

2018-10-05  Nathan Sidwell  <nathan@acm.org>
    Tom de Vries  <tdevries@suse.de>
    Thomas Schwinge  <thomas@codesourcery.com>
    Julian Brown  <julian@codesourcery.com>

gcc/
* doc/invoke.texi (fopenacc-dim): Update.
* omp-offload.c (oacc_parse_default_dims): Update.
(oacc_validate_dims): Emit warnings about strange partitioning choices.

gcc/testsuite/
* c-c++-common/goacc/acc-icf.c: Update.
* c-c++-common/goacc/parallel-dims-1.c: Likewise.
* c-c++-common/goacc/parallel-reduction.c: Likewise.
* c-c++-common/goacc/pr70688.c: Likewise.
* c-c++-common/goacc/routine-1.c: Likewise.
* c-c++-common/goacc/uninit-dim-clause.c: Likewise.
* gfortran.dg/goacc/parallel-tree.f95: Likewise.
* gfortran.dg/goacc/routine-4.f90: Likewise.
* gfortran.dg/goacc/routine-level-of-parallelism-1.f90: Likewise.
* gfortran.dg/goacc/uninit-dim-clause.f95: Likewise.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Add -w.
* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.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-warn-1.c: New.
* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Update.
* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/mode-transitions.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/private-variables.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
* testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/pr84028.f90: Likewise.
* testsuite/libgomp.oacc-fortran/private-variables.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-7.f90: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c: New.

4 years agoGenerate sequential loop for OpenACC loop directive inside kernels
Julian Brown [Tue, 26 Feb 2019 21:39:03 +0000 (13:39 -0800)] 
Generate sequential loop for OpenACC loop directive inside kernels

2019-09-20  Chung-Lin Tang <cltang@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>

gcc/
* omp-expand.c (struct omp_region): Add inside_kernels_p field.
(expand_omp_for_generic): Adjust to generate a 'sequential' loop
when GOMP builtin arguments are BUILT_IN_NONE.
(expand_omp_for): Use expand_omp_for_generic to generate a
non-parallelized loop for OMP_FORs inside OpenACC kernels regions.
(expand_omp): Mark inside_kernels_p field true for regions
nested inside OpenACC kernels constructs.
gcc/testsuite/
* c-c++-common/goacc/kernels-loop-acc-loop.c: New test.
* c-c++-common/goacc/kernels-loop-2-acc-loop.c: New test.
* c-c++-common/goacc/kernels-loop-3-acc-loop.c: New test.
* c-c++-common/goacc/kernels-loop-n-acc-loop.c: New test.
* c-c++-common/goacc/kernels-acc-loop-reduction.c: New test.
* c-c++-common/goacc/kernels-acc-loop-smaller-equal.c: New test.

4 years agoReinstate kernels-restrict behaviour
Julian Brown [Wed, 6 Mar 2019 22:44:56 +0000 (14:44 -0800)] 
Reinstate kernels-restrict behaviour

This patch contains a small fix for upstream churn relative to the last version
posted.

2018-09-20  Cesar Philippidis  <cesar@codesourcery.com>
    Julian Brown  <julian@codesourcery.com>

* omp-low.c (install_var_field): New base_pointer_restrict
argument.
(scan_sharing_clauses): Update call to install_var_field.
(omp_target_base_pointers_restrict_p): New function.
(scan_omp_target): Update call to install_var_field.

4 years agoAdjustments and additions to testcases
Julian Brown [Tue, 26 Feb 2019 21:18:36 +0000 (13:18 -0800)] 
Adjustments and additions to testcases

Some additions of redundant "present" clauses dropped.

2018-10-22  Cesar Philippidis  <cesar@codesourcery.com>

gcc/testsuite/
* g++.dg/goacc/loop-1.c: New test.
* g++.dg/goacc/loop-2.c: New test.
* g++.dg/goacc/loop-3.c: New test.

2018-10-22  James Norris  <jnorris@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>
    Tom de Vries  <tom@codesourcery.com>

libgomp/
* testsuite/libgomp.oacc-c-c++-common/data-2.c: Update parallel
regions to denote variables copyied in via acc enter data as
present.
* testsuite/libgomp.oacc-fortran/data-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4.f90: Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.h: Reimplement.
* testsuite/libgomp.oacc-c-c++-common/subr.ptx: Regenerated PTX.
* testsuite/libgomp.oacc-c-c++-common/timer.h: Removed.
* testsuite/libgomp.oacc-c-c++-common/lib-69.c: Change async checks.
* testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-71.c: Rework kernel i/f.
* testsuite/libgomp.oacc-c-c++-common/lib-72.c: Rework kernel i/f and
change async checks.
* testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-74.c: Rework kernel i/f and
timing checks.
* testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-93.c: New test.

4 years agoVarious OpenACC reduction enhancements - test cases
Julian Brown [Tue, 12 Feb 2019 23:14:22 +0000 (15:14 -0800)] 
Various OpenACC reduction enhancements - test cases

2018-12-13  Cesar Philippidis  <cesar@codesourcery.com>
            Nathan Sidwell  <nathan@acm.org>
            Julian Brown  <julian@codesourcery.com>

        gcc/testsuite/
        * c-c++-common/goacc/orphan-reductions-1.c: New test.
        * c-c++-common/goacc/reduction-7.c: New test.
        * c-c++-common/goacc/routine-4.c: Update.
        * g++.dg/goacc/reductions-1.C: New test.
        * gcc.dg/goacc/loop-processing-1.c: Update.
        * gfortran.dg/goacc/orphan-reductions-1.f90: New test.

        libgomp/
        * libgomp.oacc-c-c++-common/par-reduction-3.c: New test.
        * libgomp.oacc-c-c++-common/reduction-cplx-flt-2.c: New test.
        * libgomp.oacc-fortran/reduction-9.f90: New test.

4 years agoVarious OpenACC reduction enhancements - ME and nvptx changes
Julian Brown [Tue, 12 Feb 2019 23:06:55 +0000 (15:06 -0800)] 
Various OpenACC reduction enhancements - ME and nvptx changes

Parts of the first posting got lost in the second posting, above.
This version hopefully contains everything.

2018-10-30  Cesar Philippidis  <cesar@codesourcery.com>

gcc/
* config/nvptx/nvptx.c (nvptx_propagate_unified): New.
(nvptx_split_blocks): Call it for cond_uni insn.
(nvptx_expand_cond_uni): New.
(enum nvptx_builtins): Add NVPTX_BUILTIN_COND_UNI.
(nvptx_init_builtins): Initialize it.
(nvptx_expand_builtin):
(nvptx_generate_vector_shuffle): Change integral SHIFT operand to
tree BITS operand.
(nvptx_vector_reduction): New.
(nvptx_adjust_reduction_type): New.
(nvptx_goacc_reduction_setup): Use it to adjust the type of ref_to_res.
(nvptx_goacc_reduction_init): Don't update LHS if it doesn't exist.
(nvptx_goacc_reduction_fini): Call nvptx_vector_reduction for vector.
Use it to adjust the type of ref_to_res.
(nvptx_goacc_reduction_teardown):
* config/nvptx/nvptx.md (cond_uni): New pattern.

4 years agoVarious OpenACC reduction enhancements - FE changes
Julian Brown [Tue, 12 Feb 2019 22:56:12 +0000 (14:56 -0800)] 
Various OpenACC reduction enhancements - FE changes

This version differs somewhat from the last version posted upstream
(and addresses some of Jakub's review comments).

2018-12-13  Cesar Philippidis  <cesar@codesourcery.com>
    Nathan Sidwell  <nathan@acm.org>
    Julian Brown  <julian@codesourcery.com>

gcc/c/
* c-parser.c (c_parser_omp_variable_list): New c_omp_region_type
argument.  Use it to specialize handling of OMP_CLAUSE_REDUCTION for
OpenACC.
(c_parser_oacc_data_clause): Add region-type argument.
(c_parser_oacc_data_clause_deviceptr): Likewise.
(c_parser_omp_clause_reduction): Change is_omp boolean parameter to
c_omp_region_type.  Update call to c_parser_omp_variable_list.
(c_parser_oacc_all_clauses): Update calls to
c_parser_omp_clause_reduction.
(c_parser_omp_all_clauses): Likewise.
(c_parser_oacc_cache): Update call to c_parser_omp_var_list_parens.
* c-typeck.c (c_finish_omp_clauses): Emit an error on orphan OpenACC
gang reductions.  Suppress user-defined reduction error for OpenACC.

gcc/cp/
* parser.c (cp_parser_omp_var_list_no_open):  New c_omp_region_type
argument.  Use it to specialize handling of OMP_CLAUSE_REDUCTION for
OpenACC.
(cp_parser_omp_var_list): Add c_omp_region_type argument. Update call
to cp_parser_omp_var_list_parens.
(cp_parser_oacc_data_clause): Update call to cp_parser_omp_var_list.
(cp_parser_omp_clause_reduction): Change is_omp boolean parameter to
c_omp_region_type.  Update call to cp_parser_omp_var_list_no_open.
(cp_parser_oacc_all_clauses): Update call to
cp_parser_omp_clause_reduction.
(cp_parser_omp_all_clauses): Likewise.
* semantics.c (finish_omp_reduction_clause): Add c_omp_region_type
argument.  Suppress user-defined reduction error for OpenACC.
(finish_omp_clauses): Emit an error on orphan OpenACC gang reductions.

gcc/fortran/
* openmp.c (oacc_is_parallel): New.
(resolve_oacc_loop_blocks): Emit an error on orphan OpenACC
gang reductions.
* trans-openmp.c (gfc_omp_clause_copy_ctor): Permit reductions.

4 years agoAdd OpenACC Fortran support for deviceptr and variable in common blocks
Julian Brown [Tue, 12 Feb 2019 22:32:34 +0000 (14:32 -0800)] 
Add OpenACC Fortran support for deviceptr and variable in common blocks

2018-06-29  Cesar Philippidis  <cesar@codesourcery.com>
    James Norris  <jnorris@codesourcery.com>

gcc/fortran/
* openmp.c (gfc_match_omp_map_clause): Re-write handling of the
deviceptr clause.  Add new common_blocks argument.  Propagate it to
gfc_match_omp_variable_list.
(gfc_match_omp_clauses): Update calls to gfc_match_omp_map_clauses.
(resolve_positive_int_expr): Promote the warning to an error.
(check_array_not_assumed): Remove pointer check.
(resolve_oacc_nested_loops): Error on do concurrent loops.
* trans-openmp.c (gfc_omp_finish_clause): Don't create pointer data
mappings for deviceptr clauses.
(gfc_trans_omp_clauses): Likewise.

gcc/
* gimplify.c (enum gimplify_omp_var_data): Add GOVD_DEVICETPR.
(oacc_default_clause): Privatize fortran common blocks.
(omp_notice_variable): Add GOVD_DEVICEPTR attribute when appropriate.
Defer the expansion of DECL_VALUE_EXPR for common block decls.
(gimplify_scan_omp_clauses): Add GOVD_DEVICEPTR attribute when
appropriate.
(gimplify_adjust_omp_clauses_1): Set GOMP_MAP_FORCE_DEVICEPTR for
implicit deviceptr mappings.

gcc/testsuite/
* c-c++-common/goacc/deviceptr-4.c: Update.
* gfortran.dg/goacc/common-block-1.f90: New test.
* gfortran.dg/goacc/common-block-2.f90: New test.
* gfortran.dg/goacc/loop-2.f95: Update.
* gfortran.dg/goacc/loop-3-2.f95: Update.
* gfortran.dg/goacc/loop-3.f95: Update.
* gfortran.dg/goacc/pr72715.f90: New test.
* gfortran.dg/goacc/sie.f95: Update.
* gfortran.dg/goacc/tile-1.f90: Update.
* gfortran.dg/gomp/pr77516.f90: Update.

libgomp/
* oacc-parallel.c (GOACC_parallel_keyed): Handle Fortran deviceptr
clause.
(GOACC_data_start): Likewise.
* testsuite/libgomp.oacc-fortran/common-block-1.f90: New test.
* testsuite/libgomp.oacc-fortran/common-block-2.f90: New test.
* testsuite/libgomp.oacc-fortran/common-block-3.f90: New test.
* testsuite/libgomp.oacc-fortran/deviceptr-1.f90: New test.

4 years agoTweak error return value for acc_set_cuda_stream.
Julian Brown [Tue, 12 Feb 2019 14:36:03 +0000 (06:36 -0800)] 
Tweak error return value for acc_set_cuda_stream.

The return value of acc_set_cuda_stream is unspecified in OpenACC 2.6.
The testsuite changes might be unnecessary with the current async code.

libgomp/
* oacc-cuda.c (acc_set_cuda_stream): Return 0 on error/invalid
arguments.
* testsuite/libgomp.oacc-c-c++-common/lib-84.c: Handle unnumbered
async stream being an alias for a numbered async stream.
* testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.

4 years agoAdd support for OpenACC routine nohost clause
Julian Brown [Thu, 7 Feb 2019 01:46:25 +0000 (17:46 -0800)] 
Add support for OpenACC routine nohost clause

2018-10-02  Thomas Schwinge  <thomas@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>

gcc/
* tree-core.h (omp_clause_code): Add OMP_CLAUSE_NOHOST.
* tree.c (omp_clause_num_ops, omp_clause_code_name, walk_tree_1):
Update for these.
* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_NOHOST.
* gimplify.c (gimplify_scan_omp_clauses)
(gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_NOHOST.
* tree-nested.c (convert_nonlocal_omp_clauses)
(convert_local_omp_clauses): Likewise.
* omp-low.c (scan_sharing_clauses): Likewise.
* omp-offload.c (maybe_discard_oacc_function): New function.
(execute_oacc_device_lower) [!ACCEL_COMPILER]: Handle OpenACC
nohost clauses.

gcc/c-family/
* c-attribs.c (c_common_attribute_table): Set min_len to -1 for
"omp declare target".
* c-pragma.h (pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_NOHST.

gcc/c/
* c-parser.c (c_parser_omp_clause_name): Handle "nohost".
(c_parser_oacc_all_clauses): Handle PRAGMA_OACC_CLAUSE_NOHOST.
(c_parser_oacc_routine, c_finish_oacc_routine): Update.
* c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_NOHOST.

gcc/cp/
* parser.c (cp_parser_omp_clause_name): Handle "nohost".
(cp_parser_oacc_all_clauses): Handle PRAGMA_OACC_CLAUSE_NOHOST,
(cp_parser_oacc_routine, cp_finalize_oacc_routine): Update.
* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_NOHOST.
* semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_NOHOST.

gcc/fortran/
* gfortran.h (gfc_omp_clauses): Add nohost members.
* openmp.c (omp_mask2): Add OMP_CLAUSE_NOHOST.
(gfc_match_omp_clauses): Handle OMP_CLAUSE_NOHOST.
(gfc_match_oacc_routine): Set oacc_function_nohost when appropriate.
* gfortran.h (symbol_attribute): Add oacc_function_nohost member.
* trans-openmp.c (gfc_add_omp_offload_attributes): Use it to decide
whether to generate an OMP_CLAUSE_NOHOST clause.
(gfc_trans_omp_clauses_1): Unreachable code to generate an
OMP_CLAUSE_NOHOST clause.

gcc/testsuite/
* c-c++-common/goacc/classify-routine.c: Adjust test.
* c-c++-common/goacc/routine-1.c: Likewise.
* c-c++-common/goacc/routine-2.c: Likewise.
* c-c++-common/goacc/routine-nohost-1.c: New test.
* g++.dg/goacc/routine-2.C: Adjust test.
* gfortran.dg/goacc/pr72741.f90: New test.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/routine-3.c: New test.
* testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/routine-bind-nohost-1.c:
Update test.
* testsuite/libgomp.oacc-fortran/routine-6.f90: Likewise.

4 years agoMerge non-contiguous array support patches.
Chung-Lin Tang [Sun, 19 Apr 2020 12:10:43 +0000 (05:10 -0700)] 
Merge non-contiguous array support patches.

This version is based from v4, posted upstream here:
https://gcc.gnu.org/pipermail/gcc-patches/2020-April/543437.html

2020-04-19  Chung-Lin Tang  <cltang@codesourcery.com>

PR other/76739

gcc/c/
* c-typeck.c (handle_omp_array_sections_1): Add 'bool &non_contiguous'
parameter, adjust recursive call site, add cases for allowing
pointer based multi-dimensional arrays for OpenACC.
(handle_omp_array_sections): Adjust handle_omp_array_sections_1 call,
handle non-contiguous case to create dynamic array map.

gcc/cp/
* semantics.c (handle_omp_array_sections_1): Add 'bool &non_contiguous'
parameter, adjust recursive call site, add cases for allowing
pointer based multi-dimensional arrays for OpenACC.
(handle_omp_array_sections): Adjust handle_omp_array_sections_1 call,
handle non-contiguous case to create dynamic array map.

gcc/fortran/
* f95-lang.c (DEF_FUNCTION_TYPE_VAR_5): New symbol.
* types.def (BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_VAR): New type.

gcc/
* builtin-types.def (BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_VAR): New type.
* omp-builtins.def (BUILT_IN_GOACC_DATA_START): Adjust function type
to new BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_VAR.
* gimplify.c (gimplify_scan_omp_clauses): Skip gimplification of
OMP_CLAUSE_SIZE of non-contiguous array maps (which is a TREE_LIST).
* omp-expand.c (expand_omp_target): Add non-contiguous array descriptor
pointers to variadic arguments.
* omp-low.c (append_field_to_record_type): New function.
(create_noncontig_array_descr_type): Likewise.
(create_noncontig_array_descr_init_code): Likewise.
(scan_sharing_clauses): For non-contiguous array map kinds, check for
supported dimension structure, and install non-contiguous array
variable into current omp_context.
(reorder_noncontig_array_clauses): New function.
(scan_omp_target): Call reorder_noncontig_array_clauses to place
non-contiguous array map clauses at beginning of clause sequence.
(lower_omp_target): Add handling for non-contiguous array map kinds,
add all created non-contiguous array descriptors to
gimple_omp_target_data_arg.

gcc/testsuite/
* c-c++-common/goacc/noncontig_array-1.c: New test.

libgomp/
* libgomp_g.h (GOACC_data_start): Add variadic '...' to declaration.
* libgomp.h (gomp_map_vars_openacc): New function declaration.
* oacc-int.h (struct goacc_ncarray_dim): New struct declaration.
(struct goacc_ncarray_descr_type): Likewise.
(struct goacc_ncarray): Likewise.
(struct goacc_ncarray_info): Likewise.
(goacc_noncontig_array_create_ptrblock): New function declaration.
* oacc-parallel.c (goacc_noncontig_array_count_rows): New function.
(goacc_noncontig_array_compute_sizes): Likewise.
(goacc_noncontig_array_fill_rows_1): Likewise.
(goacc_noncontig_array_fill_rows): Likewise.
(goacc_process_noncontiguous_arrays): Likewise.
(goacc_noncontig_array_create_ptrblock): Likewise.
(GOACC_parallel_keyed): Use goacc_process_noncontiguous_arrays to
handle non-contiguous array descriptors at end of varargs, adjust
to use gomp_map_vars_openacc.
(GOACC_data_start): Likewise. Adjust function type to accept varargs.
* target.c (gomp_map_vars_internal): Add struct goacc_ncarray_info *
nca_info parameter, add handling code for non-contiguous arrays.
(gomp_map_vars_openacc): Add new function for specialization of
gomp_map_vars_internal for OpenACC structured region usage.
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-3.c: New test.
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-4.c: New test.
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-utils.h: Support
header for new tests.

include/
* gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_3): Define.
(enum gomp_map_kind): Add GOMP_MAP_NONCONTIG_ARRAY,
GOMP_MAP_NONCONTIG_ARRAY_TO, GOMP_MAP_NONCONTIG_ARRAY_FROM,
GOMP_MAP_NONCONTIG_ARRAY_TOFROM, GOMP_MAP_NONCONTIG_ARRAY_FORCE_TO,
GOMP_MAP_NONCONTIG_ARRAY_FORCE_FROM, GOMP_MAP_NONCONTIG_ARRAY_FORCE_TOFROM,
GOMP_MAP_NONCONTIG_ARRAY_ALLOC, GOMP_MAP_NONCONTIG_ARRAY_FORCE_ALLOC,
GOMP_MAP_NONCONTIG_ARRAY_FORCE_PRESENT.
(GOMP_MAP_NONCONTIG_ARRAY_P): Define.

4 years agoOpenACC reference count consistency checking
Julian Brown [Fri, 30 Nov 2018 10:40:49 +0000 (02:40 -0800)] 
OpenACC reference count consistency checking

2018-11-28  Julian Brown  <julian@codesourcery.com>
    Tobias Burnus  <tobias@codesourcery.com>

libgomp/
* libgomp.h (RC_CHECKING): New macro, disabled by default, guarding all
hunks in this patch.
(target_mem_desc): Add forward declaration.
(async_tgt_use): New struct.
(target_mem_desc): Add refcount_chk, mark fields.
(acc_dispatch_t): Add tgt_uses, au_lock fields.
(dump_tgt, gomp_rc_check): Add prototypes.
* oacc-async (goacc_async_unmap_tgt): Add refcount self-check code.
(goacc_async_copyout_unmap_vars): Likewise.
(goacc_remove_var_async): Likewise.
* oacc-parallel.c (GOACC_parallel_keyed_internal): Add refcount
self-check code.
(GOACC_data_start, GOACC_data_end, GOACC_enter_exit_data): Likewise.
* target.c (stdio.h): Include.
(dump_tgt, rc_check_clear, rc_check_count, rc_check_verify)
(gomp_rc_check): New functions to consistency-check reference counts.
(gomp_target_init): Initialise self-check-related device fields.

4 years agoIdentify OMP development branch in output of 'gcc --version'
Kwok Cheung Yeung [Tue, 2 Mar 2021 12:15:55 +0000 (04:15 -0800)] 
Identify OMP development branch in output of 'gcc --version'

2021-03-02  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/
* Makefile.in (REVISION_s): Change default message.

4 years agotestsuite: Fix up gcc.target/s390/zero-scratch-regs-1.c
Stefan Schulze Frielinghaus [Tue, 20 Apr 2021 07:51:16 +0000 (09:51 +0200)] 
testsuite: Fix up gcc.target/s390/zero-scratch-regs-1.c

Depending on whether GCC is configured using --with-mode=zarch or not,
for the 31bit target instructions are generated either for ESA or
z/Architecture.  For the sake of simplicity and robustness test only for
the latter by adding manually option -mzarch.

gcc/testsuite/ChangeLog:

* gcc.target/s390/zero-scratch-regs-1.c: Force test to run for
z/Architecture only.

4 years agoFortran: Fix host associated PDT entity initialization [PR99307].
Paul Thomas [Tue, 20 Apr 2021 06:30:07 +0000 (07:30 +0100)] 
Fortran: Fix host associated PDT entity initialization [PR99307].

2021-04-20  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/100110
* trans-decl.c (gfc_get_symbol_decl): Replace test for host
association with a check that the current and symbol namespaces
are the same.

gcc/testsuite/
PR fortran/100110
* gfortran.dg/pdt_31.f03: New test.
* gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9
to 8.

4 years agolibphobos: Fix SIGBUS in read_encoded_value_with_base on sparc-sun-solaris (PR98584)
Iain Buclaw [Tue, 20 Apr 2021 00:09:51 +0000 (02:09 +0200)] 
libphobos: Fix SIGBUS in read_encoded_value_with_base on sparc-sun-solaris (PR98584)

Instead of unsafe pointer dereferencing, use memcpy() to read encoded
values from memory.  The function `read_encoded_value' has been updated
to accept a ref parameter, this simplifies handling of the pointer to
memory needing to be read.

libphobos/ChangeLog:

PR d/98584
* libdruntime/gcc/deh.d (scanLSDA): Update calls to read_uleb128 and
read_encoded_value.
(actionTableLookup): Update calls to read_sleb128 and
read_encoded_value_with_base.
* libdruntime/gcc/unwind/pe.d (read_uleb128): Update signature.
(read_sleb128): Update signature.
(read_unaligned): New function.
(read_encoded_value_with_base): Update signature.  Call read_unaligned
instead of unsafe pointer dereferencing.
(read_encoded_value): Update signature.

4 years agoDaily bump.
GCC Administrator [Tue, 20 Apr 2021 00:16:27 +0000 (00:16 +0000)] 
Daily bump.

4 years agoc++: ICE with concept defined in function [PR97536]
Marek Polacek [Mon, 19 Apr 2021 20:21:46 +0000 (16:21 -0400)] 
c++: ICE with concept defined in function [PR97536]

This is an ICE-on-invalid, but I keep seeing it when reducing code so
I'd like to fix it.  We crash on

  template <typename> void forward() {
    concept C = true;
  }

which breaks two requirements:
[temp.concept]/1: A concept is a template ...
[temp.concept]/3: A concept-definition shall inhabit a namespace scope.

This patch adds a test that exercises broken code and fixes the ICE
by checking that a concept-definition is defined at namespace scope.

gcc/cp/ChangeLog:

PR c++/97536
* decl.c (grokvardecl): Given an error when a concept is not defined
at namespace scope.

gcc/testsuite/ChangeLog:

PR c++/97536
* g++.dg/concepts/diagnostic16.C: New test.

4 years agotree-optimization/100081 - Limit depth of logical expression windback.
Andrew MacLeod [Fri, 16 Apr 2021 21:08:51 +0000 (17:08 -0400)] 
tree-optimization/100081 - Limit depth of logical expression windback.

Limit how many logical expressions GORI will look back through when
evaluating outgoing edge range.

PR tree-optimization/100081
* gimple-range-cache.h (ranger_cache): Inherit from gori_compute
rather than gori_compute_cache.
* gimple-range-gori.cc (is_gimple_logical_p): Move to top of file.
(range_def_chain::m_logical_depth): New member.
(range_def_chain::range_def_chain): Initialize m_logical_depth.
(range_def_chain::get_def_chain): Don't build defchains through more
than LOGICAL_LIMIT logical expressions.
* params.opt (param_ranger_logical_depth): New.

4 years agod: Fix ICE in when formating a string with '%' or '`' characters (PR98457)
Iain Buclaw [Mon, 19 Apr 2021 16:45:32 +0000 (18:45 +0200)] 
d: Fix ICE in when formating a string with '%' or '`' characters (PR98457)

The percentage character was being confused for a format specifier in
pp_format(), whilst the backtick character was confused for the
beginning of a quoted string in expand_d_format().

Both are now properly escaped to avoid the ICE.

gcc/d/ChangeLog:

PR d/98457
* d-diagnostic.cc (expand_d_format): Handle escaped backticks.
(escape_d_format): New funtion.
(verror): Call escape_d_format on prefixing strings.
(vdeprecation): Likewise.

gcc/testsuite/ChangeLog:

PR d/98457
* gdc.dg/pr98457.d: New test.

4 years agolibphobos: Merge upstream druntime 89f870b7, phobos e6907ff3e
Iain Buclaw [Mon, 19 Apr 2021 11:51:02 +0000 (13:51 +0200)] 
libphobos: Merge upstream druntime 89f870b7, phobos e6907ff3e

Phobos changes:

 - Synchronize C bindings with the latest port fixes in upstream
   druntime.

 - Add Config.stderrPassThrough to std.process (PR98494).

Reviewed-on: https://github.com/dlang/druntime/pull/3448
     https://github.com/dlang/phobos/pull/7984

libphobos/ChangeLog:

PR d/98494
* libdruntime/MERGE: Merge upstream druntime 89f870b7.
* src/MERGE: Merge upstream phobos e6907ff3e.

4 years agolibphobos: Add Thread/Fiber support code for Darwin (PR98058)
Iain Buclaw [Mon, 19 Apr 2021 12:48:32 +0000 (14:48 +0200)] 
libphobos: Add Thread/Fiber support code for Darwin (PR98058)

libphobos/ChangeLog:

PR d/98058
* configure: Regenerate.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add
core/sys/darwin/config.d
* libdruntime/Makefile.in: Regenerate.
* libdruntime/config/powerpc/switchcontext.S: Implement
fiber_switchContext for __MACH__.
* libdruntime/config/x86/switchcontext.S: Likewise.
* libdruntime/core/sys/darwin/config.d: New file.
* libdruntime/core/thread/fiber.d (Fiber.getThis): Mark noinline.
(UnsafeFiberMigration): Define for OSX/X86 and OSX/X86_64.
* libdruntime/core/thread/osthread.d (callWithStackShell): Add inline
assembler implementation for X86, X86_64, PPC, and PPC64.
* libdruntime/core/thread/threadbase.d (ThreadBase.getThis): Mark
noinline.
* libdruntime/gcc/deh.d (FuncTable): Remove definition.
* m4/druntime/os.m4 (DRUNTIME_OS_MINFO_BRACKETING): Check for right
bracket symbol on darwin* targets.
* testsuite/libphobos.thread/fiber_guard_page.d: Update test to
support ucontext-based Fibers.

4 years agolibphobos: Add D runtime support code for MinGW (PR99794)
Iain Buclaw [Mon, 19 Apr 2021 12:36:14 +0000 (14:36 +0200)] 
libphobos: Add D runtime support code for MinGW (PR99794)

libphobos/ChangeLog:

PR d/99794
* libdruntime/Makefile.am (DRUNTIME_SOURCES_CONFIGURED): Add
config/mingw/msvc.c on DRUNTIME_OS_MINGW.
* libdruntime/Makefile.in: Regenerate.
* libdruntime/config/mingw/msvc.c: New file.
* libdruntime/config/mingw/switchcontext.S (fiber_switchContext): Fix
function definition.
* libdruntime/gcc/deh.d (__gdc_personality_seh0): Fix call to
_GCC_specific_handler.
* libdruntime/gcc/gthread.d (__gthread_once_t): Fix definition.
* libdruntime/gcc/unwind/generic.d (_GCC_specific_handler): Fix
declaration.
* libdruntime/rt/dmain2.d (rt_loadLibrary): Remove function.
(rt_loadLibraryW): Remove function.
(initLibrary): Remove function.
(rt_unloadLibrary): Remove function.

4 years agolibphobos: Add section support code for OpenBSD (PR99691)
Iain Buclaw [Mon, 19 Apr 2021 12:23:00 +0000 (14:23 +0200)] 
libphobos: Add section support code for OpenBSD (PR99691)

libphobos/ChangeLog:

PR d/99691
* configure: Regenerate.
* libdruntime/config/common/threadasm.S: Add __OpenBSD__.
* libdruntime/gcc/backtrace.d: Import core.sys.openbsd.dlfcn on
OpenBSD platforms.
* libdruntime/gcc/sections/elf.d (SharedElf): Define on OpenBSD.
(linkMapForHandle): Implement for OpenBSD.
(exeLinkMap): Remove.
(getDependencies): Adjust dlpi_addr on OpenBSD.
(handleForName): Implement for OpenBSD.
(IterateManually): Define on OpenBSD.
* libdruntime/gcc/sections/package.d (SectionsElf): Define on OpenBSD.
* m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_ATOMIC): Test for
enable_libatomic.
(DRUNTIME_LIBRARIES_BACKTRACE): Test for enable_libbacktrace.

4 years agoarm: partial revert of r11-8168 [PR100067]
Richard Earnshaw [Mon, 19 Apr 2021 15:56:31 +0000 (16:56 +0100)] 
arm: partial revert of r11-8168 [PR100067]

This is a partial revert of r11-8168.  The overall purpose of the
commit is retained (to fix a bogus warning when -mfpu=<not-auto> is
used in combination with eg -mcpu=neoverse-v1), but it removes the
hunk that changed the subsequent feature bits for features of a
simd/fp unit that cannot be described by -mfpu.  While I still think
that is the correct direction of travel, it's somewhat disruptive and
not appropriate for late stage4.  I'll revisit for gcc-12.

gcc:
PR target/100067
* config/arm/arm.c (arm_configure_build_target): Do not strip
extended FPU/SIMD feature bits from the target ISA when -mfpu
is specified (partial revert of r11-8168).

4 years agoaarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]
Christophe Lyon [Mon, 19 Apr 2021 13:24:31 +0000 (13:24 +0000)] 
aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]

The testcase is endianness dependent and works only on little-endian.

2021-04-19  Christophe Lyon  <christophe.lyon@linaro.org>

PR target/100075
gcc/testsuite/
* gcc.target/aarch64/pr100075.c: Add aarch64_little_endian
effective target.

4 years agopreprocessor/100142 - revert unwanted change in last commit
Richard Biener [Mon, 19 Apr 2021 08:07:35 +0000 (10:07 +0200)] 
preprocessor/100142  - revert unwanted change in last commit

This reverts a s/column_offset/column/ change in the fix for PR99446.

2021-04-19  Richard Biener  <rguenther@suse.de>

PR preprocessor/100142
libcpp/
* line-map.c (linemap_position_for_loc_and_offset): Revert
unintended s/column_offset/column/ change.

gcc/testsuite/
* gcc.dg/pr100142.c: New testcase.
* g++.dg/diagnostic/pr72803.C: Revert last change.

4 years ago[OpenACC 'kernels'] '-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'
Thomas Schwinge [Mon, 19 Apr 2021 08:24:49 +0000 (10:24 +0200)] 
[OpenACC 'kernels'] '-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'

This configuration knob is temporary, and isn't really meant to be exposed to
users.

gcc/
* params.opt (-param=openacc-kernels=): Add.
* omp-oacc-kernels-decompose.cc
(pass_omp_oacc_kernels_decompose::gate): Use it.
* doc/invoke.texi (-fopenacc-kernels=@var{mode}): Move...
(--param): ... here, 'openacc-kernels'.
gcc/c-family/
* c.opt (fopenacc-kernels=): Remove.
gcc/fortran/
* lang.opt (fopenacc-kernels=): Remove.
gcc/testsuite/
* c-c++-common/goacc/if-clause-2.c: '-fopenacc-kernels=[...]' ->
'--param=openacc-kernels=[...]'.
* c-c++-common/goacc/kernels-decompose-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-2.c: Likewise.
* c-c++-common/goacc/kernels-decompose-ice-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise.
* gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c:
'-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'.
* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Likewise.
* testsuite/libgomp.oacc-fortran/pr94358-1.f90: Likewise.

4 years agolibstdc++: Update some baseline_symbols.txt (x32)
H.J. Lu [Sun, 18 Apr 2021 17:02:17 +0000 (10:02 -0700)] 
libstdc++: Update some baseline_symbols.txt (x32)

* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt:
Updated.

4 years agoAlign decl and def arguments.
Martin Liska [Mon, 19 Apr 2021 09:20:46 +0000 (11:20 +0200)] 
Align decl and def arguments.

gcc/ChangeLog:

PR c/100143
* gengtype.c (finish_root_table): Align function arguments
in between declaration and definition.

4 years agoFix another -freorder-blocks-and-partition glitch with Windows SEH
Eric Botcazou [Mon, 19 Apr 2021 08:13:36 +0000 (10:13 +0200)] 
Fix another -freorder-blocks-and-partition glitch with Windows SEH

Since GCC 8, the -freorder-blocks-and-partition pass can split a function
into hot and cold parts, thus generating 2 FDEs for a single function in
DWARF for exception purposes and doing an equivalent trick for Windows SEH.

Now the Windows system unwinder does not support arbitrarily large frames
and there is even a hard limit on the encoding of the CFI, which changes
the stack allocation strategy when it is topped and which must be reflected
everywhere.

gcc/
* config/i386/winnt.c (i386_pe_seh_cold_init): Properly deal with
frames larger than the SEH maximum frame size.
gcc/testsuite/
* gnat.dg/opt92.adb: New test.

4 years agoDaily bump.
GCC Administrator [Mon, 19 Apr 2021 00:16:19 +0000 (00:16 +0000)] 
Daily bump.

4 years agocombine: Don't create REG_UNUSED notes if the reg already died (PR99927)
Segher Boessenkool [Sat, 17 Apr 2021 18:06:17 +0000 (18:06 +0000)] 
combine: Don't create REG_UNUSED notes if the reg already died (PR99927)

If the register named in an existing REG_UNUSED note dies somewhere
between where the note used to be and I3, we should just drop it.

2021-04-21  Segher Boessenkool  <segher@kernel.crashing.org>

PR rtl-optimization/99927
* combine.c (distribute_notes) [REG_UNUSED]: If the register already
is dead, just drop it.

4 years agoDaily bump.
GCC Administrator [Sun, 18 Apr 2021 00:16:21 +0000 (00:16 +0000)] 
Daily bump.

4 years agotestsuite: Enable zero-scratch-regs-{8,9,10,11}.c on s390*
Stefan Schulze Frielinghaus [Sat, 17 Apr 2021 15:53:33 +0000 (17:53 +0200)] 
testsuite: Enable zero-scratch-regs-{8,9,10,11}.c on s390*

On s390* the only missing part for the mentioned testcases was a load of
a double floating-point zero via a move (in particular for quite old
machines) which was added in commit 46c47420a5fefd4d9d02b0db347235dd74e20fb2.
Common code implementation is sufficient in order to clear volatile
GPRs, FPRs, and VRs.  Access registers a0 and a1 are nonvolatile and not
cleared.  Therefore, target hook TARGET_ZERO_CALL_USED_REGS is not
implemented for s390*.

Added a target specific test in order to ensure that all call clobbered
GPRs, FPRs, and VRs are zeroed and all call saved registers are kept.

gcc/testsuite/ChangeLog:

* c-c++-common/zero-scratch-regs-8.c: Enable on s390*.
* c-c++-common/zero-scratch-regs-9.c: Likewise.
* c-c++-common/zero-scratch-regs-10.c: Likewise.
* c-c++-common/zero-scratch-regs-11.c: Likewise.
* gcc.target/s390/zero-scratch-regs-1.c: New test.

4 years agod: Add TARGET_D_TEMPLATES_ALWAYS_COMDAT
Iain Buclaw [Tue, 13 Apr 2021 20:28:55 +0000 (22:28 +0200)] 
d: Add TARGET_D_TEMPLATES_ALWAYS_COMDAT

Following up on the fix for PR99914, when testing on MinGW, it was found
not to support weak in the same way as on ELF or Mach-O targets.

So the linkage has been reverted back to COMDAT for that target, however
in order to properly support overriding functions and variables, all
declarations with external linkage must be put on COMDAT.  For this a
new target hook has been added to control the behavior.

gcc/ChangeLog:

PR d/99914
* config/i386/winnt-d.c (TARGET_D_TEMPLATES_ALWAYS_COMDAT): Define.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_TEMPLATES_ALWAYS_COMDAT.

gcc/d/ChangeLog:

PR d/99914
* d-target.def (d_templates_always_comdat): New hook.
* d-tree.h (mark_needed): Remove prototype.
* decl.cc: Include d-target.h.
(mark_needed): Rename to...
(d_mark_needed): ...this.  Make static.
(set_linkage_for_decl): Put variables in comdat if
d_templates_always_comdat.

4 years agod: Implement __traits(getTargetInfo, "objectFormat")
Iain Buclaw [Sun, 11 Apr 2021 23:39:08 +0000 (01:39 +0200)] 
d: Implement __traits(getTargetInfo, "objectFormat")

Following on from adding TARGET_D_REGISTER_OS_TARGET_INFO, this adds the
required handlers to implement `__traits(getTargetInfo, "objectFormat")'
for all platforms that have D support files.

Some back-ends (i386, rs6000, and pa) have some awarenes of the what
object format they are compiling for, so new getTargetInfo handlers have
been have added both to those back-ends as well as platform-specific
target files to override the default in the D front-end.

gcc/ChangeLog:

* config/darwin-d.c (darwin_d_handle_target_object_format): New
function.
(darwin_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/dragonfly-d.c (dragonfly_d_handle_target_object_format): New
function.
(dragonfly_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/freebsd-d.c (freebsd_d_handle_target_object_format): New
function.
(freebsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/glibc-d.c (glibc_d_handle_target_object_format): New
function.
(glibc_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/i386/i386-d.c (ix86_d_handle_target_object_format): New
function.
(ix86_d_register_target_info): Add ix86_d_handle_target_object_format
as handler for objectFormat key.
* config/i386/winnt-d.c (winnt_d_handle_target_object_format): New
function.
(winnt_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/netbsd-d.c (netbsd_d_handle_target_object_format): New
function.
(netbsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/openbsd-d.c (openbsd_d_handle_target_object_format): New
function.
(openbsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/pa/pa-d.c (pa_d_handle_target_object_format): New function.
(pa_d_register_target_info): Add pa_d_handle_target_object_format as
handler for objectFormat key.
* config/rs6000/rs6000-d.c (rs6000_d_handle_target_object_format): New
function.
(rs6000_d_register_target_info): Add
rs6000_d_handle_target_object_format as handler for objectFormat key.
* config/sol2-d.c (solaris_d_handle_target_object_format): New
function.
(solaris_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.

gcc/d/ChangeLog:

* d-target.cc (d_handle_target_object_format): New function.
(d_language_target_info): Add d_handle_target_object_format as handler
for objectFormat key.
(Target::getTargetInfo): Continue if handler returned NULL_TREE.

4 years agolibstdc++: Update ppc32 baseline_symbols.txt
Jakub Jelinek [Sat, 17 Apr 2021 09:33:52 +0000 (11:33 +0200)] 
libstdc++: Update ppc32 baseline_symbols.txt

And here is an update for 32-bit powerpc-linux.

2021-04-17  Jakub Jelinek  <jakub@redhat.com>

* config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.

4 years agolibstdc++: Update some baseline_symbols.txt
Jakub Jelinek [Sat, 17 Apr 2021 09:31:30 +0000 (11:31 +0200)] 
libstdc++: Update some baseline_symbols.txt

As we have only one P1 left right now, I think it is the right time
to update abi list files in libstdc++.

Here is an update for x86_64/i?86/s390x/ppc64 linux (aarch64 seems
to be correct already).  For ppc64le it is missing the IEEE128 symver
symbols, but those need further work on the abi checking side.

2021-04-17  Jakub Jelinek  <jakub@redhat.com>

* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
* config/abi/post/i386-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.

4 years agosanitizer: Fix asan against glibc 2.34 [PR100114]
Jakub Jelinek [Sat, 17 Apr 2021 09:27:14 +0000 (11:27 +0200)] 
sanitizer: Fix asan against glibc 2.34 [PR100114]

As mentioned in the PR, SIGSTKSZ is no longer a compile time constant in
glibc 2.34 and later, so
static const uptr kAltStackSize = SIGSTKSZ * 4;
needs dynamic initialization, but is used by a function called indirectly
from .preinit_array and therefore before the variable is constructed.
This results in using 0 size instead and all asan instrumented programs
die with:
==91==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)

Here is a cherry-pick from upstream to fix this.

2021-04-17  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/100114
* sanitizer_common/sanitizer_posix_libcdep.cpp: Cherry-pick
llvm-project revisions 82150606fb11d28813ae6da1101f5bda638165fe
and b93629dd335ffee2fc4b9b619bf86c3f9e6b0023.

4 years agoDaily bump.
GCC Administrator [Sat, 17 Apr 2021 00:16:25 +0000 (00:16 +0000)] 
Daily bump.

4 years agoFortran: Add missing TKR initialization [PR100094]
José Rui Faustino de Sousa [Fri, 16 Apr 2021 23:33:04 +0000 (23:33 +0000)] 
Fortran: Add missing TKR initialization [PR100094]

gcc/fortran/ChangeLog:

PR fortran/100094
* trans-array.c (gfc_trans_deferred_array): Add code to initialize
pointers and allocatables with correct TKR parameters.

gcc/testsuite/ChangeLog:

PR fortran/100094
* gfortran.dg/PR100094.f90: New test.

4 years agotestsuite/arm: Fix scan-assembler-times in pr96770.c with movt/movw
Christophe Lyon [Fri, 16 Apr 2021 19:58:25 +0000 (19:58 +0000)] 
testsuite/arm: Fix scan-assembler-times in pr96770.c with movt/movw

The previous change to this testcase missed the fact that the data may
be accessed via an anchor, depending on the optimization level,
leading to false failures.

This patch restricts matching to upper16:lower16 followed by
non-spaces, followed by +4 (in f4) or +320 (in f5).

Using '.*' instead of '[^ \]' would match accross the whole assembly
file, which is not what we want, hence the limitation with spaces.

2021-04-16  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
PR target/96770
* gcc.target/arm/pure-code/pr96770.c: Fix scan-assembler-times
with movt/movw.

4 years agoaarch64: Don't emit -Wpsabi note when ABI was never affected [PR91710]
Jakub Jelinek [Fri, 16 Apr 2021 18:49:33 +0000 (20:49 +0200)] 
aarch64: Don't emit -Wpsabi note when ABI was never affected [PR91710]

As the following testcase shows, we emit a -Wpsabi note about argument
passing change since GCC 9, but in reality the ABI didn't change.
The alignment is 8 bits in GCC < 9 and 32 bits in GCC >= 9 and
the aarch64_function_arg_alignment returns in that case:
return MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY);
so when both the old and new alignment are smaller or equal to PARM_BOUNDARY
(or both are larger than STACK_BOUNDARY, just in theory), even when the new
one is bigger, it doesn't change the argument passing.

So, the following patch changes aarch64_function_arg_alignment to tell the
callers the exact old alignmentm so that they can test it if needed.
The other aarch64_function_arg_alignment callers either check the
alignment for equality against 16-byte alignment (when old alignment was
smaller than that and the new one is 16-byte, we want to emit -Wpsabi
in all the cases) or the va_arg case which I think is ok now too.

2021-04-16  Jakub Jelinek  <jakub@redhat.com>

PR target/91710
* config/aarch64/aarch64.c (aarch64_function_arg_alignment): Change
abi_break argument from bool * to unsigned *, store there the pre-GCC 9
alignment.
(aarch64_layout_arg, aarch64_gimplify_va_arg_expr): Adjust callers.
(aarch64_function_arg_regno_p): Likewise.  Only emit -Wpsabi note if
the old and new alignment after applying MIN/MAX to it is different.

* gcc.target/aarch64/pr91710.c: New test.

4 years agointl: Add --enable-host-shared support [PR100096]
Jakub Jelinek [Fri, 16 Apr 2021 16:32:27 +0000 (18:32 +0200)] 
intl: Add --enable-host-shared support [PR100096]

As mentioned in the PR, building gcc with jit enabled and
--enable-host-shared doesn't work on NetBSD/i?86, as libgccjit.so.0
has text relocations.
The r0-125846-g459260ecf8b420b029601a664cdb21c185268ecb changes
added --enable-host-shared support to various libraries, but didn't
add it to intl/ subdirectory; on Linux it isn't really needed, because
all: all-no
all-no: #nothing
but on other OSes intl/libintl.a is built.

The following patch makes sure it is built with -fPIC when
--enable-host-shared is used.

2021-04-16  Jakub Jelinek  <jakub@redhat.com>

PR jit/100096
* configure.ac: Add --enable-host-shared support.
* Makefile.in: Update copyright.  Add @PICFLAG@ to CFLAGS.
* configure: Regenerated.

4 years agoFortran: Fix ICE due to referencing a NULL pointer [PR100018]
José Rui Faustino de Sousa [Fri, 16 Apr 2021 16:17:21 +0000 (16:17 +0000)] 
Fortran: Fix ICE due to referencing a NULL pointer [PR100018]

gcc/fortran/ChangeLog:

PR fortran/100018
* resolve.c: Add association check before de-referencing pointer.

gcc/testsuite/ChangeLog:

PR fortran/100018
* gfortran.dg/PR10018.f90: New test.

4 years agoSVE: Fix wrong sve predicate split (PR100048)
Tamar Christina [Fri, 16 Apr 2021 15:58:50 +0000 (16:58 +0100)] 
SVE: Fix wrong sve predicate split (PR100048)

The attached testcase generates the following paradoxical subregs when creating
the predicates.

(insn 22 21 23 2 (set (reg:VNx8BI 100)
(subreg:VNx8BI (reg:VNx2BI 103) 0))
     (expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0])
(const_int 1 [0x1])
(const_int 0 [0]) repeated x5
    ])
(nil)))

and

(insn 15 14 16 2 (set (reg:VNx8BI 96)
(subreg:VNx8BI (reg:VNx2BI 99) 0))
     (expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0]) repeated x7
    ])
(nil)))

This causes CSE to incorrectly think that the two predicates are equal because
some of the significant bits get ignored due to the subreg.

The attached patch instead makes it so it always looks at all 16-bits of the
predicate, but in turn means we need to generate a TRN that matches the expected
result mode.  In effect in RTL we keep the mode as VNx16BI but during codegen
re-interpret them as the mode the predicate instruction wanted:

(insn 10 9 11 2 (set (reg:VNx8BI 96)
(subreg:VNx8BI (reg:VNx16BI 99) 0))
     (expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0]) repeated x7
    ])
(nil)))

Which needed correction to the TRN pattern.  A new TRN1_CONV unspec is
introduced which allows one to keep the arguments as VNx16BI but encode the
instruction as a type of the last operand.

(insn 9 8 10 2 (set (reg:VNx16BI 99)
(unspec:VNx16BI [
(reg:VNx16BI 97)
(reg:VNx16BI 98)
(reg:VNx2BI 100)
    ] UNSPEC_TRN1_CONV))
(nil))

This allows us remove all the paradoxical subregs and end up with

(insn 16 15 17 2 (set (reg:VNx8BI 101)
(subreg:VNx8BI (reg:VNx16BI 104) 0))
(expr_list:REG_EQUAL (const_vector:VNx8BI [
(const_int 1 [0x1])
(const_int 0 [0])
(const_int 1 [0x1])
(const_int 0 [0]) repeated x5
    ])
(nil)))

gcc/ChangeLog:

PR target/100048
* config/aarch64/aarch64-sve.md (@aarch64_sve_trn1_conv<mode>): New.
* config/aarch64/aarch64.c (aarch64_expand_sve_const_pred_trn): Use new
TRN optab.
* config/aarch64/iterators.md (UNSPEC_TRN1_CONV): New.

gcc/testsuite/ChangeLog:

PR target/100048
* gcc.target/aarch64/sve/pr100048.c: New test.

4 years agoc++: Fix empty base stores in cxx_eval_store_expression [PR100111]
Jakub Jelinek [Fri, 16 Apr 2021 15:37:07 +0000 (17:37 +0200)] 
c++: Fix empty base stores in cxx_eval_store_expression [PR100111]

In r11-6895 handling of empty bases has been fixed such that non-lval
stores of empty classes are not added when the type of *valp doesn't
match the type of the initializer, but as this testcase shows it is
done only when *valp is non-NULL.  If it is NULL, we still shouldn't
add empty class constructors if the type of the constructor elt *valp
points to doesn't match.

2021-04-16  Jakub Jelinek  <jakub@redhat.com>

PR c++/100111
* constexpr.c (cxx_eval_store_expression): Don't add CONSTRUCTORs
for empty classes into *valp when types don't match even when *valp
is NULL.

* g++.dg/cpp0x/constexpr-100111.C: New test.

4 years agodoc: Update Power builtin documentation in user's manual
Bill Schmidt [Fri, 16 Apr 2021 15:38:11 +0000 (10:38 -0500)] 
doc: Update Power builtin documentation in user's manual

The standard for many Power vector interfaces is now the recently
published Power Vector Intrinsic Programming Reference.  Reference
that document for the relevant interfaces, and remove redundant
information from the GCC user's manual.

2021-04-16  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): Revise
this section and its subsections.

4 years agoc++: ICE with bogus late return type [PR99803]
Marek Polacek [Wed, 14 Apr 2021 21:57:15 +0000 (17:57 -0400)] 
c++: ICE with bogus late return type [PR99803]

Here we ICE when compiling this code in C++20, because we're trying to
slam a 'typename' after the ->.  The cp_parser_template_id call just
before the spot I'm changing parsed A::template A<int> as a BASELINK
that contains a constructor, but make_typename_type crashes on that.

This patch makes make_typename_type more robust instead of checking
for is_overloaded_fn prior calling it.

gcc/cp/ChangeLog:

PR c++/99803
* decl.c (make_typename_type): Give an error and return when
name is is_overloaded_fn.
* parser.c (cp_parser_class_name): Don't check is_overloaded_fn
before calling make_typename_type.

gcc/testsuite/ChangeLog:

PR c++/99803
* g++.dg/cpp2a/typename14.C: Don't expect particular error
messages.
* g++.dg/cpp2a/typename19.C: New test.

4 years agotestsuite: Move gimplefe-4[0|1] tests.
Robin Dapp [Wed, 17 Mar 2021 08:08:42 +0000 (09:08 +0100)] 
testsuite: Move gimplefe-4[0|1] tests.

The gimplefe-40.c and gimplefe-41.c test cases require vect_* effective
targets even though they reside in gcc.dg.  By default e.g.
DEFAULT_VECTCFLAGS which is used to add target-specific machine or build
flags is only applied in the ./vect subdirectory.  Move these tests
there.

gcc/testsuite/ChangeLog:

* gcc.dg/gimplefe-40.c: Moved to...
* gcc.dg/vect/gimplefe-40.c: ...here.
* gcc.dg/gimplefe-41.c: Moved to...
* gcc.dg/vect/gimplefe-41.c: ...here.

4 years agoPR fortran/63797 - Bogus ambiguous reference to 'sqrt'
Harald Anlauf [Fri, 16 Apr 2021 14:24:31 +0000 (16:24 +0200)] 
PR fortran/63797 - Bogus ambiguous reference to 'sqrt'

The interface of an intrinsic procedure is automatically explicit.
Do not write it to the module file to prevent wrong ambiguities on USE.

gcc/fortran/ChangeLog:

PR fortran/63797
* module.c (write_symtree): Do not write interface of intrinsic
procedure to module file for F2003 and newer.

gcc/testsuite/ChangeLog:

PR fortran/63797
* gfortran.dg/pr63797.f90: New test.

Co-authored-by: Paul Thomas <pault@gcc.gnu.org>
4 years agotestsuite: Fix pr83403-{1,2}.c on IBM Z
Stefan Schulze Frielinghaus [Fri, 16 Apr 2021 14:03:07 +0000 (16:03 +0200)] 
testsuite: Fix pr83403-{1,2}.c on IBM Z

For z10 and newer inner loops are completely unrolled which means store
motion is not applied.  Reverting max-completely-peeled-insns to the
default value fixes these testcases.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr83403-1.c: Revert
max-completely-peeled-insns to the default value on IBM Z.
* gcc.dg/tree-ssa/pr83403-2.c: Likewise.

4 years agoc++: partially initialized constexpr array [PR99700]
Patrick Palka [Fri, 16 Apr 2021 13:24:46 +0000 (09:24 -0400)] 
c++: partially initialized constexpr array [PR99700]

Here, reduced_constant_expression_p is incorrectly returning true for a
partially initialized array CONSTRUCTOR (in C++20 mode) because when the
CONSTRUCTOR_NO_CLEARING flag is set, the predicate doesn't check that
the CONSTRUCTOR spans the entire array like it does for class CONSTRUCTORS.
This patch adds a dedicated loop for the array case that simultaneously
verifies the CONSTRUCTOR spans the entire array and is made up of valid
constant expressions.

gcc/cp/ChangeLog:

PR c++/99700
* constexpr.c (reduced_constant_expression_p): For array
CONSTRUCTORs, use a dedicated loop that additionally verifies
the CONSTRUCTOR spans the entire array.

gcc/testsuite/ChangeLog:

PR c++/99700
* g++.dg/cpp2a/constexpr-init21.C: New test.

4 years agoaarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]
Jakub Jelinek [Fri, 16 Apr 2021 11:44:23 +0000 (13:44 +0200)] 
aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]

The testcase used to be compiled at -O2 by GCC8 and earlier to:
f1:
        neg     w1, w0, asr 16
        and     w1, w1, 65535
        orr     w0, w1, w0, lsl 16
        ret
f2:
        neg     w1, w0
        extr    w0, w1, w0, 16
        ret
but since GCC9 (r9-3594 for f1 and r9-6926 for f2) we compile it into:
f1:
        mov     w1, w0
        sbfx    x0, x1, 16, 16
        neg     w0, w0
        bfi     w0, w1, 16, 16
        ret
f2:
        neg     w1, w0
        sbfx    x0, x0, 16, 16
        bfi     w0, w1, 16, 16
        ret
instead, i.e. one insn longer each.  With this patch we get:
f1:
        mov     w1, w0
        neg     w0, w1, asr 16
        bfi     w0, w1, 16, 16
        ret
f2:
        neg     w1, w0
        extr    w0, w1, w0, 16
        ret
i.e. identical f2 and same number of insns as in GCC8 in f1.
The combiner unfortunately doesn't try splitters when doing 2 -> 1
combination, so it can't be implemented as combine splitters, but
it could be implemented as define_insn_and_split if desirable.

2021-04-16  Jakub Jelinek  <jakub@redhat.com>

PR target/100075
* config/aarch64/aarch64.md (*neg_asr_si2_extr, *extrsi5_insn_di): New
define_insn patterns.

* gcc.target/aarch64/pr100075.c: New test.

4 years agoMark untyped calls and handle them specially [PR98689]
Richard Sandiford [Fri, 16 Apr 2021 11:38:02 +0000 (12:38 +0100)] 
Mark untyped calls and handle them specially [PR98689]

This patch fixes a regression introduced by the rtl-ssa patches.
It was seen on HPPA but it might be latent elsewhere.

The problem is that the traditional way of expanding an untyped_call
is to emit sequences like:

   (call (mem (symbol_ref "foo")))
   (set (reg pseudo1) (reg result1))
   ...
   (set (reg pseudon) (reg resultn))

The ABI specifies that result1..resultn are clobbered by the call but
nothing in the RTL indicates that result1..resultn are the results
of the call.  Normally, using a clobbered value gives undefined results,
but in this case the results are well-defined and matter for correctness.

This seems like a niche case, so I think it would be better to mark
it explicitly rather than try to detect it heuristically.

Note that in expand_builtin_apply we already have an rtx_insn *,
so it doesn't matter whether we call emit_call_insn or emit_insn.
Calling emit_insn seems more natural now that the gen_* call
has been split out.  It also matches later code in the function.

gcc/
PR rtl-optimization/98689
* reg-notes.def (UNTYPED_CALL): New note.
* combine.c (distribute_notes): Handle it.
* emit-rtl.c (try_split): Likewise.
* rtlanal.c (rtx_properties::try_to_add_insn): Likewise.  Assume
that calls with the note implicitly set all return value registers.
* builtins.c (expand_builtin_apply): Add a REG_UNTYPED_CALL
to untyped_calls.

4 years agortlanal: Don't assume that calls write to a global SP [PR99596]
Richard Sandiford [Fri, 16 Apr 2021 11:38:01 +0000 (12:38 +0100)] 
rtlanal: Don't assume that calls write to a global SP [PR99596]

This patch is a GCC 11 regression caused by the rtl-ssa code.
Normally we treat calls as containing a potential set of a global
register, but DF makes a sensible exception for the stack pointer:

      if (i == STACK_POINTER_REGNUM)
/* The stack ptr is used (honorarily) by a CALL insn.  */
df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
       NULL, bb, insn_info, DF_REF_REG_USE,
       DF_REF_CALL_STACK_USAGE | flags);
      else if (global_regs[i])
{
  /* Calls to const functions cannot access any global registers and
     calls to pure functions cannot set them.  All other calls may
     reference any of the global registers, so they are recorded as
     used. */

The only DF definition of SP was therefore the one in the entry block.
However, the rtlanal.c rtx_properties code (wrongly) assumed that calls
also clobbered the global SP.  This led to multiple definitions of SP
when we only expected one.

This patch tightens the rtlanal.c handling of global registers
to match the DF approach.

gcc/
PR rtl-optimization/99596
* rtlanal.c (rtx_properties::try_to_add_insn): Don't add global
register accesses for const calls.  Assume that pure functions
can only read from global registers.  Ignore cases in which
the stack pointer has been marked global.

gcc/testsuite/
PR rtl-optimization/99596
* gcc.target/arm/pr99596.c: New test.

4 years agoarm: Fix some testsuite fallout from r11-8168 [PR100067]
Richard Earnshaw [Fri, 16 Apr 2021 10:58:17 +0000 (11:58 +0100)] 
arm: Fix some testsuite fallout from r11-8168 [PR100067]

Commit r11-8168 changed the word ordering of a warning in order to
make the text more consistent.  Unfortunately, it neglected to update
some filters in the testsuite that are intended to strip such warnings
when we try to partially override the user-supplied command-line
options.

This patch rectifies this and also fixes some patterns that were
incorrectly specified in the first place.

gcc/testsuite:

PR target/100067
* g++.target/arm/arm.exp (dg_runtest_extra_prunes): Update prune
template.
* gcc.target/arm/arm.exp (dg_runtest_extra_prunes): Likewise.
* g++.target/arm/mve.exp (dg_runtest_extra_prunes): Likewise.  Fix
missing quotes around switch names.
* gcc.target/arm/mve/mve.exp: (dg_runtest_extra_prunes): Likewise.

4 years agovectorizer: Remove dead scalar .COND_* calls from vectorized loops [PR99767]
Jakub Jelinek [Fri, 16 Apr 2021 09:44:04 +0000 (11:44 +0200)] 
vectorizer: Remove dead scalar .COND_* calls from vectorized loops [PR99767]

The following testcase ICEs because disabling of DCE means there are dead
stmts in the loop (though, in theory they could become dead only shortly
before if-conv through some optimization), ifcvt which goes through all
stmts in the loop if-converts them into .COND_DIV etc. internal fn calls
in the copy of the loop meant for vectorization only, the loop is
successfully vectorized but the particular .COND_* call is not because
it isn't a live statement and the scalar .COND_* remains in the IL until
expansion where it ICEs because these ifns only support vectors and not
scalars.

These ifns are similar to .MASK_{LOAD,STORE} in this behavior.

One possible fix could be to expand scalar versions of them during
expansion, basically undoing what if-conv did to create them, i.e.
expand them as the lhs = else; if (mask) { lhs = statement; } or so.

For .MASK_LOAD we have code to replace them in vect_transform_loop already
though (not needed for .MASK_STORE, as stores should be always live
and thus always vectorized), so this patch instead replaces .COND_*
similarly to .MASK_LOAD in that loop, with the small difference
that lhs = .MASK_LOAD (...); is replaced by lhs = 0; while
lhs = .COND_* (..., else_arg); is replaced by lhs = else_arg.
The statement must be dead, otherwise it would be vectorized, so I think
it is not a big deal we don't turn it back into multiple basic blocks etc.
(and it might be not possible to do that at that point).

2021-04-16  Jakub Jelinek  <jakub@redhat.com>

PR target/99767
* tree-vect-loop.c (vect_transform_loop): Don't remove just
dead scalar .MASK_LOAD calls, but also dead .COND_* calls - replace
them by their last argument.

* gcc.target/aarch64/pr99767.c: New test.

4 years agoc++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850]
Jakub Jelinek [Fri, 16 Apr 2021 07:34:26 +0000 (09:34 +0200)] 
c++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850]

The requires clause parsing has code to suggest users wrapping
non-primary expressions in (), so if it e.g. parses a primary expression
and sees it is followed by ++, --, ., ( or -> among other things it
will try to reparse it as assignment expression or what and if that works
suggests wrapping it inside of parens.
When it is requires-clause that is after <typename T> etc. it already
has an exception from that as ( can occur in valid C++20 expression there
- starting the parameters of the lambda.
In C++23 another case can occur, as the parameters with the ()s can be
omitted, requires C can be followed immediately by -> which starts a
trailing return type.  Even in that case, we don't want to parse that
as C->...

2021-04-16  Jakub Jelinek  <jakub@redhat.com>

PR c++/99850
* parser.c (cp_parser_constraint_requires_parens) <case CPP_DEREF>:
If lambda_p, return pce_ok instead of pce_maybe_postfix.

* g++.dg/cpp23/lambda-specifiers2.C: New test.

4 years agoc++: Fix up handling of structured bindings in extract_locals_r [PR99833]
Jakub Jelinek [Fri, 16 Apr 2021 07:32:44 +0000 (09:32 +0200)] 
c++: Fix up handling of structured bindings in extract_locals_r [PR99833]

The following testcase ICEs in tsubst_decomp_names because the assumptions
that the structured binding artificial var is followed in DECL_CHAIN by
the corresponding structured binding vars is violated.
I've tracked it to extract_locals* which is done for the constexpr
IF_STMT.  extract_locals_r when it sees a DECL_EXPR adds that decl
into a hash set so that such decls aren't returned from extract_locals*,
but in the case of a structured binding that just means the artificial var
and not the vars corresponding to structured binding identifiers.
The following patch fixes it by pushing not just the artificial var
for structured bindings but also the other vars.

2021-04-16  Jakub Jelinek  <jakub@redhat.com>

PR c++/99833
* pt.c (extract_locals_r): When handling DECL_EXPR of a structured
binding, add to data.internal also all corresponding structured
binding decls.

* g++.dg/cpp1z/pr99833.C: New test.
* g++.dg/cpp2a/pr99833.C: New test.

4 years agotestsuite: Fix unroll-and-jam.c on IBM Z
Stefan Schulze Frielinghaus [Fri, 16 Apr 2021 05:48:34 +0000 (07:48 +0200)] 
testsuite: Fix unroll-and-jam.c on IBM Z

For z10 and newer inner loops are completely unrolled which leaves no
inner loops to jam which renders this testcase to fail.  Reverting
max-completely-peel-times to the default value fixes this testcase.

gcc/testsuite/ChangeLog:

* gcc.dg/unroll-and-jam.c: Revert max-completely-peel-times to
the default value on IBM Z.

4 years agoc++: C++20 class NTTP trailing zero-init [PR100079]
Jason Merrill [Wed, 14 Apr 2021 21:27:19 +0000 (17:27 -0400)] 
c++: C++20 class NTTP trailing zero-init [PR100079]

The new testcase was breaking because constexpr evaluation was simplifying
Bar{Baz<42>{}} to Bar{empty}, but then we weren't treating them as
equivalent.  Poking at this revealed that the code for eliding trailing
zero-initialization in class non-type template argument mangling was pretty
broken, including the test, mangle71.

I dealt with the FIXME to support RANGE_EXPR, and fixed the confusion
between a list-initialized temporary mangled as written (i.e. in the
signature of a function template) and a template parameter object mangled as
the value representation of the object.  I'm distinguishing between these
using COMPOUND_LITERAL_P.  A later patch will adjust the use of
COMPOUND_LITERAL_P to be more useful for this distinction, but it works now
for distinguishing these cases in mangling.

gcc/cp/ChangeLog:

PR c++/100079
* cp-tree.h (first_field): Declare.
* mangle.c (range_expr_nelts): New.
(write_expression): Improve class NTTP mangling.
* pt.c (get_template_parm_object): Clear TREE_HAS_CONSTRUCTOR.
* tree.c (zero_init_expr_p): Improve class NTTP handling.
* decl.c: Adjust comment.

gcc/testsuite/ChangeLog:

PR c++/100079
* g++.dg/abi/mangle71.C: Fix expected mangling.
* g++.dg/abi/mangle77.C: New test.
* g++.dg/cpp2a/nontype-class-union1.C: Likewise.
* g++.dg/cpp2a/nontype-class-equiv1.C: Removed.
* g++.dg/cpp2a/nontype-class44.C: New test.

4 years agoDaily bump.
GCC Administrator [Fri, 16 Apr 2021 00:16:23 +0000 (00:16 +0000)] 
Daily bump.

4 years agoPropagate type attribute when merging extern declarations at local scope.
Martin Sebor [Thu, 15 Apr 2021 21:49:30 +0000 (15:49 -0600)] 
Propagate type attribute when merging extern declarations at local scope.

Resolves:
PR c/99420 - bogus -Warray-parameter on a function redeclaration in function scope
PR c/99972 - missing -Wunused-result on a call to a locally redeclared warn_unused_result function

gcc/c/ChangeLog:

PR c/99420
PR c/99972
* c-decl.c (pushdecl): Always propagate type attribute.

gcc/testsuite/ChangeLog:

PR c/99420
PR c/99972
* gcc.dg/Warray-parameter-9.c: New test.
* gcc.dg/Wnonnull-6.c: New test.
* gcc.dg/Wreturn-type3.c: New test.
* gcc.dg/Wunused-result.c: New test.
* gcc.dg/attr-noreturn.c: New test.
* gcc.dg/attr-returns-nonnull.c: New test.

4 years agogcc.dg/pr84877.c: Xfail for cris-*-*
Hans-Peter Nilsson [Thu, 15 Apr 2021 19:51:08 +0000 (21:51 +0200)] 
gcc.dg/pr84877.c: Xfail for cris-*-*

Unfortunately it appears that this PR is on nobody's radar.
Xfailing it to get an arguably artificial zero regression
state (since T0=2007-01-05) helps my autotester.

Caveat: the pass/fail state of this test, as long as stack
alignment isn't adjusted, is dependent on the alignment of
the stack at the entry of main, so depending on the target,
e.g. the size and number of environment variables at
invocation time can affect the result (including simulator
runs where environment variables are propagated to the
target).

gcc/testsuite:
PR middle-end/84877
* gcc.dg/pr84877.c: Xfail for cris-*-*.

4 years agoc++: constexpr and volatile member function [PR80456]
Jason Merrill [Thu, 15 Apr 2021 19:13:18 +0000 (15:13 -0400)] 
c++: constexpr and volatile member function [PR80456]

When calling a static member function we still need to evaluate an explicit
object argument.  But we don't want to force a load of the entire object
if the argument is volatile, so we take its address.  If as a result it no
longer has any side-effects, we don't need to evaluate it after all.

gcc/cp/ChangeLog:

PR c++/80456
* call.c (build_new_method_call_1): Check again for side-effects
with a volatile object.

gcc/testsuite/ChangeLog:

PR c++/80456
* g++.dg/cpp0x/constexpr-volatile3.C: New test.