Skip to content
Snippets Groups Projects
  1. Jul 28, 2023
  2. Jul 27, 2023
    • David Faust's avatar
      bpf: ISA V4 sign-extending move and load insns [PR110782,PR110784] · 14dab1a1
      David Faust authored
      BPF ISA V4 introduces sign-extending move and load operations.  This
      patch makes the BPF backend generate those instructions, when enabled
      and useful.
      
      A new option, -m[no-]smov gates generation of these instructions, and is
      enabled by default for -mcpu=v4 and above.  Tests for the new
      instructions and documentation for the new options are included.
      
      	PR target/110782
      	PR target/110784
      
      gcc/
      
      	* config/bpf/bpf.opt (msmov): New option.
      	* config/bpf/bpf.cc (bpf_option_override): Handle it here.
      	* config/bpf/bpf.md (*extendsidi2): New.
      	(extendhidi2): New.
      	(extendqidi2): New.
      	(extendsisi2): New.
      	(extendhisi2): New.
      	(extendqisi2): New.
      	* doc/invoke.texi (Option Summary): Add -msmov eBPF option.
      	(eBPF Options): Add -m[no-]smov.  Document that -mcpu=v4
      	also enables -msmov.
      
      gcc/testsuite/
      
      	* gcc.target/bpf/sload-1.c: New test.
      	* gcc.target/bpf/sload-pseudoc-1.c: New test.
      	* gcc.target/bpf/smov-1.c: New test.
      	* gcc.target/bpf/smov-pseudoc-1.c: New test.
      14dab1a1
    • David Faust's avatar
      bpf: minor doc cleanup for command-line options · 9cbf4286
      David Faust authored
      This patch makes some minor cleanups to eBPF options documented in
      invoke.texi:
       - Delete some vestigal docs for removed -mkernel option
       - Add -mbswap and -msdiv to the option summary
       - Note the negative versions of several options
       - Note that -mcpu=v4 also enables -msdiv.
      
      gcc/
      
      	* doc/invoke.texi (Option Summary): Remove -mkernel eBPF option.
      	Add -mbswap and -msdiv eBPF options.
      	(eBPF Options): Remove -mkernel.  Add -mno-{jmpext, jmp32,
      	alu32, v3-atomics, bswap, sdiv}.  Document that -mcpu=v4 also
      	enables -msdiv.
      9cbf4286
    • David Faust's avatar
      bpf: correct pseudo-C template for add3 and sub3 · 31d18ff4
      David Faust authored
      The pseudo-C output templates for these instructions were incorrectly
      using operand 1 rather than operand 2 on the RHS, which led to some
      very incorrect assembly generation with -masm=pseudoc.
      
      gcc/
      
      	* config/bpf/bpf.md (add<AM:mode>3): Use %w2 instead of %w1
      	in pseudo-C dialect output template.
      	(sub<AM:mode>3): Likewise.
      
      gcc/testsuite/
      
      	* gcc.target/bpf/alu-2.c: New test.
      	* gcc.target/bpf/alu-pseudoc-2.c: Likewise.
      31d18ff4
    • Jan Hubicka's avatar
      Make store likely in optimize_mask_stores · d023775c
      Jan Hubicka authored
      gcc/ChangeLog:
      
      	* tree-vect-loop.cc (optimize_mask_stores): Make store
      	likely.
      d023775c
    • Jan Hubicka's avatar
      Fix profile update after RTL unrolling · a7d4310a
      Jan Hubicka authored
      This patch fixes profile update after RTL unroll, that is now done same way as
      in tree one.  We still produce (slightly) corrupted profile for multiple exit
      loops I can try to fix incrementally.
      
      I also updated testcases to look for profile mismatches so they do not creep
      back in again.
      
      gcc/ChangeLog:
      
      	* cfgloop.h (single_dom_exit): Declare.
      	* cfgloopmanip.h (update_exit_probability_after_unrolling): Declare.
      	* cfgrtl.cc (struct cfg_hooks): Fix comment.
      	* loop-unroll.cc (unroll_loop_constant_iterations): Update exit edge.
      	* tree-ssa-loop-ivopts.h (single_dom_exit): Do not declare it here.
      	* tree-ssa-loop-manip.cc (update_exit_probability_after_unrolling):
      	Break out from ...
      	(tree_transform_and_unroll_loop): ... here;
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-prof/peel-1.c: Test for profile mismatches.
      	* gcc.dg/tree-prof/unroll-1.c: Test for profile mismatches.
      	* gcc.dg/tree-ssa/peel1.c: Test for profile mismatches.
      	* gcc.dg/unroll-1.c: Test for profile mismatches.
      	* gcc.dg/unroll-3.c: Test for profile mismatches.
      	* gcc.dg/unroll-4.c: Test for profile mismatches.
      	* gcc.dg/unroll-5.c: Test for profile mismatches.
      	* gcc.dg/unroll-6.c: Test for profile mismatches.
      a7d4310a
    • Tobias Burnus's avatar
      OpenMP/Fortran: Extend reject code between target + teams [PR71065, PR110725] · 081e25d3
      Tobias Burnus authored
      The previous version failed to diagnose when the 'teams' was nested
      more deeply inside the target region, e.g. inside a DO or some
      block or structured block.
      
                  PR fortran/110725
                  PR middle-end/71065
      
      gcc/fortran/ChangeLog:
      
      	* openmp.cc (resolve_omp_target): Minor cleanup.
      	* parse.cc (decode_omp_directive): Find TARGET statement
      	also higher in the stack.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/gomp/teams-6.f90: Extend.
      081e25d3
    • Jonathan Wakely's avatar
      libstdc++: Fix std::format alternate form for floating-point [PR108046] · 50bc490c
      Jonathan Wakely authored
      A decimal point was being added to the end of the string for {:#.0}
      because the __expc character was not being set, for the _Pres_none
      presentation type, so __s.find(__expc) didn't the 'e' in "1e+01" and so
      we created "1e+01." by appending the radix char to the end.
      
      This can be fixed by ensuring that __expc='e' is set for the _Pres_none
      case. I realized we can also set __expc='P' and __expc='E' when needed,
      to save a call to std::toupper later.
      
      For the {:#.0g} format, __expc='e' was being set and so the 'e' was
      found in "1e+10" but then __z = __prec - __sigfigs would wraparound to
      SIZE_MAX. That meant we would decide not to add a radix char because the
      number of extra characters to insert would be 1+SIZE_MAX i.e. zero.
      
      This can be fixed by using __z == 0 when __prec == 0.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/108046
      	* include/std/format (__formatter_fp::format): Ensure __expc is
      	always set for all presentation types. Set __z correctly for
      	zero precision.
      	* testsuite/std/format/functions/format.cc: Check problem cases.
      50bc490c
    • Jan Hubicka's avatar
      Fix profile update in tree_transform_and_unroll_loop · 9bd1ee6d
      Jan Hubicka authored
      Fixe profile update in tree_transform_and_unroll_loop which is used
      by predictive comming.  I stared by attempt to fix
      gcc.dg/tree-ssa/update-unroll-1.c I xfailed last week, but it turned to be
      harder job.
      
      Unrolling was never fixed for changes in duplicate_loop_body_to_header_edge
      which is now smarter on getting profile right when some exists are eliminated.
      A lot of manual profile can thus now be done using existing infrastructure.
      
      I also noticed that scale_dominated_blocks_in_loop does job identical
      to loop I wrote in scale_loop_profile and thus I commonized the implementaiton
      and removed recursion.
      
      I also extended duplicate_loop_body_to_header_edge to handle flat profiles same
      way as we do in vectorizer. Without it we end up with less then 0 iteration
      count in gcc.dg/tree-ssa/update-unroll-1.c (it is unrolled 32times but predicted
      to iterated fewer times) and added missing code to update loop_info.
      
      gcc/ChangeLog:
      
      	* cfgloopmanip.cc (scale_dominated_blocks_in_loop): Move here from
      	tree-ssa-loop-manip.cc and avoid recursion.
      	(scale_loop_profile): Use scale_dominated_blocks_in_loop.
      	(duplicate_loop_body_to_header_edge): Add DLTHE_FLAG_FLAT_PROFILE
      	flag.
      	* cfgloopmanip.h (DLTHE_FLAG_FLAT_PROFILE): Define.
      	(scale_dominated_blocks_in_loop): Declare.
      	* predict.cc (dump_prediction): Do not ICE on uninitialized probability.
      	(change_edge_frequency): Remove.
      	* predict.h (change_edge_frequency): Remove.
      	* tree-ssa-loop-manip.cc (scale_dominated_blocks_in_loop): Move to
      	cfgloopmanip.cc.
      	(niter_for_unrolled_loop): Remove.
      	(tree_transform_and_unroll_loop): Fix profile update.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/pr102385.c: Check for no profile mismatches.
      	* gcc.dg/pr96931.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-1.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-2.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-3.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-4.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-5.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-7.c: Check for one profile mismatch.
      	* gcc.dg/tree-ssa/predcom-8.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-1.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-10.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-11.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-12.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-2.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-3.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-4.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-5.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-6.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-7.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-8.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/predcom-dse-9.c: Check for no profile mismatches.
      	* gcc.dg/tree-ssa/update-unroll-1.c: Unxfail.
      9bd1ee6d
    • Jan Hubicka's avatar
      Fix profile update in tree-ssa-loop-im.cc · 5b06b3b8
      Jan Hubicka authored
      This fixes two bugs in tree-ssa-loop-im.cc.  First is that cap probability is not
      reliable, but it is constructed with adjusted quality.  Second is that sometimes
      the conditional has wrong joiner BB count.  This is visible on
      testsuite/gcc.dg/pr102385.c however the testcase triggers another profile
      update bug in pcom, so I will update it in followup patch.
      
      gcc/ChangeLog:
      
      	* tree-ssa-loop-im.cc (execute_sm_if_changed): Turn cap probability
      	to guessed; fix count of new_bb.
      5b06b3b8
    • Jan Hubicka's avatar
      Fix profile_count::apply_probability · 499b8079
      Jan Hubicka authored
      profile_count::apply_probability misses check for uninitialized probability which leads
      to completely random results on applying uninitialized probability to initialized scale.
      This can make difference when i.e. inlining -fno-guess-branch-probability function
      to -fguess-branch-probability one.
      
      gcc/ChangeLog:
      
      	* profile-count.h (profile_count::apply_probability): Fix
      	handling of uninitialized probabilities, optimize scaling
      	by probability 1.
      499b8079
    • Richard Biener's avatar
      tree-optimization/91838 - fix FAIL of g++.dg/opt/pr91838.C · d1c072a1
      Richard Biener authored
      The following fixes the lack of simplification of a vector shift
      by an out-of-bounds shift value.  For scalars this is done both
      by CCP and VRP but vectors are not handled there.  This results
      in PR91838 differences in outcome dependent on whether a vector
      shift ISA is available and thus vector lowering does or does not
      expose scalar shifts here.
      
      The following adds a match.pd pattern to catch uniform out-of-bound
      shifts, simplifying them to zero when not sanitizing shift amounts.
      
      	PR tree-optimization/91838
      	* gimple-match-head.cc: Include attribs.h and asan.h.
      	* generic-match-head.cc: Likewise.
      	* match.pd (([rl]shift @0 out-of-bounds) -> zero): New pattern.
      d1c072a1
    • Patrick Palka's avatar
      c++: constexpr empty subobject elision [PR110197] · a426b91b
      Patrick Palka authored
      Now that init_subob_ctx no longer sets new_ctx.ctor for a subobject of
      empty type, it seems we need to ensure its callers also consistently
      omit entries in the parent ctx->ctor for such subobjects.  We also need
      to allow cxx_eval_array_reference to synthesize an empty subobject even
      if the array CONSTRUCTOR has CONSTRUCTOR_NO_CLEARING set.
      
      	PR c++/110197
      
      gcc/cp/ChangeLog:
      
      	* constexpr.cc (cxx_eval_array_reference): Allow synthesizing an
      	empty subobject even if CONSTRUCTOR_NO_CLEARING is set.
      	(cxx_eval_bare_aggregate): Set 'no_slot' to true more generally
      	whenever new_ctx.ctor is set to NULL_TREE by init_subob_ctx,
      	i.e. whenever initializing an subobject of empty type.
      	(cxx_eval_vec_init_1): Define 'no_slot' as above and use it
      	accordingly.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/constexpr-empty18.C: New test.
      	* g++.dg/cpp0x/constexpr-empty19.C: New test.
      a426b91b
    • Juzhe-Zhong's avatar
      RISC-V: Enable basic VLS modes support · 33b153ff
      Juzhe-Zhong authored
      Support && Test VLS modes load/store/reg move as well as LRA spilling
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-modes.def (VECTOR_BOOL_MODE): Add VLS modes.
      	(ADJUST_ALIGNMENT): Ditto.
      	(ADJUST_PRECISION): Ditto.
      	(VLS_MODES): Ditto.
      	(VECTOR_MODE_WITH_PREFIX): Ditto.
      	* config/riscv/riscv-opts.h (TARGET_VECTOR_VLS): New macro.
      	* config/riscv/riscv-protos.h (riscv_v_ext_vls_mode_p): New function.
      	* config/riscv/riscv-v.cc (INCLUDE_ALGORITHM): Add include.
      	(legitimize_move): Enable basic VLS modes support.
      	(get_vlmul): Ditto.
      	(get_ratio): Ditto.
      	(get_vector_mode): Ditto.
      	* config/riscv/riscv-vector-switch.def (VLS_ENTRY): Add vls modes.
      	* config/riscv/riscv.cc (riscv_v_ext_vls_mode_p): New function.
      	(VLS_ENTRY): New macro.
      	(riscv_v_ext_mode_p): Add vls modes.
      	(riscv_get_v_regno_alignment): New function.
      	(riscv_print_operand): Add vls modes.
      	(riscv_hard_regno_nregs): Ditto.
      	(riscv_hard_regno_mode_ok): Ditto.
      	(riscv_regmode_natural_size): Ditto.
      	(riscv_vectorize_preferred_vector_alignment): Ditto.
      	* config/riscv/riscv.md: Ditto.
      	* config/riscv/vector-iterators.md: Ditto.
      	* config/riscv/vector.md: Ditto.
      	* config/riscv/autovec-vls.md: New file.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/partial/slp-9.c: Add more checks.
      	* gcc.target/riscv/rvv/rvv.exp: Add VLS modes tests.
      	* gcc.target/riscv/rvv/autovec/vls/def.h: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-10.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-11.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-12.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-13.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-14.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-15.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-16.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-17.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-3.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-4.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-7.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-8.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/mov-9.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/spill-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/spill-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/spill-3.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/spill-4.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/spill-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/spill-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls/spill-7.c: New test.
      33b153ff
    • Pan Li's avatar
      RISC-V: Remove unnecessary vread_csr/vwrite_csr intrinsic. · d0ae71c2
      Pan Li authored
      According to below RVV doc, the related intrinsic is not longer needed.
      
      https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/249
      
      
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv_vector.h (enum RVV_CSR): Removed.
      	(vread_csr): Ditto.
      	(vwrite_csr): Ditto.
      d0ae71c2
    • demin.han's avatar
      RISC-V: Fix uninitialized and redundant use of which_alternative · cdc65458
      demin.han authored
      
      When pass split2 starts, which_alternative is random depending on
      last set of certain pass.
      
      Even initialized, the generated movement is redundant.
      The movement can be generated by assembly output template.
      
      Signed-off-by: default avatardemin.han <demin.han@starfivetech.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec.md: Delete which_alternative use in split
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/madd-split2-1.c: New test.
      Signed-off-by: default avatardemin.han <demin.han@starfivetech.com>
      cdc65458
    • Richard Biener's avatar
      XFAIL parts broken deliberately by r13-1762-gf9d4c3b45c5ed5 · 41482832
      Richard Biener authored
      The following XFAILs recognizing a complex store as memset.
      
      	PR tree-optimization/110829
      	* gcc.dg/pr56837.c: XFAIL part of the testcase.
      41482832
    • Richard Biener's avatar
      Remove recursive post-dominator traversal in sinking · e7cda6ef
      Richard Biener authored
      The following turns the recursive post-dominator traversal in GIMPLE
      code sinking to a worklist.
      
      	* tree-ssa-sink.cc (sink_code_in_bb): Remove recursion, instead
      	use a worklist ...
      	(pass_sink_code::execute): ... in the caller.
      e7cda6ef
    • Nathaniel Shead's avatar
      c++: Fix ICE with parameter pack of decltype(auto) [PR103497] · ca912a39
      Nathaniel Shead authored
      
      This patch ensures 'type_uses_auto' also checks for usages of 'auto' in
      parameter packs.
      
      	PR c++/103497
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (type_uses_auto): Check inside parameter packs.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1y/decltype-auto-103497.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      ca912a39
    • Kewen Lin's avatar
      vect: Treat VMAT_ELEMENTWISE as scalar load in costing [PR110776] · 9890d4e8
      Kewen Lin authored
      
      PR110776 exposes one issue that we could query unaligned
      load for vector type but actually no unaligned vector load
      is supported there.  The reason is that the costed load is
      with single-lane vector type and its memory access type is
      VMAT_ELEMENTWISE, we actually take it as scalar load and
      set its alignment_support_scheme as dr_unaligned_supported.
      
      To avoid the ICE as exposed, following Rich's suggestion,
      this patch is to make VMAT_ELEMENTWISE be costed as scalar
      load.
      
      Co-authored-by: default avatarRichard Biener <rguenther@suse.de>
      
      	PR tree-optimization/110776
      
      gcc/ChangeLog:
      
      	* tree-vect-stmts.cc (vectorizable_load): Always cost VMAT_ELEMENTWISE
      	as scalar load.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/powerpc/pr110776.c: New test.
      9890d4e8
    • Jeff Law's avatar
      [committed] [RISC-V] Fix expected diagnostic messages in testsuite · 6f709f79
      Jeff Law authored
      Whoops, this should have gone in with the fixes to the RISC-V
      diagnostics from earlier this week.
      
      gcc/testsuite
      	* gcc.target/riscv/arch-23.c: Update expected diagnostic messages.
      	* gcc.target/riscv/pr102957.c: Likewise.
      6f709f79
    • GCC Administrator's avatar
      Daily bump. · 5278cd6a
      GCC Administrator authored
      5278cd6a
  3. Jul 26, 2023
    • Patrick Palka's avatar
      c++: passing partially inst ttp as ttp [PR110566] · b8218eb2
      Patrick Palka authored
      The previous fix doesn't work for partially instantiated ttps mainly
      because most_general_template is a no-op for them.  This patch fixes
      this by giving such ttps a DECL_TEMPLATE_INFO (extending the
      r11-734-g2fb595f8348e16 fix) with which most_general_template can obtain
      the original, unlowered ttp.
      
      This patch additionally makes coerce_template_template_parms use the
      correct amount of levels from the scope of a ttp argument.
      
      	PR c++/110566
      	PR c++/108179
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (reduce_template_parm_level): Set DECL_TEMPLATE_INFO
      	on the DECL_TEMPLATE_RESULT of the new ttp.
      	(add_defaults_to_ttp): Make a copy of the original ttp's
      	DECL_TEMPLATE_RESULT, and update this copy's DECL_TEMPLATE_INFO
      	as well.
      	(coerce_template_template_parms): Make sure 'scope_args' has
      	the right amount of levels for the ttp argument.
      	(most_general_template): Handle template template parameters.
      	(rewrite_template_parm): Set DECL_TEMPLATE_RESULT on the
      	DECL_TEMPLATE_RESULT of the new ttp.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1z/class-deduction115.C: New test.
      	* g++.dg/template/ttp39.C: New test.
      b8218eb2
    • Patrick Palka's avatar
      c++: passing partially inst tmpl as ttp [PR110566] · b3adcc60
      Patrick Palka authored
      Since the template arguments 'pargs' we pass to coerce_template_parms from
      coerce_template_template_parms are always a full set, we need to make sure
      we always pass the parameters of the most general template because if the
      template is partially instantiated then the levels won't match up.  In the
      testcase below during said call to coerce_template_parms the parameters are
      {X, Y}, both level 1 rather than 2, and the arguments are {{int}, {N, M}},
      which results in a crash during auto deduction for parameters' types.
      
      	PR c++/110566
      	PR c++/108179
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (coerce_template_template_parms): Simplify by using
      	DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
      	Always pass the parameters of the most general template to
      	coerce_template_parms.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/template/ttp38.C: New test.
      b3adcc60
    • Xiao Zeng's avatar
      [PATCH 2/5] [RISC-V] Generate Zicond instruction for basic semantics · 74290c66
      Xiao Zeng authored
      
      This patch completes the recognition of the basic semantics
      defined in the spec, namely:
      
      Conditional zero, if condition is equal to zero
        rd = (rs2 == 0) ? 0 : rs1
      Conditional zero, if condition is non zero
        rd = (rs2 != 0) ? 0 : rs1
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv.md: Include zicond.md
      	* config/riscv/zicond.md: New file.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/zicond-primitiveSemantics.c: New test.
      
      Co-authored-by: default avatarPhilipp Tomsich <philipp.tomsich@vrull.eu>
      Co-authored-by: default avatarRaphael Zinsly <rzinsly@ventanamicro.com>
      Co-authored-by: default avatarJeff Law <jlaw@ventanamicro.com>
      74290c66
    • Xiao Zeng's avatar
      [PATCH 1/5] [RISC-V] Recognize Zicond extension · aee2817e
      Xiao Zeng authored
      
      gcc/ChangeLog:
      
      	* common/config/riscv/riscv-common.cc: New extension.
      	* config/riscv/riscv-opts.h (MASK_ZICOND): New mask.
      	(TARGET_ZICOND): New target.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/attribute-20.c: New test.
      	* gcc.target/riscv/attribute-21.c: New test.
      
      Co-authored-by: default avatarPhilipp Tomsich <philipp.tomsich@vrull.eu>
      aee2817e
    • Patrick Palka's avatar
      c++: unifying REAL_CSTs [PR110809] · 744e1f35
      Patrick Palka authored
      This teaches unify how to compare two REAL_CSTs.
      
      	PR c++/110809
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (unify) <case INTEGER_CST>: Generalize to handle
      	REAL_CST as well.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp2a/nontype-float3.C: New test.
      744e1f35
    • Harald Anlauf's avatar
      Fortran: diagnose strings of non-constant length in DATA statements [PR68569] · 27ba7364
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/68569
      	* resolve.cc (check_data_variable): Do not accept strings with
      	deferred length or non-constant length in a DATA statement.
      	Reject also substrings of string variables of non-constant length.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/68569
      	* gfortran.dg/data_char_4.f90: Adjust expected diagnostic.
      	* gfortran.dg/data_char_5.f90: Likewise.
      	* gfortran.dg/data_char_6.f90: New test.
      27ba7364
    • Joseph Myers's avatar
      Update gcc uk.po · 15a122db
      Joseph Myers authored
      	* uk.po: Update.
      15a122db
    • Joseph Myers's avatar
      Regenerate gcc.pot · 1c362a8e
      Joseph Myers authored
      	* gcc.pot: Regenerate.
      1c362a8e
    • Jonathan Wakely's avatar
      libstdc++: Require C++11 for 23_containers/vector/bool/110807.cc [PR110807] · f30e62b0
      Jonathan Wakely authored
      This new test uses uniform initialization syntax, so requires C++11 or
      later.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110807
      	* testsuite/23_containers/vector/bool/110807.cc: Require c++11.
      f30e62b0
    • Carl Love's avatar
      rs6000, add argument to function find_instance · 3fce8097
      Carl Love authored
      The function find_instance assumes it is called to check a built-in with
      only two arguments.  This patch extends the function by adding a parameter
      specifying the number of built-in arguments to check.
      
      Note, this patch was supposed to have been applied before commit:
      
        commit b51795c8
        Author: Carl Love <cel@us.ibm.com>
        Date:   Wed Jul 26 11:31:53 2023 -0400
      
            rs6000, fix vec_replace_unaligned built-in arguments
             ...
      
      gcc/ChangeLog:
      	* config/rs6000/rs6000-c.cc (find_instance): Add new parameter that
      	specifies the number of built-in arguments to check.
      	(altivec_resolve_overloaded_builtin): Update calls to find_instance
      	to pass the number of built-in arguments to be checked.
      3fce8097
    • Marek Polacek's avatar
      c++: cp_parser_constant_expression cleanups · 5bd02d91
      Marek Polacek authored
      It's pointless to call *_rvalue_constant_expression when we're not using
      the result.  Also apply some drive-by cleanups.
      
      gcc/cp/ChangeLog:
      
      	* parser.cc (cp_parser_constant_expression): Allow non_constant_p to be
      	nullptr even when allow_non_constant_p is true.  Don't call
      	_rvalue_constant_expression when not necessary.  Move local variable
      	declarations closer to their first use.
      	(cp_parser_static_assert): Don't pass a dummy down to
      	cp_parser_constant_expression.
      5bd02d91
    • Jason Merrill's avatar
      c++: member vs global template [PR106310] · 51b997ea
      Jason Merrill authored
      For backward compatibility we still want to allow patterns like
      this->A<T>::foo, but the template keyword in a qualified name is
      specifically to specify that a dependent name is a template, so don't look
      in the enclosing scope at all.
      
      Also fix handling of dependent bases: if member lookup in the current
      instantiation fails and we have dependent bases, the lookup is dependent.
      We were already handling that for the case where lookup in the enclosing
      scope also fails, but we also want it to affect that lookup itself.
      
      	PR c++/106310
      
      gcc/cp/ChangeLog:
      
      	* parser.cc (cp_parser_template_name): Skip non-member
      	lookup after the template keyword.
      	(cp_parser_lookup_name): Pass down template_keyword_p.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/template/template-keyword4.C: New test.
      51b997ea
    • David Faust's avatar
      bpf: add v3 atomic instructions · db189d02
      David Faust authored
      This patch adds support for the general atomic operations introduced in
      eBPF v3. In addition to the existing atomic add instruction, this adds:
       - Atomic and, or, xor
       - Fetching versions of these operations (including add)
       - Atomic exchange
       - Atomic compare-and-exchange
      
      To control emission of these instructions, a new target option
      -m[no-]v3-atomics is added. This option is enabled by -mcpu=v3
      and above.
      
      Support for these instructions was recently added in binutils.
      
      gcc/
      
      	* config/bpf/bpf.opt (mv3-atomics): New option.
      	* config/bpf/bpf.cc (bpf_option_override): Handle it here.
      	* config/bpf/bpf.h (enum_reg_class): Add R0 class.
      	(REG_CLASS_NAMES): Likewise.
      	(REG_CLASS_CONTENTS): Likewise.
      	(REGNO_REG_CLASS): Handle R0.
      	* config/bpf/bpf.md (UNSPEC_XADD): Rename to UNSPEC_AADD.
      	(UNSPEC_AAND): New unspec.
      	(UNSPEC_AOR): Likewise.
      	(UNSPEC_AXOR): Likewise.
      	(UNSPEC_AFADD): Likewise.
      	(UNSPEC_AFAND): Likewise.
      	(UNSPEC_AFOR): Likewise.
      	(UNSPEC_AFXOR): Likewise.
      	(UNSPEC_AXCHG): Likewise.
      	(UNSPEC_ACMPX): Likewise.
      	(atomic_add<mode>): Use UNSPEC_AADD and atomic type attribute.
      	Move to...
      	* config/bpf/atomic.md: ...Here. New file.
      	* config/bpf/constraints.md (t): New constraint for R0.
      	* doc/invoke.texi (eBPF Options): Document -mv3-atomics.
      
      gcc/testsuite/
      
      	* gcc.target/bpf/atomic-cmpxchg-1.c: New test.
      	* gcc.target/bpf/atomic-cmpxchg-2.c: New test.
      	* gcc.target/bpf/atomic-fetch-op-1.c: New test.
      	* gcc.target/bpf/atomic-fetch-op-2.c: New test.
      	* gcc.target/bpf/atomic-fetch-op-3.c: New test.
      	* gcc.target/bpf/atomic-op-1.c: New test.
      	* gcc.target/bpf/atomic-op-2.c: New test.
      	* gcc.target/bpf/atomic-op-3.c: New test.
      	* gcc.target/bpf/atomic-xchg-1.c: New test.
      	* gcc.target/bpf/atomic-xchg-2.c: New test.
      db189d02
    • Jonathan Wakely's avatar
      libstdc++: Avoid bogus overflow warnings in std::vector<bool> [PR110807] · 7931a1de
      Jonathan Wakely authored
      GCC thinks the allocation can alter the object being copied if it's
      globally reachable, so doesn't realize that [x.begin(), x.end()) after
      the allocation is the same as x.size() before it.
      
      This causes a testsuite failure when testing with -D_GLIBCXX_DEBUG:
      FAIL: 23_containers/vector/bool/swap.cc (test for excess errors)
      A fix is to move the calls to x.begin() and x.end() to before the
      allocation.
      
      A similar problem exists in vector<bool>::_M_insert_range where *this is
      globally reachable, as reported in PR libstdc++/110807. That can also be
      fixed by moving calls to begin() and end() before the allocation.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110807
      	* include/bits/stl_bvector.h (vector(const vector&)): Access
      	iterators before allocating.
      	* include/bits/vector.tcc (vector<bool>::_M_insert_range):
      	Likewise.
      	* testsuite/23_containers/vector/bool/110807.cc: New test.
      7931a1de
    • Jonathan Wakely's avatar
      libstdc++: Add deprecated attribute to std::random_shuffle declarations · c01b344e
      Jonathan Wakely authored
      We already have these attributes on the definitions in <bits/stl_algo.h>
      but they don't work due to PR c++/84542. Add the attributes to the
      declarations in <bits/algorithmfwd.h> as well, and add a test.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/algorithmfwd.h (random_shuffle): Add deprecated
      	attribute.
      	* include/bits/stl_algo.h (random_shuffle): Correct comments.
      	* testsuite/25_algorithms/random_shuffle/1.cc: Disable
      	deprecated warnings.
      	* testsuite/25_algorithms/random_shuffle/59603.cc: Likewise.
      	* testsuite/25_algorithms/random_shuffle/moveable.cc: Likewise.
      	* testsuite/25_algorithms/random_shuffle/deprecated.cc: New
      	test.
      c01b344e
    • Matthew Malcomson's avatar
      [committed] Add check_vect in a testcase · d74aed3d
      Matthew Malcomson authored
      Also reformat a comment that had too long lines.
      Commit c5bd0e58 introduced both these problems to fix.
      
      Committed as obvious after ensuring that when running the testcase on
      AArch64 it still fails before the original c5bd0e58 commit and passes
      after it.
      
      gcc/ChangeLog:
      
      	* tree-vect-stmts.cc (get_group_load_store_type): Reformat
      	comment.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/vect-multi-peel-gaps.c: Add `check_vect` call into
      	`main` of this testcase.
      d74aed3d
    • Carl Love's avatar
      rs6000, fix vec_replace_unaligned built-in arguments · b51795c8
      Carl Love authored
      The first argument of the vec_replace_unaligned built-in should always be
      of type vector unsigned char, as specified in gcc/doc/extend.texi.
      
      This patch fixes the builtin definitions and updates the test cases to use
      the correct arguments.  The original test file is renamed and a second test
      file is added for a new test case.
      
      gcc/ChangeLog:
      	* config/rs6000/rs6000-builtins.def: Rename
      	__builtin_altivec_vreplace_un_uv2di as __builtin_altivec_vreplace_un_udi
      	__builtin_altivec_vreplace_un_uv4si as __builtin_altivec_vreplace_un_usi
      	__builtin_altivec_vreplace_un_v2df as __builtin_altivec_vreplace_un_df
      	__builtin_altivec_vreplace_un_v2di as __builtin_altivec_vreplace_un_di
      	__builtin_altivec_vreplace_un_v4sf as __builtin_altivec_vreplace_un_sf
      	__builtin_altivec_vreplace_un_v4si as __builtin_altivec_vreplace_un_si.
      	Rename VREPLACE_UN_UV2DI as VREPLACE_UN_UDI, VREPLACE_UN_UV4SI as
      	VREPLACE_UN_USI, VREPLACE_UN_V2DF as VREPLACE_UN_DF,
      	VREPLACE_UN_V2DI as VREPLACE_UN_DI, VREPLACE_UN_V4SF as
      	VREPLACE_UN_SF, VREPLACE_UN_V4SI as VREPLACE_UN_SI.
      	Rename vreplace_un_v2di as vreplace_un_di, vreplace_un_v4si as
      	vreplace_un_si, vreplace_un_v2df as vreplace_un_df,
      	vreplace_un_v2di as vreplace_un_di, vreplace_un_v4sf as
      	vreplace_un_sf, vreplace_un_v4si as vreplace_un_si.
      	* config/rs6000/rs6000-c.cc (find_instance): Add case
      	RS6000_OVLD_VEC_REPLACE_UN.
      	* config/rs6000/rs6000-overload.def (__builtin_vec_replace_un):
      	Fix first argument type.  Rename VREPLACE_UN_UV4SI as
      	VREPLACE_UN_USI, VREPLACE_UN_V4SI as VREPLACE_UN_SI,
      	VREPLACE_UN_UV2DI as VREPLACE_UN_UDI, VREPLACE_UN_V2DI as
      	VREPLACE_UN_DI, VREPLACE_UN_V4SF as VREPLACE_UN_SF,
      	VREPLACE_UN_V2DF as VREPLACE_UN_DF.
      	* config/rs6000/vsx.md (REPLACE_ELT): Rename the mode_iterator
      	REPLACE_ELT_V for vector modes.
      	(REPLACE_ELT): New scalar mode iterator.
      	(REPLACE_ELT_char): Add scalar attributes.
      	(vreplace_un_<mode>): Change iterator and mode attribute.
      
      gcc/testsuite/ChangeLog:
      	* gcc.target/powerpc/vec-replace-word-runnable.c: Renam
      	vec-replace-word-runnable_1.c.
      	* gcc.target/powerpc/vec-replace-word-runnable_1.c
      	(dg-options): add -flax-vector-conversions.
      	(vec_replace_unaligned) Fix first argument type.
      	(vresult_uchar): Fix expected results.
      	(vec_replace_unaligned): Update for loop to check uchar results.
      	Remove extra spaces in if statements. Insert missing spaces in
      	for statements.
      	* gcc.target/powerpc/vec-replace-word-runnable_2.c: New test file.
      b51795c8
    • David Malcolm's avatar
      analyzer: add symbol base class, moving region id to there [PR104940] · 9d804f9b
      David Malcolm authored
      
      This patch introduces a "symbol" base class that region and svalue
      both inherit from, generalizing the ID from the region class so it's
      also used by svalues.  This gives a way of sorting regions and svalues
      into creation order, which I've found useful in my experiments with
      adding SMT support (PR analyzer/104940).
      
      gcc/ChangeLog:
      	PR analyzer/104940
      	* Makefile.in (ANALYZER_OBJS): Add analyzer/symbol.o.
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/104940
      	* region-model-manager.cc
      	(region_model_manager::region_model_manager): Update for
      	generalizing region ids to also cover svalues.
      	(region_model_manager::get_or_create_constant_svalue): Likewise.
      	(region_model_manager::get_or_create_unknown_svalue): Likewise.
      	(region_model_manager::create_unique_svalue): Likewise.
      	(region_model_manager::get_or_create_initial_value): Likewise.
      	(region_model_manager::get_or_create_setjmp_svalue): Likewise.
      	(region_model_manager::get_or_create_poisoned_svalue): Likewise.
      	(region_model_manager::get_ptr_svalue): Likewise.
      	(region_model_manager::get_or_create_unaryop): Likewise.
      	(region_model_manager::get_or_create_binop): Likewise.
      	(region_model_manager::get_or_create_sub_svalue): Likewise.
      	(region_model_manager::get_or_create_repeated_svalue): Likewise.
      	(region_model_manager::get_or_create_bits_within): Likewise.
      	(region_model_manager::get_or_create_unmergeable): Likewise.
      	(region_model_manager::get_or_create_widening_svalue): Likewise.
      	(region_model_manager::get_or_create_compound_svalue): Likewise.
      	(region_model_manager::get_or_create_conjured_svalue): Likewise.
      	(region_model_manager::get_or_create_asm_output_svalue): Likewise.
      	(region_model_manager::get_or_create_const_fn_result_svalue):
      	Likewise.
      	(region_model_manager::get_region_for_fndecl): Likewise.
      	(region_model_manager::get_region_for_label): Likewise.
      	(region_model_manager::get_region_for_global): Likewise.
      	(region_model_manager::get_field_region): Likewise.
      	(region_model_manager::get_element_region): Likewise.
      	(region_model_manager::get_offset_region): Likewise.
      	(region_model_manager::get_sized_region): Likewise.
      	(region_model_manager::get_cast_region): Likewise.
      	(region_model_manager::get_frame_region): Likewise.
      	(region_model_manager::get_symbolic_region): Likewise.
      	(region_model_manager::get_region_for_string): Likewise.
      	(region_model_manager::get_bit_range): Likewise.
      	(region_model_manager::get_var_arg_region): Likewise.
      	(region_model_manager::get_region_for_unexpected_tree_code):
      	Likewise.
      	(region_model_manager::get_or_create_region_for_heap_alloc):
      	Likewise.
      	(region_model_manager::create_region_for_alloca): Likewise.
      	(region_model_manager::log_stats): Likewise.
      	* region-model-manager.h (region_model_manager::get_num_regions):
      	Replace with...
      	(region_model_manager::get_num_symbols): ...this.
      	(region_model_manager::alloc_region_id): Replace with...
      	(region_model_manager::alloc_symbol_id): ...this.
      	(region_model_manager::m_next_region_id): Replace with...
      	(region_model_manager::m_next_symbol_id): ...this.
      	* region-model.cc (selftest::test_get_representative_tree): Update
      	for generalizing region ids to also cover svalues.
      	(selftest::test_binop_svalue_folding): Likewise.
      	(selftest::test_state_merging): Likewise.
      	* region.cc (region::cmp_ids): Delete, in favor of
      	symbol::cmp_ids.
      	(region::region): Update for introduction of symbol base class.
      	(frame_region::get_region_for_local): Likewise.
      	(root_region::root_region): Likewise.
      	(symbolic_region::symbolic_region): Likewise.
      	* region.h: Replace include of "analyzer/complexity.h" with
      	"analyzer/symbol.h".
      	(class region): Make a subclass of symbol.
      	(region::get_id): Delete in favor of symbol::get_id.
      	(region::cmp_ids): Delete in favor of symbol::cmp_ids.
      	(region::get_complexity): Delete in favor of
      	symbol::get_complexity.
      	(region::region): Use symbol::id_t for "id" param.
      	(region::m_complexity): Move field to symbol base class.
      	(region::m_id): Likewise.
      	(space_region::space_region): Use symbol::id_t for "id" param.
      	(frame_region::frame_region): Likewise.
      	(globals_region::globals_region): Likewise.
      	(code_region::code_region): Likewise.
      	(function_region::function_region): Likewise.
      	(label_region::label_region): Likewise.
      	(stack_region::stack_region): Likewise.
      	(heap_region::heap_region): Likewise.
      	(thread_local_region::thread_local_region): Likewise.
      	(root_region::root_region): Likewise.
      	(symbolic_region::symbolic_region): Likewise.
      	(decl_region::decl_region): Likewise.
      	(field_region::field_region): Likewise.
      	(element_region::element_region): Likewise.
      	(offset_region::offset_region): Likewise.
      	(sized_region::sized_region): Likewise.
      	(cast_region::cast_region): Likewise.
      	(heap_allocated_region::heap_allocated_region): Likewise.
      	(alloca_region::alloca_region): Likewise.
      	(string_region::string_region): Likewise.
      	(bit_range_region::bit_range_region): Likewise.
      	(var_arg_region::var_arg_region): Likewise.
      	(errno_region::errno_region): Likewise.
      	(unknown_region::unknown_region): Likewise.
      	* svalue.cc (sub_svalue::sub_svalue): Add symbol::id_t param.
      	(repeated_svalue::repeated_svalue): Likewise.
      	(bits_within_svalue::bits_within_svalue): Likewise.
      	(compound_svalue::compound_svalue): Likewise.
      	* svalue.h: Replace include of "analyzer/complexity.h" with
      	"analyzer/symbol.h".
      	(class svalue): Make a subclass of symbol.
      	(svalue::get_complexity): Delete in favor of
      	symbol::get_complexity.
      	(svalue::svalue): Add symbol::id_t param.  Update for new base
      	class.
      	(svalue::m_complexity): Delete in favor of
      	symbol::m_complexity.
      	(region_svalue::region_svalue): Add symbol::id_t param
      	(constant_svalue::constant_svalue): Likewise.
      	(unknown_svalue::unknown_svalue): Likewise.
      	(poisoned_svalue::poisoned_svalue): Likewise.
      	(setjmp_svalue::setjmp_svalue): Likewise.
      	(initial_svalue::initial_svalue): Likewise.
      	(unaryop_svalue::unaryop_svalue): Likewise.
      	(binop_svalue::binop_svalue): Likewise.
      	(sub_svalue::sub_svalue): Likewise.
      	(repeated_svalue::repeated_svalue): Likewise.
      	(bits_within_svalue::bits_within_svalue): Likewise.
      	(unmergeable_svalue::unmergeable_svalue): Likewise.
      	(placeholder_svalue::placeholder_svalue): Likewise.
      	(widening_svalue::widening_svalue): Likewise.
      	(compound_svalue::compound_svalue): Likewise.
      	(conjured_svalue::conjured_svalue): Likewise.
      	(asm_output_svalue::asm_output_svalue): Likewise.
      	(const_fn_result_svalue::const_fn_result_svalue): Likewise.
      	* symbol.cc: New file.
      	* symbol.h: New file.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      9d804f9b
Loading