Skip to content
Snippets Groups Projects
  1. Jan 05, 2024
    • Jonathan Wakely's avatar
      libstdc++: Do not use __is_convertible unconditionally [PR113241] · 57fa5b60
      Jonathan Wakely authored
      The new __is_convertible built-in should only be used after checking
      that it's supported.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/113241
      	* include/std/type_traits (is_convertible_v): Guard use of
      	built-in with preprocessor check.
      57fa5b60
    • Jonathan Wakely's avatar
      contrib: Remove C-style comments from Python files · 29abd09a
      Jonathan Wakely authored
      These Python scripts have "*/" at the end of the license header comment
      blocks, presumably copy&pasted from C files.
      
      contrib/ChangeLog:
      
      	* analyze_brprob.py: Remove stray text at end of comment.
      	* analyze_brprob_spec.py: Likewise.
      	* check-params-in-docs.py: Likewise.
      	* check_GNU_style.py: Likewise.
      	* check_GNU_style_lib.py: Likewise.
      	* filter-clang-warnings.py: Likewise.
      	* gcc-changelog/git_check_commit.py: Likewise.
      	* gcc-changelog/git_commit.py: Likewise.
      	* gcc-changelog/git_email.py: Likewise.
      	* gcc-changelog/git_repository.py: Likewise.
      	* gcc-changelog/git_update_version.py: Likewise.
      	* gcc-changelog/test_email.py: Likewise.
      	* gen_autofdo_event.py: Likewise.
      	* mark_spam.py: Likewise.
      	* unicode/gen-box-drawing-chars.py: Likewise.
      	* unicode/gen-combining-chars.py: Likewise.
      	* unicode/gen-printable-chars.py: Likewise.
      	* unicode/gen_wcwidth.py: Likewise.
      29abd09a
    • Jonathan Wakely's avatar
      contrib: Add script name to usage error in gen_wcwidth.py · 1bc9eddb
      Jonathan Wakely authored
      contrib/ChangeLog:
      
      	* unicode/gen_wcwidth.py: Add sys.argv[0] to usage error.
      1bc9eddb
    • Lulu Cheng's avatar
      LoongArch: Fixed the problem of incorrect judgment of the immediate field of... · 03c7df97
      Lulu Cheng authored
      LoongArch: Fixed the problem of incorrect judgment of the immediate field of the [x]vld/[x]vst instruction.
      
      The [x]vld/[x]vst directive is defined as follows:
        [x]vld/[x]vst {x/v}d, rj, si12
      
      When not modified, the immediate field of [x]vld/[x]vst is between 10 and
      14 bits depending on the type. However, in loongarch_valid_offset_p, the
      immediate field is restricted first, so there is no error. However, in
      some cases redundant instructions will be generated, see test cases.
      Now modify it according to the description in the instruction manual.
      
      gcc/ChangeLog:
      
      	* config/loongarch/lasx.md (lasx_mxld_<lasxfmt_f>):
      	Modify the method of determining the memory offset of [x]vld/[x]vst.
      	(lasx_mxst_<lasxfmt_f>): Likewise.
      	* config/loongarch/loongarch.cc (loongarch_valid_offset_p): Delete.
      	(loongarch_address_insns): Likewise.
      	* config/loongarch/lsx.md (lsx_ld_<lsxfmt_f>): Likewise.
      	(lsx_st_<lsxfmt_f>): Likewise.
      	* config/loongarch/predicates.md (aq10b_operand): Likewise.
      	(aq10h_operand): Likewise.
      	(aq10w_operand): Likewise.
      	(aq10d_operand): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/loongarch/vect-ld-st-imm12.c: New test.
      03c7df97
    • chenxiaolong's avatar
      LoongArch: testsuite:Give up the detection of the gcc.dg/fma-{3, 4, 6, 7}.c file. · f8e4412b
      chenxiaolong authored
      On the LoongArch architecture, the above four test cases need to be waived
      during testing. There are two situations:
      
      1. The function of fma-{3,6}.c test is to find the value of c-a*b, but on
      the LoongArch architecture, the function of the existing fnmsub instruction
      is to find the value of -(a*b - c);
      
      2. The function of fma-{4,7}.c test is to find the value of -(a*b)-c, but on
      the LoongArch architecture, the function of the existing fnmadd instruction
      is to find the value of -(a*b + c);
      
      Through the analysis of the above two cases, there will be positive and
      negative zero inequality.
      
      gcc/testsuite/ChangeLog
      
      	* gcc.dg/fma-3.c: The intermediate file corresponding to the
      	function does not produce the corresponding FNMA symbol, so the test
      	rules should be skipped when testing.
      	* gcc.dg/fma-4.c: The intermediate file corresponding to the
      	function does not produce the corresponding FNMS symbol, so skip the
      	test rules when testing.
      	* gcc.dg/fma-6.c: The cause is the same as fma-3.c.
      	* gcc.dg/fma-7.c: The cause is the same as fma-4.c
      f8e4412b
    • chenxiaolong's avatar
      LoongArch: testsuite:Added additional vectorization "-mlasx" compilation option. · b2de0b84
      chenxiaolong authored
      In the LoongArch architecture, the reason for not adding the 128-bit
      vector-width-*hi* instruction template in the GCC back end is that it causes
      program performance loss, so we can only add the "-mlasx" compilation option
      to use 256-bit vectorization functions in test files.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/bb-slp-pattern-1.c: If you are testing on the
      	LoongArch architecture, you need to add the "-mlasx" compilation
      	option to generate vectorized code.
      	* gcc.dg/vect/slp-widen-mult-half.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-const-s16.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-const-u16.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-half-u8.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-half.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-u16.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-u8-s16-s32.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-u8-u32.c: Dito.
      	* gcc.dg/vect/vect-widen-mult-u8.c: Dito.
      b2de0b84
    • chenxiaolong's avatar
      LoongArch: testsuite:Delete the default run behavior in pr60510.f. · 70069fd2
      chenxiaolong authored
      When binutils does not support vector instruction sets, the test program fails
      because it does not recognize vectorization at the assembly stage. Therefore,
      the default run behavior of the program is deleted, so that the behavior of
      the program depends on whether the software supports vectorization.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/vect/pr60510.f: Delete the default behavior of the
      	program.
      70069fd2
    • chenxiaolong's avatar
      LoongArch: testsuite:Fix FAIL in file bind_c_array_params_2.f90. · 4ae1ab1f
      chenxiaolong authored
      On the LoongArch architecture, an error was found in the
      bind_c_array_params_2.f90 file because there was no proper assembly code
      for the regular expression detection function call, such as bl %plt(myBindC).
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/bind_c_array_params_2.f90: Add code test rules to
      	support testing of the loongArch architecture.
      4ae1ab1f
    • chenxiaolong's avatar
      LoongArch: testsuite:Added detection support for LoongArch architecture in vect-{82, 83}.c. · 12ad10af
      chenxiaolong authored
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/vect-82.c: Add the LoongArch architecture to the
      	object detection framework.
      	* gcc.dg/vect/vect-83.c: Dito.
      12ad10af
    • chenxiaolong's avatar
      LoongArch: testsuite:Modify the test behavior of the vect-bic-bitmask-{12, 23}.c file. · 0eba9cae
      chenxiaolong authored
      Before modifying the test behavior of the program, dg-do is set to assemble in
      vect-bic-bitmask-{12,23}.c. However, when the binutils library does not support
      the vector instruction set, it will FAIL to recognize the vector instruction
      and fail item will appear in the assembly stage. So set the program's dg-do to
      compile.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/vect-bic-bitmask-12.c: Change the default
      	setting of assembly to compile.
      	* gcc.dg/vect/vect-bic-bitmask-23.c: Dito.
      0eba9cae
    • chenxiaolong's avatar
      LoongArch: testsuite:Added support for vector object detection. · 8a2ca066
      chenxiaolong authored
      - Change the default vectorization "-mlasx" option to "-mlsx" because there
      are many non-aligned memory accesses when using 256-bit vectorization.
      
      - The following detection procedure is added to the target-supports.exp file:
      
      1.check_effective_target_scalar_all_fma
      2.check_effective_target_vect_int
      3.check_effective_target_vect_intfloat_cvt
      4.check_effective_target_vect_doubleint_cvt
      5.check_effective_target_vect_intdouble_cvt
      6.check_effective_target_vect_uintfloat_cvt
      7.check_effective_target_vect_floatint_cvt
      8.check_effective_target_vect_floatuint_cvt
      9.check_effective_target_vect_shift
      10.check_effective_target_vect_var_shift
      11.check_effective_target_whole_vector_shift
      12.check_effective_target_vect_bswap
      13.check_effective_target_vect_bool_cmp
      14.check_effective_target_vect_char_add
      15.check_effective_target_vect_shift_char
      16.check_effective_target_vect_long
      17.check_effective_target_vect_float
      18.check_effective_target_vect_double
      19.check_effective_target_vect_long_long
      20.check_effective_target_vect_perm
      21.check_effective_target_vect_perm_byte
      22.check_effective_target_vect_perm_short
      23.check_effective_target_vect_widen_sum_hi_to_si
      24.check_effective_target_vect_widen_sum_qi_to_hi
      25.check_effective_target_vect_widen_sum_qi_to_hi
      26.check_effective_target_vect_widen_mult_qi_to_hi
      27.check_effective_target_vect_widen_mult_hi_to_si
      28.check_effective_target_vect_widen_mult_qi_to_hi_pattern
      29.check_effective_target_vect_widen_mult_hi_to_si_pattern
      30.check_effective_target_vect_widen_mult_si_to_di_pattern
      31.check_effective_target_vect_sdot_qi
      32.check_effective_target_vect_udot_qi
      33.check_effective_target_vect_sdot_hi
      34.check_effective_target_vect_udot_hi
      35.check_effective_target_vect_usad_char
      36.check_effective_target_vect_avg_qi
      37.check_effective_target_vect_pack_trunc
      38.check_effective_target_vect_unpack
      39.check_effective_target_vect_hw_misalign
      40.check_effective_target_vect_gather_load_ifn
      40.check_effective_target_vect_condition
      42.check_effective_target_vect_cond_mixed
      43.check_effective_target_vect_char_mult
      44.check_effective_target_vect_short_mult
      45.check_effective_target_vect_int_mult
      46.check_effective_target_vect_long_mult
      47.check_effective_target_vect_int_mod
      48.check_effective_target_vect_extract_even_odd
      49.check_effective_target_vect_interleave
      50.check_effective_target_vect_call_copysignf
      51.check_effective_target_vect_call_sqrtf
      52.check_effective_target_vect_call_lrint
      53.check_effective_target_vect_call_btrunc
      54.check_effective_target_vect_call_btruncf
      55.check_effective_target_vect_call_ceil
      56.check_effective_target_vect_call_ceilf
      57.check_effective_target_vect_call_floor
      58.check_effective_target_vect_call_floorf
      59.check_effective_target_vect_call_lceil
      60.check_effective_target_vect_call_lfloor
      61.check_effective_target_vect_logical_reduc
      62.check_effective_target_section_anchors
      63.check_vect_support_and_set_flags
      64.check_effective_target_vect_max_reduc
      65.check_effective_target_loongarch_sx
      66.check_effective_target_loongarch_sx_hw
      
      gcc/testsuite/ChangeLog:
      
      	* lib/target-supports.exp: Add LoongArch to the list of supported
      	targets.
      8a2ca066
    • Alex Coplan's avatar
      aarch64: Further fix for throwing insns in ldp/stp pass [PR113217] · 4b67ec7f
      Alex Coplan authored
      As the PR shows, the fix in
      r14-6916-g057dc349021660c40699fb5c98fd9cac8e168653 was not complete.
      That fix was enough to stop us trying to move throwing accesses above
      nondebug insns, but due to this code in try_fuse_pair:
      
        // Placement strategy: push loads down and pull stores up, this should
        // help register pressure by reducing live ranges.
        if (load_p)
          range.first = range.last;
        else
          range.last = range.first;
      
      we would still try to move stores up above any debug insns that occurred
      immediately after the previous nondebug insn.  This patch fixes that by
      narrowing the move range in the case that the second access is throwing
      to exactly the range of that insn.
      
      Note that we still need the fix to latest_hazard_before mentioned above
      so as to ensure we select a suitable base and reject pairs if it isn't
      viable to form the pair at the end of the BB.
      
      gcc/ChangeLog:
      
      	PR target/113217
      	* config/aarch64/aarch64-ldp-fusion.cc
      	(ldp_bb_info::try_fuse_pair): If the second access can throw,
      	narrow the move range to exactly that insn.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/113217
      	* g++.dg/pr113217.C: New test.
      4b67ec7f
    • Ilya Leoshkevich's avatar
      asan: Align .LASANPC on function boundary · e66dc37b
      Ilya Leoshkevich authored
      GCC can emit code between the function label and the .LASANPC label,
      making the latter unaligned.  Some architectures cannot load unaligned
      labels directly and require literal pool entries, which is inefficient.
      
      Move the invocation of asan_function_start to
      ASM_OUTPUT_FUNCTION_LABEL, which guarantees that no additional code is
      emitted.  This allows setting the .LASANPC label alignment to the
      respective function alignment.
      
      Link: https://inbox.sourceware.org/gcc-patches/20240102194511.3171559-3-iii@linux.ibm.com/
      
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      
      gcc/ChangeLog:
      
      	* asan.cc (asan_function_start): Drop switch_to_section ().
      	(asan_emit_stack_protection): Set .LASANPC alignment.
      	* config/i386/i386.cc: Use assemble_function_label_raw ()
      	instead of ASM_OUTPUT_LABEL ().
      	* config/s390/s390.cc (s390_asm_output_function_label):
      	Likewise.
      	* defaults.h (ASM_OUTPUT_FUNCTION_LABEL): Likewise.
      	* final.cc (final_start_function_1): Drop
      	asan_function_start ().
      	* output.h (assemble_function_label_raw): New function.
      	* varasm.cc (assemble_function_label_raw): Likewise.
      e66dc37b
    • Ilya Leoshkevich's avatar
      Implement ASM_DECLARE_FUNCTION_NAME using ASM_OUTPUT_FUNCTION_LABEL · c659dd8b
      Ilya Leoshkevich authored
      gccint recommends using ASM_OUTPUT_FUNCTION_LABEL in
      ASM_DECLARE_FUNCTION_NAME, but many implementations use
      ASM_OUTPUT_LABEL instead.  It's inconsistent and prevents changes to
      ASM_OUTPUT_FUNCTION_LABEL from affecting the respective targets.
      
      Link: https://inbox.sourceware.org/gcc-patches/20240102194511.3171559-2-iii@linux.ibm.com/
      
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64.cc (aarch64_declare_function_name):
      	Use ASM_OUTPUT_FUNCTION_LABEL ().
      	* config/alpha/alpha.cc (alpha_start_function): Likewise.
      	* config/arm/aout.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
      	* config/arm/arm.cc (arm_asm_declare_function_name): Likewise.
      	* config/bfin/bfin.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
      	* config/c6x/c6x.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
      	* config/gcn/gcn.cc (gcn_hsa_declare_function_name): Likewise.
      	* config/h8300/h8300.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
      	* config/ia64/ia64.cc (ia64_start_function): Likewise.
      	* config/mcore/mcore-elf.h (ASM_DECLARE_FUNCTION_NAME):
      	Likewise.
      	* config/microblaze/microblaze.cc (microblaze_function_prologue):
      	Likewise.
      	* config/mips/mips.cc (mips_start_unique_function): Return the
      	tree.
      	(mips_start_function_definition): Use
      	ASM_OUTPUT_FUNCTION_LABEL ().
      	(mips_finish_stub): Pass the tree to
      	mips_start_function_definition ().
      	(mips16_build_function_stub): Likewise.
      	(mips16_build_call_stub): Likewise.
      	(mips_output_function_prologue): Likewise.
      	* config/pa/pa.cc (pa_output_function_label): Use
      	ASM_OUTPUT_FUNCTION_LABEL ().
      	* config/riscv/riscv.cc (riscv_declare_function_name): Likewise.
      	* config/rs6000/rs6000.cc (rs6000_elf_declare_function_name):
      	Likewise.
      	(rs6000_xcoff_declare_function_name): Likewise.
      c659dd8b
    • Jonathan Wakely's avatar
      libstdc++: Fix std::char_traits<C>::move [PR113200] · 15cc2918
      Jonathan Wakely authored
      The current constexpr implementation of std::char_traits<C>::move relies
      on being able to compare the pointer parameters, which is not allowed
      for unrelated pointers. We can use __builtin_constant_p to determine
      whether it's safe to compare the pointers directly. If not, then we know
      the ranges must be disjoint and so we can use char_traits<C>::copy to
      copy forwards from the first character to the last. If the pointers can
      be compared directly, then we can simplify the condition for copying
      backwards to just two pointer comparisons.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/113200
      	* include/bits/char_traits.h (__gnu_cxx::char_traits::move): Use
      	__builtin_constant_p to check for unrelated pointers that cannot
      	be compared during constant evaluation.
      	* testsuite/21_strings/char_traits/requirements/113200.cc: New
      	test.
      15cc2918
    • Cassio Neri's avatar
      libstdc++: Remove UB from month and weekday additions and subtractions. · 2cb3d42d
      Cassio Neri authored
      The following invoke signed integer overflow (UB) [1]:
      
        month   + months{MAX} // where MAX is the maximum value of months::rep
        month   + months{MIN} // where MIN is the maximum value of months::rep
        month   - months{MIN} // where MIN is the minimum value of months::rep
        weekday + days  {MAX} // where MAX is the maximum value of days::rep
        weekday - days  {MIN} // where MIN is the minimum value of days::rep
      
      For the additions to MAX, the crux of the problem is that, in libstdc++,
      months::rep and days::rep are int64_t. Other implementations use int32_t, cast
      operands to int64_t and perform arithmetic operations without risk of
      overflowing.
      
      For month + months{MIN}, the implementation follows the Standard's "returns
      clause" and evaluates:
      
         modulo(static_cast<long long>(unsigned{__x}) + (__y.count() - 1), 12);
      
      Overflow occurs when MIN - 1 is evaluated. Casting to a larger type could help
      but, unfortunately again, this is not possible for libstdc++.
      
      For the subtraction of MIN, the problem is that -MIN is not representable.
      
      It's fair to say that the intention is for these additions/subtractions to
      be performed in modulus (12 or 7) arithmetic so that no overflow is expected.
      
      To fix these UB, this patch implements:
      
        template <unsigned __d, typename _T>
        unsigned __add_modulo(unsigned __x, _T __y);
      
        template <unsigned __d, typename _T>
        unsigned __sub_modulo(unsigned __x, _T __y);
      
      which respectively, returns the remainder of Euclidean division of, __x + __y
      and __x - __y by __d without overflowing. These functions replace
      
        constexpr unsigned __modulo(long long __n, unsigned __d);
      
      which also calculates the reminder of __n, where __n is the result of the
      addition or subtraction. Hence, these operations might invoke UB before __modulo
      is called and thus, __modulo can't do anything to remediate the issue.
      
      In addition to solve the UB issues, __add_modulo and __sub_modulo allow better
      codegen (shorter and branchless) on x86-64 and ARM [2].
      
      [1] https://godbolt.org/z/a9YfWdn57
      [2] https://godbolt.org/z/Gh36cr7E4
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/chrono: Fix + and - for months and weekdays.
      	* testsuite/std/time/month/1.cc: Add constexpr tests against overflow.
      	* testsuite/std/time/month/2.cc: New test for extreme values.
      	* testsuite/std/time/weekday/1.cc: Add constexpr tests against overflow.
      	* testsuite/std/time/weekday/2.cc: New test for extreme values.
      2cb3d42d
    • Jonathan Wakely's avatar
      libstdc++: Use if-constexpr in std::__try_use_facet [PR113099] · 9f3eb93e
      Jonathan Wakely authored
      As noted in the PR, we can use if-constexpr for the explicit
      instantantiation definitions that are compiled with -std=gnu++11. We
      just need to disable the -Wc++17-extensions diagnostics.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/113099
      	* include/bits/locale_classes.tcc (__try_use_facet): Use
      	if-constexpr for C++11 and up.
      9f3eb93e
    • Jakub Jelinek's avatar
      scev: Avoid ICE on results used in abnormal PHI args [PR113201] · b8faf1fc
      Jakub Jelinek authored
      The following testcase ICEs when rslt is SSA_NAME_OCCURS_IN_ABNORMAL_PHI
      and we call replace_uses_by with a INTEGER_CST def, where it ICEs on:
                    if (e->flags & EDGE_ABNORMAL
                        && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val))
      because val is not an SSA_NAME.  One way would be to add
                        && TREE_CODE (val) == SSA_NAME
      check in between the above 2 lines in replace_uses_by.
      
      And/or the following patch just punts propagating constants to
      SSA_NAME_OCCURS_IN_ABNORMAL_PHI rslt uses.
      
      Or we could punt somewhere earlier in final value replacement (but dunno
      where).
      
      2024-01-05  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/113201
      	* tree-scalar-evolution.cc (final_value_replacement_loop): Don't call
      	replace_uses_by on SSA_NAME_OCCURS_IN_ABNORMAL_PHI rslt.
      
      	* gcc.c-torture/compile/pr113201.c: New test.
      b8faf1fc
    • Jakub Jelinek's avatar
      Improve __builtin_popcount* (x) == 1 generation if x is known != 0 [PR90693] · 0152637c
      Jakub Jelinek authored
      We expand __builtin_popcount* (x) == 1 as
      x ^ (x - 1) > x - 1, either unconditionally in tree-ssa-math-opts.cc
      if we don't have a direct optab support for popcount, or during
      expansion where we compare the costs of comparison of the popcount
      against one vs. the above expression.
      As mentioned in the PR, if we know from ranger that the argument is
      not zero, we can emit x & (x - 1) == 0 test which is same number of
      GIMPLE statements, but on many targets cheaper (e.g. whenever an AND
      instruction can also set flags on whether result was zero or not).
      
      The following patch does that.
      
      2024-01-05  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/90693
      	* tree-ssa-math-opts.cc (match_single_bit_test): If
      	tree_expr_nonzero_p (arg), remember it in the second argument to
      	IFN_POPCOUNT or lower it as arg & (arg - 1) == 0 rather than
      	arg ^ (arg - 1) > arg - 1.
      	* internal-fn.cc (expand_POPCOUNT): If second argument to
      	IFN_POPCOUNT suggests arg is non-zero, try to expand it as
      	arg & (arg - 1) == 0 rather than arg ^ (arg - 1) > arg - 1.
      
      	* gcc.target/i386/pr90693-2.c: New test.
      0152637c
    • Kito Cheng's avatar
      RISC-V: Fix wrong fix in last clean up · 397bdd1a
      Kito Cheng authored
      I just replace the wrong logic in last clean up...
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.h:
      	Fix the check condition.
      397bdd1a
    • Kito Cheng's avatar
      RISC-V: Clean up testsuite for multi-lib testing [NFC] · 085585e9
      Kito Cheng authored
      - Drop unnecessary including for stdlib.h and math.h
      - Drop assert.h / assert, use __builtin_abort instead.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h:
      	Use __builtin_abort instead of assert.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax-1.c: Drop math.h.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax-2.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax-3.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax-4.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin-1.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin-2.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin-3.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin-4.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-1.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-2.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-3.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-4.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-1.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-2.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-3.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-4.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.h: Use
      	__builtin_abort instead of assert.
      	* gcc.target/riscv/rvv/autovec/pr112694-1.c: Ditto.
      	* gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.h: Ditto.
      	* gcc.target/riscv/rvv/autovec/unop/abs-template.h: Drop stdlib.h.
      	* gcc.target/riscv/rvv/autovec/unop/vneg-template.h: Ditto.
      	* gcc.target/riscv/rvv/autovec/unop/vnot-template.h: Ditto.
      085585e9
    • Kito Cheng's avatar
      RISC-V: Clean up unused variable [NFC] · 05415dba
      Kito Cheng authored
      gcc/ChangeLog:
      
      	* config/riscv/riscv-v.cc (expand_load_store):
      	Remove `value`.
      	(expand_cond_len_op): Ditto.
      	(expand_gather_scatter): Ditto.
      	(expand_lanes_load_store): Ditto.
      	(expand_fold_extract_last): Ditto.
      05415dba
    • Jakub Jelinek's avatar
      Update copyright years. · 1ccad1f1
      Jakub Jelinek authored
      1ccad1f1
    • Jakub Jelinek's avatar
      Update copyright years. · 219a688b
      Jakub Jelinek authored
      219a688b
    • Pan Li's avatar
      Revert "RISC-V: Add crypto vector api-testing cases." · fc75b733
      Pan Li authored
      This reverts commit b3ec98d4.
      fc75b733
    • Pan Li's avatar
      Revert "RISC-V: Add crypto vector builtin function." · fd946ecb
      Pan Li authored
      This reverts commit 960c2620.
      fd946ecb
    • Feng Wang's avatar
      RISC-V: Add crypto vector api-testing cases. · b3ec98d4
      Feng Wang authored
      This patch add crypto vector api-testing cases based on
      https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/eopc/vector-crypto/auto-generated/vector-crypto
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/zvbb-intrinsic.c: New test.
      	* gcc.target/riscv/rvv/base/zvbb_vandn_vx_constraint.c: New test.
      	* gcc.target/riscv/rvv/base/zvbc-intrinsic.c: New test.
      	* gcc.target/riscv/rvv/base/zvbc_vx_constraint-1.c: New test.
      	* gcc.target/riscv/rvv/base/zvbc_vx_constraint-2.c: New test.
      	* gcc.target/riscv/rvv/base/zvkg-intrinsic.c: New test.
      	* gcc.target/riscv/rvv/base/zvkned-intrinsic.c: New test.
      	* gcc.target/riscv/rvv/base/zvknha-intrinsic.c: New test.
      	* gcc.target/riscv/rvv/base/zvknhb-intrinsic.c: New test.
      	* gcc.target/riscv/rvv/base/zvksed-intrinsic.c: New test.
      	* gcc.target/riscv/rvv/base/zvksh-intrinsic.c: New test.
      	* gcc.target/riscv/zvkb.c: New test.
      b3ec98d4
    • Feng Wang's avatar
      RISC-V: Add crypto vector builtin function. · 960c2620
      Feng Wang authored
      This patch add the intrinsic funtions of crypto vector based on the
      intrinsic doc(https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob
      /eopc/vector-crypto/auto-generated/vector-crypto/intrinsic_funcs.md).
      
      Co-Authored by: Songhe Zhu <zhusonghe@eswincomputing.com>
      Co-Authored by: Ciyan Pan <panciyan@eswincomputing.com>
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc (class vandn):
      				Add new function_base for crypto vector.
      	(class bitmanip): Ditto.
      	(class b_reverse):Ditto.
      	(class vwsll):   Ditto.
      	(class clmul):   Ditto.
      	(class vg_nhab):  Ditto.
      	(class crypto_vv):Ditto.
      	(class crypto_vi):Ditto.
      	(class vaeskf2_vsm3c):Ditto.
      	(class vsm3me): Ditto.
      	(BASE): Add BASE declaration for crypto vector.
      	* config/riscv/riscv-vector-builtins-bases.h: Ditto.
      	* config/riscv/riscv-vector-builtins-functions.def (REQUIRED_EXTENSIONS):
      				Add crypto vector intrinsic definition.
      	(vbrev): Ditto.
      	(vclz): Ditto.
      	(vctz): Ditto.
      	(vwsll): Ditto.
      	(vandn): Ditto.
      	(vbrev8): Ditto.
      	(vrev8): Ditto.
      	(vrol): Ditto.
      	(vror): Ditto.
      	(vclmul): Ditto.
      	(vclmulh): Ditto.
      	(vghsh): Ditto.
      	(vgmul): Ditto.
      	(vaesef): Ditto.
      	(vaesem): Ditto.
      	(vaesdf): Ditto.
      	(vaesdm): Ditto.
      	(vaesz): Ditto.
      	(vaeskf1): Ditto.
      	(vaeskf2): Ditto.
      	(vsha2ms): Ditto.
      	(vsha2ch): Ditto.
      	(vsha2cl): Ditto.
      	(vsm4k): Ditto.
      	(vsm4r): Ditto.
      	(vsm3me): Ditto.
      	(vsm3c): Ditto.
      	* config/riscv/riscv-vector-builtins-shapes.cc (struct crypto_vv_def):
      				Add new function_shape for crypto vector.
      	(struct crypto_vi_def): Ditto.
      	(struct crypto_vv_no_op_type_def): Ditto.
      	(SHAPE): Add SHAPE declaration of crypto vector.
      	* config/riscv/riscv-vector-builtins-shapes.h: Ditto.
      	* config/riscv/riscv-vector-builtins-types.def (DEF_RVV_CRYPTO_SEW32_OPS):
      				Add new data type for crypto vector.
      	(DEF_RVV_CRYPTO_SEW64_OPS): Ditto.
      	(vuint32mf2_t): Ditto.
      	(vuint32m1_t): Ditto.
      	(vuint32m2_t): Ditto.
      	(vuint32m4_t): Ditto.
      	(vuint32m8_t): Ditto.
      	(vuint64m1_t): Ditto.
      	(vuint64m2_t): Ditto.
      	(vuint64m4_t): Ditto.
      	(vuint64m8_t): Ditto.
      	* config/riscv/riscv-vector-builtins.cc (DEF_RVV_CRYPTO_SEW32_OPS):
      				Add new data struct for crypto vector.
      	(DEF_RVV_CRYPTO_SEW64_OPS): Ditto.
      	(registered_function::overloaded_hash): Processing size_t uimm for C overloaded func.
      	* config/riscv/riscv-vector-builtins.def (vi): Add vi OP_TYPE.
      960c2620
    • GCC Administrator's avatar
      Daily bump. · 81d1a6e9
      GCC Administrator authored
      81d1a6e9
    • Ken Matsui's avatar
      libstdc++: Use _GLIBCXX_USE_BUILTIN_TRAIT · f151db0f
      Ken Matsui authored
      
      This patch uses _GLIBCXX_USE_BUILTIN_TRAIT macro instead of __has_builtin
      in the type_traits header for traits that have a corresponding fallback
      non-built-in implementation.  This macro supports to toggle the use of
      built-in traits in the type_traits header through
      _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS macro, without needing to modify the
      source code.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/type_traits: Use _GLIBCXX_USE_BUILTIN_TRAIT.
      
      Signed-off-by: default avatarKen Matsui <kmatsui@gcc.gnu.org>
      Reviewed-by: default avatarPatrick Palka <ppalka@redhat.com>
      Reviewed-by: default avatarJonathan Wakely <jwakely@redhat.com>
      f151db0f
  2. Jan 04, 2024
    • Juzhe-Zhong's avatar
      RISC-V: Make liveness estimation be aware of .vi variant · 3ab4c381
      Juzhe-Zhong authored
      Consider this following case:
      
      void
      f (int *restrict a, int *restrict b, int *restrict c, int *restrict d, int n)
      {
        for (int i = 0; i < n; i++)
          {
            int tmp = b[i] + 15;
            int tmp2 = tmp + b[i];
            c[i] = tmp2 + b[i];
            d[i] = tmp + tmp2 + b[i];
          }
      }
      
      Current dynamic LMUL cost model choose LMUL = 4 because we count the "15" as
      consuming 1 vector register group which is not accurate.
      
      We teach the dynamic LMUL cost model be aware of the potential vi variant instructions
      transformation, so that we can choose LMUL = 8 according to more accurate cost model.
      
      After this patch:
      
      f:
      	ble	a4,zero,.L5
      .L3:
      	vsetvli	a5,a4,e32,m8,ta,ma
      	slli	a0,a5,2
      	vle32.v	v16,0(a1)
      	vadd.vi	v24,v16,15
      	vadd.vv	v8,v24,v16
      	vadd.vv	v0,v8,v16
      	vse32.v	v0,0(a2)
      	vadd.vv	v8,v8,v24
      	vadd.vv	v8,v8,v16
      	vse32.v	v8,0(a3)
      	add	a1,a1,a0
      	add	a2,a2,a0
      	add	a3,a3,a0
      	sub	a4,a4,a5
      	bne	a4,zero,.L3
      .L5:
      	ret
      
      Tested on both RV32 and RV64 no regression.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-costs.cc (variable_vectorized_p): Teach vi variant.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-13.c: New test.
      3ab4c381
    • Andrew Pinski's avatar
      Match: Improve inverted_equal_p for bool and `^` and `==` [PR113186] · 97def769
      Andrew Pinski authored
      
      For boolean types, `a ^ b` is a valid form for `a != b`. This means for
      gimple_bitwise_inverted_equal_p, we catch some inverted value forms. This
      patch extends inverted_equal_p to allow matching of `^` with the
      corresponding `==`. Note in the testcase provided we used to optimize
      in GCC 12 to just `return 0` where `a == b` was used,
      this allows us to do that again.
      
      Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR tree-optimization/113186
      
      gcc/ChangeLog:
      
      	* gimple-match-head.cc (gimple_bitwise_inverted_equal_p):
      	Match `^` with the `==` for 1bit integral types.
      	* match.pd (maybe_cmp): Allow for bit_xor for 1bit
      	integral types.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/bitops-bool-1.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      97def769
    • Arsen Arsenović's avatar
      libstdc++: fix typo in <generator> · 589781c1
      Arsen Arsenović authored
      libstdc++-v3/ChangeLog:
      
      	* include/std/generator (_Subyield_state::_M_jump_in): Fix typo
      	reported by Will Hawkins <hawkinsw@obs.cr>.
      589781c1
    • Arsen Arsenović's avatar
      libstdc++: rename _A badname in <generator> · 29ad18f0
      Arsen Arsenović authored
      libstdc++-v3/ChangeLog:
      
      	* include/std/generator (_Stateless_alloc): Rename typename _A
      	to _All.
      29ad18f0
    • Raiki Tamura's avatar
      libcpp: add function to check XID properties · 00dea7e8
      Raiki Tamura authored
      
      This commit adds a new function intended for checking the XID properties
      of a possibly unicode character, as well as the accompanying enum
      describing the possible properties.
      
      libcpp/ChangeLog:
      
      	* charset.cc (cpp_check_xid_property): New.
      	* include/cpplib.h
      	(cpp_check_xid_property): New.
      	(enum cpp_xid_property): New.
      
      Signed-off-by: default avatarRaiki Tamura <tamaron1203@gmail.com>
      00dea7e8
    • David Malcolm's avatar
      options: wire up options-urls.cc into gcc_urlifier · 4ded42c2
      David Malcolm authored
      
      Changed in v2:
      - split out from the code that generates options-urls.cc
      - call the generated function, rather than use a generated array
      - pass around lang_mask
      
      gcc/ChangeLog:
      	* diagnostic.h (diagnostic_make_option_url_cb): Add lang_mask
      	param.
      	(diagnostic_context::make_option_url): Update for lang_mask param.
      	* gcc-urlifier.cc: Include "opts.h" and "options.h".
      	(gcc_urlifier::gcc_urlifier): Add lang_mask param.
      	(gcc_urlifier::m_lang_mask): New field.
      	(doc_urls): Make static.
      	(gcc_urlifier::get_url_for_quoted_text): Use label_text.
      	(gcc_urlifier::get_url_suffix_for_quoted_text): Use label_text.
      	Look for an option by name before trying a binary search in
      	doc_urls.
      	(gcc_urlifier::get_url_suffix_for_quoted_text): Use label_text.
      	(gcc_urlifier::get_url_suffix_for_option): New.
      	(make_gcc_urlifier): Add lang_mask param.
      	(selftest::gcc_urlifier_cc_tests): Update for above changes.
      	Verify that a URL is found for "-fpack-struct".
      	* gcc-urlifier.def: Drop options "--version" and "-fpack-struct".
      	* gcc-urlifier.h (make_gcc_urlifier): Add lang_mask param.
      	* gcc.cc (driver::global_initializations): Pass 0 for lang_mask
      	to make_gcc_urlifier.
      	* opts-diagnostic.h (get_option_url): Add lang_mask param.
      	* opts.cc (get_option_html_page): Remove special-casing for
      	analyzer and LTO.
      	(get_option_url_suffix): New.
      	(get_option_url): Reimplement.
      	(selftest::test_get_option_html_page): Rename to...
      	(selftest::test_get_option_url_suffix): ...this and update for
      	above changes.
      	(selftest::opts_cc_tests): Update for renaming.
      	* opts.h: Include "rich-location.h".
      	(get_option_url_suffix): New decl.
      
      gcc/testsuite/ChangeLog:
      	* lib/gcc-dg.exp: Set TERM to xterm.
      
      gcc/ChangeLog:
      	* toplev.cc (general_init): Pass lang_mask to urlifier.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      4ded42c2
    • David Malcolm's avatar
      opts: add logic to generate options-urls.cc · 6ecc1e32
      David Malcolm authored
      
      Changed in v2:
      - split out from the code that uses this
      - now handles lang-specific URLs, as well as generic URLs
      - the generated options-urls.cc now contains a function with a
        switch statement, rather than an array, to support
        lang-specific URLs:
      
      const char *
      get_opt_url_suffix (int option_index, unsigned lang_mask)
      {
        switch (option_index)
          {
           [...snip...]
           case OPT_B:
             if (lang_mask & CL_D)
               return "gdc/Directory-Options.html#index-B";
             return "gcc/Directory-Options.html#index-B";
          [...snip...]
        return nullptr;
      }
      
      gcc/ChangeLog:
      	* Makefile.in (ALL_OPT_URL_FILES): New.
      	(GCC_OBJS): Add options-urls.o.
      	(OBJS): Likewise.
      	(OBJS-libcommon): Likewise.
      	(s-options): Depend on $(ALL_OPT_URL_FILES), and add this to
      	inputs to opt-gather.awk.
      	(options-urls.cc): New Makefile target.
      	* opt-functions.awk (url_suffix): New function.
      	(lang_url_suffix): New function.
      	* options-urls-cc-gen.awk: New file.
      	* opts.h (get_opt_url_suffix): New decl.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      6ecc1e32
    • David Malcolm's avatar
      Add generated .opt.urls files · 5bb18475
      David Malcolm authored
      
      Changed in v5: regenerated
      Changed in v4: regenerated
      Changed in v3: regenerated
      Changed in v2: the files now contain some lang-specific URLs.
      
      gcc/ada/ChangeLog:
      	* gcc-interface/lang.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/analyzer/ChangeLog:
      	* analyzer.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/c-family/ChangeLog:
      	* c.opt.urls: New file, autogenerated by regenerate-opt-urls.py.
      
      gcc/ChangeLog:
      	* common.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      	* config/aarch64/aarch64.opt.urls: Likewise.
      	* config/alpha/alpha.opt.urls: Likewise.
      	* config/alpha/elf.opt.urls: Likewise.
      	* config/arc/arc-tables.opt.urls: Likewise.
      	* config/arc/arc.opt.urls: Likewise.
      	* config/arm/arm-tables.opt.urls: Likewise.
      	* config/arm/arm.opt.urls: Likewise.
      	* config/arm/vxworks.opt.urls: Likewise.
      	* config/avr/avr.opt.urls: Likewise.
      	* config/bpf/bpf.opt.urls: Likewise.
      	* config/c6x/c6x-tables.opt.urls: Likewise.
      	* config/c6x/c6x.opt.urls: Likewise.
      	* config/cris/cris.opt.urls: Likewise.
      	* config/cris/elf.opt.urls: Likewise.
      	* config/csky/csky.opt.urls: Likewise.
      	* config/csky/csky_tables.opt.urls: Likewise.
      	* config/darwin.opt.urls: Likewise.
      	* config/dragonfly.opt.urls: Likewise.
      	* config/epiphany/epiphany.opt.urls: Likewise.
      	* config/fr30/fr30.opt.urls: Likewise.
      	* config/freebsd.opt.urls: Likewise.
      	* config/frv/frv.opt.urls: Likewise.
      	* config/ft32/ft32.opt.urls: Likewise.
      	* config/fused-madd.opt.urls: Likewise.
      	* config/g.opt.urls: Likewise.
      	* config/gcn/gcn.opt.urls: Likewise.
      	* config/gnu-user.opt.urls: Likewise.
      	* config/h8300/h8300.opt.urls: Likewise.
      	* config/hpux11.opt.urls: Likewise.
      	* config/i386/cygming.opt.urls: Likewise.
      	* config/i386/cygwin.opt.urls: Likewise.
      	* config/i386/djgpp.opt.urls: Likewise.
      	* config/i386/i386.opt.urls: Likewise.
      	* config/i386/mingw-w64.opt.urls: Likewise.
      	* config/i386/mingw.opt.urls: Likewise.
      	* config/i386/nto.opt.urls: Likewise.
      	* config/ia64/ia64.opt.urls: Likewise.
      	* config/ia64/ilp32.opt.urls: Likewise.
      	* config/ia64/vms.opt.urls: Likewise.
      	* config/iq2000/iq2000.opt.urls: Likewise.
      	* config/linux-android.opt.urls: Likewise.
      	* config/linux.opt.urls: Likewise.
      	* config/lm32/lm32.opt.urls: Likewise.
      	* config/loongarch/loongarch.opt.urls: Likewise.
      	* config/lynx.opt.urls: Likewise.
      	* config/m32c/m32c.opt.urls: Likewise.
      	* config/m32r/m32r.opt.urls: Likewise.
      	* config/m68k/ieee.opt.urls: Likewise.
      	* config/m68k/m68k-tables.opt.urls: Likewise.
      	* config/m68k/m68k.opt.urls: Likewise.
      	* config/m68k/uclinux.opt.urls: Likewise.
      	* config/mcore/mcore.opt.urls: Likewise.
      	* config/microblaze/microblaze.opt.urls: Likewise.
      	* config/mips/mips-tables.opt.urls: Likewise.
      	* config/mips/mips.opt.urls: Likewise.
      	* config/mips/sde.opt.urls: Likewise.
      	* config/mmix/mmix.opt.urls: Likewise.
      	* config/mn10300/mn10300.opt.urls: Likewise.
      	* config/moxie/moxie.opt.urls: Likewise.
      	* config/msp430/msp430.opt.urls: Likewise.
      	* config/nds32/nds32-elf.opt.urls: Likewise.
      	* config/nds32/nds32-linux.opt.urls: Likewise.
      	* config/nds32/nds32.opt.urls: Likewise.
      	* config/netbsd-elf.opt.urls: Likewise.
      	* config/netbsd.opt.urls: Likewise.
      	* config/nios2/elf.opt.urls: Likewise.
      	* config/nios2/nios2.opt.urls: Likewise.
      	* config/nvptx/nvptx-gen.opt.urls: Likewise.
      	* config/nvptx/nvptx.opt.urls: Likewise.
      	* config/openbsd.opt.urls: Likewise.
      	* config/or1k/elf.opt.urls: Likewise.
      	* config/or1k/or1k.opt.urls: Likewise.
      	* config/pa/pa-hpux.opt.urls: Likewise.
      	* config/pa/pa-hpux1010.opt.urls: Likewise.
      	* config/pa/pa-hpux1111.opt.urls: Likewise.
      	* config/pa/pa-hpux1131.opt.urls: Likewise.
      	* config/pa/pa.opt.urls: Likewise.
      	* config/pa/pa64-hpux.opt.urls: Likewise.
      	* config/pdp11/pdp11.opt.urls: Likewise.
      	* config/pru/pru.opt.urls: Likewise.
      	* config/riscv/riscv.opt.urls: Likewise.
      	* config/rl78/rl78.opt.urls: Likewise.
      	* config/rpath.opt.urls: Likewise.
      	* config/rs6000/476.opt.urls: Likewise.
      	* config/rs6000/aix64.opt.urls: Likewise.
      	* config/rs6000/darwin.opt.urls: Likewise.
      	* config/rs6000/linux64.opt.urls: Likewise.
      	* config/rs6000/rs6000-tables.opt.urls: Likewise.
      	* config/rs6000/rs6000.opt.urls: Likewise.
      	* config/rs6000/sysv4.opt.urls: Likewise.
      	* config/rtems.opt.urls: Likewise.
      	* config/rx/elf.opt.urls: Likewise.
      	* config/rx/rx.opt.urls: Likewise.
      	* config/s390/s390.opt.urls: Likewise.
      	* config/s390/tpf.opt.urls: Likewise.
      	* config/sh/sh.opt.urls: Likewise.
      	* config/sh/superh.opt.urls: Likewise.
      	* config/sol2.opt.urls: Likewise.
      	* config/sparc/long-double-switch.opt.urls: Likewise.
      	* config/sparc/sparc.opt.urls: Likewise.
      	* config/stormy16/stormy16.opt.urls: Likewise.
      	* config/v850/v850.opt.urls: Likewise.
      	* config/vax/elf.opt.urls: Likewise.
      	* config/vax/vax.opt.urls: Likewise.
      	* config/visium/visium.opt.urls: Likewise.
      	* config/vms/vms.opt.urls: Likewise.
      	* config/vxworks-smp.opt.urls: Likewise.
      	* config/vxworks.opt.urls: Likewise.
      	* config/xtensa/elf.opt.urls: Likewise.
      	* config/xtensa/uclinux.opt.urls: Likewise.
      	* config/xtensa/xtensa.opt.urls: Likewise.
      
      gcc/d/ChangeLog:
      	* lang.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/fortran/ChangeLog:
      	* lang.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/go/ChangeLog:
      	* lang.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/lto/ChangeLog:
      	* lang.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/m2/ChangeLog:
      	* lang.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/ChangeLog:
      	* params.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      gcc/rust/ChangeLog:
      	* lang.opt.urls: New file, autogenerated by
      	regenerate-opt-urls.py.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      5bb18475
    • David Malcolm's avatar
      options: add gcc/regenerate-opt-urls.py · 9e49746d
      David Malcolm authored
      In r14-5118-gc5db4d8ba5f3de I added a mechanism to automatically add
      URLs to quoted strings in diagnostics.  This was based on a data table
      mapping strings to URLs, with placeholder data covering various pragmas
      and a couple of options.
      
      The following patches add automatic URLification in our diagnostic
      messages to mentions of *all* of our options in quoted strings, linking
      to our HTML documentation.
      
      For example, with these patches, given:
      
        ./xgcc -B. -S t.c -Wctad-maybe-unsupported
        cc1: warning: command-line option ‘-Wctad-maybe-unsupported’ is valid for C++/ObjC++ but not for C
      
      the quoted string '-Wctad-maybe-unsupported' gets automatically URLified
      in a sufficiently modern terminal to:
        https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wctad-maybe-unsupported
      
      
      
      Objectives:
      - integrate with DOCUMENTATION_ROOT_URL
      - integrate with the existing .opt mechanisms
      - automate keeping the URLs up-to-date
      - work with target-specific options based on current configuration
      - work with lang-specific options based on current configuration
      - keep autogenerated material separate from the human-maintained .opt
        files
      - no new build-time requirements (by using awk at build time)
      - be maintainable
      
      The approach is a new regenerate-opt-urls.py which:
      - scrapes the generated HTML documentation finding anchors
        for options,
      - reads all the .opt files in the source tree
      - for each .opt file, generates a .opt.urls file; for each
        option in the .opt file it has either a UrlSuffix directives giving
        the final part of the URL of that option's documentation (relative
        to DOCUMENTATION_ROOT_URL), or a comment describing the problem.
      
      regenerate-opt-urls.py is written in Python 3, and has unit tests.
      I tested it with Python 3.8, and it probably works with earlier
      releases of Python 3.
      The .opt.urls files it generates become part of the source tree, and
      would be regenerated by maintainers whenever new options are added.
      Forgetting to update the files (or not having Python 3 handy) merely
      means that URLs might be missing or out of date until someone else
      regenerates them.
      
      At build time, the .opt.urls are added to .opt files when regenerating
      the optionslist file.  A new "options-urls-cc-gen.awk" is run at build
      time on the optionslist to generate a "options-urls.cc" file, and this
      is then used by the gcc_urlifier class when emitting diagnostics.
      
      Changed in v5:
      - removed commented-out code
      
      Changed in v4:
      - added PER_LANGUAGE_OPTION_INDEXES
      - added info to sourcebuild.texi on adding a new front end
      - removed TODOs and out-of-date comment
      
      Changed in v3:
      - Makefile.in: added OPT_URLS_HTML_DEPS and a comment
      
      Changed in v2:
      - added convenience targets to Makefile for regenerating the .opt.urls
        files, and for running unit tests for the generation code
      - parse gdc and gfortran documentation, and create LangUrlSuffix_{lang}
      directives for language-specific URLs.
      - add documentation to sourcebuild.texi
      
      gcc/ChangeLog:
      	* Makefile.in (OPT_URLS_HTML_DEPS): New.
      	(regenerate-opt-urls): New target.
      	(regenerate-opt-urls-unit-test): New target.
      	* doc/options.texi (Option properties): Add UrlSuffix and
      	description of regenerate-opt-urls.py.  Add LangUrlSuffix_*.
      	* doc/sourcebuild.texi (Anatomy of a Language Front End): Add
      	reference to regenerate-opt-urls.py's PER_LANGUAGE_OPTION_INDEXES
      	and Makefile.in's OPT_URLS_HTML_DEPS.
      	(Anatomy of a Target Back End): Add
      	reference to regenerate-opt-urls.py's TARGET_SPECIFIC_PAGES.
      	* regenerate-opt-urls.py: New file.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      9e49746d
    • David Malcolm's avatar
      analyzer: add sarif properties for checker events · 05c99b1c
      David Malcolm authored
      
      As another followup to r14-6057-g12b67d1e13b3cf, optionally add SARIF
      property bags to threadFlowLocation objects when writing out diagnostic
      paths, and add analyzer-specific properties to them.
      
      This was useful for debugging PR analyzer/112790.
      
      gcc/analyzer/ChangeLog:
      	* checker-event.cc: Include "diagnostic-format-sarif.h" and
      	"tree-logical-location.h".
      	(checker_event::maybe_add_sarif_properties): New.
      	(superedge_event::maybe_add_sarif_properties): New.
      	(superedge_event::superedge_event): Add comment.
      	* checker-event.h (checker_event::maybe_add_sarif_properties): New
      	decl.
      	(superedge_event::maybe_add_sarif_properties): New decl.
      
      gcc/ChangeLog:
      	* diagnostic-format-sarif.cc
      	(sarif_builder::make_logical_location_object): Convert to...
      	(make_sarif_logical_location_object): ...this.
      	(sarif_builder::set_any_logical_locs_arr): Update for above
      	change.
      	(sarif_builder::make_thread_flow_location_object): Call
      	maybe_add_sarif_properties on each diagnostic_event.
      	* diagnostic-format-sarif.h (class logical_location): New forward
      	decl.
      	(make_sarif_logical_location_object): New decl.
      	* diagnostic-path.h (class sarif_object): New forward decl.
      	(diagnostic_event::maybe_add_sarif_properties): New vfunc.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      05c99b1c
Loading