Skip to content
Snippets Groups Projects
  1. Oct 24, 2023
    • Andrew Pinski's avatar
      match: Fix the `popcnt(a&b) + popcnt(a|b)` pattern for types [PR111913] · 452c4f32
      Andrew Pinski authored
      So this pattern needs a little help on the gimple side of things to know what
      the type popcount should be. For most builtins, the type is the same as the input
      but popcount and others are not. And when using it with another outer expression,
      genmatch needs some slight help to know that the return type was type rather than
      the argument type.
      
      Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR tree-optimization/111913
      
      gcc/ChangeLog:
      
      	* match.pd (`popcount(X&Y) + popcount(X|Y)`): Add the resulting
      	type for popcount.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.c-torture/compile/fold-popcount-1.c: New test.
      	* gcc.dg/fold-popcount-8a.c: New test.
      452c4f32
    • Richard Sandiford's avatar
      rtl-ssa: Avoid creating duplicated phis · 3e901615
      Richard Sandiford authored
      If make_uses_available was called twice for the same use,
      we could end up trying to create duplicate definitions for
      the same extended live range.
      
      gcc/
      	* rtl-ssa/blocks.cc (function_info::create_degenerate_phi): Check
      	whether the requested phi already exists.
      3e901615
    • Richard Sandiford's avatar
      rtl-ssa: Don't insert after insns that can throw · d0eb4ace
      Richard Sandiford authored
      rtl_ssa::can_insert_after didn't handle insns that can throw.
      Fixing that avoids a regression with a later patch.
      
      gcc/
      	* rtl-ssa.h: Include cfgbuild.h.
      	* rtl-ssa/movement.h (can_insert_after): Replace is_jump with the
      	more comprehensive control_flow_insn_p.
      d0eb4ace
    • Richard Sandiford's avatar
      rtl-ssa: Fix handling of deleted insns · c97b167e
      Richard Sandiford authored
      RTL-SSA queues up some invasive changes for later.  But sometimes
      the insns involved in those changes can be deleted by later
      optimisations, making the queued change unnecessary.  This patch
      checks for that case.
      
      gcc/
      	* rtl-ssa/changes.cc (function_info::perform_pending_updates): Check
      	whether an insn has been replaced by a note.
      c97b167e
    • Richard Sandiford's avatar
      rtl-ssa: Fix null deref in first_any_insn_use · 50313dcd
      Richard Sandiford authored
      first_any_insn_use implicitly (but contrary to its documentation)
      assumed that there was at least one use.
      
      gcc/
      	* rtl-ssa/member-fns.inl (first_any_insn_use): Handle null
      	m_first_use.
      50313dcd
    • Richard Sandiford's avatar
      i386: Avoid paradoxical subreg dests in vector zero_extend · 58de8e93
      Richard Sandiford authored
      For the V2HI -> V2SI zero extension in:
      
        typedef unsigned short v2hi __attribute__((vector_size(4)));
        typedef unsigned int v2si __attribute__((vector_size(8)));
        v2si f (v2hi x) { return (v2si) {x[0], x[1]}; }
      
      ix86_expand_sse_extend would generate:
      
         (set (reg:V2HI 102)
              (const_vector:V2HI [(const_int 0 [0])
      			    (const_int 0 [0])]))
         (set (subreg:V8HI (reg:V2HI 101) 0)
              (vec_select:V8HI
                (vec_concat:V16HI (subreg:V8HI (reg/v:V2HI 99 [ x ]) 0)
                                  (subreg:V8HI (reg:V2HI 102) 0))
                (parallel [(const_int 0 [0])
                           (const_int 8 [0x8])
                           (const_int 1 [0x1])
                           (const_int 9 [0x9])
                           (const_int 2 [0x2])
                           (const_int 10 [0xa])
                           (const_int 3 [0x3])
                           (const_int 11 [0xb])])))
        (set (reg:V2SI 100)
             (subreg:V2SI (reg:V2HI 101) 0))
          (expr_list:REG_EQUAL (zero_extend:V2SI (reg/v:V2HI 99 [ x ])))
      
      But using (subreg:V8HI (reg:V2HI 101) 0) as the destination of
      the vec_select means that only the low 4 bytes of the destination
      are stored.  Only the lower half of reg 100 is well-defined.
      
      Things tend to happen to work if the register allocator ties reg 101
      to reg 100.  But it caused problems with the upcoming late-combine pass
      because we propagated the set of reg 100 into its uses.
      
      gcc/
      	* config/i386/i386-expand.cc (ix86_split_mmx_punpck): Allow the
      	destination to be wider than the sources.  Take the mode from the
      	first source.
      	(ix86_expand_sse_extend): Pass the destination directly to
      	ix86_split_mmx_punpck, rather than using a fresh register that
      	is half the size.
      58de8e93
    • Richard Sandiford's avatar
      i386: Fix unprotected REGNO in aeswidekl_operation · cc477955
      Richard Sandiford authored
      I hit an ICE in aeswidekl_operation while testing the late-combine
      pass on x86.  The predicate tested REGNO without first testing REG_P.
      
      gcc/
      	* config/i386/predicates.md (aeswidekl_operation): Protect
      	REGNO check with REG_P.
      cc477955
    • Richard Sandiford's avatar
      aarch64: Define TARGET_INSN_COST · 21416caf
      Richard Sandiford authored
      This patch adds a bare-bones TARGET_INSN_COST.  See the comment
      in the patch for the rationale.
      
      Just to get a flavour for how much difference it makes, I tried
      compiling the testsuite with -Os -fno-schedule-insns{,2} and
      seeing what effect the patch had on the number of instructions.
      Very few tests changed, but all the changes were positive:
      
        Tests   Good    Bad   Delta    Best   Worst  Median
        =====   ====    ===   =====    ====   =====  ======
           19     19      0    -177     -52      -1      -4
      
      The change for -O2 was even smaller, but more mixed:
      
        Tests   Good    Bad   Delta    Best   Worst  Median
        =====   ====    ===   =====    ====   =====  ======
            6      3      3      -8      -9       6      -2
      
      There were no obvious effects on SPEC CPU2017.
      
      The patch is needed to avoid a regression with a later change.
      
      gcc/
      	* config/aarch64/aarch64.cc (aarch64_insn_cost): New function.
      	(TARGET_INSN_COST): Define.
      21416caf
    • Richard Sandiford's avatar
      aarch64: Avoid bogus atomics match · b632a516
      Richard Sandiford authored
      The non-LSE pattern aarch64_atomic_exchange<mode> comes before the
      LSE pattern aarch64_atomic_exchange<mode>_lse.  From a recog
      perspective, the only difference between the patterns is that
      the non-LSE one clobbers CC and needs a scratch.
      
      However, combine and RTL-SSA can both add clobbers to make a
      pattern match.  This means that if they try to rerecognise an
      LSE pattern, they could end up turning it into a non-LSE pattern.
      This patch adds a !TARGET_LSE test to avoid that.
      
      This is needed to avoid a regression with later patches.
      
      gcc/
      	* config/aarch64/atomics.md (aarch64_atomic_exchange<mode>): Require
      	!TARGET_LSE.
      b632a516
    • xuli's avatar
      RISC-V: Fix ICE of RVV vget/vset intrinsic[PR111935] · b44d4ff7
      xuli authored
      Calling vget/vset intrinsic without receiving a return value will cause
      a crash. Because in this case e.target is null.
      This patch should be backported to releases/gcc-13.
      
      	PR target/111935
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc: fix bug.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/pr111935.c: New test.
      b44d4ff7
    • Sergei Trofimovich's avatar
      libgcc: make heap-based trampolines conditional on libc presence · eaf75155
      Sergei Trofimovich authored
      To build `libc` for a target one needs to build `gcc` without `libc`
      support first. Commit r14-4823-g8abddb187b3348 "libgcc: support
      heap-based trampolines" added unconditional `libc` dependency and broke
      libc-less `gcc` builds.
      
      An example failure on `x86_64-unknown-linux-gnu`:
      
          $ mkdir -p /tmp/empty
          $ ../gcc/configure \
              --disable-multilib \
              --without-headers \
              --with-newlib \
              --enable-languages=c \
              --disable-bootstrap \
              --disable-gcov \
              --disable-threads \
              --disable-shared \
              --disable-libssp \
              --disable-libquadmath \
              --disable-libgomp \
              --disable-libatomic \
              --with-build-sysroot=/tmp/empty
          $ make
          ...
          /tmp/gb/./gcc/xgcc -B/tmp/gb/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include --sysroot=/tmp/empty   -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection -mshstk -I. -I. -I../.././gcc -I/home/slyfox/dev/git/gcc/libgcc -I/home/slyfox/dev/git/gcc/libgcc/. -I/home/slyfox/dev/git/gcc/libgcc/../gcc -I/home/slyfox/dev/git/gcc/libgcc/../include  -DHAVE_CC_TLS  -DUSE_TLS  -o heap-trampoline.o -MT heap-trampoline.o -MD -MP -MF heap-trampoline.dep  -c .../gcc/libgcc/config/i386/heap-trampoline.c -fvisibility=hidden -DHIDE_EXPORTS
          ../gcc/libgcc/config/i386/heap-trampoline.c:3:10: fatal error: unistd.h: No such file or directory
              3 | #include <unistd.h>
                |          ^~~~~~~~~~
          compilation terminated.
          make[2]: *** [.../gcc/libgcc/static-object.mk:17: heap-trampoline.o] Error 1
          make[2]: Leaving directory '/tmp/gb/x86_64-pc-linux-gnu/libgcc'
          make[1]: *** [Makefile:13307: all-target-libgcc] Error 2
      
      The change inhibits any heap-based trampoline code.
      
      libgcc/
      
      	* config/aarch64/heap-trampoline.c: Disable when libc is not
      	present.
      	* config/i386/heap-trampoline.c: Ditto.
      eaf75155
    • Mark Harmstone's avatar
      Remove obsolete debugging formats from names list · 724badca
      Mark Harmstone authored
      	* opts.cc (debug_type_names): Remove stabs and xcoff.
      	(df_set_names): Adjust.
      724badca
    • Juzhe-Zhong's avatar
      RISC-V: Fix ICE of RTL CHECK on VSETVL PASS[PR111947] · 7b2984ad
      Juzhe-Zhong authored
      ICE on vsetvli a5, 8 instruction demand info.
      
      The AVL is const_int 8 which ICE on RENGO caller.
      
      Committed as it is obvious fix.
      
      	PR target/111947
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vsetvl.cc (pre_vsetvl::compute_lcm_local_properties): Add REGNO check.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/vsetvl/pr111947.c: New test.
      7b2984ad
    • GCC Administrator's avatar
      Daily bump. · 9cf2e744
      GCC Administrator authored
      9cf2e744
  2. Oct 23, 2023
    • Lewis Hyatt's avatar
      libcpp: Improve the diagnostic for poisoned identifiers [PR36887] · cb05acdc
      Lewis Hyatt authored
      The PR requests an enhancement to the diagnostic issued for the use of a
      poisoned identifier. Currently, we show the location of the usage, but not
      the location which requested the poisoning, which would be helpful for the
      user if the decision to poison an identifier was made externally, such as
      in a library header.
      
      In order to output this information, we need to remember a location_t for
      each identifier that has been poisoned, and that data needs to be preserved
      as well in a PCH. One option would be to add a field to struct cpp_hashnode,
      but there is no convenient place to add it without increasing the size of
      the struct for all identifiers. Given this facility will be needed rarely,
      it seemed better to add a second hash map, which is handled PCH-wise the
      same as the current one in gcc/stringpool.cc. This hash map associates a new
      struct cpp_hashnode_extra with each identifier that needs one. Currently
      that struct only contains the new location_t, but it could be extended in
      the future if there is other ancillary data that may be convenient to put
      there for other purposes.
      
      libcpp/ChangeLog:
      
      	PR preprocessor/36887
      	* directives.cc (do_pragma_poison): Store in the extra hash map the
      	location from which an identifier has been poisoned.
      	* lex.cc (identifier_diagnostics_on_lex): When issuing a diagnostic
      	for the use of a poisoned identifier, also add a note indicating the
      	location from which it was poisoned.
      	* identifiers.cc (alloc_node): Convert to template function.
      	(_cpp_init_hashtable): Handle the new extra hash map.
      	(_cpp_destroy_hashtable): Likewise.
      	* include/cpplib.h (struct cpp_hashnode_extra): New struct.
      	(cpp_create_reader): Update prototype to...
      	* init.cc (cpp_create_reader): ...accept an argument for the extra
      	hash table and pass it to _cpp_init_hashtable.
      	* include/symtab.h (ht_lookup): New overload for convenience.
      	* internal.h (struct cpp_reader): Add EXTRA_HASH_TABLE member.
      	(_cpp_init_hashtable): Adjust prototype.
      
      gcc/c-family/ChangeLog:
      
      	PR preprocessor/36887
      	* c-opts.cc (c_common_init_options): Pass new extra hash map
      	argument to cpp_create_reader().
      
      gcc/ChangeLog:
      
      	PR preprocessor/36887
      	* toplev.h (ident_hash_extra): Declare...
      	* stringpool.cc (ident_hash_extra): ...this new global variable.
      	(init_stringpool): Handle ident_hash_extra as well as ident_hash.
      	(ggc_mark_stringpool): Likewise.
      	(ggc_purge_stringpool): Likewise.
      	(struct string_pool_data_extra): New struct.
      	(spd2): New GC root variable.
      	(gt_pch_save_stringpool): Use spd2 to handle ident_hash_extra,
      	analogous to how spd is used to handle ident_hash.
      	(gt_pch_restore_stringpool): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	PR preprocessor/36887
      	* c-c++-common/cpp/diagnostic-poison.c: New test.
      	* g++.dg/pch/pr36887.C: New test.
      	* g++.dg/pch/pr36887.Hs: New test.
      cb05acdc
    • Ian Lance Taylor's avatar
      compiler: move Selector_expression up in file · 02aa322c
      Ian Lance Taylor authored
      This is a mechanical change to move Selector_expression up in expressions.cc.
      This will make it visible to Builtin_call_expression for later work.
      This produces a very large "git --diff", but "git diff --minimal" is clear.
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536642
      02aa322c
    • Ian Lance Taylor's avatar
      compiler: make xx_constant_value methods non-const · 597dba85
      Ian Lance Taylor authored
      This changes the Expression {numeric,string,boolean}_constant_value
      methods non-const.  This does not affect anything immediately,
      but will be useful for later CLs in this series.
      
      The only real effect is to Builtin_call_expression::do_export,
      which remains const and can no longer call numeric_constant_value.
      But it never needed to call it, as do_export runs after do_lower,
      and do_lower replaces a constant expression with the actual constant.
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536641
      597dba85
    • Ian Lance Taylor's avatar
      compiler: pass gogo to Runtime::make_call · 45a5ab05
      Ian Lance Taylor authored
      This is a boilerplate change to pass gogo to Runtime::make_call.
      It's not currently used but will be used by later CLs in this series.
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536640
      45a5ab05
    • Ian Lance Taylor's avatar
      compiler: add Expression::is_untyped method · ac50e9b7
      Ian Lance Taylor authored
      This method is not currently used by anything, but it will be used
      by later CLs in this series.
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536639
      ac50e9b7
    • Ian Lance Taylor's avatar
      syscall: add missing type conversion · 2621bd1b
      Ian Lance Taylor authored
      The gofrontend incorrectly accepted code that was missing a type conversion.
      The test case for this is bug518.go in https://go.dev/cl/536537.
      Future CLs in this series will detect the type error.
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536638
      2621bd1b
    • Robin Dapp's avatar
      vect: Allow same precision for bit-precision conversions. · 32b74c9e
      Robin Dapp authored
      In PR111794 we miss a vectorization because on riscv type precision and
      mode precision differ for mask types.  We can still vectorize when
      allowing assignments with the same precision for dest and source which
      is what this patch does.
      
      gcc/ChangeLog:
      
      	PR tree-optimization/111794
      	* tree-vect-stmts.cc (vectorizable_assignment): Add
      	same-precision exception for dest and source.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/slp-mask-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/slp-mask-run-1.c: New test.
      32b74c9e
    • Robin Dapp's avatar
      RISC-V: Add popcount fallback expander. · 82bbbb73
      Robin Dapp authored
      I didn't manage to get back to the generic vectorizer fallback for
      popcount so I figured I'd rather create a popcount fallback in the
      riscv backend.  It uses the WWG algorithm from libgcc.
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec.md (popcount<mode>2): New expander.
      	* config/riscv/riscv-protos.h (expand_popcount): Define.
      	* config/riscv/riscv-v.cc (expand_popcount): Vectorize popcount
      	with the WWG algorithm.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/unop/popcount-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/popcount-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/popcount-run-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/unop/popcount.c: New test.
      82bbbb73
    • Richard Biener's avatar
      tree-optimization/111916 - SRA of BIT_FIELD_REF of constant pool entries · 458db9b6
      Richard Biener authored
      The following adjusts a leftover BIT_FIELD_REF special-casing to only
      cover the cases general code doesn't handle.
      
      	PR tree-optimization/111916
      	* tree-sra.cc (sra_modify_assign): Do not lower all
      	BIT_FIELD_REF reads that are sra_handled_bf_read_p.
      
      	* gcc.dg/torture/pr111916.c: New testcase.
      458db9b6
    • Richard Biener's avatar
      tree-optimization/111915 - mixing grouped and non-grouped accesses · 00eb0812
      Richard Biener authored
      The change to allow SLP of non-grouped accesses failed to check
      for the case of mixing with grouped accesses.
      
      	PR tree-optimization/111915
      	* tree-vect-slp.cc (vect_build_slp_tree_1): Check all
      	accesses are either grouped or not.
      
      	* gcc.dg/vect/pr111915.c: New testcase.
      00eb0812
    • Richard Biener's avatar
      ipa/111914 - perform parameter init after remapping types · 738d4434
      Richard Biener authored
      The following addresses a mismatch in SSA name vs. symbol when
      we emit a dummy assignment when not optimizing.  The temporary
      we create is not remapped by initialize_inlined_parameters because
      we have no easy way to get at it.  The following instead emits
      the additional statement after we have remapped the type of
      the replacement variable.
      
      	PR ipa/111914
      	* tree-inline.cc (setup_one_parameter): Move code emitting
      	a dummy load when not optimizing ...
      	(initialize_inlined_parameters): ... here to after when
      	we remapped the parameter type.
      
      	* gcc.dg/pr111914.c: New testcase.
      738d4434
    • Iain Sandoe's avatar
      configure, libquadmath: Remove unintended AC_CHECK_LIBM [PR111928] · 538dcde8
      Iain Sandoe authored
      
      This was a rebase error, that managed to pass testing on Darwin and
      Linux (but fails on bare metal).
      
      	PR libquadmath/111928
      
      libquadmath/ChangeLog:
      
      	* Makefile.in: Regenerate.
      	* configure: Regenerate.
      	* configure.ac: Remove AC_CHECK_LIBM.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      538dcde8
    • Oleg Endo's avatar
      SH: Fix PR 111001 · 267e369a
      Oleg Endo authored
      gcc/ChangeLog:
      
      	PR target/111001
      	* config/sh/sh_treg_combine.cc (sh_treg_combine::record_set_of_reg):
      	Skip over nop move insns.
      267e369a
    • Tamar Christina's avatar
      middle-end: don't keep .MEM guard nodes for PHI nodes who dominate loop [PR111860] · 9ed6b22e
      Tamar Christina authored
      The previous patch tried to remove PHI nodes that dominated the first loop,
      however the correct fix is to only remove .MEM nodes.
      
      This patch thus makes the condition a bit stricter and only tries to remove
      MEM phi nodes.
      
      I couldn't figure out a way to easily determine if a particular PHI is vUSE
      related, so the patch does:
      
      1. check if the definition is a vDEF and not defined in main loop.
      2. check if the definition is a PHI and not defined in main loop.
      3. check if the definition is a default definition.
      
      For no 2 and 3 we may misidentify the PHI, in both cases the value is defined
      outside of the loop version block which also makes it ok to remove.
      
      gcc/ChangeLog:
      
      	PR tree-optimization/111860
      	* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
      	Drop .MEM nodes only.
      
      gcc/testsuite/ChangeLog:
      
      	PR tree-optimization/111860
      	* gcc.dg/vect/pr111860-2.c: New test.
      	* gcc.dg/vect/pr111860-3.c: New test.
      9ed6b22e
    • Andrew Pinski's avatar
      move the (a-b) CMP 0 ? (a-b) : (b-a) optimization from fold_cond_expr_with_comparison to match · 1acd4576
      Andrew Pinski authored
      This patch moves the `(a-b) CMP 0 ? (a-b) : (b-a)` optimization
      from fold_cond_expr_with_comparison to match.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      Changes in:
      v2: Removes `(a == b) ? 0 : (b - a)` handling since it was handled
          via r14-3606-g3d86e7f4a8ae
          Change zerop to integer_zerop for `(a - b) == 0 ? 0 : (b - a)`,
          Add `(a - b) != 0 ? (a - b) : 0` handling.
      
      gcc/ChangeLog:
      
      	* match.pd (`(A - B) CMP 0 ? (A - B) : (B - A)`):
      	New patterns.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/phi-opt-38.c: New test.
      1acd4576
    • Andrew Pinski's avatar
      Use error_mark_node after error in convert · 85e930ac
      Andrew Pinski authored
      While working on PR c/111903, I Noticed that
      convert will convert integer_zero_node to that
      type after an error instead of returning error_mark_node.
      From what I can tell this was the old way of not having
      error recovery since other places in this file does return
      error_mark_node and the places I am replacing date from
      when the file was imported into the repro (either via a gcc2 merge
      or earlier).
      
      I also had to update the objc front-end to allow for the error_mark_node
      change, I suspect you could hit the ICE without this change though.
      
      Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      gcc/ChangeLog:
      
      	* convert.cc (convert_to_pointer_1): Return error_mark_node
      	after an error.
      	(convert_to_real_1): Likewise.
      	(convert_to_integer_1): Likewise.
      	(convert_to_complex_1): Likewise.
      
      gcc/objc/ChangeLog:
      
      	* objc-gnu-runtime-abi-01.cc (build_objc_method_call): Allow
      	for error_operand after call to build_c_cast.
      	* objc-next-runtime-abi-01.cc (build_objc_method_call): Likewise.
      	* objc-next-runtime-abi-02.cc (build_v2_build_objc_method_call): Likewise.
      85e930ac
    • Andrew Pinski's avatar
      convert_to_complex vs invalid_conversion [PR111903] · 13c0d052
      Andrew Pinski authored
      convert_to_complex when creating a COMPLEX_EXPR does
      not currently check if either the real or imag parts
      was not error_mark_node. This later on confuses the gimpilfier
      when there was a SAVE_EXPR wrapped around that COMPLEX_EXPR.
      The simple fix is after calling convert inside convert_to_complex_1,
      check that the either result was an error_operand and return
      an error_mark_node in that case.
      
      Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR c/111903
      
      gcc/ChangeLog:
      
      	* convert.cc (convert_to_complex_1): Return
      	error_mark_node if either convert was an error
      	when converting from a scalar.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/float16-8.c: New test.
      13c0d052
    • Richard Biener's avatar
      tree-optimization/111917 - bougs IL after guard hoisting · d96bd4aa
      Richard Biener authored
      The unswitching code to hoist guards inserts conditions in wrong
      places.  The following fixes this, simplifying code.
      
      	PR tree-optimization/111917
      	* tree-ssa-loop-unswitch.cc (hoist_guard): Always insert
      	new conditional after last stmt.
      
      	* gcc.dg/torture/pr111917.c: New testcase.
      d96bd4aa
    • Juzhe-Zhong's avatar
      RISC-V: Fix ICE for the fusion case from vsetvl to scalar move[PR111927] · 0c4bd132
      Juzhe-Zhong authored
      ICE:
      
      during RTL pass: vsetvl
      <source>: In function 'riscv_lms_f32':
      <source>:240:1: internal compiler error: in merge, at config/riscv/riscv-vsetvl.cc:1997
        240 | }
      
      In general compatible_p (avl_equal_p) has:
      
          if (next.has_vl () && next.vl_used_by_non_rvv_insn_p ())
            return false;
      
      Don't fuse AVL of vsetvl if the VL operand is used by non-RVV instructions.
      
      It is reasonable to add it into 'can_use_next_avl_p' since we don't want to
      fuse AVL of vsetvl into a scalar move instruction which doesn't demand AVL.
      And after the fusion, we will alway use compatible_p to check whether the demand
      is correct or not.
      
      	PR target/111927
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vsetvl.cc: Fix bug.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/vsetvl/pr111927.c: New test.
      0c4bd132
    • Pan Li's avatar
      RISC-V: Remove unnecessary asm check for vec cvt · 09c9de06
      Pan Li authored
      
      The vsetvl asm check is unnecessary for the vector convert. We
      should be focus for constrait and leave the vsetvl test to the
      vsetvl pass.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/unop/cvt-0.c: Remove the vsetvl
      	asm check from func body.
      	* gcc.target/riscv/rvv/autovec/unop/cvt-1.c: Ditto.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      09c9de06
    • Jan Beulich's avatar
      libatomic: drop redundant all-multi command · 00938214
      Jan Beulich authored
      ./multilib.am already specifies this same command, and make warns about
      the earlier one being ignored when seeing the later one. All that needs
      retaining to still satisfy the preceding comment is the extra
      dependency.
      
      libatomic/
      
      	* Makefile.am (all-multi): Drop commands.
      	* Makefile.in: Update accordingly.
      00938214
    • Pan Li's avatar
      RISC-V: Bugfix for merging undef tmp register for trunc · 996785db
      Pan Li authored
      
      For trunc function autovec, there will be one step like below take MU
      for the merge operand.
      
      rtx tmp = gen_reg_rtx (vec_int_mode);
      emit_vec_cvt_x_f_rtz (tmp, op_1, mask, vec_fp_mode);
      
      The MU will leave the tmp (aka dest register) register unmasked elements
      unchanged and it is undefined here. This patch would like to adjust the
      MU to MA.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-v.cc (emit_vec_cvt_x_f_rtz): Add insn type
      	arg.
      	(expand_vec_trunc): Take MA instead of MU for cvt_x_f_rtz.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      996785db
    • Xi Ruoyao's avatar
      LoongArch: Document -mexplicit-relocs={auto,none,always} · e1b1cba1
      Xi Ruoyao authored
      gcc/ChangeLog:
      
      	* doc/invoke.texi (-mexplicit-relocs=style): Document.
      	(-mexplicit-relocs): Document as an alias of
      	-mexplicit-relocs=always.
      	(-mno-explicit-relocs): Document as an alias of
      	-mexplicit-relocs=none.
      	(-mcmodel=extreme): Mention -mexplicit-relocs=always instead of
      	-mexplicit-relocs.
      Unverified
      e1b1cba1
    • Xi Ruoyao's avatar
      LoongArch: Use explicit relocs for addresses only used for one load or store... · 83e24e8c
      Xi Ruoyao authored
      LoongArch: Use explicit relocs for addresses only used for one load or store with -mexplicit-relocs=auto and -mcmodel={normal,medium}
      
      In these cases, if we use explicit relocs, we end up with 2
      instructions:
      
          pcalau12i    t0, %pc_hi20(x)
          ld.d         t0, t0, %pc_lo12(x)
      
      If we use la.local pseudo-op, in the best scenario (x is in +/- 2MiB
      range) we still have 2 instructions:
      
          pcaddi       t0, %pcrel_20(x)
          ld.d         t0, t0, 0
      
      If x is out of the range we'll have 3 instructions.  So for these cases
      just emit machine instructions with explicit relocs.
      
      gcc/ChangeLog:
      
      	* config/loongarch/predicates.md (symbolic_pcrel_operand): New
      	predicate.
      	* config/loongarch/loongarch.md (define_peephole2): Optimize
      	la.local + ld/st to pcalau12i + ld/st if the address is only used
      	once if -mexplicit-relocs=auto and -mcmodel=normal or medium.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/loongarch/explicit-relocs-auto-single-load-store.c:
      	New test.
      	* gcc.target/loongarch/explicit-relocs-auto-single-load-store-no-anchor.c:
      	New test.
      Unverified
      83e24e8c
    • Xi Ruoyao's avatar
      LoongArch: Use explicit relocs for TLS access with -mexplicit-relocs=auto · 95db62f4
      Xi Ruoyao authored
      The linker does not know how to relax TLS access for LoongArch, so let's
      emit machine instructions with explicit relocs for TLS.
      
      gcc/ChangeLog:
      
      	* config/loongarch/loongarch.cc (loongarch_explicit_relocs_p):
      	Return true for TLS symbol types if -mexplicit-relocs=auto.
      	(loongarch_call_tls_get_addr): Replace TARGET_EXPLICIT_RELOCS
      	with la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE.
      	(loongarch_legitimize_tls_address): Likewise.
      	* config/loongarch/loongarch.md (@tls_low<mode>): Remove
      	TARGET_EXPLICIT_RELOCS from insn condition.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/loongarch/explicit-relocs-auto-tls-ld-gd.c: New
      	test.
      	* gcc.target/loongarch/explicit-relocs-auto-tls-le-ie.c: New
      	test.
      Unverified
      95db62f4
    • Xi Ruoyao's avatar
      LoongArch: Use explicit relocs for GOT access when -mexplicit-relocs=auto and... · 8811630d
      Xi Ruoyao authored
      LoongArch: Use explicit relocs for GOT access when -mexplicit-relocs=auto and LTO during a final link with linker plugin
      
      If we are performing LTO for a final link and linker plugin is enabled,
      then we are sure any GOT access may resolve to a symbol out of the link
      unit (otherwise the linker plugin will tell us the symbol should be
      resolved locally and we'll use PC-relative access instead).
      
      Produce machine instructions with explicit relocs instead of la.global
      for better scheduling.
      
      gcc/ChangeLog:
      
      	* config/loongarch/loongarch-protos.h
      	(loongarch_explicit_relocs_p): Declare new function.
      	* config/loongarch/loongarch.cc (loongarch_explicit_relocs_p):
      	Implement.
      	(loongarch_symbol_insns): Call loongarch_explicit_relocs_p for
      	SYMBOL_GOT_DISP, instead of using TARGET_EXPLICIT_RELOCS.
      	(loongarch_split_symbol): Call loongarch_explicit_relocs_p for
      	deciding if return early, instead of using
      	TARGET_EXPLICIT_RELOCS.
      	(loongarch_output_move): CAll loongarch_explicit_relocs_p
      	instead of using TARGET_EXPLICIT_RELOCS.
      	* config/loongarch/loongarch.md (*low<mode>): Remove
      	TARGET_EXPLICIT_RELOCS from insn condition.
      	(@ld_from_got<mode>): Likewise.
      	* config/loongarch/predicates.md (move_operand): Call
      	loongarch_explicit_relocs_p instead of using
      	TARGET_EXPLICIT_RELOCS.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/loongarch/explicit-relocs-auto-lto.c: New test.
      Unverified
      8811630d
Loading