aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-06-25c++: decltype of capture proxy of ref [PR115504]Patrick Palka2-1/+22
The finish_decltype_type capture proxy handling added in r14-5330 was incorrectly stripping references in the type of the captured variable. PR c++/115504 gcc/cp/ChangeLog: * semantics.cc (finish_decltype_type): Don't strip the reference type (if any) of a capture proxy's captured variable. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/decltype-auto8.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-06-25[PATCH 09/11] Handle arrays for CodeViewMark Harmstone2-0/+180
Translates DW_TAG_array_type DIEs into LF_ARRAY symbols. gcc/ * dwarf2codeview.cc (struct codeview_custom_type): Add lf_array to union. (write_lf_array): New function. (write_custom_types): Call write_lf_array. (get_type_num_array_type): New function. (get_type_num): Handle DW_TAG_array_type DIEs. * dwarf2codeview.h (LF_ARRAY): Define.
2024-06-25[PATCH 08/11] Handle unions for CodeView.Mark Harmstone2-6/+86
Translates DW_TAG_union_type DIEs into LF_UNION symbols. gcc/ * dwarf2codeview.cc (write_lf_union): New function. (write_custom_types): Call write_lf_union. (add_struct_forward_def): Handle DW_TAG_union_type DIEs. (get_type_num_struct): Handle unions. (get_type_num): Handle DW_TAG_union_type DIEs. * dwarf2codeview.h (LF_UNION): Define.
2024-06-25libstdc++: Simplify std::valarray initialization helpersJonathan Wakely1-79/+18
Dispatching to partial specializations doesn't really seem to offer much benefit here. The __is_trivial(T) condition is a compile-time constant so the untaken branches are dead code and don't cost us anything. libstdc++-v3/ChangeLog: * include/bits/valarray_array.h (_Array_default_ctor): Remove. (__valarray_default_construct): Inline it into here. (_Array_init_ctor): Remove. (__valarray_fill_construct): Inline it into here. (_Array_copy_ctor): Remove. (__valarray_copy_construct(const T*, const T*, T*)): Inline it into here. (__valarray_copy_construct(const T*, size_t, size_t, T*)): Use _GLIBCXX17_CONSTEXPR for constant condition.
2024-06-25modula2: tidyup remove unused procedures and unused parametersGaius Mulley2-113/+16
This patch removes M2GenGCC.mod:QuadCondition and M2Quads.mod:GenQuadOTypeUniquetok. It also removes unused parameter WalkAction for all FoldIf procedures. gcc/m2/ChangeLog: * gm2-compiler/M2GenGCC.mod (QuadCondition): Remove. (FoldIfEqu): Remove WalkAction parameter. (FoldIfNotEqu): Ditto. (FoldIfGreEqu): Ditto. (FoldIfLessEqu): Ditto. (FoldIfGre): Ditto. (FoldIfLess): Ditto. (FoldIfIn): Ditto. (FoldIfNotIn): Ditto. * gm2-compiler/M2Quads.mod (GenQuadOTypeUniquetok): Remove. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-06-25libstdc++: Replace viewcvs links in docs with cgit linksJonathan Wakely7-19/+19
libstdc++-v3/ChangeLog: * doc/xml/faq.xml: Replace viewcvs links with cgit links. * doc/xml/manual/allocator.xml: Likewise. * doc/xml/manual/mt_allocator.xml: Likewise. * doc/html/*: Regenerate.
2024-06-25c++: ICE with __has_unique_object_representations [PR115476]Marek Polacek2-1/+17
Here we started to ICE with r13-25: in check_trait_type, for "X[]" we return true here: if (kind == 1 && TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)) return true; // Array of unknown bound. Don't care about completeness. and then end up crashing in record_has_unique_obj_representations: 4836 if (cur != wi::to_offset (sz)) because sz is null. https://eel.is/c++draft/type.traits#tab:meta.unary.prop-row-47-column-3-sentence-1 says that the preconditions for __has_unique_object_representations are: "T shall be a complete type, cv void, or an array of unknown bound" and that "For an array type T, the same result as has_unique_object_representations_v<remove_all_extents_t<T>>" so T[] should be treated as T. So we should use kind==2 for the trait. PR c++/115476 gcc/cp/ChangeLog: * semantics.cc (finish_trait_expr) <case CPTK_HAS_UNIQUE_OBJ_REPRESENTATIONS>: Move below to call check_trait_type with kind==2. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/has-unique-obj-representations4.C: New test.
2024-06-25[PATCH v2 3/3] RISC-V: cmpmem for RISCV with V extensionSergei Lewis8-2/+377
So this is the cmpmem patch from Sergei, updated for the trunk. Updates included adjusting the existing cmpmemsi expander to conditionally try expansion via vector. And a minor testsuite adjustment to turn off vector expansion in one test that is primarily focused on vset optimization and ensuring we don't have extras. I've spun this in my tester successfully and just want to see a clean run through precommit CI before moving forward. Jeff gcc/ChangeLog: * config/riscv/riscv-protos.h (riscv_vector::expand_vec_cmpmem): New function declaration. * config/riscv/riscv-string.cc (riscv_vector::expand_vec_cmpmem): New function. * config/riscv/riscv.md (cmpmemsi): Try riscv_vector::expand_vec_cmpmem for constant lengths. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/cmpmem-1.c: New codegen tests * gcc.target/riscv/rvv/base/cmpmem-2.c: New execution tests * gcc.target/riscv/rvv/base/cmpmem-3.c: New codegen tests * gcc.target/riscv/rvv/base/cmpmem-4.c: New codegen tests * gcc.target/riscv/rvv/autovec/vls/misalign-1.c: Turn off vector mem* and str* handling.
2024-06-25PR modula2/115540 gcc/m2/mc-boot-ch/Gtermios.cc error return-statement with ↵Gaius Mulley3-3/+3
a value This patch fixes three occurrences of cfmakeraw use in the hand built m2 support libraries which incorrectly attempt to return a void result. gcc/m2/ChangeLog: PR modula2/115540 * gm2-libs-ch/termios.c (cfmakeraw): Remove return. * mc-boot-ch/Gtermios.cc (cfmakeraw): Remove return. * pge-boot/Gtermios.cc (cfmakeraw): Remove return. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-06-25Add param for bb limit to invoke fast_vrp.Andrew MacLeod3-2/+19
If the basic block count is too high, simply use fast_vrp for all VRP passes. * doc/invoke.texi (vrp-block-limit): Document. * params.opt (param=vrp-block-limit): New. * tree-vrp.cc (fvrp_folder::execute): Invoke fast_vrp if block count exceeds limit.
2024-06-25c++: ICE with generic lambda and pack expansion [PR115425]Marek Polacek2-0/+27
In r13-272 we hardened the *_PACK_EXPANSION and *_ARGUMENT_PACK macros. That trips up here because make_pack_expansion returns error_mark_node and we access that with PACK_EXPANSION_LOCAL_P. PR c++/115425 gcc/cp/ChangeLog: * pt.cc (tsubst_pack_expansion): Return error_mark_node if make_pack_expansion doesn't work out. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-generic12.C: New test.
2024-06-25c++: ICE with __dynamic_cast redecl [PR115501]Marek Polacek2-0/+17
Since r13-3299, build_dynamic_cast_1 calls pushdecl which calls duplicate_decls and that in this testcase emits the "conflicting declaration" error and returns error_mark_node, so the subsequent build_cxx_call crashes on the error_mark_node. PR c++/115501 gcc/cp/ChangeLog: * rtti.cc (build_dynamic_cast_1): Return if dcast_fn is erroneous. gcc/testsuite/ChangeLog: * g++.dg/rtti/dyncast8.C: New test.
2024-06-25ira: Scale save/restore costs of callee save registers with block frequencySurya Kumari Jangala2-1/+20
In assign_hard_reg(), when computing the costs of the hard registers, the cost of saving/restoring a callee-save hard register in prolog/epilog is taken into consideration. However, this cost is not scaled with the entry block frequency. Without scaling, the cost of saving/restoring is quite small and this can result in a callee-save register being chosen by assign_hard_reg() even though there are free caller-save registers available. Assigning a callee save register to a pseudo that is live in the entire function and across a call will cause shrink wrap to fail. 2024-06-25 Surya Kumari Jangala <jskumari@linux.ibm.com> gcc/ PR rtl-optimization/111673 * ira-color.cc (assign_hard_reg): Scale save/restore costs of callee save registers with block frequency. gcc/testsuite/ PR rtl-optimization/111673 * gcc.target/powerpc/pr111673.c: New test.
2024-06-25PR modula2/115536 Expression is evaluated incorrectly when encountering ↵Gaius Mulley21-392/+677
relops and indirection This fix ensures that we only call BuildRelOpFromBoolean if we are inside a constant expression (where no indirection can be used). The fix creates a temporary variable when a boolean is created from a relop in other cases. The previous pattern implementation would not work if the operands required dereferencing during non const expressions. Comparison of relop results in a constant expression are resolved by constant propagation, basic block analysis and dead code removal. After the quadruples have been optimized only one assignment to the boolean variable will remain for const expressions. All quadruple pattern checking for boolean expressions is removed by the patch. Thus the implementation becomes more generic. gcc/m2/ChangeLog: PR modula2/115536 * gm2-compiler/M2BasicBlock.def (GetBasicBlockScope): New procedure. (GetBasicBlockStart): Ditto. (GetBasicBlockEnd): Ditto. (IsBasicBlockFirst): New procedure function. * gm2-compiler/M2BasicBlock.mod (ConvertQuads2BasicBlock): Allow conditional boolean quads to be removed. (GetBasicBlockScope): Implement new procedure. (GetBasicBlockStart): Ditto. (GetBasicBlockEnd): Ditto. (IsBasicBlockFirst): Implement new procedure function. * gm2-compiler/M2GCCDeclare.def (FoldConstants): New parameter declaration. * gm2-compiler/M2GCCDeclare.mod (FoldConstants): New parameter declaration. (DeclareTypesConstantsProceduresInRange): Recreate basic blocks after resolving constant expressions. (CodeBecomes): Guard IsVariableSSA with IsVar. * gm2-compiler/M2GenGCC.def (ResolveConstantExpressions): New parameter declaration. * gm2-compiler/M2GenGCC.mod (FoldIfLess): Remove relop pattern detection. (FoldIfGre): Ditto. (FoldIfLessEqu): Ditto. (FoldIfGreEqu): Ditto. (FoldIfIn): Ditto. (FoldIfNotIn): Ditto. (FoldIfEqu): Ditto. (FoldIfNotEqu): Ditto. (FoldBecomes): Add BasicBlock parameter and allow conditional boolean becomes to be folded in the first basic block. (ResolveConstantExpressions): Reimplement. * gm2-compiler/M2Quads.def (IsConstQuad): New procedure function. (IsConditionalBooleanQuad): Ditto. * gm2-compiler/M2Quads.mod (IsConstQuad): Implement new procedure function. (IsConditionalBooleanQuad): Ditto. (MoveWithMode): Use GenQuadOTypetok. (IsInitialisingConst): Rewrite using OpUsesOp1. (OpUsesOp1): New procedure function. (doBuildAssignment): Mark des as a VarConditional. (ConvertBooleanToVariable): Call PutVarConditional. (DumpQuadSummary): New procedure. (BuildRelOpFromBoolean): Updated debugging and improved comments. (BuildRelOp): Only call BuildRelOpFromBoolean if we are in a const expression and both operands are boolean relops. (GenQuadOTypeUniquetok): New procedure. (BackPatch): Correct comment. * gm2-compiler/SymbolTable.def (PutVarConditional): New procedure. (IsVarConditional): New procedure function. * gm2-compiler/SymbolTable.mod (PutVarConditional): Implement new procedure. (IsVarConditional): Implement new procedure function. (SymConstVar): New field IsConditional. (SymVar): New field IsConditional. (MakeVar): Initialize IsConditional field. (MakeConstVar): Initialize IsConditional field. * gm2-compiler/M2Swig.mod (DoBasicBlock): Change parameters to use BasicBlock. * gm2-compiler/M2Code.mod (SecondDeclareAndOptimize): Use iterator to FoldConstants over basic block list. * gm2-compiler/M2SymInit.mod (AppendEntry): Replace parameters with BasicBlock. * gm2-compiler/P3Build.bnf (Relation): Call RecordOp for #, <> and =. gcc/testsuite/ChangeLog: PR modula2/115536 * gm2/iso/const/pass/constbool4.mod: New test. * gm2/iso/const/pass/constbool5.mod: New test. * gm2/iso/run/pass/condtest2.mod: New test. * gm2/iso/run/pass/condtest3.mod: New test. * gm2/iso/run/pass/condtest4.mod: New test. * gm2/iso/run/pass/condtest5.mod: New test. * gm2/iso/run/pass/constbool4.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-06-25[committed] Fix fr30-elf newlib build failure with late-combineJeff Law3-22/+20
So the late combine work has exposed a latent bug in the fr30 port. The fr30 "call" instruction is pc-relative with a *very* limited range, 12 bits to be precise. With such a limited range its hard to see how we could ever consistently use it in the compiler, with the possible exception of self-recursion. Even for a call to a locally binding function -ffunction-sections and linker placement of functions may separate the caller/callee. Code generation seemed to be using indirect forms pretty consistently, though the RTL would allow direct calls. With late-combine some of those indirects would be optimized into direct calls. This naturally led to out of range scenarios. With the fr30 port slated for removal unless it gets updated to use LRA and the fundamental problems using direct calls, I took the shortest path to keep things working -- namely forcing all calls to be indirect. Tested in my tester with no regressions (and fixes the newlib build failure with late-combine enabled). Pushed to the trunk. gcc/ * config/fr30/constraints.md (Q): Remove unused constraint. * config/fr30/predicates.md (call_operand): Remove unused predicate. * config/fr30/fr30.md (call, vall_value): Turn into expanders and force the call address into a register. (*call, *call_value): Adjust to only allow indirect calls. Adjust output template accordingly.
2024-06-25late-combine: Honor targetm.cannot_copy_insn_pRichard Sandiford1-0/+12
late-combine was failing to take targetm.cannot_copy_insn_p into account, which led to multiple definitions of PIC symbols on arm*-*-* targets. gcc/ * late-combine.cc (insn_combination::substitute_nondebug_use): Reject second and subsequent uses if targetm.cannot_copy_insn_p disallows copying.
2024-06-25c++: alias CTAD and copy deduction guide [PR115198]Patrick Palka2-1/+19
Here we're neglecting to update DECL_NAME during the alias CTAD guide transformation, which causes copy_guide_p to return false for the transformed copy deduction guide since DECL_NAME is still __dguide_C with TREE_TYPE C<B, T> but it should be __dguide_A with TREE_TYPE A<T> (i.e. C<false, T>). This ultimately results in ambiguity during overload resolution between the copy deduction guide vs copy ctor guide. This patch makes us update DECL_NAME of a transformed guide accordingly during alias/inherited CTAD. PR c++/115198 gcc/cp/ChangeLog: * pt.cc (alias_ctad_tweaks): Update DECL_NAME of the transformed guides. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-alias22.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-06-25c++: using non-dep array var of unknown bound [PR115358]Patrick Palka4-14/+16
For a non-dependent array variable of unknown bound, it seems we need to try instantiating its definition upon use in a template context for sake of proper checking and typing of the overall expression, like we do for function specializations with deduced return type. PR c++/115358 gcc/cp/ChangeLog: * decl2.cc (mark_used): Call maybe_instantiate_decl for an array variable with unknown bound. * semantics.cc (finish_decltype_type): Remove now redundant handling of array variables with unknown bound. * typeck.cc (cxx_sizeof_expr): Likewise. gcc/testsuite/ChangeLog: * g++.dg/template/array37.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-06-25Fix PR c/115587, uninitialized variable in c_parser_omp_loop_nestSandra Loosemore2-9/+3
This function had a reference to an uninitialized variable on the error path. The problem was diagnosed by clang but not gcc. It seems the cleanest solution is to initialize all the loop-clause variables at the point of declaration rather than at different places in the code. The C++ front end didn't have this problem, but I've made similar changes there to keep the code in sync. gcc/c/ChangeLog: PR c/115587 * c-parser.cc (c_parser_omp_loop_nest): Move initializations to point of declaration. gcc/cp/ChangeLog: PR c/115587 * parser.cc (cp_parser_omp_loop_nest): Move initializations to point of declaration.
2024-06-25GORI cleanupsRichard Biener1-6/+2
The following replaces conditional is_export_p calls as is_export_p handles a NULL bb itself. * gimple-range-gori.cc (gori_compute::may_recompute_p): Call is_export_p with NULL bb.
2024-06-25doc: gccint: Fix typos in jump_table_data descriptionXi Ruoyao1-2/+2
gcc/ChangeLog: * doc/rtl.texi (jump_table_data): Fix typos.
2024-06-25Add a debug counter for late-combineRichard Sandiford2-0/+7
This should help to diagnose problems like PR115631. gcc/ * dbgcnt.def (late_combine): New debug counter. * late-combine.cc (insn_combination::run): Use it.
2024-06-25libatomic: Add rcpc3 128-bit atomic operations for AArch64Victor Do Nascimento2-6/+74
The introduction of the optional RCPC3 architectural extension for Armv8.2-A upwards provides additional support for the release consistency model, introducing the Load-Acquire RCpc Pair Ordered, and Store-Release Pair Ordered operations in the form of LDIAPP and STILP. These operations are single-copy atomic on cores which also implement LSE2 and, as such, support for these operations is added to Libatomic and employed accordingly when the LSE2 and RCPC3 features are detected in a given core at runtime. libatomic/ChangeLog: * config/linux/aarch64/atomic_16.S (libat_load_16): Add LRCPC3 variant. (libat_store_16): Likewise. * config/linux/aarch64/host-config.h (HWCAP2_LRCPC3): New. (LSE2_LRCPC3_ATOP): Previously LSE2_ATOP. New ifuncs guarded under it. (has_rcpc3): New.
2024-06-25SPARC: fix internal error with -mv8plus on 64-bit LinuxEric Botcazou1-1/+1
This passes -m32 when -mv8plus is specified on Linux (like on Solaris). gcc/ PR target/115608 * config/sparc/linux64.h (CC1_SPEC): Pass -m32 for -mv8plus.
2024-06-25rs6000: Properly default-disable late-combine passes [PR106594, PR115622, ↵Thomas Schwinge1-8/+8
PR115633] ..., so that it also works for '__attribute__ ((optimize("[...]")))' etc. PR target/106594 PR target/115622 PR target/115633 gcc/ * config/rs6000/rs6000.cc (rs6000_option_override_internal): Move default-disable of late-combine passes from here... (rs6000_override_options_after_change): ... to here.
2024-06-25Revert one of the force_subreg changesRichard Sandiford1-1/+7
One of the changes in g:d4047da6a070175aae7121c739d1cad6b08ff4b2 caused a regression in ft32-elf; see: https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655418.html for details. This change was different from the others in that the original call was to simplify_subreg rather than simplify_lowpart_subreg. The old code would therefore go on to do the force_reg for more cases than the new code would. gcc/ * expmed.cc (store_bit_field_using_insv): Revert earlier change to use force_subreg instead of simplify_gen_subreg.
2024-06-25MIPS: Implement vcond_mask optabs for MSAYunQiang Su3-9/+28
Currently, we have `mips_expand_vec_cond_expr`, which calculate cmp_res first. We can just add a new extra argument to ask it to use operands[3] as cmp_res instead of calculating from operands[4] and operands[5]. gcc * config/mips/mips.cc(mips_expand_vec_cond_expr): Add extra argument to info that opernads[3] is cmp_res already. * config/mips/mips-protos.h(mips_expand_vec_cond_expr): Ditto. * config/mips/mips-msa.md(vcond_mask): Define new expand. (vcondu): Use mips_expand_vec_cond_expr with 4th argument. (vcond): Ditto.
2024-06-25MIPS: Output $0 for conditional trap if !ISA_HAS_COND_TRAPIYunQiang Su1-1/+1
MIPSr6 removes condition trap instructions with imm, so the instruction like `teq $2,imm` will be converted to li $at, imm teq $2, $at The current version of Gas cannot detect if imm is zero, and output teq $2, $0 Let's do it in GCC. gcc * config/mips/mips.md(conditional_trap_reg): Output $0 instead of 0 if !ISA_HAS_COND_TRAPI.
2024-06-25aarch64: Add DLL import/export to AArch64 targetEvgeny Karpov3-3/+53
This patch reuses the MinGW implementation to enable DLL import/export functionality for the aarch64-w64-mingw32 target. It also modifies environment configurations for MinGW. 2024-06-08 Evgeny Karpov <Evgeny.Karpov@microsoft.com> gcc/ChangeLog: * config.gcc: Add winnt-dll.o, which contains the DLL import/export implementation. * config/aarch64/aarch64.cc (aarch64_load_symref_appropriately): Add dllimport implementation. (aarch64_expand_call): Likewise. (aarch64_legitimize_address): Likewise. * config/aarch64/cygming.h (SYMBOL_FLAG_DLLIMPORT): Modify MinGW environment to support DLL import/export. (SYMBOL_FLAG_DLLEXPORT): Likewise. (SYMBOL_REF_DLLIMPORT_P): Likewise. (SYMBOL_FLAG_STUBVAR): Likewise. (SYMBOL_REF_STUBVAR_P): Likewise. (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise. (TARGET_ASM_FILE_END): Likewise. (SUB_TARGET_RECORD_STUB): Likewise. (GOT_ALIAS_SET): Likewise. (PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED): Likewise. (HAVE_64BIT_POINTERS): Likewise.
2024-06-25Adjust DLL import/export implementation for AArch64Evgeny Karpov3-2/+7
The DLL import/export mingw implementation, originally from ix86, requires minor adjustments to be compatible with AArch64. 2024-06-08 Evgeny Karpov <Evgeny.Karpov@microsoft.com> gcc/ChangeLog: * config/i386/cygming.h (PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED): Declare whether an external declaration should be legitimized. (HAVE_64BIT_POINTERS): Define whether the target supports 64-bit pointers. * config/mingw/mingw32.h (defined): Use the correct DllMainCRTStartup entry function. * config/mingw/winnt-dll.cc (defined): Exclude ix86-related code.
2024-06-25aarch64: Add selectany attribute handlingEvgeny Karpov2-1/+7
This patch extends the aarch64 attributes list with the selectany attribute for the aarch64-w64-mingw32 target and reuses the mingw implementation to handle it. 2024-06-08 Evgeny Karpov <Evgeny.Karpov@microsoft.com> gcc/ChangeLog: * config/aarch64/aarch64.cc: Extend the aarch64 attributes list. * config/aarch64/cygming.h (SUBTARGET_ATTRIBUTE_TABLE): Define the selectany attribute.
2024-06-25Rename functions for reuse in AArch64Evgeny Karpov4-11/+12
This patch renames functions related to dllimport/dllexport and selectany functionality. These functions will be reused in the aarch64-w64-mingw32 target. 2024-06-08 Evgeny Karpov <Evgeny.Karpov@microsoft.com> gcc/ChangeLog: * config/i386/cygming.h (mingw_pe_record_stub): Rename functions in mingw folder which will be reused for aarch64. (TARGET_ASM_FILE_END): Update to new target-independent name. (SUBTARGET_ATTRIBUTE_TABLE): Likewise. (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise. (SUB_TARGET_RECORD_STUB): Likewise. * config/i386/i386-protos.h (ix86_handle_selectany_attribute): Likewise. (mingw_handle_selectany_attribute): Likewise. (i386_pe_valid_dllimport_attribute_p): Likewise. (mingw_pe_valid_dllimport_attribute_p): Likewise. (i386_pe_file_end): Likewise. (mingw_pe_file_end): Likewise. (i386_pe_record_stub): Likewise. (mingw_pe_record_stub): Likewise. * config/mingw/winnt.cc (ix86_handle_selectany_attribute): Likewise. (mingw_handle_selectany_attribute): Likewise. (i386_pe_valid_dllimport_attribute_p): Likewise. (mingw_pe_valid_dllimport_attribute_p): Likewise. (i386_pe_record_stub): Likewise. (mingw_pe_record_stub): Likewise. (i386_pe_file_end): Likewise. (mingw_pe_file_end): Likewise. * config/mingw/winnt.h (mingw_handle_selectany_attribute): Declate functionality that will be reused by multiple targets. (mingw_pe_file_end): Likewise. (mingw_pe_record_stub): Likewise. (mingw_pe_valid_dllimport_attribute_p): Likewise.
2024-06-25Extract ix86 dllimport implementation to mingwEvgeny Karpov12-203/+298
This patch extracts the ix86 implementation for expanding a SYMBOL into its corresponding dllimport, far-address, or refptr symbol. It will be reused in the aarch64-w64-mingw32 target. The implementation is copied as is from i386/i386.cc with minor changes to follow to the code style. Also this patch replaces the original DLL import/export implementation in ix86 with mingw. 2024-06-08 Evgeny Karpov <Evgeny.Karpov@microsoft.com> gcc/ChangeLog: * config.gcc: Add winnt-dll.o, which contains the DLL import/export implementation. * config/i386/cygming.h (SUB_TARGET_RECORD_STUB): Remove the old implementation. Rename the required function to MinGW. Use MinGW implementation for COFF and nothing otherwise. (GOT_ALIAS_SET): Likewise. * config/i386/i386-expand.cc (ix86_expand_move): Likewise. * config/i386/i386-expand.h (ix86_GOT_alias_set): Likewise. (legitimize_pe_coff_symbol): Likewise. * config/i386/i386-protos.h (i386_pe_record_stub): Likewise. * config/i386/i386.cc (is_imported_p): Likewise. (legitimate_pic_address_disp_p): Likewise. (ix86_GOT_alias_set): Likewise. (legitimize_pic_address): Likewise. (legitimize_tls_address): Likewise. (struct dllimport_hasher): Likewise. (GTY): Likewise. (get_dllimport_decl): Likewise. (legitimize_pe_coff_extern_decl): Likewise. (legitimize_dllimport_symbol): Likewise. (legitimize_pe_coff_symbol): Likewise. (ix86_legitimize_address): Likewise. * config/i386/i386.h (GOT_ALIAS_SET): Likewise. * config/mingw/winnt.cc (i386_pe_record_stub): Likewise. (mingw_pe_record_stub): Likewise. * config/mingw/winnt.h (mingw_pe_record_stub): Likewise. * config/mingw/t-cygming: Add the winnt-dll.o compilation. * config/mingw/winnt-dll.cc: New file. * config/mingw/winnt-dll.h: New file.
2024-06-25Move mingw_* declarations to the mingw folderEvgeny Karpov5-15/+37
This patch refactors recent changes to move mingw-related functionality to the mingw folder. More renamings to the mingw_ prefix will be done in follow-up commits. This is the first commit in the second patch series to add DLL import/export implementation to AArch64. Coauthors: Zac Walker <zacwalker@microsoft.com>, Mark Harmstone <mark@harmstone.com> and Ron Riddle <ron.riddle@microsoft.com> Refactored, prepared, and validated by Radek Barton <radek.barton@microsoft.com> and Evgeny Karpov <evgeny.karpov@microsoft.com> 2024-06-08 Evgeny Karpov <evgeny.karpov@microsoft.com> gcc/ChangeLog: * config.gcc: Move mingw_* declations to mingw. * config/aarch64/aarch64-protos.h (mingw_pe_maybe_record_exported_symbol): Likewise. (mingw_pe_section_type_flags): Likewise. (mingw_pe_unique_section): Likewise. (mingw_pe_encode_section_info): Likewise. * config/aarch64/cygming.h (mingw_pe_asm_named_section): Likewise. (mingw_pe_declare_function_type): Likewise. * config/i386/i386-protos.h (mingw_pe_unique_section): Likewise. (mingw_pe_declare_function_type): Likewise. (mingw_pe_maybe_record_exported_symbol): Likewise. (mingw_pe_encode_section_info): Likewise. (mingw_pe_section_type_flags): Likewise. (mingw_pe_asm_named_section): Likewise. * config/mingw/winnt.h: New file.
2024-06-25c: Fix ICE related to incomplete structures in C23 [PR114930]Jakub Jelinek5-13/+55
Here is a version of the c_update_type_canonical fixes which passed bootstrap/regtest. The non-trivial part is the handling of the case when build_qualified_type (TYPE_CANONICAL (t), TYPE_QUALS (x)) returns a type with NULL TYPE_CANONICAL. That should happen only if TYPE_CANONICAL (t) == t, because otherwise c_update_type_canonical should have been already called on the other type. c, the returned type, is usually x and in that case it should have TYPE_CANONICAL set to itself, or worst for whatever reason x is not the right canonical type (say it has attributes or whatever disqualifies it from check_qualified_type). In that case either it finds some pre-existing type from the variant chain of t which is later in the chain and we haven't processed it yet (but then get_qualified_type moves it right after t in: /* Put the found variant at the head of the variant list so frequently searched variants get found faster. The C++ FE benefits greatly from this. */ tree t = *tp; *tp = TYPE_NEXT_VARIANT (t); TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (mv); TYPE_NEXT_VARIANT (mv) = t; return t; optimization), or creates a fresh new type using build_variant_type_copy, which again places the new type right after t: /* Add the new type to the chain of variants of TYPE. */ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (m) = t; TYPE_MAIN_VARIANT (t) = m; At this point we want to make c its own canonical type (i.e. TYPE_CANONICAL (c) = c;), but also need to process pointers to it and only then return back to processing x. Processing the whole chain from c again could be costly, we could have hundreds of types in the chain already processed, and while the loop would just quickly skip them for (tree x = t, l = NULL_TREE; x; l = x, x = TYPE_NEXT_VARIANT (x)) { if (x != t && TYPE_STRUCTURAL_EQUALITY_P (x)) ... else if (x != t) continue; it feels costly. So, this patch instead moves c from right after t to right before x in the chain (that shouldn't change anything, because clearly build_qualified_type didn't find any matches in the chain before x) and continues processing the c at that position, so should handle the x that encountered this in the next iteration. We could avoid some of the moving in the chain if we processed the chain twice, once deal only with x != t && TYPE_STRUCTURAL_EQUALITY_P (x) && TYPE_CANONICAL (t) == t && check_qualified_type (t, x, TYPE_QUALS (x)) types (in that case set TYPE_CANONICAL (x) = x) and once the rest. There is still the theoretical case where build_qualified_type would return a new type and in that case we are back to the moving the type around and needing to handle it though. 2024-06-25 Jakub Jelinek <jakub@redhat.com> Martin Uecker <uecker@tugraz.at> PR c/114930 PR c/115502 gcc/c/ * c-decl.cc (c_update_type_canonical): Assert t is main variant with 0 TYPE_QUALS. Simplify and don't use check_qualified_type. Deal with the case where build_qualified_type returns TYPE_STRUCTURAL_EQUALITY_P type. gcc/testsuite/ * gcc.dg/pr114574-1.c: Require lto effective target. * gcc.dg/pr114574-2.c: Likewise. * gcc.dg/pr114930.c: New test. * gcc.dg/pr115502.c: New test.
2024-06-24[PATCH 07/11] Handle structs and classes for CodeViewMark Harmstone2-23/+493
Translates DW_TAG_structure_type DIEs into LF_STRUCTURE symbols, and DW_TAG_class_type DIEs into LF_CLASS symbols. gcc/ * dwarf2codeview.cc (struct codeview_type): Add is_fwd_ref member. (struct codeview_subtype): Add lf_member to union. (struct codeview_custom_type): Add lf_structure to union. (struct codeview_deferred_type): New structure. (deferred_types, last_deferred_type): New variables. (get_type_num): Add new args to prototype. (write_lf_fieldlist): Handle LF_MEMBER subtypes. (write_lf_structure): New function. (write_custom_types): Call write_lf_structure. (get_type_num_pointer_type): Add in_struct argument. (get_type_num_const_type): Likewise. (get_type_num_volatile_type): Likewise. (add_enum_forward_def): Fix get_type_num call. (get_type_num_enumeration_type): Add in-struct argument. (add_deferred_type, flush_deferred_types): New functions. (add_struct_forward_def, get_type_num_struct): Likewise. (get_type_num): Handle self-referential structs. (add_variable): Fix get_type_num call. (codeview_debug_early_finish): Call flush_deferred_types. * dwarf2codeview.h (LF_CLASS, LF_STRUCTURE, LF_MEMBER): Define.
2024-06-24[committed][RISC-V] Fix some of the testsuite fallout from late-combine patchJeff Law49-69/+140
This fixes most, but not all of the testsuite fallout from the late-combine patch. Specifically in the vector space we're often able to eliminate a broadcast of an scalar element across a vector. That eliminates the vsetvl related to the broadcast, but more importantly from the testsuite standpoint it turns .vv forms into .vf or .vx forms. There were two paths we could have taken here. One to accept .v*, ignoring the actual register operands. Or to create new matches for the .vx and .vf variants. I selected the latter as I'd like us to know if the code to avoid the broadcast regresses. I'm pushing this through now so that we've got cleaner results and to prevent duplicate work. I've got patch for the rest of the testsuite fallout, but I want to think about them a bit. gcc/testsuite * gcc.target/riscv/rvv/autovec/binop/vadd-rv32gcv-nofm.c: Adjust expected test output after late-combine changes. * gcc.target/riscv/rvv/autovec/binop/vadd-rv64gcv-nofm.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vdiv-rv32gcv-nofm.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vdiv-rv32gcv.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vdiv-rv64gcv-nofm.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vdiv-rv64gcv.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vmul-rv32gcv-nofm.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vmul-rv64gcv-nofm.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vsub-rv32gcv-nofm.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vsub-rv64gcv-nofm.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_copysign-rv32gcv.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_copysign-rv64gcv.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fadd-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fadd-2.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fadd-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fadd-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-5.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-6.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax-2.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-2.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin-2.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-2.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-5.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-6.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmul-1.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmul-2.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmul-3.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmul-4.c: Likewise. * gcc.target/riscv/rvv/autovec/cond/cond_fmul-5.c: Likewise.
2024-06-25Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook mode_for_floating_typeKewen Lin86-333/+423
Currently how we determine which mode will be used for a floating point type is that for a given type precision (size) call mode_for_size to get the first mode which has this size in the specified class. On Powerpc, we have three modes (TF/KF/IF) having the same mode precision 128 (see[1]), so the processing forces us to have to place TF at the first place, it would require us to make more adjustment in some generic code to avoid some unexpected mode conversions and it would be even worse if we get rid of TF eventually one day. And as Joseph pointed out in [2], "floating types should have their mode, not a poorly defined precision value", as Joseph and Richi suggested, this patch is to introduce one hook mode_for_floating_type which returns the corresponding mode for type float, double or long double. The default implementation returns SFmode for float and DFmode for double or long double. For ports which need special treatment, there are some other patches for their own port specific implementation (referring to how {,LONG_}DOUBLE_TYPE_SIZE get used there). For all generic uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE, depending on the context, some of them are replaced with TYPE_PRECISION of the according type node, some other are replaced with GET_MODE_PRECISION on the mode from mode_for_floating_type. This patch also poisons {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE, so most defines of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in port specific are removed, but there are still some which are good to be kept for readability then they get renamed with port specific prefix. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651017.html [2] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html gcc/jit/ChangeLog: * jit-recording.cc (recording::memento_of_get_type::get_size): Update macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE. gcc/ChangeLog: * coretypes.h (enum tree_index): Forward declaration. * defaults.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * doc/rtl.texi: Update document by replacing {FLOAT,DOUBLE}_TYPE_SIZE with C type {float,double}. * doc/tm.texi.in: Document new hook mode_for_floating_type, remove document entries for {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE and update document for WIDEST_HARDWARE_FP_SIZE. * doc/tm.texi: Regenerate. * emit-rtl.cc (init_emit_once): Replace DOUBLE_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_DOUBLE_TYPE. * real.h (REAL_VALUE_TO_TARGET_LONG_DOUBLE): Use TYPE_PRECISION of long_double_type_node to replace LONG_DOUBLE_TYPE_SIZE. * system.h (FLOAT_TYPE_SIZE): Poison. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * target.def (mode_for_floating_type): New hook. * targhooks.cc (default_mode_for_floating_type): New function. (default_scalar_mode_supported_p): Update macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE. * targhooks.h (default_mode_for_floating_type): New declaration. * tree-core.h (enum tree_index): Specify underlying type unsigned to sync with forward declaration in coretypes.h. (NUM_FLOATN_TYPES): Explicitly convert to int. (NUM_FLOATNX_TYPES): Likewise. (NUM_FLOATN_NX_TYPES): Likewise. * tree.cc (build_common_tree_nodes): Update macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE and set type mode accordingly. * config/arc/arc.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/bpf/bpf.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/epiphany/epiphany.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/fr30/fr30.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/frv/frv.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/ft32/ft32.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/gcn/gcn.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/iq2000/iq2000.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/lm32/lm32.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/m32c/m32c.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/m32r/m32r.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/microblaze/microblaze.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/mmix/mmix.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/moxie/moxie.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/msp430/msp430.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/nds32/nds32.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/nios2/nios2.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/nvptx/nvptx.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/or1k/or1k.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/pdp11/pdp11.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/pru/pru.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/stormy16/stormy16.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/visium/visium.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/xtensa/xtensa.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (rs6000_c_mode_for_floating_type): New function. * config/rs6000/rs6000.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/aarch64/aarch64.cc (aarch64_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/aarch64/aarch64.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/alpha/alpha.cc (alpha_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/alpha/alpha.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/avr/avr.cc (avr_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/avr/avr.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/i386/i386.cc (ix86_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/i386/i386.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/ia64/ia64.cc (ia64_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/ia64/ia64.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/riscv/riscv.cc (riscv_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/riscv/riscv.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rl78/rl78.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (rl78_c_mode_for_floating_type): New function. * config/rl78/rl78.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rx/rx.cc (rx_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/rx/rx.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.cc (s390_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/s390/s390.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/sh/sh.cc (sh_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/sh/sh.h (LONG_DOUBLE_TYPE_SIZE): Remove. * config/h8300/h8300.cc (h8300_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/h8300/h8300.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_SIZE): Remove. (DOUBLE_TYPE_MODE): New macro. * config/h8300/linux.h (DOUBLE_TYPE_SIZE): Remove. (DOUBLE_TYPE_MODE): New macro. * config/loongarch/loongarch.cc (loongarch_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/loongarch/loongarch.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_SIZE): Rename to ... (LA_LONG_DOUBLE_TYPE_SIZE): ... this. (UNITS_PER_FPVALUE): Replace LONG_DOUBLE_TYPE_SIZE with LA_LONG_DOUBLE_TYPE_SIZE. (MAX_FIXED_MODE_SIZE): Likewise. (STRUCTURE_SIZE_BOUNDARY): Likewise. (BIGGEST_ALIGNMENT): Likewise. * config/m68k/m68k.cc (m68k_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/m68k/m68k.h (LONG_DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_MODE): New macro. * config/m68k/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_MODE): New macro. * config/mips/mips.cc (mips_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/mips/mips.h (UNITS_PER_FPVALUE): Replace LONG_DOUBLE_TYPE_SIZE with MIPS_LONG_DOUBLE_TYPE_SIZE. (MAX_FIXED_MODE_SIZE): Likewise. (STRUCTURE_SIZE_BOUNDARY): Likewise. (BIGGEST_ALIGNMENT): Likewise. (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_SIZE): Rename to ... (MIPS_LONG_DOUBLE_TYPE_SIZE): ... this. * config/mips/n32-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (MIPS_LONG_DOUBLE_TYPE_SIZE): ... this. * config/pa/pa.cc (pa_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (pa_scalar_mode_supported_p): Rename FLOAT_TYPE_SIZE to PA_FLOAT_TYPE_SIZE, rename DOUBLE_TYPE_SIZE to PA_DOUBLE_TYPE_SIZE and rename LONG_DOUBLE_TYPE_SIZE to PA_LONG_DOUBLE_TYPE_SIZE. * config/pa/pa.h (PA_FLOAT_TYPE_SIZE): New macro. (PA_DOUBLE_TYPE_SIZE): Likewise. (PA_LONG_DOUBLE_TYPE_SIZE): Likewise. * config/pa/pa-64.h (FLOAT_TYPE_SIZE): Rename to ... (PA_FLOAT_TYPE_SIZE): ... this. (DOUBLE_TYPE_SIZE): Rename to ... (PA_DOUBLE_TYPE_SIZE): ... this. (LONG_DOUBLE_TYPE_SIZE): Rename to ... (PA_LONG_DOUBLE_TYPE_SIZE): ... this. * config/pa/pa-hpux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (PA_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sparc.cc (sparc_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. (sparc_type_code): Replace FLOAT_TYPE_SIZE with TYPE_PRECISION of float_type_node. * config/sparc/sparc.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. * config/sparc/freebsd.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/linux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/linux64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/openbsd64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sol2.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sp-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sp64-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/bfin/bfin.h (FLOAT_TYPE_SIZE): Rename to ... (BFIN_FLOAT_TYPE_SIZE): ... this. (DOUBLE_TYPE_SIZE): Rename to ... (BFIN_DOUBLE_TYPE_SIZE): ... this. (LONG_DOUBLE_TYPE_SIZE): Remove. (UNITS_PER_FLOAT): Replace FLOAT_TYPE_SIZE with BFIN_FLOAT_TYPE_SIZE. (UNITS_PER_DOUBLE): Replace DOUBLE_TYPE_SIZE with BFIN_DOUBLE_TYPE_SIZE.
2024-06-25vms: Replace use of LONG_DOUBLE_TYPE_SIZEKewen Lin1-2/+3
Joseph pointed out "floating types should have their mode, not a poorly defined precision value" in the discussion[1], as he and Richi suggested, the existing macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a hook mode_for_floating_type. To be prepared for that, this patch is to replace use of LONG_DOUBLE_TYPE_SIZE in vms port with TYPE_PRECISION of long_double_type_node. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html gcc/ChangeLog: * config/vms/vms.cc (vms_patch_builtins): Use TYPE_PRECISION of long_double_type_node to replace LONG_DOUBLE_TYPE_SIZE.
2024-06-25rust: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZEKewen Lin1-3/+3
Joseph pointed out "floating types should have their mode, not a poorly defined precision value" in the discussion[1], as he and Richi suggested, the existing macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a hook mode_for_floating_type. To be prepared for that, this patch is to replace use of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in rust with TYPE_PRECISION of {float,{,long_}double}_type_node. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html gcc/rust/ChangeLog: * rust-gcc.cc (float_type): Use TYPE_PRECISION of {float,double,long_double}_type_node to replace {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
2024-06-25go: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZEKewen Lin1-6/+6
Joseph pointed out "floating types should have their mode, not a poorly defined precision value" in the discussion[1], as he and Richi suggested, the existing macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a hook mode_for_floating_type. To be prepared for that, this patch is to replace use of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in go with TYPE_PRECISION of {float,{,long_}double}_type_node. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html gcc/go/ChangeLog: * go-gcc.cc (Gcc_backend::float_type): Use TYPE_PRECISION of {float,double,long_double}_type_node to replace {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE. (Gcc_backend::complex_type): Likewise.
2024-06-24c-family: Add Warning property to Wnrvo option [PR115624]Andrew Pinski1-1/+1
This was missing when Wnrvo was added in r14-1594-g2ae5384d457b9c67586de012816dfc71a6943164 . Pushed after a bootstrap/test on x86_64-linux-gnu. gcc/c-family/ChangeLog: PR c++/115624 * c.opt (Wnrvo): Add Warning property. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-06-24Make transitive relations an oracle optionAndrew MacLeod5-7/+14
This patch makes processing of transitive relations configurable at dom_oracle creation. * tree-vrp.cc (execute_fast_vrp): Do not use transitive relations. * value-query.cc (range_query::create_relation_oracle): Add parameter to enable transitive relations. * value-query.h (range_query::create_relation_oracle): Likewise. * value-relation.h (dom_oracle::dom_oracle): Likewise. * value-relation.cc (dom_oracle::dom_oracle): Likewise. (dom_oracle::register_transitives): Check transitive flag.
2024-06-25Daily bump.GCC Administrator4-1/+324
2024-06-24[PATCH v2 2/3] RISC-V: setmem for RISCV with V extensionSergei Lewis6-2/+320
This is primarily Sergei's work, my contributions were limited to merging his expander with the one that's on the trunk, allowing non-constant value and trivial testsuite adjustments due to option renaming. I'm doing setmem first because it's the easiest. The others will follow soon enough. I've tested this in my system, waiting on pre-commit CI to render its verdict before moving forward. gcc/ChangeLog * config/riscv/riscv-protos.h (riscv_vector::expand_vec_setmem): New function declaration. * config/riscv/riscv-string.cc (riscv_vector::expand_vec_setmem): New function: this generates an inline vectorised memory set, if and only if we know the entire operation can be performed in a single vector store. * config/riscv/riscv.md (setmem<mode>): Try riscv_vector::expand_vec_setmem for constant lengths. Do not require operand 2 to be a constant. gcc/testsuite/ChangeLog * gcc.target/riscv/rvv/base/setmem-1.c: New tests * gcc.target/riscv/rvv/base/setmem-2.c: New tests * gcc.target/riscv/rvv/base/setmem-3.c: New tests
2024-06-24RISC-V: Add dg-remove-option for z* extensionsPatrick O'Neill36-56/+246
This introduces testsuite support infra for removing extensions. Since z* extensions don't have ordering requirements the logic for adding/removing those extensions has also been consolidated. This fixes RVWMO compile testcases failing on Ztso targets by removing the extension from the -march string. gcc/ChangeLog: * doc/sourcebuild.texi (dg-remove-option): Add documentation. (dg-add-option): Add documentation for riscv_{a,zaamo,zalrsc,ztso} gcc/testsuite/ChangeLog: * gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c: Add dg-remove-options for ztso. * gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-1.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-4.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-5.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-6.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-7.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-fence-1.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-fence-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-fence-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-fence-4.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-fence-5.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-load-1.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-load-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-load-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-store-1.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-store-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-store-compat-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-1.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-5.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c: Replace manually specified -march string with dg-add/remove-options directives. * gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c: Ditto. * lib/target-supports-dg.exp: Add dg-remove-options. * lib/target-supports.exp: Add dg-remove-options and consolidate z* extension add/remove-option code. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2024-06-24Fortran: fix passing of optional dummy as actual to optional argument [PR55978]Harald Anlauf2-4/+46
gcc/fortran/ChangeLog: PR fortran/55978 * trans-array.cc (gfc_conv_array_parameter): Do not dereference data component of a missing allocatable dummy array argument for passing as actual to optional dummy. Harden logic of presence check for optional pointer dummy by using TRUTH_ANDIF_EXPR instead of TRUTH_AND_EXPR. gcc/testsuite/ChangeLog: PR fortran/55978 * gfortran.dg/optional_absent_12.f90: New test.
2024-06-24PR tree-optimization/113673: Avoid load merging when potentially trapping.Roger Sayle2-2/+18
This patch fixes PR tree-optimization/113673, a P2 ice-on-valid regression caused by load merging of (ptr[0]<<8)+ptr[1] when -ftrapv has been specified. When the operator is | or ^ this is safe, but for addition of signed integer types, a trap may be generated/required, so merging this idiom into a single non-trapping instruction is inappropriate, confusing the compiler by transforming a basic block with an exception edge into one without. This revision implements Richard Biener's feedback to add an early check for stmt_can_throw_internal (cfun, stmt) to prevent transforming in the presence of any statement that could trap, not just overflow on addition. The one other tweak included in this patch is to mark the local function find_bswap_or_nop_load as static ensuring that it isn't called from outside this file, and guaranteeing that it is dominated by stmt_can_throw_internal checking. 2024-06-24 Roger Sayle <roger@nextmovesoftware.com> Richard Biener <rguenther@suse.de> gcc/ChangeLog PR tree-optimization/113673 * gimple-ssa-store-merging.cc (find_bswap_or_nop_load): Make static. (find_bswap_or_nop_1): Avoid transformations (load merging) when stmt_can_throw_internal indicates that a statement can trap. gcc/testsuite/ChangeLog PR tree-optimization/113673 * g++.dg/pr113673.C: New test case.
2024-06-24tree-optimization/115602 - SLP CSE results in cyclesRichard Biener2-12/+48
The following prevents SLP CSE to create new cycles which happened because of a 1:1 permute node being present where its child was then CSEd to the permute node. Fixed by making a node only available to CSE to after recursing. PR tree-optimization/115602 * tree-vect-slp.cc (vect_cse_slp_nodes): Delay populating the bst-map to avoid cycles. * gcc.dg/vect/pr115602.c: New testcase.
2024-06-24tree-optimization/115528 - fix vect alignment analysis for outer loop vectRichard Biener2-28/+56
For outer loop vectorization of a data reference in the inner loop we have to look at both steps to see if they preserve alignment. What is special for this testcase is that the outer loop step is one element but the inner loop step four and that we now use SLP and the vectorization factor is one. PR tree-optimization/115528 * tree-vect-data-refs.cc (vect_compute_data_ref_alignment): Make sure to look at both the inner and outer loop step behavior. * gfortran.dg/vect/pr115528.f: New testcase.