aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-11-03c++: change -fconcepts to mean C++20 conceptsJason Merrill88-103/+99
It was always weird that -fconcepts in C++17 mode meant the same thing as -fconcepts-ts in C++20 mode; this patch harmonizes the flags so that for TS concepts you always need to write -fconcepts-ts. In the unlikely event anyone is still using -fconcepts in C++17 mode, they can either fix their code to work with C++20 concepts or adjust the compiler flag. gcc/c-family/ChangeLog: * c-opts.cc (c_common_post_options): -fconcepts no longer implies -fconcepts-ts before C++20. gcc/ChangeLog: * doc/invoke.texi: -fconcepts no longer implies -fconcepts-ts before C++20. gcc/cp/ChangeLog: * parser.cc (cp_parser_template_declaration_after_parameters): Fix concept parsing below C++20. gcc/testsuite/ChangeLog: * g++.dg/concepts/auto1.C: * g++.dg/concepts/auto3.C: * g++.dg/concepts/auto4.C: * g++.dg/concepts/class-deduction1.C: * g++.dg/concepts/class5.C: * g++.dg/concepts/class6.C: * g++.dg/concepts/debug1.C: * g++.dg/concepts/decl-diagnose.C: * g++.dg/concepts/deduction-constraint1.C: * g++.dg/concepts/diagnostic1.C: * g++.dg/concepts/dr1430.C: * g++.dg/concepts/equiv.C: * g++.dg/concepts/equiv2.C: * g++.dg/concepts/expression.C: * g++.dg/concepts/expression2.C: * g++.dg/concepts/expression3.C: * g++.dg/concepts/fn-concept1.C: * g++.dg/concepts/fn-concept2.C: * g++.dg/concepts/fn-concept3.C: * g++.dg/concepts/fn1.C: * g++.dg/concepts/fn10.C: * g++.dg/concepts/fn2.C: * g++.dg/concepts/fn3.C: * g++.dg/concepts/fn4.C: * g++.dg/concepts/fn5.C: * g++.dg/concepts/fn6.C: * g++.dg/concepts/fn8.C: * g++.dg/concepts/fn9.C: * g++.dg/concepts/generic-fn-err.C: * g++.dg/concepts/generic-fn.C: * g++.dg/concepts/inherit-ctor1.C: * g++.dg/concepts/inherit-ctor3.C: * g++.dg/concepts/intro1.C: * g++.dg/concepts/intro2.C: * g++.dg/concepts/intro3.C: * g++.dg/concepts/intro4.C: * g++.dg/concepts/intro5.C: * g++.dg/concepts/intro6.C: * g++.dg/concepts/intro7.C: * g++.dg/concepts/locations1.C: * g++.dg/concepts/partial-concept-id1.C: * g++.dg/concepts/partial-concept-id2.C: * g++.dg/concepts/partial-spec5.C: * g++.dg/concepts/placeholder2.C: * g++.dg/concepts/placeholder3.C: * g++.dg/concepts/placeholder4.C: * g++.dg/concepts/placeholder5.C: * g++.dg/concepts/placeholder6.C: * g++.dg/concepts/pr65634.C: * g++.dg/concepts/pr65636.C: * g++.dg/concepts/pr65681.C: * g++.dg/concepts/pr65848.C: * g++.dg/concepts/pr67249.C: * g++.dg/concepts/pr67595.C: * g++.dg/concepts/pr68434.C: * g++.dg/concepts/pr71127.C: * g++.dg/concepts/pr71128.C: * g++.dg/concepts/pr71131.C: * g++.dg/concepts/pr71385.C: * g++.dg/concepts/pr85065.C: * g++.dg/concepts/template-parm11.C: * g++.dg/concepts/template-parm12.C: * g++.dg/concepts/template-parm2.C: * g++.dg/concepts/template-parm3.C: * g++.dg/concepts/template-parm4.C: * g++.dg/concepts/template-template-parm1.C: * g++.dg/concepts/var-concept1.C: * g++.dg/concepts/var-concept2.C: * g++.dg/concepts/var-concept3.C: * g++.dg/concepts/var-concept4.C: * g++.dg/concepts/var-concept5.C: * g++.dg/concepts/var-concept6.C: * g++.dg/concepts/var-concept7.C: * g++.dg/concepts/var-templ2.C: * g++.dg/concepts/var-templ3.C: * g++.dg/concepts/variadic1.C: * g++.dg/concepts/variadic2.C: * g++.dg/concepts/variadic3.C: * g++.dg/concepts/variadic4.C: * g++.dg/cpp2a/concepts-pr65575.C: * g++.dg/cpp2a/concepts-pr66091.C: * g++.dg/cpp2a/concepts-pr84980.C: * g++.dg/cpp2a/concepts-pr85265.C: Pass -fconcepts-ts. * g++.dg/cpp2a/concepts-pr84979-2.C: * g++.dg/cpp2a/concepts-pr84979-3.C: Same diagnostics in C++20 and below.
2022-11-03c++: constexpr error with defaulted virtual dtor [PR93413]Patrick Palka2-8/+10
We're rejecting the below testcase with error: 'virtual constexpr Base::~Base()' used before its definition error: 'virtual constexpr Derived::~Derived()' used before its definition due to special handling in mark_used added by r181272 to defer synthesis of virtual destructors until EOF (where we can set their linkage), which in turn makes them effectively unusable during constexpr evaluation. Fortunately it seems this special handling is unnecessary ever since r208030 enabled us to tentatively set linkage of all defaulted virtual destructors, including templated ones. So this patch gets rid of this special handling. PR c++/93413 gcc/cp/ChangeLog: * decl2.cc (mark_used): Don't defer synthesis of virtual functions. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/constexpr-virtual21.C: New test.
2022-11-03amdgcn: Fix instruction generation for exp2 and log2 operationsKwok Cheung Yeung2-6/+24
The GCN instructions for the exp2 and log2 operations are v_exp_* and v_log_* respectively, which unfortunately do not line up with the RTL naming convention. To deal with this, a new set of int attributes is now used when generating the assembly for these instructions. 2022-11-03 Kwok Cheung Yeung <kcy@codesourcery.com> gcc/ * config/gcn/gcn-valu.md (math_unop_insn): New attribute. (<math_unop><mode>2, <math_unop><mode>2<exec>, <math_unop><mode>2, <math_unop><mode>2<exec>, *<math_unop><mode>2_insn, *<math_unop><mode>2<exec>_insn): Use math_unop_insn to generate assembler output. gcc/testsuite/ * gcc.target/gcn/unsafe-math-1.c: New.
2022-11-03analyzer: use std::unique_ptr for state machines from pluginsDavid Malcolm3-4/+5
gcc/analyzer/ChangeLog: * analyzer.h: Use std::unique_ptr for state machines from plugins. * engine.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_gil_plugin.c: Use std::unique_ptr for state machines from plugins. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: use std::unique_ptr for known functionsDavid Malcolm6-12/+15
gcc/analyzer/ChangeLog: * analyzer.h: Use std::unique_ptr for known functions. * engine.cc: Likewise. * known-function-manager.cc: Likewise. * known-function-manager.h: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_kernel_plugin.c: Use std::unique_ptr for known functions. * gcc.dg/plugin/analyzer_known_fns_plugin.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: use std::unique_ptr during bifurcationDavid Malcolm16-30/+35
gcc/analyzer/ChangeLog: * analysis-plan.cc: Define INCLUDE_MEMORY before including system.h. * analyzer-pass.cc: Likewise. * analyzer-selftests.cc: Likewise. * analyzer.cc: Likewise. * analyzer.h: Use std::unique_ptr in bifurcation code. * call-string.cc: Define INCLUDE_MEMORY before including system.h. * complexity.cc: Likewise. * engine.cc: Use std::unique_ptr in bifurcation code. * exploded-graph.h: Likewise. * known-function-manager.cc: Define INCLUDE_MEMORY before including system.h. * region-model-impl-calls.cc: Use std::unique_ptr in bifurcation code. * region-model.cc: Likewise. * region-model.h: Likewise. * supergraph.cc: Define INCLUDE_MEMORY before including system.h. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_kernel_plugin.c: Include "make-unique.h". Use std::unique_ptr in bifurcation code. * gcc.dg/plugin/analyzer_known_fns_plugin.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: use std::unique_ptr for checker_eventDavid Malcolm8-120/+133
gcc/analyzer/ChangeLog: * call-info.cc: Use std::unique_ptr for checker_event. * checker-path.cc: Likewise. * checker-path.h: Likewise. * diagnostic-manager.cc: Likewise. * engine.cc: Likewise. * pending-diagnostic.cc: Likewise. * sm-signal.cc: Likewise. * varargs.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: use std::unique_ptr for feasibility_problems and exploded_pathDavid Malcolm6-47/+43
gcc/analyzer/ChangeLog: * diagnostic-manager.cc: Include "make-unique.h". Use std::unique_ptr for feasibility_problems and exploded_path. Delete explicit saved_diagnostic dtor. * diagnostic-manager.h: Likewise. * engine.cc: Likewise. * exploded-graph.h: Likewise. * feasible-graph.cc: Likewise. * feasible-graph.h: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: use std::unique_ptr for custom_edge_info pointersDavid Malcolm4-42/+25
gcc/analyzer/ChangeLog: * checker-path.cc (rewind_event::rewind_event): Update for usage of std::unique_ptr on custom_edge_info. * engine.cc (exploded_node::on_longjmp): Likewise. (exploded_edge::exploded_edge): Likewise. (exploded_edge::~exploded_edge): Delete. (exploded_graph::add_function_entry): Update for usage of std::unique_ptr on custom_edge_info. (exploded_graph::add_edge): Likewise. (add_tainted_args_callback): Likewise. (exploded_graph::maybe_create_dynamic_call): Likewise. (exploded_graph::process_node): Likewise. * exploded-graph.h (exploded_edge::~exploded_edge): Delete. (exploded_edge::m_custom_info): Use std::unique_ptr. (exploded_edge::add_edge): Likewise. * sm-signal.cc (register_signal_handler::impl_transition): Use make_unique. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: use std::unique_ptr for saved_diagnostic::m_stmt_finderDavid Malcolm4-13/+12
gcc/analyzer/ChangeLog: * diagnostic-manager.cc (saved_diagnostic::saved_diagnostic): Make stmt_finder const. (saved_diagnostic::~saved_diagnostic): Remove explicit delete of m_stmt_finder. (diagnostic_manager::add_diagnostic): Make stmt_finder const. * diagnostic-manager.h (saved_diagnostic::saved_diagnostic): Likewise. (saved_diagnostic::m_stmt_finder): Convert to std::unique_ptr. (diagnostic_manager::add_diagnostic): Make stmt_finder const. * engine.cc (impl_sm_context::impl_sm_context): Likewise. (impl_sm_context::m_stmt_finder): Likewise. (leak_stmt_finder::clone): Convert return type to std::unique_ptr. * exploded-graph.h (stmt_finder::clone): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: use std::unique_ptr for pending_diagnostic/noteDavid Malcolm37-190/+266
gcc/analyzer/ChangeLog: * call-info.cc: Add define of INCLUDE_MEMORY. * call-summary.cc: Likewise. * checker-path.cc: Likewise. * constraint-manager.cc: Likewise. * diagnostic-manager.cc: Likewise. (saved_diagnostic::saved_diagnostic): Use std::unique_ptr for param d and field m_d. (saved_diagnostic::~saved_diagnostic): Remove explicit delete of m_d. (saved_diagnostic::add_note): Use std::unique_ptr for param pn. (saved_diagnostic::get_pending_diagnostic): Update for conversion of m_sd.m_d to unique_ptr. (diagnostic_manager::add_diagnostic): Use std::unique_ptr for param d. Remove explicit deletion. (diagnostic_manager::add_note): Use std::unique_ptr for param pn. (diagnostic_manager::emit_saved_diagnostic): Update for conversion of m_sd.m_d to unique_ptr. (null_assignment_sm_context::warn): Use std::unique_ptr for param d. Remove explicit deletion. * diagnostic-manager.h (saved_diagnostic::saved_diagnostic): Use std::unique_ptr for param d. (saved_diagnostic::add_note): Likewise for param pn. (saved_diagnostic::m_d): Likewise. (diagnostic_manager::add_diagnostic): Use std::unique_ptr for param d. (diagnostic_manager::add_note): Use std::unique_ptr for param pn. * engine.cc: Include "make-unique.h". (impl_region_model_context::warn): Update to use std::unique_ptr for param, removing explicit deletion. (impl_region_model_context::add_note): Likewise. (impl_sm_context::warn): Update to use std::unique_ptr for param. (impl_region_model_context::on_state_leak): Likewise for result of on_leak. (exploded_node::on_longjmp): Use make_unique when creating pending_diagnostic. (exploded_graph::process_node): Likewise. * exploded-graph.h (impl_region_model_context::warn): Update to use std::unique_ptr for param. (impl_region_model_context::add_note): Likewise. * feasible-graph.cc: Add define of INCLUDE_MEMORY. * pending-diagnostic.cc: Likewise. * pending-diagnostic.h: Include analyzer.sm.h" * program-point.cc: Add define of INCLUDE_MEMORY. * program-state.cc: Likewise. * region-model-asm.cc: Likewise. * region-model-impl-calls.cc: Likewise. Include "make-unique.h". (region_model::impl_call_putenv): Use make_unique when creating pending_diagnostic. * region-model-manager.cc: Add define of INCLUDE_MEMORY. * region-model-reachability.cc: Likewise. * region-model.cc: Likewise. Include "make-unique.h". (region_model::get_gassign_result): Use make_unique when creating pending_diagnostic. (region_model::check_for_poison): Likewise. (region_model::on_stmt_pre): Likewise. (region_model::check_symbolic_bounds): Likewise. (region_model::check_region_bounds): Likewise. (annotating_ctxt: make_note): Use std::unique_ptr for result. (region_model::deref_rvalue): Use make_unique when creating pending_diagnostic. (region_model::check_for_writable_region): Likewise. (region_model::check_region_size): Likewise. (region_model::check_dynamic_size_for_floats): Likewise. (region_model::maybe_complain_about_infoleak): Likewise. (noop_region_model_context::add_note): Use std::unique_ptr for param. Remove explicit deletion. * region-model.h: Include "analyzer/pending-diagnostic.h". (region_model_context::warn): Convert param to std::unique_ptr. (region_model_context::add_note): Likewise. (noop_region_model_context::warn): Likewise. (noop_region_model_context::add_note): Likewise. (region_model_context_decorator::warn): Likewise. (region_model_context_decorator::add_note): Likewise. (note_adding_context::warn): Likewise. (note_adding_context::make_note): Likewise for return type. (test_region_model_context::warn): Convert param to std::unique_ptr. * region.cc: Add define of INCLUDE_MEMORY. * sm-fd.cc: Likewise. Include "make-unique.h". (fd_state_machine::check_for_fd_attrs): Use make_unique when creating pending_diagnostics. (fd_state_machine::on_open): Likewise. (fd_state_machine::on_creat): Likewise. (fd_state_machine::check_for_dup): Likewise. (fd_state_machine::on_close): Likewise. (fd_state_machine::check_for_open_fd): Likewise. (fd_state_machine::on_leak): Likewise, converting return type to std::unique_ptr. * sm-file.cc: Add define of INCLUDE_MEMORY. Include "make-unique.h". (fileptr_state_machine::on_stmt): Use make_unique when creating pending_diagnostic. (fileptr_state_machine::on_leak): Likewise, converting return type to std::unique_ptr. * sm-malloc.cc: Add define of INCLUDE_MEMORY. Include "make-unique.h". (malloc_state_machine::on_stmt): Use make_unique when creating pending_diagnostic. (malloc_state_machine::handle_free_of_non_heap): Likewise. (malloc_state_machine::on_deallocator_call): Likewise. (malloc_state_machine::on_realloc_call): Likewise. (malloc_state_machine::on_leak): Likewise, converting return type to std::unique_ptr. * sm-pattern-test.cc: Add define of INCLUDE_MEMORY. Include "make-unique.h". (pattern_test_state_machine::on_condition): Use make_unique when creating pending_diagnostic. * sm-sensitive.cc: Add define of INCLUDE_MEMORY. Include "make-unique.h". (sensitive_state_machine::warn_for_any_exposure): Use make_unique when creating pending_diagnostic. * sm-signal.cc: Add define of INCLUDE_MEMORY. Include "make-unique.h". (signal_state_machine::on_stmt): Use make_unique when creating pending_diagnostic. * sm-taint.cc: Add define of INCLUDE_MEMORY. Include "make-unique.h". (taint_state_machine::check_for_tainted_size_arg): Use make_unique when creating pending_diagnostic. (taint_state_machine::check_for_tainted_divisor): Likewise. (region_model::check_region_for_taint): Likewise. (region_model::check_dynamic_size_for_taint): Likewise. * sm.cc: Add define of INCLUDE_MEMORY. Include "analyzer/pending-diagnostic.h". (state_machine::on_leak): Move here from sm.h, changing return type to std::unique_ptr. * sm.h (state_machine::on_leak): Change return type to std::unique_ptr. Move defn of base impl to sm.cc (sm_context::warn): Convert param d to std_unique_ptr. * state-purge.cc: Add define of INCLUDE_MEMORY. * store.cc: Likewise. * svalue.cc: Likewise. * trimmed-graph.cc: Likewise. * varargs.cc: Likewise. Include "make-unique.h". (va_list_state_machine::check_for_ended_va_list): Use make_unique when creating pending_diagnostic. (va_list_state_machine::on_leak): Likewise, converting return type to std::unique_ptr. (region_model::impl_call_va_arg): Use make_unique when creating pending_diagnostic. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_gil_plugin.c: Add define of INCLUDE_MEMORY. Include "make-unique.h". (gil_state_machine::check_for_pyobject_in_call): Use make_unique when creating pending_diagnostic. (gil_state_machine::on_stmt): Likewise. (gil_state_machine::check_for_pyobject_usage_without_gil): Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.c: : Add define of INCLUDE_MEMORY. * gcc.dg/plugin/analyzer_known_fns_plugin.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03Update range query cache when a statement is updated.Andrew MacLeod5-0/+62
Add an update_stmt interface to range query, and hook into it with the ssa statement update call. gcc/ * gimple-range.cc (gimple_ranger::update_stmt): New. * gimple-range.h (gimple_ranger::update_stmt): New prototype. * tree-ssa-operands.cc (update_stmt_operands): Notify range query that stmt has changed. * value-query.h (range_query::update_stmt): New. gcc/testsuite/ * gcc.dg/tree-ssa/vrp-update.c: New.
2022-11-03Add gcc/make-unique.hDavid Malcolm1-0/+44
This patch adds gcc/make-unique.h, containing a minimal C++11 implementation of make_unique (std::make_unique is C++14). gcc/ChangeLog: * make-unique.h: New file. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03analyzer: fix ICE when pipe's arg isn't a pointer [PR107486]David Malcolm5-4/+38
gcc/analyzer/ChangeLog: PR analyzer/107486 * analyzer.cc (is_pipe_call_p): New. * analyzer.h (is_pipe_call_p): New decl. * region-model.cc (region_model::on_call_pre): Use it. (region_model::on_call_post): Likewise. gcc/testsuite/ChangeLog: PR analyzer/107486 * gcc.dg/analyzer/pipe-pr107486.c: New test. * gcc.dg/analyzer/pipe-void-return.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-03OpenMP/Fortran: 'target update' with DT componentsTobias Burnus2-7/+12
OpenMP 5.0 permits to use arrays with derived type components for the list items to the 'from'/'to' clauses of the 'target update' directive. gcc/fortran/ChangeLog: * openmp.cc (gfc_match_omp_clauses): Permit derived types for the 'to' and 'from' clauses of 'target update'. * trans-openmp.cc (gfc_trans_omp_clauses): Fixes for derived-type changes; fix size for scalars. libgomp/ChangeLog: * testsuite/libgomp.fortran/target-11.f90: New test. * testsuite/libgomp.fortran/target-13.f90: New test.
2022-11-03i386: Fix uninitialized register after peephole2 conversion [PR107404]Uros Bizjak2-1/+55
The eliminate reg-reg move by inverting the condition of a cmove #2 peephole2 converts the following sequence: 473: bx:DI=[r14:DI*0x8+r12:DI] 960: r15:DI=r8:DI 485: {flags:CCC=cmp(r15:DI+bx:DI,bx:DI);r15:DI=r15:DI+bx:DI;} 737: r15:DI={(geu(flags:CCC,0))?r15:DI:bx:DI} to: 1110: {flags:CCC=cmp(r8:DI+bx:DI,bx:DI);r8:DI=r8:DI+bx:DI;} 1111: r15:DI=[r14:DI*0x8+r12:DI] 1112: r15:DI={(geu(flags:CCC,0))?r8:DI:r15:DI} Please note that(insn 1110) uses register BX, but its initialization was eliminated. Avoid conversion if eliminated move intialized a register, used in the moved instruction. 2022-11-03 Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog: PR target/107404 * config/i386/i386.md (eliminate reg-reg move by inverting the condition of a cmove #2 peephole2): Check if eliminated move initialized a register, used in the moved instruction. gcc/testsuite/ChangeLog: PR target/107404 * g++.target/i386/pr107404.C: New test.
2022-11-03amdgcn: Fix duplicate conditionals [PR107510]Andrew Stubbs1-2/+0
Just a harmless cut-and-paste issue. PR target/107510 gcc/ChangeLog: * config/gcn/gcn.cc (gcn_expand_reduc_scalar): Remove duplicate UNSPEC_SMIN_DPP_SHR conditionals.
2022-11-03testsuite: Fix gen-vect-34.c with vect_masked_load [PR106806]Kewen Lin1-1/+1
This is to fix the failure on powerpc as reported in PR106806, the test case requires tree ifcvt pass to perform on that loop, and it relies on masked_load support. The fix is to guard the expected scan with vect_masked_load effective target. As tested on powerpc64{,le}-linux-gnu and aarch64-linux-gnu (cfarm machine), the failures were gone. But on x86_64-redhat-linux (cfarm machine) the result becomes from PASS to N/A. I think it's expected since that machine doesn't support AVX by default so both check_avx_available and vect_masked_load fail, it should work fine on machines with default AVX support, or if we adjust the current check_avx_available with current_compiler_flags. PR testsuite/106806 gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/gen-vect-34.c: Adjust with vect_masked_load effective target.
2022-11-03c: C2x autoJoseph Myers9-19/+418
Implement C2x auto, a more restricted version of the C++ feature (closer to GNU C __auto_type in terms of what's supported). Since the feature is very close to GNU C __auto_type, much of the implementation can be shared. The main differences are: * Any prior declaration of the identifier in an outer scope is shadowed during the initializer (whereas __auto_type leaves any such declaration visible until the initializer ends and the scope of the __auto_type declaration itself starts). (A prior declaration in the same scope is undefined behavior.) * The standard feature supports braced initializers (containing a single expression, optionally followed by a comma). * The standard feature disallows the declaration from declaring anything that's not an ordinary identifier (thus, the initializer cannot declare a tag or the members of a structure or union), while making it undefined behavior for it to declare more than one ordinary identifier. (For the latter, while I keep the existing error from __auto_type in the case of more than one declarator, I don't restrict other ordinary identifiers from being declared in inner scopes such as GNU statement expressions. I do however disallow defining the members of an enumeration inside the initializer (if the enum definition has no tag, that doesn't actually violate a constraint), to avoid an enum type becoming accessible beyond where it would have been without auto. (Preventing new types from escaping the initializer - thus, ensuring that anything written with auto corresponds to something that could have been written without auto, modulo multiple evaluation of VLA size expressions when not using auto - is a key motivation for some restrictions on what can be declared in the initializer.) The rule on shadowing and restrictions on other declarations in the initializer are actually general rules for what C2x calls underspecified declarations, a description that covers constexpr as well as auto (in particular, this disallows a constexpr initializer from referencing the variable being initialized). Thus, some of the code added for those restrictions will also be of use in implementing C2x constexpr. auto with a type specifier remains a storage class specifier with the same meaning as before (i.e. a redundant storage class specifier for use at block scope). Note that the feature is only enabled in C2x mode (-std=c2x or -std=gnu2x); in older modes, a declaration with auto and no type is treated as a case of implicit int (only accepted at block scope). Since many of the restrictions on C2x auto are specified as undefined behavior rather than constraint violations, it would be possible to support more features from C++ auto without requiring diagnostics (but maybe not a good idea, if it isn't clear exactly what semantics might be given to such a feature in a future revision of C; and -Wc23-c2y-compat should arguably warn for any such future feature anyway). For now the features are limited to something close to what's supported with __auto_type, with the differences as discussed above between the two features. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-decl.cc (in_underspecified_init, start_underspecified_init) (finish_underspecified_init): New. (shadow_tag_warned, parser_xref_tag, start_struct, start_enum): Give errors inside initializers of underspecified declarations. (grokdeclarator): Handle (erroneous) case of C2X auto on a parameter. (declspecs_add_type): Handle c2x_auto_p case. (declspecs_add_scspec): Handle auto possibly setting c2x_auto_p in C2X mode. (finish_declspecs): Handle c2x_auto_p. * c-parser.cc (c_parser_declaration_or_fndef): Handle C2X auto. * c-tree.h (C_DECL_UNDERSPECIFIED): New macro. (struct c_declspecs): Add c2x_auto_p. (start_underspecified_init, finish_underspecified_init): New prototypes. * c-typeck.cc (build_external_ref): Give error for underspecified declaration referenced in its initializer. gcc/testsuite/ * gcc.dg/c2x-auto-1.c, gcc.dg/c2x-auto-2.c, gcc.dg/c2x-auto-3.c, gcc.dg/c2x-auto-4.c, gcc.dg/gnu2x-auto-1.c: New tests.
2022-11-03Daily bump.GCC Administrator3-1/+39
2022-11-02RISC-V: Add Zawrs ISA extension supportChristoph Müllner4-0/+23
This patch adds support for the Zawrs ISA extension. Zawrs has been ratified by the RISC-V BoD on Oct 20th, 2022. Binutils support has been merged as: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=eb668e50036e979fb0a74821df4eee0307b44e66 gcc/ChangeLog: * common/config/riscv/riscv-common.cc: Add zawrs extension. * config/riscv/riscv-opts.h (MASK_ZAWRS): New. (TARGET_ZAWRS): New. * config/riscv/riscv.opt: New. gcc/testsuite/ChangeLog: * gcc.target/riscv/zawrs.c: New test. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
2022-11-02gcc: honour -ffile-prefix-map in ASM_MAP [PR93371]Rasmus Villemoes1-1/+1
-ffile-prefix-map is supposed to be a superset of -fmacro-prefix-map and -fdebug-prefix-map. However, when building .S or .s files, gas is not called with the appropriate --debug-prefix-map option when -ffile-prefix-map is used. While the user can specify -fdebug-prefix-map when building assembly files via gcc, it's more ergonomic to also support -ffile-prefix-map; especially since for .S files that could contain the __FILE__ macro, one would then also have to specify -fmacro-prefix-map. gcc: PR driver/93371 * gcc.cc (ASM_MAP): Honour -ffile-prefix-map.
2022-11-02Fix bug in frange::contains_p() for signed zeros.Aldy Hernandez1-1/+9
The contains_p() code wasn't returning true for non-singleton ranges containing signed zeros. With this patch we now handle: -0.0 exists in [-3, +5.0] +0.0 exists in [-3, +5.0] gcc/ChangeLog: * value-range.cc (frange::contains_p): Fix signed zero handling. (range_tests_signed_zeros): New test.
2022-11-02builtins: Guard builtins.cc against HUGE_VAL and NAN definitionsRainer Orth1-0/+5
trunk bootstrap recently broke on Solaris like this: /vol/gcc/src/hg/master/local/gcc/builtins.cc:2104:8: error: pasting "CFN_BUILT_IN_" and "(" does not give a valid preprocessing token 2104 | case CFN_BUILT_IN_##MATHFN: \ | ^~~~~~~~~~~~~ /vol/gcc/src/hg/master/local/gcc/builtins.cc:2112:3: note: in expansion of macro 'CASE_MATHFN' 2112 | CASE_MATHFN(MATHFN) \ | ^~~~~~~~~~~ /vol/gcc/src/hg/master/local/gcc/builtins.cc:1967:5: note: in expansion of macro 'CASE_MATHFN_FLOATN' 1967 | CASE_MATHFN_FLOATN (HUGE_VAL) \ and similarly for NAN. It turns out this happens because <math.h> is included at some point, which (in <iso/math_c99.h>) defines While this only happpens on Solaris right now, the same issue would be present on other targets when <math.h> gets included somehow. To avoid this, this patch #undef's both macros. Bootstrapped without regressions on i386-pc-solaris2.11 and sparc-sun-solaris2.11. 2022-11-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gcc: * builtins.cc (mathfn_built_in_2): #undef HUGE_VAL, NAN.
2022-11-02rs6000: Byte reverse V8HI on Power8 by vector rotation.Xionghu Luo3-7/+29
gcc/ PR target/100866 * config/rs6000/altivec.md: (*altivec_vrl<VI_char>): Named to... (altivec_vrl<VI_char>): ...this. * config/rs6000/vsx.md (revb_<mode>): Call vspltish and vrlh when target is Power8 and mode is V8HI. gcc/testsuite/ PR target/100866 * gcc.target/powerpc/pr100866-2.c: New.
2022-11-02Daily bump.GCC Administrator4-1/+212
2022-11-01c++: per-scope, per-signature lambda discriminatorsNathan Sidwell9-3/+264
This implements ABI-compliant lambda discriminators. Not only do we have per-scope counters, but we also distinguish by lambda signature. Only lambdas with the same signature will need non-zero discriminators. As the discriminator is signature-dependent, we have to process the lambda function's declaration before we can determine it. For templated and generic lambdas the signature is that of the uninstantiated lambda -- not separate for each instantiation. With this change, gcc and clang now produce the same lambda manglings for all these testcases. gcc/cp/ * cp-tree.h (LAMBDA_EXPR_SCOPE_SIG_DISCRIMINATOR): New. (struct tree_lambda_expr): Add discriminator_sig bitfield. (recrd_lambda_scope_sig_discriminator): Declare. * lambda.cc (struct lambda_sig_count): New. (lambda_discriminator): Add signature vector. (start_lambda_scope): Adjust. (compare_lambda_template_head, compare_lambda_sig): New. (record_lambda_scope_sig_discriminator): New. * mangle.cc (write_closure_type): Use the scope-sig discriminator for ABI >= 18. Emit abi mangling warning if needed. * module.cc (trees_out::core_vals): Stream the new discriminator. (trees_in::core_vals): Likewise. * parser.cc (cp_parser_lambda_declarator_opt): Call record_lambda_scope_sig_discriminator. * pt.cc (tsubst_lambda_expr): Likewise. libcc1/ * libcp1plugin.cc (plugin_start_lambda_closure_class_type): Initialize the per-scope, per-signature discriminator. gcc/testsuite/ * g++.dg/abi/lambda-sig1-18.C: New. * g++.dg/abi/lambda-sig1-18vs17.C: New. * g++.dg/cpp1y/lambda-mangle-1-18.C: New.
2022-11-01configure: cache result of "sys/sdt.h" header checkDavid Seifert2-12/+24
Use AC_CACHE_CHECK to store the result of the header check for systemtap's "sys/sdt.h", which is similar in spirit to libstdc++'s AC_CACHE_CHECK(..., glibcxx_cv_sys_sdt_h). gcc/ * configure.ac: Add AC_CACHE_CHECK(..., gcc_cv_sys_sdt_h). * configure: Regenerate.
2022-11-01gcc/file-prefix-map: Allow remapping of relative pathsRichard Purdie1-3/+13
Relative paths currently aren't remapped by -ffile-prefix-map and friends. When cross compiling with separate 'source' and 'build' directories, the same relative paths between directories may not be available on target as compared to build time. In order to be able to remap these relative build paths to paths that would work on target, resolve paths within the file-prefix-map function using realpath(). This does cause a change of behaviour if users were previously relying upon symlinks or absolute paths not being resolved. Use basename to ensure plain filenames don't have paths added. gcc/ChangeLog: * file-prefix-map.cc (remap_filename): Allow remapping of relative paths.
2022-11-01[PR tree-optimization/107490] Handle NANs in op[12]_range.Aldy Hernandez2-8/+60
None of the build_<OP> functions in range-op handle NANs. This is by design in order to force us to handle NANs specially, because "x relop NAN" makes no sense. This patch fixes a handful of op[12]_range entries that weren't handling NANs. PR tree-optimization/107490 gcc/ChangeLog: * range-op-float.cc (foperator_unordered_lt::op1_range): Handle NANs. (foperator_unordered_lt::op2_range): Same. (foperator_unordered_le::op1_range): Same. (foperator_unordered_le::op2_range): Same. (foperator_unordered_gt::op1_range): Same. (foperator_unordered_gt::op2_range): Same. (foperator_unordered_ge::op1_range): Same. (foperator_unordered_ge::op2_range): Same. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr107490.c: New test.
2022-11-01Make sure ssa-name is valid.Andrew MacLeod1-1/+1
PR tree-optimization/107497 * tree-vrp.cc (remove_unreachable::remove_and_update_globals): Check that ssa-name still exists before accessing it.
2022-11-01Make ranger vrp1 default.Andrew MacLeod3-2/+44
Turn on ranger as the default vrp1 pass and adjust testcases. gcc/ * params.opt (param_vrp1_mode): Make ranger default. gcc/testsuite/ * gcc.dg/pr68217.c: Test [-INF, -INF][0, 0] instead of [-INF, 0]. * gcc.dg/tree-ssa/vrp-unreachable.c: New. Test unreachable removal.
2022-11-01Remove builtin_unreachable in VRPAndrew MacLeod1-3/+187
Removal of __builtin_unreachable calls were handled in an inconsistent way. This removes then in the VRP pass, and sets the global range appropriately. * tree-vrp.cc (class remove_unreachable): New. (remove_unreachable::maybe_register_block): New. (remove_unreachable::remove_and_update_globals): New. (rvrp_folder::rvrp_folder): Initialize m_unreachable. (rvrp_folder::post_fold_bb): Maybe register unreachable block. (rvrp_folder::m_unreachable): New member. (execute_ranger_vrp): Add final_pass flag, remove unreachables.
2022-11-01Allow queries on exit block.Andrew MacLeod2-7/+10
Ranger was not allowing the exit block to be queried for range_on_entry or exit. This removes that restriction. * gimple-range-cache.cc (ranger_cache::fill_block_cache): Allow exit block to be specified. (ranger_cache::range_from_dom): If exit block is specified, use the immediate predecessor instead of the dominator to start. * gimple-range.cc (gimple_ranger::range_on_exit): Allow query for exit block.
2022-11-01Intersect with nonzero bits can indicate change incorrectly.Andrew MacLeod1-0/+4
* value-range.cc (irange::intersect_nonzero_bits): If new non-zero mask is the same as original, flag no change.
2022-11-01i386: correct integer division modeling in znver.mdAlexander Monakov1-18/+21
In znver.md, division instructions have descriptions like (define_insn_reservation "znver1_idiv_DI" 41 (and (eq_attr "cpu" "znver1,znver2") (and (eq_attr "type" "idiv") (and (eq_attr "mode" "DI") (eq_attr "memory" "none")))) "znver1-double,znver1-ieu2*41") which says that DImode idiv has latency 41 (which is correct) and that it occupies 2nd integer execution unit for 41 consecutive cycles, but that is not correct: 1) the division instruction is partially pipelined, and has throughput 1/14, not 1/41; 2) for the most part it occupies a separate division unit, not the general arithmetic unit. Evidently, interaction of such 41-cycle paths with the rest of reservations causes a combinatorial explosion in the automaton. Fix this by modeling the integer division unit properly, and correcting reservations to use the measured reciprocal throughput of those instructions (available from uops.info). A similar correction for floating-point divisions is left for a followup patch. Top 5 znver table sizes, before: 68692 r znver1_ieu_check 68692 r znver1_ieu_transitions 99792 r znver1_ieu_min_issue_delay 428108 r znver1_fp_min_issue_delay 856216 r znver1_fp_transitions After: 1454 r znver1_ieu_translate 1454 r znver1_translate 2304 r znver1_ieu_transitions 428108 r znver1_fp_min_issue_delay 856216 r znver1_fp_transitions gcc/ChangeLog: PR target/87832 * config/i386/znver.md (znver1_idiv): New automaton. (znver1-idiv): New unit. (znver1_idiv_DI): Correct unit and cycles in the reservation. (znver1_idiv_SI): Ditto. (znver1_idiv_HI): Ditto. (znver1_idiv_QI): Ditto. (znver1_idiv_mem_DI): Ditto. (znver1_idiv_mem_SI): Ditto. (znver1_idiv_mem_HI): Ditto. (znver1_idiv_mem_QI): Ditto. (znver3_idiv_DI): Ditto. (znver3_idiv_SI): Ditto. (znver3_idiv_HI): Ditto. (znver3_idiv_QI): Ditto. (znver3_idiv_mem_DI): Ditto. (znver3_idiv_mem_SI): Ditto. (znver3_idiv_mem_HI): Ditto. (znver3_idiv_mem_QI): Ditto.
2022-11-01c++: Reorganize per-scope lambda discriminatorsNathan Sidwell11-97/+198
We currently use a per-extra-scope counter to discriminate multiple lambdas in a particular such scope. This is not ABI compliant. This patch merely refactors the existing code to make it easier to drop in a conformant mangling -- there's no functional change here. I rename the LAMBDA_EXPR_DISCIMINATOR to LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR, foreshadowing that there'll be a new discriminator. To provide ABI warnings we'll need to calculate both, and that requires some repacking of the lambda_expr's fields. Finally, although we end up calling the discriminator setter and the scope recorder (nearly) always consecutively, it's clearer to handle it as two separate operations. That also allows us to remove the instantiation special-case for a null extra-scope. gcc/cp/ * cp-tree.h (LAMBDA_EXPR_DISCRIMINATOR): Rename to ... (LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR): ... here. (struct tree_lambda_expr): Make default_capture_mode & discriminator_scope bitfields. (record_null_lambda_scope) Delete. (record_lambda_scope_discriminator): Declare. * lambda.cc (struct lambda_discriminator): New struct. (lambda_scope, lambda_scope_stack): Adjust types. (lambda_count): Delete. (struct tree_int): Delete. (start_lambda_scope, finish_lambda_scope): Adjust. (record_lambda_scope): Only record the scope. (record_lambda_scope_discriminator): New. * mangle.cc (write_closure_type_name): Adjust. * module.cc (trees_out::core_vals): Likewise, (trees_in::core_vals): Likewise. * parser.cc (cp_parser_lambda_expression): Call record_lambda_scope_discriminator. * pt.cc (tsubst_lambda_expr): Adjust record_lambda_scope caling. Call record_lambda_scope_discriminator. Commonize control flow on tsubsting the operator function. libcc1/ * libcp1plugin.cc (plugin_start_closure): Adjust. gcc/testsuite/ * g++.dg/abi/lambda-sig1-17.C: New. * g++.dg/abi/lambda-sig1.h: New. * g++.dg/cpp1y/lambda-mangle-1.C: Extracted to ... * g++.dg/cpp1y/lambda-mangle-1.h: ... here. * g++.dg/cpp1y/lambda-mangle-1-11.C: New * g++.dg/cpp1y/lambda-mangle-1-17.C
2022-11-01Fix incorrect digit constraintliuhongt3-84/+77
Matching constraints are used in these circumstances. More precisely, the two operands that match must include one input-only operand and one output-only operand. Moreover, the digit must be a smaller number than the number of the operand that uses it in the constraint. In pr107057, the 2 operands in the pattern are both input operands. gcc/ChangeLog: PR target/107057 * config/i386/sse.md (*vec_interleave_highv2df): Remove constraint 1. (*vec_interleave_lowv2df): Ditto. (vec_concatv2df): Ditto. (*avx512f_unpcklpd512<mask_name>): Ditto and renamed to .. (avx512f_unpcklpd512<mask_name>): .. this. (avx512f_movddup512<mask_name>): Change to define_insn. (avx_movddup256<mask_name>): Ditto. (*avx_unpcklpd256<mask_name>): Remove constraint 1 and renamed to .. (avx_unpcklpd256<mask_name>): .. this. * config/i386/i386.cc (ix86_vec_interleave_v2df_operator_ok): Disallow MEM_P (op1) && MEM_P (op2). gcc/testsuite/ChangeLog: * gcc.target/i386/pr107057.c: New test.
2022-11-01Enable more optimization for 32-bit/64-bit shrd/shld with imm shift count.liuhongt2-4/+173
This patch doens't handle variable count since it require 5 insns to be combined to get wanted pattern, but current pass_combine only supports at most 4. This patch doesn't handle 16-bit shrd/shld either. gcc/ChangeLog: PR target/55583 * config/i386/i386.md (*x86_64_shld_1): Rename to .. (x86_64_shld_1): .. this. (*x86_shld_1): Rename to .. (x86_shld_1): .. this. (*x86_64_shrd_1): Rename to .. (x86_64_shrd_1): .. this. (*x86_shrd_1): Rename to .. (x86_shrd_1): .. this. (*x86_64_shld_shrd_1_nozext): New pre_reload splitter. (*x86_shld_shrd_1_nozext): Ditto. (*x86_64_shrd_shld_1_nozext): Ditto. (*x86_shrd_shld_1_nozext): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr55583.c: New test.
2022-10-31c++: pass std attributes to make_call_declaratorJason Merrill1-4/+8
It seems preferable to pass these to the function rather than set them separately after the call. gcc/cp/ChangeLog: * parser.cc (make_call_declarator): Add std_attrs parm. (cp_parser_lambda_declarator_opt): Pass it. (cp_parser_direct_declarator): Pass it.
2022-10-31c++: set TREE_NOTHROW after genericizeJason Merrill1-8/+8
genericize might introduce function calls (and does on the contracts branch), so it's safer to set this flag later. gcc/cp/ChangeLog: * decl.cc (finish_function): Set TREE_NOTHROW later in the function.
2022-10-31c++: formatting tweaksJason Merrill3-7/+4
gcc/cp/ChangeLog: * decl.cc (duplicate_decls): Reformat loop. * parser.cc (cp_parser_member_declaration): Add newline. * semantics.cc: Remove newline.
2022-11-01Add attribute hot judgement for INLINE_HINT_known_hot hint.Cui,Lili2-4/+56
We set up INLINE_HINT_known_hot hint only when we have profile feedback, now add function attribute judgement for it, when both caller and callee have __attribute__((hot)), we will also set up INLINE_HINT_known_hot hint for it. With this patch applied, ADL Multi-copy: 538.imagic_r 16.7% ICX Multi-copy: 538.imagic_r 15.2% CLX Multi-copy: 538.imagic_r 12.7% Znver3 Multi-copy: 538.imagic_r 10.6% Arm Multi-copy: 538.imagic_r 13.4% gcc/ChangeLog * ipa-inline-analysis.cc (do_estimate_edge_time): Add function attribute judgement for INLINE_HINT_known_hot hint. gcc/testsuite/ChangeLog: * gcc.dg/ipa/inlinehint-6.c: New test.
2022-11-01Daily bump.GCC Administrator3-1/+343
2022-10-31libstdc++-v3: <complex> support for extended floating point typesJakub Jelinek1-0/+182
The following patch adds <complex> support for extended floating point types. C++23 removes the float/double/long double specializations from the spec and instead adds explicit(bool) specifier on the converting constructor. The patch uses that for converting constructor of the base template as well as the float/double/long double specializations's converting constructors (e.g. so that it handles convertion construction also from complex of extended floating point types). Copy ctor was already defaulted as the spec now requires. The patch also adds partial specialization for the _Float{16,32,64,128} and __gnu_cxx::__bfloat16_t types because the base template doesn't use __complex__ but a pair of floating point values. The g++.dg/cpp23/ testcase verifies explicit(bool) works correctly. 2022-10-31 Jakub Jelinek <jakub@redhat.com> gcc/testsuite/ * g++.dg/cpp23/ext-floating12.C: New test. libstdc++-v3/ * include/std/complex (complex::complex converting ctor): For C++23 use explicit specifier with constant expression. Explicitly cast both parts to _Tp. (__complex_abs, __complex_arg, __complex_cos, __complex_cosh, __complex_exp, __complex_log, __complex_sin, __complex_sinh, __complex_sqrt, __complex_tan, __complex_tanh, __complex_pow): Add __complex__ _Float{16,32,64,128} and __complex__ decltype(0.0bf16) overloads. (complex<float>::complex converting ctor, complex<double>::complex converting ctor, complex<long double>::complex converting ctor): For C++23 implement as template with explicit specifier with constant expression and explicit casts. (__complex_type): New template. (complex): New partial specialization for types with extended floating point types. (__complex_acos, __complex_asin, __complex_atan, __complex_acosh, __complex_asinh, __complex_atanh): Add __complex__ _Float{16,32,64,128} and __complex__ decltype(0.0bf16) overloads. (__complex_proj): Likewise. Add template for complex of extended floating point types. * include/bits/cpp_type_traits.h (__is_floating): Specialize for _Float{16,32,64,128} and __gnu_cxx::__bfloat16_t. * testsuite/26_numerics/complex/ext_c++23.cc: New test.
2022-10-31btf: Add support to BTF_KIND_ENUM64 typeGuillermo E. Martinez6-15/+84
BTF supports 64-bits enumerators with following encoding: struct btf_type: name_off: 0 or offset to a valid C identifier info.kind_flag: 0 for unsigned, 1 for signed info.kind: BTF_KIND_ENUM64 info.vlen: number of enum values size: 1/2/4/8 The btf_type is followed by info.vlen number of: struct btf_enum64 { uint32_t name_off; /* Offset in string section of enumerator name. */ uint32_t val_lo32; /* lower 32-bit value for a 64-bit value Enumerator */ uint32_t val_hi32; /* high 32-bit value for a 64-bit value Enumerator */ }; So, a new btf_enum64 structure was added to represent BTF_KIND_ENUM64 and a new field dtd_enum_unsigned in ctf_dtdef structure to distinguish when CTF enum is a signed or unsigned type, later that information is used to encode the BTF enum type. gcc/ChangeLog: * btfout.cc (btf_calc_num_vbytes): Compute enumeration size depending of enumerator type btf_enum{,64}. (btf_asm_type): Update btf_kflag according to enumeration type sign using dtd_enum_unsigned field for both: BTF_KIND_ENUM{,64}. (btf_asm_enum_const): New argument to represent the size of the BTF enum type, writing the enumerator constant value for 32 bits, if it's 64 bits then explicitly writes lower 32-bits value and higher 32-bits value. (output_asm_btf_enum_list): Add enumeration size argument. * ctfc.cc (ctf_add_enum): New argument to represent CTF enum basic information. (ctf_add_generic): Use of ei_{name. size, unsigned} to build the dtd structure containing enumeration information. (ctf_add_enumerator): Update comment mention support for BTF enumeration in 64-bits. * dwarf2ctf.cc (gen_ctf_enumeration_type): Extract signedness for enumeration type and use it in ctf_add_enum. * ctfc.h (ctf_dmdef): Update dmd_value to HOST_WIDE_INT to allow use 32/64 bits enumerators. information. (ctf_dtdef): New field to describe enum signedness. include/ * btf.h (btf_enum64): Add new definition and new symbolic constant to BTF_KIND_ENUM64 and BTF_KF_ENUM_{UN,}SIGNED. gcc/testsuite/ChangeLog: * gcc.dg/debug/btf/btf-enum-1.c: Update testcase, with correct info.kflags encoding. * gcc.dg/debug/btf/btf-enum64-1.c: New testcase.
2022-10-31RISC-V: Change constexpr back to CONSTEXPRJu-Zhe Zhong4-11/+11
According to https://github.com/gcc-mirror/gcc/commit/f95d3d5de72a1c43e8d529bad3ef59afc3214705. Since GCC 4.8.6 doesn't support constexpr, we should change it back to CONSTEXPR. gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc: Change constexpr back to CONSTEXPR. * config/riscv/riscv-vector-builtins-shapes.cc (SHAPE): Ditto. * config/riscv/riscv-vector-builtins.cc (struct registered_function_hasher): Ditto. * config/riscv/riscv-vector-builtins.h (struct rvv_arg_type_info): Ditto.
2022-10-31amdgcn: add fmin/fmax patternsAndrew Stubbs2-0/+32
Add fmin/fmax for scalar, vector, and reductions. The smin/smax patterns are already using the IEEE compliant hardware instructions anyway, so we can just expand to use those insns. gcc/ChangeLog: * config/gcn/gcn-valu.md (fminmaxop): New iterator. (<fexpander><mode>3): New define_expand. (<fexpander><mode>3<exec>): Likewise. (reduc_<fexpander>_scal_<mode>): Likewise. * config/gcn/gcn.md (fexpander): New attribute.
2022-10-31amdgcn: multi-size vector reductionsAndrew Stubbs3-94/+45
Add support for vector reductions for any vector width by switching iterators and generalising the code slightly. There's no one-instruction way to move an item from lane 31 to lane 0 (63, 15, 7, 3, and 1 are all fine though), and vec_extract is probably fewer cycles anyway, so now we always reduce to an SGPR. gcc/ChangeLog: * config/gcn/gcn-valu.md (V64_SI): Delete iterator. (V64_DI): Likewise. (V64_1REG): Likewise. (V64_INT_1REG): Likewise. (V64_2REG): Likewise. (V64_ALL): Likewise. (V64_FP): Likewise. (reduc_<reduc_op>_scal_<mode>): Use V_ALL. Use gen_vec_extract. (fold_left_plus_<mode>): Use V_FP. (*<reduc_op>_dpp_shr_<mode>): Use V_1REG. (*<reduc_op>_dpp_shr_<mode>): Use V_DI. (*plus_carry_dpp_shr_<mode>): Use V_INT_1REG. (*plus_carry_in_dpp_shr_<mode>): Use V_SI. (*plus_carry_dpp_shr_<mode>): Use V_DI. (mov_from_lane63_<mode>): Delete. (mov_from_lane63_<mode>): Delete. * config/gcn/gcn.cc (gcn_expand_reduc_scalar): Support partial vectors. * config/gcn/gcn.md (unspec): Remove UNSPEC_MOV_FROM_LANE63.
2022-10-31amdgcn: Silence unused parameter warningAndrew Stubbs1-1/+1
gcc/ChangeLog: * config/gcn/gcn.cc (gcn_simd_clone_compute_vecsize_and_simdlen): Set base_type as ARG_UNUSED.