Skip to content
Snippets Groups Projects
  1. Jun 06, 2023
  2. Jun 05, 2023
    • Andre Vieira's avatar
      Remove widen_plus/minus_expr tree codes · 8ebd1d9a
      Andre Vieira authored
      This patch removes the old widen plus/minus tree codes which have been
      replaced by internal functions.
      
      2023-06-05  Andre Vieira  <andre.simoesdiasvieira@arm.com>
      	    Joel Hutton  <joel.hutton@arm.com>
      
      gcc/ChangeLog:
      
      	* doc/generic.texi: Remove old tree codes.
      	* expr.cc (expand_expr_real_2): Remove old tree code cases.
      	* gimple-pretty-print.cc (dump_binary_rhs): Likewise.
      	* optabs-tree.cc (optab_for_tree_code): Likewise.
      	(supportable_half_widening_operation): Likewise.
      	* tree-cfg.cc (verify_gimple_assign_binary): Likewise.
      	* tree-inline.cc (estimate_operator_cost): Likewise.
      	(op_symbol_code): Likewise.
      	* tree-vect-data-refs.cc (vect_get_smallest_scalar_type): Likewise.
      	(vect_analyze_data_ref_accesses): Likewise.
      	* tree-vect-generic.cc (expand_vector_operations_1): Likewise.
      	* cfgexpand.cc (expand_debug_expr): Likewise.
      	* tree-vect-stmts.cc (vectorizable_conversion): Likewise.
      	(supportable_widening_operation): Likewise.
      	* gimple-range-op.cc (gimple_range_op_handler::maybe_non_standard):
      	Likewise.
      	* optabs.def (vec_widen_ssubl_hi_optab, vec_widen_ssubl_lo_optab,
      	vec_widen_saddl_hi_optab, vec_widen_saddl_lo_optab,
      	vec_widen_usubl_hi_optab, vec_widen_usubl_lo_optab,
      	vec_widen_uaddl_hi_optab, vec_widen_uaddl_lo_optab): Remove optabs.
      	* tree-pretty-print.cc (dump_generic_node): Remove tree code definition.
      	* tree.def (WIDEN_PLUS_EXPR, WIDEN_MINUS_EXPR, VEC_WIDEN_PLUS_HI_EXPR,
      	VEC_WIDEN_PLUS_LO_EXPR, VEC_WIDEN_MINUS_HI_EXPR,
      	VEC_WIDEN_MINUS_LO_EXPR): Likewise.
      8ebd1d9a
    • Andre Vieira's avatar
      internal-fn,vect: Refactor widen_plus as internal_fn · 2f482a07
      Andre Vieira authored
           DEF_INTERNAL_WIDENING_OPTAB_FN and DEF_INTERNAL_NARROWING_OPTAB_FN
      are like DEF_INTERNAL_SIGNED_OPTAB_FN and DEF_INTERNAL_OPTAB_FN
      respectively. With the exception that they provide convenience wrappers
      for a single vector to vector conversion, a hi/lo split or an even/odd
      split.  Each definition for <NAME> will require either signed optabs
      named <UOPTAB> and <SOPTAB> (for widening) or a single <OPTAB> (for
      narrowing) for each of the five functions it creates.
      
            For example, for widening addition the
      DEF_INTERNAL_WIDENING_OPTAB_FN will create five internal functions:
      IFN_VEC_WIDEN_PLUS, IFN_VEC_WIDEN_PLUS_HI, IFN_VEC_WIDEN_PLUS_LO,
      IFN_VEC_WIDEN_PLUS_EVEN and IFN_VEC_WIDEN_PLUS_ODD. Each requiring two
      optabs, one for signed and one for unsigned.
            Aarch64 implements the hi/lo split optabs:
            IFN_VEC_WIDEN_PLUS_HI   -> vec_widen_<su>add_hi_<mode> -> (u/s)addl2
            IFN_VEC_WIDEN_PLUS_LO  -> vec_widen_<su>add_lo_<mode> -> (u/s)addl
      
           This gives the same functionality as the previous
      WIDEN_PLUS/WIDEN_MINUS tree codes which are expanded into
      VEC_WIDEN_PLUS_LO, VEC_WIDEN_PLUS_HI.
      
      2023-06-05  Andre Vieira  <andre.simoesdiasvieira@arm.com>
      	    Joel Hutton  <joel.hutton@arm.com>
      	    Tamar Christina  <tamar.christina@arm.com>
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-simd.md (vec_widen_<su>addl_lo_<mode>): Rename
      	this ...
      	(vec_widen_<su>add_lo_<mode>): ... to this.
      	(vec_widen_<su>addl_hi_<mode>): Rename this ...
      	(vec_widen_<su>add_hi_<mode>): ... to this.
      	(vec_widen_<su>subl_lo_<mode>): Rename this ...
      	(vec_widen_<su>sub_lo_<mode>): ... to this.
      	(vec_widen_<su>subl_hi_<mode>): Rename this ...
      	(vec_widen_<su>sub_hi_<mode>): ...to this.
      	* doc/generic.texi: Document new IFN codes.
      	* internal-fn.cc (lookup_hilo_internal_fn): Add lookup function.
      	(commutative_binary_fn_p): Add widen_plus fn's.
      	(widening_fn_p): New function.
      	(narrowing_fn_p): New function.
      	(direct_internal_fn_optab): Change visibility.
      	* internal-fn.def (DEF_INTERNAL_WIDENING_OPTAB_FN): Macro to define an
      	internal_fn that expands into multiple internal_fns for widening.
      	(IFN_VEC_WIDEN_PLUS, IFN_VEC_WIDEN_PLUS_HI, IFN_VEC_WIDEN_PLUS_LO,
      	IFN_VEC_WIDEN_PLUS_EVEN, IFN_VEC_WIDEN_PLUS_ODD,
      	IFN_VEC_WIDEN_MINUS, IFN_VEC_WIDEN_MINUS_HI,
      	IFN_VEC_WIDEN_MINUS_LO, IFN_VEC_WIDEN_MINUS_ODD,
      	IFN_VEC_WIDEN_MINUS_EVEN): Define widening  plus,minus functions.
      	* internal-fn.h (direct_internal_fn_optab): Declare new prototype.
      	(lookup_hilo_internal_fn): Likewise.
      	(widening_fn_p): Likewise.
      	(Narrowing_fn_p): Likewise.
      	* optabs.cc (commutative_optab_p): Add widening plus optabs.
      	* optabs.def (OPTAB_D): Define widen add, sub optabs.
      	* tree-vect-patterns.cc (vect_recog_widen_op_pattern): Support
      	patterns with a hi/lo or even/odd split.
      	(vect_recog_sad_pattern): Refactor to use new IFN codes.
      	(vect_recog_widen_plus_pattern): Likewise.
      	(vect_recog_widen_minus_pattern): Likewise.
      	(vect_recog_average_pattern): Likewise.
      	* tree-vect-stmts.cc (vectorizable_conversion): Add support for
      	_HILO IFNs.
      	(supportable_widening_operation): Likewise.
      	* tree.def (WIDEN_SUM_EXPR): Update example to use new IFNs.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/aarch64/vect-widen-add.c: Test that new
      	IFN_VEC_WIDEN_PLUS is being used.
      	* gcc.target/aarch64/vect-widen-sub.c: Test that new
      	IFN_VEC_WIDEN_MINUS is being used.
      2f482a07
    • Andre Vieira's avatar
      vect: Refactor to allow internal_fn's · fe29963d
      Andre Vieira authored
      Refactor vect-patterns to allow patterns to be internal_fns starting
      with widening_plus/minus patterns
      
      2023-06-05  Andre Vieira  <andre.simoesdiasvieira@arm.com>
      	    Joel Hutton  <joel.hutton@arm.com>
      
      gcc/ChangeLog:
      	* tree-vect-patterns.cc: Add include for gimple-iterator.
      	(vect_recog_widen_op_pattern): Refactor to use code_helper.
      	(vect_gimple_build): New function.
      	* tree-vect-stmts.cc (simple_integer_narrowing): Refactor to use
      	code_helper.
      	(vectorizable_call): Likewise.
      	(vect_gen_widened_results_half): Likewise.
      	(vect_create_vectorized_demotion_stmts): Likewise.
      	(vect_create_vectorized_promotion_stmts): Likewise.
      	(vect_create_half_widening_stmts): Likewise.
      	(vectorizable_conversion): Likewise.
      	(supportable_widening_operation): Likewise.
      	(supportable_narrowing_operation): Likewise.
      	* tree-vectorizer.h (supportable_widening_operation): Change
      	prototype to use code_helper.
      	(supportable_narrowing_operation): Likewise.
      	(vect_gimple_build): New function prototype.
      	* tree.h (code_helper::safe_as_tree_code): New function.
      	(code_helper::safe_as_fn_code): New function.
      fe29963d
    • Iain Buclaw's avatar
      d: Warn when declared size of a special enum does not match its intrinsic type. · 3ad9313a
      Iain Buclaw authored
      All special enums have declarations in the D runtime library, but the
      compiler will recognize and treat them specially if declared in any
      module.  When the underlying base type of a special enum is a different
      size to its matched intrinsic, then this can cause undefined behavior at
      runtime.  Detect and warn about when such a mismatch occurs.
      
      gcc/d/ChangeLog:
      
      	* gdc.texi (Warnings): Document -Wextra and -Wmismatched-special-enum.
      	* implement-d.texi (Special Enums): Add reference to warning option
      	-Wmismatched-special-enum.
      	* lang.opt: Add -Wextra and -Wmismatched-special-enum.
      	* types.cc (TypeVisitor::visit (TypeEnum *)): Warn when declared
      	special enum size mismatches its intrinsic type.
      
      gcc/testsuite/ChangeLog:
      
      	* gdc.dg/Wmismatched_enum.d: New test.
      3ad9313a
    • Roger Sayle's avatar
      New wi::bitreverse function. · 108ff03b
      Roger Sayle authored
      This patch provides a wide-int implementation of bitreverse, that
      implements both of Richard Sandiford's suggestions from the review at
      https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618215.html of an
      improved API (as a stand-alone function matching the bswap refactoring),
      and an implementation that works with any bit-width precision.
      
      2023-06-05  Roger Sayle  <roger@nextmovesoftware.com>
      
      gcc/ChangeLog
      	* wide-int.cc (wi::bitreverse_large): New function implementing
      	bit reversal of an integer.
      	* wide-int.h (wi::bitreverse): New (template) function prototype.
      	(bitreverse_large): Prototype helper function/implementation.
      	(wi::bitreverse): New template wrapper around bitreverse_large.
      108ff03b
    • Liao Shihua's avatar
      Testsuite: Fix a fail about xtheadcondmov-indirect-rv64.c · f7f12f0b
      Liao Shihua authored
      I find fail of the xtheadcondmov-indirect-rv64.c test case and provide a way to solve it.
      In this patch, I take Kito's advice that I modify the form of the function bodies.It likes
      *[a-x0-9].
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/xtheadcondmov-indirect-rv32.c: Generalize to be
      	less sensitive to register allocation choices.
      	* gcc.target/riscv/xtheadcondmov-indirect-rv64.c: Similarly.
      f7f12f0b
    • Uros Bizjak's avatar
      print-rtl: Change return type of two print functions from int to void · 8e1e1fc4
      Uros Bizjak authored
      Also change one internal variable to bool.
      
      gcc/ChangeLog:
      
      	* rtl.h (print_rtl_single): Change return type from int to void.
      	(print_rtl_single_with_indent): Ditto.
      	* print-rtl.h (class rtx_writer): Ditto.  Change m_sawclose to bool.
      	* print-rtl.cc (rtx_writer::rtx_writer): Update for m_sawclose change.
      	(rtx_writer::print_rtx_operand_code_0): Ditto.
      	(rtx_writer::print_rtx_operand_codes_E_and_V): Ditto.
      	(rtx_writer::print_rtx_operand_code_i): Ditto.
      	(rtx_writer::print_rtx_operand_code_u): Ditto.
      	(rtx_writer::print_rtx_operand): Ditto.
      	(rtx_writer::print_rtx): Ditto.
      	(rtx_writer::finish_directive): Ditto.
      	(print_rtl_single): Change return type from int to void
      	and adjust function body accordingly.
      	(rtx_writer::print_rtl_single_with_indent): Ditto.
      8e1e1fc4
    • Uros Bizjak's avatar
      reginfo: Change return type of predicate functions from int to bool · d015c658
      Uros Bizjak authored
      gcc/ChangeLog:
      
      	* rtl.h (reg_classes_intersect_p): Change return type from int to bool.
      	(reg_class_subset_p): Ditto.
      	* reginfo.cc (reg_classes_intersect_p): Ditto.
      	(reg_class_subset_p): Ditto.
      d015c658
    • Costas Argyris's avatar
      libiberty: pex-win32.c: Fix some typos. · 7ee22dc8
      Costas Argyris authored
      
      libiberty/ChangeLog:
      
      	* pex-win32.c: fix typos.
      
      Signed-off-by: default avatarCostas Argyris <costas.argyris@gmail.com>
      Signed-off-by: default avatarJonathan Yong <10walls@gmail.com>
      7ee22dc8
    • Pan Li's avatar
      RISC-V: Support RVV FP16 ZVFH floating-point intrinsic API · 71ea7a30
      Pan Li authored
      
      This patch support the intrinsic API of FP16 ZVFH floating-point. Aka
      SEW=16 for below instructions:
      
      vfadd vfsub vfrsub vfwadd vfwsub
      vfmul vfdiv vfrdiv vfwmul
      vfmacc vfnmacc vfmsac vfnmsac vfmadd
      vfnmadd vfmsub vfnmsub vfwmacc vfwnmacc vfwmsac vfwnmsac
      vfsqrt vfrsqrt7 vfrec7
      vfmin vfmax
      vfsgnj vfsgnjn vfsgnjx
      vmfeq vmfne vmflt vmfle vmfgt vmfge
      vfclass vfmerge
      vfmv
      vfcvt vfwcvt vfncvt
      
      Then users can leverage the instrinsic APIs to perform the FP=16 related
      operations. Please note not all the instrinsic APIs are coverred in the
      test files, only pick some typical ones due to too many. We will perform
      the FP16 related instrinsic API test entirely soon.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-types.def
      	(vfloat32mf2_t): New type for DEF_RVV_WEXTF_OPS.
      	(vfloat32m1_t): Ditto.
      	(vfloat32m2_t): Ditto.
      	(vfloat32m4_t): Ditto.
      	(vfloat32m8_t): Ditto.
      	(vint16mf4_t): New type for DEF_RVV_CONVERT_I_OPS.
      	(vint16mf2_t): Ditto.
      	(vint16m1_t): Ditto.
      	(vint16m2_t): Ditto.
      	(vint16m4_t): Ditto.
      	(vint16m8_t): Ditto.
      	(vuint16mf4_t): New type for DEF_RVV_CONVERT_U_OPS.
      	(vuint16mf2_t): Ditto.
      	(vuint16m1_t): Ditto.
      	(vuint16m2_t): Ditto.
      	(vuint16m4_t): Ditto.
      	(vuint16m8_t): Ditto.
      	(vint32mf2_t): New type for DEF_RVV_WCONVERT_I_OPS.
      	(vint32m1_t): Ditto.
      	(vint32m2_t): Ditto.
      	(vint32m4_t): Ditto.
      	(vint32m8_t): Ditto.
      	(vuint32mf2_t): New type for DEF_RVV_WCONVERT_U_OPS.
      	(vuint32m1_t): Ditto.
      	(vuint32m2_t): Ditto.
      	(vuint32m4_t): Ditto.
      	(vuint32m8_t): Ditto.
      	* config/riscv/vector-iterators.md: Add FP=16 support for V,
      	VWCONVERTI, VCONVERT, VNCONVERT, VMUL1 and vlmul1.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/zvfh-intrinsic.c: New test.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      71ea7a30
    • Costas Argyris's avatar
      libiberty: On Windows, pass a >32k cmdline through a response file. · 180ebb8a
      Costas Argyris authored
      
      pex-win32.c (win32_spawn): If the command line for CreateProcess
      exceeds the 32k Windows limit, try to store it in a temporary
      response file and call CreateProcess with @file instead (PR71850).
      
      Signed-off-by: default avatarCostas Argyris <costas.argyris@gmail.com>
      Signed-off-by: default avatarJonathan Yong <10walls@gmail.com>
      
      libiberty/ChangeLog:
      
      	* pex-win32.c (win32_spawn): Check command line length
      	and generate a response file if necessary.
      	(spawn_script): Adjust parameters.
      	(pex_win32_exec_child): Ditto.
      
      Signed-off-by: default avatarJonathan Yong <10walls@gmail.com>
      180ebb8a
    • Andrew Pinski's avatar
      Fix PR 110085: `make clean` in GCC directory on sh target causes a failure · afd87299
      Andrew Pinski authored
      On sh target, there is a MULTILIB_DIRNAMES (or is it MULTILIB_OPTIONS) named m2,
      this conflicts with the langauge m2. So when you do a `make clean`, it will remove
      the m2 directory and then a build will fail. Now since r0-78222-gfa9585134f6f58,
      the multilib directories are no longer created in the gcc directory as libgcc
      was moved to the toplevel. So we can remove the part of clean that removes those
      directories.
      
      Tested on x86_64-linux-gnu and a cross to sh-elf that `make clean` followed by
      `make` works again.
      
      OK?
      
      gcc/ChangeLog:
      
      	PR bootstrap/110085
      	* Makefile.in (clean): Remove the removing of
      	MULTILIB_DIR/MULTILIB_OPTIONS directories.
      afd87299
    • Kewen Lin's avatar
      libgcc: Use initarray section type for .init_stack · 83c3550e
      Kewen Lin authored
      One of my workmates found there is a warning like:
      
        libgcc/config/rs6000/morestack.S:402: Warning: ignoring
          incorrect section type for .init_array.00000
      
      when compiling libgcc/config/rs6000/morestack.S.
      
      Since commit r13-6545 touched that file recently, which was
      suspected to be responsible for this warning, I did some
      investigation and found this is a warning staying for a long
      time.  For section .init_stack*, it's preferred to use
      section type SHT_INIT_ARRAY.  So this patch is use
      "@init_array" to replace "@progbits".
      
      Although the warning is trivial, Segher suggested me to
      post this to fix it, in order to avoid any possible
      misunderstanding/confusion on the warning.
      
      As Alan confirmed, this doesn't require a premise check
      on if the existing binutils supports "@init_array" or not,
      "because if you want split-stack to work, you must link
      with gold, any version of binutils that has gold has an
      assembler that understands @init_array". (Thanks Alan!)
      
      libgcc/ChangeLog:
      
      	* config/i386/morestack.S: Use @init_array rather than
      	@progbits for section type of section .init_array.
      	* config/rs6000/morestack.S: Likewise.
      	* config/s390/morestack.S: Likewise.
      83c3550e
    • YunQiang Su's avatar
      MIPS: Add speculation_barrier support · 29b74545
      YunQiang Su authored
      speculation_barrier for MIPS needs sync+jr.hb (r2+),
      so we implement __speculation_barrier in libgcc, like arm32 does.
      
      gcc/ChangeLog:
      	* config/mips/mips-protos.h (mips_emit_speculation_barrier): New
      	prototype.
      	* config/mips/mips.cc (speculation_barrier_libfunc): New static
      	variable.
      	(mips_init_libfuncs): Initialize it.
      	(mips_emit_speculation_barrier): New function.
      	* config/mips/mips.md (speculation_barrier): Call
      	mips_emit_speculation_barrier.
      
      libgcc/ChangeLog:
      	* config/mips/lib1funcs.S: New file.
      	define __speculation_barrier and include mips16.S.
      	* config/mips/t-mips: define LIB1ASMSRC as mips/lib1funcs.S.
      	define LIB1ASMFUNCS as _speculation_barrier.
      	set version info for __speculation_barrier.
      	* config/mips/libgcc-mips.ver: New file.
      	* config/mips/t-mips16: don't define LIB1ASMSRC as mips16.S
      	included in lib1funcs.S now.
      29b74545
    • Juzhe-Zhong's avatar
      RISC-V: Reorganize riscv-v.cc · c7fe7ad6
      Juzhe-Zhong authored
      This patch is just reorganizing the functions for the following patch.
      
      I put rvv_builder and emit_* functions located before expand_const_vector
      function since I will use them in expand_const_vector in the following patch.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-v.cc (class rvv_builder): Reorganize functions.
      	(rvv_builder::can_duplicate_repeating_sequence_p): Ditto.
      	(rvv_builder::repeating_sequence_use_merge_profitable_p): Ditto.
      	(rvv_builder::get_merged_repeating_sequence): Ditto.
      	(rvv_builder::get_merge_scalar_mask): Ditto.
      	(emit_scalar_move_insn): Ditto.
      	(emit_vlmax_integer_move_insn): Ditto.
      	(emit_nonvlmax_integer_move_insn): Ditto.
      	(emit_vlmax_gather_insn): Ditto.
      	(emit_vlmax_masked_gather_mu_insn): Ditto.
      	(get_repeating_sequence_dup_machine_mode): Ditto.
      c7fe7ad6
    • Juzhe-Zhong's avatar
      RISC-V: Split arguments of expand_vec_perm · 2418cdfc
      Juzhe-Zhong authored
      Since the following patch will calls expand_vec_perm with
      splitted arguments, change the expand_vec_perm interface in
      this patch.
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec.md: Split arguments.
      	* config/riscv/riscv-protos.h (expand_vec_perm): Ditto.
      	* config/riscv/riscv-v.cc (expand_vec_perm): Ditto.
      2418cdfc
    • GCC Administrator's avatar
      Daily bump. · b4889084
      GCC Administrator authored
      b4889084
  3. Jun 04, 2023
    • Andrew Pinski's avatar
      Improve do_store_flag for comparing single bit against that bit · 6cf856f8
      Andrew Pinski authored
      This is a case which I noticed while working on the previous patch.
      Sometimes we end up with `a == CST` instead of comparing against 0.
      This happens in the following code:
      ```
      unsigned f(unsigned t)
      {
        if (t & ~(1<<30)) __builtin_unreachable();
        t ^= (1<<30);
        return t != 0;
      }
      ```
      
      We should handle the case where the nonzero bits is the same as the
      comparison operand.
      
      Changes from v1:
      * v2: Updated for the bit extraction changes.
      
      OK? Bootstrapped and tested on x86_64-linux-gnu.
      
      gcc/ChangeLog:
      
      	* expr.cc (do_store_flag): Improve for single bit testing
      	not against zero but against that single bit.
      6cf856f8
    • Andrew Pinski's avatar
      Improve do_store_flag for single bit comparison against 0 · 908e5ab5
      Andrew Pinski authored
      While working something else, I noticed we could improve
      the following function code generation:
      ```
      unsigned f(unsigned t)
      {
        if (t & ~(1<<30)) __builtin_unreachable();
        return t != 0;
      }
      ```
      Right know we just emit a comparison against 0 instead
      of just a shift right by 30.
      There is code in do_store_flag which already optimizes
      `(t & 1<<30) != 0` to `(t >> 30) & 1` (using bit extraction if available).
      This patch extends it to handle the case where we know t has a nonzero
      of just one bit set.
      
      Changes from v1:
      * v2: Updated for the bit extraction improvements.
      
      OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      gcc/ChangeLog:
      
      	* expr.cc (do_store_flag): Extend the one bit checking case
      	to handle the case where we don't have an and but rather still
      	one bit is known to be non-zero.
      908e5ab5
    • Jeff Law's avatar
      Convert H8 port to LRA · f66e0a94
      Jeff Law authored
      With Vlad's recent LRA fix to the elimination code, the H8 can be converted
      to LRA.
      
      This patch has two changes of note.
      
      First, this turns Zz into a standard constraint.  This helps reloading for
      the H8/SX movqi pattern.
      
      Second, this drops the whole pattern for the SX bit memory operations.  I
      can't see why those exist to begin with.  They should be handled by the
      standard bit manipulation patterns.   If someone wants to try and improve SX
      bit support, that'd be great and they can do so within the LRA framework :-)
      
      Pushed to the trunk...
      
      gcc/
      	* config/h8300/constraints.md (Zz): Make this a normal
      	constraint.
      	* config/h8300/h8300.cc (TARGET_LRA_P): Remove.
      	* config/h8300/logical.md (H8/SX bit patterns): Remove.
      f66e0a94
    • Takayuki 'January June' Suwa's avatar
      xtensa: Optimize boolean evaluation or branching when EQ/NE to INT_MIN · 830d36b3
      Takayuki 'January June' Suwa authored
      This patch optimizes both the boolean evaluation of and the branching of
      EQ/NE against INT_MIN (-2147483648), by taking advantage of the specifi-
      cation the ABS machine instruction on Xtensa returns INT_MIN iff INT_MIN,
      otherwise non-negative value.
      
          /* example */
          int test0(int x) {
            return (x == -2147483648);
          }
          int test1(int x) {
            return (x != -2147483648);
          }
          extern void foo(void);
          void test2(int x) {
            if(x == -2147483648)
              foo();
          }
          void test3(int x) {
            if(x != -2147483648)
              foo();
          }
      
          ;; before
          test0:
      	movi.n	a9, -1
      	slli	a9, a9, 31
      	add.n	a2, a2, a9
      	nsau	a2, a2
      	srli	a2, a2, 5
      	ret.n
          test1:
      	movi.n	a9, -1
      	slli	a9, a9, 31
      	add.n	a9, a2, a9
      	movi.n	a2, 1
      	moveqz	a2, a9, a9
      	ret.n
          test2:
      	movi.n	a9, -1
      	slli	a9, a9, 31
      	bne	a2, a9, .L3
      	j.l     foo, a9
          .L3:
      	ret.n
          test3:
      	movi.n	a9, -1
      	slli	a9, a9, 31
      	beq	a2, a9, .L5
      	j.l	foo, a9
          .L5:
      	ret.n
      
          ;; after
          test0:
      	abs	a2, a2
      	extui	a2, a2, 31, 1
      	ret.n
          test1:
      	abs	a2, a2
      	srai	a2, a2, 31
      	addi.n	a2, a2, 1
      	ret.n
          test2:
      	abs	a2, a2
      	bbci	a2, 31, .L3
      	j.l	foo, a9
          .L3:
      	ret.n
          test3:
      	abs	a2, a2
      	bbsi	a2, 31, .L5
      	j.l	foo, a9
          .L5:
      	ret.n
      
      gcc/ChangeLog:
      
      	* config/xtensa/xtensa.md (*btrue_INT_MIN, *eqne_INT_MIN):
      	New insn_and_split patterns.
      830d36b3
    • Juzhe-Zhong's avatar
      RISC-V: Remove redundant vlmul_ext_* patterns to fix PR110109 · a96ba6b9
      Juzhe-Zhong authored
      This patch is to fix PR110109 issue. This issue happens is because:
      
      (define_insn_and_split "*vlmul_extx2<mode>"
        [(set (match_operand:<VLMULX2> 0 "register_operand"  "=vr, ?&vr")
             (subreg:<VLMULX2>
               (match_operand:VLMULEXT2 1 "register_operand" " 0,   vr") 0))]
        "TARGET_VECTOR"
        "#"
        "&& reload_completed"
        [(const_int 0)]
      {
        emit_insn (gen_rtx_SET (gen_lowpart (<MODE>mode, operands[0]), operands[1]));
        DONE;
      })
      
      Such pattern generate such codes in insn-recog.cc:
      static int
      pattern57 (rtx x1)
      {
        rtx * const operands ATTRIBUTE_UNUSED = &recog_data.operand[0];
        rtx x2;
        int res ATTRIBUTE_UNUSED;
        if (maybe_ne (SUBREG_BYTE (x1).to_constant (), 0))
          return -1;
      ...
      
      PR110109 ICE at maybe_ne (SUBREG_BYTE (x1).to_constant (), 0) since for scalable
      RVV modes can not be accessed as SUBREG_BYTE (x1).to_constant ()
      
      I create that patterns is to optimize the following test:
      vfloat32m2_t test_vlmul_ext_v_f32mf2_f32m2(vfloat32mf2_t op1) {
        return __riscv_vlmul_ext_v_f32mf2_f32m2(op1);
      }
      
      codegen:
      test_vlmul_ext_v_f32mf2_f32m2:
              vsetvli a5,zero,e32,m2,ta,ma
              vmv.v.i v2,0
              vsetvli a5,zero,e32,mf2,ta,ma
              vle32.v v2,0(a1)
              vs2r.v  v2,0(a0)
              ret
      
      There is a redundant 'vmv.v.i' here, Since GCC doesn't undefine IR
      (unlike LLVM, LLVM has undef/poison).  For vlmul_ext_* RVV intrinsic,
      GCC will initiate all zeros into register. However, I think it's not
      a big issue after we support subreg livness tracking.
      
      	PR target/110109
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc: Change expand approach.
      	* config/riscv/vector.md (@vlmul_extx2<mode>): Remove it.
      	(@vlmul_extx4<mode>): Ditto.
      	(@vlmul_extx8<mode>): Ditto.
      	(@vlmul_extx16<mode>): Ditto.
      	(@vlmul_extx32<mode>): Ditto.
      	(@vlmul_extx64<mode>): Ditto.
      	(*vlmul_extx2<mode>): Ditto.
      	(*vlmul_extx4<mode>): Ditto.
      	(*vlmul_extx8<mode>): Ditto.
      	(*vlmul_extx16<mode>): Ditto.
      	(*vlmul_extx32<mode>): Ditto.
      	(*vlmul_extx64<mode>): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/pr110109-1.c: New test.
      	* gcc.target/riscv/rvv/base/pr110109-2.c: New test.
      a96ba6b9
    • Pan Li's avatar
      RISC-V: Support RVV FP16 ZVFHMIN intrinsic API · 5c9cffa3
      Pan Li authored
      
      This patch support the 2 intrinsic API of FP16 ZVFHMIN extension. Aka
      SEW=16 for below instructions
      
      vfwcvt.f.f.v
      vfncvt.f.f.w
      
      Then users can leverage the instrinsic APIs to perform the conversion
      between RVV vector single float point and half float point.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-types.def
      	(vfloat32mf2_t): Add vfloat32mf2_t type to vfncvt.f.f.w operations.
      	(vfloat32m1_t): Likewise.
      	(vfloat32m2_t): Likewise.
      	(vfloat32m4_t): Likewise.
      	(vfloat32m8_t): Likewise.
      	* config/riscv/riscv-vector-builtins.def: Fix typo in comments.
      	* config/riscv/vector-iterators.md: Add single to half machine
      	mode conversion.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/zvfhmin-intrinsic.c: New test.
      5c9cffa3
    • Juzhe-Zhong's avatar
      RISC-V: Move optimization patterns into autovec-opt.md · 13309771
      Juzhe-Zhong authored
      Move all optimization patterns into autovec-opt.md to make organization
      easier maintain.
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec-opt.md (*<optab>not<mode>): Move to autovec-opt.md.
      	(*n<optab><mode>): Ditto.
      	* config/riscv/autovec.md (*<optab>not<mode>): Ditto.
      	(*n<optab><mode>): Ditto.
      	* config/riscv/vector.md: Ditto.
      13309771
    • Roger Sayle's avatar
      PR target/110083: Fix-up REG_EQUAL notes on COMPARE in STV. · 8ab9fb6b
      Roger Sayle authored
      This patch fixes PR target/110083, an ICE-on-valid regression exposed by
      my recent PTEST improvements (to address PR target/109973).  The latent
      bug (admittedly mine) is that the scalar-to-vector (STV) pass doesn't update
      or delete REG_EQUAL notes attached to COMPARE instructions.  As a result
      the operands of COMPARE would be mismatched, with the register transformed
      to V1TImode, but the immediate operand left as const_wide_int, which is
      valid for TImode but not V1TImode.  This remained latent when the STV
      conversion converted the mode of the COMPARE to CCmode, with later passes
      recognizing the REG_EQUAL note is obviously invalid as the modes didn't
      match, but now that we (correctly) preserve the CCZmode on COMPARE, the
      mismatched operand modes trigger a sanity checking ICE downstream.
      
      Fixed by updating (or deleting) any REG_EQUAL notes in convert_compare.
      
      Before:
          (expr_list:REG_EQUAL (compare:CCZ (reg:V1TI 119 [ ivin.29_38 ])
              (const_wide_int 0x80000000000000000000000000000000))
      
      After:
          (expr_list:REG_EQUAL (compare:CCZ (reg:V1TI 119 [ ivin.29_38 ])
              (const_vector:V1TI [
                  (const_wide_int 0x80000000000000000000000000000000)
               ]))
      
      2023-06-04  Roger Sayle  <roger@nextmovesoftware.com>
      
      gcc/ChangeLog
      	PR target/110083
      	* config/i386/i386-features.cc (scalar_chain::convert_compare):
      	Update or delete REG_EQUAL notes, converting CONST_INT and
      	CONST_WIDE_INT immediate operands to a suitable CONST_VECTOR.
      
      gcc/testsuite/ChangeLog
      	PR target/110083
      	* gcc.target/i386/pr110083.c: New test case.
      8ab9fb6b
    • Jason Merrill's avatar
      c++: use __cxa_call_terminate for MUST_NOT_THROW [PR97720] · 2415024e
      Jason Merrill authored
      [except.handle]/7 says that when we enter std::terminate due to a throw,
      that is considered an active handler.  We already implemented that properly
      for the case of not finding a handler (__cxa_throw calls __cxa_begin_catch
      before std::terminate) and the case of finding a callsite with no landing
      pad (the personality function calls __cxa_call_terminate which calls
      __cxa_begin_catch), but for the case of a throw in a try/catch in a noexcept
      function, we were emitting a cleanup that calls std::terminate directly
      without ever calling __cxa_begin_catch to handle the exception.
      
      A straightforward way to fix this seems to be calling __cxa_call_terminate
      instead.  However, that requires exporting it from libstdc++, which we have
      not previously done.  Despite the name, it isn't actually part of the ABI
      standard.  Nor is __cxa_call_unexpected, as far as I can tell, but that one
      is also used by clang.  For this case they use __clang_call_terminate; it
      seems reasonable to me for us to stick with __cxa_call_terminate.
      
      I also change __cxa_call_terminate to take void* for simplicity in the front
      end (and consistency with __cxa_call_unexpected) but that isn't necessary if
      it's undesirable for some reason.
      
      This patch does not fix the issue that representing the noexcept as a
      cleanup is wrong, and confuses the handler search; since it looks like a
      cleanup in the EH tables, the unwinder keeps looking until it finds the
      catch in main(), which it should never have gotten to.  Without the
      try/catch in main, the unwinder would reach the end of the stack and say no
      handler was found.  The noexcept is a handler, and should be treated as one,
      as it is when the landing pad is omitted.
      
      The best fix for that issue seems to me to be to represent an
      ERT_MUST_NOT_THROW after an ERT_TRY in an action list as though it were an
      ERT_ALLOWED_EXCEPTIONS (since indeed it is an exception-specification).  The
      actual code generation shouldn't need to change (apart from the change made
      by this patch), only the action table entry.
      
      	PR c++/97720
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (enum cp_tree_index): Add CPTI_CALL_TERMINATE_FN.
      	(call_terminate_fn): New macro.
      	* cp-gimplify.cc (gimplify_must_not_throw_expr): Use it.
      	* except.cc (init_exception_processing): Set it.
      	(cp_protect_cleanup_actions): Return it.
      
      gcc/ChangeLog:
      
      	* tree-eh.cc (lower_resx): Pass the exception pointer to the
      	failure_decl.
      	* except.h: Tweak comment.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/eh_call.cc (__cxa_call_terminate): Take void*.
      	* config/abi/pre/gnu.ver: Add it.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/eh/terminate2.C: New test.
      2415024e
    • Hans-Peter Nilsson's avatar
      reload_cse_move2add: Handle trivial single_set:s · 3991b2f6
      Hans-Peter Nilsson authored
      The reload_cse_move2add part of "postreload" handled only
      insns whose PATTERN was a SET.  That excludes insns that
      e.g. clobber a flags register, which it does only for
      "simplicity".  The patch extends the "simplicity" to most
      single_set insns.  For a subset of those insns there's still
      an assumption; that the single_set of a PARALLEL insn is the
      first element in the PARALLEL.  If the assumption fails,
      it's no biggie; the optimization just isn't performed.
      Don't let the name deceive you, this optimization doesn't
      hit often, but as often (or as rarely) for LRA as for reload
      at least on e.g. cris-elf where the biggest effect was seen
      in reducing repeated addresses in copies from fixed-address
      arrays, like in gcc.c-torture/compile/pr78694.c.
      
      	* postreload.cc (move2add_use_add2_insn): Handle
      	trivial single_sets.  Rename variable PAT to SET.
      	(move2add_use_add3_insn, reload_cse_move2add): Similar.
      3991b2f6
    • Pan Li's avatar
      RISC-V: Support RVV zvfh{min} vfloat16*_t mov and spill · 8bdfa8a6
      Pan Li authored
      
      This patch would like to allow the mov and spill operation for the RVV
      vfloat16*_t types. The involved machine mode includes VNx1HF, VNx2HF,
      VNx4HF, VNx8HF, VNx16HF, VNx32HF and VNx64HF.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      Co-Authored by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-types.def
      	(vfloat16mf4_t): Add the float16 type to DEF_RVV_F_OPS.
      	(vfloat16mf2_t): Likewise.
      	(vfloat16m1_t): Likewise.
      	(vfloat16m2_t): Likewise.
      	(vfloat16m4_t): Likewise.
      	(vfloat16m8_t): Likewise.
      	* config/riscv/riscv.md: Add vfloat16*_t to attr mode.
      	* config/riscv/vector-iterators.md: Add vfloat16*_t machine mode
      	to V, V_WHOLE, V_FRACT, VINDEX, VM, VEL and sew.
      	* config/riscv/vector.md: Add vfloat16*_t machine mode to sew,
      	vlmul and ratio.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/mov-14.c: New test.
      	* gcc.target/riscv/rvv/base/spill-13.c: New test.
      8bdfa8a6
    • GCC Administrator's avatar
      Daily bump. · 321cee7e
      GCC Administrator authored
      321cee7e
  4. Jun 03, 2023
    • Fei Gao's avatar
      [RISC-V] fix cfi issue in save-restore. · 56818720
      Fei Gao authored
      This patch fixes a cfi issue introduced by
      https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=60524be1e3929d83e15fceac6e2aa053c8a6fb20
      
      Test code:
      char my_getchar();
      float getf();
      int test_f0()
      {
        int s0 = my_getchar();
        float f0 = getf();
        int b = my_getchar();
        return f0+s0+b;
      }
      
      cflags: -g -Os -march=rv32imafc -mabi=ilp32f -msave-restore -mcmodel=medlow
      
      before patch:
      test_f0:
      ...
      	.cfi_startproc
      	call	t0,__riscv_save_1
      	.cfi_offset 8, -8
      	.cfi_offset 1, -4
      	.cfi_def_cfa_offset 16
      ...
      	addi	sp,sp,-16
      	.cfi_def_cfa_offset 32
      
      ...
      
      	addi	sp,sp,16
      	.cfi_def_cfa_offset 0  // issue here
      ...
      	tail	__riscv_restore_1
      	.cfi_restore 8
      	.cfi_restore 1
      	.cfi_def_cfa_offset -16 // issue here
      	.cfi_endproc
      
      after patch:
      test_f0:
      ...
      	.cfi_startproc
      	call	t0,__riscv_save_1
      	.cfi_offset 8, -8
      	.cfi_offset 1, -4
      	.cfi_def_cfa_offset 16
      ...
      	addi	sp,sp,-16
      	.cfi_def_cfa_offset 32
      
      ...
      
      	addi	sp,sp,16
      	.cfi_def_cfa_offset 16  // corrected here
      ...
      	tail	__riscv_restore_1
      	.cfi_restore 8
      	.cfi_restore 1
      	.cfi_def_cfa_offset 0 // corrected here
      	.cfi_endproc
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv.cc (riscv_expand_epilogue): fix cfi issue with
      	correct offset.
      56818720
    • Die Li's avatar
      Remove unnecessary md pattern for TARGET_XTHEADCONDMOV · e1d2493f
      Die Li authored
      
      There are 2 small changes in this patch, but they do not affect the result.
      
      1. Remove unnecessary md pattern for TARGET_XTHEADCONDMOV in thead.md. The operands[4]
      in "if_then_else" are always comparison operations, so the generated rtl does not match
      the pattern that is expected to be deleted.
      
      2. Change operands[4] from const0_rtx to operands[1] to maintain rtl consistency. Although
      when output assembly, only operands[4] CODE will affect the output result.
      
      Signed-off-by: default avatarDie Li <lidie@eswincomputing.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/thead.md (*th_cond_gpr_mov<GPR:mode><GPR2:mode>): Delete.
      e1d2493f
    • Lehua Ding's avatar
      Add more ForEachMacros to clang-format file · d42f3ad0
      Lehua Ding authored
      contrib/
      	* clang-format (ForEachMacros): Add missing cases
      	for EXECUTE_IF_... macros.
      d42f3ad0
    • Gaius Mulley's avatar
      PR modula2/110003 Wrong source line listed for unused parameters · 7c0e2159
      Gaius Mulley authored
      
      Ensure that the parameter token position is recorded for both
      definition and implementation modules.  The shadow variable
      is created inside BuildFormalParameterSection.  The shadow
      variable needs to have the other definition or implementation module
      token position set when CheckFormalParameterSection is called.
      This allows the MetaError family of procedures to request the
      implementation module token position when reporting unused parameters.
      
      gcc/m2/ChangeLog:
      
      	PR modula2/110003
      	* gm2-compiler/P2SymBuild.mod (GetParameterShadowVar): Import.
      	(CheckFormalParameterSection): Call PutDeclared for the shadow
      	variable associated with the parameter.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      7c0e2159
    • Patrick Palka's avatar
      c++: is_specialization_of_friend confusion [PR109923] · 38af81df
      Patrick Palka authored
      The check for a non-template member function of a class template in
      is_specialization_of_friend is overbroad, and accidentally holds for a
      non-template hidden friend too, which for the testcase below causes the
      predicate to bogusly return true for
      
        decl = void non_templ_friend(A<int>, A<void>)
        friend_decl = void non_templ_friend(A<void>, A<void>)
      
      This patch refines the check appropriately.
      
      	PR c++/109923
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (is_specialization_of_friend): Fix overbroad check for
      	a non-template member function of a class template.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/template/friend79.C: New test.
      38af81df
    • Patrick Palka's avatar
      c++: simplify TEMPLATE_TEMPLATE_PARM hashing · 23bee850
      Patrick Palka authored
      r10-7815-gaa576f2a860c82 added special hashing for TEMPLATE_TEMPLATE_PARM
      to work around non-lowered ttps having TYPE_CANONICAL set but lowered
      ttps did not.  But ever since r13-737-gd0ef9e06197d14 this is no longer
      the case, and all ttps should now have TYPE_CANONICAL set.  So this
      special hashing is now unnecessary and we can fall back to always using
      TYPE_CANONICAL.
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (iterative_hash_template_arg): Don't hash
      	TEMPLATE_TEMPLATE_PARM specially.
      23bee850
    • Patrick Palka's avatar
      c++: replace in_template_function · 557cc2b7
      Patrick Palka authored
      All uses of in_template_function except for the one in cp_make_fname_decl
      seem like they could be generalized to consider any template context.
      To that end this patch replaces the predicate with a generalized
      in_template_context predicate that returns true if we're inside any
      template context.  If we legitimately need to consider only function
      contexts, as in cp_make_fname_decl, we can just additionally check e.g.
      current_function_decl.
      
      One concrete benefit of this, which the adjusted testcase below
      demonstrates, is that we no longer instantiate/odr-use entities based on
      uses within a non-function template.
      
      gcc/cp/ChangeLog:
      
      	* class.cc (build_base_path): Check in_template_context instead
      	of in_template_function.
      	(resolves_to_fixed_type_p): Likewise.
      	* cp-tree.h (in_template_context): Define.
      	(in_template_function): Remove.
      	* decl.cc (cp_make_fname_decl): Check current_function_decl
      	and in_template_context instead of in_template_function.
      	* decl2.cc (mark_used): Check in_template_context instead of
      	in_template_function.
      	* pt.cc (in_template_function): Remove.
      	* semantics.cc (enforce_access): Check in_template_context
      	instead of current_template_parms directly.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/warn/Waddress-of-packed-member2.C: No longer expect a()
      	to be marked as odr-used.
      557cc2b7
    • Patrick Palka's avatar
      c++: mangle noexcept-expr [PR70790] · 999e617d
      Patrick Palka authored
      This implements noexcept(expr) mangling and demangling as per the
      Itanium ABI.
      
      	PR c++/70790
      
      gcc/cp/ChangeLog:
      
      	* mangle.cc (write_expression): Handle NOEXCEPT_EXPR.
      
      libiberty/ChangeLog:
      
      	* cp-demangle.c (cplus_demangle_operators): Add the noexcept
      	operator.
      	(d_print_comp_inner) <case DEMANGLE_COMPONENT_UNARY>: Always
      	print parens around the operand of noexcept too.
      	* testsuite/demangle-expected: Test noexcept operator
      	demangling.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/abi/mangle78.C: New test.
      999e617d
    • Thomas Neumann's avatar
      fix radix sort on 32bit platforms [PR109670] · 38e88d41
      Thomas Neumann authored
      The radix sort uses two buffers, a1 for input and a2 for output.
      After every digit the role of the two buffers is swapped.
      When terminating the sort early the code made sure the output
      was in a2.  However, when we run out of bits, as can happen on
      32bit platforms, the sorted result was in a1, as we had just
      swapped a1 and a2.
      This patch fixes the problem by unconditionally having a1 as
      output after every loop iteration.
      
      This bug manifested itself only on 32bit platforms and even then
      only in some circumstances, as it needs frames where a swap
      is required due to differences in the top-most byte, which is
      affected by ASLR. The new logic was validated by exhaustive
      search over 32bit input values.
      
      libgcc/ChangeLog:
      	PR libgcc/109670
      	* unwind-dw2-fde.c: Fix radix sort buffer management.
      38e88d41
Loading