aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-10-04Daily bump.GCC Administrator3-1/+15
2022-10-04openmp: Add begin declare target supportJakub Jelinek23-75/+429
The following patch adds support for the begin declare target construct, which is another spelling for declare target construct without clauses (where it needs paired end declare target), but unlike that one accepts clauses. This is an OpenMP 5.1 feature, implemented with 5.2 clarification because in 5.1 we had a restriction in the declare target chapter shared by declare target and begin declare target that if there are any clauses specified at least one of them needs to be to or link. But that was of course meant just for declare target and not begin declare target, because begin declare target doesn't even allow to/link/enter clauses. In addition to that, the patch also makes device_type clause duplication an error (as stated in 5.1) and similarly makes declare target with just device_type clause an error rather than warning. What this patch doesn't do is: 1) OpenMP 5.1 also added an indirect clause, we don't support that neither on declare target nor begin declare target and I couldn't find it in our features pages (neither libgomp.texi nor web) 2) I think device_type(nohost)/device_type(host) support can't work for variables (in 5.0 it only talked about procedures so this could be also thought as 5.1 feature that we should just add to the list and implement) 3) I don't see any use of the "omp declare target nohost" attribute, so I'm not sure if device_type(nohost) works at all 2022-10-04 Jakub Jelinek <jakub@redhat.com> gcc/c-family/ * c-omp.cc (c_omp_directives): Uncomment begin declare target entry. gcc/c/ * c-lang.h (struct c_omp_declare_target_attr): New type. (current_omp_declare_target_attribute): Change type from int to vec<c_omp_declare_target_attr, va_gc> *. * c-parser.cc (c_parser_translation_unit): Adjust for that change. If last pushed directive was begin declare target, use different wording and simplify format strings for easier translations. (c_parser_omp_clause_device_type): Uncomment check_no_duplicate_clause call. (c_parser_omp_declare_target): Adjust for the current_omp_declare_target_attribute type change, push { -1 }. Use error_at rather than warning_at for declare target with only device_type clauses. (OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Define. (c_parser_omp_begin): Add begin declare target support. (c_parser_omp_end): Adjust for the current_omp_declare_target_attribute type change, adjust diagnostics wording and simplify format strings for easier translations. * c-decl.cc (current_omp_declare_target_attribute): Change type from int to vec<c_omp_declare_target_attr, va_gc> *. (c_decl_attributes): Adjust for the current_omp_declare_target_attribute type change. If device_type was present on begin declare target, add "omp declare target host" and/or "omp declare target nohost" attributes. gcc/cp/ * cp-tree.h (struct omp_declare_target_attr): Rename to ... (cp_omp_declare_target_attr): ... this. Add device_type member. (omp_begin_assumes_data): Rename to ... (cp_omp_begin_assumes_data): ... this. (struct saved_scope): Change types of omp_declare_target_attribute and omp_begin_assumes. * parser.cc (cp_parser_omp_clause_device_type): Uncomment check_no_duplicate_clause call. (cp_parser_omp_all_clauses): Fix up pasto, c_name for OMP_CLAUSE_LINK should be "link" rather than "to". (cp_parser_omp_declare_target): Adjust for omp_declare_target_attr to cp_omp_declare_target_attr changes, push -1 as device_type. Use error_at rather than warning_at for declare target with only device_type clauses. (OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Define. (cp_parser_omp_begin): Add begin declare target support. Adjust for omp_begin_assumes_data to cp_omp_begin_assumes_data change. (cp_parser_omp_end): Adjust for the omp_declare_target_attr to cp_omp_declare_target_attr and omp_begin_assumes_data to cp_omp_begin_assumes_data type changes, adjust diagnostics wording and simplify format strings for easier translations. * semantics.cc (finish_translation_unit): Likewise. * decl2.cc (cplus_decl_attributes): If device_type was present on begin declare target, add "omp declare target host" and/or "omp declare target nohost" attributes. gcc/testsuite/ * c-c++-common/gomp/declare-target-4.c: Move tests that are now rejected into declare-target-7.c. * c-c++-common/gomp/declare-target-6.c: Adjust expected diagnostics. * c-c++-common/gomp/declare-target-7.c: New test. * c-c++-common/gomp/begin-declare-target-1.c: New test. * c-c++-common/gomp/begin-declare-target-2.c: New test. * c-c++-common/gomp/begin-declare-target-3.c: New test. * c-c++-common/gomp/begin-declare-target-4.c: New test. * g++.dg/gomp/attrs-9.C: Add begin declare target tests. * g++.dg/gomp/attrs-18.C: New test. libgomp/ * libgomp.texi (Support begin/end declare target syntax in C/C++): Mark as implemented. (cherry picked from commit b6d5d72bd0b71ac96a8b2ee537367c46107dcb73)
2022-10-03gcc/config/t-i386: add build dependencies on i386-builtin-types.incSergei Trofimovich1-0/+5
i386-builtin-types.inc is included indirectly via i386-builtins.h into 4 files: i386.cc i386-builtins.cc i386-expand.cc i386-features.cc Only i386.cc dependency was present in gcc/config/t-i386 makefile. As a result parallel builds occasionally fail as: g++ ... -o i386-builtins.o ... ../../gcc-13-20220911/gcc/config/i386/i386-builtins.cc In file included from ../../gcc-13-20220911/gcc/config/i386/i386-builtins.cc:92: ../../gcc-13-20220911/gcc/config/i386/i386-builtins.h:25:10: fatal error: i386-builtin-types.inc: No such file or directory 25 | #include "i386-builtin-types.inc" | ^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[3]: *** [../../gcc-13-20220911/gcc/config/i386/t-i386:54: i386-builtins.o] Error 1 shuffle=1663349189 gcc/ PR target/107064 * config/i386/t-i386: Add build-time dependencies against i386-builtin-types.inc to i386-builtins.o, i386-expand.o, i386-features.o. (cherry picked from commit ef3165736d9daafba88adb2db65b2e8ebf0024ca)
2022-10-03Update gcc sv.poJoseph Myers1-17/+19
* sv.po: Update.
2022-10-03Daily bump.GCC Administrator1-1/+1
2022-10-02Daily bump.GCC Administrator3-1/+36
2022-10-01Fortran: Fix automatic reallocation inside select rank [PR100103]José Rui Faustino de Sousa2-2/+78
gcc/fortran/ChangeLog: PR fortran/100103 * trans-array.cc (gfc_is_reallocatable_lhs): Add select rank temporary associate names as possible targets of automatic reallocation. gcc/testsuite/ChangeLog: PR fortran/100103 * gfortran.dg/PR100103.f90: New test. (cherry picked from commit 12b537b9b7fd50f4b2fbfcb7ccf45f8d66085577)
2022-10-01Fortran: Fix function attributes [PR100132]José Rui Faustino de Sousa2-2/+88
gcc/fortran/ChangeLog: PR fortran/100132 * trans-types.cc (create_fn_spec): Fix function attributes when passing polymorphic pointers. gcc/testsuite/ChangeLog: PR fortran/100132 * gfortran.dg/PR100132.f90: New test. (cherry picked from commit be60aa5b608b5f09fadfeff852a46589ac311a42)
2022-10-01Daily bump.GCC Administrator1-1/+1
2022-09-30Fortran: Update use_device_ptr for OpenMP 5.1 [PR105318]Tobias Burnus8-27/+244
OpenMP 5.1 added has_device_addr and relaxed the restrictions for use_device_ptr, including processing non-type(c_ptr) arguments as if has_device_addr was used. (There is a semantic difference.) For completeness, the likewise change was done for 'use_device_ptr', where non-type(c_ptr) arguments now use use_device_addr. Finally, a warning for 'device(omp_{initial,invalid}_device)' was silenced on the way as affecting the new testcase. PR fortran/105318 gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Update is_device_ptr restrictions for OpenMP 5.1 and map to has_device_addr where applicable; map use_device_ptr to use_device_addr where applicable. Silence integer-range warning for device(omp_{initial,invalid}_device). libgomp/ChangeLog: * testsuite/libgomp.fortran/is_device_ptr-2.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/is_device_ptr-1.f90: Remove dg-error. * gfortran.dg/gomp/is_device_ptr-2.f90: Likewise. * gfortran.dg/gomp/is_device_ptr-3.f90: Update tree-scan-dump. (cherry picked from commit 10a116104969b3ecc9ea4abdd5436c66fd78d537)
2022-09-30Daily bump.GCC Administrator6-1/+120
2022-09-29c++: fix triviality of class with unsatisfied op=Jason Merrill2-2/+55
cxx20_pair is trivially copyable because it has a trivial copy constructor and only a deleted copy assignment operator; the non-triviality of the unsatisfied copy assignment overload is not considered. gcc/cp/ChangeLog: * class.cc (check_methods): Call constraints_satisfied_p. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/cond-triv3.C: New test.
2022-09-29Fortran: error recovery while simplifying intrinsic UNPACK [PR107054]Harald Anlauf2-3/+23
gcc/fortran/ChangeLog: PR fortran/107054 * simplify.cc (gfc_simplify_unpack): Replace assert by condition that terminates simplification when there are not enough elements in the constructor of argument VECTOR. gcc/testsuite/ChangeLog: PR fortran/107054 * gfortran.dg/pr107054.f90: New test. (cherry picked from commit 78bc6497fc61bbdacfb416ee0246a775360d9af6)
2022-09-29Fortran: fix ICE in generate_coarray_sym_init [PR82868]Harald Anlauf2-0/+16
gcc/fortran/ChangeLog: PR fortran/82868 * trans-decl.cc (generate_coarray_sym_init): Skip symbol if attr.associate_var. gcc/testsuite/ChangeLog: PR fortran/82868 * gfortran.dg/associate_26a.f90: New test. (cherry picked from commit bc71318a91286b5f00e88f07aab818ac82510692)
2022-09-29Fortran: NULL pointer dereference in invalid simplification [PR106985]Harald Anlauf2-1/+10
gcc/fortran/ChangeLog: PR fortran/106985 * expr.cc (gfc_simplify_expr): Avoid NULL pointer dereference. gcc/testsuite/ChangeLog: PR fortran/106985 * gfortran.dg/pr106985.f90: New test. (cherry picked from commit 8dbb15bc2d019488240c1e69d93121b0347ac092)
2022-09-29i386: Mark XMM4-XMM6 as clobbered by encodekey128/encodekey256H.J. Lu4-14/+12
encodekey128 and encodekey256 operations clear XMM4-XMM6. But it is documented that XMM4-XMM6 are reserved for future usages and software should not rely upon them being zeroed. Change encodekey128 and encodekey256 to clobber XMM4-XMM6. gcc/ PR target/107061 * config/i386/predicates.md (encodekey128_operation): Check XMM4-XMM6 as clobbered. (encodekey256_operation): Likewise. * config/i386/sse.md (encodekey128u32): Clobber XMM4-XMM6. (encodekey256u32): Likewise. gcc/testsuite/ PR target/107061 * gcc.target/i386/keylocker-encodekey128.c: Don't check XMM4-XMM6. * gcc.target/i386/keylocker-encodekey256.c: Likewise. (cherry picked from commit db288230db55dc1ff626f46c708b555847013a41)
2022-09-29Merge branch 'releases/gcc-12' into devel/omp/gcc-12Tobias Burnus22-58/+172
Merged up to r12-8794-g85adc2ec2b0736d07c0df35ad9a450f97ff59a7c (29th Sept 2022) This includes r12-8793-gafea1ae84f0 (cherry-picked from r13-2868-gd3df98807b5) "OpenACC: Fix reduction tree-sharing issue [PR106982]". However, due to omp-low.cc changes, it neither applies cleanly nor it required to make the testcases pass. This merge adds the testcases - but due to conflicts under a different filename: gcc/testsuite/c-c++-common/goacc/reduction-7.c added as ...-9.c and ...-8.c added as ...-10.c.
2022-09-29libstdc++: Disable volatile-qualified std::bind for C++20Jonathan Wakely13-33/+87
LWG 2487 added a precondition to std::bind for C++17, making volatile-qualified uses undefined. We still support it, but with a deprecated warning. P1065R2 made it explicitly ill-formed for C++20, so we should no longer accept it as deprecated. This implements that change. libstdc++-v3/ChangeLog: * doc/xml/manual/evolution.xml: Document std::bind API changes. * doc/xml/manual/intro.xml: Document LWG 2487 status. * doc/xml/manual/using.xml: Clarify default value of _GLIBCXX_USE_DEPRECATED. * doc/html/*: Regenerate. * include/std/functional (_Bind::operator()(Args&&...) volatile) (_Bind::operator()(Args&&...) const volatile) (_Bind_result::operator()(Args&&...) volatile) (_Bind_result::operator()(Args&&...) const volatile): Replace with deleted overload for C++20 and later. * testsuite/20_util/bind/cv_quals.cc: Check for deprecated warnings in C++17. * testsuite/20_util/bind/cv_quals_2.cc: Likewise, and check for ill-formed in C++20. (cherry picked from commit d01f112de4a54db6d2abef836e6dff3a08167389)
2022-09-29OpenACC: Fix reduction tree-sharing issue [PR106982]Tobias Burnus3-8/+45
The tree for var == incoming == outgound was 'MEM <double[5]> [(double *)&reduced]' which caused the ICE "incorrect sharing of tree nodes". PR middle-end/106982 gcc/ChangeLog: * omp-low.cc (lower_oacc_reductions): Add some unshare_expr. gcc/testsuite/ChangeLog: * c-c++-common/goacc/reduction-7.c: New test. * c-c++-common/goacc/reduction-8.c: New test. (cherry picked from commit d3df98807b58df186061ad52ff87cc09ba593e9b)
2022-09-29Daily bump.GCC Administrator2-1/+25
2022-09-28OpenMP: Fix ICE with OMP metadirectivesPaul-Antoine Arras7-10/+142
Problem: ending an OpenMP metadirective block with an OMP end statement results in an internal compiler error. Solution: reject invalid end statements and issue a proper diagnostic. This revision also fixes a couple of minor metadirective issues and adds related test cases. gcc/fortran/ChangeLog: * parse.cc (gfc_ascii_statement): Missing $ in !$OMP END METADIRECTIVE. (parse_omp_structured_block): Fix handling of OMP end metadirective. (parse_omp_metadirective_body): Reject OMP end statements at the end of an OMP metadirective. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/metadirective-1.f90: Match !$OMP END METADIRECTIVE. * gfortran.dg/gomp/metadirective-10.f90: New test. * gfortran.dg/gomp/metadirective-11.f90: New xfail test. * gfortran.dg/gomp/metadirective-9.f90: New test.
2022-09-28aarch64: Add Arm Neoverse V2 supportKyrylo Tkachov4-23/+24
This patch adds -mcpu/-mtune support for the Arm Neoverse V2 core. This updates the internal references to "demeter", but leaves "demeter" as an accepted value to -mcpu/-mtune as it appears in the released GCC 12 series. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ChangeLog: * config/aarch64/aarch64-cores.def (neoverse-v2): New entry. (demeter): Update tunings to neoversev2. * config/aarch64/aarch64-tune.md: Regenerate. * config/aarch64/aarch64.cc (demeter_addrcost_table): Rename to neoversev2_addrcost_table. (demeter_regmove_cost): Rename to neoversev2_addrcost_table. (demeter_advsimd_vector_cost): Rename to neoversev2_advsimd_vector_cost. (demeter_sve_vector_cost): Rename to neoversev2_sve_vector_cost. (demeter_scalar_issue_info): Rename to neoversev2_scalar_issue_info. (demeter_advsimd_issue_info): Rename to neoversev2_advsimd_issue_info. (demeter_sve_issue_info): Rename to neoversev2_sve_issue_info. (demeter_vec_issue_info): Rename to neoversev2_vec_issue_info. Update references to above. (demeter_vector_cost): Rename to neoversev2_vector_cost. (demeter_tunings): Rename to neoversev2_tunings. (aarch64_vec_op_count::rename_cycles_per_iter): Use neoversev2_sve_issue_info instead of demeter_sve_issue_info. * doc/invoke.texi (AArch64 Options): Document neoverse-v2. (cherry picked from commit 14d4b4fb12041dde1511262b926662929196c3fe)
2022-09-28libgomp.texi: Status 'P' for 'assume', remove duplicated lineTobias Burnus2-2/+9
libgomp/ * libgomp.texi (OpenMP 5.1): Mark 'assume' as implemented for C/C++. Remove duplicated 'begin declare target' entry. (cherry picked from commit 175a89d12392acd9cb09e56acafee6fcf2366392)
2022-09-28Merge branch 'releases/gcc-12' into devel/omp/gcc-12Tobias Burnus3-2/+5
Merge up to r12-8790-g8dbde52fbcd0ad5749398216064637414d639d89 (28th Sep 2022)
2022-09-28Daily bump.GCC Administrator2-1/+5
2022-09-27amdgcn: Add builtin for vectorized DFmode fabs operationKwok Cheung Yeung3-0/+24
2022-09-27 Kwok Cheung Yeung <kcy@codesourcery.com> gcc/ * config/gcn/gcn-builtins.def (FABSV): New builtin. * config/gcn/gcn.cc (gcn_expand_builtin_1): Generate builtin for GCN_BUILTIN_FABSV.
2022-09-27amdgcn: Fix instruction generation for exp2 and log2 operationsKwok Cheung Yeung2-6/+22
The GCN instructions for the exp2 and log2 operations are v_exp_* and v_log_* respectively, which unfortunately do not line up with the RTL naming convention. To deal with this, a new set of int attributes is now used when generating the assembly for these instructions. 2022-09-27 Kwok Cheung Yeung <kcy@codesourcery.com> gcc/ * config/gcn/gcn-valu.md (math_unop_insn): New attribute. (<math_unop><mode>2, <math_unop><mode>2<exec>, <math_unop><mode>2, <math_unop><mode>2<exec>, *<math_unop><mode>2_insn, *<math_unop><mode>2<exec>_insn): Use math_unop_insn to generate assembler output.
2022-09-27OpenMP: Generate SIMD clones for functions with "declare target"Sandra Loosemore15-52/+362
This patch causes the IPA simdclone pass to generate clones for functions with the "omp declare target" attribute as if they had "omp declare simd", provided the function appears to be suitable for SIMD execution. The filter is conservative, rejecting functions that write memory or that call other functions not known to be safe. A new option -fopenmp-target-simd-clone is added to control this transformation; it's enabled at -O2 and higher. This is a backport of the proposed mainline patch. https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601972.html gcc/ChangeLog: * common.opt (fopenmp-target-simd-clone): New option. * opts.cc (default_options_table): Add -fopenmp-target-simd-clone. * doc/invoke.texi (-fopenmp-target-simd-clone): Document. * omp-simd-clone.cc (auto_simd_check_stmt): New function. (mark_auto_simd_clone): New function. (simd_clone_create): Add force_local argument, make the symbol have internal linkage if it is true. (expand_simd_clones): Also check for cloneable functions with "omp declare target". Pass explicit_p argument to simd_clone.compute_vecsize_and_simdlen target hook. * target.def (TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN): Add bool explicit_p argument. * doc/tm.texi: Regenerated. * config/aarch64/aarch64.cc (aarch64_simd_clone_compute_vecsize_and_simdlen): Update. * config/gcn/gcn.cc (gcn_simd_clone_compute_vecsize_and_simdlen): Update. * config/i386/i386.cc (ix86_simd_clone_compute_vecsize_and_simdlen): Update. gcc/testsuite/ChangeLog: * gcc.dg/gomp/target-simd-clone-1.c: New. * gcc.dg/gomp/target-simd-clone-2.c: New. * gcc.dg/gomp/target-simd-clone-3.c: New. * gcc.dg/gomp/target-simd-clone-4.c: New. * gcc.dg/gomp/target-simd-clone-5.c: New. * gcc.dg/gomp/target-simd-clone-6.c: New.
2022-09-27c-family: Drop nothrow from c_keywordsMarek Polacek1-1/+0
As discussed in <https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602337.html>. gcc/c-family/ChangeLog: * c-format.cc (c_keywords): Drop nothrow.
2022-09-27openmp: Add OpenMP assume, assumes and begin/end assumes supportJakub Jelinek33-67/+1165
The following patch implements OpenMP 5.1 #pragma omp assume #pragma omp assumes and #pragma omp begin assumes #pragma omp end assumes directive support for C and C++. Currently it doesn't remember anything from the assumption clauses for later, so is mainly to support the directives and diagnose errors in their use. If the recently posted C++23 [[assume (cond)]]; support makes it in, the intent is that this can be easily adjusted at least for the #pragma omp assume directive with holds clause(s) to use the same infrastructure. Now, C++23 portable assumptions are slightly different from OpenMP 5.1 assumptions' holds clause in that C++23 assumption holds just where it appears, while OpenMP 5.1 assumptions hold everywhere in the scope of the directive. For assumes directive which can appear at file or namespace scope it is the whole TU and everything that functions from there call at runtime, for begin assumes/end assumes pair all the functions in between those directives and everything they call and for assume directive the associated (currently structured) block. I have no idea how to represents such holds to be usable for optimizers, except to make #pragma omp assume holds (cond) block; expand essentially to [[assume (cond)]]; block; or [[assume (cond)]]; block; [[assume (cond)]]; for now. Except for holds clause, the other assumptions are OpenMP related, I'd say we should brainstorm where it would be useful to optimize based on such information (I guess e.g. in target regions it easily could) and only when we come up with something like that think about how to propagate the assumptions to the optimizers. 2022-09-27 Jakub Jelinek <jakub@redhat.com> gcc/c-family/ * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ASSUME, PRAGMA_OMP_ASSUMES and PRAGMA_OMP_BEGIN. Rename PRAGMA_OMP_END_DECLARE_TARGET to PRAGMA_OMP_END. * c-pragma.cc (omp_pragmas): Add assumes and begin. For end rename PRAGMA_OMP_END_DECLARE_TARGET to PRAGMA_OMP_END. (omp_pragmas_simd): Add assume. * c-common.h (c_omp_directives): Declare. * c-omp.cc (omp_directives): Rename to ... (c_omp_directives): ... this. No longer static. Uncomment assume, assumes, begin assumes and end assumes entries. In end declare target entry rename PRAGMA_OMP_END_DECLARE_TARGET to PRAGMA_OMP_END. (c_omp_categorize_directive): Adjust for omp_directives to c_omp_directives renaming. gcc/c/ * c-lang.h (current_omp_begin_assumes): Declare. * c-parser.cc: Include bitmap.h. (c_parser_omp_end_declare_target): Rename to ... (c_parser_omp_end): ... this. Handle also end assumes. (c_parser_omp_begin, c_parser_omp_assumption_clauses, c_parser_omp_assumes, c_parser_omp_assume): New functions. (c_parser_translation_unit): Also diagnose #pragma omp begin assumes without corresponding #pragma omp end assumes. (c_parser_pragma): Use %s in may only be used at file scope diagnostics to decrease number of translatable messages. Handle PRAGMA_OMP_BEGIN and PRAGMA_OMP_ASSUMES. Handle PRAGMA_OMP_END rather than PRAGMA_OMP_END_DECLARE_TARGET and call c_parser_omp_end for it rather than c_parser_omp_end_declare_target. (c_parser_omp_construct): Handle PRAGMA_OMP_ASSUME. * c-decl.cc (current_omp_begin_assumes): Define. gcc/cp/ * cp-tree.h (struct omp_begin_assumes_data): New type. (struct saved_scope): Add omp_begin_assumes member. * parser.cc: Include bitmap.h. (cp_parser_omp_assumption_clauses, cp_parser_omp_assume, cp_parser_omp_assumes, cp_parser_omp_begin): New functions. (cp_parser_omp_end_declare_target): Rename to ... (cp_parser_omp_end): ... this. Handle also end assumes. (cp_parser_omp_construct): Handle PRAGMA_OMP_ASSUME. (cp_parser_pragma): Handle PRAGMA_OMP_ASSUME, PRAGMA_OMP_ASSUMES and PRAGMA_OMP_BEGIN. Handle PRAGMA_OMP_END rather than PRAGMA_OMP_END_DECLARE_TARGET and call cp_parser_omp_end for it rather than cp_parser_omp_end_declare_target. * pt.cc (apply_late_template_attributes): Also temporarily clear omp_begin_assumes. * semantics.cc (finish_translation_unit): Also diagnose #pragma omp begin assumes without corresponding #pragma omp end assumes. gcc/testsuite/ * c-c++-common/gomp/assume-1.c: New test. * c-c++-common/gomp/assume-2.c: New test. * c-c++-common/gomp/assume-3.c: New test. * c-c++-common/gomp/assumes-1.c: New test. * c-c++-common/gomp/assumes-2.c: New test. * c-c++-common/gomp/assumes-3.c: New test. * c-c++-common/gomp/assumes-4.c: New test. * c-c++-common/gomp/begin-assumes-1.c: New test. * c-c++-common/gomp/begin-assumes-2.c: New test. * c-c++-common/gomp/begin-assumes-3.c: New test. * c-c++-common/gomp/begin-assumes-4.c: New test. * c-c++-common/gomp/declare-target-6.c: New test. * g++.dg/gomp/attrs-1.C (bar): Add n1 and n2 arguments, add tests for assume directive. * g++.dg/gomp/attrs-2.C (bar): Likewise. * g++.dg/gomp/attrs-9.C: Add n1 and n2 variables, add tests for begin assumes directive. * g++.dg/gomp/attrs-15.C: New test. * g++.dg/gomp/attrs-16.C: New test. * g++.dg/gomp/attrs-17.C: New test. (cherry picked from commit 4790fe99f236c7f1b617722403e682ba2f82485f)
2022-09-27Daily bump.GCC Administrator1-1/+1
2022-09-26nvptx: Allow '--with-arch' to override the default '-misa'Thomas Schwinge6-6/+106
gcc/ * config.gcc (with_arch) [nvptx]: Allow '--with-arch' to override the default. * config/nvptx/gen-multilib-matches.sh: New. * config/nvptx/t-nvptx (MULTILIB_OPTIONS, MULTILIB_MATCHES) (MULTILIB_EXCEPTIONS): Handle this. * doc/install.texi (Specific) <nvptx-*-none>: Document this. * doc/invoke.texi (Nvidia PTX Options): Likewise. (cherry picked from commit e9019085e17554c209ca8531022f116b2d7f94fe)
2022-09-26nvptx: Introduce dummy multilib option for default '-misa=sm_30'Thomas Schwinge3-1/+29
... primarily in preparation for later changes. gcc/ * config.gcc (TM_MULTILIB_CONFIG) [nvptx]: Set to '$with_arch'. * config/nvptx/t-nvptx (MULTILIB_OPTIONS, MULTILIB_MATCHES) (MULTILIB_EXCEPTIONS): Handle it. (cherry picked from commit 4d94582e0dcbf5fed9d61213715bfff877bf5ecf)
2022-09-26nvptx: Make default '-misa=sm_30' explicitThomas Schwinge5-1/+36
... primarily in preparation for later changes. gcc/ * config.gcc (with_arch) [nvptx]: Set to 'sm_30'. * config/nvptx/nvptx.cc (nvptx_option_override): Assert that '-misa' appeared. * config/nvptx/nvptx.h (OPTION_DEFAULT_SPECS): Define. * config/nvptx/nvptx.opt (misa=): Remove 'Init'. (cherry picked from commit 108b99b6c45ed8fbad6776539a639244b63191f5)
2022-09-26nvptx: forward '-v' command-line option to assemblerThomas Schwinge2-0/+11
For example, for offloading compilation with '-save-temps -v', before vs. after word-diff then looks like: [...] [...]/build-gcc-offload-nvptx-none/gcc/as {+-v -v+} -o ./a.xnvptx-none.mkoffload.o ./a.xnvptx-none.mkoffload.s {+Verifying sm_30 code with sm_35 code generation.+} {+ ptxas -c -o /dev/null ./a.xnvptx-none.mkoffload.o --gpu-name sm_35 -O0+} [...] (This depends on <https://github.com/MentorEmbedded/nvptx-tools/pull/37> "Put '-v' verbose output onto stderr instead of stdout".) gcc/ * config/nvptx/nvptx.h (ASM_SPEC): Define. (cherry picked from commit 84072a2615ec1f5f35e994128a6dc22af5bf1322)
2022-09-26Daily bump.GCC Administrator1-1/+1
2022-09-25Daily bump.GCC Administrator1-1/+1
2022-09-24openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]Jakub Jelinek5-3/+51
The following testcase ICEs because with -O0 -fexceptions GOMP_taskgroup_end call isn't directly followed by GOMP_RETURN statement, but there are some conditionals to handle exceptions and we fail to find the correct GOMP_RETURN. The fix is to treat taskgroup similarly to target data, both of these constructs emit a try { body } finally { end_call } around the construct's body during gimplification and we need to see proper construct nesting during gimplification and omp lowering (including nesting of regions checks), but during omp expansion we don't really need their nesting anymore, all we need is emit something at the start of the region and the end of the region is the end API call we've already emitted during gimplification. For target data, we weren't adding GOMP_RETURN statement during omp lowering, so after that pass it is treated merely like stand-alone omp directives. This patch does the same for taskgroup too. 2022-09-24 Jakub Jelinek <jakub@redhat.com> PR c/107001 * omp-low.cc (lower_omp_taskgroup): Don't add GOMP_RETURN statement at the end. * omp-expand.cc (build_omp_regions_1): Clarify GF_OMP_TARGET_KIND_DATA is not stand-alone directive. For GIMPLE_OMP_TASKGROUP, also don't update parent. (omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset cur_region back after new_omp_region. * c-c++-common/gomp/pr107001.c: New test. (cherry picked from commit ad2aab5c816a6fd56b46210c0a4a4c6243da1de9)
2022-09-24openmp, c: Tighten up c_tree_equal [PR106981]Jakub Jelinek6-6/+64
This patch changes c_tree_equal to work more like cp_tree_equal, be more strict in what it accepts. The ICE on the first testcase was due to INTEGER_CST wi::wide (t1) == wi::wide (t2) comparison which ICEs if the two constants have different precision, but as the second testcase shows, being too lenient in it can also lead to miscompilation of valid OpenMP programs where we think certain expression is the same even when it isn't and can be guaranteed at runtime to represent different memory location. So, the patch looks through only NON_LVALUE_EXPRs and for constants as well as casts requires that the types match before actually comparing the constant values or recursing on the cast operands. 2022-09-24 Jakub Jelinek <jakub@redhat.com> PR c/106981 gcc/c/ * c-typeck.cc (c_tree_equal): Only strip NON_LVALUE_EXPRs at the start. For CONSTANT_CLASS_P or CASE_CONVERT: return false if t1 and t2 have different types. gcc/testsuite/ * c-c++-common/gomp/pr106981.c: New test. libgomp/ * testsuite/libgomp.c-c++-common/pr106981.c: New test. (cherry picked from commit 3c5bccb608c665ac3f62adb1817c42c845812428)
2022-09-24Daily bump.GCC Administrator1-1/+1
2022-09-23Come up with {,UN}LIKELY macros.Martin Liska2-0/+11
gcc/ChangeLog: * system.h (LIKELY): Define. (UNLIKELY): Likewise. (cherry picked from commit 22d9c8802add09a93308319fc37dd3a0f1125393, partial)
2022-09-23Merge branch 'releases/gcc-12' into devel/omp/gcc-12Tobias Burnus36-121/+544
Merge up to r12-8784-g126e207199077e80c958ce0adfed443df1fe8f29 (23rd Sep 2022)
2022-09-23Fortran: F2018 type(*),dimension(*) with scalars [PR104143]Tobias Burnus6-2/+62
Assumed-size dummy arguments accept arrays and array elements as actual arguments. There are also a few exceptions when real scalars are permitted. Since F2018, this includes scalar arguments to assumed-type dummies; while type(*) was added in TS29113, this change is only in F2018 itself. PR fortran/104143 gcc/fortran/ChangeLog: * interface.cc (compare_parameter): Permit scalar args to 'type(*), dimension(*)'. gcc/testsuite/ChangeLog: * gfortran.dg/c-interop/c407b-2.f90: Remove dg-error. * gfortran.dg/assumed_type_16.f90: New test. * gfortran.dg/assumed_type_17.f90: New test. (cherry picked from commit 59f6dea963b5f7a6b9ced325200359b4831e7fa7)
2022-09-23Daily bump.GCC Administrator4-1/+28
2022-09-22Update gcc fr.poJoseph Myers1-11/+8
* fr.po: Update.
2022-09-22Fortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]Harald Anlauf2-0/+9
gcc/fortran/ChangeLog: PR fortran/106986 * simplify.cc (gfc_simplify_findloc): Do not try to simplify intrinsic FINDLOC when the ARRAY argument has a NULL shape. gcc/testsuite/ChangeLog: PR fortran/106986 * gfortran.dg/pr106986.f90: New test. (cherry picked from commit 5976fbf9d5dd9542fcb82eebb2185886fd52d000)
2022-09-22i386: Add syscall to enable AMX for latest kernelsHaochen Jiang1-0/+30
gcc/testsuite/ChangeLog: * gcc.target/i386/amx-check.h (request_perm_xtile_data): New function to check if AMX is usable and enable AMX. (main): Run test if AMX is usable.
2022-09-22Daily bump.GCC Administrator3-1/+47
2022-09-21aarch64: Fix GTY markup for arm_sve.h [PR106491]Richard Sandiford1-4/+8
It turns out that GTY(()) markers in definitions like: GTY(()) tree scalar_types[NUM_VECTOR_TYPES]; are not effective and are silently ignored. The GTY(()) has to come after an extern or static. The externs associated with the SVE ACLE GTY variables are in aarch64-sve-builtins.h. This file is not in tm_include_list because we don't want every target-facing file to include it. It therefore isn't in the list of GC header files either. In this case that's a blessing in disguise, since the variables belong to a namespace and gengtype doesn't understand namespaces. I think the fix is instead to add an extra extern before each variable declaration, similarly to varasm.cc and vtable-verify.cc. (This works due to a "using namespace" at the end of the file.) gcc/ PR target/106491 * config/aarch64/aarch64-sve-builtins.cc (scalar_types) (acle_vector_types, acle_svpattern, acle_svprfop): Add GTY markup to (new) extern declarations instead of to the main definition. (cherry picked from commit 6bf5a704d36243c4c04b17a9408ebe881beb0051)
2022-09-20rs6000: Fix the check of bif argument number [PR104482]Kewen Lin2-30/+46
As PR104482 shown, it's one regression about the handlings when the argument number is more than the one of built-in function prototype. The new bif support only catches the case that the argument number is less than the one of function prototype, but it misses the case that the argument number is more than the one of function prototype. Because it uses "n != expected_args", n is updated in for (n = 0; !VOID_TYPE_P (TREE_VALUE (fnargs)) && n < nargs; fnargs = TREE_CHAIN (fnargs), n++) , it's restricted to be less than or equal to expected_args with the guard !VOID_TYPE_P (TREE_VALUE (fnargs)), so it's wrong. The fix is to use nargs instead, also move the checking hunk's location ahead to avoid useless further scanning when the counts mismatch. PR target/104482 gcc/ChangeLog: * config/rs6000/rs6000-c.cc (altivec_resolve_overloaded_builtin): Fix the equality check for argument number, and move this hunk ahead. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr104482.c: New test. (cherry picked from commit 38db48346cc045ed5656233c42d01d6d06bffc35)