- Nov 14, 2023
-
-
David Malcolm authored
This patch eliminates the following functions that implicitly used global_dc's file cache: extern char_span location_get_source_line (const char *file_path, int line); extern char_span get_source_file_content (const char *file_path); extern bool location_missing_trailing_newline (const char *file_path); in favor of explicitly using a specific file_cache throughout, and only using global_dc's file_cache in gcc-specific code. Rather than creating global_dc's file_cache the first time its needed, this patch simply creates one when a diagnostic_context is initialized, and eliminates diagnostic_file_cache_init. No functional change intended. gcc/c-family/ChangeLog: * c-common.cc (c_get_substring_location): Use global_dc's file_cache. * c-format.cc (get_corrected_substring): Likewise. * c-indentation.cc (get_visual_column): Add file_cache param. (get_first_nws_vis_column): Likewise. (detect_intervening_unindent): Likewise. (should_warn_for_misleading_indentation): Use global_dc's file_cache. (assert_get_visual_column_succeeds): Add file_cache param. (ASSERT_GET_VISUAL_COLUMN_SUCCEEDS): Likewise. (assert_get_visual_column_fails): Likewise. (define ASSERT_GET_VISUAL_COLUMN_FAILS): Likewise. (selftest::test_get_visual_column): Create and use a temporary file_cache. gcc/cp/ChangeLog: * contracts.cc (build_comment): Use global_dc's file_cache. gcc/ChangeLog: * diagnostic-format-sarif.cc (sarif_builder::get_sarif_column): Use m_context's file_cache. (sarif_builder::maybe_make_artifact_content_object): Likewise. (sarif_builder::get_source_lines): Likewise. * diagnostic-show-locus.cc (exploc_with_display_col::exploc_with_display_col): Add file_cache param. (layout::m_file_cache): New field. (make_range): Add file_cache param. (selftest::test_layout_range_for_single_point): Create and use a temporary file_cache. (selftest::test_layout_range_for_single_line): Likewise. (selftest::test_layout_range_for_multiple_lines): Likewise. (layout::layout): Initialize m_file_cache from the context and use it. (layout::maybe_add_location_range): Use m_file_cache. (layout::calculate_x_offset_display): Likewise. (get_affected_range): Add file_cache param. (get_printed_columns): Likewise. (line_corrections::line_corrections): Likewwise. (line_corrections::m_file_cache): New field. (source_line::source_line): Add file_cache param. (line_corrections::add_hint): Use m_file_cache. (layout::print_trailing_fixits): Likewise. (layout::print_line): Likewise. (selftest::test_layout_x_offset_display_utf8): Create and use a temporary file_cache. (selftest::test_layout_x_offset_display_tab): Likewise. (selftest::test_diagnostic_show_locus_one_liner_utf8): Likewise. (selftest::test_add_location_if_nearby): Pass global_dc's file_cache to temp_source_file ctor. (selftest::test_overlapped_fixit_printing): Create and use a temporary file_cache. (selftest::test_overlapped_fixit_printing_utf8): Likewise. (selftest::test_overlapped_fixit_printing_2): Use dc's file_cache. * diagnostic.cc (diagnostic_context::initialize): Always create a file_cache. (diagnostic_context::initialize_input_context): Assume m_file_cache has already been created. (diagnostic_context::create_edit_context): Pass m_file_cache to edit_context. (convert_column_unit): Add file_cache param. (diagnostic_context::converted_column): Use context's file_cache. (print_parseable_fixits): Add file_cache param. (diagnostic_context::report_diagnostic): Use context's file_cache. (selftest::test_print_parseable_fixits_none): Create and use a temporary file_cache. (selftest::test_print_parseable_fixits_insert): Likewise. (selftest::test_print_parseable_fixits_remove): Likewise. (selftest::test_print_parseable_fixits_replace): Likewise. (selftest::test_print_parseable_fixits_bytes_vs_display_columns): Likewise. * diagnostic.h (diagnostic_context::file_cache_init): Delete. (diagnostic_context::get_file_cache): Convert return type from pointer to reference. * edit-context.cc (edited_file::get_file_cache): New. (edited_file::m_edit_context): New. (edit_context::edit_context): Add file_cache param. (edit_context::get_or_insert_file): Pass this to edited_file's ctor. (edited_file::edited_file): Add edit_context param. (edited_file::print_content): Use get_file_cache. (edited_file::print_diff_hunk): Likewise. (edited_file::print_run_of_changed_lines): Likewise. (edited_file::get_or_insert_line): Likewise. (edited_file::get_num_lines): Likewise. (edited_line::edited_line): Pass in file_cache and use it. (selftest::test_get_content): Create and use a temporary file_cache. (selftest::test_applying_fixits_insert_before): Likewise. (selftest::test_applying_fixits_insert_after): Likewise. (selftest::test_applying_fixits_insert_after_at_line_end): Likewise. (selftest::test_applying_fixits_insert_after_failure): Likewise. (selftest::test_applying_fixits_insert_containing_newline): Likewise. (selftest::test_applying_fixits_growing_replace): Likewise. (selftest::test_applying_fixits_shrinking_replace): Likewise. (selftest::test_applying_fixits_replace_containing_newline): Likewise. (selftest::test_applying_fixits_remove): Likewise. (selftest::test_applying_fixits_multiple): Likewise. (selftest::test_applying_fixits_multiple_lines): Likewise. (selftest::test_applying_fixits_modernize_named_init): Likewise. (selftest::test_applying_fixits_modernize_named_init): Likewise. (selftest::test_applying_fixits_unreadable_file): Likewise. (selftest::test_applying_fixits_line_out_of_range): Likewise. (selftest::test_applying_fixits_column_validation): Likewise. (selftest::test_applying_fixits_column_validation): Likewise. (selftest::test_applying_fixits_column_validation): Likewise. (selftest::test_applying_fixits_column_validation): Likewise. * edit-context.h (edit_context::edit_context): Add file_cache param. (edit_context::get_file_cache): New. (edit_context::m_file_cache): New. * final.cc: Include "diagnostic.h". (asm_show_source): Use global_dc's file_cache. * gcc-rich-location.cc (blank_line_before_p): Add file_cache param. (use_new_line): Likewise. (gcc_rich_location::add_fixit_insert_formatted): Use global dc's file_cache. * input.cc (diagnostic_file_cache_init): Delete. (diagnostic_context::file_cache_init): Delete. (diagnostics_file_cache_forcibly_evict_file): Delete. (file_cache::missing_trailing_newline_p): New. (file_cache::evicted_cache_tab_entry): Don't call diagnostic_file_cache_init. (location_get_source_line): Delete. (get_source_text_between): Add file_cache param. (get_source_file_content): Delete. (location_missing_trailing_newline): Delete. (location_compute_display_column): Add file_cache param. (dump_location_info): Create and use temporary file_cache. (get_substring_ranges_for_loc): Add file_cache param. (get_location_within_string): Likewise. (get_source_range_for_char): Likewise. (get_num_source_ranges_for_substring): Likewise. (selftest::test_reading_source_line): Create and use temporary file_cache. (selftest::lexer_test::m_file_cache): New field. (selftest::assert_char_at_range): Use test.m_file_cache. (selftest::assert_num_substring_ranges): Likewise. (selftest::assert_has_no_substring_ranges): Likewise. (selftest::test_lexer_string_locations_concatenation_2): Likewise. * input.h (class file_cache): New forward decl. (location_compute_display_column): Add file_cache param. (location_get_source_line): Delete. (get_source_text_between): Add file_cache param. (get_source_file_content): Delete. (location_missing_trailing_newline): Delete. (file_cache::missing_trailing_newline_p): New decl. (diagnostics_file_cache_forcibly_evict_file): Delete. * selftest.cc (named_temp_file::named_temp_file): Add file_cache param. (named_temp_file::~named_temp_file): Optionally evict the file from the given file_cache. (temp_source_file::temp_source_file): Add file_cache param. * selftest.h (class file_cache): New forward decl. (named_temp_file::named_temp_file): Add file_cache param. (named_temp_file::m_file_cache): New field. (temp_source_file::temp_source_file): Add file_cache param. * substring-locations.h (get_location_within_string): Add file_cache param. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Use global_dc's file cache. * gcc.dg/plugin/expensive_selftests_plugin.c: Likewise. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
David Malcolm authored
No functional change intended. gcc/ChangeLog: * diagnostic-format-json.cc: Use type-specific "set_*" functions of json::object to avoid naked new of json value subclasses. * diagnostic-format-sarif.cc: Likewise. * gcov.cc: Likewise. * json.cc (object::set_string): New. (object::set_integer): New. (object::set_float): New. (object::set_bool): New. (selftest::test_writing_objects): Use object::set_string. * json.h (object::set_string): New decl. (object::set_integer): New decl. (object::set_float): New decl. (object::set_bool): New decl. * optinfo-emit-json.cc: Use type-specific "set_*" functions of json::object to avoid naked new of json value subclasses. * timevar.cc: Likewise. * tree-diagnostic-path.cc: Likewise. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
Jonathan Wakely authored
The Xmethod for std::deque::size() assumed that the first element would be at the start of the first node. That's only true if elements are only added at the back. If an element is inserted at the front, or removed from the front (or anywhere before the middle) then the first node will not be completely populated, and the Xmethod will give the wrong result. libstdc++-v3/ChangeLog: PR libstdc++/112491 * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.size): Fix calculation to use _M_start._M_cur. * testsuite/libstdc++-xmethods/deque.cc: Check failing cases.
-
Andrew MacLeod authored
Create a range from the label type, and cast it to the required type. PR tree-optimization/112509 gcc/ * tree-vrp.cc (find_case_label_range): Create range from case labels. gcc/testsuite/ * gcc.dg/pr112509.c: New.
-
Stefan Schulze Frielinghaus authored
The offset for vec_scatter_element of floats should be a vector of type UV4SI instead of V4SF. Note, this is an incompatibility change. gcc/ChangeLog: * config/s390/s390-builtin-types.def: Add/remove types. * config/s390/s390-builtins.def (s390_vec_scatter_element_flt): The type for the offset should be UV4SI instead of V4SF.
-
Saurabh Jha authored
This patch tightens mve_vector_mem_operand to reject non-register operands inside {PRE,POST}_{INC,DEC} addresses by introducing a REG_P check. This patch fixes this ICE:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112337 gcc/ChangeLog: PR target/112337 * config/arm/arm.cc (mve_vector_mem_operand): Add a REG_P check for INC and DEC operations. gcc/testsuite/ChangeLog: PR target/112337 * gcc.target/arm/mve/pr112337.c: Test for REG_P check for INC and DEC operations.
-
Richard Biener authored
The change in r14-2852-gf5fb9ff2396fd4 failed to update patch_loop_exit to compensate for rewriting of a NE/EQ_EXPR to a new code. Fixed with the following. PR tree-optimization/111233 PR tree-optimization/111652 PR tree-optimization/111727 PR tree-optimization/111838 PR tree-optimization/112113 * tree-ssa-loop-split.cc (patch_loop_exit): Get the new guard code instead of the old guard stmt. (split_loop): Adjust. * gcc.dg/torture/pr111233.c: New testcase. * gcc.dg/torture/pr111652.c: Likewise. * gcc.dg/torture/pr111727.c: Likewise. * gcc.dg/torture/pr111838.c: Likewise. * gcc.dg/torture/pr112113.c: Likewise.
-
Richard Biener authored
The following adjusts data_dep_in_cycle_p to properly consider the whole loop nest when looking for data dep cycles and exempting zero-distance DDRs instead of just the outermost loop. * tree-loop-distribution.cc (loop_distribution::data_dep_in_cycle_p): Consider all loops in the nest when looking for lambda_vector_zerop.
-
Richard Biener authored
We currently distribute for (c = 2; c; c--) for (e = 0; e < 2; e++) { d[c] = b = d[c + 1]; d[c + 1].a = 0; } in a wrong way where the inner loop zero dependence distance should make us preserve stmt execution order. We fail to do so since we only look for a fully zero distance vector rather than looking at the innermost loop distance. This is somewhat similar to PR87022 where we instead looked at the outermost loop distance and changed this to what we do now. The following switches us to look at the innermost loop distance. PR tree-optimization/112281 * tree-loop-distribution.cc (pg_add_dependence_edges): Preserve stmt order when the innermost loop has exact overlap. * gcc.dg/torture/pr112281.c: New testcase.
-
GCC Administrator authored
-
Jakub Jelinek authored
On Sun, Nov 12, 2023 at 09:03:42PM -0000, Roger Sayle wrote: > This patch improves register pressure during reload, inspired by PR 97756. > Normally, a double-word right-shift by a constant produces a double-word > result, the highpart of which is dead when followed by a truncation. > The dead code calculating the high part gets cleaned up post-reload, so > the issue isn't normally visible, except for the increased register > pressure during reload, sometimes leading to odd register assignments. > Providing a post-reload splitter, which clobbers a single wordmode > result register instead of a doubleword result register, helps (a bit). Unfortunately this broke bootstrap on i686-linux, broke all ACATS tests on x86_64-linux as well as miscompiled e.g. __floattisf in libgcc there as well. The bug is that shrd{l,q} instruction expects the low part of the input to be the same register as the output, rather than the high part as the patch implemented. split_double_mode (<DWI>mode, &operands[1], 1, &operands[1], &operands[3]); sets operands[1] to the lo_half and operands[3] to the hi_half, so if operands[0] is not the same register as operands[1] (rather than [3]) after RA, we should during splitting move operands[1] into operands[0]. Your testcase: > #define MASK60 ((1ul << 60) - 1) > unsigned long foo (__uint128_t n) > { > unsigned long a = n & MASK60; > unsigned long b = (n >> 60); > b = b & MASK60; > unsigned long c = (n >> 120); > return a+b+c; > } still has the same number of instructions. Bootstrapped/regtested on x86_64-linux (where it e.g. turns === acats Summary === -# of unexpected failures 2328 +# of expected passes 2328 +# of unexpected failures 0 and fixes gcc.dg/torture/fp-int-convert-*timode.c FAILs as well) and i686-linux (where it previously didn't bootstrap, but compared to Friday evening's bootstrap the testresults are ok). 2023-11-14 Jakub Jelinek <jakub@redhat.com> PR target/112523 PR ada/112514 * config/i386/i386.md (<insn><dwi>3_doubleword_lowpart): Move operands[1] aka low part of input rather than operands[3] aka high part of input to output if not the same register.
-
Jakub Jelinek authored
The r14-5312-g040e5b0edbca861196d9e2ea2af5e805769c8d5d commit log contains a line from git revert with correct hash, but unfortunately hand ammended with explanation, so it got through the pre-commit hook but failed during update_version_git generation. Please don't do this. 2023-11-14 Jakub Jelinek <jakub@redhat.com> contrib/ChangeLog: * gcc-changelog/git_update_version.py: Add 040e5b0e to ignored commits.
-
Georg-Johann Lay authored
libgcc/config/avr/libf7/ * libf7-const.def [F7MOD_sinh_]: Add MiniMax polynomial. * libf7.c (f7_sinh): Use it instead of (exp(x) - exp(-x)) / 2 when |x| < 0.5 to avoid loss of precision due to cancellation.
-
Lehua Ding authored
Hi, This little patch adjust the assert in apx-spill_to_egprs-1.c testcase. The -mapxf compilation option allows more registers to be used, which in turn eliminates the need for local variables to be stored in stack memory. Therefore, the assertion is changed to detects no memory loaded through the %rsp register. gcc/testsuite/ChangeLog: * gcc.target/i386/apx-spill_to_egprs-1.c: Make sure that no local variables are stored on the stack.
-
Andreas Krebbel authored
This adds GTY markers to s390_builtin_types, s390_builtin_fn_types, and s390_builtin_decls. These were missing causing problems in particular when using builtins after including a precompiled header. Unfortunately the declaration of these data structures use enum values from s390-builtins.h. This file however is not included everywhere and is rather large. In order to include it only for the purpose of gtype-desc.cc we place a preprocessed copy of it in the build directory and include only this. This is going to be backported to GCC 12 and 13. gcc/ChangeLog: * config.gcc: Add s390-gen-builtins.h to target_gtfiles. * config/s390/s390-builtins.h (s390_builtin_types) (s390_builtin_fn_types, s390_builtin_decls): Add GTY marker. * config/s390/t-s390 (EXTRA_GTYPE_DEPS): Add s390-gen-builtins.h. Add build rule for s390-gen-builtins.h.
-
Andreas Krebbel authored
s390_resolve_overloaded_builtin, when called on NON_DEPENDENT_EXPR, ICEs when using the type from it which ends up as error_mark_node. This particular instance of the problem does not occur anymore since NON_DEPENDENT_EXPR has been removed. Nevertheless that case needs to be handled here. gcc/ChangeLog: * config/s390/s390-c.cc (s390_fn_types_compatible): Add a check for error_mark_node. gcc/testsuite/ChangeLog: * g++.target/s390/zvec-templ-1.C: New test.
-
Jonathan Wakely authored
Several users have been confused by the status of these warnings, which can be misunderstood as "this might not be what you want", rather than diagnostics required by the C++ standard. Add the text "ISO C++ does not allow" to make this clear. Also link them to -Wnarrowing so that they can be disabled or promoted to errors independently of other pedwarns. PR c++/111842 PR c++/112498 gcc/cp/ChangeLog: * call.cc (convert_like_internal): Use OPT_Wnarrowing for pedwarns about illformed conversions involving extended floating-point types. Clarify that ISO C++ requires these diagnostics. gcc/testsuite/ChangeLog: * g++.dg/cpp23/ext-floating16.C: New test. * g++.dg/cpp23/ext-floating17.C: New test.
-
Jakub Jelinek authored
The following patch adds 6 new type-generic builtins, __builtin_clzg __builtin_ctzg __builtin_clrsbg __builtin_ffsg __builtin_parityg __builtin_popcountg The g at the end stands for generic because the unsuffixed variant of the builtins already have unsigned int or int arguments. The main reason to add these is to support arbitrary unsigned (for clrsb/ffs signed) bit-precise integer types and also __int128 which wasn't supported by the existing builtins, so that e.g. <stdbit.h> type-generic functions could then support not just bit-precise unsigned integer type whose width matches a standard or extended integer type, but others too. None of these new builtins promote their first argument, so the argument can be e.g. unsigned char or unsigned short or unsigned __int20 etc. The first 2 support either 1 or 2 arguments, if only 1 argument is supplied, the behavior is undefined for argument 0 like for other __builtin_c[lt]z* builtins, if 2 arguments are supplied, the second argument should be int that will be returned if the argument is 0. All other builtins have just one argument. For __builtin_clrsbg and __builtin_ffsg the argument shall be any signed standard/extended or bit-precise integer, for the others any unsigned standard/extended or bit-precise integer (bool not allowed). One possibility would be to also allow signed integer types for the clz/ctz/parity/popcount ones (and just cast the argument to unsigned_type_for during folding) and similarly unsigned integer types for the clrsb/ffs ones, dunno what is better; for stdbit.h the current version is sufficient and diagnoses use of the inappropriate sign, though on the other side I wonder if users won't be confused by __builtin_clzg (1) being an error and having to write __builtin_clzg (1U). The new builtins are lowered to corresponding builtins with other suffixes or internal calls (plus casts and adjustments where needed) during FE folding or during gimplification at latest, the non-suffixed builtins handling precisions up to precision of int, l up to precision of long, ll up to precision of long long, up to __int128 precision lowered to double-word expansion early and the rest (which must be _BitInt) lowered to internal fn calls - those are then lowered during bitint lowering pass. The patch also changes representation of IFN_CLZ and IFN_CTZ calls, previously they were in the IL only if they are directly supported optab and depending on C[LT]Z_DEFINED_VALUE_AT_ZERO (...) == 2 they had or didn't have defined behavior at 0, now they are in the IL either if directly supported optab, or for the large/huge BITINT_TYPEs and they have either 1 or 2 arguments. If one, the behavior is undefined at zero, if 2, the second argument is an int constant that should be returned for 0. As there is no extra support during expansion, for directly supported optab the second argument if present should still match the C[LT]Z_DEFINED_VALUE_AT_ZERO (...) == 2 value, but for BITINT_TYPE arguments it can be arbitrary int INTEGER_CST. The indended uses in stdbit.h are e.g. #ifdef __has_builtin #if __has_builtin(__builtin_clzg) && __has_builtin(__builtin_ctzg) && __has_builtin(__builtin_popcountg) #define stdc_leading_zeros(value) \ ((unsigned int) __builtin_clzg (value, __builtin_popcountg ((__typeof (value)) ~(__typeof (value)) 0))) #define stdc_leading_ones(value) \ ((unsigned int) __builtin_clzg ((__typeof (value)) ~(value), __builtin_popcountg ((__typeof (value)) ~(__typeof (value)) 0))) #define stdc_first_trailing_one(value) \ ((unsigned int) (__builtin_ctzg (value, -1) + 1)) #define stdc_trailing_zeros(value) \ ((unsigned int) __builtin_ctzg (value, __builtin_popcountg ((__typeof (value)) ~(__typeof (value)) 0))) #endif #endif where __builtin_popcountg ((__typeof (x)) -1) computes the bit precision of x's type (kind of _Bitwidthof (x) alternative). They also allow casting of arbitrary unsigned _BitInt other than unsigned _BitInt(1) to corresponding signed _BitInt by using signed _BitInt(__builtin_popcountg ((__typeof (a)) -1)) and of arbitrary signed _BitInt to corresponding unsigned _BitInt using unsigned _BitInt(__builtin_clrsbg ((__typeof (a)) -1) + 1). 2023-11-14 Jakub Jelinek <jakub@redhat.com> PR c/111309 gcc/ * builtins.def (BUILT_IN_CLZG, BUILT_IN_CTZG, BUILT_IN_CLRSBG, BUILT_IN_FFSG, BUILT_IN_PARITYG, BUILT_IN_POPCOUNTG): New builtins. * builtins.cc (fold_builtin_bit_query): New function. (fold_builtin_1): Use it for BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G. (fold_builtin_2): Use it for BUILT_IN_{CLZ,CTZ}G. * fold-const-call.cc: Fix comment typo on tm.h inclusion. (fold_const_call_ss): Handle CFN_BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G. (fold_const_call_sss): New function. (fold_const_call_1): Call it for 2 argument functions returning scalar when passed 2 INTEGER_CSTs. * genmatch.cc (cmp_operand): For function calls also compare number of arguments. (fns_cmp): New function. (dt_node::gen_kids): Sort fns and generic_fns. (dt_node::gen_kids_1): Handle fns with the same id but different number of arguments. * match.pd (CLZ simplifications): Drop checks for defined behavior at zero. Add variant of simplifications for IFN_CLZ with 2 arguments. (CTZ simplifications): Drop checks for defined behavior at zero, don't optimize precisions above MAX_FIXED_MODE_SIZE. Add variant of simplifications for IFN_CTZ with 2 arguments. (a != 0 ? CLZ(a) : CST -> .CLZ(a)): Use TREE_TYPE (@3) instead of type, add BITINT_TYPE handling, create 2 argument IFN_CLZ rather than one argument. Add variant for matching CLZ with 2 arguments. (a != 0 ? CTZ(a) : CST -> .CTZ(a)): Similarly. * gimple-lower-bitint.cc (bitint_large_huge::lower_bit_query): New method. (bitint_large_huge::lower_call): Use it for IFN_{CLZ,CTZ,CLRSB,FFS} and IFN_{PARITY,POPCOUNT} calls. * gimple-range-op.cc (cfn_clz::fold_range): Don't check CLZ_DEFINED_VALUE_AT_ZERO for m_gimple_call_internal_p, instead assume defined value at zero if the call has 2 arguments and use second argument value for that case. (cfn_ctz::fold_range): Similarly. (gimple_range_op_handler::maybe_builtin_call): Use op_cfn_clz_internal or op_cfn_ctz_internal only if internal fn call has 2 arguments and set m_op2 in that case. * tree-vect-patterns.cc (vect_recog_ctz_ffs_pattern, vect_recog_popcount_clz_ctz_ffs_pattern): For value defined at zero use second argument of calls if present, otherwise assume UB at zero, create 2 argument .CLZ/.CTZ calls if needed. * tree-vect-stmts.cc (vectorizable_call): Handle 2 argument .CLZ/.CTZ calls. * tree-ssa-loop-niter.cc (build_cltz_expr): Create 2 argument .CLZ/.CTZ calls if needed. * tree-ssa-forwprop.cc (simplify_count_trailing_zeroes): Create 2 argument .CTZ calls if needed. * tree-ssa-phiopt.cc (cond_removal_in_builtin_zero_pattern): Handle 2 argument .CLZ/.CTZ calls, handle BITINT_TYPE, create 2 argument .CLZ/.CTZ calls. * doc/extend.texi (__builtin_clzg, __builtin_ctzg, __builtin_clrsbg, __builtin_ffsg, __builtin_parityg, __builtin_popcountg): Document. gcc/c-family/ * c-common.cc (check_builtin_function_arguments): Handle BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G. * c-gimplify.cc (c_gimplify_expr): If __builtin_c[lt]zg second argument hasn't been folded into constant yet, transform it to one argument call inside of a COND_EXPR which for first argument 0 returns the second argument. gcc/c/ * c-typeck.cc (convert_arguments): Don't promote first argument of BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G. gcc/cp/ * call.cc (magic_varargs_p): Return 4 for BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G. (build_over_call): Don't promote first argument of BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G. * cp-gimplify.cc (cp_gimplify_expr): For BUILT_IN_C{L,T}ZG use c_gimplify_expr. gcc/testsuite/ * c-c++-common/pr111309-1.c: New test. * c-c++-common/pr111309-2.c: New test. * gcc.dg/torture/bitint-43.c: New test. * gcc.dg/torture/bitint-44.c: New test.
-
Xi Ruoyao authored
LoongArch: Disable relaxation if the assembler don't support conditional branch relaxation [PR112330] As the commit message of r14-4674 has indicated, if the assembler does not support conditional branch relaxation, a relocation overflow may happen on conditional branches when relaxation is enabled because the number of NOP instructions inserted by the assembler will be more than the number estimated by GCC. To work around this issue, disable relaxation by default if the assembler is detected incapable to perform conditional branch relaxation at GCC build time. We also need to pass -mno-relax to the assembler to really disable relaxation. But, if the assembler does not support -mrelax option at all, we should not pass -mno-relax to the assembler or it will immediately error out. Also handle this with the build time assembler capability probing, and add a pair of options -m[no-]pass-mrelax-to-as to allow using a different assembler from the build-time one. With this change, if GCC is built with GAS 2.41, relaxation will be disabled by default. So the default value of -mexplicit-relocs= is also changed to 'always' if -mno-relax is specified or implied by the build-time default, because using assembler macros for symbol addresses produces no benefit when relaxation is disabled. gcc/ChangeLog: PR target/112330 * config/loongarch/genopts/loongarch.opt.in: Add -m[no]-pass-relax-to-as. Change the default of -m[no]-relax to account conditional branch relaxation support status. * config/loongarch/loongarch.opt: Regenerate. * configure.ac (gcc_cv_as_loongarch_cond_branch_relax): Check if the assembler supports conditional branch relaxation. * configure: Regenerate. * config.in: Regenerate. Note that there are some unrelated changes introduced by r14-5424 (which does not contain a config.in regeneration). * config/loongarch/loongarch-opts.h (HAVE_AS_COND_BRANCH_RELAXATION): Define to 0 if not defined. * config/loongarch/loongarch-driver.h (ASM_MRELAX_DEFAULT): Define. (ASM_MRELAX_SPEC): Define. (ASM_SPEC): Use ASM_MRELAX_SPEC instead of "%{mno-relax}". * config/loongarch/loongarch.cc: Take the setting of -m[no-]relax into account when determining the default of -mexplicit-relocs=. * doc/invoke.texi: Document -m[no-]relax and -m[no-]pass-mrelax-to-as for LoongArch. Update the default value of -mexplicit-relocs=.
-
liuhongt authored
if (TREE_CODE (init_expr) == INTEGER_CST) init_expr = fold_convert (TREE_TYPE (vectype), init_expr); else gcc_assert (tree_nop_conversion_p (TREE_TYPE (vectype), TREE_TYPE (init_expr))); and init_expr is a 24 bit integer type while vectype has 32bit components. The "fix" is to bail out instead of asserting. gcc/ChangeLog: PR tree-optimization/112496 * tree-vect-loop.cc (vectorizable_nonlinear_induction): Return false when !tree_nop_conversion_p (TREE_TYPE (vectype), TREE_TYPE (init_expr)). gcc/testsuite/ChangeLog: * gcc.target/i386/pr112496.c: New test.
-
Xi Ruoyao authored
LA664 defines DBAR hints 0x1 - 0x1f (except 0xf and 0x1f) as follows [1-2]: - Bit 4: kind of constraint (0: completion, 1: ordering) - Bit 3: barrier for previous read (0: true, 1: false) - Bit 2: barrier for previous write (0: true, 1: false) - Bit 1: barrier for succeeding read (0: true, 1: false) - Bit 0: barrier for succeeding write (0: true, 1: false) LLVM has already utilized them for different memory orders [3]: - Bit 4 is always set to one because it's only intended to be zero for things like MMIO devices, which are out of the scope of memory orders. - An acquire barrier is used to implement acquire loads like ld.d $a1, $t0, 0 dbar acquire_hint where the load operation (ld.d) should not be reordered with any load or store operation after the acquire load. To accomplish this constraint, we need to prevent the load operation from being reordered after the barrier, and also prevent any following load/store operation from being reordered before the barrier. Thus bits 0, 1, and 3 must be zero, and bit 2 can be one, so acquire_hint should be 0b10100. - An release barrier is used to implement release stores like dbar release_hint st.d $a1, $t0, 0 where the store operation (st.d) should not be reordered with any load or store operation before the release store. So we need to prevent the store operation from being reordered before the barrier, and also prevent any preceding load/store operation from being reordered after the barrier. So bits 0, 2, 3 must be zero, and bit 1 can be one. So release_hint should be 0b10010. A similar mapping has been utilized for RISC-V GCC [4], LoongArch Linux kernel [1], and LoongArch LLVM [3]. So the mapping should be correct. And I've also bootstrapped & regtested GCC on a LA664 with this patch. The LoongArch CPUs should treat "unknown" hints as dbar 0, so we can unconditionally emit the new hints without a compiler switch. [1]: https://git.kernel.org/torvalds/c/e031a5f3f1ed [2]: https://github.com/loongson-community/docs/pull/12 [3]: https://github.com/llvm/llvm-project/pull/68787 [4]: https://gcc.gnu.org/r14-406 gcc/ChangeLog: * config/loongarch/sync.md (mem_thread_fence): Remove redundant check. (mem_thread_fence_1): Emit finer-grained DBAR hints for different memory models, instead of 0.
-
Jakub Jelinek authored
The following testcase ICEs because BITINT_TYPE isn't handled in type_contains_placeholder_1. Given that Ada doesn't emit it, it doesn't matter that much where exactly we handle it as right now it should never contain a placeholder; I've picked the same spot as INTEGER_TYPE, but if you prefer e.g. the one with OFFSET_TYPE above, I can move it there too. 2023-11-14 Jakub Jelinek <jakub@redhat.com> PR middle-end/112511 * tree.cc (type_contains_placeholder_1): Handle BITINT_TYPE like INTEGER_TYPE. * gcc.dg/pr112511.c: New test.
-
Jakub Jelinek authored
The vblendps instruction is only VEX encoded, not EVEX, so can't be used if there are %ymm16+ or EGPR registers involved. 2023-11-14 Jakub Jelinek <jakub@redhat.com> Hu, Lin1 <lin1.hu@intel.com> PR target/112435 * config/i386/sse.md (avx512vl_shuf_<shuffletype>32x4_1<mask_name>, <mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>): Add alternative with just x instead of v constraints and xjm instead of vm and use vblendps as optimization only with that alternative. * gcc.target/i386/avx512vl-pr112435-1.c: New test. * gcc.target/i386/avx512vl-pr112435-2.c: New test. * gcc.target/i386/avx512vl-pr112435-3.c: New test.
-
Juzhe-Zhong authored
Notice the assembly check of init-2.c is wrong. Committed. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls/init-2.c: Fix vid.v check.
-
liuhongt authored
analyze_and_compute_bitop_with_inv_effect assumes the first operand is loop invariant which is not the case when it's INTEGER_CST. gcc/ChangeLog: PR tree-optimization/105735 PR tree-optimization/111972 * tree-scalar-evolution.cc (analyze_and_compute_bitop_with_inv_effect): Handle bitop with INTEGER_CST. gcc/testsuite/ChangeLog: * gcc.target/i386/pr105735-3.c: New test.
-
Sam James authored
maintainer-scripts/ * gcc_release: Cleanup whitespace. Signed-off-by:
Sam James <sam@gentoo.org>
-
Sam James authored
maintainer-scripts/ * gcc_release: Use HTTPS for links. Signed-off-by:
Sam James <sam@gentoo.org>
-
Arsen Arsenović authored
The previous commit did not include regenerating files maintained by autoheader. libcpp/ChangeLog: * config.in: Regenerate.
-
- Nov 13, 2023
-
-
Arsen Arsenović authored
This patch updates gettext.m4 and related .m4 files and adds gettext-runtime as a gmp/mpfr/... style host library, allowing newer libintl to be used. This patch /does not/ add build-time tools required for internationalizing (msgfmt et al), instead, it just updates the runtime library. The result should be a distribution that acts exactly the same when a copy of gettext is present, and disables internationalization otherwise. There should be no changes in behavior when gettext is included in-tree. When gettext is not included in tree, nor available on the system, the programs will be built without localization. ChangeLog: PR bootstrap/12596 * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. config/ChangeLog: * intlmacosx.m4: Import from gettext-0.22 (serial 8). * gettext.m4: Sync with gettext-0.22 (serial 77). * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's uninstalled-config.sh, or call AM_GNU_GETTEXT if missing. * iconv.m4: Sync with gettext-0.22 (serial 26). contrib/ChangeLog: * prerequisites.sha512: Add gettext. * prerequisites.md5: Add gettext. * download_prerequisites: Add gettext. gcc/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from LIBINTL_DEP. * doc/install.texi: Document new (notable) flags added by the optional gettext tree and by AM_GNU_GETTEXT. Document libintl/libc with gettext dependency. libcpp/ChangeLog: * configure: Regenerate. * aclocal.m4: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate.
-
Arsen Arsenović authored
ChangeLog: * intl/*: Remove.
-
Jonathan Wakely authored
I meant to add these changes as part of r14-4959-g7d06b29f814580 but missed these files out. libstdc++-v3/ChangeLog: * testsuite/std/time/clock/file/io.cc: Double timeout using dg-timeout-factor. * testsuite/std/time/clock/gps/io.cc: Likewise. * testsuite/std/time/clock/local/io.cc: Likewise. * testsuite/std/time/clock/system/io.cc: Likewise. * testsuite/std/time/clock/tai/io.cc: Likewise. * testsuite/std/time/clock/utc/io.cc: Likewise.
-
Jonathan Wakely authored
This small change removes a branch when clearing a std::optional<T> for types with no-op destructors. For types where the destructor can be optimized away (e.g. because it's trivial, or empty and can be inlined) the _M_destroy() function does nothing but set _M_engaged to false. Setting _M_engaged=false unconditionally is cheaper than only doing it when initially true, because it allows the compiler to remove a branch. The compiler thinks it would be incorrect to unconditionally introduce a store there, because it could conflict with reads in other threads, so it won't do that optimization itself. We know it's safe to do because we're in a non-const member function, so the standard forbids any potentially concurrent calls to other member functions of the same object. Making the store unconditional can't create a data race that isn't already present in the program. libstdc++-v3/ChangeLog: PR libstdc++/112480 * include/std/optional (_Optional_payload_base::_M_reset): Set _M_engaged to false unconditionally.
-
Uros Bizjak authored
Flags reg is valid only with CC mode. gcc/ChangeLog: * config/i386/i386-expand.h (gen_pushfl): New prototype. (gen_popfl): Ditto. * config/i386/i386-expand.cc (ix86_expand_builtin) [case IX86_BUILTIN_READ_FLAGS]: Use gen_pushfl. [case IX86_BUILTIN_WRITE_FLAGS]: Use gen_popfl. * config/i386/i386.cc (gen_pushfl): New function. (gen_popfl): Ditto. * config/i386/i386.md (unspec): Add UNSPEC_PUSHFL and UNSPEC_POPFL. (@pushfl<mode>2): Rename from *pushfl<mode>2. Rewrite as unspec using UNSPEC_PUSHFL. (@popfl<mode>1): Rename from *popfl<mode>1. Rewrite as unspec using UNSPEC_POPFL.
-
Uros Bizjak authored
Combine wants to combine following instructions into an insn that can perform both an (arithmetic) operation and set the condition code. During the conversion a new RTX is created, and combine passes the RTX code of the innermost RTX expression of the CC use insn in which CC reg is used to SELECT_CC_MODE, to determine the new mode of the comparison: Trying 5 -> 8: 5: r98:DI=0xd7 8: flags:CCZ=cmp(r98:DI,0) REG_EQUAL cmp(0xd7,0) Failed to match this instruction: (parallel [ (set (reg:CC 17 flags) (compare:CC (const_int 215 [0xd7]) (const_int 0 [0]))) (set (reg/v:DI 98 [ flags ]) (const_int 215 [0xd7])) ]) where: (insn 5 2 6 2 (set (reg/v:DI 98 [ flags ]) (const_int 215 [0xd7])) "pr112494.c":8:8 84 {*movdi_internal} (nil)) (insn 8 7 11 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg/v:DI 98 [ flags ]) (const_int 0 [0]))) "pr112494.c":11:9 8 {*cmpdi_ccno_1} (expr_list:REG_EQUAL (compare:CCZ (const_int 215 [0xd7]) (const_int 0 [0])) (nil))) x86_cc_mode (AKA SELECT_CC_MODE) is not prepared to handle random RTX codes and triggers gcc_unreachable() when SET RTX code is passed to it. The patch removes gcc_unreachable() and returns CCmode for unknown RTX codes, so combine can try various combinations involving CC reg without triggering ICE. Please note that x86 MOV instructions do not set flags, so the above combination is not recognized as a valid x86 instruction. PR target/112494 gcc/ChangeLog: * config/i386/i386.cc (ix86_cc_mode) [default]: Return CCmode. gcc/testsuite/ChangeLog: * gcc.target/i386/pr112494.c: New test.
-
Brendan Shanks authored
bad-mapper-1.C has been failing since the posix_spawn codepath was added to libiberty, adjust the check to accept the changed error message. Patch has been verified on x86_64 Linux. gcc/testsuite: * g++.dg/modules/bad-mapper-1.C: Also accept posix_spawn.
-
Robin Dapp authored
This patch enhances the equality check for REG_EQUAL notes in the vsetvl pass by using the == operator instead of rtx_equal_p. With that, in situations like the following, a5 and a7 are not considered equal anymore. (insn 62 60 63 4 (set (reg:DI 17 a7 [orig:154 loop_len_54 ] [154]) (umin:DI (reg:DI 15 a5 [orig:174 _100 ] [174]) (reg:DI 30 t5 [219]))) 442 {umindi3} (expr_list:REG_EQUAL (umin:DI (reg:DI 15 a5 [orig:174 _100 ] [174]) (const_int 8 [0x8])) (nil))) (insn 63 62 65 4 (set (reg:DI 15 a5 [orig:175 _103 ] [175]) (minus:DI (reg:DI 15 a5 [orig:174 _100 ] [174]) (reg:DI 17 a7 [orig:154 loop_len_54 ] [154]))) 11 {subdi3} (nil)) (insn 65 63 66 4 (set (reg:DI 16 a6 [orig:153 loop_len_53 ] [153]) (umin:DI (reg:DI 15 a5 [orig:175 _103 ] [175]) (reg:DI 30 t5 [219]))) 442 {umindi3} (expr_list:REG_EQUAL (umin:DI (reg:DI 15 a5 [orig:175 _103 ] [175]) (const_int 8 [0x8])) (nil))) gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (source_equal_p): Use pointer equality for REG_EQUAL. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_zbb.c: New test.
-
Gaius Mulley authored
This patch adds libgm2/acinclude.m4 and libgm2/configure.host which are reduced versions from libstdc++-v3. They currently allow for discovering the time features available in libc and will be extended to discover availability of ieee128 long double support in the near future. These files were also added to provide the functions: GLIBCXX_CONFIGURE, GLIBCXX_CHECK_GETTIMEOFDAY and GLIBCXX_ENABLE_LIBSTDCXX_TIME called by configure.ac. libgm2/ChangeLog: PR modula2/110779 * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Remove newline. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.in: Regenerate. * acinclude.m4: New file. * configure.host: New file. Signed-off-by:
Gaius Mulley <gaiusmod2@gmail.com>
-
Richard Earnshaw authored
This test is arm specific and requires neon. To improve compatibility add a new test for armv7-a with neon and use that. gcc/testsuite: * lib/target-supports.exp (v7a_neon): New feature-test target. * gcc.dg/debug/pr57351.c: Use it.
-
Richard Earnshaw authored
This fixes a bunch more tests that try to override the default architecture; some partially used the framework for doing this, others just blindly added a -march option, which was doomed to cause problems. In most cases we can now run these tests regardless of the users testing options and the base compiler configuration. gcc/testsuite: * lib/target-supports.exp (check_effective_target_arm_arch_FUNC_ok): Add test for v7a_arm. * gcc.target/arm/pr60650-2.c: Use require-effective-target and add-options. * gcc.target/arm/pr60657.c: Likewise. * gcc.target/arm/pr60663.c: Likewise. * gcc.target/arm/pr81863.c: Likewise. * gcc.target/arm/pr97969.c: Likewise. * gcc.target/arm/pr98931.c: Likewise. * gcc.target/arm/tail-long-call.c: Likewise.
-
Richard Earnshaw authored
Some of the standard Arm architecture tests require the test to use a specific instruction set (arm or thumb). But although the framework was checking that the flag was accepted, it wasn't checking that the flag wasn't somehow being override (eg by run-specific options). We can improve these tests easily by checking whether or not __thumb-_ is defined. gcc/testsuite: * lib/target-supports.exp (check_effective_target_arm_arch_FUNC_ok): For instruction-set specific tests, check that __thumb__ is, or isn't defined as appropriate.
-