Skip to content
Snippets Groups Projects
  1. Mar 24, 2023
    • Alexandre Oliva's avatar
      [testsuite] test for weak_undefined support and add options · 378ec7b8
      Alexandre Oliva authored
      A number of tests that depend on weak undefined symbols fail to
      require that support, and arrange to skip some targets and add special
      options to others on a test-by-test basis.  Fix this by stating the
      requirement explicitly, and adding a proc to return any required
      options.
      
      Others rely on weak undefined symbols only to test for the
      availability of posix_memalign.  Drop that in favor of dg effective
      target support for posix_memalign.
      
      
      for  gcc/ChangeLog
      
      	* doc/sourcebuild.texi (weak_undefined, posix_memalign):
      	Document options and effective targets.
      
      for  gcc/testsuite/ChangeLog
      
      	* lib/target-supports.exp (add_options_for_weak_undefined):
      	New.
      	(check_effective_target_weak_undefined): Use it.
      	(check_effective_target_posix_memalign): New.
      	* gcc.dg/torture/pr53922.c: Drop skips and custom options in
      	favor of effective target requirement and added options for
      	weak_undefined symbols.
      	* gcc.dg/torture/pr90020.c: Likewise.
      	* gcc.dg/addr_equal-1.c: Likewise.
      	* gcc.target/aarch64/aapcs64/aapcs64.exp: Likewise, for
      	abitest.S-using tests.
      	* gcc.dg/torture/pr60092.c: Likewise, but in favor of
      	posix_memalign tests.
      	* gcc.dg/vect/vect-tail-nomask-1.c: Likewise.
      378ec7b8
    • Haochen Gui's avatar
      Fortran: Escalate failure when Hollerith constant to real conversion fails · 3b67db31
      Haochen Gui authored
      
      gcc/fortran/
      	PR target/103628
      	* target-memory.cc (gfc_interpret_float): Return FAIL when
      	native_interpret_expr gets a NULL tree.
      	* arith.cc (gfc_hollerith2real): Return NULL when
      	gfc_interpret_float fails.
      	* error.cc (gfc_buffered_p): Define.
      	* gfortran.h (gfc_buffered_p): Declare.
      	* intrinsic.cc: Add diagnostic.h to include list.
      	(do_simplify): Save errorcount and check it at finish.  Report a
      	"Cannot simplify expression" error on a bad result if error count
      	doesn't change and no other errors buffered.
      
      gcc/testsuite/
      	PR target/103628
      	* gfortran.dg/assumed_size_refs_2.f90: Check "Cannot simplify
      	expression" error.
      	* gfortran.dg/unpack_field_1.f90: Likewise.
      	* gfortran.dg/pr103628.f90: New.
      
      Co-Authored-By: default avatarTobias Burnus <tobias@codesourcery.com>
      3b67db31
    • Costas Argyris's avatar
      Fix native MSYS2 build failure [PR108865, PR109188] · 08ef17c7
      Costas Argyris authored
      
      Don't cause an error if the symbol is not found.
      
      When building natively as an MSYS2 package, some
      executables are borrowing the $(COMPILERS) flags
      and --require-defined=HOST_EXTRA_OBJS_SYMBOL is
      causing them to fail.
      
      These executables don't need that symbol, so make
      it optional such that they don't error out.
      
      The compilers will still look for it (and find it)
      with the desired effect of getting UTF-8 support.
      
      	PR/PR108865
      
      gcc/ChangeLog:
      
      	* config/i386/x-mingw32-utf8: Make HOST_EXTRA_OBJS_SYMBOL
      	optional.
      
      Signed-off-by: default avatarJonathan Yong <10walls@gmail.com>
      08ef17c7
    • GCC Administrator's avatar
      Daily bump. · ec92be4a
      GCC Administrator authored
      ec92be4a
  2. Mar 23, 2023
    • Jason Merrill's avatar
      c++: constexpr PMF conversion [PR105996] · c4792bd1
      Jason Merrill authored
      Here, we were calling build_reinterpret_cast regardless of whether there was
      actually a cast, and that now sets REINTERPRET_CAST_P.  But that
      optimization seems dodgy anyway, as it involves NOP_EXPR from one
      RECORD_TYPE to another and we try to reserve NOP_EXPR for fundamental types.
      And the generated code seems the same, so let's drop it.  And also strip
      location wrappers.
      
      	PR c++/105996
      
      gcc/cp/ChangeLog:
      
      	* typeck.cc (build_ptrmemfunc): Drop 0-offset optimization
      	and location wrappers.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/constexpr-pmf3.C: New test.
      c4792bd1
    • Hans-Peter Nilsson's avatar
      testsuite: Xfail gcc.dg/tree-ssa/ssa-fre-100.c for ! natural_alignment_32 · 3fbeff66
      Hans-Peter Nilsson authored
      The test gcc.dg/tree-ssa/ssa-fre-100.c fails the
      scan-tree-dump-not fre1 "baz" for at least m68k-linux,
      pru-elf, and cris-elf according to posts on gcc-testresults.
      
      GCC requires int-size-alignment for a target to see through
      the "int *" dereference and perform value-numbering.  See
      comments in PR91419 and also the recent patch to
      gcc.dg/tree-ssa/pr100359.c.  This is a flaw in gcc rather
      than the target, so prefer an xfail rather than skipping
      the test.
      
      	* gcc.dg/tree-ssa/ssa-fre-100.c: XFAIL for ! natural_alignment_32.
      3fbeff66
    • Hans-Peter Nilsson's avatar
      testsuite: Compile-only gcc.dg/tree-ssa/pr100359.c if ! natural_alignment_32 · 08981d59
      Hans-Peter Nilsson authored
      The test gcc.dg/tree-ssa/pr100359.c fails the "test for
      excess errors" for at least m68k-linux, pru-elf, and
      cris-elf according to posts on gcc-testresults.  For
      cris-elf, the "excess errors" is a failure to link; an
      undefined reference to foo, because the code has a call to
      an extern function foo, which is not optimized away, and
      which is not defined.  I guess it's the same for those other
      targets.
      
      From comparative gdb sessions for native x86_64-linux and
      cris-elf, I see tree-ssa-sccvn.cc:vn_reference_lookup_3
      (called from the "pre" pass) requires int-size-alignment for
      a target to see through the "int *" dereference, that the
      expression is constant false and subsequently optimize away
      the call to foo.  The conclusion is with substantially less
      effort available from comments in PR91419.
      
      The point of the test seems only incidental to
      optimizing-out the call to foo, judging from the comments in
      PR100359, so an alternative is compile it (not link it) for
      all targets.  However, I chose to not change the nature of
      the test where it passes.
      
      	* gcc.dg/tree-ssa/pr100359.c: Compile-only for ! natural_alignment_32.
      08981d59
    • Pat Haugen's avatar
      Don't force target of modulo into a distinct register. · f58cbbb7
      Pat Haugen authored
      The define_insns for the modulo operation currently force the target register
      to a distinct reg in preparation for a possible future peephole combining
      div/mod. But this can lead to cases of a needless copy being inserted. Fixed
      with the following patch.
      
      gcc/
      	* config/rs6000/rs6000.md (*mod<mode>3, umod<mode>3): Add
      	non-earlyclobber alternative.
      
      gcc/testsuite/
      	* gcc.target/powerpc/mod-no_copy.c: New.
      	* gcc.target/powerpc/mod-peephole.c: New.
      f58cbbb7
    • Andrew Pinski's avatar
      c: [PR84900] cast of compound literal does not cause the code to become a non-lvalue · 80ed2a64
      Andrew Pinski authored
      The problem here is after r0-92187-g2ec5deb5c3146c, maybe_lvalue_p would
      return false for compound literals which causes non_lvalue_loc not
      to wrap the expression with a NON_LVALUE_EXPR unlike before when it
      return true as it returns true for all language specific tree codes.
      
      This fixes that oversight and fixes the testcase to have the cast as
      a non-lvalue.
      
      Committed to the trunk as obvious after a bootstrap/test on x86_64-linux-gnu.
      
      	PR c/84900
      
      gcc/ChangeLog:
      
      	* fold-const.cc (maybe_lvalue_p): Treat COMPOUND_LITERAL_EXPR
      	as a lvalue.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/compound-literal-cast-lvalue-1.c: New test.
      80ed2a64
    • Gaius Mulley's avatar
      PR modula2/109264 Bugfix resolve opaque types containing sets · 5ededfa5
      Gaius Mulley authored
      
      Resolve opaque type handling.  The bug is caused by the compiler
      attempting to resolve the meta types of a constant constructor.
      It incorrectly attempts to get the type on an enumeration type
      (resulting in NulSym) which causes the meta resolver to spin.
      Some PHBuild rules (building records need to be copied from P3Build
      so that hidden types are resolved in order across the compile.
      
      gcc/m2/ChangeLog:
      
      	PR modula2/109264
      	* gm2-compiler/M2Quads.mod (BuildConstFunctionCall): Comment
      	out ErrorString in debugging block.
      	(BuildConstructorStart): Replace Assert with a call to
      	MetaErrorT3.  Import MetaErrorT3.
      	* gm2-compiler/PCSymBuild.mod (buildConstFunction): Rename
      	local variables.
      	(WalkFunctionParam): Remove test for IsEnumeration when
      	resolving MIN or MAX parameters.
      	* gm2-compiler/PHBuild.bnf (BlockAssert): New procedure.
      	(ErrorArrayat): New procedure.
      	(Expect): Renamed parameter t to tok.
      	(PushQualident): New rule.
      	(ConstSetOrQualidentOrFunction): Force AutoOn.
      	(TypeDeclaration): Add debugging assert.
      	(SimpleType): Add debugging assert.
      	(DefaultRecordAttributes): New rule (and bugfix).
      	(FieldPragmaExpression): New rule (and bugfix).
      	(PragmaConstExpression): New rule (and bugfix).
      	(SetOrDesignatorOrFunction): Add debugging assert.
      	(Block): Add debugging assert.
      	* gm2-gcc/m2expr.cc (m2expr_ConstantExpressionWarning): int
      	to bool.
      	* gm2-gcc/m2expr.h (m2expr_TreeOverflow): int to bool.
      	(m2expr_GetBooleanTrue): Remove.
      	(m2expr_GetBooleanFalse): Remove.
      	* gm2-gcc/m2options.h (M2Options_SetStatistics): Replace
      	int with bool.
      
      gcc/testsuite/ChangeLog:
      
      	PR modula2/109264
      	* gm2/iso/extended-opaque/pass/iso-extended-opaque-pass.exp:
      	New test.
      	* gm2/iso/extended-opaque/pass/stressset.def: New test.
      	* gm2/iso/extended-opaque/pass/stressset.mod: New test.
      	* gm2/iso/extended-opaque/pass/testset.mod: New test.
      	* gm2/projects/iso/small/run/pass/iso-extended-opaque-run-pass.exp:
      	New test.
      	* gm2/projects/iso/small/run/pass/stressset.def: New test.
      	* gm2/projects/iso/small/run/pass/stressset.mod: New test.
      	* gm2/projects/iso/small/run/pass/test1.mod: New test.
      	* gm2/projects/iso/small/run/pass/testlib.def: New test.
      	* gm2/projects/iso/small/run/pass/testlib.mod: New test.
      	* gm2/projects/iso/small/run/pass/testset.mod: New test.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      5ededfa5
    • Richard Biener's avatar
      tree-optimization/107569 - avoid wrecking earlier folding in FRE/PRE · 41ade339
      Richard Biener authored
      The following avoids picking up dead code left over from folding
      during FRE/PRE, effectively undoing propagations.
      
      	PR tree-optimization/107569
      	* tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt):
      	Do not push SSA names with zero uses as available leader.
      	(process_bb): Likewise.
      
      	* g++.dg/opt/pr107569.C: New testcase.
      41ade339
    • Richard Biener's avatar
      tree-optimization/109262 - ICE with non-call EH and forwprop · 25979b67
      Richard Biener authored
      The recent combining of complex part loads to a complex load missed
      to account for non-call EH.
      
      	PR tree-optimization/109262
      	* tree-ssa-forwprop.cc (pass_forwprop::execute): When
      	combining a piecewise complex load avoid touching loads
      	that throw internally.  Use fun, not cfun throughout.
      
      	* g++.dg/torture/pr109262.C: New testcase.
      25979b67
    • Jakub Jelinek's avatar
      ranger: Ranger meets aspell · c46b5b0a
      Jakub Jelinek authored
      I've noticed a comment typo in tree-vrp.cc and decided to quickly
      skim aspell -c on the ranger sources (with quick I on everything that
      looked ok or roughly ok).
      But not being a native English speaker, I could get stuff wrong.
      
      2023-03-23  Jakub Jelinek  <jakub@redhat.com>
      
      	* value-range.cc (irange::irange_union, irange::intersect): Fix
      	comment spelling bugs.
      	* gimple-range-trace.cc (range_tracer::do_header): Likewise.
      	* gimple-range-trace.h: Likewise.
      	* gimple-range-edge.cc: Likewise.
      	(gimple_outgoing_range_stmt_p,
      	gimple_outgoing_range::switch_edge_range,
      	gimple_outgoing_range::edge_range_p): Likewise.
      	* gimple-range.cc (gimple_ranger::prefill_stmt_dependencies,
      	gimple_ranger::fold_stmt, gimple_ranger::register_transitive_infer,
      	assume_query::assume_query, assume_query::calculate_phi): Likewise.
      	* gimple-range-edge.h: Likewise.
      	* value-range.h (Value_Range::set, Value_Range::lower_bound,
      	Value_Range::upper_bound, frange::set_undefined): Likewise.
      	* gimple-range-gori.h (range_def_chain::depend, gori_map::m_outgoing,
      	gori_compute): Likewise.
      	* gimple-range-fold.h (fold_using_range): Likewise.
      	* gimple-range-path.cc (path_range_query::compute_ranges_in_phis):
      	Likewise.
      	* gimple-range-gori.cc (range_def_chain::in_chain_p,
      	range_def_chain::dump, gori_map::calculate_gori,
      	gori_compute::compute_operand_range_switch,
      	gori_compute::logical_combine, gori_compute::refine_using_relation,
      	gori_compute::compute_operand1_range, gori_compute::may_recompute_p):
      	Likewise.
      	* gimple-range.h: Likewise.
      	(enable_ranger): Likewise.
      	* range-op.h (empty_range_varying): Likewise.
      	* value-query.h (value_query): Likewise.
      	* gimple-range-cache.cc (block_range_cache::set_bb_range,
      	block_range_cache::dump, ssa_global_cache::clear_global_range,
      	temporal_cache::temporal_value, temporal_cache::current_p,
      	ranger_cache::range_of_def, ranger_cache::propagate_updated_value,
      	ranger_cache::range_from_dom, ranger_cache::register_inferred_value):
      	Likewise.
      	* gimple-range-fold.cc (fur_edge::get_phi_operand,
      	fur_stmt::get_operand, gimple_range_adjustment,
      	fold_using_range::range_of_phi,
      	fold_using_range::relation_fold_and_or): Likewise.
      	* value-range-storage.h (irange_storage_slot::MAX_INTS): Likewise.
      	* value-query.cc (range_query::value_of_expr,
      	range_query::value_on_edge, range_query::query_relation): Likewise.
      	* tree-vrp.cc (remove_unreachable::remove_and_update_globals,
      	intersect_range_with_nonzero_bits): Likewise.
      	* gimple-range-infer.cc (gimple_infer_range::check_assume_func,
      	exit_range): Likewise.
      	* value-relation.h: Likewise.
      	(equiv_oracle, relation_trio::relation_trio, value_relation,
      	value_relation::value_relation, pe_min): Likewise.
      	* range-op-float.cc (range_operator_float::rv_fold,
      	frange_arithmetic, foperator_unordered_equal::op1_range,
      	foperator_div::rv_fold): Likewise.
      	* gimple-range-op.cc (cfn_clz::fold_range): Likewise.
      	* value-relation.cc (equiv_oracle::query_relation,
      	equiv_oracle::register_equiv, equiv_oracle::add_equiv_to_block,
      	value_relation::apply_transitive, relation_chain_head::find_relation,
      	dom_oracle::query_relation, dom_oracle::find_relation_block,
      	dom_oracle::find_relation_dom, path_oracle::register_equiv): Likewise.
      	* range-op.cc (range_operator::wi_fold_in_parts_equiv,
      	create_possibly_reversed_range, adjust_op1_for_overflow,
      	operator_mult::wi_fold, operator_exact_divide::op1_range,
      	operator_cast::lhs_op1_relation, operator_cast::fold_pair,
      	operator_cast::fold_range, operator_abs::wi_fold, range_op_cast_tests,
      	range_op_lshift_tests): Likewise.
      c46b5b0a
    • Eric Botcazou's avatar
      Skip gnat.dg/div_zero.adb on Aarch64 · 097e2afd
      Eric Botcazou authored
      gcc/testsuite/
      	* gnat.dg/div_zero.adb: Skip for aarch64*-*-* targets.
      097e2afd
    • Marek Polacek's avatar
      c++: further -Wdangling-reference refinement [PR107532] · 59bfdd5f
      Marek Polacek authored
      Based on <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532#c24>,
      it seems like we should treat *any* class with a reference member
      as a reference wrapper.  To suppress the warning in
      
        int i = 42;
        auto const& v = std::get<0>(std::tuple<int&>(i));
      
      we have to look into base classes as well.  For std::tuple, this means
      that we have to check the _Head_base subobject, which is a non-direct
      base class of std::tuple.  So I've employed a DFS walk.
      
      	PR c++/107532
      
      gcc/cp/ChangeLog:
      
      	* call.cc (class_has_reference_member_p): New.
      	(class_has_reference_member_p_r): New.
      	(reference_like_class_p): Don't look for a specific constructor.
      	Use a DFS walk with class_has_reference_member_p_r.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/warn/Wdangling-reference11.C: New test.
      	* g++.dg/warn/Wdangling-reference12.C: New test.
      59bfdd5f
    • Andrew Stubbs's avatar
      amdgcn: Fix register size bug · 3b97715a
      Andrew Stubbs authored
      Fix an issue in which "vectors" of duplicate entries placed in scalar
      registers caused the following 63 registers to be marked live, for the
      purpose of prologue generation, which resulted in stack corruption.
      
      gcc/ChangeLog:
      
      	* config/gcn/gcn.cc (gcn_class_max_nregs): Handle vectors in SGPRs.
      	(move_callee_saved_registers): Detect the bug condition early.
      3b97715a
    • Andrew Stubbs's avatar
      amdgcn: vec_extract no-op insns · db80ccd3
      Andrew Stubbs authored
      Just using move insn for no-op conversions triggers special move handling in
      IRA which declares that subreg of vectors aren't valid and routes everything
      through memory.  These patterns make the vec_select explicit and all is well.
      
      gcc/ChangeLog:
      
      	* config/gcn/gcn-protos.h (gcn_stepped_zero_int_parallel_p): New.
      	* config/gcn/gcn-valu.md (V_1REG_ALT): New.
      	(V_2REG_ALT): New.
      	(vec_extract<V_1REG:mode><V_1REG_ALT:mode>_nop): New.
      	(vec_extract<V_2REG:mode><V_2REG_ALT:mode>_nop): New.
      	(vec_extract<V_ALL:mode><V_ALL_ALT:mode>): Use new patterns.
      	* config/gcn/gcn.cc (gcn_stepped_zero_int_parallel_p): New.
      	* config/gcn/predicates.md (ascending_zero_int_parallel): New.
      db80ccd3
    • Jakub Jelinek's avatar
      tree-vect-generic: Fix up expand_vector_condition [PR109176] · 484c41c7
      Jakub Jelinek authored
      The following testcase ICEs on aarch64-linux, because
      expand_vector_condition attempts to piecewise lower SVE
        d_3 = a_1(D) < b_2(D);
        _5 = VEC_COND_EXPR <d_3, c_4(D), d_3>;
      which isn't possible - nunits_for_known_piecewise_op ICEs but
      the rest of the code assumes constant number of elements too.
      
      expand_vector_condition attempts to find if a (rhs1) is a SSA_NAME
      for comparison and calls expand_vec_cond_expr_p (type, TREE_TYPE (a1), code)
      where a1 is one of the operands of the comparison and code is the comparison
      code.  That one indeed isn't supported here, but what aarch64 SVE supports
      are the individual statements, comparison (expand_vec_cmp_expr_p) and
      expand_vec_cond_expr_p (type, TREE_TYPE (a), SSA_NAME), the latter because
      that function starts with
        if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type)
            && get_vcond_mask_icode (TYPE_MODE (value_type),
                                     TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing)
          return true;
      
      In an earlier version of the patch (in the PR), we did this
        if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a))
            && expand_vec_cond_expr_p (type, TREE_TYPE (a), ERROR_MARK))
          return true;
      before the code == SSA_NAME handling plus some further tweaks later.
      While that fixed the ICE, it broke quite a few tests on x86 and some on
      aarch64 too.  The problem is that expand_vector_comparison doesn't lower
      comparisons which aren't supported and only feed VEC_COND_EXPR first operand
      and expand_vector_condition succeeds for those, so with the above mentioned
      change we'd verify the VEC_COND_EXPR is implementable using optab alone,
      but nothing would verify the tcc_comparison which relied on
      expand_vector_condition to verify.
      
      So, the following patch instead queries whether optabs can handle the
      comparison and VEC_COND_EXPR together (if a (rhs1) is a comparison;
      otherwise as before it checks only the VEC_COND_EXPR) and if that fails,
      also checks whether the two operations could be supported individually
      and only if even that fails does the piecewise lowering.
      
      2023-03-23  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/109176
      	* tree-vect-generic.cc (expand_vector_condition): If a has
      	vector boolean type and is a comparison, also check if both
      	the comparison and VEC_COND_EXPR could be successfully expanded
      	individually.
      
      	* gcc.target/aarch64/sve/pr109176.c: New test.
      484c41c7
    • Pan Li's avatar
      RISC-V: Bugfix for rvv bool mode size adjustment · 3a982e07
      Pan Li authored
      
      Fix the bug of the rvv bool mode size by the adjustment.
      Besides the mode precision (aka bit size [1, 2, 4, 8, 16, 32, 64])
      of the vbool*_t, the mode size (aka byte size) will be adjusted to
      [1, 1, 1, 1, 2, 4, 8] according to the rvv spec 1.0 isa. The
      adjustment will provide correct information for the underlying
      redundant instruction elimiation.
      
      Given the below sample code:
      {
        vbool1_t v1 = *(vbool1_t*)in;
        vbool64_t v2 = *(vbool64_t*)in;
      
        *(vbool1_t*)(out + 100) = v1;
        *(vbool64_t*)(out + 200) = v2;
      }
      
      Before the size adjustment:
      csrr    t0,vlenb
      slli    t1,t0,1
      csrr    a3,vlenb
      sub     sp,sp,t1
      slli    a4,a3,1
      add     a4,a4,sp
      addi    a2,a1,100
      vsetvli a5,zero,e8,m8,ta,ma
      sub     a3,a4,a3
      vlm.v   v24,0(a0)
      vsm.v   v24,0(a2)
      vsm.v   v24,0(a3)
      addi    a1,a1,200
      csrr    t0,vlenb
      vsetvli a4,zero,e8,mf8,ta,ma
      slli    t1,t0,1
      vlm.v   v24,0(a3)
      vsm.v   v24,0(a1)
      add     sp,sp,t1
      jr      ra
      
      After the size adjustment:
      addi    a3,a1,100
      vsetvli a4,zero,e8,m8,ta,ma
      addi    a1,a1,200
      vlm.v   v24,0(a0)
      vsm.v   v24,0(a3)
      vsetvli a5,zero,e8,mf8,ta,ma
      vlm.v   v24,0(a0)
      vsm.v   v24,0(a1)
      ret
      
      Additionally, the size adjust cannot cover all possible combinations
      of the vbool*_t code pattern like above. We will take a look into it
      in another patches.
      
      PR 108185
      PR 108654
      
      gcc/ChangeLog:
      
      	PR target/108654
      	PR target/108185
      	* config/riscv/riscv-modes.def (ADJUST_BYTESIZE): Adjust size
      	for vector mask modes.
      	* config/riscv/riscv.cc (riscv_v_adjust_bytesize): New.
      	* config/riscv/riscv.h (riscv_v_adjust_bytesize): New.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/108654
      	PR target/108185
      	* gcc.target/riscv/rvv/base/pr108185-1.c: Update.
      	* gcc.target/riscv/rvv/base/pr108185-2.c: Ditto.
      	* gcc.target/riscv/rvv/base/pr108185-3.c: Ditto.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      Co-authored-by: default avatarJu-Zhe Zhong <juzhe.zhong@rivai.ai>
      3a982e07
    • Songhe Zhu's avatar
      RISC-V: Fix loss of function to script 'multilib-generator' · 37dd1f14
      Songhe Zhu authored
      
      The arch 'rv32imac' will not be created when excuting
      './multilib-generator rv32imc-ilp32--a'
      
      The output is:
      MULTILIB_OPTIONS = march=rv32imc mabi=ilp32
      MULTILIB_DIRNAMES = rv32imc ilp32
      MULTILIB_REQUIRED = march=rv32imc/mabi=ilp32
      MULTILIB_REUSE =
      
      Analysis : The alts:['rv32imc', 'rv32imac'] will change
      to ['rv32imac', 'rv32imc'] through function:unique(alts) processing,
      This is the wrong alts should not be changed.
      This patch fix it.
      
      gcc/ChangLog:
      	* config/riscv/multilib-generator: Adjusting the loop of 'alt' in 'alts'.
      
      Signed-off-by: default avatarSonghe Zhu <zhusonghe@eswincomputing.com>
      37dd1f14
    • Jason Merrill's avatar
      c++: local class in nested generic lambda [PR109241] · 4872e46e
      Jason Merrill authored
      In this testcase, the tree walk to look for bare parameter packs was
      confused by finding a type with no TREE_BINFO.  But it should be fine that
      it's unset; we already checked for unexpanded packs at parse time.
      
      I also tried doing the partial instantiation of the local class, which is
      probably the long-term direction we want to go, but for stage 4 let's go
      with this safer change.
      
      	PR c++/109241
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1y/lambda-generic-local-class2.C: New test.
      4872e46e
    • Ju-Zhe Zhong's avatar
      RISC-V: Fix LRA issue for LMUL < 1 vector spillings [PR109244] · cd0c433e
      Ju-Zhe Zhong authored
      In order to decrease the memory traffic, we don't use whole register
      load/store for the LMUL less than 1 and mask mode, so those case will
      require one extra general purpose register for setting up VL register,
      but it's not allowed during LRA process, so we defined few special move patterns
      used for LRA, which will defer the expansion after LRA.
      
      gcc/ChangeLog:
      
      	PR target/109244
      	* config/riscv/riscv-protos.h (emit_vlmax_vsetvl): Define as global.
      	(emit_vlmax_op): Ditto.
      	* config/riscv/riscv-v.cc (get_sew): New function.
      	(emit_vlmax_vsetvl): Adapt function.
      	(emit_pred_op): Ditto.
      	(emit_vlmax_op): Ditto.
      	(emit_nonvlmax_op): Ditto.
      	(legitimize_move): Fix LRA ICE.
      	(gen_no_side_effects_vsetvl_rtx): Adapt function.
      	* config/riscv/vector.md (@mov<V_FRACT:mode><P:mode>_lra): New pattern.
      	(@mov<VB:mode><P:mode>_lra): Ditto.
      	(*mov<V_FRACT:mode><P:mode>_lra): Ditto.
      	(*mov<VB:mode><P:mode>_lra): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/109244
      	* g++.target/riscv/rvv/base/pr109244.C: New test.
      	* gcc.target/riscv/rvv/base/binop_vv_constraint-4.c: Adapt testcase.
      	* gcc.target/riscv/rvv/base/binop_vv_constraint-6.c: Ditto.
      	* gcc.target/riscv/rvv/base/binop_vx_constraint-127.c: Ditto.
      	* gcc.target/riscv/rvv/base/spill-1.c: Ditto.
      	* gcc.target/riscv/rvv/base/spill-2.c: Ditto.
      	* gcc.target/riscv/rvv/base/spill-3.c: Ditto.
      	* gcc.target/riscv/rvv/base/spill-5.c: Ditto.
      	* gcc.target/riscv/rvv/base/spill-7.c: Ditto.
      	* g++.target/riscv/rvv/base/bug-18.C: New test.
      	* gcc.target/riscv/rvv/base/merge_constraint-3.c: New test.
      	* gcc.target/riscv/rvv/base/merge_constraint-4.c: New test.
      cd0c433e
    • Ju-Zhe Zhong's avatar
      RISC-V: Implement __riscv_vlenb PR109228 · 116a8678
      Ju-Zhe Zhong authored
      __riscv_vlenb is defined in RVV intrinsic spec 0.11 and used in some project
      like google/highway.
      
      gcc/ChangeLog:
      
      	PR target/109228
      	* config/riscv/riscv-vector-builtins-bases.cc (class vlenb): Add
      	__riscv_vlenb support.
      	(BASE): Ditto.
      	* config/riscv/riscv-vector-builtins-bases.h: Ditto.
      	* config/riscv/riscv-vector-builtins-functions.def (vlenb): Ditto.
      	* config/riscv/riscv-vector-builtins-shapes.cc (struct vlenb_def): Ditto.
      	(SHAPE): Ditto.
      	* config/riscv/riscv-vector-builtins-shapes.h: Ditto.
      	* config/riscv/riscv-vector-builtins.cc: Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/109228
      	* gcc.target/riscv/rvv/base/vlenb-1.c: New test.
      116a8678
    • Ju-Zhe Zhong's avatar
      RISC-V: Fix wrong vsetvli fusion for vmv.s.x · a481eed8
      Ju-Zhe Zhong authored
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vsetvl.cc (reg_available_p): Fix bugs.
      	(pass_vsetvl::compute_local_backward_infos): Fix bugs.
      	(pass_vsetvl::need_vsetvl): Fix bugs.
      	(pass_vsetvl::backward_demand_fusion): Fix bugs.
      	(pass_vsetvl::demand_fusion): Fix bugs.
      	(eliminate_insn): Fix bugs.
      	(insert_vsetvl): Ditto.
      	(pass_vsetvl::emit_local_forward_vsetvls): Ditto.
      	* config/riscv/riscv-vsetvl.h (enum vsetvl_type): Ditto.
      	* config/riscv/vector.md: Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.target/riscv/rvv/base/bug-10.C: New test.
      	* g++.target/riscv/rvv/base/bug-11.C: New test.
      	* g++.target/riscv/rvv/base/bug-12.C: New test.
      	* g++.target/riscv/rvv/base/bug-13.C: New test.
      	* g++.target/riscv/rvv/base/bug-14.C: New test.
      	* g++.target/riscv/rvv/base/bug-15.C: New test.
      	* g++.target/riscv/rvv/base/bug-16.C: New test.
      	* g++.target/riscv/rvv/base/bug-17.C: New test.
      	* g++.target/riscv/rvv/base/bug-2.C: New test.
      	* g++.target/riscv/rvv/base/bug-3.C: New test.
      	* g++.target/riscv/rvv/base/bug-4.C: New test.
      	* g++.target/riscv/rvv/base/bug-5.C: New test.
      	* g++.target/riscv/rvv/base/bug-6.C: New test.
      	* g++.target/riscv/rvv/base/bug-7.C: New test.
      	* g++.target/riscv/rvv/base/bug-8.C: New test.
      	* g++.target/riscv/rvv/base/bug-9.C: New test.
      
      Signed-off-by: default avatarJu-Zhe Zhong <juzhe.zhong@rivai.ai>
      Co-authored-by: default avatarkito-cheng <kito.cheng@sifive.com>
      a481eed8
    • Ju-Zhe Zhong's avatar
      RISC-V: Fix wrong RTL pattern for ternary instructions. · 0e271517
      Ju-Zhe Zhong authored
      
      We've wrong RTL pattern cause unexpected optimizaion result.
      
      Give a example is vnmsub.vx pattern, the operation of vnmsub.vx
      list below:
      
        vnmsub.vx vd, rs1, vs2, vm    # vd[i] = -(x[rs1] * vd[i]) + vs2[i]
      
      But our RTL pattern write as (x[rs1] * vd[i]) - vs2[i], and the GCC try to
      simplify when x[rs1] is constant 1, and then become a vd[i] - vs[i]
      instruction.
      
      We also revise all ternary instructions to make sure the RTL has right
      semantic:
      
      And it's the mapping list between instruction and RTL pattern:
      
      interger:
      vnmsac.vv vd, vs1, vs2, vm    # vd[i] = -(vs1[i] * vs2[i]) + vd[i]  (minus op3 (mult op1 op2))
      vnmsac.vx vd, rs1, vs2, vm    # vd[i] = -(x[rs1] * vs2[i]) + vd[i]   (minus op3 (mult op1 op2))
      
      floating-point:
      vfmacc.vv vd, vs1, vs2, vm    # vd[i] = +(vs1[i] * vs2[i]) + vd[i] (plus (mult (op1 op2)) op3)
      vfmacc.vf vd, rs1, vs2, vm    # vd[i] = +(f[rs1] * vs2[i]) + vd[i] (plus (mult (op1 op2)) op3)
      
      vfnmacc.vv vd, vs1, vs2, vm   # vd[i] = -(vs1[i] * vs2[i]) - vd[i] (minus (neg (mult (op1 op2))) op3))
      vfnmacc.vf vd, rs1, vs2, vm   # vd[i] = -(f[rs1] * vs2[i]) - vd[i] (minus (neg (mult (op1 op2)) op3))
      vfmsac.vv vd, vs1, vs2, vm    # vd[i] = +(vs1[i] * vs2[i]) - vd[i] (minus (mult (op1 op2)) op3)
      vfmsac.vf vd, rs1, vs2, vm    # vd[i] = +(f[rs1] * vs2[i]) - vd[i] (minus (mult (op1 op2)) op3)
      
      vfnmsac.vv vd, vs1, vs2, vm   # vd[i] = -(vs1[i] * vs2[i]) + vd[i] (plus (neg:(mult (op1 op2))) op3)
      vfnmsac.vf vd, rs1, vs2, vm   # vd[i] = -(f[rs1] * vs2[i]) + vd[i] (plus (neg:(mult (op1 op2))) op3)
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc: Fix ternary bug.
      	* config/riscv/vector-iterators.md (nmsac): Ditto.
      	(nmsub): Ditto.
      	(msac): Ditto.
      	(msub): Ditto.
      	(nmadd): Ditto.
      	(nmacc): Ditto.
      	* config/riscv/vector.md (@pred_mul_<optab><mode>): Ditto.
      	(@pred_mul_plus<mode>): Ditto.
      	(*pred_madd<mode>): Ditto.
      	(*pred_macc<mode>): Ditto.
      	(*pred_mul_plus<mode>): Ditto.
      	(@pred_mul_plus<mode>_scalar): Ditto.
      	(*pred_madd<mode>_scalar): Ditto.
      	(*pred_macc<mode>_scalar): Ditto.
      	(*pred_mul_plus<mode>_scalar): Ditto.
      	(*pred_madd<mode>_extended_scalar): Ditto.
      	(*pred_macc<mode>_extended_scalar): Ditto.
      	(*pred_mul_plus<mode>_extended_scalar): Ditto.
      	(@pred_minus_mul<mode>): Ditto.
      	(*pred_<madd_nmsub><mode>): Ditto.
      	(*pred_nmsub<mode>): Ditto.
      	(*pred_<macc_nmsac><mode>): Ditto.
      	(*pred_nmsac<mode>): Ditto.
      	(*pred_mul_<optab><mode>): Ditto.
      	(*pred_minus_mul<mode>): Ditto.
      	(@pred_mul_<optab><mode>_scalar): Ditto.
      	(@pred_minus_mul<mode>_scalar): Ditto.
      	(*pred_<madd_nmsub><mode>_scalar): Ditto.
      	(*pred_nmsub<mode>_scalar): Ditto.
      	(*pred_<macc_nmsac><mode>_scalar): Ditto.
      	(*pred_nmsac<mode>_scalar): Ditto.
      	(*pred_mul_<optab><mode>_scalar): Ditto.
      	(*pred_minus_mul<mode>_scalar): Ditto.
      	(*pred_<madd_nmsub><mode>_extended_scalar): Ditto.
      	(*pred_nmsub<mode>_extended_scalar): Ditto.
      	(*pred_<macc_nmsac><mode>_extended_scalar): Ditto.
      	(*pred_nmsac<mode>_extended_scalar): Ditto.
      	(*pred_mul_<optab><mode>_extended_scalar): Ditto.
      	(*pred_minus_mul<mode>_extended_scalar): Ditto.
      	(*pred_<madd_msub><mode>): Ditto.
      	(*pred_<macc_msac><mode>): Ditto.
      	(*pred_<madd_msub><mode>_scalar): Ditto.
      	(*pred_<macc_msac><mode>_scalar): Ditto.
      	(@pred_neg_mul_<optab><mode>): Ditto.
      	(@pred_mul_neg_<optab><mode>): Ditto.
      	(*pred_<nmadd_msub><mode>): Ditto.
      	(*pred_<nmsub_nmadd><mode>): Ditto.
      	(*pred_<nmacc_msac><mode>): Ditto.
      	(*pred_<nmsac_nmacc><mode>): Ditto.
      	(*pred_neg_mul_<optab><mode>): Ditto.
      	(*pred_mul_neg_<optab><mode>): Ditto.
      	(@pred_neg_mul_<optab><mode>_scalar): Ditto.
      	(@pred_mul_neg_<optab><mode>_scalar): Ditto.
      	(*pred_<nmadd_msub><mode>_scalar): Ditto.
      	(*pred_<nmsub_nmadd><mode>_scalar): Ditto.
      	(*pred_<nmacc_msac><mode>_scalar): Ditto.
      	(*pred_<nmsac_nmacc><mode>_scalar): Ditto.
      	(*pred_neg_mul_<optab><mode>_scalar): Ditto.
      	(*pred_mul_neg_<optab><mode>_scalar): Ditto.
      	(@pred_widen_neg_mul_<optab><mode>): Ditto.
      	(@pred_widen_mul_neg_<optab><mode>): Ditto.
      	(@pred_widen_neg_mul_<optab><mode>_scalar): Ditto.
      	(@pred_widen_mul_neg_<optab><mode>_scalar): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/bug-3.c: New test.
      	* gcc.target/riscv/rvv/base/bug-4.c: New test.
      	* gcc.target/riscv/rvv/base/bug-5.c: New test.
      
      Signed-off-by: default avatarJu-Zhe Zhong <juzhe.zhong@rivai.ai>
      Co-authored-by: default avatarkito-cheng <kito.cheng@sifive.com>
      0e271517
    • Kito Cheng's avatar
      RISC-V: Add riscv_vector target check · ba31f9a3
      Kito Cheng authored
      Add target check funciton to ensure vector extension can be used.
      
      gcc/testsuite/ChangeLog:
      
      	* lib/target-supports.exp (check_effective_target_riscv_vector):
      	New.
      ba31f9a3
    • liuhongt's avatar
      Remove TARGET_GEN_MEMSET_SCRATCH_RTX since it's not used anymore. · 77127363
      liuhongt authored
      The target hook is only used by i386, and the current definition is
      same as default gen_reg_rtx.
      
      gcc/ChangeLog:
      
      	* builtins.cc (builtin_memset_read_str): Replace
      	targetm.gen_memset_scratch_rtx with gen_reg_rtx.
      	(builtin_memset_gen_str): Ditto.
      	* config/i386/i386-expand.cc
      	(ix86_convert_const_wide_int_to_broadcast): Replace
      	ix86_gen_scratch_sse_rtx with gen_reg_rtx.
      	(ix86_expand_vector_move): Ditto.
      	* config/i386/i386-protos.h (ix86_gen_scratch_sse_rtx):
      	Removed.
      	* config/i386/i386.cc (ix86_gen_scratch_sse_rtx): Removed.
      	(TARGET_GEN_MEMSET_SCRATCH_RTX): Removed.
      	* doc/tm.texi: Remove TARGET_GEN_MEMSET_SCRATCH_RTX.
      	* doc/tm.texi.in: Ditto.
      	* target.def: Ditto.
      77127363
    • GCC Administrator's avatar
      Daily bump. · 50bd9c41
      GCC Administrator authored
      50bd9c41
  3. Mar 22, 2023
    • Jonathan Wakely's avatar
      libstdc++: Fix assigning nullptr to std::atomic<shared_ptr<T>> (LWG 3893) · a495b738
      Jonathan Wakely authored
      LWG voted this to Tentatively Ready recently.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/shared_ptr_atomic.h (atomic::operator=(nullptr_t)):
      	Add overload, as per LWG 3893.
      	* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
      	Check assignment from nullptr.
      a495b738
    • David Malcolm's avatar
      testsuite: always use UTF-8 in scan-sarif-file[-not] [PR105959] · 6b274094
      David Malcolm authored
      
      c-c++-common/diagnostic-format-sarif-file-4.c is a test case for
      quoting non-ASCII source code in a SARIF diagnostic log.
      
      The SARIF standard mandates that .sarif files are UTF-8 encoded.
      
      PR testsuite/105959 notes that the test case fails when the system
      encoding is not UTF-8, such as when the "make" invocation is prefixed
      with LC_ALL=C, whereas it works with in a UTF-8-locale.
      
      The root cause is that dg-scan opens the file for reading using the
      "system" encoding; I believe it is falling back to treating all files as
      effectively ISO 8859-1 in a non-UTF-8 locale.
      
      This patch fixes things by adding a mechanism to dg-scan to allow
      callers to (optionally) specify an encoding to use when reading the
      file, and updating scan-sarif-file (and the -not variant) to always
      use UTF-8 when calling dg-scan, fixing the test case with LC_ALL=C.
      
      gcc/testsuite/ChangeLog:
      	PR testsuite/105959
      	* gcc.dg-selftests/dg-final.exp
      	(dg_final_directive_check_num_args): Update expected maximum
      	number of args for the various directives using dg-scan.
      	* lib/scanasm.exp (append_encoding_arg): New procedure.
      	(dg-scan): Add optional 3rd argument: the encoding to use when
      	reading from the file.
      	* lib/scansarif.exp (scan-sarif-file): Treat the file as UTF-8
      	encoded when reading it.
      	(scan-sarif-file-not): Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      6b274094
    • Ian Lance Taylor's avatar
    • Jason Merrill's avatar
      c++: array bound partial ordering [PR108390] · 5a1717fb
      Jason Merrill authored
      fold_convert doesn't work with a dependent argument, and problematically
      differed from the corresponding fold+build_nop further down in the
      function.  So change it to match.
      
      	PR c++/108390
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (unify): Use fold of build_nop instead of fold_convert.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/template/partial-order3.C: New test.
      5a1717fb
    • Harald Anlauf's avatar
      Fortran: improve checking of FINAL subroutine arguments [PR104572] · 3e791f45
      Harald Anlauf authored
      
      gcc/fortran/ChangeLog:
      
      	PR fortran/104572
      	* resolve.cc (gfc_resolve_finalizers): Argument of a FINAL subroutine
      	cannot be an alternate return.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/104572
      	* gfortran.dg/pr104572.f90: New test.
      
      Co-authored-by: default avatarSteven G. Kargl <kargl@gcc.gnu.org>
      3e791f45
    • Jonathan Wakely's avatar
      libstdc++: Remove std::formatter<const charT[N], charT> specialization · f2e70da6
      Jonathan Wakely authored
      This was approved in Issaquah as LWG 3833.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/format (formatter<const charT[N], charT>): Do not
      	define partial speclialization, as per LWG 3833.
      	* testsuite/std/format/formatter/requirements.cc: Check it.
      f2e70da6
    • Jonathan Wakely's avatar
      libstdc++: Define __cpp_lib_constexpr_algorithms in <utility> (LWG 3792) · 924d9904
      Jonathan Wakely authored
      We actually defined this macro in <utility> at one point, but I removed
      it in r10-7901-g2025db692e9ed1.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/utility (__cpp_lib_constexpr_algorithms): Define,
      	as per LWG 3792.
      	* testsuite/20_util/exchange/constexpr.cc: Check for it.
      924d9904
    • Jonathan Wakely's avatar
      libstdc++: Add missing __cpp_lib_format macro to <version> · 02e86035
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* include/std/version (__cpp_lib_format): Define.
      	* testsuite/std/format/functions/format.cc: Check it.
      02e86035
    • Jonathan Wakely's avatar
      libstdc++: Use rvalues in std::string::resize_and_overwrite (LWG 3645) · ba4f5530
      Jonathan Wakely authored
      Previously the C++23 draft required that the callback arguments were
      lvalues, which was overvable by the callback. LWG 3645 removes that
      overspecification, so we can pass rvalues and the user can't modify
      our local variables. I've used auto(p) to produce rvalues, which is only
      supported since Clang 15, but I think that's OK for a C++23 feature.
      
      While making this change I noticed that we weren't correctly enforcing
      the requirement that the callback returns an integer-like type. Add
      better assertions for the type and value.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/basic_string.tcc (basic_string::resize_and_overwrite):
      	Pass rvalues to the callback, as now allowed by LWG 3645.
      	Enforce preconditions on the return value.
      	* testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc:
      	Adjust.
      ba4f5530
    • Jonathan Wakely's avatar
      libstdc++: Add comment to <format> (LWG 3720) · 7d4f4ce6
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* include/std/format: Add a comment noting that the resolution
      	of LWG 3720 has been applied..
      7d4f4ce6
    • Jonathan Wakely's avatar
      libstdc++: Add allocator-extended constructors to std::match_results (LWG 2195) · 9ae11081
      Jonathan Wakely authored
      This was approved in Issaquah last month.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/regex.h (match_results): Add allocator-extended
      	copy and move constructors, as per LWG 2195.
      	* testsuite/28_regex/match_results/ctors/char/alloc.cc: New test.
      9ae11081
    • Jonathan Wakely's avatar
      libstdc++: Make std::istream_iterator copy ctor constexpr (LWG 3600) · ad0b9cf1
      Jonathan Wakely authored
      As explained in LWG 3600, we never implemented a C++0x change that made
      the copy constructor of std::istream_iterator defined as defaulted. That
      would be an ABI break, so the resolution of LWG 3600 is to not require
      it to be trivial, but just constexpr and conditionally noexcept. This
      applies that resolution.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stream_iterator.h (istream_iterator): Add
      	constexpr to copy constructor, as per LWG 3600.
      	* testsuite/24_iterators/istream_iterator/cons/constexpr.cc:
      	Check copy construction.
      ad0b9cf1
Loading