aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-08-19Remove reduction chain detection from parloopsRichard Biener1-177/+0
Historically SLP reduction chains were the only multi-stmt reductions supported. But since we have check_reduction_path more complicated cases are handled. As parloops doesn't do any specific chain processing it can solely rely on that functionality instead. * tree-parloops.cc (parloops_is_slp_reduction): Remove. (parloops_is_simple_reduction): Do not call it.
2025-08-19A few missing SLP node passings to vector costingRichard Biener2-5/+6
The following fixes another few missed cases to pass a SLP node instead of a stmt_info. * tree-vect-loop.cc (vectorizable_reduction): Pass the appropriate SLP node for costing of single-def-use-cycle operations. (vectorizable_live_operation): Pass the SLP node to the costing hook. * tree-vect-stmts.cc (vectorizable_bswap): Likewise. (vectorizable_store): Likewise.
2025-08-19tree-optimization/121592 - failed reduction SLP discoveryRichard Biener1-0/+5
The testcase in the PR shows that when we have a reduction chain with a wrapped conversion we fail to properly fall back to a regular reduction, resulting in wrong-code. The following fixes this by failing discovery. The testcase has other issues, so I'm not including it here. PR tree-optimization/121592 * tree-vect-slp.cc (vect_analyze_slp): When SLP reduction chain discovery fails, fail overall when the tail of the chain isn't also the entry for the non-SLP reduction.
2025-08-19Fix riscv build, no longer works with python2Richard Biener1-1/+1
Building riscv no longer works with python2: > python ./config/riscv/arch-canonicalize -misa-spec=20191213 rv64gc File "./config/riscv/arch-canonicalize", line 229 print(f"ERROR: Unhandled conditional dependency: '{ext_name}' with condition:", file=sys.stderr) ^ SyntaxError: invalid syntax On systems that have python aliased to python2 we chose that, even when python3 is available. Don't. * config.gcc (riscv*-*-*): Look for python3, then fall back to python. Never use python2.
2025-08-19tree-optimization/121527 - wrong SRA with aggregate copyRichard Biener1-14/+6
SRA handles outermost VIEW_CONVERT_EXPRs but it wrongly ignores those when building an access which leads to the wrong size used when the VIEW_CONVERT_EXPR does not have the same size as its operand which is valid GENERIC and is used by Ada upcasting. PR tree-optimization/121527 * tree-sra.cc (build_access_from_expr_1): Do not strip an outer VIEW_CONVERT_EXPR as it's relevant for the size of the access. (get_access_for_expr): Likewise.
2025-08-19AArch64: Use vectype from SLP node instead of stmt_info [PR121536]Tamar Christina2-5/+20
commit g:1786be14e94bf1a7806b9dc09186f021737f0227 stops storing in STMT_VINFO_VECTYPE the vectype of the current stmt being vectorized and instead requires the use of SLP_TREE_VECTYPE for everything but data-refs. This means that STMT_VINFO_VECTYPE (stmt_info) will always be NULL and so aarch64_bool_compound_p will never properly cost predicate AND operations anymore resulting in less vectorization. This patch changes it to use SLP_TREE_VECTYPE and pass the slp_node to aarch64_bool_compound_p. gcc/ChangeLog: PR target/121536 * config/aarch64/aarch64.cc (aarch64_bool_compound_p): Use SLP_TREE_VECTYPE instead of STMT_VINFO_VECTYPE. (aarch64_adjust_stmt_cost, aarch64_vector_costs::count_ops): Pass SLP node to aarch64_bool_compound_p. gcc/testsuite/ChangeLog: PR target/121536 * g++.target/aarch64/sve/pr121536.cc: New test.
2025-08-19middle-end: Fix costing hooks of various vectorizable_* [PR121536]Tamar Christina1-6/+6
commit g:1786be14e94bf1a7806b9dc09186f021737f0227 stops storing in STMT_VINFO_VECTYPE the vectype of the current stmt being vectorized and instead requires the use of SLP_TREE_VECTYPE for everything but data-refs. However contrary to what the commit says not all usages of STMT_VINFO_VECTYPE have been purged from vectorizable_* as the costing hooks which don't pass the SLP tree as an agrument will extract vectype using STMT_VINFO_VECTYPE. This results in no vector type being passed to the backends and results in a few costing test failures in AArch64. This commit replaces the last few cases I could find, all except for in vectorizable_reduction when single_defuse_cycle where the stmt being costed is not the representative of the PHI in the SLP tree but rather the out of tree reduction statement. So I've left that alone, but it does mean vectype is NULL. Most likely this needs to use the overload where we pass an explicit vectype but I wasn't sure so left it for now. gcc/ChangeLog: PR target/121536 * tree-vect-loop.cc (vectorizable_phi, vectorizable_recurr, vectorizable_nonlinear_induction, vectorizable_induction): Pass slp_node instead of stmt_info to record_stmt_cost.
2025-08-19AArch64: Fix scalar costing after removal of vectype from mid-end [PR121536]Tamar Christina1-0/+11
commit g:fb59c5719c17a04ecfd58b5e566eccd6d2ac583a stops passing the scalar type (confusingly named vectype) to the costing hook when doing scalar costing. As a result, we could no longer distinguish between FPR and GPR scalar stmts. A later commit also removed STMT_VINFO_VECTYPE from stmt_info. This leaves the only remaining option to get the type of the original stmt in the stmt_info. This patch does this when we're performing scalar costing. Ideally I'd refactor this a bit because a lot of the hooks just need to know if it's FP or not, but this seems pointless with the ongoing costing churn. So for now this restores our costing. gcc/ChangeLog: PR target/121536 * config/aarch64/aarch64.cc (aarch64_vector_costs::add_stmt_cost): Set vectype from type of lhs of gimple stmt.
2025-08-19libstdc++: Restore call to test6642 in string_vector_iterators.cc test ↵Tomasz Kamiński1-0/+1
[PR104874] The test call was accidentally omitted in r16-2484-gdc49c0a46ec96e, a commit that refactored this test file. This patch adds it back. PR libstdc++/104874 libstdc++-v3/ChangeLog: * testsuite/24_iterators/random_access/string_vector_iterators.cc: Call test6642.
2025-08-19testsuite: Fix g++.dg/abi/mangle83.C [PR121578]Nathaniel Shead1-1/+1
This testcase (added in r16-3233-g7921bb4afcb7a3) mistakenly only required C++14, but auto template paramaters are a C++17 feature. PR c++/121578 gcc/testsuite/ChangeLog: * g++.dg/abi/mangle83.C: Requires C++17. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2025-08-19c++/modules: Fix exporting using-decls of unattached purview functions ↵Nathaniel Shead3-2/+26
[PR120195] We have logic to adjust a function decl if it gets re-declared as a using-decl with different purviewness, but we also need to do the same if it gets redeclared with different exportedness. PR c++/120195 gcc/cp/ChangeLog: * name-lookup.cc (do_nonmember_using_decl): Also handle change in exportedness of a function. gcc/testsuite/ChangeLog: * g++.dg/modules/using-32_a.C: New test. * g++.dg/modules/using-32_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2025-08-19testsuite: Fix PR108080 testcase for some targets [PR121396]Nathaniel Shead1-1/+1
I added a testcase for the (temporary) warning that we don't currently support the 'gnu::optimize' or 'gnu::target' attributes in r15-10183; however, some targets produce target nodes even when only an optimize attribute is present. This adjusts the warning. PR c++/108080 PR c++/121396 gcc/testsuite/ChangeLog: * g++.dg/modules/pr108080.H: Also allow target warnings. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2025-08-19Daily bump.GCC Administrator8-1/+249
2025-08-18docs: Fix __builtin_object_size example [PR121581]Andrew Pinski1-1/+2
This example used to work (with C) in GCC 14 before the warning for different pointer types without a cast was changed to an error. The fix is to make the q variable `int*` rather than the current `char*`. This also fixes the example for C++ too. Pushed as obvious after doing a `make html`. PR middle-end/121581 gcc/ChangeLog: * doc/extend.texi (__builtin_object_size): Fix example. Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-08-18opts: use sanitize_code_type for sanitizer flagsIndu Bhagat14-39/+75
Currently, the data type of sanitizer flags is unsigned int, with SANITIZE_SHADOW_CALL_STACK (1UL << 31) being highest individual enumerator for enum sanitize_code. Use 'sanitize_code_type' data type to allow for more distinct instrumentation modes be added when needed. gcc/ChangeLog: * flag-types.h (sanitize_code_type): Define. * asan.h (sanitize_flags_p): Use 'sanitize_code_type' instead of 'unsigned int'. * common.opt: Likewise. * dwarf2asm.cc (dw2_output_indirect_constant_1): Likewise. * opts.cc (find_sanitizer_argument): Likewise. (report_conflicting_sanitizer_options): Likewise. (parse_sanitizer_options): Likewise. (parse_no_sanitize_attribute): Likewise. * opts.h (parse_sanitizer_options): Likewise. (parse_no_sanitize_attribute): Likewise. * tree-cfg.cc (print_no_sanitize_attr_value): Likewise. * tree.cc (tree_fits_sanitize_code_type_p): Define. (tree_to_sanitize_code_type): Likewise. * tree.h (tree_fits_sanitize_code_type_p): Declare. (tree_to_sanitize_code_type): Likewise. gcc/c-family/ChangeLog: * c-attribs.cc (add_no_sanitize_value): Use 'sanitize_code_type' instead of 'unsigned int'. (handle_no_sanitize_attribute): Likewise. (handle_no_sanitize_address_attribute): Likewise. (handle_no_sanitize_thread_attribute): Likewise. (handle_no_address_safety_analysis_attribute): Likewise. * c-common.h (add_no_sanitize_value): Likewise. gcc/c/ChangeLog: * c-parser.cc (c_parser_declaration_or_fndef): Use 'sanitize_code_type' instead of 'unsigned int'. gcc/cp/ChangeLog: * typeck.cc (get_member_function_from_ptrfunc): Use 'sanitize_code_type' instead of 'unsigned int'. gcc/d/ChangeLog: * d-attribs.cc (d_handle_no_sanitize_attribute): Use 'sanitize_code_type' instead of 'unsigned int'. Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
2025-08-18aarch64: add new constants for MTE insnsIndu Bhagat1-4/+14
Define new constants to be used by the MTE pattern definitions. gcc/ * config/aarch64/aarch64.md (MEMTAG_TAG_MASK): New define constant. (MEMTAG_ADDR_MASK): Likewise. (irg, subp, ldg): Use new constants. Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
2025-08-18MAINTAINERS: Update my email addressSpencer Abson1-1/+1
ChangeLog: * MAINTAINERS: Update my email address. Signed-off-by: Spencer Abson <spencer.abson@student.manchester.ac.uk>
2025-08-18libstdc++: Add nodiscard attribute for ranges algorithm [PR121476]Tomasz Kamiński8-91/+108
This patch adds the [[nodiscard]] attribute to the operator() of ranges algorithm function objects if their std counterpart has it. Furthermore, we [[nodiscard]] the operator() of the following ranges algorithms that lack a std counterpart: * find_last, find_last_if, find_last_if_not (to match other find algorithms) * contains, contains_subrange (to match find/any_of and search) Finally, [[nodiscard]] is added to std::min and std::max overloads that accept std::initializer_list. This appears to be an oversight, as std::minmax is already marked, and other min overloads are as well. The same applies to corresponding operator() overloads of ranges::min and ranges::max. PR libstdc++/121476 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (__all_of_fn::operator()): (__any_of_fn::operator(), __none_of_fn::operator()) (__find_first_of_fn::operator(), __count_fn::operator()) (__find_end_fn::operator(), __remove_if_fn::operator()) (__remove_fn::operator(), __unique_fn::operator()) (__is_sorted_until_fn::operator(), __is_sorted_fn::operator()) (__lower_bound_fn::operator(), __upper_bound_fn::operator()) (__equal_range_fn::operator(), __binary_search_fn::operator()) (__is_partitioned_fn::operator(), __partition_point_fn::operator()) (__minmax_fn::operator(), __min_element_fn::operator()) (__includes_fn::operator(), __max_fn::operator()) (__lexicographical_compare_fn::operator(), __clamp__fn::operator()) (__find_last_fn::operator(), __find_last_if_fn::operator()) (__find_last_if_not_fn::operator()): Add [[nodiscard]] attribute. * include/bits/ranges_algobase.h (__equal_fn::operator()): Add [[nodiscard]] attribute. * include/bits/ranges_util.h (__find_fn::operator()) (__find_if_fn::operator(), __find_if_not_fn::operator()) (__mismatch_fn::operator(), __search_fn::operator()) (__min_fn::operator(), __adjacent_find_fn::operator()): Add [[nodiscard]] attribute. * include/bits/stl_algo.h (std::min(initializer_list<T>)) (std::min(initializer_list<T>, _Compare)) (std::max(initializer_list<T>)) (std::mmax(initializer_list<T>, _Compare)): Add _GLIBCXX_NODISCARD. * testsuite/25_algorithms/min/constrained.cc: Silence nodiscard warning. * testsuite/25_algorithms/max/constrained.cc: Likewise. * testsuite/25_algorithms/minmax/constrained.cc: Likewise. * testsuite/25_algorithms/minmax_element/constrained.cc: Likewise.
2025-08-18gcse: Fix handling of partial clobbers [PR97497]Richard Sandiford2-8/+71
This patch fixes an internal disagreement in gcse about how to handle partial clobbers. Like many passes, gcse doesn't track the modes of live values, so if a call clobbers only part of a register, the pass has to make conservative assumptions. As the comment in the patch says, this means: (1) ignoring partial clobbers when computing liveness and reaching definitions (2) treating partial clobbers as full clobbers when computing availability DF is mostly concerned with (1), so ignores partial clobbers. compute_hash_table_work did (2) when calculating kill sets, but compute_transp didn't do (2) when computing transparency. This led to a nonsensical situation of a register being in both the transparency and kill sets. gcc/ PR rtl-optimization/97497 * function-abi.h (predefined_function_abi::only_partial_reg_clobbers) (function_abi::only_partial_reg_clobbers): New member functions. * gcse-common.cc: Include regs.h and function-abi.h. (compute_transp): Check for partially call-clobbered registers and treat them as not being transparent in blocks with calls.
2025-08-18libstdc++: Fix-self element self-assigments when inserting an empty range ↵Tomasz Kamiński2-3/+56
[PR121313] For __n == 0, the elements were self move-assigned by std::move_backward(__ins, __old_finish - __n, __old_finish). PR libstdc++/121313 libstdc++-v3/ChangeLog: * include/bits/vector.tcc (vector::insert_range): Add check for empty size. * testsuite/23_containers/vector/modifiers/insert/insert_range.cc: New tests.
2025-08-18LoongArch: Implement 16-byte atomic add, sub, and, or, xor, and nand with sc.qXi Ruoyao1-6/+111
gcc/ChangeLog: * config/loongarch/sync.md (UNSPEC_TI_FETCH_ADD): New unspec. (UNSPEC_TI_FETCH_SUB): Likewise. (UNSPEC_TI_FETCH_AND): Likewise. (UNSPEC_TI_FETCH_XOR): Likewise. (UNSPEC_TI_FETCH_OR): Likewise. (UNSPEC_TI_FETCH_NAND_MASK_INVERTED): Likewise. (ALL_SC): New define_mode_iterator. (_scq): New define_mode_attr. (atomic_fetch_nand<mode>): Accept ALL_SC instead of only GPR. (UNSPEC_TI_FETCH_DIRECT): New define_int_iterator. (UNSPEC_TI_FETCH): New define_int_iterator. (amop_ti_fetch): New define_int_attr. (size_ti_fetch): New define_int_attr. (atomic_fetch_<amop_ti_fetch>ti_scq): New define_insn. (atomic_fetch_<amop_ti_fetch>ti): New define_expand.
2025-08-18LoongArch: Implement 16-byte atomic exchange with sc.qXi Ruoyao1-0/+35
gcc/ChangeLog: * config/loongarch/sync.md (atomic_exchangeti_scq): New define_insn. (atomic_exchangeti): New define_expand.
2025-08-18LoongArch: Implement 16-byte CAS with sc.qXi Ruoyao1-0/+89
gcc/ChangeLog: * config/loongarch/sync.md (atomic_compare_and_swapti_scq): New define_insn. (atomic_compare_and_swapti): New define_expand.
2025-08-18LoongArch: Implement 16-byte atomic store with sc.qXi Ruoyao2-1/+28
When LSX is not available but sc.q is (for example on LA664 where the SIMD unit is not enabled), we can use a LL-SC loop for 16-byte atomic store. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_print_operand_reloc): Accept "%t" for printing the number of the 64-bit machine register holding the upper half of a TImode. * config/loongarch/sync.md (atomic_storeti_scq): New define_insn. (atomic_storeti): expand to atomic_storeti_scq if !ISA_HAS_LSX.
2025-08-18LoongArch: Add -m[no-]scq optionXi Ruoyao8-5/+31
We'll use the sc.q instruction for some 16-byte atomic operations, but it's only added in LoongArch 1.1 evolution so we need to gate it with an option. gcc/ChangeLog: * config/loongarch/genopts/isa-evolution.in (scq): New evolution feature. * config/loongarch/loongarch-evolution.cc: Regenerate. * config/loongarch/loongarch-evolution.h: Regenerate. * config/loongarch/loongarch-str.h: Regenerate. * config/loongarch/loongarch.opt: Regenerate. * config/loongarch/loongarch.opt.urls: Regenerate. * config/loongarch/loongarch-def.cc: Make -mscq the default for -march=la664 and -march=la64v1.1. * doc/invoke.texi (LoongArch Options): Document -m[no-]scq.
2025-08-18LoongArch: Implement 16-byte atomic store with LSXXi Ruoyao1-0/+44
If the vector is naturally aligned, it cannot cross cache lines so the LSX store is guaranteed to be atomic. Thus we can use LSX to do the lock-free atomic store, instead of using a lock. gcc/ChangeLog: * config/loongarch/sync.md (atomic_storeti_lsx): New define_insn. (atomic_storeti): New define_expand.
2025-08-18LoongArch: Implement 16-byte atomic load with LSXXi Ruoyao1-0/+41
If the vector is naturally aligned, it cannot cross cache lines so the LSX load is guaranteed to be atomic. Thus we can use LSX to do the lock-free atomic load, instead of using a lock. gcc/ChangeLog: * config/loongarch/sync.md (atomic_loadti_lsx): New define_insn. (atomic_loadti): New define_expand.
2025-08-18LoongArch: Implement atomic_fetch_nand<GPR:mode>Xi Ruoyao1-0/+40
Without atomic_fetch_nandsi and atomic_fetch_nanddi, __atomic_fetch_nand is expanded to a loop containing a CAS in the body, and CAS itself is a LL-SC loop so we have a nested loop. This is obviously not a good idea as we just need one LL-SC loop in fact. As ~(atom & mask) is (~mask) | (~atom), we can just invert the mask first and the body of the LL-SC loop would be just one orn instruction. gcc/ChangeLog: * config/loongarch/sync.md (atomic_fetch_nand_mask_inverted<GPR:mode>): New define_insn. (atomic_fetch_nand<GPR:mode>): New define_expand.
2025-08-18LoongArch: Don't expand atomic_fetch_sub_{hi, qi} to LL-SC loop if -mlam-bhXi Ruoyao1-1/+1
With -mlam-bh, we should negate the addend first, and use an amadd instruction. Disabling the expander makes the compiler do it correctly. gcc/ChangeLog: * config/loongarch/sync.md (atomic_fetch_sub<SHORT:mode>): Disable if ISA_HAS_LAM_BH.
2025-08-18LoongArch: Implement subword atomic_fetch_{and, or, xor} with am*.w instructionsXi Ruoyao1-143/+34
We can just shift the mask and fill the other bits with 0 (for ior/xor) or 1 (for and), and use an am*.w instruction to perform the atomic operation, instead of using a LL-SC loop. gcc/ChangeLog: * config/loongarch/sync.md (UNSPEC_COMPARE_AND_SWAP_AND): Remove. (UNSPEC_COMPARE_AND_SWAP_XOR): Remove. (UNSPEC_COMPARE_AND_SWAP_OR): Remove. (atomic_test_and_set): Rename to ... (atomic_fetch_<any_bitwise:amop><SHORT:mode>): ... this, and adapt the expansion to use it for any bitwise operations and any val, instead of just ior 1. (atomic_test_and_set): New define_expand.
2025-08-18LoongArch: Remove unneeded "andi offset, addr, 3" instruction in ↵Xi Ruoyao1-5/+4
atomic_test_and_set On LoongArch sll.w and srl.w instructions only take the [4:0] bits of rk (shift amount) into account, and we've already defined SHIFT_COUNT_TRUNCATED to 1 so the compiler knows this fact, thus we don't need this instruction. gcc/ChangeLog: * config/loongarch/sync.md (atomic_test_and_set): Remove unneeded andi instruction from the expansion.
2025-08-18LoongArch: Remove unneeded "b 3f" instruction after LL-SC loopsXi Ruoyao2-13/+10
This instruction is used to skip an redundant barrier if -mno-ld-seq-sa or the memory model requires a barrier on failure. But with -mld-seq-sa and other memory models the barrier may be nonexisting at all, and we should remove the "b 3f" instruction as well. The implementation uses a new operand modifier "%T" to output a comment marker if the operand is a memory order for which the barrier won't be generated. "%T", and also "%t", are not really used before and the code for them in loongarch_print_operand_reloc is just some MIPS legacy. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_print_operand_reloc): Make "%T" output a comment marker if the operand is a memory order for which the barrier won't be generated; remove "%t". * config/loongarch/sync.md (atomic_cas_value_strong<mode>): Add %T before "b 3f". (atomic_cas_value_cmp_and_7_<mode>): Likewise.
2025-08-18LoongArch: Don't emit overly-restrictive barrier for LL-SC loopsXi Ruoyao1-12/+9
For LL-SC loops, if the atomic operation has succeeded, the SC instruction always imply a full barrier, so the barrier we manually inserted only needs to take the account for the failure memorder, not the success memorder (the barrier is skipped with "b 3f" on success anyway). Note that if we use the AMCAS instructions, we indeed need to consider both the success memorder an the failure memorder deciding if "_db" suffix is needed. Thus the semantics of atomic_cas_value_strong<mode> and atomic_cas_value_strong<mode>_amcas start to be different. To prevent the compiler from being too clever, use a different unspec code for AMCAS instructions. gcc/ChangeLog: * config/loongarch/sync.md (UNSPEC_COMPARE_AND_SWAP_AMCAS): New UNSPEC code. (atomic_cas_value_strong<mode>): NFC, update the comment to note we only need to consider failure memory order. (atomic_cas_value_strong<mode>_amcas): Use UNSPEC_COMPARE_AND_SWAP_AMCAS instead of UNSPEC_COMPARE_AND_SWAP. (atomic_compare_and_swap<mode:GPR>): Pass failure memorder to gen_atomic_cas_value_strong<mode>. (atomic_compare_and_swap<mode:SHORT>): Pass failure memorder to gen_atomic_cas_value_cmp_and_7_si.
2025-08-18LoongArch: Allow using bstrins for masking the address in atomic_test_and_setXi Ruoyao1-5/+6
We can use bstrins for masking the address here. As people are already working on LA32R (which lacks bstrins instructions), for future-proofing we check whether (const_int -4) is an and_operand and force it into an register if not. gcc/ChangeLog: * config/loongarch/sync.md (atomic_test_and_set): Use bstrins for masking the address if possible.
2025-08-18LoongArch: Don't use "+" for atomic_{load, store} "m" constraintXi Ruoyao1-2/+2
Atomic load does not modify the memory. Atomic store does not read the memory, thus we can use "=" instead. gcc/ChangeLog: * config/loongarch/sync.md (atomic_load<mode>): Remove "+" for the memory operand. (atomic_store<mode>): Use "=" instead of "+" for the memory operand.
2025-08-18LoongArch: (NFC) Remove amo and use size insteadXi Ruoyao1-28/+25
They are the same. gcc/ChangeLog: * config/loongarch/sync.md: Use <size> instead of <amo>. (amo): Remove.
2025-08-18LoongArch: (NFC) Remove atomic_optab and use amop insteadXi Ruoyao1-4/+2
They are the same. gcc/ChangeLog: * config/loongarch/sync.md (atomic_optab): Remove. (atomic_<atomic_optab><mode>): Change atomic_optab to amop. (atomic_fetch_<atomic_optab><mode>): Likewise.
2025-08-18Daily bump.GCC Administrator5-1/+109
2025-08-17[PR target/121213] Avoid unnecessary constant load in amoswapAustin Law2-4/+21
PR 121213 shows an unnecessary "li target,0" in an atomic exchange loop on RISC-V. The source operand for an amoswap instruction should allow (const_int 0) in addition to GPRs. So the operand's predicate is changed to "reg_or_0_operand". The corresponding constraint is also changed to allow a reg or the constant 0. With the source operand no longer tied to the destination operand we do not need the earlyclobber for the destination, so the destination operand's constraint is adjusted accordingly. This patch does not address the unnecessary sign extension reported in the PR. Tested with no regressions on riscv32-elf and riscv64-elf. PR target/121213 gcc/ * config/riscv/sync.md (amo_atomic_exchange<mode>): Allow (const_int 0) as input operand. Do not tie input to output. No longer earlyclobber the output. gcc/testsuite * gcc.target/riscv/amo/pr121213.c: New test.
2025-08-17Add test for spill failuredragan.mladjenovic1-0/+10
Adding the float-agnostic reproducer as test-case. gcc/testsuite/ * gcc.target/mips/tls-1.c: New file.
2025-08-17Testsuite: Use HAS_LDC instead of a specific ISAMatthew Fortune1-1/+1
The call-clobbered-1.c test has both reasons to be above a certain ISA and below a certain ISA level. The option based ISA min/max code only triggers if there is no isa level request. gcc/testsuite/ * gcc.target/mips/call-clobbered-1.c: Use HAS_LDC ghost option instead of isa>=2.
2025-08-17Testsuite: Fix tests properly for compact-branchesAndrew Bennett4-20/+20
Compact-branches use the balc opcode, this patch adjusts the testsuite to handle that correctly. gcc/testsuite * gcc.target/mips/near-far-1.c: Fix tests properly for compact-branches (jals and balc). * gcc.target/mips/near-far-2.c: Likewise. * gcc.target/mips/near-far-3.c: Likewise. * gcc.target/mips/near-far-4.c: Likewise.
2025-08-17Testsuite: Adjust tests to cope with -mips16Jeff Law10-182/+183
Various tests are missing NOMIPS16 markers or can be safely skipped via -mno-mips16. Adjust them appropriately. gcc/testsuite/ * gcc.target/mips/call-clobbered-2.c: Add a NOMIPS16 attribute. * gcc.target/mips/call-clobbered-3.c: Likewise. * gcc.target/mips/call-clobbered-5.c: Likewise. * gcc.target/mips/ds-schedule-2.c: Add an -mno-mips16 option. * gcc.target/mips/interrupt_handler-bug-1.c: Same as call-clobbered-*.c tests. * gcc.target/mips/movdf-1.c: Likewise. * gcc.target/mips/movdf-2.c: Likewise. * gcc.target/mips/movdf-3.c: Likewise. * gcc.target/mips/msa-builtins.c: Same as ds-schedule-2.c. Remove a NOMIPS16 attribute from builtins. * gcc.target/mips/msa.c: Likewise.
2025-08-17Testsuite: Fix insn-*.c tests from trunkMatthew Fortune2-6/+6
Ensure micromips test does not get confused about library support. Ensure insn-casesi.c and insn-tablejump.c can be executed. Move the micromips/mips16 selection into the file as per function attributes so that there is no requirement on having a full micromips or mips16 runtime to execute the test. gcc/testsuite/ * gcc.target/mips/insn-casesi.c: Require mips16 support but not the command line option. * gcc.target/mips/insn-tablejump.c: Force o32 ABI as we do not really support n32/n64 microMIPS. Require micromips support but not the command line option.
2025-08-17regrename: treat writes as reads for fused instruction pairsArtemiy Volkov1-1/+9
Consider the following (RISC-V) instruction pair: mul s6,a1,a2 add s6,a4,s6 Without this patch, while handling the second instruction, (a) the existing chain for s6 will first be closed (upon the terminate_write action for the input operand), then (b) a new one will be opened (upon the mark_write action for the output operand). This will likely lead to the two output operands being different physical registers, breaking the single-output property required for some macro-op fusion pairs. This patch, using the single_output_fused_pair_p () predicate introduced earlier, changes the regrename behavior for such pairs to append the input and the output operands to the existing chain (as if both actions were mark_read), instead of breaking the current renaming chain and starting a new one. This ensures that the output operands of both fused instructions are kept in the same hard register, and that the single-output property of the insn pair is preserved. gcc/ChangeLog: * regrename.cc (scan_rtx_reg): Handle fused insn pairs.
2025-08-17[PR target/109324] H8/300: Fix genrecog warnings about operands missing modes.Jan Dubiec3-20/+20
This patch fixes genrecog warnings about operands missing modes. This is done by explicitly specifying modes of operations. PR target/109324 gcc/ChangeLog: * config/h8300/addsub.md: Explicitly specify mode for plus operation. * config/h8300/jumpcall.md: Explicitly specify modes for eq and match_operand operations. * config/h8300/testcompare.md: Explicitly specify modes for eq, ltu and compare operations.
2025-08-17MAINTAINERS, contrib: Appease check-MAINTAINERS.py (email order)Filip Kastl2-3/+3
The contrib/check-MAINTAINERS.py script sorts by surname, name, bugzilla handle and email (in this order). Document this. Switch around Andrew Pinski's entries in Contributing under DCO. Pushing as obvious. ChangeLog: * MAINTAINERS: Switch around Andrew Pinski's entries in Contributing under DCO. contrib/ChangeLog: * check-MAINTAINERS.py: Document the way the script sorts entries. Signed-off-by: Filip Kastl <fkastl@suse.cz>
2025-08-16ira: tie output allocnos for fused instruction pairsArtemiy Volkov3-2/+31
Some of the instruction pairs recognized as fusible by a preceding invocation of the dep_fusion pass require that both components of a pair have the same hard register output for the fusion to work in hardware. (An example of this would be a multiply-add operation, or a zero-extract operation composed of two shifts.) For all such pairs, the following conditions will hold: (a) Both insns are single_sets (b) Both insns have a register destination (c) The pair has been marked as fusible by setting the second insn's SCHED_GROUP flag (d) Additionally, post-RA, both instructions' destination regnos are equal (All of these conditions are encapsulated in the newly created single_output_fused_pair_p () predicate.) During IRA, if conditions (a)-(c) above hold, we need to tie the two instructions' destination allocnos together so that they are allocated to the same hard register. We do this in add_insn_allocno_copies () by adding a constraint conflict to the output operands of the two instructions. gcc/ChangeLog: * ira-conflicts.cc (add_insn_allocno_copies): Handle fused insn pairs. * rtl.h (single_output_fused_pair_p): Declare new function. * rtlanal.cc (single_output_fused_pair_p): Define it.
2025-08-16[PATCH] RISC-V: Fix block matching in arch-canonicalize [PR121538]Dimitar Dimitrov1-2/+20
Commit r16-3028-g0c517ddf9b136c introduced parsing of conditional blocks in riscv-ext*.def. For simplicity, it used a simple regular expression to match the C++ lambda function for each condition. But the regular expression is too simple - it matches only the first scoped code block, without any trailing closing braces. The "c" dependency for the "zca" extension has two code blocks inside its conditional. One for RV32 and one for RV64. The script matches only the RV32 block, and leaves the RV64 one. Any strings left, in turn, are considered a list of non-conditional extensions. Thus the quoted strings "d" and "zcd" from that block are taken as "simple" (non-conditional) dependencies: if (subset_list->xlen () == 64) { if (subset_list->lookup ("d")) return subset_list->lookup ("zcd"); As a result, arch-canonicalize erroneously adds "d" extension: $ ./config/riscv/arch-canonicalize rv32ec rv32efdc_zicsr_zca_zcd_zcf Before r16-3028-g0c517ddf9b136c the command returned: $ ./config/riscv/arch-canonicalize rv32ec rv32ec Fix by extending the conditional block match until the number of opening and closing braces is equal. This change might seem crude, but it does save us from introducing a full C++ parser into the simple arch-canonicalize python script. With this patch the script now returns: $ ./config/riscv/arch-canonicalize rv32ec rv32ec_zca Ok for trunk? PR target/121538 gcc/ChangeLog: * config/riscv/arch-canonicalize (parse_dep_exts): Match condition block up to closing brace. (test_parse_long_condition_block): New test.
2025-08-16x86: Add target("80387") function attributeH.J. Lu9-0/+78
Add target("80387") attribute to enable and disable x87 instructions in a function. gcc/ PR target/121541 * config/i386/i386-options.cc (ix86_valid_target_attribute_inner_p): Add target("80387") attribute. Set the mask bit in opts_set->x_target_flags if the mask bit in opts->x_target_flags is updated. * doc/extend.texi: Document target("80387") function attribute. gcc/testsuite/ PR target/121541 * gcc.target/i386/pr121541-1a.c: New test. * gcc.target/i386/pr121541-1b.c: Likewise. * gcc.target/i386/pr121541-2.c: Likewise. * gcc.target/i386/pr121541-3.c: Likewise. * gcc.target/i386/pr121541-4.c: Likewise. * gcc.target/i386/pr121541-5a.c: Likewise. * gcc.target/i386/pr121541-5b.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>