Skip to content
Snippets Groups Projects
  1. Aug 11, 2023
    • Pan Li's avatar
      RISC-V: Support RVV VFNMSAC rounding mode intrinsic API · cd9150e2
      Pan Li authored
      
      This patch would like to support the rounding mode API for the
      VFNMSAC for the below samples.
      
      * __riscv_vfnmsac_vv_f32m1_rm
      * __riscv_vfnmsac_vv_f32m1_rm_m
      * __riscv_vfnmsac_vf_f32m1_rm
      * __riscv_vfnmsac_vf_f32m1_rm_m
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc
      	(class vfnmsac_frm): New class for vfnmsac frm.
      	(vfnmsac_frm_obj): New declaration.
      	(BASE): Ditto.
      	* config/riscv/riscv-vector-builtins-bases.h: Ditto.
      	* config/riscv/riscv-vector-builtins-functions.def
      	(vfnmsac_frm): New function definition.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/float-point-nmsac.c: New test.
      cd9150e2
    • Jakub Jelinek's avatar
      c: Add __typeof_unqual__ and __typeof_unqual support · 607d9d50
      Jakub Jelinek authored
      As I mentioned in my stdckdint.h mail, I think having __ prefixed
      keywords for the typeof_unqual keyword which can be used in earlier
      language modes can be useful, not all code can be switched to C23
      right away.
      
      The following patch implements that.  It keeps the non-C23 behavior
      for it for the _Noreturn functions to stay compatible with how
      __typeof__ behaves.
      
      I think we don't need it for C++, in C++ we have standard
      traits to remove qualifiers etc.
      
      2023-08-11  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/
      	* doc/extend.texi (Typeof): Document typeof_unqual
      	and __typeof_unqual__.
      gcc/c-family/
      	* c-common.cc (c_common_reswords): Add __typeof_unqual
      	and __typeof_unqual__ spellings of typeof_unqual.
      gcc/c/
      	* c-parser.cc (c_parser_typeof_specifier): Handle
      	__typeof_unqual and __typeof_unqual__ as !is_std.
      gcc/testsuite/
      	* gcc.dg/c11-typeof-2.c: New test.
      	* gcc.dg/c11-typeof-3.c: New test.
      	* gcc.dg/gnu11-typeof-3.c: New test.
      	* gcc.dg/gnu11-typeof-4.c: New test.
      607d9d50
    • Andrew Pinski's avatar
      Fix PR 110954: wrong code with cmp | !cmp · f956c232
      Andrew Pinski authored
      This was an oversight on my part forgetting that
      cmp will might have a different true value than all ones
      but will have a value of 1 in most cases.
      This means if we have `(f < 0) | !(f < 0)` we would
      optimize this to -1 rather than just 1.
      
      This is version 2 of the patch.
      Decided to go down a different route than just checking if
      the precission was 1 inside bitwise_inverted_equal_p.
      So instead bitwise_inverted_equal_p gets passed an argument
      that will be set if there was a comparison that was being compared
      and the user of bitwise_inverted_equal_p decides what needs to be done.
      In most uses of bitwise_inverted_equal_p, the check will be
      `!wascmp || element_precision (type) == 1` .
      But in the case of `a & ~a` and `a ^| ~a` we can handle the case
      of wascmp by using constant_boolean_node isntead.
      
      OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR tree-optimization/110954
      
      gcc/ChangeLog:
      
      	* generic-match-head.cc (bitwise_inverted_equal_p): Add
      	wascmp argument and set it accordingly.
      	* gimple-match-head.cc (bitwise_inverted_equal_p): Add
      	wascmp argument to the macro.
      	(gimple_bitwise_inverted_equal_p): Add
      	wascmp argument and set it accordingly.
      	* match.pd (`a & ~a`, `a ^| ~a`): Update call
      	to bitwise_inverted_equal_p and handle wascmp case.
      	(`(~x | y) & x`, `(~x | y) & x`, `a?~t:t`): Update
      	call to bitwise_inverted_equal_p and check to see
      	if was !wascmp or if precision was 1.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.c-torture/execute/pr110954-1.c: New test.
      f956c232
    • Martin Uecker's avatar
      c: Support for -Wuseless-cast [PR84510] · 68783211
      Martin Uecker authored
      Add support for Wuseless-cast C (and ObjC).
      
      	PR c/84510
      
      gcc/c/:
      	* c-typeck.cc (build_c_cast): Add warning.
      
      gcc/c-family/:
      	* c.opt: Enable warning for C and ObjC.
      
      gcc/:
      	* doc/invoke.texi: Update.
      
      gcc/testsuite/:
      	* gcc.dg/Wuseless-cast.c: New test.
      68783211
    • Pan Li's avatar
      RISC-V: Support RVV VFMSAC rounding mode intrinsic API · ee8a844d
      Pan Li authored
      
      This patch would like to support the rounding mode API for the
      VFMSAC for the below samples.
      
      * __riscv_vfmsac_vv_f32m1_rm
      * __riscv_vfmsac_vv_f32m1_rm_m
      * __riscv_vfmsac_vf_f32m1_rm
      * __riscv_vfmsac_vf_f32m1_rm_m
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc
      	(class vfmsac_frm): New class for vfmsac frm.
      	(vfmsac_frm_obj): New declaration.
      	(BASE): Ditto.
      	* config/riscv/riscv-vector-builtins-bases.h: Ditto.
      	* config/riscv/riscv-vector-builtins-functions.def
      	(vfmsac_frm): New function definition
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/float-point-msac.c: New test.
      ee8a844d
    • GCC Administrator's avatar
      Daily bump. · 4271b742
      GCC Administrator authored
      4271b742
  2. Aug 10, 2023
    • Jonathan Wakely's avatar
      libstdc++: Fix out-of-bounds read in format string "{:{}." [PR110974] · ecfd8c7f
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110974
      	* include/std/format (_Spec::_S_parse_width_or_precision): Check
      	for empty range before dereferencing iterator.
      	* testsuite/std/format/string.cc: Check for expected exception.
      	Fix expected exception message in test_pr110862() and actually
      	call it.
      ecfd8c7f
    • Jonathan Wakely's avatar
      libstdc++: Fix std::format for localized floats [PR110968] · f48a5423
      Jonathan Wakely authored
      The __formatter_fp::_M_localize function just returns an empty string if
      the formatting locale is the C locale, as there is nothing to do. But
      the caller was assuming that the returned string contains the localized
      string. The caller should use the original string if _M_localize returns
      an empty string.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110968
      	* include/std/format (__formatter_fp::format): Check return
      	value of _M_localize.
      	* testsuite/std/format/functions/format.cc: Check classic
      	locale.
      f48a5423
    • Jonathan Wakely's avatar
      libstdc++: Use alias template for iterator_category [PR110970] · 9cb2a7c8
      Jonathan Wakely authored
      This renames __iterator_category_t to __iter_category_t, for consistency
      with std::iter_value_t, std::iter_difference_t and std::iter_reference_t
      in C++20. Then use __iter_category_t in <bits/stl_iterator.h>, which
      fixes the problem of the missing 'typename' that Clang 15 incorrectly
      still requires.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110970
      	* include/bits/stl_iterator.h (__detail::__move_iter_cat): Use
      	__iter_category_t.
      	(iterator_traits<common_iterator<I, S>>::_S_iter_cat): Likewise.
      	(__detail::__basic_const_iterator_iter_cat): Likewise.
      	* include/bits/stl_iterator_base_types.h (__iterator_category_t):
      	Rename to __iter_category_t.
      9cb2a7c8
    • Jan Hubicka's avatar
      Fix division by zero in loop splitting · 39204ae9
      Jan Hubicka authored
      Profile update I added to tree-ssa-loop-split can divide by zero in
      situation that the conditional is predicted with 0 probability which
      is triggered by jump threading update in the testcase.
      
      gcc/ChangeLog:
      
      	PR middle-end/110923
      	* tree-ssa-loop-split.cc (split_loop): Watch for division by zero.
      
      gcc/testsuite/ChangeLog:
      
      	PR middle-end/110923
      	* gcc.dg/tree-ssa/pr110923.c: New test.
      39204ae9
    • Patrick O'Neill's avatar
      RISC-V: Add Ztso atomic mappings · 0ac32323
      Patrick O'Neill authored
      The RISC-V Ztso extension currently has no effect on generated code.
      With the additional ordering constraints guarenteed by Ztso, we can emit
      more optimized atomic mappings than the RVWMO mappings.
      
      This PR implements the Ztso psABI mappings[1].
      
      [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/391
      
      
      
      2023-08-08 Patrick O'Neill <patrick@rivosinc.com>
      
      gcc/ChangeLog:
      
      	* common/config/riscv/riscv-common.cc: Add Ztso and mark Ztso as
      	dependent on 'a' extension.
      	* config/riscv/riscv-opts.h (MASK_ZTSO): New mask.
      	(TARGET_ZTSO): New target.
      	* config/riscv/riscv.cc (riscv_memmodel_needs_amo_acquire): Add
      	Ztso case.
      	(riscv_memmodel_needs_amo_release): Add Ztso case.
      	(riscv_print_operand): Add Ztso case for LR/SC annotations.
      	* config/riscv/riscv.md: Import sync-rvwmo.md and sync-ztso.md.
      	* config/riscv/riscv.opt: Add Ztso target variable.
      	* config/riscv/sync.md (mem_thread_fence_1): Expand to RVWMO or
      	Ztso specific insn.
      	(atomic_load<mode>): Expand to RVWMO or Ztso specific insn.
      	(atomic_store<mode>): Expand to RVWMO or Ztso specific insn.
      	* config/riscv/sync-rvwmo.md: New file. Seperate out RVWMO
      	specific load/store/fence mappings.
      	* config/riscv/sync-ztso.md: New file. Seperate out Ztso
      	specific load/store/fence mappings.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/amo-table-ztso-amo-add-1.c: New test.
      	* gcc.target/riscv/amo-table-ztso-amo-add-2.c: New test.
      	* gcc.target/riscv/amo-table-ztso-amo-add-3.c: New test.
      	* gcc.target/riscv/amo-table-ztso-amo-add-4.c: New test.
      	* gcc.target/riscv/amo-table-ztso-amo-add-5.c: New test.
      	* gcc.target/riscv/amo-table-ztso-compare-exchange-1.c: New test.
      	* gcc.target/riscv/amo-table-ztso-compare-exchange-2.c: New test.
      	* gcc.target/riscv/amo-table-ztso-compare-exchange-3.c: New test.
      	* gcc.target/riscv/amo-table-ztso-compare-exchange-4.c: New test.
      	* gcc.target/riscv/amo-table-ztso-compare-exchange-5.c: New test.
      	* gcc.target/riscv/amo-table-ztso-compare-exchange-6.c: New test.
      	* gcc.target/riscv/amo-table-ztso-compare-exchange-7.c: New test.
      	* gcc.target/riscv/amo-table-ztso-fence-1.c: New test.
      	* gcc.target/riscv/amo-table-ztso-fence-2.c: New test.
      	* gcc.target/riscv/amo-table-ztso-fence-3.c: New test.
      	* gcc.target/riscv/amo-table-ztso-fence-4.c: New test.
      	* gcc.target/riscv/amo-table-ztso-fence-5.c: New test.
      	* gcc.target/riscv/amo-table-ztso-load-1.c: New test.
      	* gcc.target/riscv/amo-table-ztso-load-2.c: New test.
      	* gcc.target/riscv/amo-table-ztso-load-3.c: New test.
      	* gcc.target/riscv/amo-table-ztso-store-1.c: New test.
      	* gcc.target/riscv/amo-table-ztso-store-2.c: New test.
      	* gcc.target/riscv/amo-table-ztso-store-3.c: New test.
      	* gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c: New test.
      	* gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c: New test.
      	* gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c: New test.
      	* gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c: New test.
      	* gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c: New test.
      
      Signed-off-by: default avatarPatrick O'Neill <patrick@rivosinc.com>
      0ac32323
    • Jan Hubicka's avatar
      Fix profile update in duplicat_loop_body_to_header_edge for loops with 0 count_in · 937591d2
      Jan Hubicka authored
      this patch makes duplicate_loop_body_to_header_edge to not drop profile counts to
      uninitialized when count_in is 0.  This happens because profile_probability in 0 count
      is undefined.
      
      gcc/ChangeLog:
      
      	* cfgloopmanip.cc (duplicate_loop_body_to_header_edge): Special case loops with
      	0 iteration count.
      937591d2
    • Jan Hubicka's avatar
      Fix profile updating bug in tree-ssa-threadupdate · 546bf79b
      Jan Hubicka authored
      ssa_fix_duplicate_block_edges later calls update_profile to correct profile after threading.
      In the testcase this does not work since we lose track of the duplicated edge.  This
      happens because redirect_edge_and_branch returns NULL if the edge already has correct
      destination which is the case.
      
      gcc/ChangeLog:
      
      	* tree-ssa-threadupdate.cc (ssa_fix_duplicate_block_edges): Fix profile update.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/phi_on_compare-1.c: Check profile consistency.
      546bf79b
    • Jan Hubicka's avatar
      Fix undefined behaviour in profile_count::differs_from_p · e4110308
      Jan Hubicka authored
      This patch avoid overflow in profile_count::differs_from_p and also makes it to
      return false from one of the values is undefined while other is defined.
      
      gcc/ChangeLog:
      
      	* profile-count.cc (profile_count::differs_from_p): Fix overflow and
      	handling of undefined values.
      e4110308
    • Jakub Jelinek's avatar
      phiopt: Fix phiopt ICE on vops [PR102989] · 8afe9d5d
      Jakub Jelinek authored
      I've ran into ICE on gcc.dg/torture/bitint-42.c with -O1 or -Os
      when enabling expensive tests, and unfortunately I can't reproduce without
      _BitInt.  The IL before phiopt3 has:
        <bb 87> [local count: 203190070]:
        # .MEM_428 = VDEF <.MEM_367>
        bitint.159 = VIEW_CONVERT_EXPR<unsigned long[8]>(*.LC3);
        goto <bb 89>; [100.00%]
      
        <bb 88> [local count: 203190070]:
        # .MEM_427 = VDEF <.MEM_367>
        bitint.159 = VIEW_CONVERT_EXPR<unsigned long[8]>(*.LC4);
      
        <bb 89> [local count: 406380139]:
        # .MEM_368 = PHI <.MEM_428(87), .MEM_427(88)>
        # VUSE <.MEM_368>
        _123 = VIEW_CONVERT_EXPR<unsigned long[8]>(r495[i_107].D.2780)[0];
      and factor_out_conditional_operation is called on the vop PHI, it
      sees it has exactly two operands and defining statements of both
      PHI arguments are converts (VCEs in this case), so it thinks it is
      a good idea to try to optimize that and while doing that it constructs
      void type SSA_NAMEs and the like.
      
      2023-08-10  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/102989
      	* tree-ssa-phiopt.cc (single_non_singleton_phi_for_edges): Never
      	return virtual phis and return NULL if there is a virtual phi
      	where the arguments from E0 and E1 edges aren't equal.
      8afe9d5d
    • Richard Biener's avatar
      Make ISEL used internal functions const/nothrow where appropriate · b0894a12
      Richard Biener authored
      Both .VEC_SET and .VEC_EXTACT and the various .VCOND internal functions
      are operating on registers only and they are not supposed to raise
      any exceptions.  The following makes them const/nothrow.  I've
      verified this avoids useless SSA updates in ISEL.
      
      	* internal-fn.def (VCOND, VCONDU, VCONDEQ, VCOND_MASK,
      	VEC_SET, VEC_EXTRACT): Make ECF_CONST | ECF_NOTHROW.
      b0894a12
    • Juzhe-Zhong's avatar
      RISC-V: Add MASK vec_duplicate pattern[PR110962] · da7b43fb
      Juzhe-Zhong authored
      This patch fix bug:
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110962
      
      SUBROUTINE a(b,c,d)
        LOGICAL,DIMENSION(INOUT)  :: b
        LOGICAL e
        REAL, DIMENSION(IN)     ::  c
        REAL, DIMENSION(INOUT)  ::  d
        REAL, DIMENSION(SIZE(c))   :: f
        WHERE (b.AND.e)
           WHERE (f>=0.)
              d = g
           ENDWHERE
        ENDWHERE
      END SUBROUTINE a
      
         PR target/110962
      
      gcc/ChangeLog:
      	PR target/110962
      	* config/riscv/autovec.md (vec_duplicate<mode>): New pattern.
      da7b43fb
    • Pan Li's avatar
      RISC-V: Support RVV VFNMACC rounding mode intrinsic API · 6176527a
      Pan Li authored
      
      This patch would like to support the rounding mode API for the
      VFNMACC for the below samples.
      
      * __riscv_vfnmacc_vv_f32m1_rm
      * __riscv_vfnmacc_vv_f32m1_rm_m
      * __riscv_vfnmacc_vf_f32m1_rm
      * __riscv_vfnmacc_vf_f32m1_rm_m
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc
      	(class vfnmacc_frm): New class for vfnmacc.
      	(vfnmacc_frm_obj): New declaration.
      	(BASE): Ditto.
      	* config/riscv/riscv-vector-builtins-bases.h: Ditto.
      	* config/riscv/riscv-vector-builtins-functions.def
      	(vfnmacc_frm): New function definition.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/float-point-nmacc.c: New test.
      6176527a
    • Pan Li's avatar
      RISC-V: Support RVV VFMACC rounding mode intrinsic API · 07e93224
      Pan Li authored
      
      This patch would like to support the rounding mode API for the
      VFMACC for the below samples.
      
      * __riscv_vfmacc_vv_f32m1_rm
      * __riscv_vfmacc_vv_f32m1_rm_m
      * __riscv_vfmacc_vf_f32m1_rm
      * __riscv_vfmacc_vf_f32m1_rm_m
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc
      	(class vfmacc_frm): New class for vfmacc frm.
      	(vfmacc_frm_obj): New declaration.
      	(BASE): Ditto.
      	* config/riscv/riscv-vector-builtins-bases.h: Ditto.
      	* config/riscv/riscv-vector-builtins-functions.def
      	(vfmacc_frm): New function definition.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/float-point-macc.c: New test.
      07e93224
    • Juzhe-Zhong's avatar
      RISC-V: Support TU for integer ternary OP[PR110964] · 887f1391
      Juzhe-Zhong authored
      PR target/110964
      
      gcc/ChangeLog:
      	PR target/110964
      	* config/riscv/riscv-v.cc (expand_cond_len_ternop): Add integer ternary.
      
      gcc/testsuite/ChangeLog:
      	PR target/110964
      	* gcc.target/riscv/rvv/autovec/pr110964.c: New test.
      887f1391
    • Richard Biener's avatar
      Remove insert location argument from vectorizable_live_operation · 9b8ebdb6
      Richard Biener authored
      The insert location argument isn't actually used but we compute
      that ourselves.  There's a single spot, namely when asking
      for the loop mask via vect_get_loop_mask that the passed argument
      is used but that looks like an oversight.  The following fixes that
      and adjusts vectorizable_live_operation and can_vectorize_live_stmts
      to no longer take a stmt iterator argument.
      
      	* tree-vectorizer.h (vectorizable_live_operation): Remove
      	gimple_stmt_iterator * argument.
      	* tree-vect-loop.cc (vectorizable_live_operation): Likewise.
      	Adjust plumbing around vect_get_loop_mask.
      	(vect_analyze_loop_operations): Adjust.
      	* tree-vect-slp.cc (vect_slp_analyze_node_operations_1): Likewise.
      	(vect_bb_slp_mark_live_stmts): Likewise.
      	(vect_schedule_slp_node): Likewise.
      	* tree-vect-stmts.cc (can_vectorize_live_stmts): Likewise.
      	Remove gimple_stmt_iterator * argument.
      	(vect_transform_stmt): Adjust.
      9b8ebdb6
    • Juzhe-Zhong's avatar
      RISC-V: Add missing modes to the iterators · 6bdbf172
      Juzhe-Zhong authored
      gcc/ChangeLog:
      
      	* config/riscv/vector-iterators.md: Add missing modes.
      6bdbf172
    • Jakub Jelinek's avatar
      lto-streamer-in: Adjust assert [PR102989] · d5ad55a8
      Jakub Jelinek authored
      With _BitInt(575) or any other _BitInt(513) or larger constants we can
      run into this assertion.  MAX_BITSIZE_MODE_ANY_INT is just a value from
      which WIDE_INT_MAX_PRECISION is derived.
      
      2023-08-10  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/102989
      	* lto-streamer-in.cc (lto_input_tree_1): Assert TYPE_PRECISION
      	is up to WIDE_INT_MAX_PRECISION rather than MAX_BITSIZE_MODE_ANY_INT.
      d5ad55a8
    • Jakub Jelinek's avatar
      expr: Small optimization [PR102989] · b129d6b5
      Jakub Jelinek authored
      Small optimization to avoid testing modifier multiple times.
      
      2023-08-10  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/102989
      	* expr.cc (expand_expr_real_1) <case MEM_REF>: Add an early return for
      	EXPAND_WRITE or EXPAND_MEMORY modifiers to avoid testing it multiple
      	times.
      b129d6b5
    • liuhongt's avatar
      i386: Do not sanitize upper part of V2HFmode and V4HFmode reg with -fno-trapping-math [PR110832] · 0c563a93
      liuhongt authored
      Also add ix86_partial_vec_fp_math to to condition of V2HF/V4HF named
      patterns in order to avoid generation of partial vector V8HFmode
      trapping instructions.
      
      gcc/ChangeLog:
      
      	PR target/110832
      	* config/i386/mmx.md: (movq_<mode>_to_sse): Also do not
      	sanitize upper part of V4HFmode register with
      	-fno-trapping-math.
      	(<insn>v4hf3): Enable for ix86_partial_vec_fp_math.
      	(<divv4hf3): Ditto.
      	(<insn>v2hf3): Ditto.
      	(divv2hf3): Ditto.
      	(movd_v2hf_to_sse): Do not sanitize upper part of V2HFmode
      	register with -fno-trapping-math.
      0c563a93
    • Pan Li's avatar
      RISC-V: Refactor RVV frm_mode attr for rounding mode intrinsic · 4cede0de
      Pan Li authored
      
      The frm_mode attr has some assumptions for each define insn as below.
      
      1. The define insn has at least 9 operands.
      2. The operands[9] must be frm reg.
      3. The operands[9] must be const int.
      
      Actually, the frm operand can be operands[8], operands[9] or
      operands[10], and not all the define insn has frm operands.
      
      This patch would like to refactor frm and eliminate the above
      assumptions, as well as unblock the underlying rounding mode intrinsic
      API support.
      
      After refactor, the default frm will be none, and the selected insn type
      will be dyn. For the floating point which honors the frm, we will
      set the frm_mode attr explicitly in define_insn.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      Co-Authored-by: default avatarKito Cheng <kito.cheng@sifive.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-protos.h
      	(enum floating_point_rounding_mode): Add NONE, DYN_EXIT and DYN_CALL.
      	(get_frm_mode): New declaration.
      	* config/riscv/riscv-v.cc (get_frm_mode): New function to get frm mode.
      	* config/riscv/riscv-vector-builtins.cc
      	(function_expander::use_ternop_insn): Take care of frm reg.
      	* config/riscv/riscv.cc (riscv_static_frm_mode_p): Migrate to FRM_XXX.
      	(riscv_emit_frm_mode_set): Ditto.
      	(riscv_emit_mode_set): Ditto.
      	(riscv_frm_adjust_mode_after_call): Ditto.
      	(riscv_frm_mode_needed): Ditto.
      	(riscv_frm_mode_after): Ditto.
      	(riscv_mode_entry): Ditto.
      	(riscv_mode_exit): Ditto.
      	* config/riscv/riscv.h (NUM_MODES_FOR_MODE_SWITCHING): Ditto.
      	* config/riscv/vector.md
      	(rne,rtz,rdn,rup,rmm,dyn,dyn_exit,dyn_call,none): Removed
      	(symbol_ref): * config/riscv/vector.md: Set frm_mode attr explicitly.
      4cede0de
    • GCC Administrator's avatar
      Daily bump. · 9b099a83
      GCC Administrator authored
      9b099a83
  3. Aug 09, 2023
    • Juzhe-Zhong's avatar
      RISC-V: Fix VLMAX AVL incorrect local anticipate [VSETVL PASS] · 83c77b31
      Juzhe-Zhong authored
      Realize we have a bug in VSETVL PASS which is triggered by strided_load_run-1.c in RV32 system.
      
      FAIL: gcc.target/riscv/rvv/autovec/gather-scatter/strided_load_run-1.c execution test
      FAIL: gcc.target/riscv/rvv/autovec/gather-scatter/strided_load_run-1.c execution test
      FAIL: gcc.target/riscv/rvv/autovec/gather-scatter/strided_load_run-1.c execution test
      FAIL: gcc.target/riscv/rvv/autovec/gather-scatter/strided_load_run-1.c execution test
      
      This is because VSETVL PASS incorrect hoist vsetvl instruction:
      
      ...
         10156:	0d9075d7          	vsetvli	a1,zero,e64,m2,ta,ma ---> pollute 'a1' register which will be used by following insns.
         1015a:	01d586b3          	add	a3,a1,t4  --------> use 'a1'
         1015e:	5e070257          	vmv.v.v	v4,v14
         10162:	b7032257          	vmacc.vv	v4,v6,v16
         10166:	26440257          	vand.vv	v4,v4,v8
         1016a:	22880227          	vs2r.v	v4,(a6)
         1016e:	00b6b7b3          	sltu	a5,a3,a1
         10172:	22888227          	vs2r.v	v4,(a7)
         10176:	9e60b157          	vmv2r.v	v2,v6
         1017a:	97ba                	add	a5,a5,a4
         1017c:	a6a62157          	vmadd.vv	v2,v12,v10
         10180:	26240157          	vand.vv	v2,v2,v8
         10184:	22830127          	vs2r.v	v2,(t1)
         10188:	873e                	mv	a4,a5
         1018a:	982a                	add	a6,a6,a0
         1018c:	98aa                	add	a7,a7,a0
         1018e:	932a                	add	t1,t1,a0
         10190:	85b6                	mv	a1,a3       -----> set 'a1'
      ...
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vsetvl.cc (anticipatable_occurrence_p): Fix
      	incorrect anticipate info.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/gather-scatter/strided_load_run-1.c:
      	Adapt test.
      	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-24.c: Ditto.
      	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-25.c: Ditto.
      	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-26.c: Ditto.
      	* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-36.c: Ditto.
      	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-14.c: Ditto.
      	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-15.c: Ditto.
      83c77b31
    • David Malcolm's avatar
      analyzer: remove default return value from region_model::on_call_pre · 73da34a5
      David Malcolm authored
      
      Previously, the code for simulating calls to external functions in
      region_model::on_call_pre wrote a default svalue to the LHS of the
      call statement, which could be further overwritten by known_function
      subclasses.
      
      Unfortunately, this led to messy hacks, such as when the default svalue
      was an allocation: the LHS would be written to with two different
      heap-allocated regions, requiring special-case cleanups to avoid the
      stray state from the first heap allocation leading to state explosions;
      see r14-3001-g021077b94741c9.
      
      The following patch eliminates this write of a default svalue to the LHS
      of callsite.  Instead, all known_function implementations that have a
      return value are now responsible for set the LHS themselves.  A new
      call_details::set_any_lhs_with_defaults function is provided to make it
      easy to get the old behavior.
      
      On working through the various known_function subclasses, I noticed that
      memset was using the default behavior.  That patch updates this so that
      it's now known to return its first parameter.
      
      Cleaning this up eliminates various doubling of saved_diagnostics (e.g.
      for dubious_allocation_size) where it was generating a diagnostic for
      both writes to the LHS, deduplicating them to the first diagnostic (with
      the default LHS), and then failing to create a region_creation_event
      when emitting the diagnostic, leading to the fallback wording in
      dubious_allocation_size::describe_final_event, such as:
      
        (1) allocated 42 bytes and assigned to ‘int32_t *’ {aka ‘int *’} here; ‘sizeof (int32_t {aka int})’ is ‘4’
      
      Without the double write to the LHS, it creates a region_creation_event,
      so we get the allocation and the assignment as two separate events in
      the diagnostic path, e.g.:
      
        (1) allocated 42 bytes here
        (2) assigned to ‘int32_t *’ {aka ‘int *’} here; ‘sizeof (int32_t {aka int})’ is ‘4’
      
      gcc/analyzer/ChangeLog:
      	* analyzer.h (class pure_known_function_with_default_return): New
      	subclass.
      	* call-details.cc (const_fn_p): Move here from region-model.cc.
      	(maybe_get_const_fn_result): Likewise.
      	(get_result_size_in_bytes): Likewise.
      	(call_details::set_any_lhs_with_defaults): New function, based on
      	code in region_model::on_call_pre.
      	* call-details.h (call_details::set_any_lhs_with_defaults): New
      	decl.
      	* diagnostic-manager.cc
      	(diagnostic_manager::emit_saved_diagnostic): Log the index of the
      	saved_diagnostic.
      	* kf.cc (pure_known_function_with_default_return::impl_call_pre):
      	New.
      	(kf_memset::impl_call_pre): Set the LHS to the first param.
      	(kf_putenv::impl_call_pre): Call cd.set_any_lhs_with_defaults.
      	(kf_sprintf::impl_call_pre): Call cd.set_any_lhs_with_defaults.
      	(class kf_stack_restore): Derive from
      	pure_known_function_with_default_return.
      	(class kf_stack_save): Likewise.
      	(kf_strlen::impl_call_pre): Call cd.set_any_lhs_with_defaults.
      	* region-model-reachability.cc (reachable_regions::handle_sval):
      	Remove logic for symbolic regions for pointers.
      	* region-model.cc (region_model::canonicalize): Remove purging of
      	dynamic extents workaround for surplus values from
      	region_model::on_call_pre's default LHS code.
      	(const_fn_p): Move to call-details.cc.
      	(maybe_get_const_fn_result): Likewise.
      	(get_result_size_in_bytes): Likewise.
      	(region_model::update_for_nonzero_return): Call
      	cd.set_any_lhs_with_defaults.
      	(region_model::on_call_pre): Remove the assignment to the LHS of a
      	default return value, instead requiring all known_function
      	implementations to write to any LHS of the call.  Use
      	cd.set_any_lhs_with_defaults on the non-kf paths.
      	* sm-fd.cc (kf_socket::outcome_of_socket::update_model): Use
      	cd.set_any_lhs_with_defaults when failing to get at fd state.
      	(kf_bind::outcome_of_bind::update_model): Likewise.
      	(kf_listen::outcome_of_listen::update_model): Likewise.
      	(kf_accept::outcome_of_accept::update_model): Likewise.
      	(kf_connect::outcome_of_connect::update_model): Likewise.
      	(kf_read::impl_call_pre): Use cd.set_any_lhs_with_defaults.
      	* sm-file.cc (class kf_stdio_output_fn): Derive from
      	pure_known_function_with_default_return.
      	(class kf_ferror): Likewise.
      	(class kf_fileno): Likewise.
      	(kf_fgets::impl_call_pre): Use cd.set_any_lhs_with_defaults.
      	(kf_read::impl_call_pre): Likewise.
      	(class kf_getc): Derive from
      	pure_known_function_with_default_return.
      	(class kf_getchar): Likewise.
      	* varargs.cc (kf_va_arg::impl_call_pre): Use
      	cd.set_any_lhs_with_defaults.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/analyzer/allocation-size-1.c: Update expected results
      	to reflect splitting of allocation size and assignment messages
      	from a single event into pairs of events
      	* gcc.dg/analyzer/allocation-size-2.c: Likewise.
      	* gcc.dg/analyzer/allocation-size-3.c: Likewise.
      	* gcc.dg/analyzer/allocation-size-4.c: Likewise.
      	* gcc.dg/analyzer/allocation-size-multiline-1.c: Likewise.
      	* gcc.dg/analyzer/allocation-size-multiline-2.c: Likewise.
      	* gcc.dg/analyzer/allocation-size-multiline-3.c: Likewise.
      	* gcc.dg/analyzer/memset-1.c (test_1): Verify that the return
      	value is the initial argument.
      	* gcc.dg/plugin/analyzer_kernel_plugin.c
      	(copy_across_boundary_fn::impl_call_pre): Ensure the LHS is set on
      	the "known zero size" case.
      	* gcc.dg/plugin/analyzer_known_fns_plugin.c
      	(known_function_attempt_to_copy::impl_call_pre): Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      73da34a5
    • Tsukasa OI's avatar
      RISC-V: Remove non-existing 'Zve32d' extension · e5fe7f2f
      Tsukasa OI authored
      Since this extension does not exist, this commit prunes this from
      the defined extension version table.
      
      gcc/ChangeLog:
      
      	* common/config/riscv/riscv-common.cc (riscv_ext_version_table):
      	Remove 'Zve32d' from the version list.
      e5fe7f2f
    • Jin Ma's avatar
      RISC-V: Handle no_insn in TARGET_SCHED_VARIABLE_ISSUE. · f088b768
      Jin Ma authored
      Reference: https://github.com/gcc-mirror/gcc/commit/d0bc0cb66bcb0e6a5a5a31a9e900e8ccc98e34e5
      
      
      
      RISC-V should also be implemented to handle no_insn patterns for pipelining.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv.cc (riscv_sched_variable_issue): New function.
      	(TARGET_SCHED_VARIABLE_ISSUE): New macro.
      
      Co-authored-by: default avatarPhilipp Tomsich <philipp.tomsich@vrull.eu>
      Co-authored-by: default avatarJeff Law <jlaw@ventanamicro.com>
      f088b768
    • Jivan Hakobyan's avatar
      RISC-V: Folding memory for FP + constant case · a16dc729
      Jivan Hakobyan authored
      Accessing local arrays element turned into load form (fp + (index << C1)) +
      C2 address.
      
      In the case when access is in the loop we got loop invariant computation.  For
      some reason, moving out that part cannot be done in loop-invariant passes.  But
      we can handle that in target-specific hook (legitimize_address).  That provides
      an opportunity to rewrite memory access more suitable for the target
      architecture.
      
      This patch solves the mentioned case by rewriting mentioned case to ((fp +
      C2) + (index << C1))
      
      I have evaluated it on SPEC2017 and got an improvement on leela (over 7b
      instructions, .39% of the dynamic count) and dwarfs the regression for gcc (14m
      instructions, .0012% of the dynamic count).
      
      gcc/ChangeLog:
      	* config/riscv/riscv.cc (riscv_legitimize_address): Handle folding.
      	(mem_shadd_or_shadd_rtx_p): New function.
      a16dc729
    • Andrew Pinski's avatar
      MATCH: [PR110937/PR100798] (a ? ~b : b) should be optimized to b ^ -(a) · 7fb65f10
      Andrew Pinski authored
      This adds a simple match pattern for this case.
      I noticed it a couple of different places.
      One while I was looking at code generation of a parser and
      also while I was looking at locations where bitwise_inverted_equal_p
      should be used more.
      
      Committed as approved after bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR tree-optimization/110937
      	PR tree-optimization/100798
      
      gcc/ChangeLog:
      
      	* match.pd (`a ? ~b : b`): Handle this
      	case.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/bool-14.c: New test.
      	* gcc.dg/tree-ssa/bool-15.c: New test.
      	* gcc.dg/tree-ssa/phi-opt-33.c: New test.
      	* gcc.dg/tree-ssa/20030709-2.c: Update testcase
      	so `a ? -1 : 0` is not used to hit the match
      	pattern.
      7fb65f10
    • Uros Bizjak's avatar
      i386: Add missing dot to -mpartial-vector-fp-math description · 5c27c911
      Uros Bizjak authored
      gcc/ChangeLog:
      
      	* config/i386/i386.opt (mpartial-vector-fp-math): Add dot.
      5c27c911
    • Richard Ball's avatar
      aarch64: Add support for Cortex-A520 CPU · 464e2074
      Richard Ball authored
      This patch adds support for the Cortex-A520 CPU to GCC.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-cores.def (AARCH64_CORE): Add Cortex-A520 CPU.
      	* config/aarch64/aarch64-tune.md: Regenerate.
      	* doc/invoke.texi: Document Cortex-A520 CPU.
      464e2074
    • Carl Love's avatar
      rs6000: Fix __builtin_altivec_vcmpne{b,h,w} implementation · 29e2bc5f
      Carl Love authored
      The current built-in definitions for vcmpneb, vcmpneh, vcmpnew are defined
      under the Power 9 section of r66000-builtins.  This implies they are only
      supported on Power 9 and above when in fact they are defined and work with
      Altivec as well with the appropriate Altivec instruction generation.
      
      The vec_cmpne builtin should generate the vcmpequ{b,h,w} instruction with
      Altivec enabled and generate the vcmpne{b,h,w} on Power 9 and newer
      processors.
      
      This patch moves the definitions to the Altivec stanza to make it clear
      the built-ins are supported for all Altivec processors.  The patch
      removes the confusion as to which processors support the vcmpequ{b,h,w}
      instructions.
      
      There is existing test coverage for the vec_cmpne built-in for
      vector bool char, vector bool short, vector bool int,
      vector bool long long in builtins-3-p9.c and p8vector-builtin-2.c.
      Coverage for vector signed int, vector unsigned int is in
      p8vector-builtin-2.c.
      
      Test vec-cmpne.c is updated to check the generation of the vcmpequ{b,h,w}
      instructions for Altivec.  A new test vec-cmpne-runnable.c is added to
      verify the built-ins work as expected.
      
      Patch has been tested on Power 8 LE/BE, Power 9 LE/BE and Power 10 LE
      with no regressions.
      
      gcc/ChangeLog:
      
      	* config/rs6000/rs6000-builtins.def (vcmpneb, vcmpneh, vcmpnew):
      	Move definitions to Altivec stanza.
      	* config/rs6000/altivec.md (vcmpneb, vcmpneh, vcmpnew): New
      	define_expand.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/powerpc/vec-cmpne-runnable.c: New execution test.
      	* gcc.target/powerpc/vec-cmpne.c (define_test_functions,
      	execute_test_functions): Move to vec-cmpne.h.  Add
      	scan-assembler-times for vcmpequb, vcmpequh, vcmpequw.
      	* gcc.target/powerpc/vec-cmpne.h: New include file for vec-cmpne.c
      	and vec-cmpne-runnable.c. Split define_test_functions definition
      	into define_test_functions and define_init_verify_functions.
      29e2bc5f
    • Jonathan Wakely's avatar
      libstdc++: Fix constexpr functions to conform to older standards · b3a2b307
      Jonathan Wakely authored
      Some constexpr functions were inadvertently relying on relaxed constexpr
      rules from later standards.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/chrono.h (duration_cast): Do not use braces
      	around statements for C++11 constexpr rules.
      	* include/bits/stl_algobase.h (__lg): Rewrite as a single
      	statement for C++11 constexpr rules.
      	* include/experimental/bits/fs_path.h (path::string): Use
      	_GLIBCXX17_CONSTEXPR not _GLIBCXX_CONSTEXPR for 'if constexpr'.
      	* include/std/charconv (__to_chars_8): Initialize variable for
      	C++17 constexpr rules.
      b3a2b307
    • Jonathan Wakely's avatar
      libstdc++: Fix a -Wsign-compare warning in std::list · 9bd19443
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* include/bits/list.tcc (list::sort(Cmp)): Fix -Wsign-compare
      	warning for loop condition.
      9bd19443
    • Jonathan Wakely's avatar
      libstdc++: Suppress clang -Wc99-extensions warnings in <complex> · 798b1f04
      Jonathan Wakely authored
      This prevents Clang from warning about the use of the non-standard
      __complex__ keyword.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/complex: Add diagnostic pragma for clang.
      798b1f04
    • Jonathan Wakely's avatar
      libstdc++: Fix some -Wmismatched-tags warnings · 5b46eacc
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* include/bits/shared_ptr_atomic.h (atomic): Change class-head
      	to struct.
      	* include/bits/stl_tree.h (_Rb_tree_merge_helper): Change
      	class-head to struct in friend declaration.
      	* include/std/chrono (tzdb_list::_Node): Likewise.
      	* include/std/future (_Task_state_base, _Task_state): Likewise.
      	* include/std/scoped_allocator (__inner_type_impl): Likewise.
      	* include/std/valarray (_BinClos, _SClos, _GClos, _IClos)
      	(_ValFunClos, _RefFunClos): Change class-head to struct.
      5b46eacc
Loading