aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-10-08Fortran: Fix ICE and wrong code for assumed-rank arrays [PR100029, PR100040]José Rui Faustino de Sousa3-21/+85
gcc/fortran/ChangeLog: PR fortran/100040 PR fortran/100029 * trans-expr.cc (gfc_conv_class_to_class): Add code to have assumed-rank arrays recognized as full arrays and fix the type of the array assignment. (gfc_conv_procedure_call): Change order of code blocks such that the free of ALLOCATABLE dummy arguments with INTENT(OUT) occurs first. gcc/testsuite/ChangeLog: PR fortran/100029 * gfortran.dg/PR100029.f90: New test. PR fortran/100040 * gfortran.dg/PR100040.f90: New test. (cherry picked from commit 5299155bb80e90df822e1eebc9f9a0c8e4505a46)
2022-10-08Daily bump.GCC Administrator1-1/+1
2022-10-07Daily bump.GCC Administrator1-1/+1
2022-10-06Daily bump.GCC Administrator1-1/+1
2022-10-06Reverted: c-c++-common/gomp/map-6.c: Fix dg-error due to mapping changesTobias Burnus2-2/+9
Revert commit a24748da5b48f23ac83fa9f2d128f766e80567ed that was added to OG11 as dg-error fix for the cherry-pick of "Fortran/OpenMP: Add support for 'close' in map clause" r12-944-gcdcec2f8505ea12c2236cf0184d77dd2f5de4832 2022-10-06 Tobias Burnus <tobias@codesourcery.com> Revert: 2021-05-14 Tobias Burnus <tobias@codesourcery.com> * c-c++-common/gomp/map-6.c: Remove two dg-error.
2022-10-06gfortran.dg/gomp/{depend-5,scope-6}.f90: Update scan-tree-dumpTobias Burnus3-6/+20
gcc/testsuite/ * gfortran.dg/gomp/depend-5.f90: Update scan-tree-dump. * gfortran.dg/gomp/scope-6.f90: Likewise.
2022-10-05Fix dg- pattern for gomp/{affinity-clause-1.f90,uses_allocators-3.f90}Tobias Burnus2-3/+5
gcc/testsuite/ * gfortran.dg/gomp/affinity-clause-1.f90: Update pattern for different array-reference handling in OG12. * gfortran.dg/gomp/uses_allocators-3.f90: Fix dg-error string.
2022-10-05Fortran: Add OpenMP's assume(s) directivesTobias Burnus17-8/+717
libgomp/ChangeLog: * libgomp.texi (OpenMP 5.1 Impl. Status): Mark 'assume' as 'Y'. gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_omp_assumes): New. (show_omp_clauses, show_namespace): Call it. (show_omp_node, show_code_node): Handle OpenMP ASSUME. * gfortran.h (enum gfc_statement): Add ST_OMP_ASSUME, ST_OMP_END_ASSUME, ST_OMP_ASSUMES and ST_NOTHING. (gfc_exec_op): Add EXEC_OMP_ASSUME. (gfc_omp_assumptions): New struct. (gfc_get_omp_assumptions): New XCNEW #define. (gfc_omp_clauses, gfc_namespace): Add assume member. (gfc_resolve_omp_assumptions): New prototype. * match.h (gfc_match_omp_assume, gfc_match_omp_assumes): New. * openmp.cc (omp_code_to_statement): Forward declare. (enum gfc_omp_directive_kind, struct gfc_omp_directive): New. (gfc_free_omp_clauses): Free assume member and its struct data. (enum omp_mask2): Add OMP_CLAUSE_ASSUMPTIONS. (gfc_omp_absent_contains_clause): New. (gfc_match_omp_clauses): Call it; optionally use passed omp_clauses argument. (omp_verify_merge_absent_contains, gfc_match_omp_assume, gfc_match_omp_assumes, gfc_resolve_omp_assumptions): New. (resolve_omp_clauses): Call the latter. (gfc_resolve_omp_directive, omp_code_to_statement): Handle EXEC_OMP_ASSUME. * parse.cc (decode_omp_directive): Parse OpenMP ASSUME(S). (next_statement, parse_executable, parse_omp_structured_block): Handle ST_OMP_ASSUME. (case_omp_decl): Add ST_OMP_ASSUMES. (gfc_ascii_statement): Handle Assumes, optional return string without '!$OMP '/'!$ACC ' prefix. * parse.h (gfc_ascii_statement): Add optional bool arg to prototype. * resolve.cc (gfc_resolve_blocks, gfc_resolve_code): Add EXEC_OMP_ASSUME. (gfc_resolve): Resolve ASSUMES directive. * symbol.cc (gfc_free_namespace): Free omp_assumes member. * st.cc (gfc_free_statement): Handle EXEC_OMP_ASSUME. * trans-openmp.cc (gfc_trans_omp_directive): Likewise. * trans.cc (trans_code): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/assume-1.f90: New test. * gfortran.dg/gomp/assume-2.f90: New test. * gfortran.dg/gomp/assumes-1.f90: New test. * gfortran.dg/gomp/assumes-2.f90: New test. (cherry picked from commit e2a228438919d846995bf2c839c9b657442224b2)
2022-10-05OpenMP: Update invoke.texi and fix fortran/parse.cc for -fopenmp-simdTobias Burnus6-7/+57
Split off from the 'Fortran: Add OpenMP's assume(s) directives' patch. gcc/ * doc/invoke.texi (-fopenmp): Mention C++ attribut syntax. (-fopenmp-simd): Likewise; update permitted directives. gcc/fortran/ * parse.cc (decode_omp_directive): Handle '(end) loop' and 'scan' also with -fopenmp-simd. gcc/testsuite/ * gfortran.dg/gomp/openmp-simd-7.f90: New test. (cherry picked from commit 8792047470073df0da4a5b91997d6058193d7676)
2022-10-05install.texi: gcn - update llvm reqirements, gcn/nvptx - newlib use versionTobias Burnus2-5/+35
gcc/ * doc/install.texi (Specific): Add missing items to bullet list. (amdgcn): Update LLVM requirements, use version not date for newlib. (nvptx): Use version not git hash for newlib. (cherry picked from commit e886ebd17965d78f609b62479f4f48085108389c)
2022-10-05Daily bump.GCC Administrator1-1/+1
2022-10-04Daily bump.GCC Administrator3-1/+15
2022-10-04openmp: Add begin declare target supportJakub Jelinek21-74/+420
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 Burnus6-27/+77
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 Administrator5-1/+99
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 Burnus9-25/+85
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-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-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 Jelinek4-6/+37
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)