Skip to content
Snippets Groups Projects
  1. Feb 28, 2024
  2. Feb 27, 2024
    • David Malcolm's avatar
      analyzer: use correct format code for string literal indices [PR110483,PR111802] · 939439a9
      David Malcolm authored
      
      On e.g. gcc211 the use of "%li" with unsigned HOST_WIDE_INT led to this warning:
      ../../src/gcc/analyzer/access-diagram.cc: In member function ‘void ana::string_literal_spatial_item::add_column_for_byte(text_art::table&, const ana::bit_to_table_map&, text_art::style_manager&, ana::byte_offset_t, ana::byte_offset_t, int, int) const’:
      ../../src/gcc/analyzer/access-diagram.cc:1909:40: warning: format ‘%li’ expects argument of type ‘long int’, but argument 3 has type ‘long long unsigned int’ [-Wformat=]
                byte_idx_within_string.ulow ()));
                                              ^
      and to all values being erroneously printed as "0".
      
      Fixed thusly.
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/110483
      	PR analyzer/111802
      	* access-diagram.cc
      	(string_literal_spatial_item::add_column_for_byte): Use %wu for
      	printing unsigned HOST_WIDE_INT.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      939439a9
    • Uros Bizjak's avatar
      i386: psrlq is not used for PERM<a,{0},1,2,3,4> [PR113871] · 15d1dae0
      Uros Bizjak authored
      Also handle V2BF mode.
      
      	PR target/113871
      
      gcc/ChangeLog:
      
      	* config/i386/mmx.md (V248FI): Add V2BF mode.
      	(V24FI_32): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr113871-5a.c: New test.
      	* gcc.target/i386/pr113871-5b.c: New test.
      15d1dae0
    • Eric Botcazou's avatar
      Fix internal error on non-byte-aligned reference in GIMPLE DSE · 27534e79
      Eric Botcazou authored
      This is a regression present on the mainline, 13 and 12 branches.  For the
      attached Ada case, it's a tree checking failure on the mainline at -O:
      
      +===========================GNAT BUG DETECTED==============================+
      | 14.0.1 20240226 (experimental) [master r14-9171-g4972f97a265]  GCC error:|
      | tree check: expected tree that contains 'decl common' structure,         |
      | have 'component_ref' in tree_could_trap_p, at tree-eh.cc:2733        |
      | Error detected around /home/eric/cvs/gcc/gcc/testsuite/gnat.dg/opt104.adb:
      
      Time is a 10-byte record and Packed_Rec.T is placed at bit-offset 65 because
      of the packing. so tree-ssa-dse.cc:setup_live_bytes_from_ref has computed a
      const_size of 88 from ref->offset of 65 and ref->max_size of 80.
      
      Then in tree-ssa-dse.cc:compute_trims:
      
      411       int last_live = bitmap_last_set_bit (live);
      (gdb) next
      412       if (ref->size.is_constant (&const_size))
      (gdb)
      414           int last_orig = (const_size / BITS_PER_UNIT) - 1;
      (gdb)
      418           *trim_tail = last_orig - last_live;
      
      (gdb) call debug_bitmap (live)
      n_bits = 256, set = {0 1 2 3 4 5 6 7 8 9 10 }
      (gdb) p last_live
      $33 = 10
      (gdb) p const_size
      $34 = 80
      (gdb) p last_orig
      $35 = 9
      (gdb) p *trim_tail
      $36 = -1
      
      In other words, compute_trims is overlooking the alignment adjustments that
      setup_live_bytes_from_ref applied earlier.  Moveover it reads:
      
        /* We use sbitmaps biased such that ref->offset is bit zero and the bitmap
           extends through ref->size.  So we know that in the original bitmap
           bits 0..ref->size were true.  We don't actually need the bitmap, just
           the REF to compute the trims.  */
      
      but setup_live_bytes_from_ref used ref->max_size instead of ref->size.
      
      It appears that all the callers of compute_trims assume that ref->offset is
      byte aligned and that the trimmed bytes are relative to ref->size, so the
      patch simply adds an early return if either condition is not fulfilled.
      
      gcc/
      	* tree-ssa-dse.cc (compute_trims): Fix description.  Return early
      	if either ref->offset is not byte aligned or ref->size is not known
      	to be equal to ref->max_size.
      	(maybe_trim_complex_store): Fix description.
      	(maybe_trim_constructor_store): Likewise.
      	(maybe_trim_partially_dead_store): Likewise.
      
      gcc/testsuite/
      	* gnat.dg/opt104.ads, gnat.dg/opt104.adb: New test.
      27534e79
    • Tobias Burnus's avatar
      OpenACC: Add Fortran routines acc_{alloc,free,hostptr,deviceptr,memcpy_{to,from}_device*} · 8b3f1edf
      Tobias Burnus authored
      These routines map simply to the C counterpart and are meanwhile
      defined in OpenACC 3.3. (There are additional routine changes,
      including the Fortran addition of acc_attach/acc_detach, that
      require more work than a simple addition of an interface and
      are therefore excluded.)
      
      libgomp/ChangeLog:
      
      	* libgomp.texi (OpenACC Runtime Library Routines): Document new 3.3
      	routines that simply map to their C counterpart.
      	* openacc.f90 (openacc): Add them.
      	* openacc_lib.h: Likewise.
      	* testsuite/libgomp.oacc-fortran/acc_host_device_ptr.f90: New test.
      	* testsuite/libgomp.oacc-fortran/acc-memcpy.f90: New test.
      	* testsuite/libgomp.oacc-fortran/acc-memcpy-2.f90: New test.
      	* testsuite/libgomp.oacc-c-c++-common/lib-59.c: Crossref to f90 test.
      	* testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise.
      	* testsuite/libgomp.oacc-c-c++-common/lib-95.c: Likewise.
      8b3f1edf
    • David Malcolm's avatar
      analyzer: fix ICE on floating-point bounds [PR111881] · 43ad6ce6
      David Malcolm authored
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/111881
      	* constraint-manager.cc (bound::ensure_closed): Assert that
      	m_constant has integral type.
      	(range::add_bound): Bail out on floating point constants.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/111881
      	* c-c++-common/analyzer/conditionals-pr111881.c: New test.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      43ad6ce6
    • Richard Earnshaw's avatar
      arm: warn about deprecation of iwmmx in mmintrin.h · a82ecdea
      Richard Earnshaw authored
      GCC 13's changes file documents that iwmmx is deprecated.  Raise the bar
      by warning when the mmintrin.h header is included by users, but provide
      a way to suppress the warning.
      
      gcc:
      	* config/arm/mmintrin.h: Warn if this header is included without
      	defining __ENABLE_DEPRECATED_IWMMXT.
      a82ecdea
    • Richard Biener's avatar
      tree-optimization/114074 - CHREC multiplication and undefined overflow · a0b17980
      Richard Biener authored
      When folding a multiply CHRECs are handled like {a, +, b} * c
      is {a*c, +, b*c} but that isn't generally correct when overflow
      invokes undefined behavior.  The following uses unsigned arithmetic
      unless either a is zero or a and b have the same sign.
      
      I've used simple early outs for INTEGER_CSTs and otherwise use
      a range-query since we lack a tree_expr_nonpositive_p and
      get_range_pos_neg isn't a good fit.
      
      	PR tree-optimization/114074
      	* tree-chrec.h (chrec_convert_rhs): Default at_stmt arg to NULL.
      	* tree-chrec.cc (chrec_fold_multiply): Canonicalize inputs.
      	Handle poly vs. non-poly multiplication correctly with respect
      	to undefined behavior on overflow.
      
      	* gcc.dg/torture/pr114074.c: New testcase.
      	* gcc.dg/pr68317.c: Adjust expected location of diagnostic.
      	* gcc.dg/vect/vect-early-break_119-pr114068.c: Do not expect
      	loop to be vectorized.
      a0b17980
    • Jakub Jelinek's avatar
      expand: Add trivial folding for bit query builtins at expansion time [PR114044] · c3c44c01
      Jakub Jelinek authored
      While it seems a lot of places in various optimization passes fold
      bit query internal functions with INTEGER_CST arguments to INTEGER_CST
      when there is a lhs, when lhs is missing, all the removals of such dead
      stmts are guarded with -ftree-dce, so with -fno-tree-dce those unfolded
      ifn calls remain in the IL until expansion.  If they have large/huge
      BITINT_TYPE arguments, there is no BLKmode optab and so expansion ICEs,
      and bitint lowering doesn't touch such calls because it doesn't know they
      need touching, functions only containing those will not even be further
      processed by the pass because there are no non-small BITINT_TYPE SSA_NAMEs
      + the 2 exceptions (stores of BITINT_TYPE INTEGER_CSTs and conversions
      from BITINT_TYPE INTEGER_CSTs to floating point SSA_NAMEs) and when walking
      there is no special case for calls with BITINT_TYPE INTEGER_CSTs either,
      those are for normal calls normally handled at expansion time.
      
      So, the following patch adjust the expansion of these 6 ifns, by doing
      nothing if there is no lhs, and also just in case and user disabled all
      possible passes that would fold this handles the case of setting lhs
      to ifn call with INTEGER_CST argument.
      
      2024-02-27  Jakub Jelinek  <jakub@redhat.com>
      
      	PR rtl-optimization/114044
      	* internal-fn.def (CLRSB, CLZ, CTZ, FFS, PARITY): Use
      	DEF_INTERNAL_INT_EXT_FN macro rather than DEF_INTERNAL_INT_FN.
      	* internal-fn.h (expand_CLRSB, expand_CLZ, expand_CTZ, expand_FFS,
      	expand_PARITY): Declare.
      	* internal-fn.cc (expand_bitquery, expand_CLRSB, expand_CLZ,
      	expand_CTZ, expand_FFS, expand_PARITY): New functions.
      	(expand_POPCOUNT): Use expand_bitquery.
      
      	* gcc.dg/bitint-95.c: New test.
      c3c44c01
    • Richard Biener's avatar
      tree-optimization/114081 - dominator update for prologue peeling · 8a5d9409
      Richard Biener authored
      The following implements manual update for multi-exit loop prologue
      peeling during vectorization.
      
      	PR tree-optimization/114081
      	* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
      	Perform manual dominator update for prologue peeling.
      	(vect_do_peeling): Properly update dominators after adding the
      	prologue-around guard.
      
      	* gcc.dg/vect/vect-early-break_121-pr114081.c: New testcase.
      8a5d9409
    • Rainer Orth's avatar
      testsuite: Fix gcc.dg/attr-weakref-1.c on Solaris/x86 with as [PR70582] · 8e8eac3d
      Rainer Orth authored
      gcc.dg/attr-weakref-1.c FAILs on 32 and 64-bit Solaris/x86 with the
      native assembler:
      
      FAIL: gcc.dg/attr-weakref-1.c (test for excess errors)
      UNRESOLVED: gcc.dg/attr-weakref-1.c compilation failed to produce executable
      
      Excess errors:
      Assembler: attr-weakref-1.c
              "/var/tmp//ccUSaysF.s", line 171 : Multiply defined symbol: "Wv3a"
      
      This is a bug in the native as, which isn't seeing fixes recently.
      
      Since only a single subtest is affected, this patch omits that one.
      
      Tested on i386-pc-solaris2.11 (as and gas) and x86_64-pc-linux-gnu.
      
      2024-02-24  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	gcc/testsuite:
      	PR ipa/70582
      	* gcc.dg/attr-weakref-1.c (dg-additional-options): Define
      	SOLARIS_X86_AS as appropriate.
      	(lv3, Wv3a, pv3a): Wrap in !SOLARIS_X86_AS.
      	(main): Likewise for chk (pv3a).
      8e8eac3d
    • GCC Administrator's avatar
      Daily bump. · 1e2a3b27
      GCC Administrator authored
      1e2a3b27
  3. Feb 26, 2024
    • Georg-Johann Lay's avatar
      AVR: Tag optimization options as "Optimization". · 96773ce7
      Georg-Johann Lay authored
      Some options that are pure optimizations where not tagged as such.
      
      gcc/
      	* config/avr/avr.opt (mcall-prologues, mrelax, maccumulate-args)
      	(mstrict-X): Tag as "Optimization".
      96773ce7
    • Georg-Johann Lay's avatar
      AVR: Dead code removal. · 9b0f7ef8
      Georg-Johann Lay authored
      gcc/
      	* config/avr/avr.cc (avr_out_compare) [AVR_TINY]: Remove code in
      	an "if avr_adiw_reg_p()" block that's dead for AVR_TINY.
      9b0f7ef8
    • Harald Anlauf's avatar
      Fortran: do not evaluate polymorphic functions twice in assignment [PR114012] · 2f71e801
      Harald Anlauf authored
      	PR fortran/114012
      
      gcc/fortran/ChangeLog:
      
      	* trans-expr.cc (gfc_conv_procedure_call): Evaluate non-trivial
      	arguments just once before assigning to an unlimited polymorphic
      	dummy variable.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/pr114012.f90: New test.
      2f71e801
    • Jakub Jelinek's avatar
      varasm: Handle private COMDAT function symbol reference in readonly data section [PR113617] · 1931c403
      Jakub Jelinek authored
      If default_elf_select_rtx_section is called to put a reference to some
      local symbol defined in a comdat section into memory, which happens more often
      since the r14-4944 RA change, linking might fail.
      default_elf_select_rtx_section puts such constants into .data.rel.ro.local
      etc. sections and if linker chooses comdat sections from some other TU
      and discards the one to which a relocation in .data.rel.ro.local remains,
      linker diagnoses error.  References to private comdat symbols can only appear
      from functions or data objects in the same comdat group, so the following
      patch arranges using .data.rel.ro.local.pool.<comdat_name> and similar sections.
      
      2024-02-26  Jakub Jelinek  <jakub@redhat.com>
      	    H.J. Lu  <hjl.tools@gmail.com>
      
      	PR rtl-optimization/113617
      	* varasm.cc (default_elf_select_rtx_section): For
      	references to private symbols in comdat sections
      	use .data.relro.local.pool.<comdat>, .data.relro.pool.<comdat>
      	or .rodata.<comdat> comdat sections.
      
      	* g++.dg/other/pr113617.C: New test.
      	* g++.dg/other/pr113617.h: New test.
      	* g++.dg/other/pr113617-aux.cc: New test.
      1931c403
    • Jakub Jelinek's avatar
      c: Improve some diagnostics for __builtin_stdc_bit_* [PR114042] · 77576915
      Jakub Jelinek authored
      The PR complains that for the __builtin_stdc_bit_* "builtins" the
      diagnostics doesn't mention the name of the builtin the user used, but
      instead __builtin_{clz,ctz,popcount}g instead (which is what the FE
      immediately lowers it to).
      
      The following patch repeats the checks from check_builtin_function_arguments
      which are there done on BUILT_IN_{CLZ,CTZ,POPCOUNT}G, such that they
      diagnose it with the name of the "builtin" user actually used before it
      is gone.
      
      2024-02-26  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/114042
      	* c-parser.cc (c_parser_postfix_expression): Diagnose
      	__builtin_stdc_bit_* argument with ENUMERAL_TYPE or BOOLEAN_TYPE
      	type or if signed here rather than on the replacement builtins
      	in check_builtin_function_arguments.
      
      	* gcc.dg/builtin-stdc-bit-2.c: Adjust testcase for actual builtin
      	names rather than names of builtin replacements.
      77576915
    • Joseph Myers's avatar
      Update gcc sv.po, zh_CN.po · 10c73c11
      Joseph Myers authored
      	* sv.po, zh_CN.po: Update.
      10c73c11
    • Richard Biener's avatar
      tree-optimization/114099 - virtual LC PHIs and early exit vect · fb68e2ca
      Richard Biener authored
      In some cases exits can lack LC PHI nodes for the virtual operand.
      We have to create them when the epilog loop requires them which also
      allows us to remove some only halfway correct fixups.  This is the
      variant triggering for alternate exits.
      
      	PR tree-optimization/114099
      	* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
      	Create and fill in a needed virtual LC PHI for the alternate
      	exits.  Remove code dealing with that missing.
      
      	* gcc.dg/vect/vect-early-break_120-pr114099.c: New testcase.
      fb68e2ca
    • Richard Biener's avatar
      tree-optimization/114068 - missed virtual LC PHI after vect peeling · 8293df80
      Richard Biener authored
      When we choose the IV exit to be one leading to no virtual use we
      fail to have a virtual LC PHI even though we need it for the epilog
      entry.  The following makes sure to create it so that later updating
      works.
      
      	PR tree-optimization/114068
      	* tree-vect-loop-manip.cc (get_live_virtual_operand_on_edge):
      	New function.
      	(slpeel_tree_duplicate_loop_to_edge_cfg): Add a virtual LC PHI
      	on the main exit if needed.  Remove band-aid for the case
      	it was missing.
      
      	* gcc.dg/vect/vect-early-break_118-pr114068.c: New testcase.
      	* gcc.dg/vect/vect-early-break_119-pr114068.c: Likewise.
      8293df80
    • Juergen Christ's avatar
      Add myself to write after approval and DCO. · 146f16c9
      Juergen Christ authored
      
      ChangeLog:
      
      	* MAINTAINERS: Add myself to write after approval and DCO.
      
      Signed-off-by: default avatarJuergen Christ <jchrist@linux.ibm.com>
      146f16c9
    • Eric Botcazou's avatar
      Finalization of object allocated by anonymous access designating local type · 39c07c5a
      Eric Botcazou authored
      The finalization of objects dynamically allocated through an anonymous
      access type is deferred to the enclosing library unit in the current
      implementation and a warning is given on each of them.
      
      However this cannot be done if the designated type is local, because this
      would generate dangling references to the local finalization routine, so
      the finalization needs to be dropped in this case and the warning adjusted.
      
      gcc/ada/
      	PR ada/113893
      	* exp_ch7.adb (Build_Anonymous_Master): Do not build the master
      	for a local designated type.
      	* exp_util.adb (Build_Allocate_Deallocate_Proc): Force Needs_Fin
      	to false if no finalization master is attached to an access type
      	and assert that it is anonymous in this case.
      	* sem_res.adb (Resolve_Allocator): Mention that the object might
      	not be finalized at all in the warning given when the type is an
      	anonymous access-to-controlled type.
      
      gcc/testsuite/
      	* gnat.dg/access10.adb: New test.
      39c07c5a
    • H.J. Lu's avatar
      x86: Check interrupt instead of noreturn attribute · bb98f71b
      H.J. Lu authored
      ix86_set_func_type checks noreturn attribute to avoid incompatible
      attribute error in LTO1 on interrupt functions.  Since TREE_THIS_VOLATILE
      is set also for _Noreturn without noreturn attribute, check interrupt
      attribute for interrupt functions instead.
      
      gcc/
      
      	PR target/114097
      	* config/i386/i386-options.cc (ix86_set_func_type): Check
      	interrupt instead of noreturn attribute.
      
      gcc/testsuite/
      
      	PR target/114097
      	* gcc.target/i386/pr114097-1.c: New test.
      bb98f71b
    • Jakub Jelinek's avatar
      i386: Enable _BitInt support on ia32 · f12697f3
      Jakub Jelinek authored
      Given the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113837#c9
      comment, the following patch just attempts to implement what I think
      is best for ia32.
      
      Compared to https://gitlab.com/x86-psABIs/i386-ABI/-/issues/5 ,
      like that patch for _BitInt(64) or smaller it uses the smallest containing
      {,un}signed {char,short,int,long long} for passing/returning and
      layout of variables including in structures for alignment/size, with any
      extra bits unspecified.
      Unlike the above proposal, for larger _BitInt (i.e. _BitInt(65)+), it uses
      passing/returning/layout/alignment of structure containing minimum needed
      number of 32-bit limbs, again with the extra bits unspecified.
      This is because most operations (except copy or bitwise ops) on _BitInts
      aren't really vectorizable and will be under the hood implemented in loops
      over 32-bit limbs anyway (using 64-bit limbs under the hood would mean
      often using library implementation for the basic operations) and because
      ia32 doesn't align even long long/double in structures to 64-bit I think
      it is better to just use 32-bit alignment for that.  And I don't see
      a reason to waste 32-bit bits say for _BitInt(224) or _BitInt(288) on ia32.
      
      So, effectively it is like the x86-64 _BitInt ABI with everything divided by
      2, the only exception is that in x86-64 psABI _BitInt(128) is said to be
      already a structure of 2 limbs, which happens to be passed mostly the same
      as __int128 (except for alignment).
      
      2024-02-26  Jakub Jelinek  <jakub@redhat.com>
      
      	* config/i386/i386.cc (ix86_bitint_type_info): Add support for
      	!TARGET_64BIT.
      f12697f3
    • Rainer Orth's avatar
      testsuite: xfail gcc.c-torture/compile/pr61159.c on Solaris/x86 with as [PR61159] · a25d7d13
      Rainer Orth authored
      gcc.c-torture/compile/pr61159.c currently FAILs on 32 and 64-bit
      Solaris/x86 with the native assembler:
      
      FAIL: gcc.c-torture/compile/pr61159.c   -O0  (test for excess errors)
      FAIL: gcc.c-torture/compile/pr61159.c   -O1  (test for excess errors)
      FAIL: gcc.c-torture/compile/pr61159.c   -O2  (test for excess errors)
      FAIL: gcc.c-torture/compile/pr61159.c   -O2 -flto  (test for excess errors)
      FAIL: gcc.c-torture/compile/pr61159.c   -O2 -flto -flto-partition=none  (test for excess errors)
      FAIL: gcc.c-torture/compile/pr61159.c   -O3 -g  (test for excess errors)
      FAIL: gcc.c-torture/compile/pr61159.c   -Os  (test for excess errors)
      
      Excess errors:
      Assembler: pr61159.c
              "/var/tmp//ccRtFPva.s", line 5 : Cannot set a weak symbol to a common symbol
      
      This is a bug/limitation in the native assembler.  Given that this
      hasn't seen fixes for a long time, this patch xfails the test.
      
      Tested on i386-pc-solaris2.11 (as and gas) and x86_64-pc-linux-gnu.
      
      2024-02-24  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	gcc/testsuite:
      	PR ipa/61159
      	* gcc.c-torture/compile/pr61159.c: xfail on Solaris/x86 with as.
      a25d7d13
    • Jakub Jelinek's avatar
      match.pd: Guard 2 simplifications on integral TYPE_OVERFLOW_UNDEFINED [PR114090] · 24aa051a
      Jakub Jelinek authored
      These 2 patterns are incorrect on floating point, or for -fwrapv, or
      for -ftrapv, or the first one for unsigned types (the second one is
      mathematically correct, but we ought to just fold that to 0 instead).
      
      So, the following patch properly guards this.
      
      I think we don't need && !TYPE_OVERFLOW_SANITIZED (type) because
      in both simplifications there would be UB before and after on
      signed integer minimum.
      
      2024-02-26  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/114090
      	* match.pd ((x >= 0 ? x : 0) + (x <= 0 ? -x : 0) -> abs x):
      	Restrict pattern to ANY_INTEGRAL_TYPE_P and TYPE_OVERFLOW_UNDEFINED
      	types.
      	((x <= 0 ? -x : 0) -> max(-x, 0)): Likewise.
      
      	* gcc.dg/pr114090.c: New test.
      24aa051a
    • Jakub Jelinek's avatar
      fold-const: Avoid infinite recursion in +-*&|^minmax reassociation [PR114084] · f9d2a95b
      Jakub Jelinek authored
      In the following testcase we infinitely recurse during BIT_IOR_EXPR
      reassociation.
      One operand is (unsigned _BitInt(31)) a << 4 and another operand
      2147483647 >> 1 | 80 where both the right shift and the | 80
      trees have TREE_CONSTANT set, but weren't folded because of delayed
      folding, where some foldings are apparently done even in that case
      unfortunately.
      Now, the fold_binary_loc reassocation code splits both operands into
      variable part, minus variable part, constant part, minus constant part,
      literal part and minus literal parts, to prevent infinite recursion
      punts if there are just 2 parts altogether from the 2 operands and then goes
      on with reassociation, merges first the corresponding parts from both
      operands and then some further merges.
      The problem with the above expressions is that we get 3 different objects,
      var0 (the left shift), con1 (the right shift) and lit1 (80), so the infinite
      recursion prevention doesn't trigger, and we eventually merge con1 with
      lit1, which effectively reconstructs the original op1 and then associate
      that with var0 which is original op0, and associate_trees for that case
      calls fold_binary.  There are some casts involved there too (the T typedef
      type and the underlying _BitInt type which are stripped with STRIP_NOPS).
      
      The following patch attempts to prevent this infinite recursion by tracking
      the origin (if certain var comes from nothing - 0, op0 - 1, op1 - 2 or both - 3)
      and propagates it through all the associate_tree calls which merge the vars.
      If near the end we'd try to merge what comes solely from op0 with what comes
      solely from op1 (or vice versa), the patch punts, because then it isn't any
      kind of reassociation between the two operands, if anything it should be
      handled when folding the suboperands.
      
      2024-02-26  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/114084
      	* fold-const.cc (fold_binary_loc): Avoid the final associate_trees
      	if all subtrees of var0 come from one of the op0 or op1 operands
      	and all subtrees of con0 come from the other one.  Don't clear
      	variables which are never used afterwards.
      
      	* gcc.dg/bitint-94.c: New test.
      f9d2a95b
    • Richard Biener's avatar
      middle-end/114070 - folding breaking VEC_COND expansion · af66ad89
      Richard Biener authored
      The following properly guards the simplifications that move
      operations into VEC_CONDs, in particular when that changes the
      type constraints on this operation.
      
      This needed a genmatch fix which was recording spurious implicit fors
      when tcc_comparison is used in a C expression.
      
      	PR middle-end/114070
      	* genmatch.cc (parser::parse_c_expr): Do not record operand
      	lists but only mark operators used.
      	* match.pd ((c ? a : b) op (c ? d : e)  -->  c ? (a op d) : (b op e)):
      	Properly guard the case of tcc_comparison changing the VEC_COND
      	value operand type.
      
      	* gcc.dg/torture/pr114070.c: New testcase.
      af66ad89
    • Jakub Jelinek's avatar
      i386: Fix up x86_function_profiler -masm=intel support [PR114094] · 6987f167
      Jakub Jelinek authored
      In my r14-8214 changes I apparently forgot one \n at the end of an instruction.
      The corresponding AT&T line looks like:
      "1:\tcall\t*%s@GOTPCREL(%%rip)\n"
      but the Intel variant was
      "1:\tcall\t[QWORD PTR %s@GOTPCREL[rip]]"
      
      Fixed thusly.
      
      2024-02-26  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/114094
      	* config/i386/i386.cc (x86_function_profiler): Add missing new-line
      	to printed instruction.
      
      	* gcc.target/i386/pr114094.c: New test.
      6987f167
    • H.J. Lu's avatar
      x86: Properly implement AMX-TILE load/store intrinsics · 4972f97a
      H.J. Lu authored
      ldtilecfg and sttilecfg take a 512-byte memory block.  With
      _tile_loadconfig implemented as
      
      extern __inline void
      __attribute__((__gnu_inline__, __always_inline__, __artificial__))
      _tile_loadconfig (const void *__config)
      {
        __asm__ volatile ("ldtilecfg\t%X0" :: "m" (*((const void **)__config)));
      }
      
      GCC sees:
      
      (parallel [
        (asm_operands/v ("ldtilecfg	%X0") ("") 0
         [(mem/f/c:DI (plus:DI (reg/f:DI 77 virtual-stack-vars)
                               (const_int -64 [0xffffffffffffffc0])) [1 MEM[(const void * *)&tile_data]+0 S8 A128])]
         [(asm_input:DI ("m"))]
         (clobber (reg:CC 17 flags))])
      
      and the memory operand size is 1 byte.  As the result, the rest of 511
      bytes is ignored by GCC.  Implement ldtilecfg and sttilecfg intrinsics
      with a pointer to XImode to honor the 512-byte memory block.
      
      gcc/ChangeLog:
      
      	PR target/114098
      	* config/i386/amxtileintrin.h (_tile_loadconfig): Use
      	__builtin_ia32_ldtilecfg.
      	(_tile_storeconfig): Use __builtin_ia32_sttilecfg.
      	* config/i386/i386-builtin.def (BDESC): Add
      	__builtin_ia32_ldtilecfg and __builtin_ia32_sttilecfg.
      	* config/i386/i386-expand.cc (ix86_expand_builtin): Handle
      	IX86_BUILTIN_LDTILECFG and IX86_BUILTIN_STTILECFG.
      	* config/i386/i386.md (ldtilecfg): New pattern.
      	(sttilecfg): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/114098
      	* gcc.target/i386/amxtile-4.c: New test.
      4972f97a
    • GCC Administrator's avatar
      Daily bump. · ad178a2b
      GCC Administrator authored
      ad178a2b
  4. Feb 25, 2024
    • Iain Buclaw's avatar
      Merge dmd, druntime ceff48bf7d, phobos dcbfbd43a · 94687d17
      Iain Buclaw authored
      D front-end changes:
      
      	-   Import latest fixes from dmd v2.107.1-rc.1.
      
      D runtime changes:
      
      	-   Import latest fixes from druntime v2.107.1-rc.1.
      
      Phobos changes:
      
      	-   Import latest fixes from phobos v2.107.1-rc.1.
      
      gcc/d/ChangeLog:
      
      	* dmd/MERGE: Merge upstream dmd ceff48bf7d.
      
      libphobos/ChangeLog:
      
      	* libdruntime/MERGE: Merge upstream druntime ceff48bf7d.
      	* libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add
      	core/sys/freebsd/net/if_.d.
      	* libdruntime/Makefile.in: Regenerate.
      	* src/MERGE: Merge upstream phobos dcbfbd43a.
      94687d17
    • Jerry DeLisle's avatar
      libgfortran: Propagate user defined iostat and iomsg. · 3f58f96a
      Jerry DeLisle authored
      	PR libfortran/105456
      
      libgfortran/ChangeLog:
      
      	* io/list_read.c (list_formatted_read_scalar): Add checks
      	for the case where a user defines their own error codes
      	and error messages and generate the runtime error.
      	* io/transfer.c (st_read_done): Whitespace.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/pr105456.f90: New test.
      3f58f96a
    • Gaius Mulley's avatar
      PR modula2/113749 m2 enabled build times out on i686-gnu-hurd · d1b241b9
      Gaius Mulley authored
      
      The bug fix changes the FIO module to use the target O_RDONLY,
      O_WRONLY, SEEK_SET and SEEK_END (now available from the module wrapc).
      Also rebuilt are the bootstrap tools mc and pge as they have their
      own wrapc and C translations of FIO.
      
      gcc/m2/ChangeLog:
      
      	PR modula2/113749
      	* Make-lang.in (BUILD-PGE-O): Add m2/pge-boot/Gwrapc.o.
      	* gm2-libs-ch/wrapc.c (wrapc_SeekSet): New function.
      	(wrapc_SeekEnd): Ditto.
      	(wrapc_ReadOnly): Ditto.
      	(wrapc_WriteOnly): Ditto.
      	* gm2-libs/FIO.mod (SEEK_SET): Remove.
      	(SEEK_END): Remove.
      	(UNIXREADONLY): Remove.
      	(UNIXWRITEONLY): Remove.
      	(ConnectToUnix): Replace UNIXWRITEONLY with a call to WriteOnly.
      	Replace UNIXREADONLY with a call to ReadOnly.
      	(SetPositionFromBeginning): Replace SEEK_SET with a call to
      	SeekSet.
      	(SetPositionFromEnd): Replace SEEK_END with a call to
      	SeekEnd.
      	* gm2-libs/wrapc.def (SeekSet): New procedure function.
      	(SeekEnd): New procedure function.
      	(ReadOnly): New procedure function.
      	(WriteOnly): New procedure function.
      	* mc-boot-ch/Glibc.c (BUILD_MC_LIBC_TRACE): Undef.
      	(check_init): New function.
      	(tracedb): Ditto.
      	(tracedb_open): Ditto.
      	(tracedb_result): Ditto.
      	(libc_read): Ditto.
      	(libc_write): Ditto.
      	(libc_close): Ditto.
      	(libc_creat): Ditto.
      	(libc_open): Ditto.
      	(libc_lseek): Ditto.
      	* mc-boot-ch/Gwrapc.c (wrapc_SeekSet): New function.
      	(wrapc_SeekEnd): Ditto.
      	(wrapc_ReadOnly): Ditto.
      	(wrapc_WriteOnly): Ditto.
      	* mc-boot/GDynamicStrings.cc: Rebuilt.
      	* mc-boot/GFIO.cc: Ditto.
      	* mc-boot/GIndexing.cc: Ditto.
      	* mc-boot/GM2Dependent.cc: Ditto.
      	* mc-boot/GM2EXCEPTION.cc: Ditto.
      	* mc-boot/GPushBackInput.cc: Ditto.
      	* mc-boot/GRTExceptions.cc: Ditto.
      	* mc-boot/GRTint.cc: Ditto.
      	* mc-boot/GSArgs.cc: Ditto.
      	* mc-boot/GStdIO.cc: Ditto.
      	* mc-boot/GStringConvert.cc: Ditto.
      	* mc-boot/GSysStorage.cc: Ditto.
      	* mc-boot/Gdecl.cc: Ditto.
      	* mc-boot/Gkeyc.cc: Ditto.
      	* mc-boot/Glibc.h: Ditto.
      	* mc-boot/GmcComment.cc: Ditto.
      	* mc-boot/GmcComp.cc: Ditto.
      	* mc-boot/GmcDebug.cc: Ditto.
      	* mc-boot/GmcMetaError.cc: Ditto.
      	* mc-boot/GmcStack.cc: Ditto.
      	* mc-boot/GmcStream.cc: Ditto.
      	* mc-boot/GnameKey.cc: Ditto.
      	* mc-boot/GsymbolKey.cc: Ditto.
      	* mc-boot/Gvarargs.cc: Ditto.
      	* mc-boot/Gwrapc.h: Ditto.
      	* mc/decl.mod (getSymName): Add pointerref clause.
      	* mc/mcStream.mod (copy): Check for an error after every read.
      	* mc/varargs.mod (copy): Rewrite pointer arithmetic using INC to
      	avoid type incompatibility.
      	* pge-boot/GDynamicStrings.cc: Rebuilt.
      	* pge-boot/GDynamicStrings.h: Ditto.
      	* pge-boot/GFIO.cc: Ditto.
      	* pge-boot/GFIO.h: Ditto.
      	* pge-boot/GIO.cc: Ditto.
      	* pge-boot/GIndexing.cc: Ditto.
      	* pge-boot/GM2Dependent.cc: Ditto.
      	* pge-boot/GM2EXCEPTION.cc: Ditto.
      	* pge-boot/GNameKey.cc: Ditto.
      	* pge-boot/GPushBackInput.cc: Ditto.
      	* pge-boot/GRTExceptions.cc: Ditto.
      	* pge-boot/GStdIO.cc: Ditto.
      	* pge-boot/GSymbolKey.cc: Ditto.
      	* pge-boot/GSysStorage.cc: Ditto.
      	* pge-boot/Glibc.h: Ditto.
      	* pge-boot/Gwrapc.cc: Ditto.
      	* pge-boot/Gwrapc.h: Ditto.
      
      libgm2/ChangeLog:
      
      	PR modula2/113749
      	* libm2pim/wrapc.cc: Include fcntl.h.
      	(SeekSet): New function.
      	(SeekEnd): Ditto.
      	(ReadOnly): Ditto.
      	(WriteOnly): Ditto.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      d1b241b9
    • GCC Administrator's avatar
      Daily bump. · 5c45dc1b
      GCC Administrator authored
      5c45dc1b
  5. Feb 24, 2024
    • Richard Sandiford's avatar
      vect: Tighten check for impossible SLP layouts [PR113205] · 0394ae31
      Richard Sandiford authored
      During its forward pass, the SLP layout code tries to calculate
      the cost of a layout change on an incoming edge.  This is taken
      as the minimum of two costs: one in which the source partition
      keeps its current layout (chosen earlier during the pass) and
      one in which the source partition switches to the new layout.
      The latter can sometimes be arranged by the backward pass.
      
      If only one of the costs is valid, the other cost was ignored.
      But the PR shows that this is not safe.  If the source partition
      has layout 0 (the normal layout), we have to be prepared to handle
      the case in which that ends up being the only valid layout.
      
      Other code already accounts for this restriction, e.g. see
      the code starting with:
      
          /* Reject the layout if it would make layout 0 impossible
             for later partitions.  This amounts to testing that the
             target supports reversing the layout change on edges
             to later partitions.
      
      gcc/
      	PR tree-optimization/113205
      	* tree-vect-slp.cc (vect_optimize_slp_pass::forward_cost): Reject
      	the proposed layout if it does not allow a source partition with
      	layout 2 to keep that layout.
      
      gcc/testsuite/
      	PR tree-optimization/113205
      	* gcc.dg/torture/pr113205.c: New test.
      0394ae31
    • Jakub Jelinek's avatar
      Use HOST_WIDE_INT_{C,UC,0,0U,1,1U} macros some more · d8b74d0b
      Jakub Jelinek authored
      I've searched for some uses of (HOST_WIDE_INT) constant or (unsigned
      HOST_WIDE_INT) constant and turned them into uses of the appropriate
      macros.
      THere are quite a few cases in non-i386 backends but I've left that out
      for now.
      The only behavior change is in build_replicated_int_cst where the
      left shift was done in HOST_WIDE_INT type but assigned to unsigned
      HOST_WIDE_INT, which I've changed into unsigned HOST_WIDE_INT shift.
      
      2024-02-24  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/
      	* builtins.cc (fold_builtin_isascii): Use HOST_WIDE_INT_UC macro.
      	* combine.cc (make_field_assignment): Use HOST_WIDE_INT_1U macro.
      	* double-int.cc (double_int::mask): Use HOST_WIDE_INT_UC macros.
      	* genattrtab.cc (attr_alt_complement): Use HOST_WIDE_INT_1 macro.
      	(mk_attr_alt): Use HOST_WIDE_INT_0 macro.
      	* genautomata.cc (bitmap_set_bit, CLEAR_BIT): Use HOST_WIDE_INT_1
      	macros.
      	* ipa-strub.cc (can_strub_internally_p): Use HOST_WIDE_INT_1 macro.
      	* loop-iv.cc (implies_p): Use HOST_WIDE_INT_1U macro.
      	* pretty-print.cc (test_pp_format): Use HOST_WIDE_INT_C and
      	HOST_WIDE_INT_UC macros.
      	* rtlanal.cc (nonzero_bits1): Use HOST_WIDE_INT_UC macro.
      	* tree.cc (build_replicated_int_cst): Use HOST_WIDE_INT_1U macro.
      	* tree.h (DECL_OFFSET_ALIGN): Use HOST_WIDE_INT_1U macro.
      	* tree-ssa-structalias.cc (dump_varinfo): Use ~HOST_WIDE_INT_0U
      	macros.
      	* wide-int.cc (divmod_internal_2): Use HOST_WIDE_INT_1U macro.
      	* config/i386/constraints.md (define_constraint "L"): Use
      	HOST_WIDE_INT_C macro.
      	* config/i386/i386.md (movabsq split peephole2): Use HOST_WIDE_INT_C
      	macro.
      	(movl + movb peephole2): Likewise.
      	* config/i386/predicates.md (x86_64_zext_immediate_operand): Likewise.
      	(const_32bit_mask): Likewise.
      gcc/objc/
      	* objc-encoding.cc (encode_array): Use HOST_WIDE_INT_0 macros.
      d8b74d0b
    • Jakub Jelinek's avatar
      bitint: Handle VIEW_CONVERT_EXPRs between large/huge BITINT_TYPEs and... · 5e7a176e
      Jakub Jelinek authored
      bitint: Handle VIEW_CONVERT_EXPRs between large/huge BITINT_TYPEs and VECTOR/COMPLEX_TYPE etc. [PR114073]
      
      The following patch implements support for VIEW_CONVERT_EXPRs from/to
      large/huge _BitInt to/from vector or complex types or anything else but
      integral/pointer types which doesn't need to live in memory.
      
      2024-02-24  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/114073
      	* gimple-lower-bitint.cc (bitint_large_huge::lower_stmt): Handle
      	VIEW_CONVERT_EXPRs between large/huge _BitInt and non-integer/pointer
      	types like vector or complex types.
      	(gimple_lower_bitint): Don't merge VIEW_CONVERT_EXPRs to non-integral
      	types.  Fix up VIEW_CONVERT_EXPR handling.  Allow merging
      	VIEW_CONVERT_EXPR from non-integral/pointer types with a store.
      
      	* gcc.dg/bitint-93.c: New test.
      5e7a176e
    • Richard Sandiford's avatar
      Restrict gcc.dg/rtl/aarch64/pr113295-1.c to aarch64 · 2541c9d9
      Richard Sandiford authored
      I keep forgetting that gcc.dg/rtl is the one testsuite where
      tests in target-specific subdirectories aren't automatically
      restricted to that target.
      
      gcc/testsuite/
      	* gcc.dg/rtl/aarch64/pr113295-1.c: Restrict to aarc64*-*-*.
      2541c9d9
    • GCC Administrator's avatar
      Daily bump. · 4d9da419
      GCC Administrator authored
      4d9da419
Loading