aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
9 daysdiagnostics: introduce a "gcc/diagnostics" subdirectoryDavid Malcolm21-36/+37
The "gcc" subdirectory of our source tree currently contains a total of almost 1000 .cc and .h files, enough to hit rate-limiting in some git web UIs, and obscuring the logical relationships between subsystems. In r16-2211-ga5d9debedd2f46 I started introducing a "namespace diagnostics" so it makes sense to move such code into a new "gcc/diagnostics" subdirectory. My intent is for the "diagnostics" namespace/directory to contain shared parts of the diagnostics code that are in libcommon, in particular which don't have knowledge of trees. This patch begins moving of the existing code within "namespace diagnostics" into a new "gcc/diagnostics" subdirectory. No functional change intended. renamed: gcc/diagnostic-digraphs.cc -> gcc/diagnostics/digraphs.cc renamed: gcc/diagnostic-digraphs.h -> gcc/diagnostics/digraphs.h renamed: gcc/diagnostic-state-to-dot.cc -> gcc/diagnostics/state-graphs-to-dot.cc renamed: gcc/diagnostic-state-graphs.cc -> gcc/diagnostics/state-graphs.cc renamed: gcc/diagnostic-state-graphs.h -> gcc/diagnostics/state-graphs.h contrib/ChangeLog: * gcc.doxy (INPUT): Add gcc/diagnostics subdir. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Rename diagnostic-digraphs.o to diagnostics/digraphs.o. Rename diagnostic-state-graphs.o to diagnostics/state-graphs.o. Rename diagnostic-state-to-dot.o to diagnostics/state-graphs-to-dot.o. (PLUGIN_HEADERS): Add $(srcdir)/diagnostics/*.h. (install-plugin:): Likewise. * configure: Regenerate. * configure.ac (gccdepdir): Add "diagnostics" to directories. * diagnostic-format-html.cc: Update #includes for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h" and of move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". * diagnostic-format-sarif.cc: Likewise. * diagnostic-path.cc: Likewise for state-graphs.h * diagnostic-digraphs.cc: Move... * diagnostics/digraphs.cc: ...to here. Update #include for renaming of digraphs.h. (selftest::diagnostic_digraphs_cc_tests): Rename to... (selftest::diagnostics_digraphs_cc_tests): ...this. * diagnostic-digraphs.h: Move... * diagnostics/digraphs.h: ...to here, updating header guard. * diagnostic-state-to-dot.cc: Move... * diagnostics/state-graphs-to-dot.cc: ...to here. Update #include of state-graphs.h. * diagnostic-state-graphs.cc: Move... * diagnostics/state-graphs.cc: ...to here. Update #include of state-graphs.h. (selftest::diagnostic_state_graphs_cc_tests): Rename... (selftest::diagnostics_state_graphs_cc_tests): ...to this. * diagnostic-state-graphs.h: Move... * diagnostics/state-graphs.h: ...to here, updating header guard. * libgdiagnostics.cc: Update #includes for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h" and of move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". * selftest-run-tests.cc (selftest::run_tests): Update for function renamings that reflect file renamings. * selftest.h (selftest::diagnostic_digraphs_cc_tests): Rename to... (selftest::diagnostics_digraphs_cc_tests): ...this. (selftest::diagnostic_state_graphs_cc_tests): Rename... (selftest::diagnostics_state_graphs_cc_tests): ...to this. gcc/analyzer/ChangeLog: * ana-state-to-diagnostic-state.cc: Update #include for move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". * ana-state-to-diagnostic-state.h: Likewise. * checker-event.cc: Likewise. * checker-event.h: Update #include for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h". * program-state.cc: : Update #include for move of "diagnostic-state-graphs.h" to "diagnostics/state-graphs.h". gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Update #include for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
9 daysc++: more name lookup for non-dep rewritten cmp opsPatrick Palka3-25/+92
As a follow-up to r16-2448-g7590c14b53a762, this patch attempts to teach build_min_non_dep_op_overload how to rebuild all rewritten comparison operators, not just != -> == ones, so that we don't incorrectly repeat the unqualified name lookup at instantiation time. Note that changes how we mangle such comparison ops, in a way that is overall more consistent with how we've been mangling non-rewritten operators, see PR c++/121239. gcc/cp/ChangeLog: * call.cc (build_new_op): If the selected candidate is rewritten, communicate the LOOKUP_REWRITTEN/REVERSED flags to the caller via the 'overload' out-parameter, and stop clearing '*overload' in that case. * tree.cc (build_min_non_dep_op_overload): Handle rebuilding all C++20 rewritten comparison operator expressions. gcc/testsuite/ChangeLog: * g++.dg/lookup/operator-8.C: Remove XFAILs and properly suppress all -Wunused-result warnings. Reviewed-by: Jason Merrill <jason@redhat.com>
9 daysRemove now redundant vect_get_vec_defs overloadRichard Biener3-65/+36
The following removes the vect_get_vec_defs overload receiving a vector type to be used for the possibly constant/invariant operand. This was used for non-SLP code generation as there constants/invariants are generated on the fly. It also elides the stmt_vec_info and ncopies argument which are not required for SLP. * tree-vectorizer.h (vect_get_vec_defs): Remove overload with operand vector type. Remove stmt_vec_info and ncopies argument. * tree-vect-stmts.cc (vect_get_vec_defs): Likewise. (vectorizable_conversion): Adjust by not passing in vector types, stmt_vec_info and ncopies. (vectorizable_bswap): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_scan_store): Likewise. (vectorizable_store): Likewise. (vectorizable_condition): Likewise. (vectorizable_comparison_1): Likewise. * tree-vect-loop.cc (vect_transform_reduction): Likewise. (vect_transform_lc_phi): Likewise.
9 daysTidy vect_is_simple_use API for SLP onlyRichard Biener3-133/+57
The following removes one vect_is_simple_use overload that shouldn't be used anymore after removing the single remaining use related to gather handling in get_group_load_store_type. It also removes the dual-purpose of the overload getting both SLP node and stmt_vec_info and removes the latter argument. That leaves us with a SLP overload handling vector code and the stmt_info overload handling scalar code. In theory the former is only convenience and it should never fail given SLP build checks the constraint already, but there's the 'op' argument we have to get rid of first. * tree-vectorizer.h (vect_is_simple_use): Remove stmt-info with vectype output overload and remove stmt-info argument from SLP based API. * tree-vect-loop.cc (vectorizable_lane_reducing): Remove unused def_stmt_info output argument to vect_is_simple_use. Adjust. * tree-vect-stmts.cc (get_group_load_store_type): Get the gather/scatter offset vector type from the SLP child. (vect_check_scalar_mask): Remove stmt_info argument. Adjust. (vect_check_store_rhs): Likewise. (vectorizable_call): Likewise. (vectorizable_simd_clone_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_load): Likewise. (vect_is_simple_cond): Remove stmt_info argument. Adjust. (vectorizable_condition): Likewise. (vectorizable_comparison_1): Likewise. (vectorizable_store): Likewise. (vect_is_simple_use): Remove overload and non-SLP path.
9 daysFix and simplify vect_model_simple_costRichard Biener1-36/+13
There's no longer any call without SLP node so we don't need dts. I also figured based on the callers that some expect to cost more than one stmt but still N times so this changes what we cost. * tree-vect-stmts.cc (vect_model_simple_cost): Removed code when no SLP node is passed, remove then unused dt and ndts parameters and fix the number of vector stmts calculation. (vectorizable_call): Adjust. (vectorizable_simd_clone_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_condition): Likewise. (vectorizable_comparison_1): Likewise.
9 daysRISC-V: Prepare dynamic LMUL heuristic for SLP.Robin Dapp2-25/+62
This patch prepares the dynamic LMUL vector costing to use the coming SLP_TREE_TYPE instead of the (to-be-removed) STMT_VINFO_TYPE. Even though the whole approach should be reviewed and adjusted at some point, the patch chooses the path of least resistance and uses a hash map for the stmt_info -> slp node relationship. A node is mapped to the accompanying stmt_info during add_stmt_cost. In finish_cost we go through all statements as before, and obtain the corresponding slp nodes as well as their types. This allows us to operate largely as before. We don't yet do the switch over from STMT_VINFO_TYPE to SLP_TREE_TYPE, though but only take care of the necessary refactoring upfront. Regtested on rv64gcv_zvl512b with -mrvv-max-lmul=dynamic. There are a few regressions but nothing worse than what we already have. I'd rather accept these now and take it as an incentive to work on the heuristic later than block the SLP work until it is fixed. gcc/ChangeLog: * config/riscv/riscv-vector-costs.cc (get_live_range): Move compute_local_program_points to cost class. (variable_vectorized_p): Add slp node parameter. (need_additional_vector_vars_p): Move from here... (costs::need_additional_vector_vars_p): ... to here and add slp parameter. (compute_estimated_lmul): Move update_local_live_ranges to cost class. (has_unexpected_spills_p): Move from here... (costs::has_unexpected_spills_p): ... to here. (costs::record_lmul_spills): New function. (costs::add_stmt_cost): Add stmt_info, slp mapping. (costs::finish_cost): Analyze loop. * config/riscv/riscv-vector-costs.h: Move declarations to class.
9 dayslibstdc++: doc: Rectify referencing of non-existent typeTuur Martens1-4/+4
The unordered_map header incorrectly refers to a non-existent template parameter _Value in default template argument descriptions. They should refer to _Key instead. This patch fixes these descriptions to match the actual template parameters. libstdc++-v3/ChangeLog: * include/bits/unordered_map.h: Rectify referencing of non-existent type.
9 daysReduce the number of STMT_VINFO_VECTYPE usesRichard Biener3-28/+28
The following adjusts uses of STMT_VINFO_VECTYPE to look elsewhere where obvious. * tree-vect-loop.cc (vect_analyze_loop_2): Get vectype from the SLP node. (vectorize_fold_left_reduction): Likewise. (vect_transform_reduction): Likewise. (vect_transform_cycle_phi): Likewise. (vect_transform_lc_phi): Likewise. * tree-vect-slp.cc (vect_analyze_slp): Likewise. * tree-vect-stmts.cc (vect_truncate_gather_scatter_offset): Pass in vectype and use that. (vect_use_strided_gather_scatters_p): Likewise. (get_group_load_store_type): Adjust. (vect_check_scalar_mask): We always have a SLP node. Use vectype from the SLP node. (vect_check_store_rhs): Likewise. (vect_build_one_gather_load_call): Pass in the vector type and use that. (vect_get_strided_load_store_ops): Likewise. (vectorizable_store): Adjust. (vectorizable_load): Use the vector type from the SLP node and adjust.
9 daysRemove unused stmt_vectypeRichard Biener2-9/+0
The following removes an unused accessor to data that should go away. * target.h (stmt_vectype): Remove. * tree-vect-stmts.cc (stmt_vectype): Likewise.
9 daysc++, coroutines: Handle allocation fail returns [PR121219].Iain Sandoe2-14/+174
The current implementation was returning the result of the g_r_o_o_a_f call independently of the return expressions for 'normal' cases. This prevents the NVRO that we need to guarantee copy elision for the ramp return values - when these are initialised from a temporary of the same type. The solution here reorders the code so that the regular return expression appears before the allocation-failed case. Ensure that the g_r_o and associated code appears in a distinct scope. These steps are to meet the constaints of NRV. PR c++/121219 gcc/cp/ChangeLog: * coroutines.cc (cp_coroutine_transform::build_ramp_function): Reorder the return expressions for the 'normal' and 'allocation failed' cases so that NRV constraints are met. gcc/testsuite/ChangeLog: * g++.dg/coroutines/torture/pr121219.C: New test. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
9 daysRISC-V: Remove user-level interruptsChristoph Müllner6-36/+11
There was once a RISC-V extension draft ("N"), which introduced user-level interrupts. However, it was never ratified and the specification draft has been removed from the RISC-V ISA manual in commit `b6cade07034` with the comment "it'll likely need to be redesigned". Support for a N extension never made it to GCC, but we support fuction attributes for user-level interrupt handlers that use the URET instruction. The "user" interrupt attribute was documented in the RISC-V C API, but has been removed in PR #106 in May 2025 (driven by LLVM devs/ maintainers and ack'ed by at least one GCC maintainer). Let's drop URET support from GCC as well. gcc/ChangeLog: * config/riscv/riscv.cc (enum riscv_privilege_levels): Remove USER_MODE. (riscv_handle_type_attribute): Remove "user" interrupts. (riscv_expand_epilogue): Likewise. (riscv_get_interrupt_type): Likewise. * config/riscv/riscv.md (riscv_uret): Remove URET pattern. * doc/extend.texi: Remove documentation of user interrupts. gcc/testsuite/ChangeLog: * gcc.target/riscv/interrupt-conflict-mode.c: Remove "user" interrupts. * gcc.target/riscv/xtheadint-push-pop.c: Likewise. * gcc.target/riscv/interrupt-umode.c: Removed. Reported-by: Sam Elliott <quic_aelliott@quicinc.com> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
9 daysRemove STMT_VINFO_VEC_STMTSRichard Biener3-8/+1
The following removes the last uses of STMT_VINFO_VEC_STMTS and the vector itself. Vector stmts are recorded in SLP nodes now. The last use is a bit strange - it was introduced by Richard S. in r8-6064-ga57776a1136962 and affects only power7 and below (the re-align optimized load path). The check should have never been true since vect_vfa_access_size is only ever invoked before stmt transform. I have done the "conservative" change of making it always true now (so the code is now entered). I can as well remove it, but I wonder if you remember anything about this ... * tree-vectorizer.h (_stmt_vec_info::vec_stmts): Remove. (STMT_VINFO_VEC_STMTS): Likewise. * tree-vectorizer.cc (vec_info::new_stmt_vec_info): Do not initialize it. (vec_info::free_stmt_vec_info): Nor free it. * tree-vect-data-refs.cc (vect_vfa_access_size): Remove check on STMT_VINFO_VEC_STMTS.
9 daysRemove load interleaving codeRichard Biener3-665/+1
The following removes the non-SLP load interleaving code which was almost unused. * tree-vectorizer.h (vect_transform_grouped_load): Remove. (vect_record_grouped_load_vectors): Likewise. * tree-vect-data-refs.cc (vect_permute_load_chain): Likewise. (vect_shift_permute_load_chain): Likewise. (vect_transform_grouped_load): Likewise. (vect_record_grouped_load_vectors): Likewise. * tree-vect-stmts.cc (vectorizable_load): Remove comments about load interleaving.
9 daysRemove store interleaving supportRichard Biener3-234/+0
The following removes the non-SLP store interleaving support which was already almost unused. * tree-vectorizer.h (vect_permute_store_chain): Remove. * tree-vect-data-refs.cc (vect_permute_store_chain): Likewise. * tree-vect-stmts.cc (vectorizable_store): Remove comment about store interleaving.
9 daysRemove vect_get_vec_defs_for_operandRichard Biener2-134/+23
This removes vect_get_vec_defs_for_operand and its remaining uses. It also removes some remaining non-SLP paths in preparation to elide STMT_VINFO_VEC_STMTS. * tree-vectorizer.h (vect_get_vec_defs_for_operand): Remove. * tree-vect-stmts.cc (vect_get_vec_defs_for_operand): Likewise. (vect_get_vec_defs): Remove non-SLP path. (check_load_store_for_partial_vectors): We always have an SLP node. (vect_check_store_rhs): Likewise. (vect_get_gather_scatter_ops): Likewise. (vect_create_vectorized_demotion_stmts): Likewise. (vectorizable_store): Adjust. (vectorizable_load): Likewise.
9 daysRemove VMAT_CONTIGUOUS_PERMUTERichard Biener2-37/+5
This VMAT was used for interleaving which was non-SLP only. The following removes code gated by it (code selecting it is already gone). * tree-vectorizer.h (VMAT_CONTIGUOUS_PERMUTE): Remove. * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Remove checks on VMAT_CONTIGUOUS_PERMUTE. (vectorizable_load): Likewise. (vectorizable_store): Likewise. Prune dead code.
9 daysRemove dead code from vectorizable_storeRichard Biener1-33/+0
There's dead code in the else block of a if (!costing_p) block, after trivial pruning only setting of 'op' remains but that has no further uses downstream. I found this looking for remaining (must-be-dead) uses of vect_get_vec_defs_for_operand. * tree-vect-stmts.cc (vectorizable_store): Remove trivially dead code.
9 daysgcn: Add "s_nop"s for MI300Tobias Burnus4-137/+312
MI300 requires some additional s_nop to be added between some instructions. * As 'v_readlane' and 'v_writelane' have to be distinguished, the 'laneselect' attribute was changed from no/yes to no/read/write. * Add some missing 'laneselect' attributes for v_(read,write)lane. * Replace 'delayeduse' by 'flatmemaccess' which is more explicit, especially as some uses have to destinguished more details. (Alongside, one off-by-two delayeduse has been fixed.) On the other hand, RDNA 2, 3, and 3.5 do not require any added s_nop; thus, there is no need to walk the instructions for them to insert pointless S_NOP. (RDNA4 (not yet in GCC) requires it in a few cases.) gcc/ChangeLog: * config/gcn/gcn-opts.h (TARGET_NO_MANUAL_NOPS, TARGET_CDNA3_NOPS): Define. * config/gcn/gcn.md (define_attr "laneselect): Change 'yes' to 'read' and 'write'. (define_attr "flatmemaccess"): Add with values store, storex34, load, atomic, atomicwait, cmpswapx2, and no. Replacing ... (define_attr "delayeduse"): Remove. (define_attr "transop"): Add with values yes and no. (various insns): Update 'laneselect', add flatmemaccess and transop, remove delayeduse; fixing an issue for s_load_dwordx4 vs. flat_store_dwordx4 related to delayeduse (now: flatmemaccess). * config/gcn/gcn-valu.md: Update laneselect attribute and add flatmemaccess. * config/gcn/gcn.cc (gcn_cmpx_insn_p): New. (gcn_md_reorg): Update for MI300 to add additional s_nop. Skip s_nop-insertion part for RDNA{2,3}; add "VALU writes EXEC followed by VALU DPP" unconditionally for CDNA2/CDNA3/GCN5.
9 daysDetermine CONSTRAINT_LEN at run-time [PR121214]Stefan Schulze Frielinghaus1-137/+123
Tests gcc.dg/asm-hard-reg-error-{4,5}.c ICE on sparc*-sun-solaris2.11 since in tm-preds.h we end up with #define CONSTRAINT_LEN(c_,s_) 1 and, therefore, do not parse hard register constraints correctly. Hard register constraints are non-single character constraints and require insn_constraint_len() in order to determine the length. In write_tm_preds_h() from genpreds.cc, previously variable constraint_max_namelen was used in order to decide whether we have single or non-single character constraints. The distinction shouldn't be done anymore and we always must call into insn_constraint_len(). While being on it, remove guard constraint_max_namelen>0 since we always have some constraints coming from common.md. This leaves constraint_max_namelen without users so remove it. gcc/ChangeLog: PR middle-end/121214 * genpreds.cc (constraint_max_namelen): Delete. (write_tm_preds_h): Always write insn_constraint_len() and define CONSTRAINT_LEN to it, i.e., remove guard constraint_max_namelen>1. Remove outer guard constraint_max_namelen>0 and re-indent. (write_insn_preds_c): Remove guard constraint_max_namelen>0 and re-indent.
9 daysada: Minor cleanupMarc Poulhiès1-15/+16
Renamed local variables to make it easier to read. gcc/ada/ChangeLog: * gcc-interface/utils.cc (update_pointer_to): Renamed ptr/old_ptr, ref/old_ref.
9 daysada: ppc-vx6: pthread clocks and headers for declsAlexandre Oliva3-1/+17
VxWorks 6 lacks pthread_condattr_setclock, so define CLOCK_RT_Ada to CLOCK_REALTIME to use the dummy definition of __gnat_pthread_condattr_setup in libgnarl/thread.c. socket.c and sysdep.c use FD_ZERO, that relies on bzero on VxWorks 6. We need to include strings.h to get a declaration for bzero, but don't require strings.h to exist, since it's nonstandard. gcc/ada/ChangeLog: * s-oscons-tmplt.c (CLOCK_RT_Ada) [__vxworks]: Define to CLOCK_REALTIME on VxWorks6. * gsocket.h [__vxworks]: Include strings.h if available. * sysdep.c [__vxworks]: Likewise.
9 daysada: Follow up fixes.Steve Baird1-0/+21
Two follow-up fixes for the previous change for this issue. gcc/ada/ChangeLog: * exp_ch6.adb (Apply_Access_Discrims_Accessibility_Check): Do nothing and simply return if either Ada_Version <= Ada_95 or if the function being returned from lacks the extra formal parameter needed to perform the check (typically because the result is tagged).
9 daysada: Bug in Indefinite_Holders instance passed to formal packageBob Duff1-0/+6
Fix bug when an instance of Indefinite_Holders with a class-wide type is passed as a generic formal package; Program_Error was raised when dealing with the implicit "=" function. The fix is to disable legality checks in formal packages when the entity is an E_Subprogram_Body, because these are implicitly generated for class-wide predefined functions when passed to generics. gcc/ada/ChangeLog: * sem_ch12.adb (Check_Formal_Package_Instance): Do nothing in case of E_Subprogram_Body.
9 daysada: Update commentsRonan Desplanques1-8/+8
A previous patch changed the mechanism of early usage detection for discriminants but failed to update a couple of surrounding comments accordingly. This patch fixes this omission. gcc/ada/ChangeLog: * sem_ch3.adb (Process_Discriminants): Update comments
9 daysada: Fix regression of finalization primitive selectionRonan Desplanques1-0/+2
A recent patch introduced a new flag to mark the types for which looking up finalization primitives needs special handling. But there was one place in Build_Derived_Record_Type where the flag was not set when it should, which introduced a regression in some cases. This patch adds the missing setting of the flag. gcc/ada/ChangeLog: * sem_ch3.adb (Build_Derived_Record_Type): Set flag appropriately.
9 daysada: Fix inconsistencies in conversion functions from DurationEric Botcazou3-17/+42
The 3 units Ada.Calendar, GNAT.Calendar and GNAT.Sockets contain conversion functions from the Duration fixed-point type that implement the same idiom but with some inconsistencies: * GNAT.Sockets only handles Timeval_Duration, i.e. positive Duration, and is satisfactory, although a simpler implementation can be written, * GNAT.Calendar mishandles negative Duration values, as well as integral Duration values, * Ada.Calendar mishandles negative Duration values, and rounds nanoseconds instead of truncating them. gcc/ada/ChangeLog: * libgnat/a-calend.adb (To_Struct_Timespec_64): Deal with negative Duration values and truncate the nanoseconds too. * libgnat/g-calend.adb (timeval_to_duration): Unsuppress overflow checks. (duration_to_timeval): Likewise. Deal with negative Duration values as well as integral Duration values. * libgnat/g-socket.adb (To_Timeval): Simplify the implementation.
9 daysRISC-V: Add support for resumable non-maskable interrupt (RNMI) handlersChristoph Müllner4-6/+34
The Smrnmi extension introduces the nmret instruction to return from RNMI handlers. We already have basic Smrnmi support. This patch introduces support for the nmret instruction and the ability to set the function attribute `__attribute__ ((interrupt ("rnmi")))` to let the compiler generate RNMI handlers. The attribute name is proposed in a PR for the RISC C API and approved by LLVM maintainers: https://github.com/riscv-non-isa/riscv-c-api-doc/pull/116 gcc/ChangeLog: * config/riscv/riscv.cc (enum riscv_privilege_levels): Add RNMI_MODE. (riscv_handle_type_attribute): Handle 'rnmi' interrupt attribute. (riscv_expand_epilogue): Generate nmret for RNMI handlers. (riscv_get_interrupt_type): Handle 'rnmi' interrupt attribute. * config/riscv/riscv.md (riscv_rnmi): Add nmret INSN. * doc/extend.texi: Add documentation for 'rnmi' interrupt attribute. gcc/testsuite/ChangeLog: * gcc.target/riscv/interrupt-rnmi.c: New test. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
9 daysDaily bump.GCC Administrator7-1/+466
10 daysc++: Unwrap type traits defined in terms of builtins within diagnostics ↵Nathaniel Shead29-187/+860
[PR117294] Currently, concept failures of standard type traits just report 'expression X<T> evaluates to false'. However, many type traits are actually defined in terms of compiler builtins; we can do better here. For instance, 'is_constructible_v' could go on to explain why the type is not constructible, or 'is_invocable_v' could list potential candidates. Apart from concept diagnostics, this is also useful when using such traits in a 'static_assert' directly, so this patch also adjusts the diagnostics in that context. As a first step to supporting that we need to be able to map the standard type traits to the builtins that they use. Rather than adding another list that would need to be kept up-to-date whenever a builtin is added, this patch instead tries to detect any variable template defined directly in terms of a TRAIT_EXPR. This patch also adjusts 'diagnose_trait_expr' to provide more helpful diagnostics for these cases. Not all type traits have yet been updated, this patch just updates those that seem particularly valuable or straight-forward. The function also gets moved to cp/semantics.cc to be closer to 'trait_expr_value'. Various other parts of the compiler are also adjusted here to assist in making clear diagnostics, such as making more use of 'is_stub_object' to refer to a type directly rather than in terms of 'std::declval<T>()'. Additionally, since there are now more cases of nesting within a 'static_assert'ion I felt it was helpful for the experimental-nesting mode to nest here as well. PR c++/117294 PR c++/113854 gcc/cp/ChangeLog: * call.cc (implicit_conversion_error): Hide label when printing a stub object. (convert_like_internal): Likewise, and nest candidate diagnostics. * constexpr.cc (diagnose_failing_condition): Nest diagnostics, attempt to provide more helpful diagnostics for traits. * constraint.cc (satisfy_atom): Pass result before constant evaluation to diagnose_atomic_constraint. (diagnose_trait_expr): Adjust diagnostics for clarity and detail. (maybe_diagnose_standard_trait): New function. (diagnose_atomic_constraint): Attempt to provide more helpful diagnostics for more traits. * cp-tree.h (explain_not_noexcept): Declare new function. (is_trivially_xible): Add parameter. (is_nothrow_xible): Likewise. (is_xible): Likewise. (is_convertible): Likewise. (is_nothrow_convertible): Likewise. (diagnose_trait_expr): Declare new function. (maybe_diagnose_standard_trait): Declare new function. * error.cc (dump_type) <case TREE_VEC>: Handle trait types. * except.cc (explain_not_noexcept): New function. * method.cc (build_trait_object): Add complain parameter. (build_invoke): Propagate complain parameter. (assignable_expr): Add explain parameter to show diagnostics. (constructible_expr): Likewise. (destructible_expr): Likewise. (is_xible_helper): Replace trivial flag with explain flag, add diagnostics. (is_trivially_xible): New explain flag. (is_nothrow_xible): Likewise. (is_xible): Likewise. (is_convertible_helper): Add complain flag. (is_convertible): New explain flag. (is_nothrow_convertible): Likewise. * typeck.cc (cp_build_function_call_vec): Add handling for stub objects. (convert_arguments): Always return -1 on error. * typeck2.cc (cxx_readonly_error): Add handling for stub objects. libstdc++-v3/ChangeLog: * testsuite/20_util/any/misc/any_cast_neg.cc: Adjust diagnostics. * testsuite/20_util/expected/illformed_neg.cc: Likewise. * testsuite/20_util/optional/monadic/or_else_neg.cc: Likewise. * testsuite/23_containers/array/creation/3_neg.cc: Likewise. * testsuite/24_iterators/range_generators/lwg3900.cc: Likewise. * testsuite/29_atomics/atomic/requirements/types_neg.cc: Likewise. * testsuite/30_threads/stop_token/stop_callback/invocable_neg.cc: Likewise. * testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc: Likewise. * testsuite/std/format/arguments/args_neg.cc: Likewise. * testsuite/std/format/string_neg.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-traits3.C: Adjust diagnostics. * g++.dg/cpp2a/concepts-traits4.C: New test. * g++.dg/diagnostic/static_assert5.C: New test. * g++.dg/ext/has_virtual_destructor2.C: New test. * g++.dg/ext/is_assignable2.C: New test. * g++.dg/ext/is_constructible9.C: New test. * g++.dg/ext/is_convertible7.C: New test. * g++.dg/ext/is_destructible3.C: New test. * g++.dg/ext/is_invocable6.C: New test. * g++.dg/ext/is_virtual_base_of_diagnostic2.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Patrick Palka <ppalka@redhat.com> Reviewed-by: Jason Merrill <jason@redhat.com>
10 daysc++: one more PR114632 tweakJason Merrill1-5/+4
Patrick points out that after the PR114632 fix we can also rever the change that moved cp_evaluated higher in tsubst_lambda_expr. gcc/cp/ChangeLog: * pt.cc (tsubst_lambda_expr): Revert r9-5971 change.
10 daysc++: lambda convop in C++23 [PR114632]Jason Merrill4-8/+31
The lambda conversion was ICEing for two C++23 features, static op() and explicit object parameters. The issue with the former seems like a more general issue: tsubst_function_decl recursing to substitute the parameters was affected by cp_unevaluated_operand from the decltype that refers to the declaration. Various places already make a point of clearing cp_unevaluated_operand ahead of PARM_DECL tsubsting; doing it here makes the PR101233 fix redundant. For explicit object lambdas, we want to implement CWG2561 and just not declare the conversion. PR c++/114632 PR c++/101233 gcc/cp/ChangeLog: * lambda.cc (maybe_add_lambda_conv_op): Not for xobj lambda. * pt.cc (tsubst_function_decl): Add cp_evaluated. (alias_ctad_tweaks): Revert PR101233 fix. gcc/testsuite/ChangeLog: * g++.dg/cpp23/explicit-obj-lambda18.C: New test. * g++.dg/cpp23/static-operator-call7.C: New test.
10 dayscobol: Honor the "-static" command-line option. [PR119231]Robert Dubner3-6/+13
gcc/cobol/ChangeLog: PR cobol/119231 * gcobolspec.cc: (lang_specific_driver): Pass OPT_static through. Handle -static and -static-libgcobol properly. gcc/testsuite/ChangeLog: * cobol.dg/group2/_-static__compilation.cob: Modify for -static warning. * cobol.dg/group2/_-static__compilation.out: Removed.
10 daysRemove vec_stmt from vectorizable_* APIRichard Biener4-137/+107
The following removes the non-SLP gimple **vec_stmt argument from the vectorizable_* functions API. Checks on it can be replaced by an inverted check on the passed cost_vec vector pointer. * tree-vectorizer.h (vectorizable_induction): Remove gimple **vec_stmt argument. (vectorizable_phi): Likewise. (vectorizable_recurr): Likewise. (vectorizable_early_exit): Likewise. * tree-vect-loop.cc (vectorizable_phi): Likewise and adjust. (vectorizable_recurr): Likewise. (vectorizable_nonlinear_induction): Likewise. (vectorizable_induction): Likewise. * tree-vect-stmts.cc (vectorizable_bswap): Likewise. (vectorizable_call): Likewise. (vectorizable_simd_clone_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vectorizable_condition): Likewise. (vectorizable_comparison_1): Likewise. (vectorizable_comparison): Likewise. (vectorizable_early_exit): Likewise. (vect_analyze_stmt): Adjust. (vect_transform_stmt): Likewise. * tree-vect-slp.cc (vect_slp_analyze_operations): Adjust. (vectorize_slp_instance_root_stmt): Likewise.
10 daysFix minor typo in #ifdef docuementationAndrew Pinski1-1/+1
As reported in https://gcc.gnu.org/pipermail/gcc/2025-July/246417.html, This fixes the minor typo under the #ifdef documentation about adding MACRO after the #endif and the MACRO matching of the #ifdef. It had `#ifndef` in it, rather than `#ifdef`. Pushed as obvious. gcc/ChangeLog: * doc/cpp.texi (#ifdef): Correct typo. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
10 daysRemove non-SLP path from vectorizable_early_exitRichard Biener1-76/+11
This removes the non-SLP path from vectorizable_early_exit. * tree-vect-stmts.cc (vectorizable_early_exit): Remove non-SLP path.
10 daysRemove non-SLP path from vectorizable_simd_clone_callRichard Biener3-98/+28
This removes the non-SLP path from vectorizable_simd_clone_call and the then unused simd_clone_info from the stmt_vec_info structure. * tree-vectorizer.h (_stmt_vec_info::simd_clone_info): Remove. (STMT_VINFO_SIMD_CLONE_INFO): Likewise. * tree-vectorizer.cc (vec_info::free_stmt_vec_info): Do not release it. * tree-vect-stmts.cc (vectorizable_simd_clone_call): Remove non-SLP path.
10 dayslibstdc++: Cleaned up string_vector_iterators.cc test [PR104874]Tomasz Kamiński1-379/+146
Removed the wrong_stuff() function, which was effectively empty for actual test runs. Replaced the manual failure counter with the VERIFY macro to simplify identifying failures. PR libstdc++/104874 libstdc++-v3/ChangeLog: * testsuite/24_iterators/random_access/string_vector_iterators.cc: Reworked. Reviewed-by: Patrick Palka <ppalka@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
10 daysriscv: testsuite: Fix misalignment check.Robin Dapp1-1/+1
This fixes a thinko in the misalignment check. If we want to check for vector misalignment support we need to load 16-byte elements, not 8-byte elements that will never be misaligned. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Fix misalignment check.
10 daysvect: Misalign checks for gather/scatter.Robin Dapp8-124/+206
This patch adds simple misalignment checks for gather/scatter operations. Previously, we assumed that those perform element accesses internally so alignment does not matter. The riscv vector spec however explicitly states that vector operations are allowed to fault on element-misaligned accesses. Reasonable uarchs won't, but... For gather/scatter we have two paths in the vectorizer: (1) Regular analysis based on datarefs. Here we can also create strided loads. (2) Non-affine access where each gather index is relative to the initial address. The assumption this patch works on is that once the alignment for the first scalar is correct, all others will fall in line, as the index is always a multiple of the first element's size. For (1) we have a dataref and can check it for alignment as in other cases. For (2) this patch checks the object alignment of BASE and compares it against the natural alignment of the current vectype's unit. The patch also adds a pointer argument to the gather/scatter IFNs that contains the necessary alignment. Most of the patch is thus mechanical in that it merely adjusts indices. I tested the riscv version with a custom qemu version that faults on element-misaligned vector accesses. With this patch applied, there is just a single fault left, which is due to PR120782 and which will be addressed separately. Bootstrapped and regtested on x86 and aarch64. Regtested on rv64gcv_zvl512b with and without unaligned vector support. gcc/ChangeLog: * internal-fn.cc (internal_fn_len_index): Adjust indices for new alias_ptr param. (internal_fn_else_index): Ditto. (internal_fn_mask_index): Ditto. (internal_fn_stored_value_index): Ditto. (internal_fn_alias_ptr_index): Ditto. (internal_fn_offset_index): Ditto. (internal_fn_scale_index): Ditto. (internal_gather_scatter_fn_supported_p): Ditto. * internal-fn.h (internal_fn_alias_ptr_index): Ditto. * optabs-query.cc (supports_vec_gather_load_p): Ditto. * tree-vect-data-refs.cc (vect_check_gather_scatter): Add alias pointer. * tree-vect-patterns.cc (vect_recog_gather_scatter_pattern): Add alias pointer. * tree-vect-slp.cc (vect_get_operand_map): Adjust for alias pointer. * tree-vect-stmts.cc (vect_truncate_gather_scatter_offset): Add alias pointer and misalignment handling. (get_load_store_type): Move from here... (get_group_load_store_type): ...To here. (vectorizable_store): Add alias pointer. (vectorizable_load): Ditto. * tree-vectorizer.h (struct gather_scatter_info): Ditto.
10 daysvect: Add is_gather_scatter argument to misalignment hook.Robin Dapp13-30/+90
This patch adds an is_gather_scatter argument to the support_vector_misalignment hook. All targets but riscv do not care about alignment for gather/scatter so return true for is_gather_scatter. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_builtin_support_vector_misalignment): Return true for gather/scatter. * config/arm/arm.cc (arm_builtin_support_vector_misalignment): Ditto. * config/epiphany/epiphany.cc (epiphany_support_vector_misalignment): Ditto. * config/gcn/gcn.cc (gcn_vectorize_support_vector_misalignment): Ditto. * config/loongarch/loongarch.cc (loongarch_builtin_support_vector_misalignment): Ditto. * config/riscv/riscv.cc (riscv_support_vector_misalignment): Add gather/scatter argument. * config/rs6000/rs6000.cc (rs6000_builtin_support_vector_misalignment): Return true for gather/scatter. * config/s390/s390.cc (s390_support_vector_misalignment): Ditto. * doc/tm.texi: Add argument. * target.def: Ditto. * targhooks.cc (default_builtin_support_vector_misalignment): Ditto. * targhooks.h (default_builtin_support_vector_misalignment): Ditto. * tree-vect-data-refs.cc (vect_supportable_dr_alignment): Ditto.
10 daysvect: Add helper macros for gather/scatter.Robin Dapp3-15/+24
This encapsulates the IFN and the builtin-function way of handling gather/scatter via three defines: GATHER_SCATTER_IFN_P GATHER_SCATTER_LEGACY_P GATHER_SCATTER_EMULATED_P and introduces a helper define for SLP operand handling as well. gcc/ChangeLog: * tree-vect-slp.cc (GATHER_SCATTER_OFFSET): New define. (vect_get_and_check_slp_defs): Use. * tree-vectorizer.h (GATHER_SCATTER_LEGACY_P): New define. (GATHER_SCATTER_IFN_P): Ditto. (GATHER_SCATTER_EMULATED_P): Ditto. * tree-vect-stmts.cc (vectorizable_store): Use. (vectorizable_load): Use.
10 daysifn: Add helper functions for gather/scatter.Robin Dapp3-7/+58
This patch adds access helpers for the gather/scatter offset and scale parameters. gcc/ChangeLog: * internal-fn.cc (expand_scatter_store_optab_fn): Use new function. (expand_gather_load_optab_fn): Ditto. (internal_fn_offset_index): Ditto. (internal_fn_scale_index): Ditto. * internal-fn.h (internal_fn_offset_index): New function. (internal_fn_scale_index): Ditto. * tree-vect-data-refs.cc (vect_describe_gather_scatter_call): Use new function.
10 daysvect: remove cast to pointer for create_if in vect_create_data_ref_ptrAlfie Richards1-3/+2
Removes `fold_convert (aggr_ptr_type, iv_step)` when using create_iv. This was previously constructing statements like: ``` unsigned int _49; vector([4,4]) int * _50; sizetype _51; vector([4,4]) int * vectp_x.6; ... _50 = (vector([4,4]) int *) _49; _51 = (sizetype) _50; ... vectp_x.6_48 = vectp_x.6_47 + _51; ``` And instead creates: ``` unsigned int _49; sizetype _50; vector([4,4]) int * vectp_x.6; ... _50 = (sizetype) _49; ... vectp_x.6_48 = vectp_x.6_47 + _50; ``` As create_iv already has the logic to handle a pointer mode base and an integer mode var this seems a more natural expression of this. gcc/ChangeLog: * tree-vect-data-refs.cc (vect_create_data_ref_ptr): Remove unnecessary casts to aggr_ptr_type.
10 dayslibstdc++: Expand compile-time ranges tests for vector and basic_string.Tomasz Kamiński14-238/+111
This replaces most test_constexpr invocations with direct calls to test_ranges(), which is also used for runtime tests. SimpleAllocator was made constexpr to simplify this refactoring. Other test allocators, like uneq_allocator (used in from_range constructor tests), were not updated. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/cons/from_range.cc: Replace test_constexpr with test_ranges inside static_assert. * testsuite/21_strings/basic_string/modifiers/append/append_range.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/assign_range.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/insert/insert_range.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/replace/replace_with_range.cc: Likewise. * testsuite/23_containers/vector/bool/cons/from_range.cc: Likewise. * testsuite/23_containers/vector/bool/modifiers/assign/assign_range.cc: Likewise. * testsuite/23_containers/vector/bool/modifiers/insert/insert_range.cc: Likewise. * testsuite/23_containers/vector/cons/from_range.cc: Likewise. * testsuite/23_containers/vector/modifiers/assign/assign_range.cc: Likewise. * testsuite/23_containers/vector/modifiers/insert/insert_range.cc: Likewise. * testsuite/23_containers/vector/bool/modifiers/insert/append_range.cc: Run full test_ranges instead of span-only in test_constexpr. * testsuite/23_containers/vector/modifiers/append_range.cc: Replace test_constexpr with calls to test_ranges and test_overlapping. * testsuite/util/testsuite_allocator.h (__gnu_test::SimpleAllocator): Declared member functions as constexpr.
10 daysRemove non-SLP path from vectorizable_comparisonRichard Biener1-22/+6
This removes the non-SLP path from vectorizable_comparison. * tree-vect-stmts.cc (vectorizable_comparison_1): Remove non-SLP path. (vectorizable_comparison): Likewise.
10 daysRemove non-SLP path from vectorizable_conditionRichard Biener1-44/+21
The following removes the non-SLP paths from vectorizable_condition. * tree-vect-stmts.cc (vectorizable_condition): Remove non-SLP paths.
10 daysRemove non-SLP path from vectorizable_scan_storeRichard Biener1-32/+6
This removes the non-SLP paths from vectorizable_scan_store. * tree-vect-stmts.cc (vectorizable_scan_store): Remove non-SLP path and unused parameters. (vectorizable_store): Adjust.
10 daysRemove non-SLP path from vectorizable_shiftRichard Biener1-79/+44
This removes the non-SLP paths from vectorizable_shift. * tree-vect-stmts.cc (vectorizable_shift): Remove non-SLP paths.
10 daysRemove non-SLP path from vectorizable_assignmentRichard Biener1-23/+5
This removes the non-SLP paths from vectorizable_assignment * tree-vect-stmts.cc (vectorizable_assignment): Remove non-SLP paths.
10 daysRemove non-SLP path from vectorizable_callRichard Biener1-310/+131
This removes the non-SLP paths from vectorizable_call, propagates out ncopies == 1 and removes empty loops resulting from that. * tree-vect-stmts.cc (vectorizable_call): Remove non-SLP path.