aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-05c++: local class memfn synth from noexcept context [PR113063]Patrick Palka3-0/+6
Extending the PR113063 testcase to additionally constant evaluate the <=> expression causes us to trip over the assert in cxx_eval_call_expression /* We used to shortcut trivial constructor/op= here, but nowadays we can only get a trivial function here with -fno-elide-constructors. */ gcc_checking_assert (!trivial_fn_p (fun) || !flag_elide_constructors /* We don't elide constructors when processing a noexcept-expression. */ || cp_noexcept_operand); since the local class's <=> was first used and therefore synthesized in a noexcept context and so its definition contains unelided trivial constructors. This patch fixes this by clearing cp_noexcept_operand alongside cp_unevaluated_context in the function-local case of maybe_push_to_top_level. PR c++/113063 gcc/cp/ChangeLog: * name-lookup.cc (local_state_t): Clear and restore cp_noexcept_operand as well. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-synth16.C: Also constant evaluate the <=> expression. * g++.dg/cpp2a/spaceship-synth16a.C: Likewise. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-05doc: remove stray characterMarek Polacek1-1/+1
There's an extra '+'. gcc/ChangeLog: * doc/invoke.texi: Remove an extra char in @item sme2.
2024-09-05c++: fn redecl in fn scope wrongly accepted [PR116239]Marek Polacek4-1/+38
Redeclaration such as void f(void); consteval void f(void); is invalid. In a namespace scope, we detect the collision in validate_constexpr_redeclaration, but not when one declaration is at block scope. When we have void f(void); void g() { consteval void f(void); } we call pushdecl on the second f and call push_local_extern_decl_alias. It finds the namespace-scope f: for (ovl_iterator iter (binding); iter; ++iter) if (decls_match (decl, *iter, /*record_versions*/false)) { alias = *iter; break; } but decls_match says they match so we just set DECL_LOCAL_DECL_ALIAS (and do not call another pushdecl leading to duplicate_decls which would detect mismatching return types, for example). I don't think we want to change decls_match, so a simple fix is to detect the problem in push_local_extern_decl_alias. PR c++/116239 gcc/cp/ChangeLog: * cp-tree.h (validate_constexpr_redeclaration): Declare. * decl.cc (validate_constexpr_redeclaration): No longer static. * name-lookup.cc (push_local_extern_decl_alias): Call validate_constexpr_redeclaration. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/redeclaration-6.C: New test.
2024-09-05Avoid ICE when passing VLA vector to accelerator.Prathamesh Kulkarni2-6/+6
gcc/ChangeLog: * gimplify.cc (omp_add_variable): Check if decl size is not poly_int_tree_p. (gimplify_adjust_omp_clauses): Likewise. * omp-low.cc (scan_sharing_clauses): Likewise. (lower_omp_target): Likewise. Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
2024-09-05nvptx: Emit DECL and DEF linker markers for aliases [PR104957]Thomas Schwinge5-12/+14
With nvptx '-malias' enabled (as implemented in commit f8b15e177155960017ac0c5daef8780d1127f91c "[nvptx] Use .alias directive for mptx >= 6.3"), the C++ front end in certain cases does 'write_fn_proto' before an eventual 'alias' attribute has been added. In that case, we do emit (via 'write_fn_marker') a DECL linker marker, but then never emit a corresponding DEF linker marker for the alias. This causes hundreds of instances of link-time 'unresolved symbol [alias]' across the C++ test suite, which are regressions compared to a test run with (default) '-mno-alias' (in which case the respective functions get duplicated). PR target/104957 gcc/ * config/nvptx/nvptx.cc (write_fn_proto_1): Revert 2022-03-22 change; 'write_fn_marker' also for alias DECL. (nvptx_asm_output_def_from_decls): 'write_fn_marker' for alias DEF. gcc/testsuite/ * g++.target/nvptx/alias-g++.dg_init_dtor2-1.C: Un-XFAIL. * gcc.target/nvptx/alias-1.c: Likewise. * gcc.target/nvptx/alias-3.c: Likewise. * gcc.target/nvptx/alias-to-alias-1.c: Likewise.
2024-09-05Add 'g++.target/nvptx/alias-g++.dg_init_dtor2-1.C'Thomas Schwinge1-0/+33
... as one minimized example for the issue that with nvptx '-malias' enabled (as implemented in commit f8b15e177155960017ac0c5daef8780d1127f91c "[nvptx] Use .alias directive for mptx >= 6.3"), there are hundreds of instances of link-time 'unresolved symbol [alias]' across the C++ test suite, which are regressions compared to a test run with (default) '-mno-alias'. PR target/104957 gcc/testsuite/ * g++.target/nvptx/alias-g++.dg_init_dtor2-1.C: Add.
2024-09-05Enhance 'gcc.target/nvptx/alias-*.c' assembler scanningThomas Schwinge5-19/+66
... in order to demonstrate unexpected behavior (XFAILed here). PR target/104957 gcc/testsuite/ * gcc.target/nvptx/alias-1.c: Enhance assembler scanning. * gcc.target/nvptx/alias-2.c: Likewise. * gcc.target/nvptx/alias-3.c: Likewise. * gcc.target/nvptx/alias-4.c: Likewise. * gcc.target/nvptx/alias-to-alias-1.c: Likewise.
2024-09-05Fix 'gcc.target/nvptx/alias-2.c' commentThomas Schwinge1-1/+1
PR target/104957 gcc/testsuite/ * gcc.target/nvptx/alias-2.c: Fix comment.
2024-09-05Move from 'gcc.target/nvptx/nvptx.exp' into 'target-supports.exp' additions ↵Thomas Schwinge10-78/+98
for nvptx target gcc/testsuite/ * gcc.target/nvptx/nvptx.exp (check_effective_target_default_ptx_isa_version_at_least) (check_effective_target_default_ptx_isa_version_at_least_6_0) (check_effective_target_runtime_ptx_isa_version_at_least) (check_effective_target_runtime_ptx_alias) (add_options_for_ptx_alias): Move... * lib/target-supports.exp (check_nvptx_default_ptx_isa_version_at_least) (check_effective_target_nvptx_default_ptx_isa_version_at_least_6_0) (check_nvptx_runtime_ptx_isa_version_at_least) (check_effective_target_nvptx_runtime_alias_ptx) (add_options_for_nvptx_alias_ptx): ... here. * gcc.target/nvptx/alias-1.c: Adjust. * gcc.target/nvptx/alias-2.c: Likewise. * gcc.target/nvptx/alias-3.c: Likewise. * gcc.target/nvptx/alias-4.c: Likewise. * gcc.target/nvptx/alias-to-alias-1.c: Likewise. * gcc.target/nvptx/alias-weak-1.c: Likewise. * gcc.target/nvptx/uniform-simt-5.c: Likewise. gcc/ * doc/sourcebuild.texi (Effective-Target Keywords): Document 'nvptx_default_ptx_isa_version_at_least_6_0', 'nvptx_runtime_alias_ptx'. (Add Options): Document 'nvptx_alias_ptx'.
2024-09-05c++: Add missing auto_diagnostic_groupsNathaniel Shead21-94/+303
This patch goes through all .cc files in gcc/cp and adds in any auto_diagnostic_groups that seem to be missing by looking for any 'inform' calls that aren't grouped with their respective error/warning. Now with SARIF output support this seems to be a bit more important. The patch isn't complete; I've tried to also track helper functions used for diagnostics to group them, but some may have been missed. Additionally there are a few functions that are definitely missing groupings but I wasn't able to see an obvious way to add them without potentially grouping together unrelated messages. This list includes: - lazy_load_{binding,pendings} "during load of {binding,pendings} for" - cp_finish_decomp "in initialization of structured binding variable" - require_deduced_type "using __builtin_source_location" - convert_nontype_argument "in template argument for type %qT" - coerce_template_params "so any instantiation with a non-empty parameter pack" - tsubst_default_argument "when instantiating default argument" - invalid_nontype_parm_type_p "invalid template non-type parameter" gcc/cp/ChangeLog: * class.cc (add_method): Add missing auto_diagnostic_group. (handle_using_decl): Likewise. (maybe_warn_about_overly_private_class): Likewise. (check_field_decl): Likewise. (check_field_decls): Likewise. (resolve_address_of_overloaded_function): Likewise. (note_name_declared_in_class): Likewise. * constraint.cc (associate_classtype_constraints): Likewise. (diagnose_trait_expr): Clean up whitespace. * coroutines.cc (find_coro_traits_template_decl): Add missing auto_diagnostic_group. (coro_promise_type_found_p): Likewise. (coro_diagnose_throwing_fn): Likewise. * cvt.cc (build_expr_type_conversion): Likewise. * decl.cc (validate_constexpr_redeclaration): Likewise. (duplicate_function_template_decls): Likewise. (duplicate_decls): Likewise. (lookup_label_1): Likewise. (check_previous_goto_1): Likewise. (check_goto_1): Likewise. (make_typename_type): Likewise. (make_unbound_class_template): Likewise. (check_tag_decl): Likewise. (start_decl): Likewise. (maybe_commonize_var): Likewise. (check_for_uninitialized_const_var): Likewise. (reshape_init_class): Likewise. (check_initializer): Likewise. (cp_finish_decl): Likewise. (find_decomp_class_base): Likewise. (cp_finish_decomp): Likewise. (expand_static_init): Likewise. (grokfndecl): Likewise. (grokdeclarator): Likewise. (check_elaborated_type_specifier): Likewise. (lookup_and_check_tag): Likewise. (xref_tag): Likewise. (cxx_simulate_enum_decl): Likewise. (finish_function): Likewise. * decl2.cc (check_classfn): Likewise. (record_mangling): Likewise. (mark_used): Likewise. * error.cc (qualified_name_lookup_error): Likewise. * except.cc (build_throw): Likewise. * init.cc (get_nsdmi): Likewise. (diagnose_uninitialized_cst_or_ref_member_1): Likewise. (warn_placement_new_too_small): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_delete): Likewise. * lambda.cc (add_capture): Likewise. (add_default_capture): Likewise. * lex.cc (unqualified_fn_lookup_error): Likewise. * method.cc (synthesize_method): Likewise. (defaulted_late_check): Likewise. * module.cc (trees_in::is_matching_decl): Likewise. (trees_in::read_enum_def): Likewise. (module_state::check_not_purview): Likewise. (module_state::deferred_macro): Likewise. (module_state::read_config): Likewise. (module_state::check_read): Likewise. (declare_module): Likewise. (init_modules): Likewise. * name-lookup.cc (diagnose_name_conflict): Likewise. (lookup_using_decl): Likewise. (set_decl_namespace): Likewise. (finish_using_directive): Likewise. (push_namespace): Likewise. (add_imported_namespace): Likewise. * parser.cc (cp_parser_check_for_definition_in_return_type): Likewise. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_binary_expression): Likewise. (cp_parser_lambda_introducer): Likewise. (cp_parser_module_declaration): Likewise. (cp_parser_import_declaration): Likewise, removing gotos to support this. (cp_parser_declaration): Add missing auto_diagnostic_group. (cp_parser_decl_specifier_seq): Likewise. (cp_parser_template_id): Likewise. (cp_parser_template_name): Likewise. (cp_parser_explicit_specialization): Likewise. (cp_parser_placeholder_type_specifier): Likewise. (cp_parser_elaborated_type_specifier): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_asm_definition): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_class_head): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_lookup_name): Likewise. (cp_parser_explicit_template_declaration): Likewise. (cp_parser_check_class_key): Likewise. * pt.cc (maybe_process_partial_specialization): Likewise. (determine_specialization): Likewise. (check_for_bare_parameter_packs): Likewise. (check_template_shadow): Likewise. (process_partial_specialization): Likewise. (push_template_decl): Likewise. (redeclare_class_template): Likewise. (convert_nontype_argument_function): Likewise. (check_valid_ptrmem_cst_expr): Likewise. (convert_nontype_argument): Likewise. (convert_template_argument): Likewise. (coerce_template_parms): Likewise. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (most_specialized_partial_spec): Likewise. (do_class_deduction): Likewise. (do_auto_deduction): Likewise. * search.cc (lookup_member): Likewise. * semantics.cc (finish_non_static_data_member): Likewise. (process_outer_var_ref): Likewise. (finish_id_expression_1): Likewise. (finish_offsetof): Likewise. (omp_reduction_lookup): Likewise. (finish_omp_clauses): Likewise. * tree.cc (check_abi_tag_redeclaration): Likewise. (check_abi_tag_args): Likewise. * typeck.cc (invalid_nonstatic_memfn_p): Likewise. (complain_about_unrecognized_member): Likewise. (finish_class_member_access_expr): Likewise. (error_args_num): Likewise. (warn_for_null_address): Likewise. (cp_build_binary_op): Likewise. (build_x_unary_op): Likewise. (cp_build_unary_op): Likewise. (build_static_cast): Likewise. (cp_build_modify_expr): Likewise. (get_delta_difference): Likewise. (convert_for_assignment): Widen scope of auto_diagnostic_group. (check_return_expr): Add missing auto_diagnostic_group. * typeck2.cc (cxx_incomplete_type_diagnostic): Likewise. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Marek Polacek <polacek@redhat.com>
2024-09-05[AARCH64] adjust gcc.target/aarch64/sve/mask_gather_load_7.cRichard Biener1-4/+4
The following adjusts the scan-assembler to also allow predicate registers p8-15 to be used for the destination of the compares. I see that code generation with a pending vectorizer patch (the only assembler change is different predicate register allocation). * gcc.target/aarch64/sve/mask_gather_load_7.c: Allow p8-15 to be used for the destination of the compares.
2024-09-05libsanitizer: On aarch64 use hint #34 in prologue of libsanitizer functionsJakub Jelinek2-4/+14
When gcc is built with -mbranch-protection=standard, running sanitized programs doesn't work properly on bti enabled kernels. This has been fixed upstream with https://github.com/llvm/llvm-project/pull/84061 The following patch cherry picks that from upstream. For trunk we should eventually do a full merge from upstream, but I'm hoping they will first fix up the _BitInt libubsan support mess. 2024-09-05 Jakub Jelinek <jakub@redhat.com> * sanitizer_common/sanitizer_asm.h: Cherry-pick llvm-project revision 1c792d24e0a228ad49cc004a1c26bbd7cd87f030. * interception/interception.h: Likewise.
2024-09-05middle-end: have vect_recog_cond_store_pattern use pattern statement for ↵Tamar Christina1-1/+9
cond if available When vectorizing a conditional operation we rely on the bool_recog pattern to hit and convert the bool of the operand to a valid mask. However we are currently not using the converted operand as this is in a pattern statement. This change updates it to look at the actual statement to be vectorized so we pick up the pattern. Note that there are no tests here since vectorization will fail until we correctly lower all boolean conditionals early. Tests for these are in the next patch, namely vect-conditional_store_5.c and vect-conditional_store_6.c. And the existing vect-conditional_store_[1-4].c checks that the other cases are still handled correctly. gcc/ChangeLog: * tree-vect-patterns.cc (vect_recog_cond_store_pattern): Use pattern statement.
2024-09-05testsuite: remove -fwrapv from signbit-5.cTamar Christina1-3/+3
The meaning of the testcase was changed by passing it -fwrapv. The reason for the test failures on some platform was because the test was testing some implementation defined behavior wrt INT_MIN in generic code. Instead of using -fwrapv this just removes the border case from the test so all the values now have a defined semantic. It still relies on the handling of shifting a negative value right, but that wasn't changed with -fwrapv anyway. The -fwrapv case is being handled already by other testcases. gcc/testsuite/ChangeLog: * gcc.dg/signbit-5.c: Remove -fwrapv and change INT_MIN to INT_MIN+1.
2024-09-05docs: double mention of armv9-a.Tamar Christina1-1/+0
The list of available architecture for Arm is incorrectly listing armv9-a twice. This removes the duplicate armv9-a enumeration from the part of the list having M-profile targets. gcc/ChangeLog: * doc/invoke.texi: Remove duplicate armv9-a mention.
2024-09-05vrp: Fix up diagnostics wordingJakub Jelinek1-1/+1
I've noticed non-standard wording of this diagnostics when looking at a miscompilation with --param=vrp-block-limit=0. Diagnostics generally shouldn't start with uppercase letter (unless the upper case would appear also in the middle of a sentence) and shouldn't be separate sentences with dot as separator, ; is IMHO more frequently used. 2024-09-05 Jakub Jelinek <jakub@redhat.com> * tree-vrp.cc (pass_vrp::execute): Start diagnostics with lowercase u rather than capital U, use semicolon instead of dot.
2024-09-05RISC-V: Lookup reversely in riscv_select_multilib_by_abiYunQiang Su1-1/+1
When use --print-multi-os-dir or -print-multi-directory, gcc outputs different values with full -march option and the base one only. $ ./gcc/xgcc --print-multi-os-dir -mabi=lp64d -march=rv64gc lib64/lp64d $ ./gcc/xgcc --print-multi-os-dir -mabi=lp64d -march=rv64gc_zba . The reason is that in multilib.h, the fallback value of multilib is listed as the 1st one in `multilib_raw[]`. gcc * common/config/riscv/riscv-common.cc(riscv_select_multilib_by_abi): look up reversely as the fallback path is listed as the 1st one.
2024-09-05testsuite: Fix xorsign.c, vect-double-2.c fails with -march=x86-64-v2Hu, Lin12-2/+2
These testcases raise fails with -march=x86-64-v2, so add -mno-sse4 to avoid these unexpected fails. gcc/testsuite/ChangeLog: PR testsuite/116608 * gcc.target/i386/vect-double-2.c: Add extra option -mno-sse4 * gcc.target/i386/xorsign.c: Ditto.
2024-09-05ada: Add bypass for internal fields on strict-alignment platformsEric Botcazou1-3/+8
This is required to support misalignment of tagged types in legacy code. gcc/ada/ * gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Add bypass for internal fields on strict-alignment platforms.
2024-09-05ada: Streamline handling of low-level peculiarities of record field layoutEric Botcazou4-18/+33
This factors out the interface to the low-level field layout machinery. gcc/ada/ * gcc-interface/gigi.h (default_field_alignment): New function. * gcc-interface/misc.cc: Include tm_p header file. (default_field_alignment): New function. * gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Replace previous alignment klduge with call to default_field_alignment. * gcc-interface/utils.cc (finish_record_type): Likewise for the alignment based on which DECL_BIT_FIELD should be cleared.
2024-09-05ada: Remove unused parameters in validity checking routinePiotr Trojanek2-25/+9
Code cleanup; semantics is unaffected. gcc/ada/ * exp_util.ads, exp_util.adb (Duplicate_Subexpr_No_Checks): Remove parameters, which are no longer used.
2024-09-05ada: Integrate new diagnostics in the frontendViljar Indus33-158/+6460
Integrate diagnostic messages using the new implementation to the codebase. New diagnostic implementation uses GNAT.Lists as a building block. Tampering checks that were initially implemented for those lists are not critical for this implementation and they lead to overly complex code. Add a generic parameter Tampering_Checks to control whether the tempering checks should be applied for the lists. Make tampering checks conditional for GNAT.Lists gcc/ada/ * par-endh.adb: add call to new diagnostic for end loop errors. * sem_ch13.adb: add call to new diagnostic for default iterator error and record representation being too late. * sem_ch4.adb: Add new diagnostic for wrong operands. * sem_ch9.adb: Add new diagnostic for a Lock_Free warning. * libgnat/g-lists.adb (Ensure_Unlocked): Make checks for tampering conditional. * libgnat/g-lists.ads: Add parameter Tampering_Checks to control whether tampering checks should be executed. * backend_utils.adb: Add new gcc switches '-fdiagnostics-format=sarif-file' and '-fdiagnostics-format=sarif-stderr'. * debug.adb: document -gnatd_D switch. * diagnostics-brief_emitter.adb: New package for displaying diagnostic messages in a compact manner. * diagnostics-brief_emitter.ads: Same as above. * diagnostics-constructors.adb: New pacakge for providing simpler constructor methods for new diagnostic objects. * diagnostics-constructors.ads: Same as above. * diagnostics-converter.adb: New package for converting old Error_Msg_Object-s to Diagnostic_Types. * diagnostics-converter.ads: Same as above. * diagnostics-json_utils.adb: Package for utility methods related to emitting JSON. * diagnostics-json_utils.ads: Same as above. * diagnostics-pretty_emitter.adb: New package for displaying diagnostic messages in a more elaborate manner. * diagnostics-pretty_emitter.ads: Same as above. * diagnostics-repository.adb: New package for collecting all created error messages. * diagnostics-repository.ads: Same as above. * diagnostics-sarif_emitter.adb: New pacakge for converting all of the diagnostics into a report in the SARIF format. * diagnostics-sarif_emitter.ads: Same as above. * diagnostics-switch_repository.adb: New package containing the definitions for all of the warninging switches. * diagnostics-switch_repository.ads: Same as above. * diagnostics-utils.adb: Contains various utility methods for the diagnostic pacakges. * diagnostics-utils.ads: Same as above. * diagnostics.adb: Contains the definitions and common functions for all the new diagnostics objects. * diagnostics.ads: Same as above. * errout.adb: Relocate the old implementations for brief and pretty printing the diagnostic messages and the entrypoint to the new implementation if a debug switch is used. * errout.ads: Improve documentation. Make Set_Msg_Text publicly available. * opt.ads: Add the flag SARIF_File which controls whether the diagnostic messages should be printed to a file in the SARIF format. Add the flag SARIF_Output to control whether the diagnostic messages should be printed to std-err in the SARIF format. * gcc-interface/Make-lang.in: Add new pacakages to the object list. * gcc-interface/Makefile.in: Add new pacakages to the object list.
2024-09-05ada: Binder respects Ada version for checksum of runtime filesJose Ruiz1-2/+20
The parsing to compute the checksums of runtime files (within the binder) was done using the default Ada version (Ada 2012 currently), while the creation of the checksum, when the runtime files are compiled, is performed in a more recent Ada version (Ada 2022 currently). This change forces the checksum computation for runtime files to be done with the same Ada version as when they were created. gcc/ada/ * ali-util.adb (Get_File_Checksum): Force the parsing for the checksum computation of runtime files to be done in the corresponding recent Ada version.
2024-09-05ada: Tweak assertions in Inline.Cannot_InlineRonan Desplanques2-3/+4
The purpose of this patch is to silence a GNATSAS report. gcc/ada/ * inline.adb (Cannot_Inline): Remove assertion. * inline.ads (Cannot_Inline): Add precondition.
2024-09-05Handle unused-only-live stmts in SLP discoveryRichard Biener1-0/+30
The following adds SLP discovery for roots that are only live but otherwise unused. These are usually inductions. This allows a few more testcases to be handled fully with SLP, for example gcc.dg/vect/no-scevccp-pr86725-1.c * tree-vect-slp.cc (vect_analyze_slp): Analyze SLP for live but otherwise unused defs.
2024-09-05Handle 'NUM' in 'PUSH_INSERT_PASSES_WITHIN'Thomas Schwinge3-7/+29
..., such that also for repeated 'NEXT_PASS', 'PUSH_INSERT_PASSES_WITHIN' for a given 'PASS', the 'PUSH_INSERT_PASSES_WITHIN' applies to the preceeding 'NEXT_PASS', and not unconditionally applies to the first 'NEXT_PASS'. gcc/ * gen-pass-instances.awk: Handle 'PUSH_INSERT_PASSES_WITHIN'. * pass_manager.h (PUSH_INSERT_PASSES_WITHIN): Adjust. * passes.cc (PUSH_INSERT_PASSES_WITHIN): Likewise.
2024-09-04[PATCH] RISC-V: Make the setCC/REE tests robust to instruction selectionPalmer Dabbelt4-4/+4
These tests were checking that the output of the setCC instruction was bit flipped, but it looks like they're really designed to test that redundant sign extension elimination fires on conditionals from function inputs. Jeff just posed a patch to clean this code up with trips up on the arbitrary xori/snez instruction selection decision changing, so let's just robustify the tests. gcc/testsuite/ChangeLog: * gcc.target/riscv/sge.c: Adjust regex to match the input. * gcc.target/riscv/sgeu.c: Likewise. * gcc.target/riscv/sle.c: Likewise. * gcc.target/riscv/sleu.c: Likewise.
2024-09-05i386: Support partial vectorized FMA for V2BF/V4BFLevy Hsu2-0/+137
This patch introduces support for vectorized FMA operations for bf16 types in V2BF and V4BF modes on the i386 architecture. New mode iterators and define_expand entries for fma, fnma, fms, and fnms operations are added in mmx.md, enhancing the i386 backend to handle these complex arithmetic operations. gcc/ChangeLog: * config/i386/mmx.md (TARGET_MMX_WITH_SSE): New mode iterator VBF_32_64 (fma<mode>4): define_expand for V2BF/V4BF fma<mode>4. (fnma<mode>4): define_expand for V2BF/V4BF fnma<mode>4. (fms<mode>4): define_expand for V2BF/V4BF fms<mode>4. (fnms<mode>4): define_expand for V2BF/V4BF fnms<mode>4. gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_2-partial-bf-vector-fma-1.c: New test.
2024-09-05Match: Fix ordered and nonequalHu, Lin14-11/+100
Need to add :c for bit_and, because bit_and is commutative. And is (ltgt @0 @1) is simpler than (bit_not (uneq @0 @1)). gcc/ChangeLog: * match.pd: Fix match for (bit_and (ordered @0 @1) (ne @0 @1)). gcc/testsuite/ChangeLog: * gcc.dg/opt-ordered-and-nonequal-1.c: New test. * gcc.target/i386/optimize_one.c: Change name to opt-comi-1.c. * gcc.target/i386/opt-comi-1.c: New test.
2024-09-05i386: Support partial signbit/xorsign/copysign/abs/neg/and/xor/ior/andn for ↵Levy Hsu3-35/+124
V2BF/V4BF This patch adds support for bf16 operations in V2BF and V4BF modes on i386, handling signbit, xorsign, copysign, abs, neg, and various logical operations. gcc/ChangeLog: * config/i386/i386.cc (ix86_build_const_vector): Add V2BF/V4BF. (ix86_build_signbit_mask): Add V2BF/V4BF. * config/i386/mmx.md: Modified supported logic op to use VHBF_32_64. gcc/testsuite/ChangeLog: * gcc.target/i386/part-vect-absnegbf.c: New test.
2024-09-05i386: Integrate BFmode for Enhanced Vectorization in ix86_preferred_simd_modeLevy Hsu1-0/+8
This change adds BFmode support to the ix86_preferred_simd_mode function enhancing SIMD vectorization for BF16 operations. The update ensures optimized usage of SIMD capabilities improving performance and aligning vector sizes with processor capabilities. gcc/ChangeLog: * config/i386/i386.cc (ix86_preferred_simd_mode): Add BFmode Support.
2024-09-05Daily bump.GCC Administrator12-1/+762
2024-09-04[PATCH 1/3] RISC-V: Improve codegen for negative repeating large constantsRaphael Moreira Zinsly2-8/+49
Improve handling of constants where its upper and lower 32-bit halves are the same and have negative values. e.g. for: unsigned long f (void) { return 0xf0f0f0f0f0f0f0f0UL; } Without the patch: li a0,-252645376 addi a0,a0,240 li a5,-252645376 addi a5,a5,241 slli a5,a5,32 add a0,a5,a0 With the patch: li a5,252645376 addi a5,a5,-241 slli a0,a5,32 add a0,a0,a5 xori a0,a0,-1 gcc/ChangeLog: * config/riscv/riscv.cc (riscv_split_integer_cost): Adjust the cost of negative repeating constants. (riscv_split_integer): Handle negative repeating constants. gcc/testsuite/ChangeLog: * gcc.target/riscv/synthesis-11.c: New test.
2024-09-04Check DECL_NAMELESS in modified_type_dieTom Tromey1-0/+1
While working on a patch to the Ada compiler, I found a spot in dwarf2out.cc that calls add_name_attribute without respecting DECL_NAMELESS. gcc * dwarf2out.cc (modified_type_die): Check DECL_NAMELESS.
2024-09-04[RISC-V] Fix scan test output after recent path-splitting changesJeff Law41-41/+41
The recent path splitting changes from Andrew result in identifying more saturation idioms instead of just identifying an overflow check. As a result many of the tests in the RISC-V port started failing a scan check on the .expand output. As expected, identifying a saturation idiom is more helpful than identifying an overflow check and the resultant code is better based on my spot checks. So the right thing to do is to expect more saturation intrinsics in the .expand output. I've verified this fixes the regressions for riscv32-elf and riscv64-elf. Pushing to the trunk. gcc/testsuite * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-13.c: Adjust expected output. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-14.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-15.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-16.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-17.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-18.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-19.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-20.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-1.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-2.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-5.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-6.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-9.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-10.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-13.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-14.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add_imm_reconcile-15.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-9.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-10.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-11.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-12.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-13.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-14.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-15.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-16.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-17.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-18.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-19.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-20.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-21.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-22.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-23.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-24.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-33.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-34.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-35.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-36.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-37.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-38.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-39.c: Likewise. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-40.c: Likewise.
2024-09-04c++: cleanup coerce_template_template_parmMarek Polacek1-19/+16
This function could use some sprucing up. gcc/cp/ChangeLog: * pt.cc (coerce_template_template_parm): Return bool instead of int.
2024-09-04c++: noexcept and pointer to member function type [PR113108]Marek Polacek2-0/+20
We ICE in nothrow_spec_p because it got a DEFERRED_NOEXCEPT. This DEFERRED_NOEXCEPT was created in implicitly_declare_fn when declaring Foo& operator=(Foo&&) = default; in the test. The problem is that in resolve_overloaded_unification we call maybe_instantiate_noexcept before try_one_overload only in the TEMPLATE_ID_EXPR case. PR c++/113108 gcc/cp/ChangeLog: * pt.cc (resolve_overloaded_unification): Call maybe_instantiate_noexcept. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/noexcept-type28.C: New test.
2024-09-04c++: add a testcase for [PR 108620]Arsen Arsenović1-0/+95
Fixed by r15-2540-g32e678b2ed7521. Add a testcase, as the original ones do not cover this particular failure mode. gcc/testsuite/ChangeLog: PR c++/108620 * g++.dg/coroutines/pr108620.C: New test.
2024-09-04coros: mark .CO_YIELD as LEAF [PR106973]Arsen Arsenović2-1/+23
We rely on .CO_YIELD calls being followed by an assignment (optionally) and then a switch/if in the same basic block. This implies that a .CO_YIELD can never end a block. However, since a call to .CO_YIELD is still a call, if the function containing it calls setjmp, GCC thinks that the .CO_YIELD can introduce abnormal control flow, and generates an edge for the call. We know this is not the case; .CO_YIELD calls get removed quite early on and have no effect, and result in no other calls, so .CO_YIELD can be considered a leaf function, preventing generating an edge when calling it. PR c++/106973 - coroutine generator and setjmp PR c++/106973 gcc/ChangeLog: * internal-fn.def (CO_YIELD): Mark as ECF_LEAF. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr106973.C: New test.
2024-09-04object-size: Use simple_dce_from_worklist in object-size passAndrew Pinski1-1/+8
While trying to see if there was a way to improve object-size pass to use the ranger (for pointer plus), I noticed that it leaves around the statement containing __builtin_object_size if it was reduced to a constant. This fixes that by using simple_dce_from_worklist. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-object-size.cc (object_sizes_execute): Mark lhs for maybe dceing if doing a propagate. Call simple_dce_from_worklist. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-04Use dg-additional-options for gfortran.dg/vect/vect-8.f90 and RISC-VRichard Biener1-1/+1
r14-9122-g67a29f99cc8138 disabled scheduling on a lot of testcases for RISC-V for PR113249 but using dg-options. This makes gfortran.dg/vect/vect-8.f90 UNRESOLVED as it relies on default flags to enable vectorization. The following uses dg-additional-options instead. Tested on riscv64-linux with qemu-user, pushed. I didn't check all the other adjusted tests for similar issues. * gfortran.dg/vect/vect-8.f90: Use dg-additional-options.
2024-09-04nvptx: Use 'enum ptx_version', 'enum ptx_isa' instead of 'int'Thomas Schwinge6-22/+37
This allows getting rid of the respective type casts. No change in behavior intended. gcc/ * config/nvptx/gen-opt.sh: Use 'enum ptx_isa' instead of 'int'. * config/nvptx/nvptx-gen.opt: Regenerate. * config/nvptx/nvptx.opt: Use 'enum ptx_version' instead of 'int'. * config/nvptx/nvptx-opts.h (enum ptx_isa): Add 'PTX_ISA_unset'. (enum ptx_version): Add 'PTX_VERSION_unset'. * config/nvptx/nvptx-c.cc (nvptx_cpu_cpp_builtins): Adjust. * config/nvptx/nvptx.cc (default_ptx_version_option) (handle_ptx_version_option, nvptx_option_override) (nvptx_file_start): Likewise.
2024-09-04Fix branch prediction dump messageFrederik Harwath1-1/+1
Instead of, for instance, "Loop got predicted 1 to iterate 10 times" the message should be "Loop 1 got predicted to iterate 10 times". gcc/ChangeLog: * predict.cc (pass_profile::execute): Fix dump message. Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
2024-09-04Fix gimple_debug_cfg declarationFrederik Harwath1-1/+1
Silence a warning. The argument type did not match the definition. gcc/ChangeLog: * tree-cfg.h (gimple_debug_cfg): Change argument type from int to dump_flags_t.
2024-09-04Document 'pass_postreload' vs. 'pass_late_compilation'Thomas Schwinge2-1/+16
See Subversion r217124 (Git commit 433e4164339f18d0b8798968444a56b681b5232c) "Reorganize post-ra pipeline for targets without register allocation". gcc/ * passes.cc: Document 'pass_postreload' vs. 'pass_late_compilation'. * passes.def: Likewise.
2024-09-04nvptx: Specify '-mno-alias' for 'gcc.dg/pr60797.c' [PR60797, PR104957]Thomas Schwinge1-2/+4
2014 Subversion r209299 (Git commit 8330537b5b58bd0532a0a49f9cbd59bf526a7847) "Fix PR60797" added this test case, which we now amend so that it's able to test its thing also in '--target=nvptx-none' configurations with symbol alias support enabled (..., and test nvptx '-mno-alias'). PR middle-end/60797 PR target/104957 gcc/testsuite/ * gcc.dg/pr60797.c: For nvptx, specify '-mno-alias'.
2024-09-04Add 'gcc.target/nvptx/alias-to-alias-1.c'Thomas Schwinge1-0/+27
... similar to alias to alias usage in 'libgomp.c-c++-common/pr96390.c'. PR target/104957 gcc/testsuite/ * gcc.target/nvptx/alias-to-alias-1.c: New.
2024-09-04Add 'gcc.target/nvptx/alias-weak-1.c'Thomas Schwinge1-0/+10
... testing for the GCC/nvptx "weak alias definitions not supported" error diagnostic (limitation of PTX). gcc/testsuite/ * gcc.target/nvptx/alias-weak-1.c: New.
2024-09-04rust: avoid clobbering LIBSMarc Poulhiès2-14/+16
Save LIBS around calls to AC_SEARCH_LIBS to avoid clobbering $LIBS. ChangeLog: * configure: Regenerate. * configure.ac: Save LIBS around calls to AC_SEARCH_LIBS. Signed-off-by: Marc Poulhiès <dkm@kataplop.net> Reviewed-by: Thomas Schwinge <tschwinge@baylibre.com> Tested-by: Thomas Schwinge <tschwinge@baylibre.com>
2024-09-04Also lower SLP grouped loads with just one consumerRichard Biener3-20/+39
This makes sure to produce interleaving schemes or load-lanes for single-element interleaving and other permutes that otherwise would use more than three vectors. It exposes the latent issue that single-element interleaving with large gaps can be inefficient - the mitigation in get_group_load_store_type doesn't trigger when we clear the load permutation. It also exposes the fact that not all permutes can be lowered in the best way in a vector length agnostic way so I've added an exception to keep power-of-two size contiguous aligned chunks unlowered (unless we want load-lanes). The optimal handling of load/store vectorization is going to continue to be a learning process. * tree-vect-slp.cc (vect_lower_load_permutations): Also process single-use grouped loads. Avoid lowering contiguous aligned power-of-two sized chunks, those are better handled by the vector size specific SLP code generation. * tree-vect-stmts.cc (get_group_load_store_type): Drop the unrelated requirement of a load permutation for the single-element interleaving limit. * gcc.dg/vect/slp-46.c: Remove XFAIL.